From e43119ebe24e5cb1cae2ed9075504599da8183cf Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 24 Aug 2023 20:59:11 +0000 Subject: [PATCH 1/3] 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: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZtd2FyZWVuZ2luZS8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZwY2FjY2Vzcy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdlYnJpc2svLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdlYnNlY3VyaXR5c2Nhbm5lci8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdvcmtmbG93cy1leGVjdXRpb25zLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdvcmtzdGF0aW9ucy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNvbnRhaW5lci8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRhdGFmbG93Ly5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWFydGlmYWN0cmVnaXN0cnkvLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWNsb3VkYnVpbGQvLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWNvbnRhaW5lcmFuYWx5c2lzLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWlhbS1jcmVkZW50aWFscy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWlhbS8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWlkZW50aXR5LWFjY2Vzc2NvbnRleHRtYW5hZ2VyLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtYWRkcmVzc3ZhbGlkYXRpb24vLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtbWFwc3BsYXRmb3JtZGF0YXNldHMvLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtcGxhY2VzLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtcm91dGluZy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1vbml0b3JpbmctZGFzaGJvYXJkLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXByaXZhY3ktZGxwLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= --- .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../google-cloud-vmwareengine/v1/.gitignore | 14 + .../google-cloud-vmwareengine/v1/.jsdoc.js | 55 + .../google-cloud-vmwareengine/v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../google-cloud-vmwareengine/v1/README.md | 1 + .../google-cloud-vmwareengine/v1/package.json | 58 + .../cloud/vmwareengine/v1/vmwareengine.proto | 2015 +++++ .../v1/vmwareengine_resources.proto | 931 ++ ...metadata_google.cloud.vmwareengine.v1.json | 1863 ++++ .../v1/vmware_engine.create_cluster.js | 95 + ...vmware_engine.create_hcx_activation_key.js | 101 + .../v1/vmware_engine.create_network_policy.js | 102 + .../v1/vmware_engine.create_private_cloud.js | 95 + ...vmware_engine.create_private_connection.js | 100 + ...are_engine.create_vmware_engine_network.js | 105 + .../v1/vmware_engine.delete_cluster.js | 71 + .../v1/vmware_engine.delete_network_policy.js | 81 + .../v1/vmware_engine.delete_private_cloud.js | 90 + ...vmware_engine.delete_private_connection.js | 81 + ...are_engine.delete_vmware_engine_network.js | 88 + .../generated/v1/vmware_engine.get_cluster.js | 65 + .../vmware_engine.get_hcx_activation_key.js | 65 + .../v1/vmware_engine.get_network_policy.js | 65 + .../v1/vmware_engine.get_node_type.js | 65 + .../v1/vmware_engine.get_private_cloud.js | 65 + .../vmware_engine.get_private_connection.js | 65 + .../generated/v1/vmware_engine.get_subnet.js | 65 + ...vmware_engine.get_vmware_engine_network.js | 65 + .../v1/vmware_engine.list_clusters.js | 104 + .../vmware_engine.list_hcx_activation_keys.js | 83 + .../v1/vmware_engine.list_network_policies.js | 114 + .../v1/vmware_engine.list_node_types.js | 106 + .../v1/vmware_engine.list_private_clouds.js | 114 + ....list_private_connection_peering_routes.js | 80 + .../vmware_engine.list_private_connections.js | 113 + .../v1/vmware_engine.list_subnets.js | 82 + ...ware_engine.list_vmware_engine_networks.js | 113 + .../v1/vmware_engine.reset_nsx_credentials.js | 82 + ...vmware_engine.reset_vcenter_credentials.js | 82 + .../v1/vmware_engine.show_nsx_credentials.js | 66 + .../vmware_engine.show_vcenter_credentials.js | 66 + .../vmware_engine.undelete_private_cloud.js | 71 + .../v1/vmware_engine.update_cluster.js | 81 + .../v1/vmware_engine.update_network_policy.js | 86 + .../v1/vmware_engine.update_private_cloud.js | 76 + ...vmware_engine.update_private_connection.js | 86 + .../v1/vmware_engine.update_subnet.js | 71 + ...are_engine.update_vmware_engine_network.js | 87 + .../google-cloud-vmwareengine/v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 449 + .../v1/src/v1/index.ts | 19 + .../v1/src/v1/vmware_engine_client.ts | 6815 +++++++++++++++ .../src/v1/vmware_engine_client_config.json | 233 + .../v1/src/v1/vmware_engine_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 + .../v1/test/gapic_vmware_engine_v1.ts | 7762 +++++++++++++++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../google-cloud-vpcaccess/v1/.eslintignore | 7 + .../google-cloud-vpcaccess/v1/.eslintrc.json | 3 + .../google-cloud-vpcaccess/v1/.gitignore | 14 + .../google-cloud-vpcaccess/v1/.jsdoc.js | 55 + .../google-cloud-vpcaccess/v1/.mocharc.js | 33 + .../google-cloud-vpcaccess/v1/.prettierrc.js | 22 + .../google-cloud-vpcaccess/v1/README.md | 1 + .../google-cloud-vpcaccess/v1/package.json | 58 + .../cloud/vpcaccess/v1/vpc_access.proto | 248 + ...et_metadata_google.cloud.vpcaccess.v1.json | 191 + .../v1/vpc_access_service.create_connector.js | 73 + .../v1/vpc_access_service.delete_connector.js | 62 + .../v1/vpc_access_service.get_connector.js | 61 + .../v1/vpc_access_service.list_connectors.js | 71 + .../google-cloud-vpcaccess/v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 67 + .../google-cloud-vpcaccess/v1/src/v1/index.ts | 19 + .../v1/src/v1/vpc_access_service_client.ts | 1139 +++ .../v1/vpc_access_service_client_config.json | 46 + .../src/v1/vpc_access_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_vpc_access_service_v1.ts | 1382 +++ .../google-cloud-vpcaccess/v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../google-cloud-webrisk/v1/.eslintignore | 7 + .../google-cloud-webrisk/v1/.eslintrc.json | 3 + .../google-cloud-webrisk/v1/.gitignore | 14 + .../google-cloud-webrisk/v1/.jsdoc.js | 55 + .../google-cloud-webrisk/v1/.mocharc.js | 33 + .../google-cloud-webrisk/v1/.prettierrc.js | 22 + .../google-cloud-webrisk/v1/README.md | 1 + .../google-cloud-webrisk/v1/package.json | 58 + .../google/cloud/webrisk/v1/webrisk.proto | 560 ++ ...ppet_metadata_google.cloud.webrisk.v1.json | 247 + ...b_risk_service.compute_threat_list_diff.js | 76 + .../v1/web_risk_service.create_submission.js | 67 + .../v1/web_risk_service.search_hashes.js | 69 + .../v1/web_risk_service.search_uris.js | 67 + .../v1/web_risk_service.submit_uri.js | 76 + .../google-cloud-webrisk/v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 73 + .../google-cloud-webrisk/v1/src/v1/index.ts | 19 + .../v1/src/v1/web_risk_service_client.ts | 957 ++ .../v1/web_risk_service_client_config.json | 50 + .../src/v1/web_risk_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_web_risk_service_v1.ts | 961 ++ .../google-cloud-webrisk/v1/tsconfig.json | 19 + .../google-cloud-webrisk/v1/webpack.config.js | 64 + .../v1beta1/.eslintignore | 7 + .../v1beta1/.eslintrc.json | 3 + .../google-cloud-webrisk/v1beta1/.gitignore | 14 + .../google-cloud-webrisk/v1beta1/.jsdoc.js | 55 + .../google-cloud-webrisk/v1beta1/.mocharc.js | 33 + .../v1beta1/.prettierrc.js | 22 + .../google-cloud-webrisk/v1beta1/README.md | 1 + .../google-cloud-webrisk/v1beta1/package.json | 58 + .../cloud/webrisk/v1beta1/webrisk.proto | 303 + ...metadata_google.cloud.webrisk.v1beta1.json | 151 + ...rvice_v1_beta1.compute_threat_list_diff.js | 71 + ...web_risk_service_v1_beta1.search_hashes.js | 66 + .../web_risk_service_v1_beta1.search_uris.js | 66 + .../google-cloud-webrisk/v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 53 + .../v1beta1/src/v1beta1/index.ts | 19 + .../web_risk_service_v1_beta1_client.ts | 516 ++ ...b_risk_service_v1_beta1_client_config.json | 41 + .../web_risk_service_v1_beta1_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 + ...gapic_web_risk_service_v1_beta1_v1beta1.ts | 375 + .../v1beta1/tsconfig.json | 19 + .../v1beta1/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 + .../websecurityscanner/v1/crawled_url.proto | 40 + .../cloud/websecurityscanner/v1/finding.proto | 122 + .../websecurityscanner/v1/finding_addon.proto | 166 + .../v1/finding_type_stats.proto | 35 + .../websecurityscanner/v1/scan_config.proto | 193 + .../v1/scan_config_error.proto | 189 + .../websecurityscanner/v1/scan_run.proto | 110 + .../v1/scan_run_error_trace.proto | 75 + .../websecurityscanner/v1/scan_run_log.proto | 55 + .../v1/scan_run_warning_trace.proto | 61 + .../v1/web_security_scanner.proto | 337 + ...ta_google.cloud.websecurityscanner.v1.json | 579 ++ ...web_security_scanner.create_scan_config.js | 65 + ...web_security_scanner.delete_scan_config.js | 61 + .../v1/web_security_scanner.get_finding.js | 62 + .../web_security_scanner.get_scan_config.js | 61 + .../v1/web_security_scanner.get_scan_run.js | 62 + .../web_security_scanner.list_crawled_urls.js | 76 + ...ecurity_scanner.list_finding_type_stats.js | 62 + .../v1/web_security_scanner.list_findings.js | 83 + .../web_security_scanner.list_scan_configs.js | 75 + .../v1/web_security_scanner.list_scan_runs.js | 75 + .../v1/web_security_scanner.start_scan_run.js | 61 + .../v1/web_security_scanner.stop_scan_run.js | 62 + ...web_security_scanner.update_scan_config.js | 68 + .../v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 169 + .../v1/src/v1/index.ts | 19 + .../v1/src/v1/web_security_scanner_client.ts | 1810 ++++ .../web_security_scanner_client_config.json | 91 + .../v1/web_security_scanner_proto_list.json | 13 + .../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_web_security_scanner_v1.ts | 2210 +++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1alpha/.eslintignore | 7 + .../v1alpha/.eslintrc.json | 3 + .../v1alpha/.gitignore | 14 + .../v1alpha/.jsdoc.js | 55 + .../v1alpha/.mocharc.js | 33 + .../v1alpha/.prettierrc.js | 22 + .../v1alpha/README.md | 1 + .../v1alpha/package.json | 58 + .../v1alpha/crawled_url.proto | 38 + .../websecurityscanner/v1alpha/finding.proto | 152 + .../v1alpha/finding_addon.proto | 78 + .../v1alpha/finding_type_stats.proto | 35 + .../v1alpha/scan_config.proto | 157 + .../websecurityscanner/v1alpha/scan_run.proto | 104 + .../v1alpha/web_security_scanner.proto | 410 + ...ogle.cloud.websecurityscanner.v1alpha.json | 579 ++ ...web_security_scanner.create_scan_config.js | 67 + ...web_security_scanner.delete_scan_config.js | 62 + .../web_security_scanner.get_finding.js | 63 + .../web_security_scanner.get_scan_config.js | 62 + .../web_security_scanner.get_scan_run.js | 63 + .../web_security_scanner.list_crawled_urls.js | 77 + ...ecurity_scanner.list_finding_type_stats.js | 63 + .../web_security_scanner.list_findings.js | 85 + .../web_security_scanner.list_scan_configs.js | 76 + .../web_security_scanner.list_scan_runs.js | 76 + .../web_security_scanner.start_scan_run.js | 62 + .../web_security_scanner.stop_scan_run.js | 63 + ...web_security_scanner.update_scan_config.js | 70 + .../v1alpha/src/index.ts | 25 + .../v1alpha/src/v1alpha/gapic_metadata.json | 169 + .../v1alpha/src/v1alpha/index.ts | 19 + .../v1alpha/web_security_scanner_client.ts | 1927 ++++ .../web_security_scanner_client_config.json | 91 + .../web_security_scanner_proto_list.json | 9 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1alpha/system-test/install.ts | 49 + .../gapic_web_security_scanner_v1alpha.ts | 2324 +++++ .../v1alpha/tsconfig.json | 19 + .../v1alpha/webpack.config.js | 64 + .../v1beta/.eslintignore | 7 + .../v1beta/.eslintrc.json | 3 + .../v1beta/.gitignore | 14 + .../v1beta/.jsdoc.js | 55 + .../v1beta/.mocharc.js | 33 + .../v1beta/.prettierrc.js | 22 + .../v1beta/README.md | 1 + .../v1beta/package.json | 58 + .../v1beta/crawled_url.proto | 41 + .../websecurityscanner/v1beta/finding.proto | 98 + .../v1beta/finding_addon.proto | 90 + .../v1beta/finding_type_stats.proto | 36 + .../v1beta/scan_config.proto | 193 + .../v1beta/scan_config_error.proto | 190 + .../websecurityscanner/v1beta/scan_run.proto | 117 + .../v1beta/scan_run_error_trace.proto | 76 + .../v1beta/scan_run_warning_trace.proto | 59 + .../v1beta/web_security_scanner.proto | 413 + ...oogle.cloud.websecurityscanner.v1beta.json | 579 ++ ...web_security_scanner.create_scan_config.js | 67 + ...web_security_scanner.delete_scan_config.js | 62 + .../web_security_scanner.get_finding.js | 63 + .../web_security_scanner.get_scan_config.js | 62 + .../web_security_scanner.get_scan_run.js | 63 + .../web_security_scanner.list_crawled_urls.js | 77 + ...ecurity_scanner.list_finding_type_stats.js | 63 + .../web_security_scanner.list_findings.js | 85 + .../web_security_scanner.list_scan_configs.js | 76 + .../web_security_scanner.list_scan_runs.js | 76 + .../web_security_scanner.start_scan_run.js | 62 + .../web_security_scanner.stop_scan_run.js | 63 + ...web_security_scanner.update_scan_config.js | 70 + .../v1beta/src/index.ts | 25 + .../v1beta/src/v1beta/gapic_metadata.json | 169 + .../v1beta/src/v1beta/index.ts | 19 + .../src/v1beta/web_security_scanner_client.ts | 1927 ++++ .../web_security_scanner_client_config.json | 91 + .../web_security_scanner_proto_list.json | 12 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta/system-test/install.ts | 49 + .../test/gapic_web_security_scanner_v1beta.ts | 2324 +++++ .../v1beta/tsconfig.json | 19 + .../v1beta/webpack.config.js | 64 + .../executions/v1/.eslintignore | 7 + .../executions/v1/.eslintrc.json | 3 + .../executions/v1/.gitignore | 14 + .../executions/v1/.jsdoc.js | 55 + .../executions/v1/.mocharc.js | 33 + .../executions/v1/.prettierrc.js | 22 + .../executions/v1/README.md | 1 + .../executions/v1/package.json | 58 + .../workflows/executions/v1/executions.proto | 399 + .../v1/executions.cancel_execution.js | 63 + .../v1/executions.create_execution.js | 68 + .../generated/v1/executions.get_execution.js | 68 + .../v1/executions.list_executions.js | 100 + ..._google.cloud.workflows.executions.v1.json | 203 + .../executions/v1/src/index.ts | 25 + .../executions/v1/src/v1/executions_client.ts | 909 ++ .../v1/src/v1/executions_client_config.json | 42 + .../v1/src/v1/executions_proto_list.json | 3 + .../executions/v1/src/v1/gapic_metadata.json | 67 + .../executions/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../executions/v1/system-test/install.ts | 49 + .../executions/v1/test/gapic_executions_v1.ts | 869 ++ .../executions/v1/tsconfig.json | 19 + .../executions/v1/webpack.config.js | 64 + .../executions/v1beta/.eslintignore | 7 + .../executions/v1beta/.eslintrc.json | 3 + .../executions/v1beta/.gitignore | 14 + .../executions/v1beta/.jsdoc.js | 55 + .../executions/v1beta/.mocharc.js | 33 + .../executions/v1beta/.prettierrc.js | 22 + .../executions/v1beta/README.md | 1 + .../executions/v1beta/package.json | 58 + .../executions/v1beta/executions.proto | 252 + .../v1beta/executions.cancel_execution.js | 63 + .../v1beta/executions.create_execution.js | 68 + .../v1beta/executions.get_execution.js | 68 + .../v1beta/executions.list_executions.js | 84 + ...gle.cloud.workflows.executions.v1beta.json | 195 + .../executions/v1beta/src/index.ts | 25 + .../v1beta/src/v1beta/executions_client.ts | 870 ++ .../src/v1beta/executions_client_config.json | 42 + .../src/v1beta/executions_proto_list.json | 3 + .../v1beta/src/v1beta/gapic_metadata.json | 67 + .../executions/v1beta/src/v1beta/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../executions/v1beta/system-test/install.ts | 49 + .../v1beta/test/gapic_executions_v1beta.ts | 869 ++ .../executions/v1beta/tsconfig.json | 19 + .../executions/v1beta/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 + .../workflows/executions/v1/executions.proto | 399 + .../google/cloud/workflows/v1/workflows.proto | 409 + .../v1/executions.cancel_execution.js | 63 + .../v1/executions.create_execution.js | 68 + .../generated/v1/executions.get_execution.js | 68 + .../v1/executions.list_executions.js | 100 + ..._google.cloud.workflows.executions.v1.json | 203 + ...et_metadata_google.cloud.workflows.v1.json | 247 + .../generated/v1/workflows.create_workflow.js | 79 + .../generated/v1/workflows.delete_workflow.js | 63 + .../generated/v1/workflows.get_workflow.js | 70 + .../generated/v1/workflows.list_workflows.js | 89 + .../generated/v1/workflows.update_workflow.js | 67 + .../v1/src/index.ts | 25 + .../v1/src/v1/executions_client.ts | 909 ++ .../v1/src/v1/executions_client_config.json | 42 + .../v1/src/v1/executions_proto_list.json | 3 + .../v1/src/v1/gapic_metadata.json | 77 + .../v1/src/v1/index.ts | 19 + .../v1/src/v1/workflows_client.ts | 1371 +++ .../v1/src/v1/workflows_client_config.json | 46 + .../v1/src/v1/workflows_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_executions_v1.ts | 869 ++ .../v1/test/gapic_workflows_v1.ts | 1594 ++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1beta/.eslintignore | 7 + .../v1beta/.eslintrc.json | 3 + .../v1beta/.gitignore | 14 + .../v1beta/.jsdoc.js | 55 + .../v1beta/.mocharc.js | 33 + .../v1beta/.prettierrc.js | 22 + .../v1beta/README.md | 1 + .../v1beta/package.json | 58 + .../executions/v1beta/executions.proto | 252 + .../cloud/workflows/v1beta/workflows.proto | 314 + .../v1beta/executions.cancel_execution.js | 63 + .../v1beta/executions.create_execution.js | 68 + .../v1beta/executions.get_execution.js | 68 + .../v1beta/executions.list_executions.js | 84 + ...gle.cloud.workflows.executions.v1beta.json | 195 + ...etadata_google.cloud.workflows.v1beta.json | 243 + .../v1beta/workflows.create_workflow.js | 79 + .../v1beta/workflows.delete_workflow.js | 63 + .../v1beta/workflows.get_workflow.js | 62 + .../v1beta/workflows.list_workflows.js | 89 + .../v1beta/workflows.update_workflow.js | 67 + .../v1beta/src/index.ts | 25 + .../v1beta/src/v1beta/executions_client.ts | 870 ++ .../src/v1beta/executions_client_config.json | 42 + .../src/v1beta/executions_proto_list.json | 3 + .../v1beta/src/v1beta/gapic_metadata.json | 77 + .../v1beta/src/v1beta/index.ts | 19 + .../v1beta/src/v1beta/workflows_client.ts | 1040 +++ .../src/v1beta/workflows_client_config.json | 46 + .../src/v1beta/workflows_proto_list.json | 3 + .../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_executions_v1beta.ts | 869 ++ .../v1beta/test/gapic_workflows_v1beta.ts | 1119 +++ .../v1beta/tsconfig.json | 19 + .../v1beta/webpack.config.js | 64 + .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../google-cloud-workstations/v1/.gitignore | 14 + .../google-cloud-workstations/v1/.jsdoc.js | 55 + .../google-cloud-workstations/v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../google-cloud-workstations/v1/README.md | 1 + .../google-cloud-workstations/v1/package.json | 58 + .../cloud/workstations/v1/workstations.proto | 1182 +++ ...metadata_google.cloud.workstations.v1.json | 983 +++ .../v1/workstations.create_workstation.js | 77 + ...workstations.create_workstation_cluster.js | 77 + .../workstations.create_workstation_config.js | 77 + .../v1/workstations.delete_workstation.js | 72 + ...workstations.delete_workstation_cluster.js | 77 + .../workstations.delete_workstation_config.js | 78 + .../v1/workstations.generate_access_token.js | 75 + .../v1/workstations.get_workstation.js | 61 + .../workstations.get_workstation_cluster.js | 61 + .../v1/workstations.get_workstation_config.js | 61 + ...tations.list_usable_workstation_configs.js | 71 + .../workstations.list_usable_workstations.js | 71 + .../workstations.list_workstation_clusters.js | 71 + .../workstations.list_workstation_configs.js | 71 + .../v1/workstations.list_workstations.js | 71 + .../v1/workstations.start_workstation.js | 72 + .../v1/workstations.stop_workstation.js | 72 + .../v1/workstations.update_workstation.js | 79 + ...workstations.update_workstation_cluster.js | 78 + .../workstations.update_workstation_config.js | 79 + .../google-cloud-workstations/v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 243 + .../v1/src/v1/index.ts | 19 + .../v1/src/v1/workstations_client.ts | 3315 +++++++ .../v1/src/v1/workstations_client_config.json | 138 + .../v1/src/v1/workstations_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_workstations_v1.ts | 4506 ++++++++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1beta/.eslintignore | 7 + .../v1beta/.eslintrc.json | 3 + .../v1beta/.gitignore | 14 + .../v1beta/.jsdoc.js | 55 + .../v1beta/.mocharc.js | 33 + .../v1beta/.prettierrc.js | 22 + .../v1beta/README.md | 1 + .../v1beta/package.json | 58 + .../workstations/v1beta/workstations.proto | 1217 +++ ...data_google.cloud.workstations.v1beta.json | 983 +++ .../v1beta/workstations.create_workstation.js | 77 + ...workstations.create_workstation_cluster.js | 77 + .../workstations.create_workstation_config.js | 77 + .../v1beta/workstations.delete_workstation.js | 72 + ...workstations.delete_workstation_cluster.js | 77 + .../workstations.delete_workstation_config.js | 78 + .../workstations.generate_access_token.js | 75 + .../v1beta/workstations.get_workstation.js | 61 + .../workstations.get_workstation_cluster.js | 61 + .../workstations.get_workstation_config.js | 61 + ...tations.list_usable_workstation_configs.js | 71 + .../workstations.list_usable_workstations.js | 71 + .../workstations.list_workstation_clusters.js | 71 + .../workstations.list_workstation_configs.js | 71 + .../v1beta/workstations.list_workstations.js | 71 + .../v1beta/workstations.start_workstation.js | 72 + .../v1beta/workstations.stop_workstation.js | 72 + .../v1beta/workstations.update_workstation.js | 79 + ...workstations.update_workstation_cluster.js | 78 + .../workstations.update_workstation_config.js | 79 + .../v1beta/src/index.ts | 25 + .../v1beta/src/v1beta/gapic_metadata.json | 243 + .../v1beta/src/v1beta/index.ts | 19 + .../v1beta/src/v1beta/workstations_client.ts | 3315 +++++++ .../v1beta/workstations_client_config.json | 138 + .../src/v1beta/workstations_proto_list.json | 3 + .../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_workstations_v1beta.ts | 4506 ++++++++++ .../v1beta/tsconfig.json | 19 + .../v1beta/webpack.config.js | 64 + .../google-container/v1/.eslintignore | 7 + .../google-container/v1/.eslintrc.json | 3 + .../google-container/v1/.gitignore | 14 + owl-bot-staging/google-container/v1/.jsdoc.js | 55 + .../google-container/v1/.mocharc.js | 33 + .../google-container/v1/.prettierrc.js | 22 + owl-bot-staging/google-container/v1/README.md | 1 + .../google-container/v1/package.json | 58 + .../google/container/v1/cluster_service.proto | 5214 +++++++++++ .../v1/cluster_manager.cancel_operation.js | 61 + ...r_manager.check_autopilot_compatibility.js | 61 + .../cluster_manager.complete_i_p_rotation.js | 61 + ...ster_manager.complete_node_pool_upgrade.js | 62 + .../v1/cluster_manager.create_cluster.js | 67 + .../v1/cluster_manager.create_node_pool.js | 67 + .../v1/cluster_manager.delete_cluster.js | 61 + .../v1/cluster_manager.delete_node_pool.js | 62 + .../v1/cluster_manager.get_cluster.js | 61 + .../cluster_manager.get_j_s_o_n_web_keys.js | 61 + .../v1/cluster_manager.get_node_pool.js | 62 + .../v1/cluster_manager.get_operation.js | 61 + .../v1/cluster_manager.get_server_config.js | 61 + .../v1/cluster_manager.list_clusters.js | 62 + .../v1/cluster_manager.list_node_pools.js | 61 + .../v1/cluster_manager.list_operations.js | 62 + ...cluster_manager.list_usable_subnetworks.js | 82 + ...ster_manager.rollback_node_pool_upgrade.js | 67 + .../v1/cluster_manager.set_addons_config.js | 67 + .../v1/cluster_manager.set_labels.js | 76 + .../v1/cluster_manager.set_legacy_abac.js | 66 + .../v1/cluster_manager.set_locations.js | 71 + .../v1/cluster_manager.set_logging_service.js | 74 + .../cluster_manager.set_maintenance_policy.js | 86 + .../v1/cluster_manager.set_master_auth.js | 71 + .../cluster_manager.set_monitoring_service.js | 74 + .../v1/cluster_manager.set_network_policy.js | 66 + ...uster_manager.set_node_pool_autoscaling.js | 67 + ...luster_manager.set_node_pool_management.js | 67 + .../v1/cluster_manager.set_node_pool_size.js | 67 + .../v1/cluster_manager.start_i_p_rotation.js | 65 + .../v1/cluster_manager.update_cluster.js | 66 + .../v1/cluster_manager.update_master.js | 73 + .../v1/cluster_manager.update_node_pool.js | 164 + .../snippet_metadata_google.container.v1.json | 1915 ++++ .../google-container/v1/src/index.ts | 25 + .../v1/src/v1/cluster_manager_client.ts | 3514 ++++++++ .../src/v1/cluster_manager_client_config.json | 192 + .../v1/src/v1/cluster_manager_proto_list.json | 3 + .../v1/src/v1/gapic_metadata.json | 367 + .../google-container/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_cluster_manager_v1.ts | 5130 +++++++++++ .../google-container/v1/tsconfig.json | 19 + .../google-container/v1/webpack.config.js | 64 + .../google-container/v1beta1/.eslintignore | 7 + .../google-container/v1beta1/.eslintrc.json | 3 + .../google-container/v1beta1/.gitignore | 14 + .../google-container/v1beta1/.jsdoc.js | 55 + .../google-container/v1beta1/.mocharc.js | 33 + .../google-container/v1beta1/.prettierrc.js | 22 + .../google-container/v1beta1/README.md | 1 + .../google-container/v1beta1/package.json | 58 + .../container/v1beta1/cluster_service.proto | 5733 ++++++++++++ .../cluster_manager.cancel_operation.js | 64 + ...r_manager.check_autopilot_compatibility.js | 61 + .../cluster_manager.complete_i_p_rotation.js | 64 + ...ster_manager.complete_node_pool_upgrade.js | 62 + .../v1beta1/cluster_manager.create_cluster.js | 69 + .../cluster_manager.create_node_pool.js | 70 + .../v1beta1/cluster_manager.delete_cluster.js | 64 + .../cluster_manager.delete_node_pool.js | 66 + .../v1beta1/cluster_manager.get_cluster.js | 64 + .../cluster_manager.get_j_s_o_n_web_keys.js | 61 + .../v1beta1/cluster_manager.get_node_pool.js | 66 + .../v1beta1/cluster_manager.get_operation.js | 64 + .../cluster_manager.get_server_config.js | 63 + .../v1beta1/cluster_manager.list_clusters.js | 64 + .../v1beta1/cluster_manager.list_locations.js | 62 + .../cluster_manager.list_node_pools.js | 64 + .../cluster_manager.list_operations.js | 64 + ...cluster_manager.list_usable_subnetworks.js | 83 + ...ster_manager.rollback_node_pool_upgrade.js | 71 + .../cluster_manager.set_addons_config.js | 70 + .../v1beta1/cluster_manager.set_labels.js | 79 + .../cluster_manager.set_legacy_abac.js | 69 + .../v1beta1/cluster_manager.set_locations.js | 74 + .../cluster_manager.set_logging_service.js | 77 + .../cluster_manager.set_maintenance_policy.js | 86 + .../cluster_manager.set_master_auth.js | 74 + .../cluster_manager.set_monitoring_service.js | 77 + .../cluster_manager.set_network_policy.js | 69 + ...uster_manager.set_node_pool_autoscaling.js | 71 + ...luster_manager.set_node_pool_management.js | 71 + .../cluster_manager.set_node_pool_size.js | 71 + .../cluster_manager.start_i_p_rotation.js | 68 + .../v1beta1/cluster_manager.update_cluster.js | 69 + .../v1beta1/cluster_manager.update_master.js | 76 + .../cluster_manager.update_node_pool.js | 168 + ...pet_metadata_google.container.v1beta1.json | 1955 +++++ .../google-container/v1beta1/src/index.ts | 25 + .../src/v1beta1/cluster_manager_client.ts | 3585 ++++++++ .../cluster_manager_client_config.json | 198 + .../v1beta1/cluster_manager_proto_list.json | 3 + .../v1beta1/src/v1beta1/gapic_metadata.json | 377 + .../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_cluster_manager_v1beta1.ts | 5238 +++++++++++ .../google-container/v1beta1/tsconfig.json | 19 + .../v1beta1/webpack.config.js | 64 + .../google-dataflow/v1beta3/.eslintignore | 7 + .../google-dataflow/v1beta3/.eslintrc.json | 3 + .../google-dataflow/v1beta3/.gitignore | 14 + .../google-dataflow/v1beta3/.jsdoc.js | 55 + .../google-dataflow/v1beta3/.mocharc.js | 33 + .../google-dataflow/v1beta3/.prettierrc.js | 22 + .../google-dataflow/v1beta3/README.md | 1 + .../google-dataflow/v1beta3/package.json | 63 + .../google/dataflow/v1beta3/environment.proto | 554 ++ .../protos/google/dataflow/v1beta3/jobs.proto | 926 ++ .../google/dataflow/v1beta3/messages.proto | 238 + .../google/dataflow/v1beta3/metrics.proto | 369 + .../google/dataflow/v1beta3/snapshots.proto | 188 + .../google/dataflow/v1beta3/streaming.proto | 231 + .../google/dataflow/v1beta3/templates.proto | 632 ++ ..._templates_service.launch_flex_template.js | 75 + .../jobs_v1_beta3.aggregated_list_jobs.js | 83 + .../jobs_v1_beta3.check_active_jobs.js | 60 + .../v1beta3/jobs_v1_beta3.create_job.js | 74 + .../v1beta3/jobs_v1_beta3.get_job.js | 74 + .../v1beta3/jobs_v1_beta3.list_jobs.js | 83 + .../v1beta3/jobs_v1_beta3.snapshot_job.js | 80 + .../v1beta3/jobs_v1_beta3.update_job.js | 75 + .../messages_v1_beta3.list_job_messages.js | 98 + ...rics_v1_beta3.get_job_execution_details.js | 84 + .../metrics_v1_beta3.get_job_metrics.js | 75 + ...cs_v1_beta3.get_stage_execution_details.js | 96 + .../snapshots_v1_beta3.delete_snapshot.js | 68 + .../snapshots_v1_beta3.get_snapshot.js | 68 + .../snapshots_v1_beta3.list_snapshots.js | 68 + ...ppet_metadata_google.dataflow.v1beta3.json | 1007 +++ ...plates_service.create_job_from_template.js | 84 + .../v1beta3/templates_service.get_template.js | 76 + .../templates_service.launch_template.js | 86 + .../google-dataflow/v1beta3/src/index.ts | 35 + .../v1beta3/flex_templates_service_client.ts | 389 + .../flex_templates_service_client_config.json | 30 + .../flex_templates_service_proto_list.json | 9 + .../v1beta3/src/v1beta3/gapic_metadata.json | 293 + .../v1beta3/src/v1beta3/index.ts | 24 + .../src/v1beta3/jobs_v1_beta3_client.ts | 1150 +++ .../v1beta3/jobs_v1_beta3_client_config.json | 61 + .../src/v1beta3/jobs_v1_beta3_proto_list.json | 9 + .../src/v1beta3/messages_v1_beta3_client.ts | 555 ++ .../messages_v1_beta3_client_config.json | 31 + .../v1beta3/messages_v1_beta3_proto_list.json | 9 + .../src/v1beta3/metrics_v1_beta3_client.ts | 846 ++ .../metrics_v1_beta3_client_config.json | 41 + .../v1beta3/metrics_v1_beta3_proto_list.json | 9 + .../src/v1beta3/snapshots_v1_beta3_client.ts | 537 ++ .../snapshots_v1_beta3_client_config.json | 41 + .../snapshots_v1_beta3_proto_list.json | 9 + .../src/v1beta3/templates_service_client.ts | 562 ++ .../templates_service_client_config.json | 41 + .../v1beta3/templates_service_proto_list.json | 9 + .../system-test/fixtures/sample/src/index.js | 32 + .../system-test/fixtures/sample/src/index.ts | 62 + .../v1beta3/system-test/install.ts | 49 + .../gapic_flex_templates_service_v1beta3.ts | 270 + .../test/gapic_jobs_v1_beta3_v1beta3.ts | 1299 +++ .../test/gapic_messages_v1_beta3_v1beta3.ts | 484 + .../test/gapic_metrics_v1_beta3_v1beta3.ts | 924 ++ .../test/gapic_snapshots_v1_beta3_v1beta3.ts | 546 ++ .../test/gapic_templates_service_v1beta3.ts | 510 ++ .../google-dataflow/v1beta3/tsconfig.json | 19 + .../google-dataflow/v1beta3/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 + .../artifactregistry/v1/apt_artifact.proto | 114 + .../artifactregistry/v1/artifact.proto | 355 + .../devtools/artifactregistry/v1/file.proto | 141 + .../artifactregistry/v1/package.proto | 101 + .../artifactregistry/v1/repository.proto | 201 + .../artifactregistry/v1/service.proto | 400 + .../artifactregistry/v1/settings.proto | 84 + .../devtools/artifactregistry/v1/tag.proto | 118 + .../artifactregistry/v1/version.proto | 135 + .../artifactregistry/v1/vpcsc_config.proto | 86 + .../artifactregistry/v1/yum_artifact.proto | 106 + .../v1/artifact_registry.create_repository.js | 70 + .../v1/artifact_registry.create_tag.js | 68 + .../v1/artifact_registry.delete_package.js | 62 + .../v1/artifact_registry.delete_repository.js | 62 + .../v1/artifact_registry.delete_tag.js | 60 + .../v1/artifact_registry.delete_version.js | 66 + .../v1/artifact_registry.get_docker_image.js | 61 + .../v1/artifact_registry.get_file.js | 61 + .../v1/artifact_registry.get_iam_policy.js | 67 + .../artifact_registry.get_maven_artifact.js | 61 + .../v1/artifact_registry.get_npm_package.js | 61 + .../v1/artifact_registry.get_package.js | 61 + .../artifact_registry.get_project_settings.js | 61 + .../artifact_registry.get_python_package.js | 61 + .../v1/artifact_registry.get_repository.js | 61 + .../generated/v1/artifact_registry.get_tag.js | 60 + .../artifact_registry.get_v_p_c_s_c_config.js | 61 + .../v1/artifact_registry.get_version.js | 64 + .../artifact_registry.import_apt_artifacts.js | 65 + .../artifact_registry.import_yum_artifacts.js | 65 + .../artifact_registry.list_docker_images.js | 76 + .../v1/artifact_registry.list_files.js | 88 + .../artifact_registry.list_maven_artifacts.js | 72 + .../v1/artifact_registry.list_npm_packages.js | 72 + .../v1/artifact_registry.list_packages.js | 71 + .../artifact_registry.list_python_packages.js | 72 + .../v1/artifact_registry.list_repositories.js | 71 + .../v1/artifact_registry.list_tags.js | 79 + .../v1/artifact_registry.list_versions.js | 78 + .../v1/artifact_registry.set_iam_policy.js | 77 + .../artifact_registry.test_iam_permissions.js | 70 + ...tifact_registry.update_project_settings.js | 64 + .../v1/artifact_registry.update_repository.js | 66 + .../v1/artifact_registry.update_tag.js | 66 + ...tifact_registry.update_v_p_c_s_c_config.js | 64 + ...a_google.devtools.artifactregistry.v1.json | 1575 ++++ .../v1/src/index.ts | 25 + .../v1/src/v1/artifact_registry_client.ts | 5109 +++++++++++ .../v1/artifact_registry_client_config.json | 201 + .../src/v1/artifact_registry_proto_list.json | 13 + .../v1/src/v1/gapic_metadata.json | 409 + .../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_artifact_registry_v1.ts | 6612 ++++++++++++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1beta2/.eslintignore | 7 + .../v1beta2/.eslintrc.json | 3 + .../v1beta2/.gitignore | 14 + .../v1beta2/.jsdoc.js | 55 + .../v1beta2/.mocharc.js | 33 + .../v1beta2/.prettierrc.js | 22 + .../v1beta2/README.md | 1 + .../v1beta2/package.json | 58 + .../v1beta2/apt_artifact.proto | 115 + .../artifactregistry/v1beta2/file.proto | 120 + .../artifactregistry/v1beta2/package.proto | 79 + .../artifactregistry/v1beta2/repository.proto | 201 + .../artifactregistry/v1beta2/service.proto | 304 + .../artifactregistry/v1beta2/settings.proto | 84 + .../artifactregistry/v1beta2/tag.proto | 118 + .../artifactregistry/v1beta2/version.proto | 127 + .../v1beta2/yum_artifact.proto | 107 + .../artifact_registry.create_repository.js | 70 + .../v1beta2/artifact_registry.create_tag.js | 68 + .../artifact_registry.delete_package.js | 61 + .../artifact_registry.delete_repository.js | 62 + .../v1beta2/artifact_registry.delete_tag.js | 60 + .../artifact_registry.delete_version.js | 66 + .../v1beta2/artifact_registry.get_file.js | 60 + .../artifact_registry.get_iam_policy.js | 67 + .../v1beta2/artifact_registry.get_package.js | 60 + .../artifact_registry.get_project_settings.js | 61 + .../artifact_registry.get_repository.js | 61 + .../v1beta2/artifact_registry.get_tag.js | 60 + .../v1beta2/artifact_registry.get_version.js | 64 + .../artifact_registry.import_apt_artifacts.js | 65 + .../artifact_registry.import_yum_artifacts.js | 65 + .../v1beta2/artifact_registry.list_files.js | 83 + .../artifact_registry.list_packages.js | 71 + .../artifact_registry.list_repositories.js | 71 + .../v1beta2/artifact_registry.list_tags.js | 79 + .../artifact_registry.list_versions.js | 78 + .../artifact_registry.set_iam_policy.js | 77 + .../artifact_registry.test_iam_permissions.js | 70 + ...tifact_registry.update_project_settings.js | 64 + .../artifact_registry.update_repository.js | 66 + .../v1beta2/artifact_registry.update_tag.js | 66 + ...gle.devtools.artifactregistry.v1beta2.json | 1131 +++ .../v1beta2/src/index.ts | 25 + .../src/v1beta2/artifact_registry_client.ts | 3439 ++++++++ .../artifact_registry_client_config.json | 149 + .../v1beta2/artifact_registry_proto_list.json | 11 + .../v1beta2/src/v1beta2/gapic_metadata.json | 293 + .../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_artifact_registry_v1beta2.ts | 4417 ++++++++++ .../v1beta2/tsconfig.json | 19 + .../v1beta2/webpack.config.js | 64 + .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../google-devtools-cloudbuild/v1/.gitignore | 14 + .../google-devtools-cloudbuild/v1/.jsdoc.js | 55 + .../google-devtools-cloudbuild/v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../google-devtools-cloudbuild/v1/README.md | 1 + .../v1/package.json | 58 + .../devtools/cloudbuild/v1/cloudbuild.proto | 2734 ++++++ .../generated/v1/cloud_build.approve_build.js | 67 + .../generated/v1/cloud_build.cancel_build.js | 71 + .../generated/v1/cloud_build.create_build.js | 72 + .../v1/cloud_build.create_build_trigger.js | 71 + .../v1/cloud_build.create_worker_pool.js | 81 + .../v1/cloud_build.delete_build_trigger.js | 71 + .../v1/cloud_build.delete_worker_pool.js | 79 + .../generated/v1/cloud_build.get_build.js | 71 + .../v1/cloud_build.get_build_trigger.js | 71 + .../v1/cloud_build.get_worker_pool.js | 62 + .../v1/cloud_build.list_build_triggers.js | 76 + .../generated/v1/cloud_build.list_builds.js | 85 + .../v1/cloud_build.list_worker_pools.js | 74 + .../v1/cloud_build.receive_trigger_webhook.js | 77 + .../generated/v1/cloud_build.retry_build.js | 72 + .../v1/cloud_build.run_build_trigger.js | 77 + .../v1/cloud_build.update_build_trigger.js | 77 + .../v1/cloud_build.update_worker_pool.js | 73 + ...etadata_google.devtools.cloudbuild.v1.json | 903 ++ .../v1/src/index.ts | 25 + .../v1/src/v1/cloud_build_client.ts | 3300 +++++++ .../v1/src/v1/cloud_build_client_config.json | 114 + .../v1/src/v1/cloud_build_proto_list.json | 3 + .../v1/src/v1/gapic_metadata.json | 215 + .../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_build_v1.ts | 3520 ++++++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v2/.eslintignore | 7 + .../v2/.eslintrc.json | 3 + .../google-devtools-cloudbuild/v2/.gitignore | 14 + .../google-devtools-cloudbuild/v2/.jsdoc.js | 55 + .../google-devtools-cloudbuild/v2/.mocharc.js | 33 + .../v2/.prettierrc.js | 22 + .../google-devtools-cloudbuild/v2/README.md | 1 + .../v2/package.json | 58 + .../devtools/cloudbuild/v2/cloudbuild.proto | 112 + .../devtools/cloudbuild/v2/repositories.proto | 802 ++ ...itory_manager.batch_create_repositories.js | 70 + .../repository_manager.create_connection.js | 76 + .../repository_manager.create_repository.js | 77 + .../repository_manager.delete_connection.js | 73 + .../repository_manager.delete_repository.js | 73 + .../v2/repository_manager.fetch_git_refs.js | 66 + ...ory_manager.fetch_linkable_repositories.js | 72 + .../v2/repository_manager.fetch_read_token.js | 62 + ...pository_manager.fetch_read_write_token.js | 62 + .../v2/repository_manager.get_connection.js | 62 + .../v2/repository_manager.get_repository.js | 62 + .../v2/repository_manager.list_connections.js | 72 + .../repository_manager.list_repositories.js | 79 + .../repository_manager.update_connection.js | 80 + ...etadata_google.devtools.cloudbuild.v2.json | 655 ++ .../v2/src/index.ts | 25 + .../v2/src/v2/gapic_metadata.json | 175 + .../v2/src/v2/index.ts | 19 + .../v2/src/v2/repository_manager_client.ts | 2572 ++++++ .../v2/repository_manager_client_config.json | 106 + .../src/v2/repository_manager_proto_list.json | 4 + .../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_repository_manager_v2.ts | 3384 +++++++ .../v2/tsconfig.json | 19 + .../v2/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 | 59 + .../v1/containeranalysis.proto | 156 + .../v1/protos/grafeas/v1/attestation.proto | 90 + .../v1/protos/grafeas/v1/build.proto | 62 + .../v1/protos/grafeas/v1/common.proto | 152 + .../v1/protos/grafeas/v1/compliance.proto | 82 + .../v1/protos/grafeas/v1/cvss.proto | 169 + .../v1/protos/grafeas/v1/deployment.proto | 66 + .../v1/protos/grafeas/v1/discovery.proto | 104 + .../protos/grafeas/v1/dsse_attestation.proto | 52 + .../v1/protos/grafeas/v1/grafeas.proto | 547 ++ .../v1/protos/grafeas/v1/image.proto | 83 + .../protos/grafeas/v1/intoto_provenance.proto | 113 + .../protos/grafeas/v1/intoto_statement.proto | 52 + .../v1/protos/grafeas/v1/package.proto | 192 + .../v1/protos/grafeas/v1/provenance.proto | 265 + .../v1/protos/grafeas/v1/severity.proto | 38 + .../protos/grafeas/v1/slsa_provenance.proto | 115 + .../grafeas/v1/slsa_provenance_zero_two.proto | 82 + .../v1/protos/grafeas/v1/upgrade.proto | 114 + .../v1/protos/grafeas/v1/vex.proto | 203 + .../v1/protos/grafeas/v1/vulnerability.proto | 297 + .../v1/container_analysis.get_iam_policy.js | 67 + ...s.get_vulnerability_occurrences_summary.js | 66 + .../v1/container_analysis.set_iam_policy.js | 77 + ...container_analysis.test_iam_permissions.js | 70 + .../v1/grafeas.batch_create_notes.js | 67 + .../v1/grafeas.batch_create_occurrences.js | 67 + .../generated/v1/grafeas.create_note.js | 72 + .../generated/v1/grafeas.create_occurrence.js | 67 + .../generated/v1/grafeas.delete_note.js | 62 + .../generated/v1/grafeas.delete_occurrence.js | 62 + .../samples/generated/v1/grafeas.get_note.js | 62 + .../generated/v1/grafeas.get_occurrence.js | 62 + .../v1/grafeas.get_occurrence_note.js | 62 + .../v1/grafeas.list_note_occurrences.js | 76 + .../generated/v1/grafeas.list_notes.js | 77 + .../generated/v1/grafeas.list_occurrences.js | 77 + .../generated/v1/grafeas.update_note.js | 71 + .../generated/v1/grafeas.update_occurrence.js | 71 + ..._google.devtools.containeranalysis.v1.json | 827 ++ .../v1/src/index.ts | 27 + .../v1/src/v1/container_analysis_client.ts | 757 ++ .../v1/container_analysis_client_config.json | 42 + .../src/v1/container_analysis_proto_list.json | 23 + .../v1/src/v1/gapic_metadata.json | 229 + .../v1/src/v1/grafeas_client.ts | 1791 ++++ .../v1/src/v1/grafeas_client_config.json | 82 + .../v1/src/v1/grafeas_proto_list.json | 23 + .../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 + .../v1/test/gapic_container_analysis_v1.ts | 691 ++ .../v1/test/gapic_grafeas_v1.ts | 2229 +++++ .../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 | 59 + .../v1beta1/attestation/attestation.proto | 170 + .../v1beta1/build/build.proto | 96 + .../v1beta1/common/common.proto | 101 + .../v1beta1/containeranalysis.proto | 148 + .../containeranalysis/v1beta1/cvss/cvss.proto | 85 + .../v1beta1/deployment/deployment.proto | 74 + .../v1beta1/discovery/discovery.proto | 86 + .../v1beta1/grafeas/grafeas.proto | 506 ++ .../v1beta1/image/image.proto | 145 + .../v1beta1/package/package.proto | 127 + .../v1beta1/provenance/provenance.proto | 164 + .../v1beta1/source/source.proto | 134 + .../v1beta1/vulnerability/vulnerability.proto | 203 + ...ysis_v1_beta1.generate_packages_summary.js | 62 + ...tainer_analysis_v1_beta1.get_iam_policy.js | 67 + ...tainer_analysis_v1_beta1.set_iam_policy.js | 77 + ..._analysis_v1_beta1.test_iam_permissions.js | 70 + .../grafeas_v1_beta1.batch_create_notes.js | 65 + ...afeas_v1_beta1.batch_create_occurrences.js | 65 + .../v1beta1/grafeas_v1_beta1.create_note.js | 69 + .../grafeas_v1_beta1.create_occurrence.js | 65 + .../v1beta1/grafeas_v1_beta1.delete_note.js | 61 + .../grafeas_v1_beta1.delete_occurrence.js | 61 + .../v1beta1/grafeas_v1_beta1.get_note.js | 61 + .../grafeas_v1_beta1.get_occurrence.js | 61 + .../grafeas_v1_beta1.get_occurrence_note.js | 61 + ...1.get_vulnerability_occurrences_summary.js | 65 + .../grafeas_v1_beta1.list_note_occurrences.js | 75 + .../v1beta1/grafeas_v1_beta1.list_notes.js | 75 + .../grafeas_v1_beta1.list_occurrences.js | 75 + .../v1beta1/grafeas_v1_beta1.update_note.js | 69 + .../grafeas_v1_beta1.update_occurrence.js | 69 + ...le.devtools.containeranalysis.v1beta1.json | 867 ++ .../v1beta1/src/index.ts | 27 + .../container_analysis_v1_beta1_client.ts | 641 ++ ...ainer_analysis_v1_beta1_client_config.json | 42 + ...ontainer_analysis_v1_beta1_proto_list.json | 15 + .../v1beta1/src/v1beta1/gapic_metadata.json | 239 + .../src/v1beta1/grafeas_v1_beta1_client.ts | 1746 ++++ .../grafeas_v1_beta1_client_config.json | 86 + .../v1beta1/grafeas_v1_beta1_proto_list.json | 15 + .../v1beta1/src/v1beta1/index.ts | 20 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + .../v1beta1/system-test/install.ts | 49 + ...pic_container_analysis_v1_beta1_v1beta1.ts | 582 ++ .../test/gapic_grafeas_v1_beta1_v1beta1.ts | 2228 +++++ .../v1beta1/tsconfig.json | 19 + .../v1beta1/webpack.config.js | 64 + .../google-iam-credentials/v1/.eslintignore | 7 + .../google-iam-credentials/v1/.eslintrc.json | 3 + .../google-iam-credentials/v1/.gitignore | 14 + .../google-iam-credentials/v1/.jsdoc.js | 55 + .../google-iam-credentials/v1/.mocharc.js | 33 + .../google-iam-credentials/v1/.prettierrc.js | 22 + .../google-iam-credentials/v1/README.md | 1 + .../google-iam-credentials/v1/package.json | 58 + .../google/iam/credentials/v1/common.proto | 190 + .../iam/credentials/v1/iamcredentials.proto | 79 + ...i_a_m_credentials.generate_access_token.js | 91 + .../v1/i_a_m_credentials.generate_id_token.js | 87 + .../v1/i_a_m_credentials.sign_blob.js | 81 + .../v1/i_a_m_credentials.sign_jwt.js | 81 + ...et_metadata_google.iam.credentials.v1.json | 215 + .../google-iam-credentials/v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 63 + .../v1/src/v1/i_a_m_credentials_client.ts | 670 ++ .../v1/i_a_m_credentials_client_config.json | 46 + .../src/v1/i_a_m_credentials_proto_list.json | 4 + .../google-iam-credentials/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_a_m_credentials_v1.ts | 582 ++ .../google-iam-credentials/v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + owl-bot-staging/google-iam/v2/.eslintignore | 7 + owl-bot-staging/google-iam/v2/.eslintrc.json | 3 + owl-bot-staging/google-iam/v2/.gitignore | 14 + owl-bot-staging/google-iam/v2/.jsdoc.js | 55 + owl-bot-staging/google-iam/v2/.mocharc.js | 33 + owl-bot-staging/google-iam/v2/.prettierrc.js | 22 + owl-bot-staging/google-iam/v2/README.md | 1 + owl-bot-staging/google-iam/v2/package.json | 58 + .../v2/protos/google/iam/v2/deny.proto | 109 + .../v2/protos/google/iam/v2/policy.proto | 287 + .../generated/v2/policies.create_policy.js | 81 + .../generated/v2/policies.delete_policy.js | 76 + .../generated/v2/policies.get_policy.js | 67 + .../generated/v2/policies.list_policies.js | 81 + .../generated/v2/policies.update_policy.js | 65 + .../v2/snippet_metadata_google.iam.v2.json | 235 + owl-bot-staging/google-iam/v2/src/index.ts | 25 + .../google-iam/v2/src/v2/gapic_metadata.json | 77 + owl-bot-staging/google-iam/v2/src/v2/index.ts | 19 + .../google-iam/v2/src/v2/policies_client.ts | 1140 +++ .../v2/src/v2/policies_client_config.json | 63 + .../v2/src/v2/policies_proto_list.json | 4 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../google-iam/v2/system-test/install.ts | 49 + .../google-iam/v2/test/gapic_policies_v2.ts | 1287 +++ owl-bot-staging/google-iam/v2/tsconfig.json | 19 + .../google-iam/v2/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 + .../type/device_resources.proto | 83 + .../v1/access_context_manager.proto | 986 +++ .../v1/access_level.proto | 192 + .../v1/access_policy.proto | 81 + .../v1/gcp_user_access_binding.proto | 68 + .../v1/service_perimeter.proto | 472 + ...ntext_manager.commit_service_perimeters.js | 77 + ...ess_context_manager.create_access_level.js | 73 + ...ss_context_manager.create_access_policy.js | 104 + ..._manager.create_gcp_user_access_binding.js | 68 + ...ontext_manager.create_service_perimeter.js | 73 + ...ess_context_manager.delete_access_level.js | 65 + ...ss_context_manager.delete_access_policy.js | 63 + ..._manager.delete_gcp_user_access_binding.js | 62 + ...ontext_manager.delete_service_perimeter.js | 65 + ...access_context_manager.get_access_level.js | 75 + ...ccess_context_manager.get_access_policy.js | 62 + ...ext_manager.get_gcp_user_access_binding.js | 61 + .../access_context_manager.get_iam_policy.js | 67 + ...s_context_manager.get_service_perimeter.js | 64 + ...cess_context_manager.list_access_levels.js | 84 + ...ss_context_manager.list_access_policies.js | 75 + ...t_manager.list_gcp_user_access_bindings.js | 75 + ...context_manager.list_service_perimeters.js | 78 + ...s_context_manager.replace_access_levels.js | 85 + ...text_manager.replace_service_perimeters.js | 85 + .../access_context_manager.set_iam_policy.js | 77 + ...ss_context_manager.test_iam_permissions.js | 70 + ...ess_context_manager.update_access_level.js | 71 + ...ss_context_manager.update_access_policy.js | 67 + ..._manager.update_gcp_user_access_binding.js | 72 + ...ontext_manager.update_service_perimeter.js | 68 + ...ogle.identity.accesscontextmanager.v1.json | 1183 +++ .../v1/src/index.ts | 25 + .../src/v1/access_context_manager_client.ts | 3706 ++++++++ .../access_context_manager_client_config.json | 156 + .../v1/access_context_manager_proto_list.json | 8 + .../v1/src/v1/gapic_metadata.json | 299 + .../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_access_context_manager_v1.ts | 4597 ++++++++++ .../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 + .../v1/protos/google/geo/type/viewport.proto | 69 + .../maps/addressvalidation/v1/address.proto | 147 + .../v1/address_validation_service.proto | 278 + .../maps/addressvalidation/v1/geocode.proto | 81 + .../maps/addressvalidation/v1/metadata.proto | 43 + .../maps/addressvalidation/v1/usps_data.proto | 221 + ..._validation.provide_validation_feedback.js | 71 + .../v1/address_validation.validate_address.js | 98 + ...data_google.maps.addressvalidation.v1.json | 107 + .../v1/src/index.ts | 25 + .../v1/src/v1/address_validation_client.ts | 484 + .../v1/address_validation_client_config.json | 48 + .../src/v1/address_validation_proto_list.json | 8 + .../v1/src/v1/gapic_metadata.json | 43 + .../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_address_validation_v1.ts | 300 + .../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 + .../mapsplatformdatasets/v1/data_source.proto | 59 + .../mapsplatformdatasets/v1/dataset.proto | 146 + .../v1/maps_platform_datasets.proto | 111 + .../v1/maps_platform_datasets_service.proto | 81 + .../maps_platform_datasets.create_dataset.js | 67 + .../maps_platform_datasets.delete_dataset.js | 61 + .../v1/maps_platform_datasets.get_dataset.js | 61 + .../maps_platform_datasets.list_datasets.js | 73 + ...atform_datasets.update_dataset_metadata.js | 68 + ...a_google.maps.mapsplatformdatasets.v1.json | 231 + .../v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 77 + .../v1/src/v1/index.ts | 19 + .../src/v1/maps_platform_datasets_client.ts | 828 ++ .../maps_platform_datasets_client_config.json | 63 + .../v1/maps_platform_datasets_proto_list.json | 6 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../test/gapic_maps_platform_datasets_v1.ts | 919 ++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1alpha/.eslintignore | 7 + .../v1alpha/.eslintrc.json | 3 + .../v1alpha/.gitignore | 14 + .../v1alpha/.jsdoc.js | 55 + .../v1alpha/.mocharc.js | 33 + .../v1alpha/.prettierrc.js | 22 + .../v1alpha/README.md | 1 + .../v1alpha/package.json | 58 + .../v1alpha/data_source.proto | 64 + .../v1alpha/dataset.proto | 110 + .../v1alpha/maps_platform_datasets.proto | 167 + ...maps_platform_datasets_alpha_service.proto | 97 + ...atform_datasets_v1_alpha.create_dataset.js | 67 + ...atform_datasets_v1_alpha.delete_dataset.js | 66 + ...atasets_v1_alpha.delete_dataset_version.js | 61 + ..._platform_datasets_v1_alpha.get_dataset.js | 73 + ...datasets_v1_alpha.list_dataset_versions.js | 74 + ...latform_datasets_v1_alpha.list_datasets.js | 74 + ...tasets_v1_alpha.update_dataset_metadata.js | 68 + ...gle.maps.mapsplatformdatasets.v1alpha.json | 327 + .../v1alpha/src/index.ts | 25 + .../v1alpha/src/v1alpha/gapic_metadata.json | 101 + .../v1alpha/src/v1alpha/index.ts | 19 + .../maps_platform_datasets_v1_alpha_client.ts | 1097 +++ ...tform_datasets_v1_alpha_client_config.json | 72 + ...platform_datasets_v1_alpha_proto_list.json | 6 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1alpha/system-test/install.ts | 49 + ...maps_platform_datasets_v1_alpha_v1alpha.ts | 1272 +++ .../v1alpha/tsconfig.json | 19 + .../v1alpha/webpack.config.js | 64 + .../google-maps-places/v1/.eslintignore | 7 + .../google-maps-places/v1/.eslintrc.json | 3 + .../google-maps-places/v1/.gitignore | 14 + .../google-maps-places/v1/.jsdoc.js | 55 + .../google-maps-places/v1/.mocharc.js | 33 + .../google-maps-places/v1/.prettierrc.js | 22 + .../google-maps-places/v1/README.md | 1 + .../google-maps-places/v1/package.json | 58 + .../v1/protos/google/geo/type/viewport.proto | 69 + .../google/maps/places/v1/geometry.proto | 42 + .../protos/google/maps/places/v1/place.proto | 424 + .../maps/places/v1/places_service.proto | 199 + .../generated/v1/places.search_text.js | 133 + ...nippet_metadata_google.maps.places.v1.json | 107 + .../google-maps-places/v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 33 + .../google-maps-places/v1/src/v1/index.ts | 19 + .../v1/src/v1/places_client.ts | 436 + .../v1/src/v1/places_client_config.json | 30 + .../v1/src/v1/places_proto_list.json | 6 + .../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_places_v1.ts | 225 + .../google-maps-places/v1/tsconfig.json | 19 + .../google-maps-places/v1/webpack.config.js | 64 + .../google-maps-routing/v2/.eslintignore | 7 + .../google-maps-routing/v2/.eslintrc.json | 3 + .../google-maps-routing/v2/.gitignore | 14 + .../google-maps-routing/v2/.jsdoc.js | 55 + .../google-maps-routing/v2/.mocharc.js | 33 + .../google-maps-routing/v2/.prettierrc.js | 22 + .../google-maps-routing/v2/README.md | 1 + .../google-maps-routing/v2/package.json | 58 + .../v2/protos/google/geo/type/viewport.proto | 69 + .../maps/routing/v2/fallback_info.proto | 73 + .../maps/routing/v2/geocoding_results.proto | 72 + .../maps/routing/v2/localized_time.proto | 40 + .../google/maps/routing/v2/location.proto | 44 + .../google/maps/routing/v2/maneuver.proto | 94 + .../routing/v2/navigation_instruction.proto | 40 + .../google/maps/routing/v2/polyline.proto | 74 + .../protos/google/maps/routing/v2/route.proto | 395 + .../google/maps/routing/v2/route_label.proto | 47 + .../maps/routing/v2/route_modifiers.proto | 65 + .../maps/routing/v2/route_travel_mode.proto | 53 + .../maps/routing/v2/routes_service.proto | 499 ++ .../maps/routing/v2/routing_preference.proto | 56 + .../routing/v2/speed_reading_interval.proto | 59 + .../google/maps/routing/v2/toll_info.proto | 42 + .../google/maps/routing/v2/toll_passes.proto | 334 + .../maps/routing/v2/traffic_model.proto | 52 + .../google/maps/routing/v2/transit.proto | 161 + .../maps/routing/v2/transit_preferences.proto | 75 + .../protos/google/maps/routing/v2/units.proto | 40 + .../routing/v2/vehicle_emission_type.proto | 47 + .../google/maps/routing/v2/vehicle_info.proto | 37 + .../google/maps/routing/v2/waypoint.proto | 76 + .../v2/routes.compute_route_matrix.js | 146 + .../generated/v2/routes.compute_routes.js | 192 + ...ippet_metadata_google.maps.routing.v2.json | 207 + .../google-maps-routing/v2/src/index.ts | 25 + .../v2/src/v2/gapic_metadata.json | 38 + .../google-maps-routing/v2/src/v2/index.ts | 19 + .../v2/src/v2/routes_client.ts | 636 ++ .../v2/src/v2/routes_client_config.json | 34 + .../v2/src/v2/routes_proto_list.json | 26 + .../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_routes_v2.ts | 313 + .../google-maps-routing/v2/tsconfig.json | 19 + .../google-maps-routing/v2/webpack.config.js | 64 + .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../google-monitoring-dashboard/v1/.gitignore | 14 + .../google-monitoring-dashboard/v1/.jsdoc.js | 55 + .../v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../google-monitoring-dashboard/v1/README.md | 1 + .../v1/package.json | 58 + .../monitoring/dashboard/v1/alertchart.proto | 41 + .../dashboard/v1/collapsible_group.proto | 32 + .../monitoring/dashboard/v1/common.proto | 452 + .../monitoring/dashboard/v1/dashboard.proto | 79 + .../dashboard/v1/dashboard_filter.proto | 68 + .../dashboard/v1/dashboards_service.proto | 189 + .../monitoring/dashboard/v1/drilldowns.proto | 25 + .../monitoring/dashboard/v1/layouts.proto | 112 + .../monitoring/dashboard/v1/logs_panel.proto | 38 + .../monitoring/dashboard/v1/metrics.proto | 198 + .../monitoring/dashboard/v1/scorecard.proto | 118 + .../monitoring/dashboard/v1/service.proto | 25 + .../monitoring/dashboard/v1/table.proto | 92 + .../dashboard/v1/table_display_options.proto | 35 + .../google/monitoring/dashboard/v1/text.proto | 46 + .../monitoring/dashboard/v1/widget.proto | 70 + .../monitoring/dashboard/v1/xychart.proto | 168 + .../v1/dashboards_service.create_dashboard.js | 73 + .../v1/dashboards_service.delete_dashboard.js | 62 + .../v1/dashboards_service.get_dashboard.js | 64 + .../v1/dashboards_service.list_dashboards.js | 75 + .../v1/dashboards_service.update_dashboard.js | 66 + ...tadata_google.monitoring.dashboard.v1.json | 235 + .../v1/src/index.ts | 25 + .../v1/src/v1/dashboards_service_client.ts | 937 ++ .../v1/dashboards_service_client_config.json | 64 + .../src/v1/dashboards_service_proto_list.json | 19 + .../v1/src/v1/gapic_metadata.json | 77 + .../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_dashboards_service_v1.ts | 987 +++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../google-privacy-dlp/v2/.eslintignore | 7 + .../google-privacy-dlp/v2/.eslintrc.json | 3 + .../google-privacy-dlp/v2/.gitignore | 14 + .../google-privacy-dlp/v2/.jsdoc.js | 55 + .../google-privacy-dlp/v2/.mocharc.js | 33 + .../google-privacy-dlp/v2/.prettierrc.js | 22 + .../google-privacy-dlp/v2/README.md | 1 + .../google-privacy-dlp/v2/package.json | 58 + .../v2/protos/google/privacy/dlp/v2/dlp.proto | 5400 ++++++++++++ .../google/privacy/dlp/v2/storage.proto | 808 ++ .../v2/dlp_service.activate_job_trigger.js | 62 + .../v2/dlp_service.cancel_dlp_job.js | 61 + .../dlp_service.create_deidentify_template.js | 88 + .../v2/dlp_service.create_dlp_job.js | 88 + .../v2/dlp_service.create_inspect_template.js | 88 + .../v2/dlp_service.create_job_trigger.js | 84 + .../v2/dlp_service.create_stored_info_type.js | 88 + .../v2/dlp_service.deidentify_content.js | 109 + .../dlp_service.delete_deidentify_template.js | 63 + .../v2/dlp_service.delete_dlp_job.js | 61 + .../v2/dlp_service.delete_inspect_template.js | 63 + .../v2/dlp_service.delete_job_trigger.js | 62 + .../v2/dlp_service.delete_stored_info_type.js | 63 + .../v2/dlp_service.finish_dlp_job.js | 61 + .../v2/dlp_service.get_deidentify_template.js | 63 + .../generated/v2/dlp_service.get_dlp_job.js | 61 + .../v2/dlp_service.get_inspect_template.js | 63 + .../v2/dlp_service.get_job_trigger.js | 62 + .../v2/dlp_service.get_stored_info_type.js | 63 + .../v2/dlp_service.hybrid_inspect_dlp_job.js | 66 + .../dlp_service.hybrid_inspect_job_trigger.js | 66 + .../v2/dlp_service.inspect_content.js | 88 + .../dlp_service.list_deidentify_templates.js | 101 + .../generated/v2/dlp_service.list_dlp_jobs.js | 125 + .../v2/dlp_service.list_info_types.js | 73 + .../v2/dlp_service.list_inspect_templates.js | 101 + .../v2/dlp_service.list_job_triggers.js | 125 + .../v2/dlp_service.list_stored_info_types.js | 98 + .../generated/v2/dlp_service.redact_image.js | 88 + .../v2/dlp_service.reidentify_content.js | 110 + .../dlp_service.update_deidentify_template.js | 71 + .../v2/dlp_service.update_inspect_template.js | 71 + .../v2/dlp_service.update_job_trigger.js | 70 + .../v2/dlp_service.update_stored_info_type.js | 73 + ...nippet_metadata_google.privacy.dlp.v2.json | 1671 ++++ .../google-privacy-dlp/v2/src/index.ts | 25 + .../v2/src/v2/dlp_service_client.ts | 5285 +++++++++++ .../v2/src/v2/dlp_service_client_config.json | 196 + .../v2/src/v2/dlp_service_proto_list.json | 4 + .../v2/src/v2/gapic_metadata.json | 383 + .../google-privacy-dlp/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_dlp_service_v2.ts | 5531 ++++++++++++ .../google-privacy-dlp/v2/tsconfig.json | 19 + .../google-privacy-dlp/v2/webpack.config.js | 64 + 1351 files changed, 293335 insertions(+) create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/README.md create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/package.json create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine.proto create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine_resources.proto create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_cluster.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_hcx_activation_key.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_network_policy.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_cloud.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_connection.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_vmware_engine_network.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_cluster.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_network_policy.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_cloud.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_connection.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_vmware_engine_network.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_cluster.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_hcx_activation_key.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_network_policy.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_node_type.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_cloud.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_connection.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_subnet.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_vmware_engine_network.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_clusters.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_hcx_activation_keys.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_network_policies.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_node_types.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_clouds.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connection_peering_routes.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connections.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_subnets.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_vmware_engine_networks.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_nsx_credentials.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_vcenter_credentials.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_nsx_credentials.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_vcenter_credentials.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.undelete_private_cloud.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_cluster.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_network_policy.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_cloud.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_connection.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_subnet.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_vmware_engine_network.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client.ts create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client_config.json create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_proto_list.json create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/test/gapic_vmware_engine_v1.ts create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/README.md create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/package.json create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/protos/google/cloud/vpcaccess/v1/vpc_access.proto create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.create_connector.js create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.delete_connector.js create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.get_connector.js create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.list_connectors.js create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client.ts create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/test/gapic_vpc_access_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/README.md create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/package.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/protos/google/cloud/webrisk/v1/webrisk.proto create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.compute_threat_list_diff.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.create_submission.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_hashes.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_uris.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.submit_uri.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/test/gapic_web_risk_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.gitignore create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/README.md create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/package.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/protos/google/cloud/webrisk/v1beta1/webrisk.proto create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client_config.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_proto_list.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/test/gapic_web_risk_service_v1_beta1_v1beta1.ts create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/README.md create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/package.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_log.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.create_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_finding.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_run.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_findings.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_configs.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_runs.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.start_scan_run.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.update_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client_config.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_proto_list.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/test/gapic_web_security_scanner_v1.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintignore create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.gitignore create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/README.md create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/package.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/index.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/index.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client_config.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_proto_list.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/test/gapic_web_security_scanner_v1alpha.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintignore create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.gitignore create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/README.md create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/package.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/index.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/index.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client_config.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_proto_list.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/test/gapic_web_security_scanner_v1beta.ts create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/README.md create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/package.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.cancel_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.create_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.get_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.list_executions.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client_config.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_proto_list.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/test/gapic_executions_v1.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintignore create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.gitignore create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/README.md create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/package.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.create_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.get_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.list_executions.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client_config.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_proto_list.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/test/gapic_executions_v1beta.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/README.md create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/package.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/v1/workflows.proto create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.cancel_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.create_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.get_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.list_executions.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.create_workflow.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.delete_workflow.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.get_workflow.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.list_workflows.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.update_workflow.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client_config.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_proto_list.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client_config.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_proto_list.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_executions_v1.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_workflows_v1.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintignore create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.gitignore create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/README.md create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/package.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/v1beta/workflows.proto create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.create_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.get_execution.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.list_executions.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.create_workflow.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.delete_workflow.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.get_workflow.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.list_workflows.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.update_workflow.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client_config.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_proto_list.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client_config.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_proto_list.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_executions_v1beta.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_workflows_v1beta.ts create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-workstations/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-workstations/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/README.md create mode 100644 owl-bot-staging/google-cloud-workstations/v1/package.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1/protos/google/cloud/workstations/v1/workstations.proto create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/snippet_metadata_google.cloud.workstations.v1.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_cluster.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_config.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_cluster.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_config.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.generate_access_token.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_cluster.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_config.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstation_configs.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstations.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_clusters.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_configs.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstations.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.start_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.stop_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_cluster.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_config.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client_config.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_proto_list.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1/test/gapic_workstations_v1.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.eslintignore create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.gitignore create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/README.md create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/package.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/protos/google/cloud/workstations/v1beta/workstations.proto create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workstations.v1beta.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_cluster.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_config.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_cluster.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_config.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.generate_access_token.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_cluster.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_config.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstation_configs.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstations.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_clusters.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_configs.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstations.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.start_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.stop_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_cluster.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_config.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/index.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client_config.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_proto_list.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/test/gapic_workstations_v1beta.ts create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/webpack.config.js create mode 100644 owl-bot-staging/google-container/v1/.eslintignore create mode 100644 owl-bot-staging/google-container/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-container/v1/.gitignore create mode 100644 owl-bot-staging/google-container/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-container/v1/.mocharc.js create mode 100644 owl-bot-staging/google-container/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-container/v1/README.md create mode 100644 owl-bot-staging/google-container/v1/package.json create mode 100644 owl-bot-staging/google-container/v1/protos/google/container/v1/cluster_service.proto create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.cancel_operation.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.check_autopilot_compatibility.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_i_p_rotation.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_node_pool_upgrade.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_cluster.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_node_pool.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_cluster.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_node_pool.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_cluster.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_j_s_o_n_web_keys.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_node_pool.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_operation.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_server_config.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_clusters.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_node_pools.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_operations.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_usable_subnetworks.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.rollback_node_pool_upgrade.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_addons_config.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_labels.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_legacy_abac.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_locations.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_logging_service.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_maintenance_policy.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_master_auth.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_monitoring_service.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_network_policy.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_autoscaling.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_management.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_size.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.start_i_p_rotation.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_cluster.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_master.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_node_pool.js create mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/snippet_metadata_google.container.v1.json create mode 100644 owl-bot-staging/google-container/v1/src/index.ts create mode 100644 owl-bot-staging/google-container/v1/src/v1/cluster_manager_client.ts create mode 100644 owl-bot-staging/google-container/v1/src/v1/cluster_manager_client_config.json create mode 100644 owl-bot-staging/google-container/v1/src/v1/cluster_manager_proto_list.json create mode 100644 owl-bot-staging/google-container/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-container/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-container/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-container/v1/test/gapic_cluster_manager_v1.ts create mode 100644 owl-bot-staging/google-container/v1/tsconfig.json create mode 100644 owl-bot-staging/google-container/v1/webpack.config.js create mode 100644 owl-bot-staging/google-container/v1beta1/.eslintignore create mode 100644 owl-bot-staging/google-container/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-container/v1beta1/.gitignore create mode 100644 owl-bot-staging/google-container/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-container/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-container/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-container/v1beta1/README.md create mode 100644 owl-bot-staging/google-container/v1beta1/package.json create mode 100644 owl-bot-staging/google-container/v1beta1/protos/google/container/v1beta1/cluster_service.proto create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.cancel_operation.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.check_autopilot_compatibility.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_i_p_rotation.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_node_pool_upgrade.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_cluster.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_node_pool.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_cluster.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_node_pool.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_cluster.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_j_s_o_n_web_keys.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_node_pool.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_operation.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_server_config.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_clusters.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_locations.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_node_pools.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_operations.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_usable_subnetworks.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.rollback_node_pool_upgrade.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_addons_config.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_labels.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_legacy_abac.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_locations.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_logging_service.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_maintenance_policy.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_master_auth.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_monitoring_service.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_network_policy.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_autoscaling.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_management.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_size.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.start_i_p_rotation.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_cluster.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_master.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_node_pool.js create mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/snippet_metadata_google.container.v1beta1.json create mode 100644 owl-bot-staging/google-container/v1beta1/src/index.ts create mode 100644 owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client.ts create mode 100644 owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client_config.json create mode 100644 owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_proto_list.json create mode 100644 owl-bot-staging/google-container/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-container/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-container/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-container/v1beta1/test/gapic_cluster_manager_v1beta1.ts create mode 100644 owl-bot-staging/google-container/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-container/v1beta1/webpack.config.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/.eslintignore create mode 100644 owl-bot-staging/google-dataflow/v1beta3/.eslintrc.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/.gitignore create mode 100644 owl-bot-staging/google-dataflow/v1beta3/.jsdoc.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/.mocharc.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/.prettierrc.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/README.md create mode 100644 owl-bot-staging/google-dataflow/v1beta3/package.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/environment.proto create mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/jobs.proto create mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/messages.proto create mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/metrics.proto create mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/snapshots.proto create mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/streaming.proto create mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/templates.proto create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/flex_templates_service.launch_flex_template.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.aggregated_list_jobs.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.check_active_jobs.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.create_job.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.get_job.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.list_jobs.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.snapshot_job.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.update_job.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/messages_v1_beta3.list_job_messages.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_execution_details.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_metrics.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_stage_execution_details.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.delete_snapshot.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.get_snapshot.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.list_snapshots.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snippet_metadata_google.dataflow.v1beta3.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.create_job_from_template.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.get_template.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.launch_template.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/index.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client_config.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_proto_list.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/gapic_metadata.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/index.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client_config.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_proto_list.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client_config.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_proto_list.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client_config.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_proto_list.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client_config.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_proto_list.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client_config.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_proto_list.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/system-test/install.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_flex_templates_service_v1beta3.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_jobs_v1_beta3_v1beta3.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_messages_v1_beta3_v1beta3.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_metrics_v1_beta3_v1beta3.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_snapshots_v1_beta3_v1beta3.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_templates_service_v1beta3.ts create mode 100644 owl-bot-staging/google-dataflow/v1beta3/tsconfig.json create mode 100644 owl-bot-staging/google-dataflow/v1beta3/webpack.config.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.eslintignore create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.gitignore create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.mocharc.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/README.md create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/package.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/apt_artifact.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/artifact.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/file.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/package.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/repository.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/service.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/settings.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/tag.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/version.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/vpcsc_config.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/yum_artifact.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_repository.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_tag.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_package.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_repository.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_tag.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_version.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_docker_image.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_file.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_iam_policy.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_maven_artifact.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_npm_package.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_package.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_project_settings.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_python_package.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_repository.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_tag.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_v_p_c_s_c_config.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_version.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_apt_artifacts.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_yum_artifacts.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_docker_images.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_files.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_maven_artifacts.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_npm_packages.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_packages.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_python_packages.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_repositories.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_tags.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_versions.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.set_iam_policy.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.test_iam_permissions.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_project_settings.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_repository.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_tag.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_v_p_c_s_c_config.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/snippet_metadata_google.devtools.artifactregistry.v1.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/index.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client_config.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_proto_list.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/test/gapic_artifact_registry_v1.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/tsconfig.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/webpack.config.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintignore create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintrc.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.gitignore create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.jsdoc.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.mocharc.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.prettierrc.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/README.md create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/package.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/apt_artifact.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/file.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/package.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/repository.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/service.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/settings.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/tag.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/version.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/yum_artifact.proto create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_repository.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_tag.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_package.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_repository.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_tag.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_version.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_file.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_iam_policy.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_package.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_project_settings.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_repository.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_tag.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_version.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_apt_artifacts.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_yum_artifacts.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_files.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_packages.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_repositories.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_tags.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_versions.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.set_iam_policy.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.test_iam_permissions.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_project_settings.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_repository.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_tag.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/snippet_metadata_google.devtools.artifactregistry.v1beta2.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/index.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client_config.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_proto_list.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/gapic_metadata.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/index.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/install.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/test/gapic_artifact_registry_v1beta2.ts create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/tsconfig.json create mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/webpack.config.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/README.md create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/package.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata_google.devtools.cloudbuild.v1.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/tsconfig.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/webpack.config.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.jsdoc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.prettierrc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/README.md create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/package.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata_google.devtools.cloudbuild.v2.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/tsconfig.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/webpack.config.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.eslintignore create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.gitignore create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.mocharc.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/README.md create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/package.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/google/devtools/containeranalysis/v1/containeranalysis.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/attestation.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/build.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/common.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/compliance.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/cvss.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/deployment.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/discovery.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/dsse_attestation.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/grafeas.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/image.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_provenance.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_statement.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/package.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/provenance.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/severity.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance_zero_two.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/upgrade.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vex.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vulnerability.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_iam_policy.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_vulnerability_occurrences_summary.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.set_iam_policy.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.test_iam_permissions.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_notes.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_occurrences.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_note.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_occurrence.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_note.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_occurrence.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_note.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence_note.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_note_occurrences.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_notes.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_occurrences.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_note.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_occurrence.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/snippet_metadata_google.devtools.containeranalysis.v1.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/index.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client_config.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_proto_list.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client_config.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_proto_list.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_container_analysis_v1.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_grafeas_v1.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/tsconfig.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/webpack.config.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintignore create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.gitignore create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/README.md create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/package.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/build/build.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/common/common.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/image/image.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/package/package.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/source/source.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.get_iam_policy.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.set_iam_policy.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.test_iam_permissions.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_notes.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_occurrences.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_note.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_occurrence.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_note.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_occurrence.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_note.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence_note.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_vulnerability_occurrences_summary.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_note_occurrences.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_notes.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_occurrences.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_note.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_occurrence.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/snippet_metadata_google.devtools.containeranalysis.v1beta1.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/index.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client_config.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_proto_list.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client_config.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_proto_list.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_container_analysis_v1_beta1_v1beta1.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_grafeas_v1_beta1_v1beta1.ts create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/webpack.config.js create mode 100644 owl-bot-staging/google-iam-credentials/v1/.eslintignore create mode 100644 owl-bot-staging/google-iam-credentials/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-iam-credentials/v1/.gitignore create mode 100644 owl-bot-staging/google-iam-credentials/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-iam-credentials/v1/.mocharc.js create mode 100644 owl-bot-staging/google-iam-credentials/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-iam-credentials/v1/README.md create mode 100644 owl-bot-staging/google-iam-credentials/v1/package.json create mode 100644 owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/common.proto create mode 100644 owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/iamcredentials.proto create mode 100644 owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_access_token.js create mode 100644 owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_id_token.js create mode 100644 owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_blob.js create mode 100644 owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_jwt.js create mode 100644 owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/snippet_metadata_google.iam.credentials.v1.json create mode 100644 owl-bot-staging/google-iam-credentials/v1/src/index.ts create mode 100644 owl-bot-staging/google-iam-credentials/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client.ts create mode 100644 owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client_config.json create mode 100644 owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_proto_list.json create mode 100644 owl-bot-staging/google-iam-credentials/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-iam-credentials/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-iam-credentials/v1/test/gapic_i_a_m_credentials_v1.ts create mode 100644 owl-bot-staging/google-iam-credentials/v1/tsconfig.json create mode 100644 owl-bot-staging/google-iam-credentials/v1/webpack.config.js create mode 100644 owl-bot-staging/google-iam/v2/.eslintignore create mode 100644 owl-bot-staging/google-iam/v2/.eslintrc.json create mode 100644 owl-bot-staging/google-iam/v2/.gitignore create mode 100644 owl-bot-staging/google-iam/v2/.jsdoc.js create mode 100644 owl-bot-staging/google-iam/v2/.mocharc.js create mode 100644 owl-bot-staging/google-iam/v2/.prettierrc.js create mode 100644 owl-bot-staging/google-iam/v2/README.md create mode 100644 owl-bot-staging/google-iam/v2/package.json create mode 100644 owl-bot-staging/google-iam/v2/protos/google/iam/v2/deny.proto create mode 100644 owl-bot-staging/google-iam/v2/protos/google/iam/v2/policy.proto create mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/policies.create_policy.js create mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/policies.delete_policy.js create mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/policies.get_policy.js create mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/policies.list_policies.js create mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/policies.update_policy.js create mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/snippet_metadata_google.iam.v2.json create mode 100644 owl-bot-staging/google-iam/v2/src/index.ts create mode 100644 owl-bot-staging/google-iam/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/google-iam/v2/src/v2/index.ts create mode 100644 owl-bot-staging/google-iam/v2/src/v2/policies_client.ts create mode 100644 owl-bot-staging/google-iam/v2/src/v2/policies_client_config.json create mode 100644 owl-bot-staging/google-iam/v2/src/v2/policies_proto_list.json create mode 100644 owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-iam/v2/system-test/install.ts create mode 100644 owl-bot-staging/google-iam/v2/test/gapic_policies_v2.ts create mode 100644 owl-bot-staging/google-iam/v2/tsconfig.json create mode 100644 owl-bot-staging/google-iam/v2/webpack.config.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintignore create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.gitignore create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.mocharc.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/README.md create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/package.json create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/type/device_resources.proto create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_context_manager.proto create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_level.proto create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_policy.proto create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.commit_service_perimeters.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_level.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_policy.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_gcp_user_access_binding.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_service_perimeter.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_level.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_policy.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_service_perimeter.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_level.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_policy.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_gcp_user_access_binding.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_iam_policy.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_service_perimeter.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_levels.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_policies.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_gcp_user_access_bindings.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_service_perimeters.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_access_levels.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_service_perimeters.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.set_iam_policy.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.test_iam_permissions.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_level.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_policy.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_gcp_user_access_binding.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_service_perimeter.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/snippet_metadata_google.identity.accesscontextmanager.v1.json create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/index.ts create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client.ts create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client_config.json create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_proto_list.json create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/test/gapic_access_context_manager_v1.ts create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/tsconfig.json create mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/webpack.config.js create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.eslintignore create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.gitignore create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.mocharc.js create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/README.md create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/package.json create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/geo/type/viewport.proto create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address.proto create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address_validation_service.proto create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/geocode.proto create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/metadata.proto create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/usps_data.proto create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.provide_validation_feedback.js create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.validate_address.js create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/snippet_metadata_google.maps.addressvalidation.v1.json create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/index.ts create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client.ts create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client_config.json create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_proto_list.json create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/test/gapic_address_validation_v1.ts create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/tsconfig.json create mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/webpack.config.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintignore create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.gitignore create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.mocharc.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/README.md create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/package.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/data_source.proto create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/dataset.proto create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets_service.proto create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.create_dataset.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.delete_dataset.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.get_dataset.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.list_datasets.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.update_dataset_metadata.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/snippet_metadata_google.maps.mapsplatformdatasets.v1.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/index.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client_config.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_proto_list.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/test/gapic_maps_platform_datasets_v1.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/tsconfig.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/webpack.config.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintignore create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintrc.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.gitignore create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.jsdoc.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.mocharc.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.prettierrc.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/README.md create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/package.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/data_source.proto create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/dataset.proto create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets_alpha_service.proto create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.create_dataset.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset_version.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.get_dataset.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_dataset_versions.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_datasets.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.update_dataset_metadata.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/snippet_metadata_google.maps.mapsplatformdatasets.v1alpha.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/index.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/gapic_metadata.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/index.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client_config.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_proto_list.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/install.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/test/gapic_maps_platform_datasets_v1_alpha_v1alpha.ts create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/tsconfig.json create mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/webpack.config.js create mode 100644 owl-bot-staging/google-maps-places/v1/.eslintignore create mode 100644 owl-bot-staging/google-maps-places/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-maps-places/v1/.gitignore create mode 100644 owl-bot-staging/google-maps-places/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-maps-places/v1/.mocharc.js create mode 100644 owl-bot-staging/google-maps-places/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-maps-places/v1/README.md create mode 100644 owl-bot-staging/google-maps-places/v1/package.json create mode 100644 owl-bot-staging/google-maps-places/v1/protos/google/geo/type/viewport.proto create mode 100644 owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/geometry.proto create mode 100644 owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/place.proto create mode 100644 owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/places_service.proto create mode 100644 owl-bot-staging/google-maps-places/v1/samples/generated/v1/places.search_text.js create mode 100644 owl-bot-staging/google-maps-places/v1/samples/generated/v1/snippet_metadata_google.maps.places.v1.json create mode 100644 owl-bot-staging/google-maps-places/v1/src/index.ts create mode 100644 owl-bot-staging/google-maps-places/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-maps-places/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-maps-places/v1/src/v1/places_client.ts create mode 100644 owl-bot-staging/google-maps-places/v1/src/v1/places_client_config.json create mode 100644 owl-bot-staging/google-maps-places/v1/src/v1/places_proto_list.json create mode 100644 owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-maps-places/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-maps-places/v1/test/gapic_places_v1.ts create mode 100644 owl-bot-staging/google-maps-places/v1/tsconfig.json create mode 100644 owl-bot-staging/google-maps-places/v1/webpack.config.js create mode 100644 owl-bot-staging/google-maps-routing/v2/.eslintignore create mode 100644 owl-bot-staging/google-maps-routing/v2/.eslintrc.json create mode 100644 owl-bot-staging/google-maps-routing/v2/.gitignore create mode 100644 owl-bot-staging/google-maps-routing/v2/.jsdoc.js create mode 100644 owl-bot-staging/google-maps-routing/v2/.mocharc.js create mode 100644 owl-bot-staging/google-maps-routing/v2/.prettierrc.js create mode 100644 owl-bot-staging/google-maps-routing/v2/README.md create mode 100644 owl-bot-staging/google-maps-routing/v2/package.json create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/geo/type/viewport.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/fallback_info.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/geocoding_results.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/localized_time.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/location.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/maneuver.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/navigation_instruction.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/polyline.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_label.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_modifiers.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_travel_mode.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routes_service.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routing_preference.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/speed_reading_interval.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_info.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_passes.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/traffic_model.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit_preferences.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/units.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_emission_type.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_info.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/waypoint.proto create mode 100644 owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_route_matrix.js create mode 100644 owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_routes.js create mode 100644 owl-bot-staging/google-maps-routing/v2/samples/generated/v2/snippet_metadata_google.maps.routing.v2.json create mode 100644 owl-bot-staging/google-maps-routing/v2/src/index.ts create mode 100644 owl-bot-staging/google-maps-routing/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/google-maps-routing/v2/src/v2/index.ts create mode 100644 owl-bot-staging/google-maps-routing/v2/src/v2/routes_client.ts create mode 100644 owl-bot-staging/google-maps-routing/v2/src/v2/routes_client_config.json create mode 100644 owl-bot-staging/google-maps-routing/v2/src/v2/routes_proto_list.json create mode 100644 owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-maps-routing/v2/system-test/install.ts create mode 100644 owl-bot-staging/google-maps-routing/v2/test/gapic_routes_v2.ts create mode 100644 owl-bot-staging/google-maps-routing/v2/tsconfig.json create mode 100644 owl-bot-staging/google-maps-routing/v2/webpack.config.js create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.eslintignore create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.gitignore create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.mocharc.js create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/README.md create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/package.json create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/alertchart.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/collapsible_group.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/common.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard_filter.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboards_service.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/drilldowns.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/layouts.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/logs_panel.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/metrics.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/scorecard.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/service.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table_display_options.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/text.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/widget.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/xychart.proto create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.create_dashboard.js create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.delete_dashboard.js create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.get_dashboard.js create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.list_dashboards.js create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.update_dashboard.js create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/snippet_metadata_google.monitoring.dashboard.v1.json create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/index.ts create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client.ts create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client_config.json create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_proto_list.json create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/test/gapic_dashboards_service_v1.ts create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/tsconfig.json create mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/webpack.config.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/.eslintignore create mode 100644 owl-bot-staging/google-privacy-dlp/v2/.eslintrc.json create mode 100644 owl-bot-staging/google-privacy-dlp/v2/.gitignore create mode 100644 owl-bot-staging/google-privacy-dlp/v2/.jsdoc.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/.mocharc.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/.prettierrc.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/README.md create mode 100644 owl-bot-staging/google-privacy-dlp/v2/package.json create mode 100644 owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/dlp.proto create mode 100644 owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/storage.proto create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.activate_job_trigger.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.cancel_dlp_job.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_deidentify_template.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_dlp_job.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_inspect_template.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_job_trigger.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_stored_info_type.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.deidentify_content.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_deidentify_template.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_dlp_job.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_inspect_template.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_job_trigger.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_stored_info_type.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.finish_dlp_job.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_deidentify_template.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_dlp_job.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_inspect_template.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_job_trigger.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_stored_info_type.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_dlp_job.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_job_trigger.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.inspect_content.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_deidentify_templates.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_dlp_jobs.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_info_types.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_inspect_templates.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_job_triggers.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_stored_info_types.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.redact_image.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.reidentify_content.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_deidentify_template.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_inspect_template.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_job_trigger.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_stored_info_type.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json create mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/index.ts create mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client.ts create mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client_config.json create mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_proto_list.json create mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/v2/index.ts create mode 100644 owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-privacy-dlp/v2/system-test/install.ts create mode 100644 owl-bot-staging/google-privacy-dlp/v2/test/gapic_dlp_service_v2.ts create mode 100644 owl-bot-staging/google-privacy-dlp/v2/tsconfig.json create mode 100644 owl-bot-staging/google-privacy-dlp/v2/webpack.config.js diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/.eslintignore b/owl-bot-staging/google-cloud-vmwareengine/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/.eslintrc.json b/owl-bot-staging/google-cloud-vmwareengine/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/.gitignore b/owl-bot-staging/google-cloud-vmwareengine/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/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-vmwareengine/v1/.jsdoc.js b/owl-bot-staging/google-cloud-vmwareengine/v1/.jsdoc.js new file mode 100644 index 00000000000..eb1f6fb78c2 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/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/vmwareengine', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/.mocharc.js b/owl-bot-staging/google-cloud-vmwareengine/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/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-vmwareengine/v1/.prettierrc.js b/owl-bot-staging/google-cloud-vmwareengine/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/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-vmwareengine/v1/README.md b/owl-bot-staging/google-cloud-vmwareengine/v1/README.md new file mode 100644 index 00000000000..0bf3ffc6467 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/README.md @@ -0,0 +1 @@ +Vmwareengine: Nodejs Client diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/package.json b/owl-bot-staging/google-cloud-vmwareengine/v1/package.json new file mode 100644 index 00000000000..7799de13ad4 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/vmwareengine", + "version": "0.1.0", + "description": "Vmwareengine client for Node.js", + "repository": "googleapis/nodejs-vmwareengine", + "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 vmwareengine", + "vmwareengine", + "vmware engine" + ], + "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-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine.proto b/owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine.proto new file mode 100644 index 00000000000..eef4dcd7da4 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine.proto @@ -0,0 +1,2015 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.vmwareengine.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/vmwareengine/v1/vmwareengine_resources.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.VmwareEngine.V1"; +option go_package = "cloud.google.com/go/vmwareengine/apiv1/vmwareenginepb;vmwareenginepb"; +option java_multiple_files = true; +option java_outer_classname = "VmwareengineProto"; +option java_package = "com.google.cloud.vmwareengine.v1"; +option php_namespace = "Google\\Cloud\\VmwareEngine\\V1"; +option ruby_package = "Google::Cloud::VmwareEngine::V1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; + +// VMwareEngine manages VMware's private clusters in the Cloud. +service VmwareEngine { + option (google.api.default_host) = "vmwareengine.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists `PrivateCloud` resources in a given project and location. + rpc ListPrivateClouds(ListPrivateCloudsRequest) + returns (ListPrivateCloudsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/privateClouds" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves a `PrivateCloud` resource by its resource name. + rpc GetPrivateCloud(GetPrivateCloudRequest) returns (PrivateCloud) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/privateClouds/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new `PrivateCloud` resource in a given project and location. + // Private clouds can only be created in zones, regional private clouds are + // not supported. + // + // Creating a private cloud also creates a [management + // cluster](https://cloud.google.com/vmware-engine/docs/concepts-vmware-components) + // for that private cloud. + rpc CreatePrivateCloud(CreatePrivateCloudRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/privateClouds" + body: "private_cloud" + }; + option (google.api.method_signature) = + "parent,private_cloud,private_cloud_id"; + option (google.longrunning.operation_info) = { + response_type: "PrivateCloud" + metadata_type: "OperationMetadata" + }; + } + + // Modifies a `PrivateCloud` resource. Only the following fields can be + // updated: `description`. + // Only fields specified in `updateMask` are applied. + // + // During operation processing, the resource is temporarily in the `ACTIVE` + // state before the operation fully completes. For that period of time, you + // can't update the resource. Use the operation status to determine when the + // processing fully completes. + rpc UpdatePrivateCloud(UpdatePrivateCloudRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{private_cloud.name=projects/*/locations/*/privateClouds/*}" + body: "private_cloud" + }; + option (google.api.method_signature) = "private_cloud,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "PrivateCloud" + metadata_type: "OperationMetadata" + }; + } + + // Schedules a `PrivateCloud` resource for deletion. + // + // A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` + // set to `DELETED` and `expireTime` set to the time when deletion is final + // and can no longer be reversed. The delete operation is marked as done + // as soon as the `PrivateCloud` is successfully scheduled for deletion + // (this also applies when `delayHours` is set to zero), and the operation is + // not kept in pending state until `PrivateCloud` is purged. + // `PrivateCloud` can be restored using `UndeletePrivateCloud` method before + // the `expireTime` elapses. When `expireTime` is reached, deletion is final + // and all private cloud resources are irreversibly removed and billing stops. + // During the final removal process, `PrivateCloud.state` is set to `PURGING`. + // `PrivateCloud` can be polled using standard `GET` method for the whole + // period of deletion and purging. It will not be returned only + // when it is completely purged. + rpc DeletePrivateCloud(DeletePrivateCloudRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/privateClouds/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "PrivateCloud" + metadata_type: "OperationMetadata" + }; + } + + // Restores a private cloud that was previously scheduled for deletion by + // `DeletePrivateCloud`. A `PrivateCloud` resource scheduled for deletion has + // `PrivateCloud.state` set to `DELETED` and `PrivateCloud.expireTime` set to + // the time when deletion can no longer be reversed. + rpc UndeletePrivateCloud(UndeletePrivateCloudRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/privateClouds/*}:undelete" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "PrivateCloud" + metadata_type: "OperationMetadata" + }; + } + + // Lists `Cluster` resources in a given private cloud. + rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/privateClouds/*}/clusters" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves a `Cluster` resource by its resource name. + rpc GetCluster(GetClusterRequest) returns (Cluster) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/privateClouds/*/clusters/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new cluster in a given private cloud. + // Creating a new cluster provides additional nodes for + // use in the parent private cloud and requires sufficient [node + // quota](https://cloud.google.com/vmware-engine/quotas). + rpc CreateCluster(CreateClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/privateClouds/*}/clusters" + body: "cluster" + }; + option (google.api.method_signature) = "parent,cluster,cluster_id"; + option (google.longrunning.operation_info) = { + response_type: "Cluster" + metadata_type: "OperationMetadata" + }; + } + + // Modifies a `Cluster` resource. Only the following fields can be updated: + // `node_type_configs.*.node_count`. Only fields specified in `updateMask` are + // applied. + // + // During operation processing, the resource is temporarily in the `ACTIVE` + // state before the operation fully completes. For that period of time, you + // can't update the resource. Use the operation status to determine when the + // processing fully completes. + rpc UpdateCluster(UpdateClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{cluster.name=projects/*/locations/*/privateClouds/*/clusters/*}" + body: "cluster" + }; + option (google.api.method_signature) = "cluster,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Cluster" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a `Cluster` resource. To avoid unintended data loss, migrate or + // gracefully shut down any workloads running on the cluster before deletion. + // You cannot delete the management cluster of a private cloud using this + // method. + rpc DeleteCluster(DeleteClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/privateClouds/*/clusters/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Lists subnets in a given private cloud. + rpc ListSubnets(ListSubnetsRequest) returns (ListSubnetsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/privateClouds/*}/subnets" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single subnet. + rpc GetSubnet(GetSubnetRequest) returns (Subnet) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/privateClouds/*/subnets/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the parameters of a single subnet. Only fields specified in + // `update_mask` are applied. + // + // *Note*: This API is synchronous and always returns a successful + // `google.longrunning.Operation` (LRO). The returned LRO will only have + // `done` and `response` fields. + rpc UpdateSubnet(UpdateSubnetRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{subnet.name=projects/*/locations/*/privateClouds/*/subnets/*}" + body: "subnet" + }; + option (google.api.method_signature) = "subnet,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Subnet" + metadata_type: "OperationMetadata" + }; + } + + // Lists node types + rpc ListNodeTypes(ListNodeTypesRequest) returns (ListNodeTypesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/nodeTypes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single `NodeType`. + rpc GetNodeType(GetNodeTypeRequest) returns (NodeType) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/nodeTypes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets details of credentials for NSX appliance. + rpc ShowNsxCredentials(ShowNsxCredentialsRequest) returns (Credentials) { + option (google.api.http) = { + get: "/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:showNsxCredentials" + }; + option (google.api.method_signature) = "private_cloud"; + } + + // Gets details of credentials for Vcenter appliance. + rpc ShowVcenterCredentials(ShowVcenterCredentialsRequest) + returns (Credentials) { + option (google.api.http) = { + get: "/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:showVcenterCredentials" + }; + option (google.api.method_signature) = "private_cloud"; + } + + // Resets credentials of the NSX appliance. + rpc ResetNsxCredentials(ResetNsxCredentialsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:resetNsxCredentials" + body: "*" + }; + option (google.api.method_signature) = "private_cloud"; + option (google.longrunning.operation_info) = { + response_type: "PrivateCloud" + metadata_type: "OperationMetadata" + }; + } + + // Resets credentials of the Vcenter appliance. + rpc ResetVcenterCredentials(ResetVcenterCredentialsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:resetVcenterCredentials" + body: "*" + }; + option (google.api.method_signature) = "private_cloud"; + option (google.longrunning.operation_info) = { + response_type: "PrivateCloud" + metadata_type: "OperationMetadata" + }; + } + + // Creates a new HCX activation key in a given private cloud. + rpc CreateHcxActivationKey(CreateHcxActivationKeyRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/privateClouds/*}/hcxActivationKeys" + body: "hcx_activation_key" + }; + option (google.api.method_signature) = + "parent,hcx_activation_key,hcx_activation_key_id"; + option (google.longrunning.operation_info) = { + response_type: "HcxActivationKey" + metadata_type: "OperationMetadata" + }; + } + + // Lists `HcxActivationKey` resources in a given private cloud. + rpc ListHcxActivationKeys(ListHcxActivationKeysRequest) + returns (ListHcxActivationKeysResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/privateClouds/*}/hcxActivationKeys" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves a `HcxActivationKey` resource by its resource name. + rpc GetHcxActivationKey(GetHcxActivationKeyRequest) + returns (HcxActivationKey) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves a `NetworkPolicy` resource by its resource name. + rpc GetNetworkPolicy(GetNetworkPolicyRequest) returns (NetworkPolicy) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/networkPolicies/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists `NetworkPolicy` resources in a specified project and location. + rpc ListNetworkPolicies(ListNetworkPoliciesRequest) + returns (ListNetworkPoliciesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/networkPolicies" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new network policy in a given VMware Engine network of a + // project and location (region). A new network policy cannot be created if + // another network policy already exists in the same scope. + rpc CreateNetworkPolicy(CreateNetworkPolicyRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/networkPolicies" + body: "network_policy" + }; + option (google.api.method_signature) = + "parent,network_policy,network_policy_id"; + option (google.longrunning.operation_info) = { + response_type: "NetworkPolicy" + metadata_type: "OperationMetadata" + }; + } + + // Modifies a `NetworkPolicy` resource. Only the following fields can be + // updated: `internet_access`, `external_ip`, `edge_services_cidr`. + // Only fields specified in `updateMask` are applied. When updating a network + // policy, the external IP network service can only be disabled if there are + // no external IP addresses present in the scope of the policy. Also, a + // `NetworkService` cannot be updated when `NetworkService.state` is set + // to `RECONCILING`. + // + // During operation processing, the resource is temporarily in the `ACTIVE` + // state before the operation fully completes. For that period of time, you + // can't update the resource. Use the operation status to determine when the + // processing fully completes. + rpc UpdateNetworkPolicy(UpdateNetworkPolicyRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{network_policy.name=projects/*/locations/*/networkPolicies/*}" + body: "network_policy" + }; + option (google.api.method_signature) = "network_policy,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "NetworkPolicy" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a `NetworkPolicy` resource. A network policy cannot be deleted + // when `NetworkService.state` is set to `RECONCILING` for either its external + // IP or internet access service. + rpc DeleteNetworkPolicy(DeleteNetworkPolicyRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/networkPolicies/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Creates a new VMware Engine network that can be used by a private cloud. + rpc CreateVmwareEngineNetwork(CreateVmwareEngineNetworkRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/vmwareEngineNetworks" + body: "vmware_engine_network" + }; + option (google.api.method_signature) = + "parent,vmware_engine_network,vmware_engine_network_id"; + option (google.longrunning.operation_info) = { + response_type: "VmwareEngineNetwork" + metadata_type: "OperationMetadata" + }; + } + + // Modifies a VMware Engine network resource. Only the following fields can be + // updated: `description`. Only fields specified in `updateMask` are + // applied. + rpc UpdateVmwareEngineNetwork(UpdateVmwareEngineNetworkRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{vmware_engine_network.name=projects/*/locations/*/vmwareEngineNetworks/*}" + body: "vmware_engine_network" + }; + option (google.api.method_signature) = "vmware_engine_network,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "VmwareEngineNetwork" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a `VmwareEngineNetwork` resource. You can only delete a VMware + // Engine network after all resources that refer to it are deleted. For + // example, a private cloud, a network peering, and a network policy can all + // refer to the same VMware Engine network. + rpc DeleteVmwareEngineNetwork(DeleteVmwareEngineNetworkRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/vmwareEngineNetworks/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Retrieves a `VmwareEngineNetwork` resource by its resource name. The + // resource contains details of the VMware Engine network, such as its VMware + // Engine network type, peered networks in a service project, and state + // (for example, `CREATING`, `ACTIVE`, `DELETING`). + rpc GetVmwareEngineNetwork(GetVmwareEngineNetworkRequest) + returns (VmwareEngineNetwork) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/vmwareEngineNetworks/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists `VmwareEngineNetwork` resources in a given project and location. + rpc ListVmwareEngineNetworks(ListVmwareEngineNetworksRequest) + returns (ListVmwareEngineNetworksResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/vmwareEngineNetworks" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new private connection that can be used for accessing private + // Clouds. + rpc CreatePrivateConnection(CreatePrivateConnectionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/privateConnections" + body: "private_connection" + }; + option (google.api.method_signature) = + "parent,private_connection,private_connection_id"; + option (google.longrunning.operation_info) = { + response_type: "PrivateConnection" + metadata_type: "OperationMetadata" + }; + } + + // Retrieves a `PrivateConnection` resource by its resource name. The resource + // contains details of the private connection, such as connected + // network, routing mode and state. + rpc GetPrivateConnection(GetPrivateConnectionRequest) + returns (PrivateConnection) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/privateConnections/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists `PrivateConnection` resources in a given project and location. + rpc ListPrivateConnections(ListPrivateConnectionsRequest) + returns (ListPrivateConnectionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/privateConnections" + }; + option (google.api.method_signature) = "parent"; + } + + // Modifies a `PrivateConnection` resource. Only `description` and + // `routing_mode` fields can be updated. Only fields specified in `updateMask` + // are applied. + rpc UpdatePrivateConnection(UpdatePrivateConnectionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{private_connection.name=projects/*/locations/*/privateConnections/*}" + body: "private_connection" + }; + option (google.api.method_signature) = "private_connection,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "PrivateConnection" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a `PrivateConnection` resource. When a private connection is + // deleted for a VMware Engine network, the connected network becomes + // inaccessible to that VMware Engine network. + rpc DeletePrivateConnection(DeletePrivateConnectionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/privateConnections/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Lists the private connection routes exchanged over a peering connection. + rpc ListPrivateConnectionPeeringRoutes( + ListPrivateConnectionPeeringRoutesRequest) + returns (ListPrivateConnectionPeeringRoutesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/privateConnections/*}/peeringRoutes" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request message for +// [VmwareEngine.ListPrivateClouds][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateClouds] +message ListPrivateCloudsRequest { + // Required. The resource name of the private cloud to be queried for + // clusters. Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of private clouds to return in one page. + // The service may return fewer than this value. + // The maximum value is coerced to 1000. + // The default value of this field is 500. + int32 page_size = 2; + + // A page token, received from a previous `ListPrivateClouds` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListPrivateClouds` must + // match the call that provided the page token. + string page_token = 3; + + // A filter expression that matches resources returned in the response. + // The expression must specify the field name, a comparison operator, and the + // value that you want to use for filtering. The value must be a string, a + // number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + // `<`. + // + // For example, if you are filtering a list of private clouds, you can exclude + // the ones named `example-pc` by specifying `name != "example-pc"`. + // + // You can also filter nested fields. For example, you could specify + // `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + // only if they have a matching address in their network configuration. + // + // To filter on multiple expressions, provide each separate expression within + // parentheses. For example: + // ``` + // (name = "example-pc") + // (createTime > "2021-04-12T08:15:10.40Z") + // ``` + // + // By default, each expression is an `AND` expression. However, you can + // include `AND` and `OR` expressions explicitly. For example: + // ``` + // (name = "private-cloud-1") AND + // (createTime > "2021-04-12T08:15:10.40Z") OR + // (name = "private-cloud-2") + // ``` + string filter = 4; + + // Sorts list results by a certain order. By default, returned results are + // ordered by `name` in ascending order. You can also sort results in + // descending order based on the `name` value using `orderBy="name desc"`. + // Currently, only ordering by `name` is supported. + string order_by = 5; +} + +// Response message for +// [VmwareEngine.ListPrivateClouds][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateClouds] +message ListPrivateCloudsResponse { + // A list of private clouds. + repeated PrivateCloud private_clouds = 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 when making an aggregated query using + // wildcards. + repeated string unreachable = 3; +} + +// Request message for +// [VmwareEngine.GetPrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateCloud] +message GetPrivateCloudRequest { + // Required. The resource name of the private cloud to retrieve. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; +} + +// Request message for +// [VmwareEngine.CreatePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateCloud] +message CreatePrivateCloudRequest { + // Required. The resource name of the location to create the new + // private cloud in. Resource names are schemeless URIs that follow the + // conventions in https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The user-provided identifier of the private cloud to be created. + // This identifier must be unique among each `PrivateCloud` within the parent + // and becomes the final token in the name URI. + // The identifier must meet the following requirements: + // + // * Only contains 1-63 alphanumeric characters and hyphens + // * Begins with an alphabetical character + // * Ends with a non-hyphen character + // * Not formatted as a UUID + // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + // (section 3.5) + string private_cloud_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The initial description of the new private cloud. + PrivateCloud private_cloud = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. 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. True if you want the request to be validated and not executed; + // false otherwise. + bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [VmwareEngine.UpdatePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateCloud] +message UpdatePrivateCloudRequest { + // Required. Private cloud description. + PrivateCloud private_cloud = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Field mask is used to specify the fields to be overwritten in the + // `PrivateCloud` resource by the update. The fields specified in `updateMask` + // 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 = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. 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 +// [VmwareEngine.DeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateCloud] +message DeletePrivateCloudRequest { + // Required. The resource name of the private cloud to delete. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; + + // Optional. 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, cascade delete is enabled and all children of + // this private cloud resource are also deleted. When this flag is set to + // false, the private cloud will not be deleted if there are any children + // other than the management cluster. The management cluster is always + // deleted. + bool force = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Time delay of the deletion specified in hours. The default value + // is `3`. Specifying a non-zero value for this field changes the value of + // `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned + // deletion time. Deletion can be cancelled before `expire_time` elapses using + // [VmwareEngine.UndeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud]. + // Specifying a value of `0` for this field instead begins the deletion + // process and ceases billing immediately. During the final deletion process, + // the value of `PrivateCloud.state` becomes `PURGING`. + optional int32 delay_hours = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [VmwareEngine.UndeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud] +message UndeletePrivateCloudRequest { + // Required. The resource name of the private cloud scheduled for deletion. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; + + // Optional. The request ID must be a valid UUID with the exception that zero + // UUID is not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [VmwareEngine.ListClusters][google.cloud.vmwareengine.v1.VmwareEngine.ListClusters] +message ListClustersRequest { + // Required. The resource name of the private cloud to query for clusters. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; + + // The maximum number of clusters to return in one page. + // The service may return fewer than this value. + // The maximum value is coerced to 1000. + // The default value of this field is 500. + int32 page_size = 2; + + // A page token, received from a previous `ListClusters` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListClusters` + // must match the call that provided the page token. + string page_token = 3; + + // + // To filter on multiple expressions, provide each separate expression within + // parentheses. For example: + // ``` + // (name = "example-cluster") + // (nodeCount = "3") + // ``` + // + // By default, each expression is an `AND` expression. However, you can + // include `AND` and `OR` expressions explicitly. For example: + // ``` + // (name = "example-cluster-1") AND + // (createTime > "2021-04-12T08:15:10.40Z") OR + // (name = "example-cluster-2") + // ``` + string filter = 4; + + // Sorts list results by a certain order. By default, returned results are + // ordered by `name` in ascending order. You can also sort results in + // descending order based on the `name` value using `orderBy="name desc"`. + // Currently, only ordering by `name` is supported. + string order_by = 5; +} + +// Response message for +// [VmwareEngine.ListClusters][google.cloud.vmwareengine.v1.VmwareEngine.ListClusters] +message ListClustersResponse { + // A list of private cloud clusters. + repeated Cluster clusters = 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 when making an aggregated query using + // wildcards. + repeated string unreachable = 3; +} + +// Request message for +// [VmwareEngine.GetCluster][google.cloud.vmwareengine.v1.VmwareEngine.GetCluster] +message GetClusterRequest { + // Required. The cluster resource name to retrieve. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/Cluster" + } + ]; +} + +// Request message for +// [VmwareEngine.CreateCluster][google.cloud.vmwareengine.v1.VmwareEngine.CreateCluster] +message CreateClusterRequest { + // Required. The resource name of the private cloud to create a new cluster + // in. Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; + + // Required. The user-provided identifier of the new `Cluster`. + // This identifier must be unique among clusters within the parent and becomes + // the final token in the name URI. + // The identifier must meet the following requirements: + // + // * Only contains 1-63 alphanumeric characters and hyphens + // * Begins with an alphabetical character + // * Ends with a non-hyphen character + // * Not formatted as a UUID + // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + // (section 3.5) + string cluster_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The initial description of the new cluster. + Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. 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. True if you want the request to be validated and not executed; + // false otherwise. + bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [VmwareEngine.UpdateCluster][google.cloud.vmwareengine.v1.VmwareEngine.UpdateCluster] +message UpdateClusterRequest { + // Required. Field mask is used to specify the fields to be overwritten in the + // `Cluster` resource by the update. The fields specified in the `updateMask` + // 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) = REQUIRED]; + + // Required. The description of the cluster. + Cluster cluster = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. 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]; + + // Optional. True if you want the request to be validated and not executed; + // false otherwise. + bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [VmwareEngine.DeleteCluster][google.cloud.vmwareengine.v1.VmwareEngine.DeleteCluster] +message DeleteClusterRequest { + // Required. The resource name of the cluster to delete. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/Cluster" + } + ]; + + // Optional. The request ID must be a valid UUID with the exception that zero + // UUID is not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [VmwareEngine.ListSubnets][google.cloud.vmwareengine.v1.VmwareEngine.ListSubnets] +message ListSubnetsRequest { + // Required. The resource name of the private cloud to be queried for + // subnets. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; + + // The maximum number of subnets to return in one page. + // The service may return fewer than this value. + // The maximum value is coerced to 1000. + // The default value of this field is 500. + int32 page_size = 2; + + // A page token, received from a previous `ListSubnetsRequest` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListSubnetsRequest` must match the call that provided the page token. + string page_token = 3; +} + +// Response message for +// [VmwareEngine.ListSubnets][google.cloud.vmwareengine.v1.VmwareEngine.ListSubnets] +message ListSubnetsResponse { + // A list of subnets. + repeated Subnet subnets = 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 when making an aggregated query using + // wildcards. + repeated string unreachable = 3; +} + +// Request message for +// [VmwareEngine.GetSubnet][google.cloud.vmwareengine.v1.VmwareEngine.GetSubnet] +message GetSubnetRequest { + // Required. The resource name of the subnet to retrieve. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/Subnet" + } + ]; +} + +// Request message for +// [VmwareEngine.UpdateSubnet][google.cloud.vmwareengine.v1.VmwareEngine.UpdateSubnet] +message UpdateSubnetRequest { + // Required. Field mask is used to specify the fields to be overwritten in the + // `Subnet` 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) = REQUIRED]; + + // Required. Subnet description. + Subnet subnet = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// 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. True if the user has requested cancellation + // of the operation; false otherwise. + // 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 +// [VmwareEngine.ListNodeTypes][google.cloud.vmwareengine.v1.VmwareEngine.ListNodeTypes] +message ListNodeTypesRequest { + // Required. The resource name of the location to be queried for node types. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of node types to return in one page. + // The service may return fewer than this value. + // The maximum value is coerced to 1000. + // The default value of this field is 500. + int32 page_size = 2; + + // A page token, received from a previous `ListNodeTypes` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListNodeTypes` must match the call that provided the page token. + string page_token = 3; + + // A filter expression that matches resources returned in the response. + // The expression must specify the field name, a comparison + // operator, and the value that you want to use for filtering. The value + // must be a string, a number, or a boolean. The comparison operator + // must be `=`, `!=`, `>`, or `<`. + // + // For example, if you are filtering a list of node types, you can + // exclude the ones named `standard-72` by specifying + // `name != "standard-72"`. + // + // To filter on multiple expressions, provide each separate expression within + // parentheses. For example: + // ``` + // (name = "standard-72") + // (virtual_cpu_count > 2) + // ``` + // + // By default, each expression is an `AND` expression. However, you + // can include `AND` and `OR` expressions explicitly. + // For example: + // ``` + // (name = "standard-96") AND + // (virtual_cpu_count > 2) OR + // (name = "standard-72") + // ``` + string filter = 4; +} + +// Response message for +// [VmwareEngine.ListNodeTypes][google.cloud.vmwareengine.v1.VmwareEngine.ListNodeTypes] +message ListNodeTypesResponse { + // A list of Node Types. + repeated NodeType node_types = 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 when making an aggregated query using + // wildcards. + repeated string unreachable = 3; +} + +// Request message for +// [VmwareEngine.GetNodeType][google.cloud.vmwareengine.v1.VmwareEngine.GetNodeType] +message GetNodeTypeRequest { + // Required. The resource name of the node type to retrieve. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/NodeType" + } + ]; +} + +// Request message for +// [VmwareEngine.ShowNsxCredentials][google.cloud.vmwareengine.v1.VmwareEngine.ShowNsxCredentials] +message ShowNsxCredentialsRequest { + // Required. The resource name of the private cloud + // to be queried for credentials. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + string private_cloud = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; +} + +// Request message for +// [VmwareEngine.ShowVcenterCredentials][google.cloud.vmwareengine.v1.VmwareEngine.ShowVcenterCredentials] +message ShowVcenterCredentialsRequest { + // Required. The resource name of the private cloud + // to be queried for credentials. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + string private_cloud = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; +} + +// Request message for +// [VmwareEngine.ResetNsxCredentials][google.cloud.vmwareengine.v1.VmwareEngine.ResetNsxCredentials] +message ResetNsxCredentialsRequest { + // Required. The resource name of the private cloud + // to reset credentials for. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + string private_cloud = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; + + // 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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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 message for +// [VmwareEngine.ResetVcenterCredentials][google.cloud.vmwareengine.v1.VmwareEngine.ResetVcenterCredentials] +message ResetVcenterCredentialsRequest { + // Required. The resource name of the private cloud + // to reset credentials for. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + string private_cloud = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; + + // 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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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]; +} + +// Response message for +// [VmwareEngine.ListHcxActivationKeys][google.cloud.vmwareengine.v1.VmwareEngine.ListHcxActivationKeys] +message ListHcxActivationKeysResponse { + // List of HCX activation keys. + repeated HcxActivationKey hcx_activation_keys = 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 when making an aggregated query using + // wildcards. + repeated string unreachable = 3; +} + +// Request message for +// [VmwareEngine.ListHcxActivationKeys][google.cloud.vmwareengine.v1.VmwareEngine.ListHcxActivationKeys] +message ListHcxActivationKeysRequest { + // Required. The resource name of the private cloud + // to be queried for HCX activation keys. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1/privateClouds/my-cloud` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; + + // The maximum number of HCX activation keys to return in one page. + // The service may return fewer than this value. + // The maximum value is coerced to 1000. + // The default value of this field is 500. + int32 page_size = 2; + + // A page token, received from a previous `ListHcxActivationKeys` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListHcxActivationKeys` must match the call that provided the page + // token. + string page_token = 3; +} + +// Request message for [VmwareEngine.GetHcxActivationKeys][] +message GetHcxActivationKeyRequest { + // Required. The resource name of the HCX activation key to retrieve. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/HcxActivationKey" + } + ]; +} + +// Request message for +// [VmwareEngine.CreateHcxActivationKey][google.cloud.vmwareengine.v1.VmwareEngine.CreateHcxActivationKey] +message CreateHcxActivationKeyRequest { + // Required. The resource name of the private cloud to create the key for. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1/privateClouds/my-cloud` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + } + ]; + + // Required. The initial description of a new HCX activation key. When + // creating a new key, this field must be an empty object. + HcxActivationKey hcx_activation_key = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The user-provided identifier of the `HcxActivationKey` to be + // created. This identifier must be unique among `HcxActivationKey` resources + // within the parent and becomes the final token in the name URI. + // The identifier must meet the following requirements: + // + // * Only contains 1-63 alphanumeric characters and hyphens + // * Begins with an alphabetical character + // * Ends with a non-hyphen character + // * Not formatted as a UUID + // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + // (section 3.5) + string hcx_activation_key_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // 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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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 +// [VmwareEngine.ListNetworkPolicies][google.cloud.vmwareengine.v1.VmwareEngine.ListNetworkPolicies] +message ListNetworkPoliciesRequest { + // Required. The resource name of the location (region) to query for + // network policies. Resource names are schemeless URIs that follow the + // conventions in https://cloud.google.com/apis/design/resource_names. For + // example: `projects/my-project/locations/us-central1` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "vmwareengine.googleapis.com/NetworkPolicy" + } + ]; + + // The maximum number of network policies to return in one page. + // The service may return fewer than this value. + // The maximum value is coerced to 1000. + // The default value of this field is 500. + int32 page_size = 2; + + // A page token, received from a previous `ListNetworkPolicies` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListNetworkPolicies` must match the call that provided the page + // token. + string page_token = 3; + + // A filter expression that matches resources returned in the response. + // The expression must specify the field name, a comparison + // operator, and the value that you want to use for filtering. The value + // must be a string, a number, or a boolean. The comparison operator + // must be `=`, `!=`, `>`, or `<`. + // + // For example, if you are filtering a list of network policies, you can + // exclude the ones named `example-policy` by specifying + // `name != "example-policy"`. + // + // To filter on multiple expressions, provide each separate expression within + // parentheses. For example: + // ``` + // (name = "example-policy") + // (createTime > "2021-04-12T08:15:10.40Z") + // ``` + // + // By default, each expression is an `AND` expression. However, you + // can include `AND` and `OR` expressions explicitly. + // For example: + // ``` + // (name = "example-policy-1") AND + // (createTime > "2021-04-12T08:15:10.40Z") OR + // (name = "example-policy-2") + // ``` + string filter = 4; + + // Sorts list results by a certain order. By default, returned results + // are ordered by `name` in ascending order. + // You can also sort results in descending order based on the `name` value + // using `orderBy="name desc"`. + // Currently, only ordering by `name` is supported. + string order_by = 5; +} + +// Response message for +// [VmwareEngine.ListNetworkPolicies][google.cloud.vmwareengine.v1.VmwareEngine.ListNetworkPolicies] +message ListNetworkPoliciesResponse { + // A list of network policies. + repeated NetworkPolicy network_policies = 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; + + // Locations that could not be reached when making an aggregated query using + // wildcards. + repeated string unreachable = 3; +} + +// Request message for +// [VmwareEngine.GetNetworkPolicy][google.cloud.vmwareengine.v1.VmwareEngine.GetNetworkPolicy] +message GetNetworkPolicyRequest { + // Required. The resource name of the network policy to retrieve. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/NetworkPolicy" + } + ]; +} + +// Request message for +// [VmwareEngine.UpdateNetworkPolicy][google.cloud.vmwareengine.v1.VmwareEngine.UpdateNetworkPolicy] +message UpdateNetworkPolicyRequest { + // Required. Network policy description. + NetworkPolicy network_policy = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Field mask is used to specify the fields to be overwritten in the + // `NetworkPolicy` 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 = 2 + [(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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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 +// [VmwareEngine.CreateNetworkPolicy][google.cloud.vmwareengine.v1.VmwareEngine.CreateNetworkPolicy] +message CreateNetworkPolicyRequest { + // Required. The resource name of the location (region) + // to create the new network policy in. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "vmwareengine.googleapis.com/NetworkPolicy" + } + ]; + + // Required. The user-provided identifier of the network policy to be created. + // This identifier must be unique within parent + // `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes + // the final token in the name URI. + // The identifier must meet the following requirements: + // + // * Only contains 1-63 alphanumeric characters and hyphens + // * Begins with an alphabetical character + // * Ends with a non-hyphen character + // * Not formatted as a UUID + // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + // (section 3.5) + string network_policy_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The network policy configuration to use in the request. + NetworkPolicy network_policy = 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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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 +// [VmwareEngine.DeleteNetworkPolicy][google.cloud.vmwareengine.v1.VmwareEngine.DeleteNetworkPolicy] +message DeleteNetworkPolicyRequest { + // Required. The resource name of the network policy to delete. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/NetworkPolicy" + } + ]; + + // 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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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 message for +// [VmwareEngine.CreateVmwareEngineNetwork][google.cloud.vmwareengine.v1.VmwareEngine.CreateVmwareEngineNetwork] +message CreateVmwareEngineNetworkRequest { + // Required. The resource name of the location to create the new VMware Engine + // network in. A VMware Engine network of type + // `LEGACY` is a regional resource, and a VMware + // Engine network of type `STANDARD` is a global resource. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. For example: + // `projects/my-project/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "vmwareengine.googleapis.com/VmwareEngineNetwork" + } + ]; + + // Required. The user-provided identifier of the new VMware Engine network. + // This identifier must be unique among VMware Engine network resources + // within the parent and becomes the final token in the name URI. The + // identifier must meet the following requirements: + // + // * For networks of type LEGACY, adheres to the format: + // `{region-id}-default`. Replace `{region-id}` with the region where you want + // to create the VMware Engine network. For example, "us-central1-default". + // * Only contains 1-63 alphanumeric characters and hyphens + // * Begins with an alphabetical character + // * Ends with a non-hyphen character + // * Not formatted as a UUID + // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + // (section 3.5) + string vmware_engine_network_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The initial description of the new VMware Engine network. + VmwareEngineNetwork vmware_engine_network = 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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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 +// [VmwareEngine.UpdateVmwareEngineNetwork][google.cloud.vmwareengine.v1.VmwareEngine.UpdateVmwareEngineNetwork] +message UpdateVmwareEngineNetworkRequest { + // Required. VMware Engine network description. + VmwareEngineNetwork vmware_engine_network = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Field mask is used to specify the fields to be overwritten in the + // VMware Engine network 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. Only the + // following fields can be updated: `description`. + google.protobuf.FieldMask update_mask = 2 + [(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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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 +// [VmwareEngine.DeleteVmwareEngineNetwork][google.cloud.vmwareengine.v1.VmwareEngine.DeleteVmwareEngineNetwork] +message DeleteVmwareEngineNetworkRequest { + // Required. The resource name of the VMware Engine network to be deleted. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/VmwareEngineNetwork" + } + ]; + + // 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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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. Checksum used to ensure that the user-provided value is up to + // date before the server processes the request. The server compares provided + // checksum with the current checksum of the resource. If the user-provided + // value is out of date, this request returns an `ABORTED` error. + string etag = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [VmwareEngine.GetVmwareEngineNetwork][google.cloud.vmwareengine.v1.VmwareEngine.GetVmwareEngineNetwork] +message GetVmwareEngineNetworkRequest { + // Required. The resource name of the VMware Engine network to retrieve. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/VmwareEngineNetwork" + } + ]; +} + +// Request message for +// [VmwareEngine.ListVmwareEngineNetworks][google.cloud.vmwareengine.v1.VmwareEngine.ListVmwareEngineNetworks] +message ListVmwareEngineNetworksRequest { + // Required. The resource name of the location to query for + // VMware Engine networks. Resource names are schemeless URIs that follow the + // conventions in https://cloud.google.com/apis/design/resource_names. For + // example: `projects/my-project/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of results to return in one page. + // The maximum value is coerced to 1000. + // The default value of this field is 500. + int32 page_size = 2; + + // A page token, received from a previous `ListVmwareEngineNetworks` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListVmwareEngineNetworks` must match the call that provided the page + // token. + string page_token = 3; + + // A filter expression that matches resources returned in the response. + // The expression must specify the field name, a comparison + // operator, and the value that you want to use for filtering. The value + // must be a string, a number, or a boolean. The comparison operator + // must be `=`, `!=`, `>`, or `<`. + // + // For example, if you are filtering a list of network peerings, you can + // exclude the ones named `example-network` by specifying + // `name != "example-network"`. + // + // To filter on multiple expressions, provide each separate expression within + // parentheses. For example: + // ``` + // (name = "example-network") + // (createTime > "2021-04-12T08:15:10.40Z") + // ``` + // + // By default, each expression is an `AND` expression. However, you + // can include `AND` and `OR` expressions explicitly. + // For example: + // ``` + // (name = "example-network-1") AND + // (createTime > "2021-04-12T08:15:10.40Z") OR + // (name = "example-network-2") + // ``` + string filter = 4; + + // Sorts list results by a certain order. By default, returned results + // are ordered by `name` in ascending order. + // You can also sort results in descending order based on the `name` value + // using `orderBy="name desc"`. + // Currently, only ordering by `name` is supported. + string order_by = 5; +} + +// Response message for +// [VmwareEngine.ListVmwareEngineNetworks][google.cloud.vmwareengine.v1.VmwareEngine.ListVmwareEngineNetworks] +message ListVmwareEngineNetworksResponse { + // A list of VMware Engine networks. + repeated VmwareEngineNetwork vmware_engine_networks = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Request message for +// [VmwareEngine.CreatePrivateConnection][google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateConnection] +message CreatePrivateConnectionRequest { + // Required. The resource name of the location to create the new private + // connection in. Private connection is a regional resource. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. For example: + // `projects/my-project/locations/us-central1` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "vmwareengine.googleapis.com/PrivateConnection" + } + ]; + + // Required. The user-provided identifier of the new private connection. + // This identifier must be unique among private connection resources + // within the parent and becomes the final token in the name URI. The + // identifier must meet the following requirements: + // + // * Only contains 1-63 alphanumeric characters and hyphens + // * Begins with an alphabetical character + // * Ends with a non-hyphen character + // * Not formatted as a UUID + // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + // (section 3.5) + string private_connection_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The initial description of the new private connection. + PrivateConnection private_connection = 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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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 +// [VmwareEngine.GetPrivateConnection][google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateConnection] +message GetPrivateConnectionRequest { + // Required. The resource name of the private connection to retrieve. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1/privateConnections/my-connection` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateConnection" + } + ]; +} + +// Request message for +// [VmwareEngine.ListPrivateConnections][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnections] +message ListPrivateConnectionsRequest { + // Required. The resource name of the location to query for + // private connections. Resource names are schemeless URIs that follow the + // conventions in https://cloud.google.com/apis/design/resource_names. For + // example: `projects/my-project/locations/us-central1` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "vmwareengine.googleapis.com/PrivateConnection" + } + ]; + + // The maximum number of private connections to return in one page. + // The maximum value is coerced to 1000. + // The default value of this field is 500. + int32 page_size = 2; + + // A page token, received from a previous `ListPrivateConnections` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListPrivateConnections` must match the call that provided the page + // token. + string page_token = 3; + + // A filter expression that matches resources returned in the response. + // The expression must specify the field name, a comparison + // operator, and the value that you want to use for filtering. The value + // must be a string, a number, or a boolean. The comparison operator + // must be `=`, `!=`, `>`, or `<`. + // + // For example, if you are filtering a list of private connections, you can + // exclude the ones named `example-connection` by specifying + // `name != "example-connection"`. + // + // To filter on multiple expressions, provide each separate expression within + // parentheses. For example: + // ``` + // (name = "example-connection") + // (createTime > "2022-09-22T08:15:10.40Z") + // ``` + // + // By default, each expression is an `AND` expression. However, you + // can include `AND` and `OR` expressions explicitly. + // For example: + // ``` + // (name = "example-connection-1") AND + // (createTime > "2021-04-12T08:15:10.40Z") OR + // (name = "example-connection-2") + // ``` + string filter = 4; + + // Sorts list results by a certain order. By default, returned results + // are ordered by `name` in ascending order. + // You can also sort results in descending order based on the `name` value + // using `orderBy="name desc"`. + // Currently, only ordering by `name` is supported. + string order_by = 5; +} + +// Response message for +// [VmwareEngine.ListPrivateConnections][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnections] +message ListPrivateConnectionsResponse { + // A list of private connections. + repeated PrivateConnection private_connections = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Request message for +// [VmwareEngine.UpdatePrivateConnection][google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateConnection] +message UpdatePrivateConnectionRequest { + // Required. Private connection description. + PrivateConnection private_connection = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Field mask is used to specify the fields to be overwritten in the + // `PrivateConnection` 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 = 2 + [(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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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 +// [VmwareEngine.DeletePrivateConnection][google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateConnection] +message DeletePrivateConnectionRequest { + // Required. The resource name of the private connection to be deleted. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1/privateConnections/my-connection` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateConnection" + } + ]; + + // 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 guarantees that a + // request doesn't result in creation of duplicate commitments for at least 60 + // minutes. + // + // For example, consider a situation where you 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 message for +// [VmwareEngine.ListPrivateConnectionPeeringRoutes][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnectionPeeringRoutes] +message ListPrivateConnectionPeeringRoutesRequest { + // Required. The resource name of the private connection to retrieve peering + // routes from. Resource names are schemeless URIs that follow the conventions + // in https://cloud.google.com/apis/design/resource_names. For example: + // `projects/my-project/locations/us-west1/privateConnections/my-connection` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/PrivateConnection" + } + ]; + + // The maximum number of peering routes to return in one page. + // The service may return fewer than this value. + // The maximum value is coerced to 1000. + // The default value of this field is 500. + int32 page_size = 2; + + // A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + // call. Provide this to retrieve the subsequent page. When paginating, all + // other parameters provided to `ListPrivateConnectionPeeringRoutes` must + // match the call that provided the page token. + string page_token = 3; +} + +// Response message for +// [VmwareEngine.ListPrivateConnectionPeeringRoutes][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnectionPeeringRoutes] +message ListPrivateConnectionPeeringRoutesResponse { + // A list of peering routes. + repeated PeeringRoute peering_routes = 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; +} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine_resources.proto b/owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine_resources.proto new file mode 100644 index 00000000000..273a833719e --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine_resources.proto @@ -0,0 +1,931 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.vmwareengine.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.VmwareEngine.V1"; +option go_package = "cloud.google.com/go/vmwareengine/apiv1/vmwareenginepb;vmwareenginepb"; +option java_multiple_files = true; +option java_outer_classname = "VmwareengineResourcesProto"; +option java_package = "com.google.cloud.vmwareengine.v1"; +option php_namespace = "Google\\Cloud\\VmwareEngine\\V1"; +option ruby_package = "Google::Cloud::VmwareEngine::V1"; + +// Network configuration in the consumer project +// with which the peering has to be done. +message NetworkConfig { + // Required. Management CIDR used by VMware management appliances. + string management_cidr = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The relative resource name of the VMware Engine network attached + // to the private cloud. Specify the name in the following form: + // `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + // where `{project}` can either be a project number or a project ID. + string vmware_engine_network = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/VmwareEngineNetwork" + } + ]; + + // Output only. The canonical name of the VMware Engine network in the form: + // `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + string vmware_engine_network_canonical = 6 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/VmwareEngineNetwork" + } + ]; + + // Output only. The IP address layout version of the management IP address + // range. Possible versions include: + // * `managementIpAddressLayoutVersion=1`: Indicates the legacy IP address + // layout used by some existing private clouds. This is no longer supported + // for new private clouds as it does not support all features. + // * `managementIpAddressLayoutVersion=2`: Indicates the latest IP address + // layout used by all newly created private clouds. This version supports all + // current features. + int32 management_ip_address_layout_version = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Information about the type and number of nodes associated with the cluster. +message NodeTypeConfig { + // Required. The number of nodes of this type in the cluster + int32 node_count = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Customized number of cores available to each node of the type. + // This number must always be one of `nodeType.availableCustomCoreCounts`. + // If zero is provided max value from `nodeType.availableCustomCoreCounts` + // will be used. + int32 custom_core_count = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a private cloud resource. Private clouds are zonal resources. +message PrivateCloud { + option (google.api.resource) = { + type: "vmwareengine.googleapis.com/PrivateCloud" + pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}" + }; + + // Enum State defines possible states of private clouds. + enum State { + // The default value. This value should never be used. + STATE_UNSPECIFIED = 0; + + // The private cloud is ready. + ACTIVE = 1; + + // The private cloud is being created. + CREATING = 2; + + // The private cloud is being updated. + UPDATING = 3; + + // The private cloud is in failed state. + FAILED = 5; + + // The private cloud is scheduled for deletion. The deletion process can be + // cancelled by using the corresponding undelete method. + DELETED = 6; + + // The private cloud is irreversibly deleted and is being removed from the + // system. + PURGING = 7; + } + + // Management cluster configuration. + message ManagementCluster { + // Required. The user-provided identifier of the new `Cluster`. + // The identifier must meet the following requirements: + // + // * Only contains 1-63 alphanumeric characters and hyphens + // * Begins with an alphabetical character + // * Ends with a non-hyphen character + // * Not formatted as a UUID + // * Complies with [RFC + // 1034](https://datatracker.ietf.org/doc/html/rfc1034) (section 3.5) + string cluster_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The map of cluster node types in this cluster, where the key is + // canonical identifier of the node type (corresponds to the `NodeType`). + map node_type_configs = 7 + [(google.api.field_behavior) = REQUIRED]; + } + + // Enum Type defines private cloud type. + enum Type { + // Standard private is a zonal resource, with 3+ nodes. Default type. + STANDARD = 0; + + // Time limited private cloud is a zonal resource, can have only 1 node and + // has limited life span. Will be deleted after defined period of time, + // can be converted into standard private cloud by expanding it up to 3 + // or more nodes. + TIME_LIMITED = 1; + } + + // Output only. The resource name of this private cloud. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Creation time of this resource. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update time of this resource. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when the resource was scheduled for deletion. + google.protobuf.Timestamp delete_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when the resource will be irreversibly deleted. + google.protobuf.Timestamp expire_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. State of the resource. New values may be added to this enum + // when appropriate. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Network configuration of the private cloud. + NetworkConfig network_config = 9 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. The management cluster for this private cloud. + // This field is required during creation of the private cloud to provide + // details for the default cluster. + // + // The following fields can't be changed after private cloud creation: + // `ManagementCluster.clusterId`, `ManagementCluster.nodeTypeId`. + ManagementCluster management_cluster = 10 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = REQUIRED + ]; + + // User-provided description for this private cloud. + string description = 11; + + // Output only. HCX appliance. + Hcx hcx = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. NSX appliance. + Nsx nsx = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Vcenter appliance. + Vcenter vcenter = 19 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. System-generated unique identifier for the resource. + string uid = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Type of the private cloud. Defaults to STANDARD. + Type type = 22 [(google.api.field_behavior) = OPTIONAL]; +} + +// A cluster in a private cloud. +message Cluster { + option (google.api.resource) = { + type: "vmwareengine.googleapis.com/Cluster" + pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}" + }; + + // Enum State defines possible states of private cloud clusters. + enum State { + // The default value. This value should never be used. + STATE_UNSPECIFIED = 0; + + // The Cluster is operational and can be used by the user. + ACTIVE = 1; + + // The Cluster is being deployed. + CREATING = 2; + + // Adding or removing of a node to the cluster, any other cluster specific + // updates. + UPDATING = 3; + + // The Cluster is being deleted. + DELETING = 4; + + // The Cluster is undergoing maintenance, for example: a failed node is + // getting replaced. + REPAIRING = 5; + } + + // Output only. The resource name of this cluster. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Creation time of this resource. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update time of this resource. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. State of the resource. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. True if the cluster is a management cluster; false otherwise. + // There can only be one management cluster in a private cloud + // and it has to be the first one. + bool management = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. System-generated unique identifier for the resource. + string uid = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The map of cluster node types in this cluster, where the key is + // canonical identifier of the node type (corresponds to the `NodeType`). + map node_type_configs = 16 + [(google.api.field_behavior) = REQUIRED]; +} + +// Subnet in a private cloud. Either `management` subnets (such as vMotion) that +// are read-only, or `userDefined`, which can also be updated. +message Subnet { + option (google.api.resource) = { + type: "vmwareengine.googleapis.com/Subnet" + pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet}" + }; + + // Defines possible states of subnets. + enum State { + // The default value. This value should never be used. + STATE_UNSPECIFIED = 0; + + // The subnet is ready. + ACTIVE = 1; + + // The subnet is being created. + CREATING = 2; + + // The subnet is being updated. + UPDATING = 3; + + // The subnet is being deleted. + DELETING = 4; + + // Changes requested in the last operation are being propagated. + RECONCILING = 5; + + // Last operation on the subnet did not succeed. Subnet's payload is + // reverted back to its most recent working state. + FAILED = 6; + } + + // Output only. The resource name of this subnet. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The IP address range of the subnet in CIDR format '10.0.0.0/24'. + string ip_cidr_range = 7; + + // The IP address of the gateway of this subnet. + // Must fall within the IP prefix defined above. + string gateway_ip = 8; + + // Output only. The type of the subnet. For example "management" or + // "userDefined". + string type = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of the resource. + State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes node type. +message NodeType { + option (google.api.resource) = { + type: "vmwareengine.googleapis.com/NodeType" + pattern: "projects/{project}/locations/{location}/nodeTypes/{node_type}" + }; + + // Output only. The resource name of this node type. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The canonical identifier of the node type + // (corresponds to the `NodeType`). For example: standard-72. + string node_type_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The friendly name for this node type. + // For example: ve1-standard-72 + string display_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The total number of virtual CPUs in a single node. + int32 virtual_cpu_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The total number of CPU cores in a single node. + int32 total_core_count = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The amount of physical memory available, defined in GB. + int32 memory_gb = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The amount of storage available, defined in GB. + int32 disk_size_gb = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. List of possible values of custom core count. + repeated int32 available_custom_core_counts = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Credentials for a private cloud. +message Credentials { + // Initial username. + string username = 1; + + // Initial password. + string password = 2; +} + +// HCX activation key. A default key is created during +// private cloud provisioning, but this behavior is subject to change +// and you should always verify active keys. +// Use +// [VmwareEngine.ListHcxActivationKeys][google.cloud.vmwareengine.v1.VmwareEngine.ListHcxActivationKeys] +// to retrieve existing keys and +// [VmwareEngine.CreateHcxActivationKey][google.cloud.vmwareengine.v1.VmwareEngine.CreateHcxActivationKey] +// to create new ones. +message HcxActivationKey { + option (google.api.resource) = { + type: "vmwareengine.googleapis.com/HcxActivationKey" + pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key}" + }; + + // State of HCX activation key + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // State of a newly generated activation key. + AVAILABLE = 1; + + // State of key when it has been used to activate HCX appliance. + CONSUMED = 2; + + // State of key when it is being created. + CREATING = 3; + } + + // Output only. The resource name of this HcxActivationKey. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Creation time of HCX activation key. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. State of HCX activation key. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. HCX activation key. + string activation_key = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. System-generated unique identifier for the resource. + string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Details about a HCX Cloud Manager appliance. +message Hcx { + // State of the appliance + enum State { + // Unspecified appliance state. This is the default value. + STATE_UNSPECIFIED = 0; + + // The appliance is operational and can be used. + ACTIVE = 1; + + // The appliance is being deployed. + CREATING = 2; + } + + // Internal IP address of the appliance. + string internal_ip = 2; + + // Version of the appliance. + string version = 4; + + // Output only. The state of the appliance. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Fully qualified domain name of the appliance. + string fqdn = 6; +} + +// Details about a NSX Manager appliance. +message Nsx { + // State of the appliance + enum State { + // Unspecified appliance state. This is the default value. + STATE_UNSPECIFIED = 0; + + // The appliance is operational and can be used. + ACTIVE = 1; + + // The appliance is being deployed. + CREATING = 2; + } + + // Internal IP address of the appliance. + string internal_ip = 2; + + // Version of the appliance. + string version = 4; + + // Output only. The state of the appliance. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Fully qualified domain name of the appliance. + string fqdn = 6; +} + +// Details about a vCenter Server management appliance. +message Vcenter { + // State of the appliance + enum State { + // Unspecified appliance state. This is the default value. + STATE_UNSPECIFIED = 0; + + // The appliance is operational and can be used. + ACTIVE = 1; + + // The appliance is being deployed. + CREATING = 2; + } + + // Internal IP address of the appliance. + string internal_ip = 2; + + // Version of the appliance. + string version = 4; + + // Output only. The state of the appliance. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Fully qualified domain name of the appliance. + string fqdn = 6; +} + +// Exchanged network peering route. +message PeeringRoute { + // The type of the peering route. + enum Type { + // Unspecified peering route type. This is the default value. + TYPE_UNSPECIFIED = 0; + + // Dynamic routes in the peer network. + DYNAMIC_PEERING_ROUTE = 1; + + // Static routes in the peer network. + STATIC_PEERING_ROUTE = 2; + + // Created, updated, and removed automatically by Google Cloud when subnets + // are created, modified, or deleted in the peer network. + SUBNET_PEERING_ROUTE = 3; + } + + // The direction of the exchanged routes. + enum Direction { + // Unspecified exchanged routes direction. This is default. + DIRECTION_UNSPECIFIED = 0; + + // Routes imported from the peer network. + INCOMING = 1; + + // Routes exported to the peer network. + OUTGOING = 2; + } + + // Output only. Destination range of the peering route in CIDR notation. + string dest_range = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Type of the route in the peer VPC network. + Type type = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Region containing the next hop of the peering route. This + // field only applies to dynamic routes in the peer VPC network. + string next_hop_region = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The priority of the peering route. + int64 priority = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. True if the peering route has been imported from a peered + // VPC network; false otherwise. The import happens if the field + // `NetworkPeering.importCustomRoutes` is true for this network, + // `NetworkPeering.exportCustomRoutes` is true for the peer VPC network, and + // the import does not result in a route conflict. + bool imported = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Direction of the routes exchanged with the peer network, from + // the VMware Engine network perspective: + // + // * Routes of direction `INCOMING` are imported from the peer network. + // * Routes of direction `OUTGOING` are exported from the intranet VPC network + // of the VMware Engine network. + Direction direction = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a network policy resource. Network policies are regional +// resources. You can use a network policy to enable or disable internet access +// and external IP access. Network policies are associated with a VMware Engine +// network, which might span across regions. For a given region, a network +// policy applies to all private clouds in the VMware Engine network associated +// with the policy. +message NetworkPolicy { + option (google.api.resource) = { + type: "vmwareengine.googleapis.com/NetworkPolicy" + pattern: "projects/{project}/locations/{location}/networkPolicies/{network_policy}" + }; + + // Represents a network service that is managed by a `NetworkPolicy` resource. + // A network service provides a way to control an aspect of external access to + // VMware workloads. For example, whether the VMware workloads in the + // private clouds governed by a network policy can access or be accessed from + // the internet. + message NetworkService { + // Enum State defines possible states of a network policy controlled + // service. + enum State { + // Unspecified service state. This is the default value. + STATE_UNSPECIFIED = 0; + + // Service is not provisioned. + UNPROVISIONED = 1; + + // Service is in the process of being provisioned/deprovisioned. + RECONCILING = 2; + + // Service is active. + ACTIVE = 3; + } + + // True if the service is enabled; false otherwise. + bool enabled = 1; + + // Output only. State of the service. New values may be added to this enum + // when appropriate. + State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. The resource name of this network policy. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Creation time of this resource. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update time of this resource. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Network service that allows VMware workloads to access the internet. + NetworkService internet_access = 6; + + // Network service that allows External IP addresses to be assigned to VMware + // workloads. This service can only be enabled when `internet_access` is also + // enabled. + NetworkService external_ip = 7; + + // Required. IP address range in CIDR notation used to create internet access + // and external IP access. An RFC 1918 CIDR block, with a "/26" prefix, is + // required. The range cannot overlap with any prefixes either in the consumer + // VPC network or in use by the private clouds attached to that VPC network. + string edge_services_cidr = 9 [(google.api.field_behavior) = REQUIRED]; + + // Output only. System-generated unique identifier for the resource. + string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The relative resource name of the VMware Engine network. + // Specify the name in the following form: + // `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + // where `{project}` can either be a project number or a project ID. + string vmware_engine_network = 12 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/VmwareEngineNetwork" + } + ]; + + // Optional. User-provided description for this network policy. + string description = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The canonical name of the VMware Engine network in the form: + // `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + string vmware_engine_network_canonical = 14 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/VmwareEngineNetwork" + } + ]; +} + +// VMware Engine network resource that provides connectivity for VMware Engine +// private clouds. +message VmwareEngineNetwork { + option (google.api.resource) = { + type: "vmwareengine.googleapis.com/VmwareEngineNetwork" + pattern: "projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network}" + }; + + // Represents a VMware Engine VPC network that is managed by a + // VMware Engine network resource. + message VpcNetwork { + // Enum Type defines possible types of a VMware Engine network controlled + // service. + enum Type { + // The default value. This value should never be used. + TYPE_UNSPECIFIED = 0; + + // VPC network that will be peered with a consumer VPC network or the + // intranet VPC of another VMware Engine network. Access a private cloud + // through Compute Engine VMs on a peered VPC network or an on-premises + // resource connected to a peered consumer VPC network. + INTRANET = 1; + + // VPC network used for internet access to and from a private cloud. + INTERNET = 2; + + // VPC network used for access to Google Cloud services like + // Cloud Storage. + GOOGLE_CLOUD = 3; + } + + // Output only. Type of VPC network (INTRANET, INTERNET, or + // GOOGLE_CLOUD) + Type type = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The relative resource name of the service VPC network this + // VMware Engine network is attached to. For example: + // `projects/123123/global/networks/my-network` + string network = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Network" + } + ]; + } + + // Enum State defines possible states of VMware Engine network. + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // The VMware Engine network is being created. + CREATING = 1; + + // The VMware Engine network is ready. + ACTIVE = 2; + + // The VMware Engine network is being updated. + UPDATING = 3; + + // The VMware Engine network is being deleted. + DELETING = 4; + } + + // Enum Type defines possible types of VMware Engine network. + enum Type { + // The default value. This value should never be used. + TYPE_UNSPECIFIED = 0; + + // Network type used by private clouds created in projects without a network + // of type `STANDARD`. This network type is no longer used for new VMware + // Engine private cloud deployments. + LEGACY = 1; + } + + // Output only. The resource name of the VMware Engine network. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Creation time of this resource. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update time of this resource. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-provided description for this VMware Engine network. + string description = 5; + + // Output only. VMware Engine service VPC networks that provide connectivity + // from a private cloud to customer projects, the internet, and other Google + // Cloud services. + repeated VpcNetwork vpc_networks = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. State of the VMware Engine network. + State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. VMware Engine network type. + Type type = 8 [(google.api.field_behavior) = REQUIRED]; + + // Output only. System-generated unique identifier for the resource. + string uid = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Checksum that may be sent on update and delete requests to ensure that the + // user-provided value is up to date before the server processes a request. + // The server computes checksums based on the value of other fields in the + // request. + string etag = 10; +} + +// Private connection resource that provides connectivity for VMware Engine +// private clouds. +message PrivateConnection { + option (google.api.resource) = { + type: "vmwareengine.googleapis.com/PrivateConnection" + pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}" + }; + + // Enum State defines possible states of private connection. + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // The private connection is being created. + CREATING = 1; + + // The private connection is ready. + ACTIVE = 2; + + // The private connection is being updated. + UPDATING = 3; + + // The private connection is being deleted. + DELETING = 4; + + // The private connection is not provisioned, since no private cloud is + // present for which this private connection is needed. + UNPROVISIONED = 5; + + // The private connection is in failed state. + FAILED = 6; + } + + // Enum Type defines possible types of private connection. + enum Type { + // The default value. This value should never be used. + TYPE_UNSPECIFIED = 0; + + // Connection used for establishing [private services + // access](https://cloud.google.com/vpc/docs/private-services-access). + PRIVATE_SERVICE_ACCESS = 1; + + // Connection used for connecting to NetApp Cloud Volumes. + NETAPP_CLOUD_VOLUMES = 2; + + // Connection used for connecting to Dell PowerScale. + DELL_POWERSCALE = 3; + + // Connection used for connecting to third-party services. + THIRD_PARTY_SERVICE = 4; + } + + // Possible types for RoutingMode + enum RoutingMode { + // The default value. This value should never be used. + ROUTING_MODE_UNSPECIFIED = 0; + + // Global Routing Mode + GLOBAL = 1; + + // Regional Routing Mode + REGIONAL = 2; + } + + // Enum PeeringState defines the possible states of peering between service + // network and the vpc network peered to service network + enum PeeringState { + // The default value. This value is used if the peering state is omitted or + // unknown. + PEERING_STATE_UNSPECIFIED = 0; + + // The peering is in active state. + PEERING_ACTIVE = 1; + + // The peering is in inactive state. + PEERING_INACTIVE = 2; + } + + // Output only. The resource name of the private connection. + // Resource names are schemeless URIs that follow the conventions in + // https://cloud.google.com/apis/design/resource_names. + // For example: + // `projects/my-project/locations/us-central1/privateConnections/my-connection` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Creation time of this resource. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update time of this resource. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. User-provided description for this private connection. + string description = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. State of the private connection. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The relative resource name of Legacy VMware Engine network. + // Specify the name in the following form: + // `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + // where `{project}`, `{location}` will be same as specified in private + // connection resource name and `{vmware_engine_network_id}` will be in the + // form of `{location}`-default e.g. + // projects/project/locations/us-central1/vmwareEngineNetworks/us-central1-default. + string vmware_engine_network = 8 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/VmwareEngineNetwork" + } + ]; + + // Output only. The canonical name of the VMware Engine network in the form: + // `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + string vmware_engine_network_canonical = 9 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "vmwareengine.googleapis.com/VmwareEngineNetwork" + } + ]; + + // Required. Private connection type. + Type type = 10 [(google.api.field_behavior) = REQUIRED]; + + // Output only. VPC network peering id between given network VPC and + // VMwareEngineNetwork. + string peering_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Routing Mode. + // Default value is set to GLOBAL. + // For type = PRIVATE_SERVICE_ACCESS, this field can be set to GLOBAL or + // REGIONAL, for other types only GLOBAL is supported. + RoutingMode routing_mode = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. System-generated unique identifier for the resource. + string uid = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Service network to create private connection. + // Specify the name in the following form: + // `projects/{project}/global/networks/{network_id}` + // For type = PRIVATE_SERVICE_ACCESS, this field represents servicenetworking + // VPC, e.g. projects/project-tp/global/networks/servicenetworking. + // For type = NETAPP_CLOUD_VOLUME, this field represents NetApp service VPC, + // e.g. projects/project-tp/global/networks/netapp-tenant-vpc. + // For type = DELL_POWERSCALE, this field represent Dell service VPC, e.g. + // projects/project-tp/global/networks/dell-tenant-vpc. + // For type= THIRD_PARTY_SERVICE, this field could represent a consumer VPC or + // any other producer VPC to which the VMware Engine Network needs to be + // connected, e.g. projects/project/global/networks/vpc. + string service_network = 16 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; + + // Output only. Peering state between service network and VMware Engine + // network. + PeeringState peering_state = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json new file mode 100644 index 00000000000..91cd2c8d4e2 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json @@ -0,0 +1,1863 @@ +{ + "clientLibrary": { + "name": "nodejs-vmwareengine", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.vmwareengine.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListPrivateClouds_async", + "title": "VmwareEngine listPrivateClouds Sample", + "origin": "API_DEFINITION", + "description": " Lists `PrivateCloud` resources in a given project and location.", + "canonical": true, + "file": "vmware_engine.list_private_clouds.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 106, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListPrivateClouds", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateClouds", + "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.vmwareengine.v1.ListPrivateCloudsResponse", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ListPrivateClouds", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateClouds", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetPrivateCloud_async", + "title": "VmwareEngine getPrivateCloud Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a `PrivateCloud` resource by its resource name.", + "canonical": true, + "file": "vmware_engine.get_private_cloud.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetPrivateCloud", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateCloud", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.PrivateCloud", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "GetPrivateCloud", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateCloud", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async", + "title": "VmwareEngine createPrivateCloud Sample", + "origin": "API_DEFINITION", + "description": " Creates a new `PrivateCloud` resource in a given project and location. Private clouds can only be created in zones, regional private clouds are not supported. Creating a private cloud also creates a [management cluster](https://cloud.google.com/vmware-engine/docs/concepts-vmware-components) for that private cloud.", + "canonical": true, + "file": "vmware_engine.create_private_cloud.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreatePrivateCloud", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateCloud", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "private_cloud_id", + "type": "TYPE_STRING" + }, + { + "name": "private_cloud", + "type": ".google.cloud.vmwareengine.v1.PrivateCloud" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "CreatePrivateCloud", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateCloud", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async", + "title": "VmwareEngine updatePrivateCloud Sample", + "origin": "API_DEFINITION", + "description": " Modifies a `PrivateCloud` resource. Only the following fields can be updated: `description`. Only fields specified in `updateMask` are applied. During operation processing, the resource is temporarily in the `ACTIVE` state before the operation fully completes. For that period of time, you can't update the resource. Use the operation status to determine when the processing fully completes.", + "canonical": true, + "file": "vmware_engine.update_private_cloud.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdatePrivateCloud", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateCloud", + "async": true, + "parameters": [ + { + "name": "private_cloud", + "type": ".google.cloud.vmwareengine.v1.PrivateCloud" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "UpdatePrivateCloud", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateCloud", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async", + "title": "VmwareEngine deletePrivateCloud Sample", + "origin": "API_DEFINITION", + "description": " Schedules a `PrivateCloud` resource for deletion. A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` set to `DELETED` and `expireTime` set to the time when deletion is final and can no longer be reversed. The delete operation is marked as done as soon as the `PrivateCloud` is successfully scheduled for deletion (this also applies when `delayHours` is set to zero), and the operation is not kept in pending state until `PrivateCloud` is purged. `PrivateCloud` can be restored using `UndeletePrivateCloud` method before the `expireTime` elapses. When `expireTime` is reached, deletion is final and all private cloud resources are irreversibly removed and billing stops. During the final removal process, `PrivateCloud.state` is set to `PURGING`. `PrivateCloud` can be polled using standard `GET` method for the whole period of deletion and purging. It will not be returned only when it is completely purged.", + "canonical": true, + "file": "vmware_engine.delete_private_cloud.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePrivateCloud", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateCloud", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + }, + { + "name": "delay_hours", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "DeletePrivateCloud", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateCloud", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async", + "title": "VmwareEngine undeletePrivateCloud Sample", + "origin": "API_DEFINITION", + "description": " Restores a private cloud that was previously scheduled for deletion by `DeletePrivateCloud`. A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` set to `DELETED` and `PrivateCloud.expireTime` set to the time when deletion can no longer be reversed.", + "canonical": true, + "file": "vmware_engine.undelete_private_cloud.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UndeletePrivateCloud", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "UndeletePrivateCloud", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListClusters_async", + "title": "VmwareEngine listClusters Sample", + "origin": "API_DEFINITION", + "description": " Lists `Cluster` resources in a given private cloud.", + "canonical": true, + "file": "vmware_engine.list_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 96, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListClusters", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListClusters", + "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.vmwareengine.v1.ListClustersResponse", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ListClusters", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListClusters", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetCluster_async", + "title": "VmwareEngine getCluster Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a `Cluster` resource by its resource name.", + "canonical": true, + "file": "vmware_engine.get_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCluster", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.Cluster", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "GetCluster", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetCluster", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreateCluster_async", + "title": "VmwareEngine createCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a new cluster in a given private cloud. Creating a new cluster provides additional nodes for use in the parent private cloud and requires sufficient [node quota](https://cloud.google.com/vmware-engine/quotas).", + "canonical": true, + "file": "vmware_engine.create_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCluster", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "cluster", + "type": ".google.cloud.vmwareengine.v1.Cluster" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "CreateCluster", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateCluster", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async", + "title": "VmwareEngine updateCluster Sample", + "origin": "API_DEFINITION", + "description": " Modifies a `Cluster` resource. Only the following fields can be updated: `node_type_configs.*.node_count`. Only fields specified in `updateMask` are applied. During operation processing, the resource is temporarily in the `ACTIVE` state before the operation fully completes. For that period of time, you can't update the resource. Use the operation status to determine when the processing fully completes.", + "canonical": true, + "file": "vmware_engine.update_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCluster", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateCluster", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "cluster", + "type": ".google.cloud.vmwareengine.v1.Cluster" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "UpdateCluster", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateCluster", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async", + "title": "VmwareEngine deleteCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes a `Cluster` resource. To avoid unintended data loss, migrate or gracefully shut down any workloads running on the cluster before deletion. You cannot delete the management cluster of a private cloud using this method.", + "canonical": true, + "file": "vmware_engine.delete_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteCluster", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "DeleteCluster", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteCluster", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListSubnets_async", + "title": "VmwareEngine listSubnets Sample", + "origin": "API_DEFINITION", + "description": " Lists subnets in a given private cloud.", + "canonical": true, + "file": "vmware_engine.list_subnets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSubnets", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListSubnets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.ListSubnetsResponse", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ListSubnets", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListSubnets", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetSubnet_async", + "title": "VmwareEngine getSubnet Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single subnet.", + "canonical": true, + "file": "vmware_engine.get_subnet.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSubnet", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetSubnet", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.Subnet", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "GetSubnet", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetSubnet", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async", + "title": "VmwareEngine updateSubnet Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single subnet. Only fields specified in `update_mask` are applied. *Note*: This API is synchronous and always returns a successful `google.longrunning.Operation` (LRO). The returned LRO will only have `done` and `response` fields.", + "canonical": true, + "file": "vmware_engine.update_subnet.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSubnet", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateSubnet", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "subnet", + "type": ".google.cloud.vmwareengine.v1.Subnet" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "UpdateSubnet", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateSubnet", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListNodeTypes_async", + "title": "VmwareEngine listNodeTypes Sample", + "origin": "API_DEFINITION", + "description": " Lists node types", + "canonical": true, + "file": "vmware_engine.list_node_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 98, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNodeTypes", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListNodeTypes", + "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" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.ListNodeTypesResponse", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ListNodeTypes", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListNodeTypes", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetNodeType_async", + "title": "VmwareEngine getNodeType Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single `NodeType`.", + "canonical": true, + "file": "vmware_engine.get_node_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNodeType", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetNodeType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.NodeType", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "GetNodeType", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetNodeType", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ShowNsxCredentials_async", + "title": "VmwareEngine showNsxCredentials Sample", + "origin": "API_DEFINITION", + "description": " Gets details of credentials for NSX appliance.", + "canonical": true, + "file": "vmware_engine.show_nsx_credentials.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ShowNsxCredentials", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ShowNsxCredentials", + "async": true, + "parameters": [ + { + "name": "private_cloud", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.Credentials", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ShowNsxCredentials", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ShowNsxCredentials", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ShowVcenterCredentials_async", + "title": "VmwareEngine showVcenterCredentials Sample", + "origin": "API_DEFINITION", + "description": " Gets details of credentials for Vcenter appliance.", + "canonical": true, + "file": "vmware_engine.show_vcenter_credentials.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ShowVcenterCredentials", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ShowVcenterCredentials", + "async": true, + "parameters": [ + { + "name": "private_cloud", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.Credentials", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ShowVcenterCredentials", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ShowVcenterCredentials", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async", + "title": "VmwareEngine resetNsxCredentials Sample", + "origin": "API_DEFINITION", + "description": " Resets credentials of the NSX appliance.", + "canonical": true, + "file": "vmware_engine.reset_nsx_credentials.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResetNsxCredentials", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ResetNsxCredentials", + "async": true, + "parameters": [ + { + "name": "private_cloud", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ResetNsxCredentials", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ResetNsxCredentials", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async", + "title": "VmwareEngine resetVcenterCredentials Sample", + "origin": "API_DEFINITION", + "description": " Resets credentials of the Vcenter appliance.", + "canonical": true, + "file": "vmware_engine.reset_vcenter_credentials.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResetVcenterCredentials", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ResetVcenterCredentials", + "async": true, + "parameters": [ + { + "name": "private_cloud", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ResetVcenterCredentials", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ResetVcenterCredentials", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async", + "title": "VmwareEngine createHcxActivationKey Sample", + "origin": "API_DEFINITION", + "description": " Creates a new HCX activation key in a given private cloud.", + "canonical": true, + "file": "vmware_engine.create_hcx_activation_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateHcxActivationKey", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateHcxActivationKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "hcx_activation_key", + "type": ".google.cloud.vmwareengine.v1.HcxActivationKey" + }, + { + "name": "hcx_activation_key_id", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "CreateHcxActivationKey", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateHcxActivationKey", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListHcxActivationKeys_async", + "title": "VmwareEngine listHcxActivationKeys Sample", + "origin": "API_DEFINITION", + "description": " Lists `HcxActivationKey` resources in a given private cloud.", + "canonical": true, + "file": "vmware_engine.list_hcx_activation_keys.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListHcxActivationKeys", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListHcxActivationKeys", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.ListHcxActivationKeysResponse", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ListHcxActivationKeys", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListHcxActivationKeys", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetHcxActivationKey_async", + "title": "VmwareEngine getHcxActivationKey Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a `HcxActivationKey` resource by its resource name.", + "canonical": true, + "file": "vmware_engine.get_hcx_activation_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetHcxActivationKey", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetHcxActivationKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.HcxActivationKey", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "GetHcxActivationKey", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetHcxActivationKey", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetNetworkPolicy_async", + "title": "VmwareEngine getNetworkPolicy Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a `NetworkPolicy` resource by its resource name.", + "canonical": true, + "file": "vmware_engine.get_network_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNetworkPolicy", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetNetworkPolicy", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.NetworkPolicy", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "GetNetworkPolicy", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetNetworkPolicy", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListNetworkPolicies_async", + "title": "VmwareEngine listNetworkPolicies Sample", + "origin": "API_DEFINITION", + "description": " Lists `NetworkPolicy` resources in a specified project and location.", + "canonical": true, + "file": "vmware_engine.list_network_policies.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 106, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNetworkPolicies", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListNetworkPolicies", + "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.vmwareengine.v1.ListNetworkPoliciesResponse", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ListNetworkPolicies", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListNetworkPolicies", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async", + "title": "VmwareEngine createNetworkPolicy Sample", + "origin": "API_DEFINITION", + "description": " Creates a new network policy in a given VMware Engine network of a project and location (region). A new network policy cannot be created if another network policy already exists in the same scope.", + "canonical": true, + "file": "vmware_engine.create_network_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 94, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNetworkPolicy", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateNetworkPolicy", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "network_policy_id", + "type": "TYPE_STRING" + }, + { + "name": "network_policy", + "type": ".google.cloud.vmwareengine.v1.NetworkPolicy" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "CreateNetworkPolicy", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateNetworkPolicy", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async", + "title": "VmwareEngine updateNetworkPolicy Sample", + "origin": "API_DEFINITION", + "description": " Modifies a `NetworkPolicy` resource. Only the following fields can be updated: `internet_access`, `external_ip`, `edge_services_cidr`. Only fields specified in `updateMask` are applied. When updating a network policy, the external IP network service can only be disabled if there are no external IP addresses present in the scope of the policy. Also, a `NetworkService` cannot be updated when `NetworkService.state` is set to `RECONCILING`. During operation processing, the resource is temporarily in the `ACTIVE` state before the operation fully completes. For that period of time, you can't update the resource. Use the operation status to determine when the processing fully completes.", + "canonical": true, + "file": "vmware_engine.update_network_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNetworkPolicy", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateNetworkPolicy", + "async": true, + "parameters": [ + { + "name": "network_policy", + "type": ".google.cloud.vmwareengine.v1.NetworkPolicy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "UpdateNetworkPolicy", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateNetworkPolicy", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async", + "title": "VmwareEngine deleteNetworkPolicy Sample", + "origin": "API_DEFINITION", + "description": " Deletes a `NetworkPolicy` resource. A network policy cannot be deleted when `NetworkService.state` is set to `RECONCILING` for either its external IP or internet access service.", + "canonical": true, + "file": "vmware_engine.delete_network_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNetworkPolicy", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteNetworkPolicy", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "DeleteNetworkPolicy", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteNetworkPolicy", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async", + "title": "VmwareEngine createVmwareEngineNetwork Sample", + "origin": "API_DEFINITION", + "description": " Creates a new VMware Engine network that can be used by a private cloud.", + "canonical": true, + "file": "vmware_engine.create_vmware_engine_network.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 97, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateVmwareEngineNetwork", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateVmwareEngineNetwork", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "vmware_engine_network_id", + "type": "TYPE_STRING" + }, + { + "name": "vmware_engine_network", + "type": ".google.cloud.vmwareengine.v1.VmwareEngineNetwork" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "CreateVmwareEngineNetwork", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateVmwareEngineNetwork", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async", + "title": "VmwareEngine updateVmwareEngineNetwork Sample", + "origin": "API_DEFINITION", + "description": " Modifies a VMware Engine network resource. Only the following fields can be updated: `description`. Only fields specified in `updateMask` are applied.", + "canonical": true, + "file": "vmware_engine.update_vmware_engine_network.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateVmwareEngineNetwork", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateVmwareEngineNetwork", + "async": true, + "parameters": [ + { + "name": "vmware_engine_network", + "type": ".google.cloud.vmwareengine.v1.VmwareEngineNetwork" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "UpdateVmwareEngineNetwork", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateVmwareEngineNetwork", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async", + "title": "VmwareEngine deleteVmwareEngineNetwork Sample", + "origin": "API_DEFINITION", + "description": " Deletes a `VmwareEngineNetwork` resource. You can only delete a VMware Engine network after all resources that refer to it are deleted. For example, a private cloud, a network peering, and a network policy can all refer to the same VMware Engine network.", + "canonical": true, + "file": "vmware_engine.delete_vmware_engine_network.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteVmwareEngineNetwork", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteVmwareEngineNetwork", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "DeleteVmwareEngineNetwork", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteVmwareEngineNetwork", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetVmwareEngineNetwork_async", + "title": "VmwareEngine getVmwareEngineNetwork Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a `VmwareEngineNetwork` resource by its resource name. The resource contains details of the VMware Engine network, such as its VMware Engine network type, peered networks in a service project, and state (for example, `CREATING`, `ACTIVE`, `DELETING`).", + "canonical": true, + "file": "vmware_engine.get_vmware_engine_network.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVmwareEngineNetwork", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetVmwareEngineNetwork", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.VmwareEngineNetwork", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "GetVmwareEngineNetwork", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetVmwareEngineNetwork", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListVmwareEngineNetworks_async", + "title": "VmwareEngine listVmwareEngineNetworks Sample", + "origin": "API_DEFINITION", + "description": " Lists `VmwareEngineNetwork` resources in a given project and location.", + "canonical": true, + "file": "vmware_engine.list_vmware_engine_networks.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 105, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListVmwareEngineNetworks", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListVmwareEngineNetworks", + "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.vmwareengine.v1.ListVmwareEngineNetworksResponse", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ListVmwareEngineNetworks", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListVmwareEngineNetworks", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async", + "title": "VmwareEngine createPrivateConnection Sample", + "origin": "API_DEFINITION", + "description": " Creates a new private connection that can be used for accessing private Clouds.", + "canonical": true, + "file": "vmware_engine.create_private_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 92, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreatePrivateConnection", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateConnection", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "private_connection_id", + "type": "TYPE_STRING" + }, + { + "name": "private_connection", + "type": ".google.cloud.vmwareengine.v1.PrivateConnection" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "CreatePrivateConnection", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateConnection", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetPrivateConnection_async", + "title": "VmwareEngine getPrivateConnection Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a `PrivateConnection` resource by its resource name. The resource contains details of the private connection, such as connected network, routing mode and state.", + "canonical": true, + "file": "vmware_engine.get_private_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetPrivateConnection", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.PrivateConnection", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "GetPrivateConnection", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateConnection", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListPrivateConnections_async", + "title": "VmwareEngine listPrivateConnections Sample", + "origin": "API_DEFINITION", + "description": " Lists `PrivateConnection` resources in a given project and location.", + "canonical": true, + "file": "vmware_engine.list_private_connections.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 105, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListPrivateConnections", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnections", + "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.vmwareengine.v1.ListPrivateConnectionsResponse", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ListPrivateConnections", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnections", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async", + "title": "VmwareEngine updatePrivateConnection Sample", + "origin": "API_DEFINITION", + "description": " Modifies a `PrivateConnection` resource. Only `description` and `routing_mode` fields can be updated. Only fields specified in `updateMask` are applied.", + "canonical": true, + "file": "vmware_engine.update_private_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdatePrivateConnection", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateConnection", + "async": true, + "parameters": [ + { + "name": "private_connection", + "type": ".google.cloud.vmwareengine.v1.PrivateConnection" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "UpdatePrivateConnection", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateConnection", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async", + "title": "VmwareEngine deletePrivateConnection Sample", + "origin": "API_DEFINITION", + "description": " Deletes a `PrivateConnection` resource. When a private connection is deleted for a VMware Engine network, the connected network becomes inaccessible to that VMware Engine network.", + "canonical": true, + "file": "vmware_engine.delete_private_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePrivateConnection", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "DeletePrivateConnection", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateConnection", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + }, + { + "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListPrivateConnectionPeeringRoutes_async", + "title": "VmwareEngine listPrivateConnectionPeeringRoutes Sample", + "origin": "API_DEFINITION", + "description": " Lists the private connection routes exchanged over a peering connection.", + "canonical": true, + "file": "vmware_engine.list_private_connection_peering_routes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListPrivateConnectionPeeringRoutes", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnectionPeeringRoutes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesResponse", + "client": { + "shortName": "VmwareEngineClient", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" + }, + "method": { + "shortName": "ListPrivateConnectionPeeringRoutes", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnectionPeeringRoutes", + "service": { + "shortName": "VmwareEngine", + "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_cluster.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_cluster.js new file mode 100644 index 00000000000..fdb7708f2ca --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_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(parent, clusterId, cluster) { + // [START vmwareengine_v1_generated_VmwareEngine_CreateCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud to create a new cluster + * in. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + */ + // const parent = 'abc123' + /** + * Required. The user-provided identifier of the new `Cluster`. + * This identifier must be unique among clusters within the parent and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + */ + // const clusterId = 'abc123' + /** + * Required. The initial description of the new cluster. + */ + // const cluster = {} + /** + * Optional. 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. True if you want the request to be validated and not executed; + * false otherwise. + */ + // const validateOnly = true + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callCreateCluster() { + // Construct request + const request = { + parent, + clusterId, + cluster, + }; + + // Run request + const [operation] = await vmwareengineClient.createCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateCluster(); + // [END vmwareengine_v1_generated_VmwareEngine_CreateCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_hcx_activation_key.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_hcx_activation_key.js new file mode 100644 index 00000000000..764dd4ab4ab --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_hcx_activation_key.js @@ -0,0 +1,101 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, hcxActivationKey, hcxActivationKeyId) { + // [START vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud to create the key for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + */ + // const parent = 'abc123' + /** + * Required. The initial description of a new HCX activation key. When + * creating a new key, this field must be an empty object. + */ + // const hcxActivationKey = {} + /** + * Required. The user-provided identifier of the `HcxActivationKey` to be + * created. This identifier must be unique among `HcxActivationKey` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + */ + // const hcxActivationKeyId = 'abc123' + /** + * 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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callCreateHcxActivationKey() { + // Construct request + const request = { + parent, + hcxActivationKey, + hcxActivationKeyId, + }; + + // Run request + const [operation] = await vmwareengineClient.createHcxActivationKey(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateHcxActivationKey(); + // [END vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_network_policy.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_network_policy.js new file mode 100644 index 00000000000..fd9792850ce --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_network_policy.js @@ -0,0 +1,102 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, networkPolicyId, networkPolicy) { + // [START vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 (region) + * to create the new network policy in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1` + */ + // const parent = 'abc123' + /** + * Required. The user-provided identifier of the network policy to be created. + * This identifier must be unique within parent + * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + */ + // const networkPolicyId = 'abc123' + /** + * Required. The network policy configuration to use in the request. + */ + // const networkPolicy = {} + /** + * 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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callCreateNetworkPolicy() { + // Construct request + const request = { + parent, + networkPolicyId, + networkPolicy, + }; + + // Run request + const [operation] = await vmwareengineClient.createNetworkPolicy(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateNetworkPolicy(); + // [END vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_cloud.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_cloud.js new file mode 100644 index 00000000000..77d7eea4e0f --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_cloud.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, privateCloudId, privateCloud) { + // [START vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 to create the new + * private cloud in. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + */ + // const parent = 'abc123' + /** + * Required. The user-provided identifier of the private cloud to be created. + * This identifier must be unique among each `PrivateCloud` within the parent + * and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + */ + // const privateCloudId = 'abc123' + /** + * Required. The initial description of the new private cloud. + */ + // const privateCloud = {} + /** + * Optional. 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. True if you want the request to be validated and not executed; + * false otherwise. + */ + // const validateOnly = true + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callCreatePrivateCloud() { + // Construct request + const request = { + parent, + privateCloudId, + privateCloud, + }; + + // Run request + const [operation] = await vmwareengineClient.createPrivateCloud(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreatePrivateCloud(); + // [END vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_connection.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_connection.js new file mode 100644 index 00000000000..03084fd79cf --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_connection.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(parent, privateConnectionId, privateConnection) { + // [START vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 to create the new private + * connection in. Private connection is a regional resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-central1` + */ + // const parent = 'abc123' + /** + * Required. The user-provided identifier of the new private connection. + * This identifier must be unique among private connection resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + */ + // const privateConnectionId = 'abc123' + /** + * Required. The initial description of the new private connection. + */ + // const privateConnection = {} + /** + * 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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callCreatePrivateConnection() { + // Construct request + const request = { + parent, + privateConnectionId, + privateConnection, + }; + + // Run request + const [operation] = await vmwareengineClient.createPrivateConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreatePrivateConnection(); + // [END vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_vmware_engine_network.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_vmware_engine_network.js new file mode 100644 index 00000000000..53977beabaa --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_vmware_engine_network.js @@ -0,0 +1,105 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, vmwareEngineNetworkId, vmwareEngineNetwork) { + // [START vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 to create the new VMware Engine + * network in. A VMware Engine network of type + * `LEGACY` is a regional resource, and a VMware + * Engine network of type `STANDARD` is a global resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global` + */ + // const parent = 'abc123' + /** + * Required. The user-provided identifier of the new VMware Engine network. + * This identifier must be unique among VMware Engine network resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * For networks of type LEGACY, adheres to the format: + * `{region-id}-default`. Replace `{region-id}` with the region where you want + * to create the VMware Engine network. For example, "us-central1-default". + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + */ + // const vmwareEngineNetworkId = 'abc123' + /** + * Required. The initial description of the new VMware Engine network. + */ + // const vmwareEngineNetwork = {} + /** + * 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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callCreateVmwareEngineNetwork() { + // Construct request + const request = { + parent, + vmwareEngineNetworkId, + vmwareEngineNetwork, + }; + + // Run request + const [operation] = await vmwareengineClient.createVmwareEngineNetwork(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateVmwareEngineNetwork(); + // [END vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_cluster.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_cluster.js new file mode 100644 index 00000000000..cb5a2264cdc --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_cluster.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(name) { + // [START vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 cluster to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + */ + // const name = 'abc123' + /** + * Optional. 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callDeleteCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await vmwareengineClient.deleteCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteCluster(); + // [END vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_network_policy.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_network_policy.js new file mode 100644 index 00000000000..a284bda09b5 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_network_policy.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(name) { + // [START vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 network policy to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + */ + // 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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callDeleteNetworkPolicy() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await vmwareengineClient.deleteNetworkPolicy(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteNetworkPolicy(); + // [END vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_cloud.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_cloud.js new file mode 100644 index 00000000000..742532dfe62 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_cloud.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(name) { + // [START vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + */ + // const name = 'abc123' + /** + * Optional. 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, cascade delete is enabled and all children of + * this private cloud resource are also deleted. When this flag is set to + * false, the private cloud will not be deleted if there are any children + * other than the management cluster. The management cluster is always + * deleted. + */ + // const force = true + /** + * Optional. Time delay of the deletion specified in hours. The default value + * is `3`. Specifying a non-zero value for this field changes the value of + * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned + * deletion time. Deletion can be cancelled before `expire_time` elapses using + * VmwareEngine.UndeletePrivateCloud google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud. + * Specifying a value of `0` for this field instead begins the deletion + * process and ceases billing immediately. During the final deletion process, + * the value of `PrivateCloud.state` becomes `PURGING`. + */ + // const delayHours = 1234 + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callDeletePrivateCloud() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await vmwareengineClient.deletePrivateCloud(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeletePrivateCloud(); + // [END vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_connection.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_connection.js new file mode 100644 index 00000000000..f382c3bb5a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_connection.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(name) { + // [START vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private connection to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + */ + // 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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callDeletePrivateConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await vmwareengineClient.deletePrivateConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeletePrivateConnection(); + // [END vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_vmware_engine_network.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_vmware_engine_network.js new file mode 100644 index 00000000000..29d1d3eace4 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_vmware_engine_network.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 vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 VMware Engine network to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + */ + // 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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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. Checksum used to ensure that the user-provided value is up to + * date before the server processes the request. The server compares provided + * checksum with the current checksum of the resource. If the user-provided + * value is out of date, this request returns an `ABORTED` error. + */ + // const etag = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callDeleteVmwareEngineNetwork() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await vmwareengineClient.deleteVmwareEngineNetwork(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteVmwareEngineNetwork(); + // [END vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_cluster.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_cluster.js new file mode 100644 index 00000000000..5706ac8001e --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_cluster.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 vmwareengine_v1_generated_VmwareEngine_GetCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The cluster resource name to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + */ + // const name = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callGetCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await vmwareengineClient.getCluster(request); + console.log(response); + } + + callGetCluster(); + // [END vmwareengine_v1_generated_VmwareEngine_GetCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_hcx_activation_key.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_hcx_activation_key.js new file mode 100644 index 00000000000..a8e524ac7e2 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_hcx_activation_key.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 vmwareengine_v1_generated_VmwareEngine_GetHcxActivationKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 HCX activation key to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + */ + // const name = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callGetHcxActivationKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await vmwareengineClient.getHcxActivationKey(request); + console.log(response); + } + + callGetHcxActivationKey(); + // [END vmwareengine_v1_generated_VmwareEngine_GetHcxActivationKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_network_policy.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_network_policy.js new file mode 100644 index 00000000000..06b3cf69916 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_network_policy.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 vmwareengine_v1_generated_VmwareEngine_GetNetworkPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 network policy to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + */ + // const name = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callGetNetworkPolicy() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await vmwareengineClient.getNetworkPolicy(request); + console.log(response); + } + + callGetNetworkPolicy(); + // [END vmwareengine_v1_generated_VmwareEngine_GetNetworkPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_node_type.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_node_type.js new file mode 100644 index 00000000000..dcd807ebcbd --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_node_type.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 vmwareengine_v1_generated_VmwareEngine_GetNodeType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 node type to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + */ + // const name = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callGetNodeType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await vmwareengineClient.getNodeType(request); + console.log(response); + } + + callGetNodeType(); + // [END vmwareengine_v1_generated_VmwareEngine_GetNodeType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_cloud.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_cloud.js new file mode 100644 index 00000000000..884fbc8e66f --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_cloud.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 vmwareengine_v1_generated_VmwareEngine_GetPrivateCloud_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + */ + // const name = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callGetPrivateCloud() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await vmwareengineClient.getPrivateCloud(request); + console.log(response); + } + + callGetPrivateCloud(); + // [END vmwareengine_v1_generated_VmwareEngine_GetPrivateCloud_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_connection.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_connection.js new file mode 100644 index 00000000000..1b9a8f615d9 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_connection.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 vmwareengine_v1_generated_VmwareEngine_GetPrivateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private connection to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + */ + // const name = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callGetPrivateConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await vmwareengineClient.getPrivateConnection(request); + console.log(response); + } + + callGetPrivateConnection(); + // [END vmwareengine_v1_generated_VmwareEngine_GetPrivateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_subnet.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_subnet.js new file mode 100644 index 00000000000..31e78f12553 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_subnet.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 vmwareengine_v1_generated_VmwareEngine_GetSubnet_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 subnet to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + */ + // const name = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callGetSubnet() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await vmwareengineClient.getSubnet(request); + console.log(response); + } + + callGetSubnet(); + // [END vmwareengine_v1_generated_VmwareEngine_GetSubnet_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_vmware_engine_network.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_vmware_engine_network.js new file mode 100644 index 00000000000..87517b5d900 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_vmware_engine_network.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 vmwareengine_v1_generated_VmwareEngine_GetVmwareEngineNetwork_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 VMware Engine network to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + */ + // const name = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callGetVmwareEngineNetwork() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await vmwareengineClient.getVmwareEngineNetwork(request); + console.log(response); + } + + callGetVmwareEngineNetwork(); + // [END vmwareengine_v1_generated_VmwareEngine_GetVmwareEngineNetwork_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_clusters.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_clusters.js new file mode 100644 index 00000000000..3964f8ef84f --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_clusters.js @@ -0,0 +1,104 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListClusters_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + */ + // const parent = 'abc123' + /** + * The maximum number of clusters to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListClusters` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListClusters` + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + */ + // const filter = 'abc123' + /** + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + */ + // const orderBy = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callListClusters() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await vmwareengineClient.listClustersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListClusters(); + // [END vmwareengine_v1_generated_VmwareEngine_ListClusters_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_hcx_activation_keys.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_hcx_activation_keys.js new file mode 100644 index 00000000000..50aa1252a10 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_hcx_activation_keys.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 vmwareengine_v1_generated_VmwareEngine_ListHcxActivationKeys_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + */ + // const parent = 'abc123' + /** + * The maximum number of HCX activation keys to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListHcxActivationKeys` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListHcxActivationKeys` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callListHcxActivationKeys() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await vmwareengineClient.listHcxActivationKeysAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListHcxActivationKeys(); + // [END vmwareengine_v1_generated_VmwareEngine_ListHcxActivationKeys_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_network_policies.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_network_policies.js new file mode 100644 index 00000000000..680d90a215b --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_network_policies.js @@ -0,0 +1,114 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListNetworkPolicies_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + */ + // const parent = 'abc123' + /** + * The maximum number of network policies to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListNetworkPolicies` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNetworkPolicies` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + */ + // const filter = 'abc123' + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + */ + // const orderBy = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callListNetworkPolicies() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await vmwareengineClient.listNetworkPoliciesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNetworkPolicies(); + // [END vmwareengine_v1_generated_VmwareEngine_ListNetworkPolicies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_node_types.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_node_types.js new file mode 100644 index 00000000000..e3433877c06 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_node_types.js @@ -0,0 +1,106 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListNodeTypes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + */ + // const parent = 'abc123' + /** + * The maximum number of node types to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListNodeTypes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNodeTypes` must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + */ + // const filter = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callListNodeTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await vmwareengineClient.listNodeTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNodeTypes(); + // [END vmwareengine_v1_generated_VmwareEngine_ListNodeTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_clouds.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_clouds.js new file mode 100644 index 00000000000..a4a40e6a293 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_clouds.js @@ -0,0 +1,114 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListPrivateClouds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + */ + // const parent = 'abc123' + /** + * The maximum number of private clouds to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListPrivateClouds` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPrivateClouds` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + */ + // const filter = 'abc123' + /** + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + */ + // const orderBy = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callListPrivateClouds() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await vmwareengineClient.listPrivateCloudsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListPrivateClouds(); + // [END vmwareengine_v1_generated_VmwareEngine_ListPrivateClouds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connection_peering_routes.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connection_peering_routes.js new file mode 100644 index 00000000000..a4b7bf2779c --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connection_peering_routes.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 vmwareengine_v1_generated_VmwareEngine_ListPrivateConnectionPeeringRoutes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + */ + // const parent = 'abc123' + /** + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListPrivateConnectionPeeringRoutes` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callListPrivateConnectionPeeringRoutes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await vmwareengineClient.listPrivateConnectionPeeringRoutesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListPrivateConnectionPeeringRoutes(); + // [END vmwareengine_v1_generated_VmwareEngine_ListPrivateConnectionPeeringRoutes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connections.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connections.js new file mode 100644 index 00000000000..75381fad0aa --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connections.js @@ -0,0 +1,113 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListPrivateConnections_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + */ + // const parent = 'abc123' + /** + * The maximum number of private connections to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + */ + // const filter = 'abc123' + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + */ + // const orderBy = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callListPrivateConnections() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await vmwareengineClient.listPrivateConnectionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListPrivateConnections(); + // [END vmwareengine_v1_generated_VmwareEngine_ListPrivateConnections_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_subnets.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_subnets.js new file mode 100644 index 00000000000..4c0f173dfcb --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_subnets.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 vmwareengine_v1_generated_VmwareEngine_ListSubnets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + */ + // const parent = 'abc123' + /** + * The maximum number of subnets to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListSubnetsRequest` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListSubnetsRequest` must match the call that provided the page token. + */ + // const pageToken = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callListSubnets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await vmwareengineClient.listSubnetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSubnets(); + // [END vmwareengine_v1_generated_VmwareEngine_ListSubnets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_vmware_engine_networks.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_vmware_engine_networks.js new file mode 100644 index 00000000000..4629b490ec6 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_vmware_engine_networks.js @@ -0,0 +1,113 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListVmwareEngineNetworks_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + */ + // const parent = 'abc123' + /** + * The maximum number of results to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListVmwareEngineNetworks` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListVmwareEngineNetworks` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + */ + // const filter = 'abc123' + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + */ + // const orderBy = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callListVmwareEngineNetworks() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await vmwareengineClient.listVmwareEngineNetworksAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListVmwareEngineNetworks(); + // [END vmwareengine_v1_generated_VmwareEngine_ListVmwareEngineNetworks_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_nsx_credentials.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_nsx_credentials.js new file mode 100644 index 00000000000..0b8500bbf4b --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_nsx_credentials.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(privateCloud) { + // [START vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + */ + // const privateCloud = '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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callResetNsxCredentials() { + // Construct request + const request = { + privateCloud, + }; + + // Run request + const [operation] = await vmwareengineClient.resetNsxCredentials(request); + const [response] = await operation.promise(); + console.log(response); + } + + callResetNsxCredentials(); + // [END vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_vcenter_credentials.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_vcenter_credentials.js new file mode 100644 index 00000000000..458b41f086d --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_vcenter_credentials.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(privateCloud) { + // [START vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + */ + // const privateCloud = '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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callResetVcenterCredentials() { + // Construct request + const request = { + privateCloud, + }; + + // Run request + const [operation] = await vmwareengineClient.resetVcenterCredentials(request); + const [response] = await operation.promise(); + console.log(response); + } + + callResetVcenterCredentials(); + // [END vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_nsx_credentials.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_nsx_credentials.js new file mode 100644 index 00000000000..300ee77edfb --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_nsx_credentials.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(privateCloud) { + // [START vmwareengine_v1_generated_VmwareEngine_ShowNsxCredentials_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + */ + // const privateCloud = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callShowNsxCredentials() { + // Construct request + const request = { + privateCloud, + }; + + // Run request + const response = await vmwareengineClient.showNsxCredentials(request); + console.log(response); + } + + callShowNsxCredentials(); + // [END vmwareengine_v1_generated_VmwareEngine_ShowNsxCredentials_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_vcenter_credentials.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_vcenter_credentials.js new file mode 100644 index 00000000000..3e437a96d07 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_vcenter_credentials.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(privateCloud) { + // [START vmwareengine_v1_generated_VmwareEngine_ShowVcenterCredentials_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + */ + // const privateCloud = 'abc123' + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callShowVcenterCredentials() { + // Construct request + const request = { + privateCloud, + }; + + // Run request + const response = await vmwareengineClient.showVcenterCredentials(request); + console.log(response); + } + + callShowVcenterCredentials(); + // [END vmwareengine_v1_generated_VmwareEngine_ShowVcenterCredentials_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.undelete_private_cloud.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.undelete_private_cloud.js new file mode 100644 index 00000000000..53a99168aa4 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.undelete_private_cloud.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(name) { + // [START vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 private cloud scheduled for deletion. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + */ + // const name = 'abc123' + /** + * Optional. 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callUndeletePrivateCloud() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await vmwareengineClient.undeletePrivateCloud(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUndeletePrivateCloud(); + // [END vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_cluster.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_cluster.js new file mode 100644 index 00000000000..001367822f4 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_cluster.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(updateMask, cluster) { + // [START vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 + * `Cluster` resource by the update. The fields specified in the `updateMask` + * 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 description of the cluster. + */ + // const cluster = {} + /** + * Optional. 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. True if you want the request to be validated and not executed; + * false otherwise. + */ + // const validateOnly = true + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callUpdateCluster() { + // Construct request + const request = { + updateMask, + cluster, + }; + + // Run request + const [operation] = await vmwareengineClient.updateCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateCluster(); + // [END vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_network_policy.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_network_policy.js new file mode 100644 index 00000000000..caddb9be46a --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_network_policy.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(networkPolicy, updateMask) { + // [START vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Network policy description. + */ + // const networkPolicy = {} + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPolicy` 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 = {} + /** + * 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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callUpdateNetworkPolicy() { + // Construct request + const request = { + networkPolicy, + updateMask, + }; + + // Run request + const [operation] = await vmwareengineClient.updateNetworkPolicy(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateNetworkPolicy(); + // [END vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_cloud.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_cloud.js new file mode 100644 index 00000000000..2eb6ba953ac --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_cloud.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(privateCloud, updateMask) { + // [START vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Private cloud description. + */ + // const privateCloud = {} + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateCloud` resource by the update. The fields specified in `updateMask` + * 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 = {} + /** + * Optional. 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callUpdatePrivateCloud() { + // Construct request + const request = { + privateCloud, + updateMask, + }; + + // Run request + const [operation] = await vmwareengineClient.updatePrivateCloud(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdatePrivateCloud(); + // [END vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_connection.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_connection.js new file mode 100644 index 00000000000..a77762077f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_connection.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(privateConnection, updateMask) { + // [START vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Private connection description. + */ + // const privateConnection = {} + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateConnection` 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 = {} + /** + * 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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callUpdatePrivateConnection() { + // Construct request + const request = { + privateConnection, + updateMask, + }; + + // Run request + const [operation] = await vmwareengineClient.updatePrivateConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdatePrivateConnection(); + // [END vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_subnet.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_subnet.js new file mode 100644 index 00000000000..058161eb533 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_subnet.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(updateMask, subnet) { + // [START vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 + * `Subnet` 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. Subnet description. + */ + // const subnet = {} + + // Imports the Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callUpdateSubnet() { + // Construct request + const request = { + updateMask, + subnet, + }; + + // Run request + const [operation] = await vmwareengineClient.updateSubnet(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateSubnet(); + // [END vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_vmware_engine_network.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_vmware_engine_network.js new file mode 100644 index 00000000000..bb3e3858fba --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_vmware_engine_network.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(vmwareEngineNetwork, updateMask) { + // [START vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. VMware Engine network description. + */ + // const vmwareEngineNetwork = {} + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * VMware Engine network 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. Only the + * following fields can be updated: `description`. + */ + // const updateMask = {} + /** + * 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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you 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 Vmwareengine library + const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; + + // Instantiates a client + const vmwareengineClient = new VmwareEngineClient(); + + async function callUpdateVmwareEngineNetwork() { + // Construct request + const request = { + vmwareEngineNetwork, + updateMask, + }; + + // Run request + const [operation] = await vmwareengineClient.updateVmwareEngineNetwork(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateVmwareEngineNetwork(); + // [END vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/src/index.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/src/index.ts new file mode 100644 index 00000000000..df9903da7c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/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 VmwareEngineClient = v1.VmwareEngineClient; +type VmwareEngineClient = v1.VmwareEngineClient; +export {v1, VmwareEngineClient}; +export default {v1, VmwareEngineClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..0e003e70da7 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/gapic_metadata.json @@ -0,0 +1,449 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.vmwareengine.v1", + "libraryPackage": "@google-cloud/vmwareengine", + "services": { + "VmwareEngine": { + "clients": { + "grpc": { + "libraryClient": "VmwareEngineClient", + "rpcs": { + "GetPrivateCloud": { + "methods": [ + "getPrivateCloud" + ] + }, + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "GetSubnet": { + "methods": [ + "getSubnet" + ] + }, + "GetNodeType": { + "methods": [ + "getNodeType" + ] + }, + "ShowNsxCredentials": { + "methods": [ + "showNsxCredentials" + ] + }, + "ShowVcenterCredentials": { + "methods": [ + "showVcenterCredentials" + ] + }, + "GetHcxActivationKey": { + "methods": [ + "getHcxActivationKey" + ] + }, + "GetNetworkPolicy": { + "methods": [ + "getNetworkPolicy" + ] + }, + "GetVmwareEngineNetwork": { + "methods": [ + "getVmwareEngineNetwork" + ] + }, + "GetPrivateConnection": { + "methods": [ + "getPrivateConnection" + ] + }, + "CreatePrivateCloud": { + "methods": [ + "createPrivateCloud" + ] + }, + "UpdatePrivateCloud": { + "methods": [ + "updatePrivateCloud" + ] + }, + "DeletePrivateCloud": { + "methods": [ + "deletePrivateCloud" + ] + }, + "UndeletePrivateCloud": { + "methods": [ + "undeletePrivateCloud" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "UpdateSubnet": { + "methods": [ + "updateSubnet" + ] + }, + "ResetNsxCredentials": { + "methods": [ + "resetNsxCredentials" + ] + }, + "ResetVcenterCredentials": { + "methods": [ + "resetVcenterCredentials" + ] + }, + "CreateHcxActivationKey": { + "methods": [ + "createHcxActivationKey" + ] + }, + "CreateNetworkPolicy": { + "methods": [ + "createNetworkPolicy" + ] + }, + "UpdateNetworkPolicy": { + "methods": [ + "updateNetworkPolicy" + ] + }, + "DeleteNetworkPolicy": { + "methods": [ + "deleteNetworkPolicy" + ] + }, + "CreateVmwareEngineNetwork": { + "methods": [ + "createVmwareEngineNetwork" + ] + }, + "UpdateVmwareEngineNetwork": { + "methods": [ + "updateVmwareEngineNetwork" + ] + }, + "DeleteVmwareEngineNetwork": { + "methods": [ + "deleteVmwareEngineNetwork" + ] + }, + "CreatePrivateConnection": { + "methods": [ + "createPrivateConnection" + ] + }, + "UpdatePrivateConnection": { + "methods": [ + "updatePrivateConnection" + ] + }, + "DeletePrivateConnection": { + "methods": [ + "deletePrivateConnection" + ] + }, + "ListPrivateClouds": { + "methods": [ + "listPrivateClouds", + "listPrivateCloudsStream", + "listPrivateCloudsAsync" + ] + }, + "ListClusters": { + "methods": [ + "listClusters", + "listClustersStream", + "listClustersAsync" + ] + }, + "ListSubnets": { + "methods": [ + "listSubnets", + "listSubnetsStream", + "listSubnetsAsync" + ] + }, + "ListNodeTypes": { + "methods": [ + "listNodeTypes", + "listNodeTypesStream", + "listNodeTypesAsync" + ] + }, + "ListHcxActivationKeys": { + "methods": [ + "listHcxActivationKeys", + "listHcxActivationKeysStream", + "listHcxActivationKeysAsync" + ] + }, + "ListNetworkPolicies": { + "methods": [ + "listNetworkPolicies", + "listNetworkPoliciesStream", + "listNetworkPoliciesAsync" + ] + }, + "ListVmwareEngineNetworks": { + "methods": [ + "listVmwareEngineNetworks", + "listVmwareEngineNetworksStream", + "listVmwareEngineNetworksAsync" + ] + }, + "ListPrivateConnections": { + "methods": [ + "listPrivateConnections", + "listPrivateConnectionsStream", + "listPrivateConnectionsAsync" + ] + }, + "ListPrivateConnectionPeeringRoutes": { + "methods": [ + "listPrivateConnectionPeeringRoutes", + "listPrivateConnectionPeeringRoutesStream", + "listPrivateConnectionPeeringRoutesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "VmwareEngineClient", + "rpcs": { + "GetPrivateCloud": { + "methods": [ + "getPrivateCloud" + ] + }, + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "GetSubnet": { + "methods": [ + "getSubnet" + ] + }, + "GetNodeType": { + "methods": [ + "getNodeType" + ] + }, + "ShowNsxCredentials": { + "methods": [ + "showNsxCredentials" + ] + }, + "ShowVcenterCredentials": { + "methods": [ + "showVcenterCredentials" + ] + }, + "GetHcxActivationKey": { + "methods": [ + "getHcxActivationKey" + ] + }, + "GetNetworkPolicy": { + "methods": [ + "getNetworkPolicy" + ] + }, + "GetVmwareEngineNetwork": { + "methods": [ + "getVmwareEngineNetwork" + ] + }, + "GetPrivateConnection": { + "methods": [ + "getPrivateConnection" + ] + }, + "CreatePrivateCloud": { + "methods": [ + "createPrivateCloud" + ] + }, + "UpdatePrivateCloud": { + "methods": [ + "updatePrivateCloud" + ] + }, + "DeletePrivateCloud": { + "methods": [ + "deletePrivateCloud" + ] + }, + "UndeletePrivateCloud": { + "methods": [ + "undeletePrivateCloud" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "UpdateSubnet": { + "methods": [ + "updateSubnet" + ] + }, + "ResetNsxCredentials": { + "methods": [ + "resetNsxCredentials" + ] + }, + "ResetVcenterCredentials": { + "methods": [ + "resetVcenterCredentials" + ] + }, + "CreateHcxActivationKey": { + "methods": [ + "createHcxActivationKey" + ] + }, + "CreateNetworkPolicy": { + "methods": [ + "createNetworkPolicy" + ] + }, + "UpdateNetworkPolicy": { + "methods": [ + "updateNetworkPolicy" + ] + }, + "DeleteNetworkPolicy": { + "methods": [ + "deleteNetworkPolicy" + ] + }, + "CreateVmwareEngineNetwork": { + "methods": [ + "createVmwareEngineNetwork" + ] + }, + "UpdateVmwareEngineNetwork": { + "methods": [ + "updateVmwareEngineNetwork" + ] + }, + "DeleteVmwareEngineNetwork": { + "methods": [ + "deleteVmwareEngineNetwork" + ] + }, + "CreatePrivateConnection": { + "methods": [ + "createPrivateConnection" + ] + }, + "UpdatePrivateConnection": { + "methods": [ + "updatePrivateConnection" + ] + }, + "DeletePrivateConnection": { + "methods": [ + "deletePrivateConnection" + ] + }, + "ListPrivateClouds": { + "methods": [ + "listPrivateClouds", + "listPrivateCloudsStream", + "listPrivateCloudsAsync" + ] + }, + "ListClusters": { + "methods": [ + "listClusters", + "listClustersStream", + "listClustersAsync" + ] + }, + "ListSubnets": { + "methods": [ + "listSubnets", + "listSubnetsStream", + "listSubnetsAsync" + ] + }, + "ListNodeTypes": { + "methods": [ + "listNodeTypes", + "listNodeTypesStream", + "listNodeTypesAsync" + ] + }, + "ListHcxActivationKeys": { + "methods": [ + "listHcxActivationKeys", + "listHcxActivationKeysStream", + "listHcxActivationKeysAsync" + ] + }, + "ListNetworkPolicies": { + "methods": [ + "listNetworkPolicies", + "listNetworkPoliciesStream", + "listNetworkPoliciesAsync" + ] + }, + "ListVmwareEngineNetworks": { + "methods": [ + "listVmwareEngineNetworks", + "listVmwareEngineNetworksStream", + "listVmwareEngineNetworksAsync" + ] + }, + "ListPrivateConnections": { + "methods": [ + "listPrivateConnections", + "listPrivateConnectionsStream", + "listPrivateConnectionsAsync" + ] + }, + "ListPrivateConnectionPeeringRoutes": { + "methods": [ + "listPrivateConnectionPeeringRoutes", + "listPrivateConnectionPeeringRoutesStream", + "listPrivateConnectionPeeringRoutesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/index.ts new file mode 100644 index 00000000000..b4f28be5fac --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/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 {VmwareEngineClient} from './vmware_engine_client'; diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client.ts new file mode 100644 index 00000000000..7af01aa1fd0 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client.ts @@ -0,0 +1,6815 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/vmware_engine_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './vmware_engine_client_config.json'; +const version = require('../../../package.json').version; + +/** + * VMwareEngine manages VMware's private clusters in the Cloud. + * @class + * @memberof v1 + */ +export class VmwareEngineClient { + 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; + vmwareEngineStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of VmwareEngineClient. + * + * @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 VmwareEngineClient({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 VmwareEngineClient; + 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 = { + clusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}' + ), + hcxActivationKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + networkPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/networkPolicies/{network_policy}' + ), + nodeTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/nodeTypes/{node_type}' + ), + privateCloudPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}' + ), + privateConnectionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/privateConnections/{private_connection}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + subnetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet}' + ), + vmwareEngineNetworkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network}' + ), + }; + + // 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 = { + listPrivateClouds: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'privateClouds'), + listClusters: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'clusters'), + listSubnets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'subnets'), + listNodeTypes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'nodeTypes'), + listHcxActivationKeys: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hcxActivationKeys'), + listNetworkPolicies: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'networkPolicies'), + listVmwareEngineNetworks: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'vmwareEngineNetworks'), + listPrivateConnections: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'privateConnections'), + listPrivateConnectionPeeringRoutes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'peeringRoutes') + }; + + 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/*/privateClouds/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/privateClouds/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/privateClouds/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:testIamPermissions',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 createPrivateCloudResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + const createPrivateCloudMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const updatePrivateCloudResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + const updatePrivateCloudMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const deletePrivateCloudResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + const deletePrivateCloudMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const undeletePrivateCloudResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + const undeletePrivateCloudMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const createClusterResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.Cluster') as gax.protobuf.Type; + const createClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const updateClusterResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.Cluster') as gax.protobuf.Type; + const updateClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const deleteClusterResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const updateSubnetResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.Subnet') as gax.protobuf.Type; + const updateSubnetMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const resetNsxCredentialsResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + const resetNsxCredentialsMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const resetVcenterCredentialsResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + const resetVcenterCredentialsMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const createHcxActivationKeyResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.HcxActivationKey') as gax.protobuf.Type; + const createHcxActivationKeyMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const createNetworkPolicyResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.NetworkPolicy') as gax.protobuf.Type; + const createNetworkPolicyMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const updateNetworkPolicyResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.NetworkPolicy') as gax.protobuf.Type; + const updateNetworkPolicyMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const deleteNetworkPolicyResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteNetworkPolicyMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const createVmwareEngineNetworkResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.VmwareEngineNetwork') as gax.protobuf.Type; + const createVmwareEngineNetworkMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const updateVmwareEngineNetworkResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.VmwareEngineNetwork') as gax.protobuf.Type; + const updateVmwareEngineNetworkMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const deleteVmwareEngineNetworkResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteVmwareEngineNetworkMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const createPrivateConnectionResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.PrivateConnection') as gax.protobuf.Type; + const createPrivateConnectionMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const updatePrivateConnectionResponse = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.PrivateConnection') as gax.protobuf.Type; + const updatePrivateConnectionMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + const deletePrivateConnectionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deletePrivateConnectionMetadata = protoFilesRoot.lookup( + '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createPrivateCloud: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createPrivateCloudResponse.decode.bind(createPrivateCloudResponse), + createPrivateCloudMetadata.decode.bind(createPrivateCloudMetadata)), + updatePrivateCloud: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updatePrivateCloudResponse.decode.bind(updatePrivateCloudResponse), + updatePrivateCloudMetadata.decode.bind(updatePrivateCloudMetadata)), + deletePrivateCloud: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deletePrivateCloudResponse.decode.bind(deletePrivateCloudResponse), + deletePrivateCloudMetadata.decode.bind(deletePrivateCloudMetadata)), + undeletePrivateCloud: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + undeletePrivateCloudResponse.decode.bind(undeletePrivateCloudResponse), + undeletePrivateCloudMetadata.decode.bind(undeletePrivateCloudMetadata)), + createCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createClusterResponse.decode.bind(createClusterResponse), + createClusterMetadata.decode.bind(createClusterMetadata)), + updateCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateClusterResponse.decode.bind(updateClusterResponse), + updateClusterMetadata.decode.bind(updateClusterMetadata)), + deleteCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteClusterResponse.decode.bind(deleteClusterResponse), + deleteClusterMetadata.decode.bind(deleteClusterMetadata)), + updateSubnet: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateSubnetResponse.decode.bind(updateSubnetResponse), + updateSubnetMetadata.decode.bind(updateSubnetMetadata)), + resetNsxCredentials: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + resetNsxCredentialsResponse.decode.bind(resetNsxCredentialsResponse), + resetNsxCredentialsMetadata.decode.bind(resetNsxCredentialsMetadata)), + resetVcenterCredentials: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + resetVcenterCredentialsResponse.decode.bind(resetVcenterCredentialsResponse), + resetVcenterCredentialsMetadata.decode.bind(resetVcenterCredentialsMetadata)), + createHcxActivationKey: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createHcxActivationKeyResponse.decode.bind(createHcxActivationKeyResponse), + createHcxActivationKeyMetadata.decode.bind(createHcxActivationKeyMetadata)), + createNetworkPolicy: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createNetworkPolicyResponse.decode.bind(createNetworkPolicyResponse), + createNetworkPolicyMetadata.decode.bind(createNetworkPolicyMetadata)), + updateNetworkPolicy: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateNetworkPolicyResponse.decode.bind(updateNetworkPolicyResponse), + updateNetworkPolicyMetadata.decode.bind(updateNetworkPolicyMetadata)), + deleteNetworkPolicy: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteNetworkPolicyResponse.decode.bind(deleteNetworkPolicyResponse), + deleteNetworkPolicyMetadata.decode.bind(deleteNetworkPolicyMetadata)), + createVmwareEngineNetwork: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createVmwareEngineNetworkResponse.decode.bind(createVmwareEngineNetworkResponse), + createVmwareEngineNetworkMetadata.decode.bind(createVmwareEngineNetworkMetadata)), + updateVmwareEngineNetwork: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateVmwareEngineNetworkResponse.decode.bind(updateVmwareEngineNetworkResponse), + updateVmwareEngineNetworkMetadata.decode.bind(updateVmwareEngineNetworkMetadata)), + deleteVmwareEngineNetwork: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteVmwareEngineNetworkResponse.decode.bind(deleteVmwareEngineNetworkResponse), + deleteVmwareEngineNetworkMetadata.decode.bind(deleteVmwareEngineNetworkMetadata)), + createPrivateConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createPrivateConnectionResponse.decode.bind(createPrivateConnectionResponse), + createPrivateConnectionMetadata.decode.bind(createPrivateConnectionMetadata)), + updatePrivateConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updatePrivateConnectionResponse.decode.bind(updatePrivateConnectionResponse), + updatePrivateConnectionMetadata.decode.bind(updatePrivateConnectionMetadata)), + deletePrivateConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deletePrivateConnectionResponse.decode.bind(deletePrivateConnectionResponse), + deletePrivateConnectionMetadata.decode.bind(deletePrivateConnectionMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.vmwareengine.v1.VmwareEngine', 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.vmwareEngineStub) { + return this.vmwareEngineStub; + } + + // Put together the "service stub" for + // google.cloud.vmwareengine.v1.VmwareEngine. + this.vmwareEngineStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.vmwareengine.v1.VmwareEngine') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.vmwareengine.v1.VmwareEngine, + 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 vmwareEngineStubMethods = + ['listPrivateClouds', 'getPrivateCloud', 'createPrivateCloud', 'updatePrivateCloud', 'deletePrivateCloud', 'undeletePrivateCloud', 'listClusters', 'getCluster', 'createCluster', 'updateCluster', 'deleteCluster', 'listSubnets', 'getSubnet', 'updateSubnet', 'listNodeTypes', 'getNodeType', 'showNsxCredentials', 'showVcenterCredentials', 'resetNsxCredentials', 'resetVcenterCredentials', 'createHcxActivationKey', 'listHcxActivationKeys', 'getHcxActivationKey', 'getNetworkPolicy', 'listNetworkPolicies', 'createNetworkPolicy', 'updateNetworkPolicy', 'deleteNetworkPolicy', 'createVmwareEngineNetwork', 'updateVmwareEngineNetwork', 'deleteVmwareEngineNetwork', 'getVmwareEngineNetwork', 'listVmwareEngineNetworks', 'createPrivateConnection', 'getPrivateConnection', 'listPrivateConnections', 'updatePrivateConnection', 'deletePrivateConnection', 'listPrivateConnectionPeeringRoutes']; + for (const methodName of vmwareEngineStubMethods) { + const callPromise = this.vmwareEngineStub.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.vmwareEngineStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'vmwareengine.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 'vmwareengine.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 -- + // ------------------- +/** + * Retrieves a `PrivateCloud` resource by its resource name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the private cloud to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetPrivateCloud_async + */ + getPrivateCloud( + request?: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|undefined, {}|undefined + ]>; + getPrivateCloud( + request: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, + {}|null|undefined>): void; + getPrivateCloud( + request: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, + {}|null|undefined>): void; + getPrivateCloud( + request?: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getPrivateCloud(request, options, callback); + } +/** + * Retrieves a `Cluster` resource by its resource name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The cluster resource name to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-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 {@link protos.google.cloud.vmwareengine.v1.Cluster|Cluster}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetCluster_async + */ + getCluster( + request?: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest|undefined, {}|undefined + ]>; + getCluster( + request: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; + getCluster( + request: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; + getCluster( + request?: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getCluster(request, options, callback); + } +/** + * Gets details of a single subnet. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the subnet to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.Subnet|Subnet}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_subnet.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetSubnet_async + */ + getSubnet( + request?: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|undefined, {}|undefined + ]>; + getSubnet( + request: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, + {}|null|undefined>): void; + getSubnet( + request: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, + {}|null|undefined>): void; + getSubnet( + request?: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSubnet(request, options, callback); + } +/** + * Gets details of a single `NodeType`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the node type to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.NodeType|NodeType}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_node_type.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNodeType_async + */ + getNodeType( + request?: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.INodeType, + protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|undefined, {}|undefined + ]>; + getNodeType( + request: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INodeType, + protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, + {}|null|undefined>): void; + getNodeType( + request: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INodeType, + protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, + {}|null|undefined>): void; + getNodeType( + request?: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.vmwareengine.v1.INodeType, + protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.INodeType, + protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.vmwareengine.v1.INodeType, + protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getNodeType(request, options, callback); + } +/** + * Gets details of credentials for NSX appliance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.privateCloud + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.Credentials|Credentials}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.show_nsx_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ShowNsxCredentials_async + */ + showNsxCredentials( + request?: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|undefined, {}|undefined + ]>; + showNsxCredentials( + request: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, + {}|null|undefined>): void; + showNsxCredentials( + request: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, + {}|null|undefined>): void; + showNsxCredentials( + request?: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'private_cloud': request.privateCloud ?? '', + }); + this.initialize(); + return this.innerApiCalls.showNsxCredentials(request, options, callback); + } +/** + * Gets details of credentials for Vcenter appliance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.privateCloud + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.Credentials|Credentials}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.show_vcenter_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ShowVcenterCredentials_async + */ + showVcenterCredentials( + request?: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|undefined, {}|undefined + ]>; + showVcenterCredentials( + request: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, + {}|null|undefined>): void; + showVcenterCredentials( + request: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, + {}|null|undefined>): void; + showVcenterCredentials( + request?: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.vmwareengine.v1.ICredentials, + protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'private_cloud': request.privateCloud ?? '', + }); + this.initialize(); + return this.innerApiCalls.showVcenterCredentials(request, options, callback); + } +/** + * Retrieves a `HcxActivationKey` resource by its resource name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the HCX activation key to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-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 {@link protos.google.cloud.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_hcx_activation_key.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetHcxActivationKey_async + */ + getHcxActivationKey( + request?: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|undefined, {}|undefined + ]>; + getHcxActivationKey( + request: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, + {}|null|undefined>): void; + getHcxActivationKey( + request: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, + {}|null|undefined>): void; + getHcxActivationKey( + request?: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getHcxActivationKey(request, options, callback); + } +/** + * Retrieves a `NetworkPolicy` resource by its resource name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the network policy to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNetworkPolicy_async + */ + getNetworkPolicy( + request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|undefined, {}|undefined + ]>; + getNetworkPolicy( + request: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, + {}|null|undefined>): void; + getNetworkPolicy( + request: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, + {}|null|undefined>): void; + getNetworkPolicy( + request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getNetworkPolicy(request, options, callback); + } +/** + * Retrieves a `VmwareEngineNetwork` resource by its resource name. The + * resource contains details of the VMware Engine network, such as its VMware + * Engine network type, peered networks in a service project, and state + * (for example, `CREATING`, `ACTIVE`, `DELETING`). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the VMware Engine network to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetVmwareEngineNetwork_async + */ + getVmwareEngineNetwork( + request?: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|undefined, {}|undefined + ]>; + getVmwareEngineNetwork( + request: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, + {}|null|undefined>): void; + getVmwareEngineNetwork( + request: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, + {}|null|undefined>): void; + getVmwareEngineNetwork( + request?: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getVmwareEngineNetwork(request, options, callback); + } +/** + * Retrieves a `PrivateConnection` resource by its resource name. The resource + * contains details of the private connection, such as connected + * network, routing mode and state. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the private connection to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetPrivateConnection_async + */ + getPrivateConnection( + request?: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|undefined, {}|undefined + ]>; + getPrivateConnection( + request: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>): void; + getPrivateConnection( + request: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>): void; + getPrivateConnection( + request?: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getPrivateConnection(request, options, callback); + } + +/** + * Creates a new `PrivateCloud` resource in a given project and location. + * Private clouds can only be created in zones, regional private clouds are + * not supported. + * + * Creating a private cloud also creates a [management + * cluster](https://cloud.google.com/vmware-engine/docs/concepts-vmware-components) + * for that private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to create the new + * private cloud in. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {string} request.privateCloudId + * Required. The user-provided identifier of the private cloud to be created. + * This identifier must be unique among each `PrivateCloud` within the parent + * and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {google.cloud.vmwareengine.v1.PrivateCloud} request.privateCloud + * Required. The initial description of the new private cloud. + * @param {string} [request.requestId] + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async + */ + createPrivateCloud( + request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createPrivateCloud( + request: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPrivateCloud( + request: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPrivateCloud( + request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createPrivateCloud(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createPrivateCloud()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async + */ + async checkCreatePrivateCloudProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPrivateCloud, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Modifies a `PrivateCloud` resource. Only the following fields can be + * updated: `description`. + * Only fields specified in `updateMask` are applied. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vmwareengine.v1.PrivateCloud} request.privateCloud + * Required. Private cloud description. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateCloud` resource by the update. The fields specified in `updateMask` + * 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 {string} [request.requestId] + * Optional. 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/vmware_engine.update_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async + */ + updatePrivateCloud( + request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updatePrivateCloud( + request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updatePrivateCloud( + request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updatePrivateCloud( + request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'private_cloud.name': request.privateCloud!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updatePrivateCloud(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updatePrivateCloud()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async + */ + async checkUpdatePrivateCloudProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updatePrivateCloud, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Schedules a `PrivateCloud` resource for deletion. + * + * A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` + * set to `DELETED` and `expireTime` set to the time when deletion is final + * and can no longer be reversed. The delete operation is marked as done + * as soon as the `PrivateCloud` is successfully scheduled for deletion + * (this also applies when `delayHours` is set to zero), and the operation is + * not kept in pending state until `PrivateCloud` is purged. + * `PrivateCloud` can be restored using `UndeletePrivateCloud` method before + * the `expireTime` elapses. When `expireTime` is reached, deletion is final + * and all private cloud resources are irreversibly removed and billing stops. + * During the final removal process, `PrivateCloud.state` is set to `PURGING`. + * `PrivateCloud` can be polled using standard `GET` method for the whole + * period of deletion and purging. It will not be returned only + * when it is completely purged. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the private cloud to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {string} [request.requestId] + * Optional. 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, cascade delete is enabled and all children of + * this private cloud resource are also deleted. When this flag is set to + * false, the private cloud will not be deleted if there are any children + * other than the management cluster. The management cluster is always + * deleted. + * @param {number} [request.delayHours] + * Optional. Time delay of the deletion specified in hours. The default value + * is `3`. Specifying a non-zero value for this field changes the value of + * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned + * deletion time. Deletion can be cancelled before `expire_time` elapses using + * {@link protos.google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud|VmwareEngine.UndeletePrivateCloud}. + * Specifying a value of `0` for this field instead begins the deletion + * process and ceases billing immediately. During the final deletion process, + * the value of `PrivateCloud.state` becomes `PURGING`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async + */ + deletePrivateCloud( + request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deletePrivateCloud( + request: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePrivateCloud( + request: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePrivateCloud( + request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deletePrivateCloud(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deletePrivateCloud()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async + */ + async checkDeletePrivateCloudProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePrivateCloud, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Restores a private cloud that was previously scheduled for deletion by + * `DeletePrivateCloud`. A `PrivateCloud` resource scheduled for deletion has + * `PrivateCloud.state` set to `DELETED` and `PrivateCloud.expireTime` set to + * the time when deletion can no longer be reversed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the private cloud scheduled for deletion. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {string} [request.requestId] + * Optional. 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/vmware_engine.undelete_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async + */ + undeletePrivateCloud( + request?: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + undeletePrivateCloud( + request: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + undeletePrivateCloud( + request: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + undeletePrivateCloud( + request?: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.undeletePrivateCloud(request, options, callback); + } +/** + * Check the status of the long running operation returned by `undeletePrivateCloud()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.undelete_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async + */ + async checkUndeletePrivateCloudProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.undeletePrivateCloud, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new cluster in a given private cloud. + * Creating a new cluster provides additional nodes for + * use in the parent private cloud and requires sufficient [node + * quota](https://cloud.google.com/vmware-engine/quotas). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to create a new cluster + * in. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {string} request.clusterId + * Required. The user-provided identifier of the new `Cluster`. + * This identifier must be unique among clusters within the parent and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {google.cloud.vmwareengine.v1.Cluster} request.cluster + * Required. The initial description of the new cluster. + * @param {string} [request.requestId] + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateCluster_async + */ + createCluster( + request?: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createCluster( + request: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCluster( + request: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCluster( + request?: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateCluster_async + */ + async checkCreateClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Modifies a `Cluster` resource. Only the following fields can be updated: + * `node_type_configs.*.node_count`. Only fields specified in `updateMask` are + * applied. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * @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 + * `Cluster` resource by the update. The fields specified in the `updateMask` + * 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.vmwareengine.v1.Cluster} request.cluster + * Required. The description of the cluster. + * @param {string} [request.requestId] + * Optional. The request ID must be a valid UUID with the exception that + * zero UUID is not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async + */ + updateCluster( + request?: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateCluster( + request: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCluster( + request: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCluster( + request?: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'cluster.name': request.cluster!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async + */ + async checkUpdateClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a `Cluster` resource. To avoid unintended data loss, migrate or + * gracefully shut down any workloads running on the cluster before deletion. + * You cannot delete the management cluster of a private cloud using this + * method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the cluster to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @param {string} [request.requestId] + * Optional. 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/vmware_engine.delete_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async + */ + deleteCluster( + request?: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteCluster( + request: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteCluster( + request: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteCluster( + request?: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async + */ + async checkDeleteClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a single subnet. Only fields specified in + * `update_mask` are applied. + * + * *Note*: This API is synchronous and always returns a successful + * `google.longrunning.Operation` (LRO). The returned LRO will only have + * `done` and `response` fields. + * + * @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 + * `Subnet` 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.vmwareengine.v1.Subnet} request.subnet + * Required. Subnet description. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_subnet.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async + */ + updateSubnet( + request?: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateSubnet( + request: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSubnet( + request: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSubnet( + request?: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'subnet.name': request.subnet!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSubnet(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateSubnet()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_subnet.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async + */ + async checkUpdateSubnetProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSubnet, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Resets credentials of the NSX appliance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.privateCloud + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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/vmware_engine.reset_nsx_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async + */ + resetNsxCredentials( + request?: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + resetNsxCredentials( + request: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + resetNsxCredentials( + request: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + resetNsxCredentials( + request?: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'private_cloud': request.privateCloud ?? '', + }); + this.initialize(); + return this.innerApiCalls.resetNsxCredentials(request, options, callback); + } +/** + * Check the status of the long running operation returned by `resetNsxCredentials()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.reset_nsx_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async + */ + async checkResetNsxCredentialsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.resetNsxCredentials, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Resets credentials of the Vcenter appliance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.privateCloud + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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/vmware_engine.reset_vcenter_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async + */ + resetVcenterCredentials( + request?: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + resetVcenterCredentials( + request: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + resetVcenterCredentials( + request: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + resetVcenterCredentials( + request?: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'private_cloud': request.privateCloud ?? '', + }); + this.initialize(); + return this.innerApiCalls.resetVcenterCredentials(request, options, callback); + } +/** + * Check the status of the long running operation returned by `resetVcenterCredentials()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.reset_vcenter_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async + */ + async checkResetVcenterCredentialsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.resetVcenterCredentials, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new HCX activation key in a given private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to create the key for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @param {google.cloud.vmwareengine.v1.HcxActivationKey} request.hcxActivationKey + * Required. The initial description of a new HCX activation key. When + * creating a new key, this field must be an empty object. + * @param {string} request.hcxActivationKeyId + * Required. The user-provided identifier of the `HcxActivationKey` to be + * created. This identifier must be unique among `HcxActivationKey` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {string} request.requestId + * 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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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/vmware_engine.create_hcx_activation_key.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async + */ + createHcxActivationKey( + request?: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createHcxActivationKey( + request: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createHcxActivationKey( + request: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createHcxActivationKey( + request?: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createHcxActivationKey(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createHcxActivationKey()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_hcx_activation_key.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async + */ + async checkCreateHcxActivationKeyProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createHcxActivationKey, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new network policy in a given VMware Engine network of a + * project and location (region). A new network policy cannot be created if + * another network policy already exists in the same scope. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location (region) + * to create the new network policy in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1` + * @param {string} request.networkPolicyId + * Required. The user-provided identifier of the network policy to be created. + * This identifier must be unique within parent + * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {google.cloud.vmwareengine.v1.NetworkPolicy} request.networkPolicy + * Required. The network policy configuration to use in the request. + * @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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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/vmware_engine.create_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async + */ + createNetworkPolicy( + request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createNetworkPolicy( + request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createNetworkPolicy( + request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createNetworkPolicy( + request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createNetworkPolicy(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createNetworkPolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async + */ + async checkCreateNetworkPolicyProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createNetworkPolicy, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Modifies a `NetworkPolicy` resource. Only the following fields can be + * updated: `internet_access`, `external_ip`, `edge_services_cidr`. + * Only fields specified in `updateMask` are applied. When updating a network + * policy, the external IP network service can only be disabled if there are + * no external IP addresses present in the scope of the policy. Also, a + * `NetworkService` cannot be updated when `NetworkService.state` is set + * to `RECONCILING`. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vmwareengine.v1.NetworkPolicy} request.networkPolicy + * Required. Network policy description. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPolicy` 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 {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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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/vmware_engine.update_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async + */ + updateNetworkPolicy( + request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateNetworkPolicy( + request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateNetworkPolicy( + request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateNetworkPolicy( + request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'network_policy.name': request.networkPolicy!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateNetworkPolicy(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateNetworkPolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async + */ + async checkUpdateNetworkPolicyProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateNetworkPolicy, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a `NetworkPolicy` resource. A network policy cannot be deleted + * when `NetworkService.state` is set to `RECONCILING` for either its external + * IP or internet access service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the network policy to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * @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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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/vmware_engine.delete_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async + */ + deleteNetworkPolicy( + request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteNetworkPolicy( + request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteNetworkPolicy( + request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteNetworkPolicy( + request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteNetworkPolicy(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteNetworkPolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async + */ + async checkDeleteNetworkPolicyProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteNetworkPolicy, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new VMware Engine network that can be used by a private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to create the new VMware Engine + * network in. A VMware Engine network of type + * `LEGACY` is a regional resource, and a VMware + * Engine network of type `STANDARD` is a global resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global` + * @param {string} request.vmwareEngineNetworkId + * Required. The user-provided identifier of the new VMware Engine network. + * This identifier must be unique among VMware Engine network resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * + * * For networks of type LEGACY, adheres to the format: + * `{region-id}-default`. Replace `{region-id}` with the region where you want + * to create the VMware Engine network. For example, "us-central1-default". + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {google.cloud.vmwareengine.v1.VmwareEngineNetwork} request.vmwareEngineNetwork + * Required. The initial description of the new VMware Engine network. + * @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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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/vmware_engine.create_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async + */ + createVmwareEngineNetwork( + request?: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createVmwareEngineNetwork( + request: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createVmwareEngineNetwork( + request: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createVmwareEngineNetwork( + request?: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createVmwareEngineNetwork(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createVmwareEngineNetwork()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async + */ + async checkCreateVmwareEngineNetworkProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createVmwareEngineNetwork, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Modifies a VMware Engine network resource. Only the following fields can be + * updated: `description`. Only fields specified in `updateMask` are + * applied. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vmwareengine.v1.VmwareEngineNetwork} request.vmwareEngineNetwork + * Required. VMware Engine network description. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * VMware Engine network 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. Only the + * following fields can be updated: `description`. + * @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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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/vmware_engine.update_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async + */ + updateVmwareEngineNetwork( + request?: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateVmwareEngineNetwork( + request: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateVmwareEngineNetwork( + request: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateVmwareEngineNetwork( + request?: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'vmware_engine_network.name': request.vmwareEngineNetwork!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateVmwareEngineNetwork(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateVmwareEngineNetwork()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async + */ + async checkUpdateVmwareEngineNetworkProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateVmwareEngineNetwork, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a `VmwareEngineNetwork` resource. You can only delete a VMware + * Engine network after all resources that refer to it are deleted. For + * example, a private cloud, a network peering, and a network policy can all + * refer to the same VMware Engine network. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the VMware Engine network to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * @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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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 {string} [request.etag] + * Optional. Checksum used to ensure that the user-provided value is up to + * date before the server processes the request. The server compares provided + * checksum with the current checksum of the resource. If the user-provided + * value is out of date, this request returns an `ABORTED` error. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async + */ + deleteVmwareEngineNetwork( + request?: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteVmwareEngineNetwork( + request: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteVmwareEngineNetwork( + request: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteVmwareEngineNetwork( + request?: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteVmwareEngineNetwork(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteVmwareEngineNetwork()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async + */ + async checkDeleteVmwareEngineNetworkProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteVmwareEngineNetwork, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new private connection that can be used for accessing private + * Clouds. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to create the new private + * connection in. Private connection is a regional resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-central1` + * @param {string} request.privateConnectionId + * Required. The user-provided identifier of the new private connection. + * This identifier must be unique among private connection resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {google.cloud.vmwareengine.v1.PrivateConnection} request.privateConnection + * Required. The initial description of the new private connection. + * @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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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/vmware_engine.create_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async + */ + createPrivateConnection( + request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createPrivateConnection( + request: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPrivateConnection( + request: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPrivateConnection( + request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createPrivateConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createPrivateConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async + */ + async checkCreatePrivateConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPrivateConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Modifies a `PrivateConnection` resource. Only `description` and + * `routing_mode` fields can be updated. Only fields specified in `updateMask` + * are applied. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vmwareengine.v1.PrivateConnection} request.privateConnection + * Required. Private connection description. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateConnection` 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 {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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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/vmware_engine.update_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async + */ + updatePrivateConnection( + request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updatePrivateConnection( + request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updatePrivateConnection( + request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updatePrivateConnection( + request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'private_connection.name': request.privateConnection!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updatePrivateConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updatePrivateConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async + */ + async checkUpdatePrivateConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updatePrivateConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a `PrivateConnection` resource. When a private connection is + * deleted for a VMware Engine network, the connected network becomes + * inaccessible to that VMware Engine network. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the private connection to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * @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 guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you 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/vmware_engine.delete_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async + */ + deletePrivateConnection( + request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deletePrivateConnection( + request: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePrivateConnection( + request: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePrivateConnection( + request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deletePrivateConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deletePrivateConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async + */ + async checkDeletePrivateConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePrivateConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists `PrivateCloud` resources 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 private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of private clouds to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateClouds` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListPrivateClouds` must + * match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` 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 Array of {@link protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud}. + * 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 `listPrivateCloudsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPrivateClouds( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.IPrivateCloud[], + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest|null, + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse + ]>; + listPrivateClouds( + request: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPrivateCloud>): void; + listPrivateClouds( + request: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPrivateCloud>): void; + listPrivateClouds( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPrivateCloud>, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPrivateCloud>): + Promise<[ + protos.google.cloud.vmwareengine.v1.IPrivateCloud[], + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest|null, + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listPrivateClouds(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 private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of private clouds to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateClouds` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListPrivateClouds` must + * match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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.vmwareengine.v1.PrivateCloud|PrivateCloud} 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 `listPrivateCloudsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPrivateCloudsStream( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + 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['listPrivateClouds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPrivateClouds.createStream( + this.innerApiCalls.listPrivateClouds as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listPrivateClouds`, 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 private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of private clouds to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateClouds` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListPrivateClouds` must + * match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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.vmwareengine.v1.PrivateCloud|PrivateCloud}. 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/vmware_engine.list_private_clouds.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateClouds_async + */ + listPrivateCloudsAsync( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + 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['listPrivateClouds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPrivateClouds.asyncIterate( + this.innerApiCalls['listPrivateClouds'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists `Cluster` resources in a given private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of clusters to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListClusters` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListClusters` + * must match the call that provided the page token. + * @param {string} request.filter + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` 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 Array of {@link protos.google.cloud.vmwareengine.v1.Cluster|Cluster}. + * 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 `listClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listClusters( + request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.ICluster[], + protos.google.cloud.vmwareengine.v1.IListClustersRequest|null, + protos.google.cloud.vmwareengine.v1.IListClustersResponse + ]>; + listClusters( + request: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListClustersRequest, + protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.ICluster>): void; + listClusters( + request: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListClustersRequest, + protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.ICluster>): void; + listClusters( + request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListClustersRequest, + protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.ICluster>, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListClustersRequest, + protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.ICluster>): + Promise<[ + protos.google.cloud.vmwareengine.v1.ICluster[], + protos.google.cloud.vmwareengine.v1.IListClustersRequest|null, + protos.google.cloud.vmwareengine.v1.IListClustersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listClusters(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 private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of clusters to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListClusters` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListClusters` + * must match the call that provided the page token. + * @param {string} request.filter + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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.vmwareengine.v1.Cluster|Cluster} 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 `listClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listClustersStream( + request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + 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['listClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listClusters.createStream( + this.innerApiCalls.listClusters as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listClusters`, 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 private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of clusters to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListClusters` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListClusters` + * must match the call that provided the page token. + * @param {string} request.filter + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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.vmwareengine.v1.Cluster|Cluster}. 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/vmware_engine.list_clusters.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListClusters_async + */ + listClustersAsync( + request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + 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['listClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listClusters.asyncIterate( + this.innerApiCalls['listClusters'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists subnets in a given private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of subnets to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListSubnetsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListSubnetsRequest` 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.vmwareengine.v1.Subnet|Subnet}. + * 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 `listSubnetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSubnets( + request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.ISubnet[], + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest|null, + protos.google.cloud.vmwareengine.v1.IListSubnetsResponse + ]>; + listSubnets( + request: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.ISubnet>): void; + listSubnets( + request: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.ISubnet>): void; + listSubnets( + request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.ISubnet>, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.ISubnet>): + Promise<[ + protos.google.cloud.vmwareengine.v1.ISubnet[], + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest|null, + protos.google.cloud.vmwareengine.v1.IListSubnetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listSubnets(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 private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of subnets to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListSubnetsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListSubnetsRequest` 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.vmwareengine.v1.Subnet|Subnet} 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 `listSubnetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSubnetsStream( + request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + 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['listSubnets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSubnets.createStream( + this.innerApiCalls.listSubnets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSubnets`, 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 private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of subnets to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListSubnetsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListSubnetsRequest` 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.vmwareengine.v1.Subnet|Subnet}. 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/vmware_engine.list_subnets.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListSubnets_async + */ + listSubnetsAsync( + request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + 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['listSubnets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSubnets.asyncIterate( + this.innerApiCalls['listSubnets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists node types + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of node types to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNodeTypes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNodeTypes` must match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.vmwareengine.v1.NodeType|NodeType}. + * 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 `listNodeTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNodeTypes( + request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.INodeType[], + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest|null, + protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse + ]>; + listNodeTypes( + request: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.INodeType>): void; + listNodeTypes( + request: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.INodeType>): void; + listNodeTypes( + request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.INodeType>, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.INodeType>): + Promise<[ + protos.google.cloud.vmwareengine.v1.INodeType[], + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest|null, + protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listNodeTypes(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 to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of node types to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNodeTypes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNodeTypes` must match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + * @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.vmwareengine.v1.NodeType|NodeType} 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 `listNodeTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNodeTypesStream( + request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + 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['listNodeTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodeTypes.createStream( + this.innerApiCalls.listNodeTypes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNodeTypes`, 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 to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of node types to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNodeTypes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNodeTypes` must match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + * @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.vmwareengine.v1.NodeType|NodeType}. 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/vmware_engine.list_node_types.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNodeTypes_async + */ + listNodeTypesAsync( + request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + 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['listNodeTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodeTypes.asyncIterate( + this.innerApiCalls['listNodeTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists `HcxActivationKey` resources in a given private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of HCX activation keys to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListHcxActivationKeys` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListHcxActivationKeys` 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.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. + * 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 `listHcxActivationKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listHcxActivationKeys( + request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.IHcxActivationKey[], + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest|null, + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse + ]>; + listHcxActivationKeys( + request: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IHcxActivationKey>): void; + listHcxActivationKeys( + request: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IHcxActivationKey>): void; + listHcxActivationKeys( + request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IHcxActivationKey>, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IHcxActivationKey>): + Promise<[ + protos.google.cloud.vmwareengine.v1.IHcxActivationKey[], + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest|null, + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listHcxActivationKeys(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 private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of HCX activation keys to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListHcxActivationKeys` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListHcxActivationKeys` 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.vmwareengine.v1.HcxActivationKey|HcxActivationKey} 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 `listHcxActivationKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listHcxActivationKeysStream( + request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + 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['listHcxActivationKeys']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHcxActivationKeys.createStream( + this.innerApiCalls.listHcxActivationKeys as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listHcxActivationKeys`, 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 private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of HCX activation keys to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListHcxActivationKeys` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListHcxActivationKeys` 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.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. 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/vmware_engine.list_hcx_activation_keys.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListHcxActivationKeys_async + */ + listHcxActivationKeysAsync( + request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + 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['listHcxActivationKeys']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHcxActivationKeys.asyncIterate( + this.innerApiCalls['listHcxActivationKeys'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists `NetworkPolicy` resources in a specified project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of network policies to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNetworkPolicies` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNetworkPolicies` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` 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 Array of {@link protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. + * 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 `listNetworkPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNetworkPolicies( + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.INetworkPolicy[], + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest|null, + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse + ]>; + listNetworkPolicies( + request: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.INetworkPolicy>): void; + listNetworkPolicies( + request: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.INetworkPolicy>): void; + listNetworkPolicies( + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.INetworkPolicy>, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.INetworkPolicy>): + Promise<[ + protos.google.cloud.vmwareengine.v1.INetworkPolicy[], + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest|null, + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listNetworkPolicies(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 (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of network policies to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNetworkPolicies` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNetworkPolicies` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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.vmwareengine.v1.NetworkPolicy|NetworkPolicy} 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 `listNetworkPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNetworkPoliciesStream( + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + 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['listNetworkPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNetworkPolicies.createStream( + this.innerApiCalls.listNetworkPolicies as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNetworkPolicies`, 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 (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of network policies to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNetworkPolicies` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNetworkPolicies` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. 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/vmware_engine.list_network_policies.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNetworkPolicies_async + */ + listNetworkPoliciesAsync( + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + 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['listNetworkPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNetworkPolicies.asyncIterate( + this.innerApiCalls['listNetworkPolicies'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists `VmwareEngineNetwork` resources 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 to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param {number} request.pageSize + * The maximum number of results to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListVmwareEngineNetworks` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListVmwareEngineNetworks` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` 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 Array of {@link protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. + * 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 `listVmwareEngineNetworksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVmwareEngineNetworks( + request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[], + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest|null, + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse + ]>; + listVmwareEngineNetworks( + request: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>): void; + listVmwareEngineNetworks( + request: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>): void; + listVmwareEngineNetworks( + request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>): + Promise<[ + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[], + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest|null, + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listVmwareEngineNetworks(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 to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param {number} request.pageSize + * The maximum number of results to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListVmwareEngineNetworks` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListVmwareEngineNetworks` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork} 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 `listVmwareEngineNetworksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVmwareEngineNetworksStream( + request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + 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['listVmwareEngineNetworks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVmwareEngineNetworks.createStream( + this.innerApiCalls.listVmwareEngineNetworks as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listVmwareEngineNetworks`, 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 to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param {number} request.pageSize + * The maximum number of results to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListVmwareEngineNetworks` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListVmwareEngineNetworks` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. 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/vmware_engine.list_vmware_engine_networks.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListVmwareEngineNetworks_async + */ + listVmwareEngineNetworksAsync( + request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + 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['listVmwareEngineNetworks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVmwareEngineNetworks.asyncIterate( + this.innerApiCalls['listVmwareEngineNetworks'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists `PrivateConnection` resources 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 to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of private connections to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` 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 Array of {@link protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection}. + * 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 `listPrivateConnectionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPrivateConnections( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.IPrivateConnection[], + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest|null, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse + ]>; + listPrivateConnections( + request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPrivateConnection>): void; + listPrivateConnections( + request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPrivateConnection>): void; + listPrivateConnections( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPrivateConnection>, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPrivateConnection>): + Promise<[ + protos.google.cloud.vmwareengine.v1.IPrivateConnection[], + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest|null, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listPrivateConnections(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 to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of private connections to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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.vmwareengine.v1.PrivateConnection|PrivateConnection} 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 `listPrivateConnectionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPrivateConnectionsStream( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + 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['listPrivateConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPrivateConnections.createStream( + this.innerApiCalls.listPrivateConnections as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listPrivateConnections`, 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 to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of private connections to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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.vmwareengine.v1.PrivateConnection|PrivateConnection}. 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/vmware_engine.list_private_connections.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateConnections_async + */ + listPrivateConnectionsAsync( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + 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['listPrivateConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPrivateConnections.asyncIterate( + this.innerApiCalls['listPrivateConnections'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists the private connection routes exchanged over a peering connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * @param {number} request.pageSize + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListPrivateConnectionPeeringRoutes` 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.vmwareengine.v1.PeeringRoute|PeeringRoute}. + * 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 `listPrivateConnectionPeeringRoutesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPrivateConnectionPeeringRoutes( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vmwareengine.v1.IPeeringRoute[], + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest|null, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse + ]>; + listPrivateConnectionPeeringRoutes( + request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute>): void; + listPrivateConnectionPeeringRoutes( + request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute>): void; + listPrivateConnectionPeeringRoutes( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute>, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute>): + Promise<[ + protos.google.cloud.vmwareengine.v1.IPeeringRoute[], + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest|null, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listPrivateConnectionPeeringRoutes(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 private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * @param {number} request.pageSize + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListPrivateConnectionPeeringRoutes` 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.vmwareengine.v1.PeeringRoute|PeeringRoute} 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 `listPrivateConnectionPeeringRoutesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPrivateConnectionPeeringRoutesStream( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + 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['listPrivateConnectionPeeringRoutes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPrivateConnectionPeeringRoutes.createStream( + this.innerApiCalls.listPrivateConnectionPeeringRoutes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listPrivateConnectionPeeringRoutes`, 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 private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * @param {number} request.pageSize + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListPrivateConnectionPeeringRoutes` 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.vmwareengine.v1.PeeringRoute|PeeringRoute}. 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/vmware_engine.list_private_connection_peering_routes.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateConnectionPeeringRoutes_async + */ + listPrivateConnectionPeeringRoutesAsync( + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + 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['listPrivateConnectionPeeringRoutes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate( + this.innerApiCalls['listPrivateConnectionPeeringRoutes'] 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 cluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} private_cloud + * @param {string} cluster + * @returns {string} Resource name string. + */ + clusterPath(project:string,location:string,privateCloud:string,cluster:string) { + return this.pathTemplates.clusterPathTemplate.render({ + project: project, + location: location, + private_cloud: privateCloud, + cluster: cluster, + }); + } + + /** + * Parse the project from Cluster resource. + * + * @param {string} clusterName + * A fully-qualified path representing Cluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromClusterName(clusterName: string) { + return this.pathTemplates.clusterPathTemplate.match(clusterName).project; + } + + /** + * Parse the location from Cluster resource. + * + * @param {string} clusterName + * A fully-qualified path representing Cluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromClusterName(clusterName: string) { + return this.pathTemplates.clusterPathTemplate.match(clusterName).location; + } + + /** + * Parse the private_cloud from Cluster resource. + * + * @param {string} clusterName + * A fully-qualified path representing Cluster resource. + * @returns {string} A string representing the private_cloud. + */ + matchPrivateCloudFromClusterName(clusterName: string) { + return this.pathTemplates.clusterPathTemplate.match(clusterName).private_cloud; + } + + /** + * Parse the cluster from Cluster resource. + * + * @param {string} clusterName + * A fully-qualified path representing Cluster resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromClusterName(clusterName: string) { + return this.pathTemplates.clusterPathTemplate.match(clusterName).cluster; + } + + /** + * Return a fully-qualified hcxActivationKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} private_cloud + * @param {string} hcx_activation_key + * @returns {string} Resource name string. + */ + hcxActivationKeyPath(project:string,location:string,privateCloud:string,hcxActivationKey:string) { + return this.pathTemplates.hcxActivationKeyPathTemplate.render({ + project: project, + location: location, + private_cloud: privateCloud, + hcx_activation_key: hcxActivationKey, + }); + } + + /** + * Parse the project from HcxActivationKey resource. + * + * @param {string} hcxActivationKeyName + * A fully-qualified path representing HcxActivationKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHcxActivationKeyName(hcxActivationKeyName: string) { + return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).project; + } + + /** + * Parse the location from HcxActivationKey resource. + * + * @param {string} hcxActivationKeyName + * A fully-qualified path representing HcxActivationKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromHcxActivationKeyName(hcxActivationKeyName: string) { + return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).location; + } + + /** + * Parse the private_cloud from HcxActivationKey resource. + * + * @param {string} hcxActivationKeyName + * A fully-qualified path representing HcxActivationKey resource. + * @returns {string} A string representing the private_cloud. + */ + matchPrivateCloudFromHcxActivationKeyName(hcxActivationKeyName: string) { + return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).private_cloud; + } + + /** + * Parse the hcx_activation_key from HcxActivationKey resource. + * + * @param {string} hcxActivationKeyName + * A fully-qualified path representing HcxActivationKey resource. + * @returns {string} A string representing the hcx_activation_key. + */ + matchHcxActivationKeyFromHcxActivationKeyName(hcxActivationKeyName: string) { + return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).hcx_activation_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 networkPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} network_policy + * @returns {string} Resource name string. + */ + networkPolicyPath(project:string,location:string,networkPolicy:string) { + return this.pathTemplates.networkPolicyPathTemplate.render({ + project: project, + location: location, + network_policy: networkPolicy, + }); + } + + /** + * Parse the project from NetworkPolicy resource. + * + * @param {string} networkPolicyName + * A fully-qualified path representing NetworkPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkPolicyName(networkPolicyName: string) { + return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName).project; + } + + /** + * Parse the location from NetworkPolicy resource. + * + * @param {string} networkPolicyName + * A fully-qualified path representing NetworkPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromNetworkPolicyName(networkPolicyName: string) { + return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName).location; + } + + /** + * Parse the network_policy from NetworkPolicy resource. + * + * @param {string} networkPolicyName + * A fully-qualified path representing NetworkPolicy resource. + * @returns {string} A string representing the network_policy. + */ + matchNetworkPolicyFromNetworkPolicyName(networkPolicyName: string) { + return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName).network_policy; + } + + /** + * Return a fully-qualified nodeType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} node_type + * @returns {string} Resource name string. + */ + nodeTypePath(project:string,location:string,nodeType:string) { + return this.pathTemplates.nodeTypePathTemplate.render({ + project: project, + location: location, + node_type: nodeType, + }); + } + + /** + * Parse the project from NodeType resource. + * + * @param {string} nodeTypeName + * A fully-qualified path representing NodeType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeTypeName(nodeTypeName: string) { + return this.pathTemplates.nodeTypePathTemplate.match(nodeTypeName).project; + } + + /** + * Parse the location from NodeType resource. + * + * @param {string} nodeTypeName + * A fully-qualified path representing NodeType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromNodeTypeName(nodeTypeName: string) { + return this.pathTemplates.nodeTypePathTemplate.match(nodeTypeName).location; + } + + /** + * Parse the node_type from NodeType resource. + * + * @param {string} nodeTypeName + * A fully-qualified path representing NodeType resource. + * @returns {string} A string representing the node_type. + */ + matchNodeTypeFromNodeTypeName(nodeTypeName: string) { + return this.pathTemplates.nodeTypePathTemplate.match(nodeTypeName).node_type; + } + + /** + * Return a fully-qualified privateCloud resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} private_cloud + * @returns {string} Resource name string. + */ + privateCloudPath(project:string,location:string,privateCloud:string) { + return this.pathTemplates.privateCloudPathTemplate.render({ + project: project, + location: location, + private_cloud: privateCloud, + }); + } + + /** + * Parse the project from PrivateCloud resource. + * + * @param {string} privateCloudName + * A fully-qualified path representing PrivateCloud resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPrivateCloudName(privateCloudName: string) { + return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName).project; + } + + /** + * Parse the location from PrivateCloud resource. + * + * @param {string} privateCloudName + * A fully-qualified path representing PrivateCloud resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPrivateCloudName(privateCloudName: string) { + return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName).location; + } + + /** + * Parse the private_cloud from PrivateCloud resource. + * + * @param {string} privateCloudName + * A fully-qualified path representing PrivateCloud resource. + * @returns {string} A string representing the private_cloud. + */ + matchPrivateCloudFromPrivateCloudName(privateCloudName: string) { + return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName).private_cloud; + } + + /** + * Return a fully-qualified privateConnection resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} private_connection + * @returns {string} Resource name string. + */ + privateConnectionPath(project:string,location:string,privateConnection:string) { + return this.pathTemplates.privateConnectionPathTemplate.render({ + project: project, + location: location, + private_connection: privateConnection, + }); + } + + /** + * Parse the project from PrivateConnection resource. + * + * @param {string} privateConnectionName + * A fully-qualified path representing PrivateConnection resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPrivateConnectionName(privateConnectionName: string) { + return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).project; + } + + /** + * Parse the location from PrivateConnection resource. + * + * @param {string} privateConnectionName + * A fully-qualified path representing PrivateConnection resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPrivateConnectionName(privateConnectionName: string) { + return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).location; + } + + /** + * Parse the private_connection from PrivateConnection resource. + * + * @param {string} privateConnectionName + * A fully-qualified path representing PrivateConnection resource. + * @returns {string} A string representing the private_connection. + */ + matchPrivateConnectionFromPrivateConnectionName(privateConnectionName: string) { + return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).private_connection; + } + + /** + * 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 subnet resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} private_cloud + * @param {string} subnet + * @returns {string} Resource name string. + */ + subnetPath(project:string,location:string,privateCloud:string,subnet:string) { + return this.pathTemplates.subnetPathTemplate.render({ + project: project, + location: location, + private_cloud: privateCloud, + subnet: subnet, + }); + } + + /** + * Parse the project from Subnet resource. + * + * @param {string} subnetName + * A fully-qualified path representing Subnet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSubnetName(subnetName: string) { + return this.pathTemplates.subnetPathTemplate.match(subnetName).project; + } + + /** + * Parse the location from Subnet resource. + * + * @param {string} subnetName + * A fully-qualified path representing Subnet resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSubnetName(subnetName: string) { + return this.pathTemplates.subnetPathTemplate.match(subnetName).location; + } + + /** + * Parse the private_cloud from Subnet resource. + * + * @param {string} subnetName + * A fully-qualified path representing Subnet resource. + * @returns {string} A string representing the private_cloud. + */ + matchPrivateCloudFromSubnetName(subnetName: string) { + return this.pathTemplates.subnetPathTemplate.match(subnetName).private_cloud; + } + + /** + * Parse the subnet from Subnet resource. + * + * @param {string} subnetName + * A fully-qualified path representing Subnet resource. + * @returns {string} A string representing the subnet. + */ + matchSubnetFromSubnetName(subnetName: string) { + return this.pathTemplates.subnetPathTemplate.match(subnetName).subnet; + } + + /** + * Return a fully-qualified vmwareEngineNetwork resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} vmware_engine_network + * @returns {string} Resource name string. + */ + vmwareEngineNetworkPath(project:string,location:string,vmwareEngineNetwork:string) { + return this.pathTemplates.vmwareEngineNetworkPathTemplate.render({ + project: project, + location: location, + vmware_engine_network: vmwareEngineNetwork, + }); + } + + /** + * Parse the project from VmwareEngineNetwork resource. + * + * @param {string} vmwareEngineNetworkName + * A fully-qualified path representing VmwareEngineNetwork resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVmwareEngineNetworkName(vmwareEngineNetworkName: string) { + return this.pathTemplates.vmwareEngineNetworkPathTemplate.match(vmwareEngineNetworkName).project; + } + + /** + * Parse the location from VmwareEngineNetwork resource. + * + * @param {string} vmwareEngineNetworkName + * A fully-qualified path representing VmwareEngineNetwork resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVmwareEngineNetworkName(vmwareEngineNetworkName: string) { + return this.pathTemplates.vmwareEngineNetworkPathTemplate.match(vmwareEngineNetworkName).location; + } + + /** + * Parse the vmware_engine_network from VmwareEngineNetwork resource. + * + * @param {string} vmwareEngineNetworkName + * A fully-qualified path representing VmwareEngineNetwork resource. + * @returns {string} A string representing the vmware_engine_network. + */ + matchVmwareEngineNetworkFromVmwareEngineNetworkName(vmwareEngineNetworkName: string) { + return this.pathTemplates.vmwareEngineNetworkPathTemplate.match(vmwareEngineNetworkName).vmware_engine_network; + } + + /** + * 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.vmwareEngineStub && !this._terminated) { + return this.vmwareEngineStub.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-vmwareengine/v1/src/v1/vmware_engine_client_config.json b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client_config.json new file mode 100644 index 00000000000..6dbb458e7b2 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client_config.json @@ -0,0 +1,233 @@ +{ + "interfaces": { + "google.cloud.vmwareengine.v1.VmwareEngine": { + "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": { + "ListPrivateClouds": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetPrivateCloud": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreatePrivateCloud": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdatePrivateCloud": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeletePrivateCloud": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UndeletePrivateCloud": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListClusters": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetCluster": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateCluster": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateCluster": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteCluster": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSubnets": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetSubnet": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateSubnet": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListNodeTypes": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetNodeType": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ShowNsxCredentials": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ShowVcenterCredentials": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ResetNsxCredentials": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResetVcenterCredentials": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateHcxActivationKey": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListHcxActivationKeys": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetHcxActivationKey": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetNetworkPolicy": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListNetworkPolicies": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateNetworkPolicy": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNetworkPolicy": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNetworkPolicy": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateVmwareEngineNetwork": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateVmwareEngineNetwork": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteVmwareEngineNetwork": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetVmwareEngineNetwork": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListVmwareEngineNetworks": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreatePrivateConnection": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetPrivateConnection": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListPrivateConnections": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdatePrivateConnection": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeletePrivateConnection": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListPrivateConnectionPeeringRoutes": { + "timeout_millis": 120000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_proto_list.json b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_proto_list.json new file mode 100644 index 00000000000..72fd1db8924 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/vmwareengine/v1/vmwareengine.proto", + "../../protos/google/cloud/vmwareengine/v1/vmwareengine_resources.proto" +] diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..6615bf40c08 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/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 vmwareengine = require('@google-cloud/vmwareengine'); + +function main() { + const vmwareEngineClient = new vmwareengine.VmwareEngineClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..ef6613306b6 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/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 {VmwareEngineClient} from '@google-cloud/vmwareengine'; + +// check that the client class type name can be used +function doStuffWithVmwareEngineClient(client: VmwareEngineClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const vmwareEngineClient = new VmwareEngineClient(); + doStuffWithVmwareEngineClient(vmwareEngineClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/install.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/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-vmwareengine/v1/test/gapic_vmware_engine_v1.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/test/gapic_vmware_engine_v1.ts new file mode 100644 index 00000000000..c01c520841c --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/v1/test/gapic_vmware_engine_v1.ts @@ -0,0 +1,7762 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 vmwareengineModule 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.VmwareEngineClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = vmwareengineModule.v1.VmwareEngineClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = vmwareengineModule.v1.VmwareEngineClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = vmwareengineModule.v1.VmwareEngineClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new vmwareengineModule.v1.VmwareEngineClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.vmwareEngineStub, undefined); + await client.initialize(); + assert(client.vmwareEngineStub); + }); + + it('has close method for the initialized client', done => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.vmwareEngineStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.vmwareEngineStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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('getPrivateCloud', () => { + it('invokes getPrivateCloud without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud() + ); + client.innerApiCalls.getPrivateCloud = stubSimpleCall(expectedResponse); + const [response] = await client.getPrivateCloud(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateCloud without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud() + ); + client.innerApiCalls.getPrivateCloud = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPrivateCloud( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateCloud|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateCloud with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPrivateCloud = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPrivateCloud(request), expectedError); + const actualRequest = (client.innerApiCalls.getPrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateCloud with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getPrivateCloud(request), expectedError); + }); + }); + + describe('getCluster', () => { + it('invokes getCluster without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster() + ); + client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster() + ); + client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCluster( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICluster|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCluster(request), expectedError); + }); + }); + + describe('getSubnet', () => { + it('invokes getSubnet without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Subnet() + ); + client.innerApiCalls.getSubnet = stubSimpleCall(expectedResponse); + const [response] = await client.getSubnet(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSubnet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSubnet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSubnet without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Subnet() + ); + client.innerApiCalls.getSubnet = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSubnet( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ISubnet|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSubnet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSubnet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSubnet with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSubnet = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSubnet(request), expectedError); + const actualRequest = (client.innerApiCalls.getSubnet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSubnet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSubnet with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSubnet(request), expectedError); + }); + }); + + describe('getNodeType', () => { + it('invokes getNodeType without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType() + ); + client.innerApiCalls.getNodeType = stubSimpleCall(expectedResponse); + const [response] = await client.getNodeType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNodeType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodeType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodeType without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType() + ); + client.innerApiCalls.getNodeType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNodeType( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INodeType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNodeType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodeType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodeType with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNodeType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNodeType(request), expectedError); + const actualRequest = (client.innerApiCalls.getNodeType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodeType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodeType with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNodeType(request), expectedError); + }); + }); + + describe('showNsxCredentials', () => { + it('invokes showNsxCredentials without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Credentials() + ); + client.innerApiCalls.showNsxCredentials = stubSimpleCall(expectedResponse); + const [response] = await client.showNsxCredentials(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.showNsxCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.showNsxCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes showNsxCredentials without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Credentials() + ); + client.innerApiCalls.showNsxCredentials = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.showNsxCredentials( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICredentials|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.showNsxCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.showNsxCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes showNsxCredentials with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.showNsxCredentials = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.showNsxCredentials(request), expectedError); + const actualRequest = (client.innerApiCalls.showNsxCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.showNsxCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes showNsxCredentials with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.showNsxCredentials(request), expectedError); + }); + }); + + describe('showVcenterCredentials', () => { + it('invokes showVcenterCredentials without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Credentials() + ); + client.innerApiCalls.showVcenterCredentials = stubSimpleCall(expectedResponse); + const [response] = await client.showVcenterCredentials(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.showVcenterCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.showVcenterCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes showVcenterCredentials without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Credentials() + ); + client.innerApiCalls.showVcenterCredentials = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.showVcenterCredentials( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICredentials|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.showVcenterCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.showVcenterCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes showVcenterCredentials with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.showVcenterCredentials = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.showVcenterCredentials(request), expectedError); + const actualRequest = (client.innerApiCalls.showVcenterCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.showVcenterCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes showVcenterCredentials with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.showVcenterCredentials(request), expectedError); + }); + }); + + describe('getHcxActivationKey', () => { + it('invokes getHcxActivationKey without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey() + ); + client.innerApiCalls.getHcxActivationKey = stubSimpleCall(expectedResponse); + const [response] = await client.getHcxActivationKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getHcxActivationKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getHcxActivationKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getHcxActivationKey without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey() + ); + client.innerApiCalls.getHcxActivationKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getHcxActivationKey( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IHcxActivationKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getHcxActivationKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getHcxActivationKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getHcxActivationKey with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getHcxActivationKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getHcxActivationKey(request), expectedError); + const actualRequest = (client.innerApiCalls.getHcxActivationKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getHcxActivationKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getHcxActivationKey with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getHcxActivationKey(request), expectedError); + }); + }); + + describe('getNetworkPolicy', () => { + it('invokes getNetworkPolicy without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy() + ); + client.innerApiCalls.getNetworkPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getNetworkPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNetworkPolicy without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy() + ); + client.innerApiCalls.getNetworkPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNetworkPolicy( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INetworkPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNetworkPolicy with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNetworkPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNetworkPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.getNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNetworkPolicy with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNetworkPolicy(request), expectedError); + }); + }); + + describe('getVmwareEngineNetwork', () => { + it('invokes getVmwareEngineNetwork without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork() + ); + client.innerApiCalls.getVmwareEngineNetwork = stubSimpleCall(expectedResponse); + const [response] = await client.getVmwareEngineNetwork(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVmwareEngineNetwork without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork() + ); + client.innerApiCalls.getVmwareEngineNetwork = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVmwareEngineNetwork( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVmwareEngineNetwork with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVmwareEngineNetwork = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVmwareEngineNetwork(request), expectedError); + const actualRequest = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVmwareEngineNetwork with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVmwareEngineNetwork(request), expectedError); + }); + }); + + describe('getPrivateConnection', () => { + it('invokes getPrivateConnection without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection() + ); + client.innerApiCalls.getPrivateConnection = stubSimpleCall(expectedResponse); + const [response] = await client.getPrivateConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateConnection without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection() + ); + client.innerApiCalls.getPrivateConnection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPrivateConnection( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateConnection|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateConnection with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPrivateConnection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPrivateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateConnection with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getPrivateConnection(request), expectedError); + }); + }); + + describe('createPrivateCloud', () => { + it('invokes createPrivateCloud without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPrivateCloud = stubLongRunningCall(expectedResponse); + const [operation] = await client.createPrivateCloud(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateCloud without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPrivateCloud = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createPrivateCloud( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateCloud with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateCloud = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createPrivateCloud(request), expectedError); + const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateCloud with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createPrivateCloud(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreatePrivateCloudProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreatePrivateCloudProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreatePrivateCloudProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreatePrivateCloudProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updatePrivateCloud', () => { + it('invokes updatePrivateCloud without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() + ); + request.privateCloud ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); + request.privateCloud.name = defaultValue1; + const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updatePrivateCloud = stubLongRunningCall(expectedResponse); + const [operation] = await client.updatePrivateCloud(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePrivateCloud without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() + ); + request.privateCloud ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); + request.privateCloud.name = defaultValue1; + const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updatePrivateCloud = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updatePrivateCloud( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePrivateCloud with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() + ); + request.privateCloud ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); + request.privateCloud.name = defaultValue1; + const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePrivateCloud = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updatePrivateCloud(request), expectedError); + const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePrivateCloud with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() + ); + request.privateCloud ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); + request.privateCloud.name = defaultValue1; + const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updatePrivateCloud(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdatePrivateCloudProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdatePrivateCloudProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdatePrivateCloudProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdatePrivateCloudProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deletePrivateCloud', () => { + it('invokes deletePrivateCloud without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePrivateCloud = stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePrivateCloud(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateCloud without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePrivateCloud = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePrivateCloud( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateCloud with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateCloud = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deletePrivateCloud(request), expectedError); + const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateCloud with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deletePrivateCloud(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeletePrivateCloudProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeletePrivateCloudProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeletePrivateCloudProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeletePrivateCloudProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('undeletePrivateCloud', () => { + it('invokes undeletePrivateCloud without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.undeletePrivateCloud = stubLongRunningCall(expectedResponse); + const [operation] = await client.undeletePrivateCloud(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeletePrivateCloud without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.undeletePrivateCloud = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeletePrivateCloud( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeletePrivateCloud with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeletePrivateCloud = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.undeletePrivateCloud(request), expectedError); + const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeletePrivateCloud with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeletePrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.undeletePrivateCloud(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUndeletePrivateCloudProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUndeletePrivateCloudProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUndeletePrivateCloudProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUndeletePrivateCloudProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createCluster', () => { + it('invokes createCluster without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.createCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateClusterProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateClusterProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateCluster', () => { + it('invokes updateCluster without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() + ); + request.cluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() + ); + request.cluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() + ); + request.cluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() + ); + request.cluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateClusterProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateClusterProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteCluster', () => { + it('invokes deleteCluster without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteClusterProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteClusterProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateSubnet', () => { + it('invokes updateSubnet without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() + ); + request.subnet ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); + request.subnet.name = defaultValue1; + const expectedHeaderRequestParams = `subnet.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSubnet = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSubnet(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSubnet without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() + ); + request.subnet ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); + request.subnet.name = defaultValue1; + const expectedHeaderRequestParams = `subnet.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSubnet = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSubnet( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSubnet with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() + ); + request.subnet ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); + request.subnet.name = defaultValue1; + const expectedHeaderRequestParams = `subnet.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSubnet = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateSubnet(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSubnet with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() + ); + request.subnet ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); + request.subnet.name = defaultValue1; + const expectedHeaderRequestParams = `subnet.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSubnet = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateSubnet(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateSubnetProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateSubnetProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateSubnetProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateSubnetProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('resetNsxCredentials', () => { + it('invokes resetNsxCredentials without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.resetNsxCredentials = stubLongRunningCall(expectedResponse); + const [operation] = await client.resetNsxCredentials(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetNsxCredentials without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.resetNsxCredentials = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetNsxCredentials( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetNsxCredentials with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetNsxCredentials = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.resetNsxCredentials(request), expectedError); + const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetNsxCredentials with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetNsxCredentials = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.resetNsxCredentials(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkResetNsxCredentialsProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkResetNsxCredentialsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkResetNsxCredentialsProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkResetNsxCredentialsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('resetVcenterCredentials', () => { + it('invokes resetVcenterCredentials without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.resetVcenterCredentials = stubLongRunningCall(expectedResponse); + const [operation] = await client.resetVcenterCredentials(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetVcenterCredentials without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.resetVcenterCredentials = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetVcenterCredentials( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetVcenterCredentials with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetVcenterCredentials = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.resetVcenterCredentials(request), expectedError); + const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetVcenterCredentials with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetVcenterCredentials = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.resetVcenterCredentials(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkResetVcenterCredentialsProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkResetVcenterCredentialsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkResetVcenterCredentialsProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkResetVcenterCredentialsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createHcxActivationKey', () => { + it('invokes createHcxActivationKey without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createHcxActivationKey = stubLongRunningCall(expectedResponse); + const [operation] = await client.createHcxActivationKey(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createHcxActivationKey without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createHcxActivationKey = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createHcxActivationKey( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createHcxActivationKey with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createHcxActivationKey = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createHcxActivationKey(request), expectedError); + const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createHcxActivationKey with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createHcxActivationKey = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createHcxActivationKey(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateHcxActivationKeyProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateHcxActivationKeyProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateHcxActivationKeyProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateHcxActivationKeyProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createNetworkPolicy', () => { + it('invokes createNetworkPolicy without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNetworkPolicy = stubLongRunningCall(expectedResponse); + const [operation] = await client.createNetworkPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNetworkPolicy without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNetworkPolicy = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNetworkPolicy( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNetworkPolicy with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNetworkPolicy = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createNetworkPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNetworkPolicy with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNetworkPolicy = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createNetworkPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateNetworkPolicyProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateNetworkPolicyProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateNetworkPolicyProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateNetworkPolicyProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateNetworkPolicy', () => { + it('invokes updateNetworkPolicy without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() + ); + request.networkPolicy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); + request.networkPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `network_policy.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateNetworkPolicy = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateNetworkPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNetworkPolicy without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() + ); + request.networkPolicy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); + request.networkPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `network_policy.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateNetworkPolicy = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNetworkPolicy( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNetworkPolicy with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() + ); + request.networkPolicy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); + request.networkPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `network_policy.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNetworkPolicy = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateNetworkPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNetworkPolicy with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() + ); + request.networkPolicy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); + request.networkPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `network_policy.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNetworkPolicy = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateNetworkPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateNetworkPolicyProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateNetworkPolicyProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateNetworkPolicyProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateNetworkPolicyProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteNetworkPolicy', () => { + it('invokes deleteNetworkPolicy without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteNetworkPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNetworkPolicy without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNetworkPolicy( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNetworkPolicy with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteNetworkPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNetworkPolicy with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteNetworkPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteNetworkPolicyProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteNetworkPolicyProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteNetworkPolicyProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteNetworkPolicyProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createVmwareEngineNetwork', () => { + it('invokes createVmwareEngineNetwork without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCall(expectedResponse); + const [operation] = await client.createVmwareEngineNetwork(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVmwareEngineNetwork without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createVmwareEngineNetwork( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVmwareEngineNetwork with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createVmwareEngineNetwork(request), expectedError); + const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVmwareEngineNetwork with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createVmwareEngineNetwork(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateVmwareEngineNetworkProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateVmwareEngineNetworkProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateVmwareEngineNetworkProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateVmwareEngineNetworkProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateVmwareEngineNetwork', () => { + it('invokes updateVmwareEngineNetwork without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() + ); + request.vmwareEngineNetwork ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); + request.vmwareEngineNetwork.name = defaultValue1; + const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateVmwareEngineNetwork(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVmwareEngineNetwork without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() + ); + request.vmwareEngineNetwork ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); + request.vmwareEngineNetwork.name = defaultValue1; + const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateVmwareEngineNetwork( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVmwareEngineNetwork with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() + ); + request.vmwareEngineNetwork ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); + request.vmwareEngineNetwork.name = defaultValue1; + const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateVmwareEngineNetwork(request), expectedError); + const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVmwareEngineNetwork with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() + ); + request.vmwareEngineNetwork ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); + request.vmwareEngineNetwork.name = defaultValue1; + const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateVmwareEngineNetwork(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateVmwareEngineNetworkProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateVmwareEngineNetworkProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateVmwareEngineNetworkProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateVmwareEngineNetworkProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteVmwareEngineNetwork', () => { + it('invokes deleteVmwareEngineNetwork without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteVmwareEngineNetwork(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVmwareEngineNetwork without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteVmwareEngineNetwork( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVmwareEngineNetwork with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteVmwareEngineNetwork(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVmwareEngineNetwork with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteVmwareEngineNetwork(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteVmwareEngineNetworkProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteVmwareEngineNetworkProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteVmwareEngineNetworkProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteVmwareEngineNetworkProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createPrivateConnection', () => { + it('invokes createPrivateConnection without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPrivateConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.createPrivateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateConnection without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPrivateConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createPrivateConnection( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateConnection with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createPrivateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateConnection with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createPrivateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreatePrivateConnectionProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreatePrivateConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreatePrivateConnectionProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreatePrivateConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updatePrivateConnection', () => { + it('invokes updatePrivateConnection without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() + ); + request.privateConnection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); + request.privateConnection.name = defaultValue1; + const expectedHeaderRequestParams = `private_connection.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updatePrivateConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.updatePrivateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePrivateConnection without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() + ); + request.privateConnection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); + request.privateConnection.name = defaultValue1; + const expectedHeaderRequestParams = `private_connection.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updatePrivateConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updatePrivateConnection( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePrivateConnection with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() + ); + request.privateConnection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); + request.privateConnection.name = defaultValue1; + const expectedHeaderRequestParams = `private_connection.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePrivateConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updatePrivateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePrivateConnection with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() + ); + request.privateConnection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); + request.privateConnection.name = defaultValue1; + const expectedHeaderRequestParams = `private_connection.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updatePrivateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdatePrivateConnectionProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdatePrivateConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdatePrivateConnectionProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdatePrivateConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deletePrivateConnection', () => { + it('invokes deletePrivateConnection without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePrivateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateConnection without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePrivateConnection( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateConnection with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deletePrivateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateConnection with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deletePrivateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeletePrivateConnectionProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeletePrivateConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeletePrivateConnectionProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeletePrivateConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listPrivateClouds', () => { + it('invokes listPrivateClouds without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + ]; + client.innerApiCalls.listPrivateClouds = stubSimpleCall(expectedResponse); + const [response] = await client.listPrivateClouds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPrivateClouds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateClouds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateClouds without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + ]; + client.innerApiCalls.listPrivateClouds = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPrivateClouds( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateCloud[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPrivateClouds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateClouds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateClouds with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPrivateClouds = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPrivateClouds(request), expectedError); + const actualRequest = (client.innerApiCalls.listPrivateClouds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateClouds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateCloudsStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + ]; + client.descriptors.page.listPrivateClouds.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPrivateCloudsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PrivateCloud[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateCloud) => { + 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.listPrivateClouds.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPrivateClouds, request)); + assert( + (client.descriptors.page.listPrivateClouds.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listPrivateCloudsStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateClouds.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPrivateCloudsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PrivateCloud[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateCloud) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listPrivateClouds.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPrivateClouds, request)); + assert( + (client.descriptors.page.listPrivateClouds.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPrivateClouds without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), + ]; + client.descriptors.page.listPrivateClouds.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IPrivateCloud[] = []; + const iterable = client.listPrivateCloudsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPrivateClouds with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateClouds.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPrivateCloudsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IPrivateCloud[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listClusters', () => { + it('invokes listClusters without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + ]; + client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listClusters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClusters without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + ]; + client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listClusters( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICluster[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClusters with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listClusters(request), expectedError); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClustersStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + ]; + client.descriptors.page.listClusters.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.Cluster[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Cluster) => { + 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.listClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listClustersStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClusters.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.Cluster[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Cluster) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listClusters without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), + ]; + client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.ICluster[] = []; + const iterable = client.listClustersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listClusters with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listClustersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.ICluster[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSubnets', () => { + it('invokes listSubnets without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + ]; + client.innerApiCalls.listSubnets = stubSimpleCall(expectedResponse); + const [response] = await client.listSubnets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSubnets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSubnets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSubnets without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + ]; + client.innerApiCalls.listSubnets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSubnets( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ISubnet[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSubnets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSubnets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSubnets with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSubnets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSubnets(request), expectedError); + const actualRequest = (client.innerApiCalls.listSubnets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSubnets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSubnetsStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + ]; + client.descriptors.page.listSubnets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSubnetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.Subnet[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Subnet) => { + 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.listSubnets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSubnets, request)); + assert( + (client.descriptors.page.listSubnets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSubnetsStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSubnets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSubnetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.Subnet[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Subnet) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSubnets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSubnets, request)); + assert( + (client.descriptors.page.listSubnets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSubnets without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + ]; + client.descriptors.page.listSubnets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.ISubnet[] = []; + const iterable = client.listSubnetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSubnets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSubnets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSubnets with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSubnets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSubnetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.ISubnet[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSubnets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSubnets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listNodeTypes', () => { + it('invokes listNodeTypes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + ]; + client.innerApiCalls.listNodeTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listNodeTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodeTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodeTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodeTypes without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + ]; + client.innerApiCalls.listNodeTypes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodeTypes( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INodeType[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodeTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodeTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodeTypes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNodeTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNodeTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.listNodeTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodeTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodeTypesStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + ]; + client.descriptors.page.listNodeTypes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNodeTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.NodeType[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NodeType) => { + 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.listNodeTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNodeTypes, request)); + assert( + (client.descriptors.page.listNodeTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNodeTypesStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodeTypes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNodeTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.NodeType[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NodeType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNodeTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNodeTypes, request)); + assert( + (client.descriptors.page.listNodeTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodeTypes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), + ]; + client.descriptors.page.listNodeTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.INodeType[] = []; + const iterable = client.listNodeTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodeTypes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodeTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNodeTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.INodeType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listHcxActivationKeys', () => { + it('invokes listHcxActivationKeys without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + ]; + client.innerApiCalls.listHcxActivationKeys = stubSimpleCall(expectedResponse); + const [response] = await client.listHcxActivationKeys(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listHcxActivationKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listHcxActivationKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listHcxActivationKeys without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + ]; + client.innerApiCalls.listHcxActivationKeys = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listHcxActivationKeys( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IHcxActivationKey[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listHcxActivationKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listHcxActivationKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listHcxActivationKeys with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listHcxActivationKeys = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listHcxActivationKeys(request), expectedError); + const actualRequest = (client.innerApiCalls.listHcxActivationKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listHcxActivationKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listHcxActivationKeysStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + ]; + client.descriptors.page.listHcxActivationKeys.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listHcxActivationKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.HcxActivationKey[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.HcxActivationKey) => { + 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.listHcxActivationKeys.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHcxActivationKeys, request)); + assert( + (client.descriptors.page.listHcxActivationKeys.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listHcxActivationKeysStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listHcxActivationKeys.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listHcxActivationKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.HcxActivationKey[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.HcxActivationKey) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listHcxActivationKeys.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHcxActivationKeys, request)); + assert( + (client.descriptors.page.listHcxActivationKeys.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listHcxActivationKeys without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), + ]; + client.descriptors.page.listHcxActivationKeys.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IHcxActivationKey[] = []; + const iterable = client.listHcxActivationKeysAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listHcxActivationKeys with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listHcxActivationKeys.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listHcxActivationKeysAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IHcxActivationKey[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listNetworkPolicies', () => { + it('invokes listNetworkPolicies without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + ]; + client.innerApiCalls.listNetworkPolicies = stubSimpleCall(expectedResponse); + const [response] = await client.listNetworkPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNetworkPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNetworkPolicies without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + ]; + client.innerApiCalls.listNetworkPolicies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNetworkPolicies( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INetworkPolicy[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNetworkPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNetworkPolicies with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNetworkPolicies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNetworkPolicies(request), expectedError); + const actualRequest = (client.innerApiCalls.listNetworkPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNetworkPoliciesStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + ]; + client.descriptors.page.listNetworkPolicies.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNetworkPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.NetworkPolicy[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NetworkPolicy) => { + 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.listNetworkPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNetworkPolicies, request)); + assert( + (client.descriptors.page.listNetworkPolicies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNetworkPoliciesStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNetworkPolicies.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNetworkPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.NetworkPolicy[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NetworkPolicy) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNetworkPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNetworkPolicies, request)); + assert( + (client.descriptors.page.listNetworkPolicies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNetworkPolicies without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), + ]; + client.descriptors.page.listNetworkPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.INetworkPolicy[] = []; + const iterable = client.listNetworkPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNetworkPolicies with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNetworkPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNetworkPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.INetworkPolicy[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listVmwareEngineNetworks', () => { + it('invokes listVmwareEngineNetworks without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + ]; + client.innerApiCalls.listVmwareEngineNetworks = stubSimpleCall(expectedResponse); + const [response] = await client.listVmwareEngineNetworks(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVmwareEngineNetworks without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + ]; + client.innerApiCalls.listVmwareEngineNetworks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listVmwareEngineNetworks( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVmwareEngineNetworks with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listVmwareEngineNetworks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listVmwareEngineNetworks(request), expectedError); + const actualRequest = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVmwareEngineNetworksStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + ]; + client.descriptors.page.listVmwareEngineNetworks.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listVmwareEngineNetworksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork) => { + 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.listVmwareEngineNetworks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVmwareEngineNetworks, request)); + assert( + (client.descriptors.page.listVmwareEngineNetworks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listVmwareEngineNetworksStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVmwareEngineNetworks.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listVmwareEngineNetworksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listVmwareEngineNetworks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVmwareEngineNetworks, request)); + assert( + (client.descriptors.page.listVmwareEngineNetworks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVmwareEngineNetworks without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), + ]; + client.descriptors.page.listVmwareEngineNetworks.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[] = []; + const iterable = client.listVmwareEngineNetworksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVmwareEngineNetworks with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVmwareEngineNetworks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listVmwareEngineNetworksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listPrivateConnections', () => { + it('invokes listPrivateConnections without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + ]; + client.innerApiCalls.listPrivateConnections = stubSimpleCall(expectedResponse); + const [response] = await client.listPrivateConnections(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnections without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + ]; + client.innerApiCalls.listPrivateConnections = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPrivateConnections( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateConnection[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnections with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPrivateConnections = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPrivateConnections(request), expectedError); + const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnectionsStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + ]; + client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPrivateConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PrivateConnection[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateConnection) => { + 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.listPrivateConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); + assert( + (client.descriptors.page.listPrivateConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listPrivateConnectionsStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPrivateConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PrivateConnection[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateConnection) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listPrivateConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); + assert( + (client.descriptors.page.listPrivateConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPrivateConnections without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), + ]; + client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IPrivateConnection[] = []; + const iterable = client.listPrivateConnectionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPrivateConnections with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPrivateConnectionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IPrivateConnection[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listPrivateConnectionPeeringRoutes', () => { + it('invokes listPrivateConnectionPeeringRoutes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + ]; + client.innerApiCalls.listPrivateConnectionPeeringRoutes = stubSimpleCall(expectedResponse); + const [response] = await client.listPrivateConnectionPeeringRoutes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnectionPeeringRoutes without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + ]; + client.innerApiCalls.listPrivateConnectionPeeringRoutes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPrivateConnectionPeeringRoutes( + request, + (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPeeringRoute[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnectionPeeringRoutes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPrivateConnectionPeeringRoutes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPrivateConnectionPeeringRoutes(request), expectedError); + const actualRequest = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnectionPeeringRoutesStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + ]; + client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPrivateConnectionPeeringRoutesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { + 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.listPrivateConnectionPeeringRoutes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPrivateConnectionPeeringRoutes, request)); + assert( + (client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listPrivateConnectionPeeringRoutesStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPrivateConnectionPeeringRoutesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = []; + stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPrivateConnectionPeeringRoutes, request)); + assert( + (client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPrivateConnectionPeeringRoutes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), + ]; + client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = []; + const iterable = client.listPrivateConnectionPeeringRoutesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPrivateConnectionPeeringRoutes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPrivateConnectionPeeringRoutesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPrivateConnectionPeeringRoutes.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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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 vmwareengineModule.v1.VmwareEngineClient({ + 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('cluster', () => { + const fakePath = "/rendered/path/cluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + private_cloud: "privateCloudValue", + cluster: "clusterValue", + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.clusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath("projectValue", "locationValue", "privateCloudValue", "clusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromClusterName', () => { + const result = client.matchLocationFromClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPrivateCloudFromClusterName', () => { + const result = client.matchPrivateCloudFromClusterName(fakePath); + assert.strictEqual(result, "privateCloudValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('hcxActivationKey', () => { + const fakePath = "/rendered/path/hcxActivationKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + private_cloud: "privateCloudValue", + hcx_activation_key: "hcxActivationKeyValue", + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hcxActivationKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.hcxActivationKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('hcxActivationKeyPath', () => { + const result = client.hcxActivationKeyPath("projectValue", "locationValue", "privateCloudValue", "hcxActivationKeyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.hcxActivationKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromHcxActivationKeyName', () => { + const result = client.matchProjectFromHcxActivationKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromHcxActivationKeyName', () => { + const result = client.matchLocationFromHcxActivationKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPrivateCloudFromHcxActivationKeyName', () => { + const result = client.matchPrivateCloudFromHcxActivationKeyName(fakePath); + assert.strictEqual(result, "privateCloudValue"); + assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchHcxActivationKeyFromHcxActivationKeyName', () => { + const result = client.matchHcxActivationKeyFromHcxActivationKeyName(fakePath); + assert.strictEqual(result, "hcxActivationKeyValue"); + assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + 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('networkPolicy', () => { + const fakePath = "/rendered/path/networkPolicy"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + network_policy: "networkPolicyValue", + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.networkPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.networkPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('networkPolicyPath', () => { + const result = client.networkPolicyPath("projectValue", "locationValue", "networkPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.networkPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNetworkPolicyName', () => { + const result = client.matchProjectFromNetworkPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromNetworkPolicyName', () => { + const result = client.matchLocationFromNetworkPolicyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNetworkPolicyFromNetworkPolicyName', () => { + const result = client.matchNetworkPolicyFromNetworkPolicyName(fakePath); + assert.strictEqual(result, "networkPolicyValue"); + assert((client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('nodeType', () => { + const fakePath = "/rendered/path/nodeType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + node_type: "nodeTypeValue", + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodeTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.nodeTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('nodeTypePath', () => { + const result = client.nodeTypePath("projectValue", "locationValue", "nodeTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.nodeTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNodeTypeName', () => { + const result = client.matchProjectFromNodeTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.nodeTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromNodeTypeName', () => { + const result = client.matchLocationFromNodeTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.nodeTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNodeTypeFromNodeTypeName', () => { + const result = client.matchNodeTypeFromNodeTypeName(fakePath); + assert.strictEqual(result, "nodeTypeValue"); + assert((client.pathTemplates.nodeTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('privateCloud', () => { + const fakePath = "/rendered/path/privateCloud"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + private_cloud: "privateCloudValue", + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.privateCloudPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.privateCloudPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('privateCloudPath', () => { + const result = client.privateCloudPath("projectValue", "locationValue", "privateCloudValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.privateCloudPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPrivateCloudName', () => { + const result = client.matchProjectFromPrivateCloudName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.privateCloudPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPrivateCloudName', () => { + const result = client.matchLocationFromPrivateCloudName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.privateCloudPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPrivateCloudFromPrivateCloudName', () => { + const result = client.matchPrivateCloudFromPrivateCloudName(fakePath); + assert.strictEqual(result, "privateCloudValue"); + assert((client.pathTemplates.privateCloudPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('privateConnection', () => { + const fakePath = "/rendered/path/privateConnection"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + private_connection: "privateConnectionValue", + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.privateConnectionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.privateConnectionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('privateConnectionPath', () => { + const result = client.privateConnectionPath("projectValue", "locationValue", "privateConnectionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.privateConnectionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPrivateConnectionName', () => { + const result = client.matchProjectFromPrivateConnectionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPrivateConnectionName', () => { + const result = client.matchLocationFromPrivateConnectionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPrivateConnectionFromPrivateConnectionName', () => { + const result = client.matchPrivateConnectionFromPrivateConnectionName(fakePath); + assert.strictEqual(result, "privateConnectionValue"); + assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + 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('subnet', () => { + const fakePath = "/rendered/path/subnet"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + private_cloud: "privateCloudValue", + subnet: "subnetValue", + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.subnetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.subnetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('subnetPath', () => { + const result = client.subnetPath("projectValue", "locationValue", "privateCloudValue", "subnetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.subnetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSubnetName', () => { + const result = client.matchProjectFromSubnetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromSubnetName', () => { + const result = client.matchLocationFromSubnetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPrivateCloudFromSubnetName', () => { + const result = client.matchPrivateCloudFromSubnetName(fakePath); + assert.strictEqual(result, "privateCloudValue"); + assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSubnetFromSubnetName', () => { + const result = client.matchSubnetFromSubnetName(fakePath); + assert.strictEqual(result, "subnetValue"); + assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('vmwareEngineNetwork', () => { + const fakePath = "/rendered/path/vmwareEngineNetwork"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + vmware_engine_network: "vmwareEngineNetworkValue", + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.vmwareEngineNetworkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.vmwareEngineNetworkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('vmwareEngineNetworkPath', () => { + const result = client.vmwareEngineNetworkPath("projectValue", "locationValue", "vmwareEngineNetworkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromVmwareEngineNetworkName', () => { + const result = client.matchProjectFromVmwareEngineNetworkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromVmwareEngineNetworkName', () => { + const result = client.matchLocationFromVmwareEngineNetworkName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVmwareEngineNetworkFromVmwareEngineNetworkName', () => { + const result = client.matchVmwareEngineNetworkFromVmwareEngineNetworkName(fakePath); + assert.strictEqual(result, "vmwareEngineNetworkValue"); + assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/tsconfig.json b/owl-bot-staging/google-cloud-vmwareengine/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/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-vmwareengine/v1/webpack.config.js b/owl-bot-staging/google-cloud-vmwareengine/v1/webpack.config.js new file mode 100644 index 00000000000..d5271c69e90 --- /dev/null +++ b/owl-bot-staging/google-cloud-vmwareengine/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: 'VmwareEngine', + filename: './vmware-engine.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-vpcaccess/v1/.eslintignore b/owl-bot-staging/google-cloud-vpcaccess/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/.eslintrc.json b/owl-bot-staging/google-cloud-vpcaccess/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/.gitignore b/owl-bot-staging/google-cloud-vpcaccess/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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-vpcaccess/v1/.jsdoc.js b/owl-bot-staging/google-cloud-vpcaccess/v1/.jsdoc.js new file mode 100644 index 00000000000..4f1be78d773 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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/vpc-access', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/.mocharc.js b/owl-bot-staging/google-cloud-vpcaccess/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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-vpcaccess/v1/.prettierrc.js b/owl-bot-staging/google-cloud-vpcaccess/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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-vpcaccess/v1/README.md b/owl-bot-staging/google-cloud-vpcaccess/v1/README.md new file mode 100644 index 00000000000..d070a08b5c9 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/README.md @@ -0,0 +1 @@ +Vpcaccess: Nodejs Client diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/package.json b/owl-bot-staging/google-cloud-vpcaccess/v1/package.json new file mode 100644 index 00000000000..050c4474863 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/vpc-access", + "version": "0.1.0", + "description": "Vpcaccess client for Node.js", + "repository": "googleapis/nodejs-vpcaccess", + "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 vpcaccess", + "vpcaccess", + "vpc access 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-vpcaccess/v1/protos/google/cloud/vpcaccess/v1/vpc_access.proto b/owl-bot-staging/google-cloud-vpcaccess/v1/protos/google/cloud/vpcaccess/v1/vpc_access.proto new file mode 100644 index 00000000000..21bf77757e6 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/protos/google/cloud/vpcaccess/v1/vpc_access.proto @@ -0,0 +1,248 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.vpcaccess.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 csharp_namespace = "Google.Cloud.VpcAccess.V1"; +option go_package = "cloud.google.com/go/vpcaccess/apiv1/vpcaccesspb;vpcaccesspb"; +option java_multiple_files = true; +option java_outer_classname = "VpcAccessProto"; +option java_package = "com.google.cloud.vpcaccess.v1"; +option php_namespace = "Google\\Cloud\\VpcAccess\\V1"; +option ruby_package = "Google::Cloud::VpcAccess::V1"; + +// Serverless VPC Access API allows users to create and manage connectors for +// App Engine, Cloud Functions and Cloud Run to have internal connections to +// Virtual Private Cloud networks. +service VpcAccessService { + option (google.api.default_host) = "vpcaccess.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Serverless VPC Access connector, returns an operation. + rpc CreateConnector(CreateConnectorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/connectors" + body: "connector" + }; + option (google.api.method_signature) = "parent,connector_id,connector"; + option (google.longrunning.operation_info) = { + response_type: "Connector" + metadata_type: "OperationMetadata" + }; + } + + // Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource + // does not exist. + rpc GetConnector(GetConnectorRequest) returns (Connector) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/connectors/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists Serverless VPC Access connectors. + rpc ListConnectors(ListConnectorsRequest) returns (ListConnectorsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/connectors" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the + // resource does not exist. + rpc DeleteConnector(DeleteConnectorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/connectors/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// Definition of a Serverless VPC Access connector. +message Connector { + option (google.api.resource) = { + type: "vpcaccess.googleapis.com/Connector" + pattern: "projects/{project}/locations/{location}/connectors/{connector}" + }; + + // State of a connector. + enum State { + // Invalid state. + STATE_UNSPECIFIED = 0; + + // Connector is deployed and ready to receive traffic. + READY = 1; + + // An Insert operation is in progress. Transient condition. + CREATING = 2; + + // A Delete operation is in progress. Transient condition. + DELETING = 3; + + // Connector is in a bad state, manual deletion recommended. + ERROR = 4; + + // The connector is being updated. + UPDATING = 5; + } + + // The subnet in which to house the connector + message Subnet { + // Subnet name (relative, not fully qualified). + // E.g. if the full subnet selfLink is + // https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetName} + // the correct input for this field would be {subnetName} + string name = 1; + + // Project in which the subnet exists. + // If not set, this project is assumed to be the project for which + // the connector create request was issued. + string project_id = 2; + } + + // The resource name in the format `projects/*/locations/*/connectors/*`. + string name = 1; + + // Name of a VPC network. + string network = 2; + + // The range of internal addresses that follows RFC 4632 notation. + // Example: `10.132.0.0/28`. + string ip_cidr_range = 3; + + // Output only. State of the VPC access connector. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Minimum throughput of the connector in Mbps. Default and min is 200. + int32 min_throughput = 5; + + // Maximum throughput of the connector in Mbps. Default is 300, max is 1000. + int32 max_throughput = 6; + + // Output only. List of projects using the connector. + repeated string connected_projects = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The subnet in which to house the VPC Access Connector. + Subnet subnet = 8; + + // Machine type of VM Instance underlying connector. Default is e2-micro + string machine_type = 10; + + // Minimum value of instances in autoscaling group underlying the connector. + int32 min_instances = 11; + + // Maximum value of instances in autoscaling group underlying the connector. + int32 max_instances = 12; +} + +// Request for creating a Serverless VPC Access connector. +message CreateConnectorRequest { + // Required. The project and location in which the configuration 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. The ID to use for this connector. + string connector_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Resource to create. + Connector connector = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for getting a Serverless VPC Access connector. +message GetConnectorRequest { + // Required. Name of a Serverless VPC Access connector to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vpcaccess.googleapis.com/Connector" + } + ]; +} + +// Request for listing Serverless VPC Access connectors in a location. +message ListConnectorsRequest { + // Required. The project and location from which the routes should be listed. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Maximum number of functions to return per call. + int32 page_size = 2; + + // Continuation token. + string page_token = 3; +} + +// Response for listing Serverless VPC Access connectors. +message ListConnectorsResponse { + // List of Serverless VPC Access connectors. + repeated Connector connectors = 1; + + // Continuation token. + string next_page_token = 2; +} + +// Request for deleting a Serverless VPC Access connector. +message DeleteConnectorRequest { + // Required. Name of a Serverless VPC Access connector to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "vpcaccess.googleapis.com/Connector" + } + ]; +} + +// Metadata for google.longrunning.Operation. +message OperationMetadata { + // Output only. Method that initiated the operation e.g. + // google.cloud.vpcaccess.v1.Connectors.CreateConnector. + string method = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when the operation was created. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when the operation completed. + google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the resource that this operation is acting on e.g. + // projects/my-project/locations/us-central1/connectors/v1. + string target = 5 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "vpcaccess.googleapis.com/Connector" + } + ]; +} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json new file mode 100644 index 00000000000..577467cc1b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json @@ -0,0 +1,191 @@ +{ + "clientLibrary": { + "name": "nodejs-vpcaccess", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.vpcaccess.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "vpcaccess_v1_generated_VpcAccessService_CreateConnector_async", + "title": "VpcAccessService createConnector Sample", + "origin": "API_DEFINITION", + "description": " Creates a Serverless VPC Access connector, returns an operation.", + "canonical": true, + "file": "vpc_access_service.create_connector.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConnector", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.CreateConnector", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "connector_id", + "type": "TYPE_STRING" + }, + { + "name": "connector", + "type": ".google.cloud.vpcaccess.v1.Connector" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VpcAccessServiceClient", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessServiceClient" + }, + "method": { + "shortName": "CreateConnector", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.CreateConnector", + "service": { + "shortName": "VpcAccessService", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService" + } + } + } + }, + { + "regionTag": "vpcaccess_v1_generated_VpcAccessService_GetConnector_async", + "title": "VpcAccessService getConnector Sample", + "origin": "API_DEFINITION", + "description": " Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.", + "canonical": true, + "file": "vpc_access_service.get_connector.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConnector", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.GetConnector", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vpcaccess.v1.Connector", + "client": { + "shortName": "VpcAccessServiceClient", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessServiceClient" + }, + "method": { + "shortName": "GetConnector", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.GetConnector", + "service": { + "shortName": "VpcAccessService", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService" + } + } + } + }, + { + "regionTag": "vpcaccess_v1_generated_VpcAccessService_ListConnectors_async", + "title": "VpcAccessService listConnectors Sample", + "origin": "API_DEFINITION", + "description": " Lists Serverless VPC Access connectors.", + "canonical": true, + "file": "vpc_access_service.list_connectors.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConnectors", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.ListConnectors", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.vpcaccess.v1.ListConnectorsResponse", + "client": { + "shortName": "VpcAccessServiceClient", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessServiceClient" + }, + "method": { + "shortName": "ListConnectors", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.ListConnectors", + "service": { + "shortName": "VpcAccessService", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService" + } + } + } + }, + { + "regionTag": "vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async", + "title": "VpcAccessService deleteConnector Sample", + "origin": "API_DEFINITION", + "description": " Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.", + "canonical": true, + "file": "vpc_access_service.delete_connector.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConnector", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.DeleteConnector", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VpcAccessServiceClient", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessServiceClient" + }, + "method": { + "shortName": "DeleteConnector", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.DeleteConnector", + "service": { + "shortName": "VpcAccessService", + "fullName": "google.cloud.vpcaccess.v1.VpcAccessService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.create_connector.js b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.create_connector.js new file mode 100644 index 00000000000..8d029f6dafd --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.create_connector.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, connectorId, connector) { + // [START vpcaccess_v1_generated_VpcAccessService_CreateConnector_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 configuration should be created, + * specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Required. The ID to use for this connector. + */ + // const connectorId = 'abc123' + /** + * Required. Resource to create. + */ + // const connector = {} + + // Imports the Vpcaccess library + const {VpcAccessServiceClient} = require('@google-cloud/vpc-access').v1; + + // Instantiates a client + const vpcaccessClient = new VpcAccessServiceClient(); + + async function callCreateConnector() { + // Construct request + const request = { + parent, + connectorId, + connector, + }; + + // Run request + const [operation] = await vpcaccessClient.createConnector(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConnector(); + // [END vpcaccess_v1_generated_VpcAccessService_CreateConnector_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.delete_connector.js b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.delete_connector.js new file mode 100644 index 00000000000..2c45649a79c --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.delete_connector.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 vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 a Serverless VPC Access connector to delete. + */ + // const name = 'abc123' + + // Imports the Vpcaccess library + const {VpcAccessServiceClient} = require('@google-cloud/vpc-access').v1; + + // Instantiates a client + const vpcaccessClient = new VpcAccessServiceClient(); + + async function callDeleteConnector() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await vpcaccessClient.deleteConnector(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteConnector(); + // [END vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.get_connector.js b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.get_connector.js new file mode 100644 index 00000000000..95900bed613 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.get_connector.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 vpcaccess_v1_generated_VpcAccessService_GetConnector_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 a Serverless VPC Access connector to get. + */ + // const name = 'abc123' + + // Imports the Vpcaccess library + const {VpcAccessServiceClient} = require('@google-cloud/vpc-access').v1; + + // Instantiates a client + const vpcaccessClient = new VpcAccessServiceClient(); + + async function callGetConnector() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await vpcaccessClient.getConnector(request); + console.log(response); + } + + callGetConnector(); + // [END vpcaccess_v1_generated_VpcAccessService_GetConnector_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.list_connectors.js b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.list_connectors.js new file mode 100644 index 00000000000..f72f81d331a --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.list_connectors.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(parent) { + // [START vpcaccess_v1_generated_VpcAccessService_ListConnectors_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 routes should be listed. + */ + // const parent = 'abc123' + /** + * Maximum number of functions to return per call. + */ + // const pageSize = 1234 + /** + * Continuation token. + */ + // const pageToken = 'abc123' + + // Imports the Vpcaccess library + const {VpcAccessServiceClient} = require('@google-cloud/vpc-access').v1; + + // Instantiates a client + const vpcaccessClient = new VpcAccessServiceClient(); + + async function callListConnectors() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await vpcaccessClient.listConnectorsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConnectors(); + // [END vpcaccess_v1_generated_VpcAccessService_ListConnectors_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/index.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/src/index.ts new file mode 100644 index 00000000000..3212970a66d --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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 VpcAccessServiceClient = v1.VpcAccessServiceClient; +type VpcAccessServiceClient = v1.VpcAccessServiceClient; +export {v1, VpcAccessServiceClient}; +export default {v1, VpcAccessServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..66ad79ef471 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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.vpcaccess.v1", + "libraryPackage": "@google-cloud/vpc-access", + "services": { + "VpcAccessService": { + "clients": { + "grpc": { + "libraryClient": "VpcAccessServiceClient", + "rpcs": { + "GetConnector": { + "methods": [ + "getConnector" + ] + }, + "CreateConnector": { + "methods": [ + "createConnector" + ] + }, + "DeleteConnector": { + "methods": [ + "deleteConnector" + ] + }, + "ListConnectors": { + "methods": [ + "listConnectors", + "listConnectorsStream", + "listConnectorsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "VpcAccessServiceClient", + "rpcs": { + "GetConnector": { + "methods": [ + "getConnector" + ] + }, + "CreateConnector": { + "methods": [ + "createConnector" + ] + }, + "DeleteConnector": { + "methods": [ + "deleteConnector" + ] + }, + "ListConnectors": { + "methods": [ + "listConnectors", + "listConnectorsStream", + "listConnectorsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/index.ts new file mode 100644 index 00000000000..233301ed42d --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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 {VpcAccessServiceClient} from './vpc_access_service_client'; diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client.ts new file mode 100644 index 00000000000..9ca2f0253ca --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_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, 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/vpc_access_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './vpc_access_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Serverless VPC Access API allows users to create and manage connectors for + * App Engine, Cloud Functions and Cloud Run to have internal connections to + * Virtual Private Cloud networks. + * @class + * @memberof v1 + */ +export class VpcAccessServiceClient { + 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; + vpcAccessServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of VpcAccessServiceClient. + * + * @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 VpcAccessServiceClient({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 VpcAccessServiceClient; + 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 = { + connectorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connectors/{connector}' + ), + 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 = { + listConnectors: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'connectors') + }; + + 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=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createConnectorResponse = protoFilesRoot.lookup( + '.google.cloud.vpcaccess.v1.Connector') as gax.protobuf.Type; + const createConnectorMetadata = protoFilesRoot.lookup( + '.google.cloud.vpcaccess.v1.OperationMetadata') as gax.protobuf.Type; + const deleteConnectorResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteConnectorMetadata = protoFilesRoot.lookup( + '.google.cloud.vpcaccess.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createConnector: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConnectorResponse.decode.bind(createConnectorResponse), + createConnectorMetadata.decode.bind(createConnectorMetadata)), + deleteConnector: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteConnectorResponse.decode.bind(deleteConnectorResponse), + deleteConnectorMetadata.decode.bind(deleteConnectorMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.vpcaccess.v1.VpcAccessService', 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.vpcAccessServiceStub) { + return this.vpcAccessServiceStub; + } + + // Put together the "service stub" for + // google.cloud.vpcaccess.v1.VpcAccessService. + this.vpcAccessServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.vpcaccess.v1.VpcAccessService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.vpcaccess.v1.VpcAccessService, + 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 vpcAccessServiceStubMethods = + ['createConnector', 'getConnector', 'listConnectors', 'deleteConnector']; + for (const methodName of vpcAccessServiceStubMethods) { + const callPromise = this.vpcAccessServiceStub.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.vpcAccessServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'vpcaccess.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 'vpcaccess.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 a Serverless VPC Access connector. Returns NOT_FOUND if the resource + * does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of a Serverless VPC Access connector 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.vpcaccess.v1.Connector|Connector}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_access_service.get_connector.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_GetConnector_async + */ + getConnector( + request?: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|undefined, {}|undefined + ]>; + getConnector( + request: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, + {}|null|undefined>): void; + getConnector( + request: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, + callback: Callback< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, + {}|null|undefined>): void; + getConnector( + request?: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConnector(request, options, callback); + } + +/** + * Creates a Serverless VPC Access connector, returns an operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the configuration should be created, + * specified in the format `projects/* /locations/*`. + * @param {string} request.connectorId + * Required. The ID to use for this connector. + * @param {google.cloud.vpcaccess.v1.Connector} request.connector + * Required. Resource 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/v1/vpc_access_service.create_connector.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_CreateConnector_async + */ + createConnector( + request?: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createConnector( + request: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnector( + request: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnector( + request?: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConnector(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createConnector()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_access_service.create_connector.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_CreateConnector_async + */ + async checkCreateConnectorProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnector, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the + * resource does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of a Serverless VPC Access connector to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_access_service.delete_connector.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async + */ + deleteConnector( + request?: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteConnector( + request: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnector( + request: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnector( + request?: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConnector(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteConnector()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_access_service.delete_connector.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async + */ + async checkDeleteConnectorProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnector, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Serverless VPC Access connectors. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the routes should be listed. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * Continuation 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.vpcaccess.v1.Connector|Connector}. + * 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 `listConnectorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listConnectors( + request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.vpcaccess.v1.IConnector[], + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest|null, + protos.google.cloud.vpcaccess.v1.IListConnectorsResponse + ]>; + listConnectors( + request: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, + protos.google.cloud.vpcaccess.v1.IConnector>): void; + listConnectors( + request: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + callback: PaginationCallback< + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, + protos.google.cloud.vpcaccess.v1.IConnector>): void; + listConnectors( + request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, + protos.google.cloud.vpcaccess.v1.IConnector>, + callback?: PaginationCallback< + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, + protos.google.cloud.vpcaccess.v1.IConnector>): + Promise<[ + protos.google.cloud.vpcaccess.v1.IConnector[], + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest|null, + protos.google.cloud.vpcaccess.v1.IListConnectorsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listConnectors(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 routes should be listed. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * Continuation 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.vpcaccess.v1.Connector|Connector} 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 `listConnectorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listConnectorsStream( + request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + 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['listConnectors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnectors.createStream( + this.innerApiCalls.listConnectors as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConnectors`, 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 routes should be listed. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * Continuation 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.vpcaccess.v1.Connector|Connector}. 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/vpc_access_service.list_connectors.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_ListConnectors_async + */ + listConnectorsAsync( + request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + 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['listConnectors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnectors.asyncIterate( + this.innerApiCalls['listConnectors'] 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 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 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.vpcAccessServiceStub && !this._terminated) { + return this.vpcAccessServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client_config.json b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client_config.json new file mode 100644 index 00000000000..b6d6c408011 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.vpcaccess.v1.VpcAccessService": { + "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": { + "CreateConnector": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetConnector": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListConnectors": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteConnector": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_proto_list.json b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_proto_list.json new file mode 100644 index 00000000000..cb787ecaff2 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/vpcaccess/v1/vpc_access.proto" +] diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..7e3e77efc71 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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 vpcaccess = require('@google-cloud/vpc-access'); + +function main() { + const vpcAccessServiceClient = new vpcaccess.VpcAccessServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..ab087650f45 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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 {VpcAccessServiceClient} from '@google-cloud/vpc-access'; + +// check that the client class type name can be used +function doStuffWithVpcAccessServiceClient(client: VpcAccessServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const vpcAccessServiceClient = new VpcAccessServiceClient(); + doStuffWithVpcAccessServiceClient(vpcAccessServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/install.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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-vpcaccess/v1/test/gapic_vpc_access_service_v1.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/test/gapic_vpc_access_service_v1.ts new file mode 100644 index 00000000000..93302739eed --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/v1/test/gapic_vpc_access_service_v1.ts @@ -0,0 +1,1382 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 vpcaccessserviceModule 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.VpcAccessServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = vpcaccessserviceModule.v1.VpcAccessServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = vpcaccessserviceModule.v1.VpcAccessServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = vpcaccessserviceModule.v1.VpcAccessServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.vpcAccessServiceStub, undefined); + await client.initialize(); + assert(client.vpcAccessServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.vpcAccessServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.vpcAccessServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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('getConnector', () => { + it('invokes getConnector without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.Connector() + ); + client.innerApiCalls.getConnector = stubSimpleCall(expectedResponse); + const [response] = await client.getConnector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnector as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnector as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnector without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.Connector() + ); + client.innerApiCalls.getConnector = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnector( + request, + (err?: Error|null, result?: protos.google.cloud.vpcaccess.v1.IConnector|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnector as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnector as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnector with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnector = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConnector(request), expectedError); + const actualRequest = (client.innerApiCalls.getConnector as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnector as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnector with closed client', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConnector(request), expectedError); + }); + }); + + describe('createConnector', () => { + it('invokes createConnector without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnector = stubLongRunningCall(expectedResponse); + const [operation] = await client.createConnector(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnector as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnector without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnector = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConnector( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnector as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnector with call error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnector = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createConnector(request), expectedError); + const actualRequest = (client.innerApiCalls.createConnector as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnector with LRO error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnector = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createConnector(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createConnector as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConnectorProgress without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateConnectorProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConnectorProgress with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateConnectorProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteConnector', () => { + it('invokes deleteConnector without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnector = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConnector(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnector without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnector = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConnector( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnector with call error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnector = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteConnector(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnector with LRO error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnector = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteConnector(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteConnectorProgress without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteConnectorProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteConnectorProgress with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteConnectorProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listConnectors', () => { + it('invokes listConnectors without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + ]; + client.innerApiCalls.listConnectors = stubSimpleCall(expectedResponse); + const [response] = await client.listConnectors(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnectors as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectors as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectors without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + ]; + client.innerApiCalls.listConnectors = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConnectors( + request, + (err?: Error|null, result?: protos.google.cloud.vpcaccess.v1.IConnector[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnectors as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectors as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectors with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConnectors = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConnectors(request), expectedError); + const actualRequest = (client.innerApiCalls.listConnectors as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectors as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectorsStream without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + ]; + client.descriptors.page.listConnectors.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConnectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vpcaccess.v1.Connector[] = []; + stream.on('data', (response: protos.google.cloud.vpcaccess.v1.Connector) => { + 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.listConnectors.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnectors, request)); + assert( + (client.descriptors.page.listConnectors.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConnectorsStream with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectors.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConnectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vpcaccess.v1.Connector[] = []; + stream.on('data', (response: protos.google.cloud.vpcaccess.v1.Connector) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConnectors.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnectors, request)); + assert( + (client.descriptors.page.listConnectors.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnectors without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + ]; + client.descriptors.page.listConnectors.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vpcaccess.v1.IConnector[] = []; + const iterable = client.listConnectorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConnectors.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnectors.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnectors with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConnectorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vpcaccess.v1.IConnector[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConnectors.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnectors.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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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('connector', () => { + const fakePath = "/rendered/path/connector"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + connector: "connectorValue", + }; + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + 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-vpcaccess/v1/tsconfig.json b/owl-bot-staging/google-cloud-vpcaccess/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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-vpcaccess/v1/webpack.config.js b/owl-bot-staging/google-cloud-vpcaccess/v1/webpack.config.js new file mode 100644 index 00000000000..5f9bfc1ebff --- /dev/null +++ b/owl-bot-staging/google-cloud-vpcaccess/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: 'VpcAccessService', + filename: './vpc-access-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-webrisk/v1/.eslintignore b/owl-bot-staging/google-cloud-webrisk/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-webrisk/v1/.eslintrc.json b/owl-bot-staging/google-cloud-webrisk/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/.gitignore b/owl-bot-staging/google-cloud-webrisk/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1/.jsdoc.js b/owl-bot-staging/google-cloud-webrisk/v1/.jsdoc.js new file mode 100644 index 00000000000..ef4492b8ebb --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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/web-risk', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-webrisk/v1/.mocharc.js b/owl-bot-staging/google-cloud-webrisk/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1/.prettierrc.js b/owl-bot-staging/google-cloud-webrisk/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1/README.md b/owl-bot-staging/google-cloud-webrisk/v1/README.md new file mode 100644 index 00000000000..55d440eecb3 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/README.md @@ -0,0 +1 @@ +Webrisk: Nodejs Client diff --git a/owl-bot-staging/google-cloud-webrisk/v1/package.json b/owl-bot-staging/google-cloud-webrisk/v1/package.json new file mode 100644 index 00000000000..eab639fcf2d --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/web-risk", + "version": "0.1.0", + "description": "Webrisk client for Node.js", + "repository": "googleapis/nodejs-webrisk", + "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 webrisk", + "webrisk", + "web risk 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-webrisk/v1/protos/google/cloud/webrisk/v1/webrisk.proto b/owl-bot-staging/google-cloud-webrisk/v1/protos/google/cloud/webrisk/v1/webrisk.proto new file mode 100644 index 00000000000..5c5f63929d6 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/protos/google/cloud/webrisk/v1/webrisk.proto @@ -0,0 +1,560 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.webrisk.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 csharp_namespace = "Google.Cloud.WebRisk.V1"; +option go_package = "cloud.google.com/go/webrisk/apiv1/webriskpb;webriskpb"; +option java_multiple_files = true; +option java_outer_classname = "WebRiskProto"; +option java_package = "com.google.webrisk.v1"; +option objc_class_prefix = "GCWR"; +option php_namespace = "Google\\Cloud\\WebRisk\\V1"; +option ruby_package = "Google::Cloud::WebRisk::V1"; + +// Web Risk API defines an interface to detect malicious URLs on your +// website and in client applications. +service WebRiskService { + option (google.api.default_host) = "webrisk.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Gets the most recent threat list diffs. These diffs should be applied to + // a local database of hashes to keep it up-to-date. If the local database is + // empty or excessively out-of-date, a complete snapshot of the database will + // be returned. This Method only updates a single ThreatList at a time. To + // update multiple ThreatList databases, this method needs to be called once + // for each list. + rpc ComputeThreatListDiff(ComputeThreatListDiffRequest) + returns (ComputeThreatListDiffResponse) { + option (google.api.http) = { + get: "/v1/threatLists:computeDiff" + }; + option (google.api.method_signature) = + "threat_type,version_token,constraints"; + } + + // This method is used to check whether a URI is on a given threatList. + // Multiple threatLists may be searched in a single query. + // The response will list all requested threatLists the URI was found to + // match. If the URI is not found on any of the requested ThreatList an + // empty response will be returned. + rpc SearchUris(SearchUrisRequest) returns (SearchUrisResponse) { + option (google.api.http) = { + get: "/v1/uris:search" + }; + option (google.api.method_signature) = "uri,threat_types"; + } + + // Gets the full hashes that match the requested hash prefix. + // This is used after a hash prefix is looked up in a threatList + // and there is a match. The client side threatList only holds partial hashes + // so the client must query this method to determine if there is a full + // hash match of a threat. + rpc SearchHashes(SearchHashesRequest) returns (SearchHashesResponse) { + option (google.api.http) = { + get: "/v1/hashes:search" + }; + option (google.api.method_signature) = "hash_prefix,threat_types"; + } + + // Creates a Submission of a URI suspected of containing phishing content to + // be reviewed. If the result verifies the existence of malicious phishing + // content, the site will be added to the [Google's Social Engineering + // lists](https://support.google.com/webmasters/answer/6350487/) in order to + // protect users that could get exposed to this threat in the future. Only + // allowlisted projects can use this method during Early Access. Please reach + // out to Sales or your customer engineer to obtain access. + rpc CreateSubmission(CreateSubmissionRequest) returns (Submission) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/submissions" + body: "submission" + }; + option (google.api.method_signature) = "parent,submission"; + } + + // Submits a URI suspected of containing malicious content to be reviewed. + // Returns a google.longrunning.Operation which, once the review is complete, + // is updated with its result. You can use the [Pub/Sub API] + // (https://cloud.google.com/pubsub) to receive notifications for the returned + // Operation. If the result verifies the existence of malicious content, the + // site will be added to the [Google's Social Engineering lists] + // (https://support.google.com/webmasters/answer/6350487/) in order to + // protect users that could get exposed to this threat in the future. Only + // allowlisted projects can use this method during Early Access. Please reach + // out to Sales or your customer engineer to obtain access. + rpc SubmitUri(SubmitUriRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/uris:submit" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Submission" + metadata_type: "SubmitUriMetadata" + }; + } +} + +// Describes an API diff request. +message ComputeThreatListDiffRequest { + // The constraints for this diff. + message Constraints { + // The maximum size in number of entries. The diff will not contain more + // entries than this value. This should be a power of 2 between 2**10 and + // 2**20. If zero, no diff size limit is set. + int32 max_diff_entries = 1; + + // Sets the maximum number of entries that the client is willing to have + // in the local database. This should be a power of 2 between 2**10 and + // 2**20. If zero, no database size limit is set. + int32 max_database_entries = 2; + + // The compression types supported by the client. + repeated CompressionType supported_compressions = 3; + } + + // Required. The threat list to update. Only a single ThreatType should be + // specified per request. If you want to handle multiple ThreatTypes, you must + // make one request per ThreatType. + ThreatType threat_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // The current version token of the client for the requested list (the + // client version that was received from the last successful diff). + // If the client does not have a version token (this is the first time calling + // ComputeThreatListDiff), this may be left empty and a full database + // snapshot will be returned. + bytes version_token = 2; + + // Required. The constraints associated with this request. + Constraints constraints = 3 [(google.api.field_behavior) = REQUIRED]; +} + +message ComputeThreatListDiffResponse { + // The type of response sent to the client. + enum ResponseType { + // Unknown. + RESPONSE_TYPE_UNSPECIFIED = 0; + + // Partial updates are applied to the client's existing local database. + DIFF = 1; + + // Full updates resets the client's entire local database. This means + // that either the client had no state, was seriously out-of-date, + // or the client is believed to be corrupt. + RESET = 2; + } + + // The expected state of a client's local database. + message Checksum { + // The SHA256 hash of the client state; that is, of the sorted list of all + // hashes present in the database. + bytes sha256 = 1; + } + + // The type of response. This may indicate that an action must be taken by the + // client when the response is received. + ResponseType response_type = 4; + + // A set of entries to add to a local threat type's list. + ThreatEntryAdditions additions = 5; + + // A set of entries to remove from a local threat type's list. + // This field may be empty. + ThreatEntryRemovals removals = 6; + + // The new opaque client version token. This should be retained by the client + // and passed into the next call of ComputeThreatListDiff as 'version_token'. + // A separate version token should be stored and used for each threatList. + bytes new_version_token = 7; + + // The expected SHA256 hash of the client state; that is, of the sorted list + // of all hashes present in the database after applying the provided diff. + // If the client state doesn't match the expected state, the client must + // discard this diff and retry later. + Checksum checksum = 8; + + // The soonest the client should wait before issuing any diff + // request. Querying sooner is unlikely to produce a meaningful diff. + // Waiting longer is acceptable considering the use case. + // If this field is not set clients may update as soon as they want. + google.protobuf.Timestamp recommended_next_diff = 2; +} + +// Request to check URI entries against threatLists. +message SearchUrisRequest { + // Required. The URI to be checked for matches. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ThreatLists to search in. Multiple ThreatLists may be + // specified. + repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message SearchUrisResponse { + // Contains threat information on a matching uri. + message ThreatUri { + // The ThreatList this threat belongs to. + repeated ThreatType threat_types = 1; + + // The cache lifetime for the returned match. Clients must not cache this + // response past this timestamp to avoid false positives. + google.protobuf.Timestamp expire_time = 2; + } + + // The threat list matches. This might be empty if the URI is on no list. + ThreatUri threat = 1; +} + +// Request to return full hashes matched by the provided hash prefixes. +message SearchHashesRequest { + // A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + // hash. For JSON requests, this field is base64-encoded. + // Note that if this parameter is provided by a URI, it must be encoded using + // the web safe base64 variant (RFC 4648). + bytes hash_prefix = 1; + + // Required. The ThreatLists to search in. Multiple ThreatLists may be + // specified. + repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message SearchHashesResponse { + // Contains threat information on a matching hash. + message ThreatHash { + // The ThreatList this threat belongs to. + // This must contain at least one entry. + repeated ThreatType threat_types = 1; + + // A 32 byte SHA256 hash. This field is in binary format. For JSON + // requests, hashes are base64-encoded. + bytes hash = 2; + + // The cache lifetime for the returned match. Clients must not cache this + // response past this timestamp to avoid false positives. + google.protobuf.Timestamp expire_time = 3; + } + + // The full hashes that matched the requested prefixes. + // The hash will be populated in the key. + repeated ThreatHash threats = 1; + + // For requested entities that did not match the threat list, how long to + // cache the response until. + google.protobuf.Timestamp negative_expire_time = 2; +} + +// The type of threat. This maps directly to the threat list a threat may +// belong to. +enum ThreatType { + // No entries should match this threat type. This threat type is unused. + THREAT_TYPE_UNSPECIFIED = 0; + + // Malware targeting any platform. + MALWARE = 1; + + // Social engineering targeting any platform. + SOCIAL_ENGINEERING = 2; + + // Unwanted software targeting any platform. + UNWANTED_SOFTWARE = 3; + + // A list of extended coverage social engineering URIs targeting any + // platform. + SOCIAL_ENGINEERING_EXTENDED_COVERAGE = 4; +} + +// The ways in which threat entry sets can be compressed. +enum CompressionType { + // Unknown. + COMPRESSION_TYPE_UNSPECIFIED = 0; + + // Raw, uncompressed data. + RAW = 1; + + // Rice-Golomb encoded data. + RICE = 2; +} + +// Contains the set of entries to add to a local database. +// May contain a combination of compressed and raw data in a single response. +message ThreatEntryAdditions { + // The raw SHA256-formatted entries. + // Repeated to allow returning sets of hashes with different prefix sizes. + repeated RawHashes raw_hashes = 1; + + // The encoded 4-byte prefixes of SHA256-formatted entries, using a + // Golomb-Rice encoding. The hashes are converted to uint32, sorted in + // ascending order, then delta encoded and stored as encoded_data. + RiceDeltaEncoding rice_hashes = 2; +} + +// Contains the set of entries to remove from a local database. +message ThreatEntryRemovals { + // The raw removal indices for a local list. + RawIndices raw_indices = 1; + + // The encoded local, lexicographically-sorted list indices, using a + // Golomb-Rice encoding. Used for sending compressed removal indices. The + // removal indices (uint32) are sorted in ascending order, then delta encoded + // and stored as encoded_data. + RiceDeltaEncoding rice_indices = 2; +} + +// A set of raw indices to remove from a local list. +message RawIndices { + // The indices to remove from a lexicographically-sorted local list. + repeated int32 indices = 1; +} + +// The uncompressed threat entries in hash format. +// Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4 +// bytes, but some hashes are lengthened if they collide with the hash of a +// popular URI. +// +// Used for sending ThreatEntryAdditons to clients that do not support +// compression, or when sending non-4-byte hashes to clients that do support +// compression. +message RawHashes { + // The number of bytes for each prefix encoded below. This field can be + // anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). + // In practice this is almost always 4, except in exceptional circumstances. + int32 prefix_size = 1; + + // The hashes, in binary format, concatenated into one long string. Hashes are + // sorted in lexicographic order. For JSON API users, hashes are + // base64-encoded. + bytes raw_hashes = 2; +} + +// The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or +// compressed removal indices. +message RiceDeltaEncoding { + // The offset of the first entry in the encoded data, or, if only a single + // integer was encoded, that single integer's value. If the field is empty or + // missing, assume zero. + int64 first_value = 1; + + // The Golomb-Rice parameter, which is a number between 2 and 28. This field + // is missing (that is, zero) if `num_entries` is zero. + int32 rice_parameter = 2; + + // The number of entries that are delta encoded in the encoded data. If only a + // single integer was encoded, this will be zero and the single value will be + // stored in `first_value`. + int32 entry_count = 3; + + // The encoded deltas that are encoded using the Golomb-Rice coder. + bytes encoded_data = 4; +} + +// Wraps a URI that might be displaying malicious content. +message Submission { + // Required. The URI that is being reported for malicious content to be + // analyzed. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. ThreatTypes found to be associated with the submitted URI + // after reviewing it. This might be empty if the URI was not added to any + // list. + repeated ThreatType threat_types = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Context about the submission including the type of abuse found on the URI and +// supporting details. +// option (google.api.message_visibility).restriction = "TRUSTED_TESTER"; +message ThreatInfo { + // The abuse type found on the URI. + enum AbuseType { + // Default. + ABUSE_TYPE_UNSPECIFIED = 0; + + // The URI contains malware. + MALWARE = 1; + + // The URI contains social engineering. + SOCIAL_ENGINEERING = 2; + + // The URI contains unwanted software. + UNWANTED_SOFTWARE = 3; + } + + // Confidence that a URI is unsafe. + message Confidence { + // Enum representation of confidence. + enum ConfidenceLevel { + // Default. + CONFIDENCE_LEVEL_UNSPECIFIED = 0; + + // Less than 60% confidence that the URI is unsafe. + LOW = 1; + + // Between 60% and 80% confidence that the URI is unsafe. + MEDIUM = 2; + + // Greater than 80% confidence that the URI is unsafe. + HIGH = 3; + } + + oneof value { + // A decimal representation of confidence in the range of 0 + // to 1 where 0 indicates no confidence and 1 indicates + // complete confidence. + float score = 1; + + // Enum representation of confidence. + ConfidenceLevel level = 2; + } + } + + // Context about why the URI is unsafe. + message ThreatJustification { + // Labels that explain how the URI was classified. + enum JustificationLabel { + // Default. + JUSTIFICATION_LABEL_UNSPECIFIED = 0; + + // The submitter manually verified that the submission is unsafe. + MANUAL_VERIFICATION = 1; + + // The submitter received the submission from an end user. + USER_REPORT = 2; + + // The submitter received the submission from an automated system. + AUTOMATED_REPORT = 3; + } + + // Labels associated with this URI that explain how it was classified. + repeated JustificationLabel labels = 1; + + // Free-form context on why this URI is unsafe. + repeated string comments = 2; + } + + // The type of abuse. + AbuseType abuse_type = 1; + + // Confidence that the URI is unsafe. + Confidence threat_confidence = 2; + + // Context about why the URI is unsafe. + ThreatJustification threat_justification = 3; +} + +// Details about how the threat was discovered. +message ThreatDiscovery { + // Platform types. + enum Platform { + // Default. + PLATFORM_UNSPECIFIED = 0; + + // General Android platform. + ANDROID = 1; + + // General iOS platform. + IOS = 2; + + // General macOS platform. + MACOS = 3; + + // General Windows platform. + WINDOWS = 4; + } + + // Platform on which the threat was discovered. + Platform platform = 1; + + // CLDR region code of the countries/regions the URI poses a threat ordered + // from most impact to least impact. Example: "US" for United States. + repeated string region_codes = 2; +} + +// Request to send a potentially phishy URI to WebRisk. +message CreateSubmissionRequest { + // Required. The name of the project that is making the submission. This + // string is in the format "projects/{project_number}". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The submission that contains the content of the phishing report. + Submission submission = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to send a potentially malicious URI to WebRisk. +message SubmitUriRequest { + // Required. The name of the project that is making the submission. This + // string is in the format "projects/{project_number}". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The submission that contains the URI to be scanned. + Submission submission = 2 [(google.api.field_behavior) = REQUIRED]; + + // Provides additional information about the submission. + ThreatInfo threat_info = 3; + + // Provides additional information about how the submission was discovered. + ThreatDiscovery threat_discovery = 4; +} + +// Metadata for the Submit URI long-running operation. +// option (google.api.message_visibility).restriction = "TRUSTED_TESTER"; +message SubmitUriMetadata { + // Enum that represents the state of the long-running operation. + enum State { + // Default unspecified state. + STATE_UNSPECIFIED = 0; + + // The operation is currently running. + RUNNING = 1; + + // The operation finished with a success status. + SUCCEEDED = 2; + + // The operation was cancelled. + CANCELLED = 3; + + // The operation finished with a failure status. + FAILED = 4; + + // The operation was closed with no action taken. + CLOSED = 5; + } + + // The state of the operation. + State state = 1; + + // Creation time of the operation. + google.protobuf.Timestamp create_time = 2; + + // Latest update time of the operation. + google.protobuf.Timestamp update_time = 3; +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json new file mode 100644 index 00000000000..8c24e94fdab --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json @@ -0,0 +1,247 @@ +{ + "clientLibrary": { + "name": "nodejs-webrisk", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.webrisk.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_async", + "title": "WebRiskService computeThreatListDiff Sample", + "origin": "API_DEFINITION", + "description": " Gets the most recent threat list diffs. These diffs should be applied to a local database of hashes to keep it up-to-date. If the local database is empty or excessively out-of-date, a complete snapshot of the database will be returned. This Method only updates a single ThreatList at a time. To update multiple ThreatList databases, this method needs to be called once for each list.", + "canonical": true, + "file": "web_risk_service.compute_threat_list_diff.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ComputeThreatListDiff", + "fullName": "google.cloud.webrisk.v1.WebRiskService.ComputeThreatListDiff", + "async": true, + "parameters": [ + { + "name": "threat_type", + "type": ".google.cloud.webrisk.v1.ThreatType" + }, + { + "name": "version_token", + "type": "TYPE_BYTES" + }, + { + "name": "constraints", + "type": ".google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints" + } + ], + "resultType": ".google.cloud.webrisk.v1.ComputeThreatListDiffResponse", + "client": { + "shortName": "WebRiskServiceClient", + "fullName": "google.cloud.webrisk.v1.WebRiskServiceClient" + }, + "method": { + "shortName": "ComputeThreatListDiff", + "fullName": "google.cloud.webrisk.v1.WebRiskService.ComputeThreatListDiff", + "service": { + "shortName": "WebRiskService", + "fullName": "google.cloud.webrisk.v1.WebRiskService" + } + } + } + }, + { + "regionTag": "webrisk_v1_generated_WebRiskService_SearchUris_async", + "title": "WebRiskService searchUris Sample", + "origin": "API_DEFINITION", + "description": " This method is used to check whether a URI is on a given threatList. Multiple threatLists may be searched in a single query. The response will list all requested threatLists the URI was found to match. If the URI is not found on any of the requested ThreatList an empty response will be returned.", + "canonical": true, + "file": "web_risk_service.search_uris.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchUris", + "fullName": "google.cloud.webrisk.v1.WebRiskService.SearchUris", + "async": true, + "parameters": [ + { + "name": "uri", + "type": "TYPE_STRING" + }, + { + "name": "threat_types", + "type": "TYPE_ENUM[]" + } + ], + "resultType": ".google.cloud.webrisk.v1.SearchUrisResponse", + "client": { + "shortName": "WebRiskServiceClient", + "fullName": "google.cloud.webrisk.v1.WebRiskServiceClient" + }, + "method": { + "shortName": "SearchUris", + "fullName": "google.cloud.webrisk.v1.WebRiskService.SearchUris", + "service": { + "shortName": "WebRiskService", + "fullName": "google.cloud.webrisk.v1.WebRiskService" + } + } + } + }, + { + "regionTag": "webrisk_v1_generated_WebRiskService_SearchHashes_async", + "title": "WebRiskService searchHashes Sample", + "origin": "API_DEFINITION", + "description": " Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is looked up in a threatList and there is a match. The client side threatList only holds partial hashes so the client must query this method to determine if there is a full hash match of a threat.", + "canonical": true, + "file": "web_risk_service.search_hashes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchHashes", + "fullName": "google.cloud.webrisk.v1.WebRiskService.SearchHashes", + "async": true, + "parameters": [ + { + "name": "hash_prefix", + "type": "TYPE_BYTES" + }, + { + "name": "threat_types", + "type": "TYPE_ENUM[]" + } + ], + "resultType": ".google.cloud.webrisk.v1.SearchHashesResponse", + "client": { + "shortName": "WebRiskServiceClient", + "fullName": "google.cloud.webrisk.v1.WebRiskServiceClient" + }, + "method": { + "shortName": "SearchHashes", + "fullName": "google.cloud.webrisk.v1.WebRiskService.SearchHashes", + "service": { + "shortName": "WebRiskService", + "fullName": "google.cloud.webrisk.v1.WebRiskService" + } + } + } + }, + { + "regionTag": "webrisk_v1_generated_WebRiskService_CreateSubmission_async", + "title": "WebRiskService createSubmission Sample", + "origin": "API_DEFINITION", + "description": " Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the [Google's Social Engineering lists](https://support.google.com/webmasters/answer/6350487/) in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.", + "canonical": true, + "file": "web_risk_service.create_submission.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSubmission", + "fullName": "google.cloud.webrisk.v1.WebRiskService.CreateSubmission", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "submission", + "type": ".google.cloud.webrisk.v1.Submission" + } + ], + "resultType": ".google.cloud.webrisk.v1.Submission", + "client": { + "shortName": "WebRiskServiceClient", + "fullName": "google.cloud.webrisk.v1.WebRiskServiceClient" + }, + "method": { + "shortName": "CreateSubmission", + "fullName": "google.cloud.webrisk.v1.WebRiskService.CreateSubmission", + "service": { + "shortName": "WebRiskService", + "fullName": "google.cloud.webrisk.v1.WebRiskService" + } + } + } + }, + { + "regionTag": "webrisk_v1_generated_WebRiskService_SubmitUri_async", + "title": "WebRiskService submitUri Sample", + "origin": "API_DEFINITION", + "description": " Submits a URI suspected of containing malicious content to be reviewed. Returns a google.longrunning.Operation which, once the review is complete, is updated with its result. You can use the [Pub/Sub API] (https://cloud.google.com/pubsub) to receive notifications for the returned Operation. If the result verifies the existence of malicious content, the site will be added to the [Google's Social Engineering lists] (https://support.google.com/webmasters/answer/6350487/) in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.", + "canonical": true, + "file": "web_risk_service.submit_uri.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SubmitUri", + "fullName": "google.cloud.webrisk.v1.WebRiskService.SubmitUri", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "submission", + "type": ".google.cloud.webrisk.v1.Submission" + }, + { + "name": "threat_info", + "type": ".google.cloud.webrisk.v1.ThreatInfo" + }, + { + "name": "threat_discovery", + "type": ".google.cloud.webrisk.v1.ThreatDiscovery" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WebRiskServiceClient", + "fullName": "google.cloud.webrisk.v1.WebRiskServiceClient" + }, + "method": { + "shortName": "SubmitUri", + "fullName": "google.cloud.webrisk.v1.WebRiskService.SubmitUri", + "service": { + "shortName": "WebRiskService", + "fullName": "google.cloud.webrisk.v1.WebRiskService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.compute_threat_list_diff.js b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.compute_threat_list_diff.js new file mode 100644 index 00000000000..0e1c627ada9 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.compute_threat_list_diff.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(threatType, constraints) { + // [START webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The threat list to update. Only a single ThreatType should be + * specified per request. If you want to handle multiple ThreatTypes, you must + * make one request per ThreatType. + */ + // const threatType = {} + /** + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * If the client does not have a version token (this is the first time calling + * ComputeThreatListDiff), this may be left empty and a full database + * snapshot will be returned. + */ + // const versionToken = Buffer.from('string') + /** + * Required. The constraints associated with this request. + */ + // const constraints = {} + + // Imports the Webrisk library + const {WebRiskServiceClient} = require('@google-cloud/web-risk').v1; + + // Instantiates a client + const webriskClient = new WebRiskServiceClient(); + + async function callComputeThreatListDiff() { + // Construct request + const request = { + threatType, + constraints, + }; + + // Run request + const response = await webriskClient.computeThreatListDiff(request); + console.log(response); + } + + callComputeThreatListDiff(); + // [END webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.create_submission.js b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.create_submission.js new file mode 100644 index 00000000000..92b83b34b77 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.create_submission.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, submission) { + // [START webrisk_v1_generated_WebRiskService_CreateSubmission_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 project that is making the submission. This + * string is in the format "projects/{project_number}". + */ + // const parent = 'abc123' + /** + * Required. The submission that contains the content of the phishing report. + */ + // const submission = {} + + // Imports the Webrisk library + const {WebRiskServiceClient} = require('@google-cloud/web-risk').v1; + + // Instantiates a client + const webriskClient = new WebRiskServiceClient(); + + async function callCreateSubmission() { + // Construct request + const request = { + parent, + submission, + }; + + // Run request + const response = await webriskClient.createSubmission(request); + console.log(response); + } + + callCreateSubmission(); + // [END webrisk_v1_generated_WebRiskService_CreateSubmission_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_hashes.js b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_hashes.js new file mode 100644 index 00000000000..245e6424f66 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_hashes.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(threatTypes) { + // [START webrisk_v1_generated_WebRiskService_SearchHashes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * Note that if this parameter is provided by a URI, it must be encoded using + * the web safe base64 variant (RFC 4648). + */ + // const hashPrefix = Buffer.from('string') + /** + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + */ + // const threatTypes = [1,2,3,4] + + // Imports the Webrisk library + const {WebRiskServiceClient} = require('@google-cloud/web-risk').v1; + + // Instantiates a client + const webriskClient = new WebRiskServiceClient(); + + async function callSearchHashes() { + // Construct request + const request = { + threatTypes, + }; + + // Run request + const response = await webriskClient.searchHashes(request); + console.log(response); + } + + callSearchHashes(); + // [END webrisk_v1_generated_WebRiskService_SearchHashes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_uris.js b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_uris.js new file mode 100644 index 00000000000..a1896647bdd --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_uris.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(uri, threatTypes) { + // [START webrisk_v1_generated_WebRiskService_SearchUris_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The URI to be checked for matches. + */ + // const uri = 'abc123' + /** + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + */ + // const threatTypes = [1,2,3,4] + + // Imports the Webrisk library + const {WebRiskServiceClient} = require('@google-cloud/web-risk').v1; + + // Instantiates a client + const webriskClient = new WebRiskServiceClient(); + + async function callSearchUris() { + // Construct request + const request = { + uri, + threatTypes, + }; + + // Run request + const response = await webriskClient.searchUris(request); + console.log(response); + } + + callSearchUris(); + // [END webrisk_v1_generated_WebRiskService_SearchUris_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.submit_uri.js b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.submit_uri.js new file mode 100644 index 00000000000..b1ed9459f4f --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.submit_uri.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, submission) { + // [START webrisk_v1_generated_WebRiskService_SubmitUri_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 project that is making the submission. This + * string is in the format "projects/{project_number}". + */ + // const parent = 'abc123' + /** + * Required. The submission that contains the URI to be scanned. + */ + // const submission = {} + /** + * Provides additional information about the submission. + */ + // const threatInfo = {} + /** + * Provides additional information about how the submission was discovered. + */ + // const threatDiscovery = {} + + // Imports the Webrisk library + const {WebRiskServiceClient} = require('@google-cloud/web-risk').v1; + + // Instantiates a client + const webriskClient = new WebRiskServiceClient(); + + async function callSubmitUri() { + // Construct request + const request = { + parent, + submission, + }; + + // Run request + const [operation] = await webriskClient.submitUri(request); + const [response] = await operation.promise(); + console.log(response); + } + + callSubmitUri(); + // [END webrisk_v1_generated_WebRiskService_SubmitUri_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/index.ts b/owl-bot-staging/google-cloud-webrisk/v1/src/index.ts new file mode 100644 index 00000000000..51a4ce32a7b --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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 WebRiskServiceClient = v1.WebRiskServiceClient; +type WebRiskServiceClient = v1.WebRiskServiceClient; +export {v1, WebRiskServiceClient}; +export default {v1, WebRiskServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..8b6c58413fd --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/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.webrisk.v1", + "libraryPackage": "@google-cloud/web-risk", + "services": { + "WebRiskService": { + "clients": { + "grpc": { + "libraryClient": "WebRiskServiceClient", + "rpcs": { + "ComputeThreatListDiff": { + "methods": [ + "computeThreatListDiff" + ] + }, + "SearchUris": { + "methods": [ + "searchUris" + ] + }, + "SearchHashes": { + "methods": [ + "searchHashes" + ] + }, + "CreateSubmission": { + "methods": [ + "createSubmission" + ] + }, + "SubmitUri": { + "methods": [ + "submitUri" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WebRiskServiceClient", + "rpcs": { + "ComputeThreatListDiff": { + "methods": [ + "computeThreatListDiff" + ] + }, + "SearchUris": { + "methods": [ + "searchUris" + ] + }, + "SearchHashes": { + "methods": [ + "searchHashes" + ] + }, + "CreateSubmission": { + "methods": [ + "createSubmission" + ] + }, + "SubmitUri": { + "methods": [ + "submitUri" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/index.ts new file mode 100644 index 00000000000..6841fbac5ae --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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 {WebRiskServiceClient} from './web_risk_service_client'; diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client.ts b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client.ts new file mode 100644 index 00000000000..64ae4bf44d9 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client.ts @@ -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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/web_risk_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './web_risk_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Web Risk API defines an interface to detect malicious URLs on your + * website and in client applications. + * @class + * @memberof v1 + */ +export class WebRiskServiceClient { + 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; + webRiskServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WebRiskServiceClient. + * + * @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 WebRiskServiceClient({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 WebRiskServiceClient; + 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}' + ), + }; + + 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/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const submitUriResponse = protoFilesRoot.lookup( + '.google.cloud.webrisk.v1.Submission') as gax.protobuf.Type; + const submitUriMetadata = protoFilesRoot.lookup( + '.google.cloud.webrisk.v1.SubmitUriMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + submitUri: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + submitUriResponse.decode.bind(submitUriResponse), + submitUriMetadata.decode.bind(submitUriMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.webrisk.v1.WebRiskService', 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.webRiskServiceStub) { + return this.webRiskServiceStub; + } + + // Put together the "service stub" for + // google.cloud.webrisk.v1.WebRiskService. + this.webRiskServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.webrisk.v1.WebRiskService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.webrisk.v1.WebRiskService, + 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 webRiskServiceStubMethods = + ['computeThreatListDiff', 'searchUris', 'searchHashes', 'createSubmission', 'submitUri']; + for (const methodName of webRiskServiceStubMethods) { + const callPromise = this.webRiskServiceStub.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.webRiskServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'webrisk.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 'webrisk.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 most recent threat list diffs. These diffs should be applied to + * a local database of hashes to keep it up-to-date. If the local database is + * empty or excessively out-of-date, a complete snapshot of the database will + * be returned. This Method only updates a single ThreatList at a time. To + * update multiple ThreatList databases, this method needs to be called once + * for each list. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.webrisk.v1.ThreatType} request.threatType + * Required. The threat list to update. Only a single ThreatType should be + * specified per request. If you want to handle multiple ThreatTypes, you must + * make one request per ThreatType. + * @param {Buffer} request.versionToken + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * If the client does not have a version token (this is the first time calling + * ComputeThreatListDiff), this may be left empty and a full database + * snapshot will be returned. + * @param {google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints} request.constraints + * Required. The constraints associated with 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.webrisk.v1.ComputeThreatListDiffResponse|ComputeThreatListDiffResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.compute_threat_list_diff.js + * region_tag:webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_async + */ + computeThreatListDiff( + request?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|undefined, {}|undefined + ]>; + computeThreatListDiff( + request: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, + {}|null|undefined>): void; + computeThreatListDiff( + request: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, + callback: Callback< + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, + {}|null|undefined>): void; + computeThreatListDiff( + request?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.computeThreatListDiff(request, options, callback); + } +/** + * This method is used to check whether a URI is on a given threatList. + * Multiple threatLists may be searched in a single query. + * The response will list all requested threatLists the URI was found to + * match. If the URI is not found on any of the requested ThreatList an + * empty response will be returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.uri + * Required. The URI to be checked for matches. + * @param {number[]} request.threatTypes + * Required. The ThreatLists to search in. Multiple ThreatLists may 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.webrisk.v1.SearchUrisResponse|SearchUrisResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.search_uris.js + * region_tag:webrisk_v1_generated_WebRiskService_SearchUris_async + */ + searchUris( + request?: protos.google.cloud.webrisk.v1.ISearchUrisRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest|undefined, {}|undefined + ]>; + searchUris( + request: protos.google.cloud.webrisk.v1.ISearchUrisRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, + {}|null|undefined>): void; + searchUris( + request: protos.google.cloud.webrisk.v1.ISearchUrisRequest, + callback: Callback< + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, + {}|null|undefined>): void; + searchUris( + request?: protos.google.cloud.webrisk.v1.ISearchUrisRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.searchUris(request, options, callback); + } +/** + * Gets the full hashes that match the requested hash prefix. + * This is used after a hash prefix is looked up in a threatList + * and there is a match. The client side threatList only holds partial hashes + * so the client must query this method to determine if there is a full + * hash match of a threat. + * + * @param {Object} request + * The request object that will be sent. + * @param {Buffer} request.hashPrefix + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * Note that if this parameter is provided by a URI, it must be encoded using + * the web safe base64 variant (RFC 4648). + * @param {number[]} request.threatTypes + * Required. The ThreatLists to search in. Multiple ThreatLists may 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.webrisk.v1.SearchHashesResponse|SearchHashesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.search_hashes.js + * region_tag:webrisk_v1_generated_WebRiskService_SearchHashes_async + */ + searchHashes( + request?: protos.google.cloud.webrisk.v1.ISearchHashesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest|undefined, {}|undefined + ]>; + searchHashes( + request: protos.google.cloud.webrisk.v1.ISearchHashesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, + {}|null|undefined>): void; + searchHashes( + request: protos.google.cloud.webrisk.v1.ISearchHashesRequest, + callback: Callback< + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, + {}|null|undefined>): void; + searchHashes( + request?: protos.google.cloud.webrisk.v1.ISearchHashesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.searchHashes(request, options, callback); + } +/** + * Creates a Submission of a URI suspected of containing phishing content to + * be reviewed. If the result verifies the existence of malicious phishing + * content, the site will be added to the [Google's Social Engineering + * lists](https://support.google.com/webmasters/answer/6350487/) in order to + * protect users that could get exposed to this threat in the future. Only + * allowlisted projects can use this method during Early Access. Please reach + * out to Sales or your customer engineer to obtain access. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * @param {google.cloud.webrisk.v1.Submission} request.submission + * Required. The submission that contains the content of the phishing 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.webrisk.v1.Submission|Submission}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.create_submission.js + * region_tag:webrisk_v1_generated_WebRiskService_CreateSubmission_async + */ + createSubmission( + request?: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|undefined, {}|undefined + ]>; + createSubmission( + request: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, + {}|null|undefined>): void; + createSubmission( + request: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, + callback: Callback< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, + {}|null|undefined>): void; + createSubmission( + request?: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSubmission(request, options, callback); + } + +/** + * Submits a URI suspected of containing malicious content to be reviewed. + * Returns a google.longrunning.Operation which, once the review is complete, + * is updated with its result. You can use the [Pub/Sub API] + * (https://cloud.google.com/pubsub) to receive notifications for the returned + * Operation. If the result verifies the existence of malicious content, the + * site will be added to the [Google's Social Engineering lists] + * (https://support.google.com/webmasters/answer/6350487/) in order to + * protect users that could get exposed to this threat in the future. Only + * allowlisted projects can use this method during Early Access. Please reach + * out to Sales or your customer engineer to obtain access. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * @param {google.cloud.webrisk.v1.Submission} request.submission + * Required. The submission that contains the URI to be scanned. + * @param {google.cloud.webrisk.v1.ThreatInfo} request.threatInfo + * Provides additional information about the submission. + * @param {google.cloud.webrisk.v1.ThreatDiscovery} request.threatDiscovery + * Provides additional information about how the submission was discovered. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.submit_uri.js + * region_tag:webrisk_v1_generated_WebRiskService_SubmitUri_async + */ + submitUri( + request?: protos.google.cloud.webrisk.v1.ISubmitUriRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + submitUri( + request: protos.google.cloud.webrisk.v1.ISubmitUriRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + submitUri( + request: protos.google.cloud.webrisk.v1.ISubmitUriRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + submitUri( + request?: protos.google.cloud.webrisk.v1.ISubmitUriRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.submitUri(request, options, callback); + } +/** + * Check the status of the long running operation returned by `submitUri()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.submit_uri.js + * region_tag:webrisk_v1_generated_WebRiskService_SubmitUri_async + */ + async checkSubmitUriProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.submitUri, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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 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.webRiskServiceStub && !this._terminated) { + return this.webRiskServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client_config.json b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client_config.json new file mode 100644 index 00000000000..dc341cc185b --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client_config.json @@ -0,0 +1,50 @@ +{ + "interfaces": { + "google.cloud.webrisk.v1.WebRiskService": { + "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": { + "ComputeThreatListDiff": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SearchUris": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SearchHashes": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateSubmission": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SubmitUri": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_proto_list.json b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_proto_list.json new file mode 100644 index 00000000000..beac97653c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/webrisk/v1/webrisk.proto" +] diff --git a/owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..d1cd13a173e --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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 webrisk = require('@google-cloud/web-risk'); + +function main() { + const webRiskServiceClient = new webrisk.WebRiskServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..ea217a23ddd --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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 {WebRiskServiceClient} from '@google-cloud/web-risk'; + +// check that the client class type name can be used +function doStuffWithWebRiskServiceClient(client: WebRiskServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const webRiskServiceClient = new WebRiskServiceClient(); + doStuffWithWebRiskServiceClient(webRiskServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/system-test/install.ts b/owl-bot-staging/google-cloud-webrisk/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1/test/gapic_web_risk_service_v1.ts b/owl-bot-staging/google-cloud-webrisk/v1/test/gapic_web_risk_service_v1.ts new file mode 100644 index 00000000000..b829e2a674a --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1/test/gapic_web_risk_service_v1.ts @@ -0,0 +1,961 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 webriskserviceModule from '../src'; + +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 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.WebRiskServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = webriskserviceModule.v1.WebRiskServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = webriskserviceModule.v1.WebRiskServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = webriskserviceModule.v1.WebRiskServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webRiskServiceStub, undefined); + await client.initialize(); + assert(client.webRiskServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.webRiskServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webRiskServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + 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 webriskserviceModule.v1.WebRiskServiceClient({ + 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('computeThreatListDiff', () => { + it('invokes computeThreatListDiff without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffResponse() + ); + client.innerApiCalls.computeThreatListDiff = stubSimpleCall(expectedResponse); + const [response] = await client.computeThreatListDiff(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes computeThreatListDiff without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffResponse() + ); + client.innerApiCalls.computeThreatListDiff = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.computeThreatListDiff( + request, + (err?: Error|null, result?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes computeThreatListDiff with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.computeThreatListDiff = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.computeThreatListDiff(request), expectedError); + }); + + it('invokes computeThreatListDiff with closed client', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.computeThreatListDiff(request), expectedError); + }); + }); + + describe('searchUris', () => { + it('invokes searchUris without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisResponse() + ); + client.innerApiCalls.searchUris = stubSimpleCall(expectedResponse); + const [response] = await client.searchUris(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchUris without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisResponse() + ); + client.innerApiCalls.searchUris = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchUris( + request, + (err?: Error|null, result?: protos.google.cloud.webrisk.v1.ISearchUrisResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchUris with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.searchUris = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchUris(request), expectedError); + }); + + it('invokes searchUris with closed client', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.searchUris(request), expectedError); + }); + }); + + describe('searchHashes', () => { + it('invokes searchHashes without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesResponse() + ); + client.innerApiCalls.searchHashes = stubSimpleCall(expectedResponse); + const [response] = await client.searchHashes(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchHashes without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesResponse() + ); + client.innerApiCalls.searchHashes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchHashes( + request, + (err?: Error|null, result?: protos.google.cloud.webrisk.v1.ISearchHashesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchHashes with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.searchHashes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchHashes(request), expectedError); + }); + + it('invokes searchHashes with closed client', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.searchHashes(request), expectedError); + }); + }); + + describe('createSubmission', () => { + it('invokes createSubmission without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.Submission() + ); + client.innerApiCalls.createSubmission = stubSimpleCall(expectedResponse); + const [response] = await client.createSubmission(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSubmission as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSubmission as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSubmission without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.Submission() + ); + client.innerApiCalls.createSubmission = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSubmission( + request, + (err?: Error|null, result?: protos.google.cloud.webrisk.v1.ISubmission|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSubmission as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSubmission as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSubmission with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSubmission = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSubmission(request), expectedError); + const actualRequest = (client.innerApiCalls.createSubmission as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSubmission as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSubmission with closed client', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSubmission(request), expectedError); + }); + }); + + describe('submitUri', () => { + it('invokes submitUri without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SubmitUriRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.submitUri = stubLongRunningCall(expectedResponse); + const [operation] = await client.submitUri(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.submitUri as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes submitUri without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SubmitUriRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.submitUri = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.submitUri( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.submitUri as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes submitUri with call error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SubmitUriRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.submitUri = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.submitUri(request), expectedError); + const actualRequest = (client.innerApiCalls.submitUri as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes submitUri with LRO error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SubmitUriRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.submitUri = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.submitUri(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.submitUri as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkSubmitUriProgress without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkSubmitUriProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSubmitUriProgress with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkSubmitUriProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + 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 webriskserviceModule.v1.WebRiskServiceClient({ + 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 webriskserviceModule.v1.WebRiskServiceClient({ + 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 webriskserviceModule.v1.WebRiskServiceClient({ + 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 webriskserviceModule.v1.WebRiskServiceClient({ + 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 webriskserviceModule.v1.WebRiskServiceClient({ + 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 webriskserviceModule.v1.WebRiskServiceClient({ + 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 webriskserviceModule.v1.WebRiskServiceClient({ + 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 webriskserviceModule.v1.WebRiskServiceClient({ + 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 webriskserviceModule.v1.WebRiskServiceClient({ + 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 webriskserviceModule.v1.WebRiskServiceClient({ + 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('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + 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-webrisk/v1/tsconfig.json b/owl-bot-staging/google-cloud-webrisk/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1/webpack.config.js b/owl-bot-staging/google-cloud-webrisk/v1/webpack.config.js new file mode 100644 index 00000000000..c45917670d0 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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: 'WebRiskService', + filename: './web-risk-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-webrisk/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/.gitignore b/owl-bot-staging/google-cloud-webrisk/v1beta1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/.jsdoc.js new file mode 100644 index 00000000000..ef4492b8ebb --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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/web-risk', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1beta1/README.md b/owl-bot-staging/google-cloud-webrisk/v1beta1/README.md new file mode 100644 index 00000000000..55d440eecb3 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/README.md @@ -0,0 +1 @@ +Webrisk: Nodejs Client diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/package.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/package.json new file mode 100644 index 00000000000..a1d7fd0bc74 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/web-risk", + "version": "0.1.0", + "description": "Webrisk client for Node.js", + "repository": "googleapis/nodejs-webrisk", + "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 webrisk", + "webrisk", + "web risk service 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-webrisk/v1beta1/protos/google/cloud/webrisk/v1beta1/webrisk.proto b/owl-bot-staging/google-cloud-webrisk/v1beta1/protos/google/cloud/webrisk/v1beta1/webrisk.proto new file mode 100644 index 00000000000..6fcdb3aec61 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/protos/google/cloud/webrisk/v1beta1/webrisk.proto @@ -0,0 +1,303 @@ +// 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.webrisk.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.WebRisk.V1Beta1"; +option go_package = "cloud.google.com/go/webrisk/apiv1beta1/webriskpb;webriskpb"; +option java_multiple_files = true; +option java_outer_classname = "WebRiskProto"; +option java_package = "com.google.webrisk.v1beta1"; +option objc_class_prefix = "GCWR"; +option php_namespace = "Google\\Cloud\\WebRisk\\V1beta1"; +option ruby_package = "Google::Cloud::WebRisk::V1beta1"; + +// Web Risk v1beta1 API defines an interface to detect malicious URLs on your +// website and in client applications. +service WebRiskServiceV1Beta1 { + option (google.api.default_host) = "webrisk.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Gets the most recent threat list diffs. + rpc ComputeThreatListDiff(ComputeThreatListDiffRequest) returns (ComputeThreatListDiffResponse) { + option (google.api.http) = { + get: "/v1beta1/threatLists:computeDiff" + }; + option (google.api.method_signature) = "threat_type,version_token,constraints"; + } + + // This method is used to check whether a URI is on a given threatList. + rpc SearchUris(SearchUrisRequest) returns (SearchUrisResponse) { + option (google.api.http) = { + get: "/v1beta1/uris:search" + }; + option (google.api.method_signature) = "uri,threat_types"; + } + + // Gets the full hashes that match the requested hash prefix. + // This is used after a hash prefix is looked up in a threatList + // and there is a match. The client side threatList only holds partial hashes + // so the client must query this method to determine if there is a full + // hash match of a threat. + rpc SearchHashes(SearchHashesRequest) returns (SearchHashesResponse) { + option (google.api.http) = { + get: "/v1beta1/hashes:search" + }; + option (google.api.method_signature) = "hash_prefix,threat_types"; + } +} + +// Describes an API diff request. +message ComputeThreatListDiffRequest { + // The constraints for this diff. + message Constraints { + // The maximum size in number of entries. The diff will not contain more + // entries than this value. This should be a power of 2 between 2**10 and + // 2**20. If zero, no diff size limit is set. + int32 max_diff_entries = 1; + + // Sets the maximum number of entries that the client is willing to have + // in the local database. This should be a power of 2 between 2**10 and + // 2**20. If zero, no database size limit is set. + int32 max_database_entries = 2; + + // The compression types supported by the client. + repeated CompressionType supported_compressions = 3; + } + + // The ThreatList to update. + ThreatType threat_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // The current version token of the client for the requested list (the + // client version that was received from the last successful diff). + bytes version_token = 2; + + // Required. The constraints associated with this request. + Constraints constraints = 3 [(google.api.field_behavior) = REQUIRED]; +} + +message ComputeThreatListDiffResponse { + // The expected state of a client's local database. + message Checksum { + // The SHA256 hash of the client state; that is, of the sorted list of all + // hashes present in the database. + bytes sha256 = 1; + } + + // The type of response sent to the client. + enum ResponseType { + // Unknown. + RESPONSE_TYPE_UNSPECIFIED = 0; + + // Partial updates are applied to the client's existing local database. + DIFF = 1; + + // Full updates resets the client's entire local database. This means + // that either the client had no state, was seriously out-of-date, + // or the client is believed to be corrupt. + RESET = 2; + } + + // The type of response. This may indicate that an action must be taken by the + // client when the response is received. + ResponseType response_type = 4; + + // A set of entries to add to a local threat type's list. + ThreatEntryAdditions additions = 5; + + // A set of entries to remove from a local threat type's list. + // This field may be empty. + ThreatEntryRemovals removals = 6; + + // The new opaque client version token. + bytes new_version_token = 7; + + // The expected SHA256 hash of the client state; that is, of the sorted list + // of all hashes present in the database after applying the provided diff. + // If the client state doesn't match the expected state, the client must + // disregard this diff and retry later. + Checksum checksum = 8; + + // The soonest the client should wait before issuing any diff + // request. Querying sooner is unlikely to produce a meaningful diff. + // Waiting longer is acceptable considering the use case. + // If this field is not set clients may update as soon as they want. + google.protobuf.Timestamp recommended_next_diff = 2; +} + +// Request to check URI entries against threatLists. +message SearchUrisRequest { + // Required. The URI to be checked for matches. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ThreatLists to search in. + repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message SearchUrisResponse { + // Contains threat information on a matching uri. + message ThreatUri { + // The ThreatList this threat belongs to. + repeated ThreatType threat_types = 1; + + // The cache lifetime for the returned match. Clients must not cache this + // response past this timestamp to avoid false positives. + google.protobuf.Timestamp expire_time = 2; + } + + // The threat list matches. This may be empty if the URI is on no list. + ThreatUri threat = 1; +} + +// Request to return full hashes matched by the provided hash prefixes. +message SearchHashesRequest { + // A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + // hash. For JSON requests, this field is base64-encoded. + bytes hash_prefix = 1; + + // Required. The ThreatLists to search in. + repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message SearchHashesResponse { + // Contains threat information on a matching hash. + message ThreatHash { + // The ThreatList this threat belongs to. + // This must contain at least one entry. + repeated ThreatType threat_types = 1; + + // A 32 byte SHA256 hash. This field is in binary format. For JSON + // requests, hashes are base64-encoded. + bytes hash = 2; + + // The cache lifetime for the returned match. Clients must not cache this + // response past this timestamp to avoid false positives. + google.protobuf.Timestamp expire_time = 3; + } + + // The full hashes that matched the requested prefixes. + // The hash will be populated in the key. + repeated ThreatHash threats = 1; + + // For requested entities that did not match the threat list, how long to + // cache the response until. + google.protobuf.Timestamp negative_expire_time = 2; +} + +// Contains the set of entries to add to a local database. +// May contain a combination of compressed and raw data in a single response. +message ThreatEntryAdditions { + // The raw SHA256-formatted entries. + // Repeated to allow returning sets of hashes with different prefix sizes. + repeated RawHashes raw_hashes = 1; + + // The encoded 4-byte prefixes of SHA256-formatted entries, using a + // Golomb-Rice encoding. The hashes are converted to uint32, sorted in + // ascending order, then delta encoded and stored as encoded_data. + RiceDeltaEncoding rice_hashes = 2; +} + +// Contains the set of entries to remove from a local database. +message ThreatEntryRemovals { + // The raw removal indices for a local list. + RawIndices raw_indices = 1; + + // The encoded local, lexicographically-sorted list indices, using a + // Golomb-Rice encoding. Used for sending compressed removal indices. The + // removal indices (uint32) are sorted in ascending order, then delta encoded + // and stored as encoded_data. + RiceDeltaEncoding rice_indices = 2; +} + +// The type of threat. This maps dirrectly to the threat list a threat may +// belong to. +enum ThreatType { + // Unknown. + THREAT_TYPE_UNSPECIFIED = 0; + + // Malware targeting any platform. + MALWARE = 1; + + // Social engineering targeting any platform. + SOCIAL_ENGINEERING = 2; + + // Unwanted software targeting any platform. + UNWANTED_SOFTWARE = 3; +} + +// The ways in which threat entry sets can be compressed. +enum CompressionType { + // Unknown. + COMPRESSION_TYPE_UNSPECIFIED = 0; + + // Raw, uncompressed data. + RAW = 1; + + // Rice-Golomb encoded data. + RICE = 2; +} + +// A set of raw indices to remove from a local list. +message RawIndices { + // The indices to remove from a lexicographically-sorted local list. + repeated int32 indices = 1; +} + +// The uncompressed threat entries in hash format. +// Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4 +// bytes, but some hashes are lengthened if they collide with the hash of a +// popular URI. +// +// Used for sending ThreatEntryAdditons to clients that do not support +// compression, or when sending non-4-byte hashes to clients that do support +// compression. +message RawHashes { + // The number of bytes for each prefix encoded below. This field can be + // anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). + int32 prefix_size = 1; + + // The hashes, in binary format, concatenated into one long string. Hashes are + // sorted in lexicographic order. For JSON API users, hashes are + // base64-encoded. + bytes raw_hashes = 2; +} + +// The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or +// compressed removal indices. +message RiceDeltaEncoding { + // The offset of the first entry in the encoded data, or, if only a single + // integer was encoded, that single integer's value. If the field is empty or + // missing, assume zero. + int64 first_value = 1; + + // The Golomb-Rice parameter, which is a number between 2 and 28. This field + // is missing (that is, zero) if `num_entries` is zero. + int32 rice_parameter = 2; + + // The number of entries that are delta encoded in the encoded data. If only a + // single integer was encoded, this will be zero and the single value will be + // stored in `first_value`. + int32 entry_count = 3; + + // The encoded deltas that are encoded using the Golomb-Rice coder. + bytes encoded_data = 4; +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json new file mode 100644 index 00000000000..50a7a60596f --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json @@ -0,0 +1,151 @@ +{ + "clientLibrary": { + "name": "nodejs-webrisk", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.webrisk.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_async", + "title": "WebRiskServiceV1Beta1 computeThreatListDiff Sample", + "origin": "API_DEFINITION", + "description": " Gets the most recent threat list diffs.", + "canonical": true, + "file": "web_risk_service_v1_beta1.compute_threat_list_diff.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ComputeThreatListDiff", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.ComputeThreatListDiff", + "async": true, + "parameters": [ + { + "name": "threat_type", + "type": ".google.cloud.webrisk.v1beta1.ThreatType" + }, + { + "name": "version_token", + "type": "TYPE_BYTES" + }, + { + "name": "constraints", + "type": ".google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints" + } + ], + "resultType": ".google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse", + "client": { + "shortName": "WebRiskServiceV1Beta1Client", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client" + }, + "method": { + "shortName": "ComputeThreatListDiff", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.ComputeThreatListDiff", + "service": { + "shortName": "WebRiskServiceV1Beta1", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1" + } + } + } + }, + { + "regionTag": "webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_async", + "title": "WebRiskServiceV1Beta1 searchUris Sample", + "origin": "API_DEFINITION", + "description": " This method is used to check whether a URI is on a given threatList.", + "canonical": true, + "file": "web_risk_service_v1_beta1.search_uris.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchUris", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.SearchUris", + "async": true, + "parameters": [ + { + "name": "uri", + "type": "TYPE_STRING" + }, + { + "name": "threat_types", + "type": "TYPE_ENUM[]" + } + ], + "resultType": ".google.cloud.webrisk.v1beta1.SearchUrisResponse", + "client": { + "shortName": "WebRiskServiceV1Beta1Client", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client" + }, + "method": { + "shortName": "SearchUris", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.SearchUris", + "service": { + "shortName": "WebRiskServiceV1Beta1", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1" + } + } + } + }, + { + "regionTag": "webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_async", + "title": "WebRiskServiceV1Beta1 searchHashes Sample", + "origin": "API_DEFINITION", + "description": " Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is looked up in a threatList and there is a match. The client side threatList only holds partial hashes so the client must query this method to determine if there is a full hash match of a threat.", + "canonical": true, + "file": "web_risk_service_v1_beta1.search_hashes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchHashes", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.SearchHashes", + "async": true, + "parameters": [ + { + "name": "hash_prefix", + "type": "TYPE_BYTES" + }, + { + "name": "threat_types", + "type": "TYPE_ENUM[]" + } + ], + "resultType": ".google.cloud.webrisk.v1beta1.SearchHashesResponse", + "client": { + "shortName": "WebRiskServiceV1Beta1Client", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client" + }, + "method": { + "shortName": "SearchHashes", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.SearchHashes", + "service": { + "shortName": "WebRiskServiceV1Beta1", + "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js new file mode 100644 index 00000000000..3f06b796af0 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.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(threatType, constraints) { + // [START webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 ThreatList to update. + */ + // const threatType = {} + /** + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + */ + // const versionToken = Buffer.from('string') + /** + * Required. The constraints associated with this request. + */ + // const constraints = {} + + // Imports the Webrisk library + const {WebRiskServiceV1Beta1Client} = require('@google-cloud/web-risk').v1beta1; + + // Instantiates a client + const webriskClient = new WebRiskServiceV1Beta1Client(); + + async function callComputeThreatListDiff() { + // Construct request + const request = { + threatType, + constraints, + }; + + // Run request + const response = await webriskClient.computeThreatListDiff(request); + console.log(response); + } + + callComputeThreatListDiff(); + // [END webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js new file mode 100644 index 00000000000..a6dbc74336d --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.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(threatTypes) { + // [START webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + */ + // const hashPrefix = Buffer.from('string') + /** + * Required. The ThreatLists to search in. + */ + // const threatTypes = [1,2,3,4] + + // Imports the Webrisk library + const {WebRiskServiceV1Beta1Client} = require('@google-cloud/web-risk').v1beta1; + + // Instantiates a client + const webriskClient = new WebRiskServiceV1Beta1Client(); + + async function callSearchHashes() { + // Construct request + const request = { + threatTypes, + }; + + // Run request + const response = await webriskClient.searchHashes(request); + console.log(response); + } + + callSearchHashes(); + // [END webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js new file mode 100644 index 00000000000..8a379be79fc --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.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(uri, threatTypes) { + // [START webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The URI to be checked for matches. + */ + // const uri = 'abc123' + /** + * Required. The ThreatLists to search in. + */ + // const threatTypes = [1,2,3,4] + + // Imports the Webrisk library + const {WebRiskServiceV1Beta1Client} = require('@google-cloud/web-risk').v1beta1; + + // Instantiates a client + const webriskClient = new WebRiskServiceV1Beta1Client(); + + async function callSearchUris() { + // Construct request + const request = { + uri, + threatTypes, + }; + + // Run request + const response = await webriskClient.searchUris(request); + console.log(response); + } + + callSearchUris(); + // [END webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/index.ts new file mode 100644 index 00000000000..cf99cbbf92c --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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 WebRiskServiceV1Beta1Client = v1beta1.WebRiskServiceV1Beta1Client; +type WebRiskServiceV1Beta1Client = v1beta1.WebRiskServiceV1Beta1Client; +export {v1beta1, WebRiskServiceV1Beta1Client}; +export default {v1beta1, WebRiskServiceV1Beta1Client}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..9ed88dddb8c --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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.webrisk.v1beta1", + "libraryPackage": "@google-cloud/web-risk", + "services": { + "WebRiskServiceV1Beta1": { + "clients": { + "grpc": { + "libraryClient": "WebRiskServiceV1Beta1Client", + "rpcs": { + "ComputeThreatListDiff": { + "methods": [ + "computeThreatListDiff" + ] + }, + "SearchUris": { + "methods": [ + "searchUris" + ] + }, + "SearchHashes": { + "methods": [ + "searchHashes" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WebRiskServiceV1Beta1Client", + "rpcs": { + "ComputeThreatListDiff": { + "methods": [ + "computeThreatListDiff" + ] + }, + "SearchUris": { + "methods": [ + "searchUris" + ] + }, + "SearchHashes": { + "methods": [ + "searchHashes" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000000..a2578d92a56 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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 {WebRiskServiceV1Beta1Client} from './web_risk_service_v1_beta1_client'; diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client.ts new file mode 100644 index 00000000000..2f3308225fe --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client.ts @@ -0,0 +1,516 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/web_risk_service_v1_beta1_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './web_risk_service_v1_beta1_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Web Risk v1beta1 API defines an interface to detect malicious URLs on your + * website and in client applications. + * @class + * @memberof v1beta1 + */ +export class WebRiskServiceV1Beta1Client { + 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}; + webRiskServiceV1Beta1Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WebRiskServiceV1Beta1Client. + * + * @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 WebRiskServiceV1Beta1Client({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 WebRiskServiceV1Beta1Client; + 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.webrisk.v1beta1.WebRiskServiceV1Beta1', 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.webRiskServiceV1Beta1Stub) { + return this.webRiskServiceV1Beta1Stub; + } + + // Put together the "service stub" for + // google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1. + this.webRiskServiceV1Beta1Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1, + 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 webRiskServiceV1Beta1StubMethods = + ['computeThreatListDiff', 'searchUris', 'searchHashes']; + for (const methodName of webRiskServiceV1Beta1StubMethods) { + const callPromise = this.webRiskServiceV1Beta1Stub.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.webRiskServiceV1Beta1Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'webrisk.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 'webrisk.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 most recent threat list diffs. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.webrisk.v1beta1.ThreatType} request.threatType + * The ThreatList to update. + * @param {Buffer} request.versionToken + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * @param {google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints} request.constraints + * Required. The constraints associated with 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.webrisk.v1beta1.ComputeThreatListDiffResponse|ComputeThreatListDiffResponse}. + * Please see the {@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/web_risk_service_v1_beta1.compute_threat_list_diff.js + * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_async + */ + computeThreatListDiff( + request?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|undefined, {}|undefined + ]>; + computeThreatListDiff( + request: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, + {}|null|undefined>): void; + computeThreatListDiff( + request: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, + {}|null|undefined>): void; + computeThreatListDiff( + request?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.computeThreatListDiff(request, options, callback); + } +/** + * This method is used to check whether a URI is on a given threatList. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.uri + * Required. The URI to be checked for matches. + * @param {number[]} request.threatTypes + * Required. The ThreatLists to search in. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.webrisk.v1beta1.SearchUrisResponse|SearchUrisResponse}. + * Please see the {@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/web_risk_service_v1_beta1.search_uris.js + * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_async + */ + searchUris( + request?: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|undefined, {}|undefined + ]>; + searchUris( + request: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, + {}|null|undefined>): void; + searchUris( + request: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, + {}|null|undefined>): void; + searchUris( + request?: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.searchUris(request, options, callback); + } +/** + * Gets the full hashes that match the requested hash prefix. + * This is used after a hash prefix is looked up in a threatList + * and there is a match. The client side threatList only holds partial hashes + * so the client must query this method to determine if there is a full + * hash match of a threat. + * + * @param {Object} request + * The request object that will be sent. + * @param {Buffer} request.hashPrefix + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * @param {number[]} request.threatTypes + * Required. The ThreatLists to search in. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.webrisk.v1beta1.SearchHashesResponse|SearchHashesResponse}. + * Please see the {@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/web_risk_service_v1_beta1.search_hashes.js + * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_async + */ + searchHashes( + request?: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|undefined, {}|undefined + ]>; + searchHashes( + request: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, + {}|null|undefined>): void; + searchHashes( + request: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, + {}|null|undefined>): void; + searchHashes( + request?: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.searchHashes(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.webRiskServiceV1Beta1Stub && !this._terminated) { + return this.webRiskServiceV1Beta1Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client_config.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client_config.json new file mode 100644 index 00000000000..669c2233b29 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client_config.json @@ -0,0 +1,41 @@ +{ + "interfaces": { + "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1": { + "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": { + "ComputeThreatListDiff": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SearchUris": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SearchHashes": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_proto_list.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_proto_list.json new file mode 100644 index 00000000000..9b9d46584be --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/webrisk/v1beta1/webrisk.proto" +] diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..4655e7378ed --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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 webrisk = require('@google-cloud/web-risk'); + +function main() { + const webRiskServiceV1Beta1Client = new webrisk.WebRiskServiceV1Beta1Client(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..35c735b60e9 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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 {WebRiskServiceV1Beta1Client} from '@google-cloud/web-risk'; + +// check that the client class type name can be used +function doStuffWithWebRiskServiceV1Beta1Client(client: WebRiskServiceV1Beta1Client) { + client.close(); +} + +function main() { + // check that the client instance can be created + const webRiskServiceV1Beta1Client = new WebRiskServiceV1Beta1Client(); + doStuffWithWebRiskServiceV1Beta1Client(webRiskServiceV1Beta1Client); +} + +main(); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1beta1/test/gapic_web_risk_service_v1_beta1_v1beta1.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/test/gapic_web_risk_service_v1_beta1_v1beta1.ts new file mode 100644 index 00000000000..f23b77476ab --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/v1beta1/test/gapic_web_risk_service_v1_beta1_v1beta1.ts @@ -0,0 +1,375 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 webriskservicev1beta1Module 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.WebRiskServiceV1Beta1Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); + await client.initialize(); + assert(client.webRiskServiceV1Beta1Stub); + }); + + it('has close method for the initialized client', done => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.webRiskServiceV1Beta1Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + 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 webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + 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('computeThreatListDiff', () => { + it('invokes computeThreatListDiff without error', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse() + ); + client.innerApiCalls.computeThreatListDiff = stubSimpleCall(expectedResponse); + const [response] = await client.computeThreatListDiff(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes computeThreatListDiff without error using callback', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse() + ); + client.innerApiCalls.computeThreatListDiff = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.computeThreatListDiff( + request, + (err?: Error|null, result?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes computeThreatListDiff with error', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.computeThreatListDiff = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.computeThreatListDiff(request), expectedError); + }); + + it('invokes computeThreatListDiff with closed client', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.computeThreatListDiff(request), expectedError); + }); + }); + + describe('searchUris', () => { + it('invokes searchUris without error', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisResponse() + ); + client.innerApiCalls.searchUris = stubSimpleCall(expectedResponse); + const [response] = await client.searchUris(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchUris without error using callback', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisResponse() + ); + client.innerApiCalls.searchUris = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchUris( + request, + (err?: Error|null, result?: protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchUris with error', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.searchUris = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchUris(request), expectedError); + }); + + it('invokes searchUris with closed client', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.searchUris(request), expectedError); + }); + }); + + describe('searchHashes', () => { + it('invokes searchHashes without error', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesResponse() + ); + client.innerApiCalls.searchHashes = stubSimpleCall(expectedResponse); + const [response] = await client.searchHashes(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchHashes without error using callback', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesResponse() + ); + client.innerApiCalls.searchHashes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchHashes( + request, + (err?: Error|null, result?: protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchHashes with error', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.searchHashes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchHashes(request), expectedError); + }); + + it('invokes searchHashes with closed client', async () => { + const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.searchHashes(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/webpack.config.js new file mode 100644 index 00000000000..9179bba0e0a --- /dev/null +++ b/owl-bot-staging/google-cloud-webrisk/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: 'WebRiskServiceV1Beta1', + filename: './web-risk-service-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-websecurityscanner/v1/.eslintignore b/owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintrc.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/.gitignore b/owl-bot-staging/google-cloud-websecurityscanner/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1/.jsdoc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/.jsdoc.js new file mode 100644 index 00000000000..efbbc504438 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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/web-security-scanner', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/.mocharc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1/.prettierrc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1/README.md b/owl-bot-staging/google-cloud-websecurityscanner/v1/README.md new file mode 100644 index 00000000000..727d3b68aef --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/README.md @@ -0,0 +1 @@ +Websecurityscanner: Nodejs Client diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/package.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/package.json new file mode 100644 index 00000000000..e7d7667cbd2 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/web-security-scanner", + "version": "0.1.0", + "description": "Websecurityscanner client for Node.js", + "repository": "googleapis/nodejs-websecurityscanner", + "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 websecurityscanner", + "websecurityscanner", + "web security scanner" + ], + "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-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto new file mode 100644 index 00000000000..6b8f8df3b62 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto @@ -0,0 +1,40 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.websecurityscanner.v1; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "CrawledUrlProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web +// Security Scanner Service crawls the web applications, following all links +// within the scope of sites, to find the URLs to test against. +message CrawledUrl { + // Output only. The http method of the request that was used to visit the URL, in + // uppercase. + string http_method = 1; + + // Output only. The URL that was crawled. + string url = 2; + + // Output only. The body of the request that was used to visit the URL. + string body = 3; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding.proto new file mode 100644 index 00000000000..0226bbf54c0 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding.proto @@ -0,0 +1,122 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.websecurityscanner.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1/finding_addon.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "FindingProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// A Finding resource represents a vulnerability instance identified during a +// ScanRun. +message Finding { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/Finding" + pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" + }; + + // The severity level of a vulnerability. + enum Severity { + // No severity specified. The default value. + SEVERITY_UNSPECIFIED = 0; + + // Critical severity. + CRITICAL = 1; + + // High severity. + HIGH = 2; + + // Medium severity. + MEDIUM = 3; + + // Low severity. + LOW = 4; + } + + // Output only. The resource name of the Finding. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + // The finding IDs are generated by the system. + string name = 1; + + // Output only. The type of the Finding. + // Detailed and up-to-date information on findings can be found here: + // https://cloud.google.com/security-command-center/docs/how-to-remediate-web-security-scanner-findings + string finding_type = 2; + + // Output only. The severity level of the reported vulnerability. + Severity severity = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The http method of the request that triggered the vulnerability, in + // uppercase. + string http_method = 3; + + // Output only. The URL produced by the server-side fuzzer and used in the request that + // triggered the vulnerability. + string fuzzed_url = 4; + + // Output only. The body of the request that triggered the vulnerability. + string body = 5; + + // Output only. The description of the vulnerability. + string description = 6; + + // Output only. The URL containing human-readable payload that user can leverage to + // reproduce the vulnerability. + string reproduction_url = 7; + + // Output only. If the vulnerability was originated from nested IFrame, the immediate + // parent IFrame is reported. + string frame_url = 8; + + // Output only. The URL where the browser lands when the vulnerability is detected. + string final_url = 9; + + // Output only. The tracking ID uniquely identifies a vulnerability instance across + // multiple ScanRuns. + string tracking_id = 10; + + // Output only. An addon containing information reported for a vulnerability with an HTML + // form, if any. + Form form = 16; + + // Output only. An addon containing information about outdated libraries. + OutdatedLibrary outdated_library = 11; + + // Output only. An addon containing detailed information regarding any resource causing the + // vulnerability such as JavaScript sources, image, audio files, etc. + ViolatingResource violating_resource = 12; + + // Output only. An addon containing information about vulnerable or missing HTTP headers. + VulnerableHeaders vulnerable_headers = 15; + + // Output only. An addon containing information about request parameters which were found + // to be vulnerable. + VulnerableParameters vulnerable_parameters = 13; + + // Output only. An addon containing information reported for an XSS, if any. + Xss xss = 14; + + // Output only. An addon containing information reported for an XXE, if any. + Xxe xxe = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto new file mode 100644 index 00000000000..409a7db542e --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto @@ -0,0 +1,166 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.websecurityscanner.v1; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "FindingAddonProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// ! Information about a vulnerability with an HTML. +message Form { + // ! The URI where to send the form when it's submitted. + string action_uri = 1; + + // ! The names of form fields related to the vulnerability. + repeated string fields = 2; +} + +// Information reported for an outdated library. +message OutdatedLibrary { + // The name of the outdated library. + string library_name = 1; + + // The version number. + string version = 2; + + // URLs to learn more information about the vulnerabilities in the library. + repeated string learn_more_urls = 3; +} + +// Information regarding any resource causing the vulnerability such +// as JavaScript sources, image, audio files, etc. +message ViolatingResource { + // The MIME type of this resource. + string content_type = 1; + + // URL of this violating resource. + string resource_url = 2; +} + +// Information about vulnerable request parameters. +message VulnerableParameters { + // The vulnerable parameter names. + repeated string parameter_names = 1; +} + +// Information about vulnerable or missing HTTP Headers. +message VulnerableHeaders { + // Describes a HTTP Header. + message Header { + // Header name. + string name = 1; + + // Header value. + string value = 2; + } + + // List of vulnerable headers. + repeated Header headers = 1; + + // List of missing headers. + repeated Header missing_headers = 2; +} + +// Information reported for an XSS. +message Xss { + // Types of XSS attack vector. + enum AttackVector { + // Unknown attack vector. + ATTACK_VECTOR_UNSPECIFIED = 0; + + // The attack comes from fuzzing the browser's localStorage. + LOCAL_STORAGE = 1; + + // The attack comes from fuzzing the browser's sessionStorage. + SESSION_STORAGE = 2; + + // The attack comes from fuzzing the window's name property. + WINDOW_NAME = 3; + + // The attack comes from fuzzing the referrer property. + REFERRER = 4; + + // The attack comes from fuzzing an input element. + FORM_INPUT = 5; + + // The attack comes from fuzzing the browser's cookies. + COOKIE = 6; + + // The attack comes from hijacking the post messaging mechanism. + POST_MESSAGE = 7; + + // The attack comes from fuzzing parameters in the url. + GET_PARAMETERS = 8; + + // The attack comes from fuzzing the fragment in the url. + URL_FRAGMENT = 9; + + // The attack comes from fuzzing the HTML comments. + HTML_COMMENT = 10; + + // The attack comes from fuzzing the POST parameters. + POST_PARAMETERS = 11; + + // The attack comes from fuzzing the protocol. + PROTOCOL = 12; + + // The attack comes from the server side and is stored. + STORED_XSS = 13; + + // The attack is a Same-Origin Method Execution attack via a GET parameter. + SAME_ORIGIN = 14; + + // The attack payload is received from a third-party host via a URL that is + // user-controllable + USER_CONTROLLABLE_URL = 15; + } + + // Stack traces leading to the point where the XSS occurred. + repeated string stack_traces = 1; + + // An error message generated by a javascript breakage. + string error_message = 2; + + // The attack vector of the payload triggering this XSS. + AttackVector attack_vector = 3; + + // The reproduction url for the seeding POST request of a Stored XSS. + string stored_xss_seeding_url = 4; +} + +// Information reported for an XXE. +message Xxe { + // Locations within a request where XML was substituted. + enum Location { + // Unknown Location. + LOCATION_UNSPECIFIED = 0; + + // The XML payload replaced the complete request body. + COMPLETE_REQUEST_BODY = 1; + } + + // The XML string that triggered the XXE vulnerability. Non-payload values + // might be redacted. + string payload_value = 1; + + // Location within the request where the payload was placed. + Location payload_location = 2; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto new file mode 100644 index 00000000000..94a5e7ea6ce --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto @@ -0,0 +1,35 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.websecurityscanner.v1; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "FindingTypeStatsProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// A FindingTypeStats resource represents stats regarding a specific FindingType +// of Findings under a given ScanRun. +message FindingTypeStats { + // Output only. The finding type associated with the stats. + string finding_type = 1; + + // Output only. The count of findings belonging to this finding type. + int32 finding_count = 2; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto new file mode 100644 index 00000000000..12f3ece5848 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto @@ -0,0 +1,193 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.websecurityscanner.v1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanConfigProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// A ScanConfig resource contains the configurations to launch a scan. +message ScanConfig { + // Scan authentication configuration. + message Authentication { + // Describes authentication configuration that uses a Google account. + message GoogleAccount { + option deprecated = true; + + // Required. The user name of the Google account. + string username = 1; + + // Required. Input only. The password of the Google account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2; + } + + // Describes authentication configuration that uses a custom account. + message CustomAccount { + // Required. The user name of the custom account. + string username = 1; + + // Required. Input only. The password of the custom account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2; + + // Required. The login form URL of the website. + string login_url = 3; + } + + // Describes authentication configuration for Identity-Aware-Proxy (IAP). + message IapCredential { + // Describes authentication configuration when Web-Security-Scanner + // service account is added in Identity-Aware-Proxy (IAP) access policies. + message IapTestServiceAccountInfo { + // Required. Describes OAuth2 client id of resources protected by + // Identity-Aware-Proxy (IAP). + string target_audience_client_id = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Identity-Aware-Proxy (IAP) Authentication Configuration + oneof iap_credentials { + // Authentication configuration when Web-Security-Scanner service + // account is added in Identity-Aware-Proxy (IAP) access policies. + IapTestServiceAccountInfo iap_test_service_account_info = 1; + } + } + + // Required. + // Authentication configuration + oneof authentication { + // Authentication using a Google account. + GoogleAccount google_account = 1 [deprecated = true]; + + // Authentication using a custom account. + CustomAccount custom_account = 2; + + // Authentication using Identity-Aware-Proxy (IAP). + IapCredential iap_credential = 4; + } + } + + // Scan schedule configuration. + message Schedule { + // A timestamp indicates when the next run will be scheduled. The value is + // refreshed by the server after each run. If unspecified, it will default + // to current server time, which means the scan will be scheduled to start + // immediately. + google.protobuf.Timestamp schedule_time = 1; + + // Required. The duration of time between executions in days. + int32 interval_duration_days = 2; + } + + // Type of user agents used for scanning. + enum UserAgent { + // The user agent is unknown. Service will default to CHROME_LINUX. + USER_AGENT_UNSPECIFIED = 0; + + // Chrome on Linux. This is the service default if unspecified. + CHROME_LINUX = 1; + + // Chrome on Android. + CHROME_ANDROID = 2; + + // Safari on IPhone. + SAFARI_IPHONE = 3; + } + + // Scan risk levels supported by Web Security Scanner. LOW impact + // scanning will minimize requests with the potential to modify data. To + // achieve the maximum scan coverage, NORMAL risk level is recommended. + enum RiskLevel { + // Use default, which is NORMAL. + RISK_LEVEL_UNSPECIFIED = 0; + + // Normal scanning (Recommended) + NORMAL = 1; + + // Lower impact scanning + LOW = 2; + } + + // Controls export of scan configurations and results to Security + // Command Center. + enum ExportToSecurityCommandCenter { + // Use default, which is ENABLED. + EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; + + // Export results of this scan to Security Command Center. + ENABLED = 1; + + // Do not export results of this scan to Security Command Center. + DISABLED = 2; + } + + // The resource name of the ScanConfig. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + // generated by the system. + string name = 1; + + // Required. The user provided display name of the ScanConfig. + string display_name = 2; + + // The maximum QPS during scanning. A valid value ranges from 5 to 20 + // inclusively. If the field is unspecified or its value is set 0, server will + // default to 15. Other values outside of [5, 20] range will be rejected with + // INVALID_ARGUMENT error. + int32 max_qps = 3; + + // Required. The starting URLs from which the scanner finds site pages. + repeated string starting_urls = 4; + + // The authentication configuration. If specified, service will use the + // authentication configuration during scanning. + Authentication authentication = 5; + + // The user agent used during scanning. + UserAgent user_agent = 6; + + // The excluded URL patterns as described in + // https://cloud.google.com/security-command-center/docs/how-to-use-web-security-scanner#excluding_urls + repeated string blacklist_patterns = 7; + + // The schedule of the ScanConfig. + Schedule schedule = 8; + + // Controls export of scan configurations and results to Security + // Command Center. + ExportToSecurityCommandCenter export_to_security_command_center = 10; + + // The risk level selected for the scan + RiskLevel risk_level = 12; + + // Whether the scan config is managed by Web Security Scanner, output + // only. + bool managed_scan = 13; + + // Whether the scan configuration has enabled static IP address scan feature. + // If enabled, the scanner will access applications from static IP addresses. + bool static_ip_scan = 14; + + // Whether to keep scanning even if most requests return HTTP error codes. + bool ignore_http_status_errors = 15; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto new file mode 100644 index 00000000000..96fe523b677 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto @@ -0,0 +1,189 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.websecurityscanner.v1; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanConfigErrorProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// Defines a custom error message used by CreateScanConfig and UpdateScanConfig +// APIs when scan configuration validation fails. It is also reported as part of +// a ScanRunErrorTrace message if scan validation fails due to a scan +// configuration error. +message ScanConfigError { + // Output only. + // Defines an error reason code. + // Next id: 44 + enum Code { + option allow_alias = true; + + // There is no error. + CODE_UNSPECIFIED = 0; + + // There is no error. + OK = 0; + + // Indicates an internal server error. + // Please DO NOT USE THIS ERROR CODE unless the root cause is truly unknown. + INTERNAL_ERROR = 1; + + // One of the seed URLs is an App Engine URL but we cannot validate the scan + // settings due to an App Engine API backend error. + APPENGINE_API_BACKEND_ERROR = 2; + + // One of the seed URLs is an App Engine URL but we cannot access the + // App Engine API to validate scan settings. + APPENGINE_API_NOT_ACCESSIBLE = 3; + + // One of the seed URLs is an App Engine URL but the Default Host of the + // App Engine is not set. + APPENGINE_DEFAULT_HOST_MISSING = 4; + + // Google corporate accounts can not be used for scanning. + CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; + + // The account of the scan creator can not be used for scanning. + CANNOT_USE_OWNER_ACCOUNT = 7; + + // This scan targets Compute Engine, but we cannot validate scan settings + // due to a Compute Engine API backend error. + COMPUTE_API_BACKEND_ERROR = 8; + + // This scan targets Compute Engine, but we cannot access the Compute Engine + // API to validate the scan settings. + COMPUTE_API_NOT_ACCESSIBLE = 9; + + // The Custom Login URL does not belong to the current project. + CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; + + // The Custom Login URL is malformed (can not be parsed). + CUSTOM_LOGIN_URL_MALFORMED = 11; + + // The Custom Login URL is mapped to a non-routable IP address in DNS. + CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; + + // The Custom Login URL is mapped to an IP address which is not reserved for + // the current project. + CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; + + // The Custom Login URL has a non-routable IP address. + CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; + + // The Custom Login URL has an IP address which is not reserved for the + // current project. + CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; + + // Another scan with the same name (case-sensitive) already exists. + DUPLICATE_SCAN_NAME = 16; + + // A field is set to an invalid value. + INVALID_FIELD_VALUE = 18; + + // There was an error trying to authenticate to the scan target. + FAILED_TO_AUTHENTICATE_TO_TARGET = 19; + + // Finding type value is not specified in the list findings request. + FINDING_TYPE_UNSPECIFIED = 20; + + // Scan targets Compute Engine, yet current project was not whitelisted for + // Google Compute Engine Scanning Alpha access. + FORBIDDEN_TO_SCAN_COMPUTE = 21; + + // User tries to update managed scan + FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; + + // The supplied filter is malformed. For example, it can not be parsed, does + // not have a filter type in expression, or the same filter type appears + // more than once. + MALFORMED_FILTER = 22; + + // The supplied resource name is malformed (can not be parsed). + MALFORMED_RESOURCE_NAME = 23; + + // The current project is not in an active state. + PROJECT_INACTIVE = 24; + + // A required field is not set. + REQUIRED_FIELD = 25; + + // Project id, scanconfig id, scanrun id, or finding id are not consistent + // with each other in resource name. + RESOURCE_NAME_INCONSISTENT = 26; + + // The scan being requested to start is already running. + SCAN_ALREADY_RUNNING = 27; + + // The scan that was requested to be stopped is not running. + SCAN_NOT_RUNNING = 28; + + // One of the seed URLs does not belong to the current project. + SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; + + // One of the seed URLs is malformed (can not be parsed). + SEED_URL_MALFORMED = 30; + + // One of the seed URLs is mapped to a non-routable IP address in DNS. + SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; + + // One of the seed URLs is mapped to an IP address which is not reserved + // for the current project. + SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; + + // One of the seed URLs has on-routable IP address. + SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; + + // One of the seed URLs has an IP address that is not reserved + // for the current project. + SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; + + // The Web Security Scanner service account is not configured under the + // project. + SERVICE_ACCOUNT_NOT_CONFIGURED = 36; + + // A project has reached the maximum number of scans. + TOO_MANY_SCANS = 37; + + // Resolving the details of the current project fails. + UNABLE_TO_RESOLVE_PROJECT_INFO = 38; + + // One or more blacklist patterns were in the wrong format. + UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; + + // The supplied filter is not supported. + UNSUPPORTED_FILTER = 40; + + // The supplied finding type is not supported. For example, we do not + // provide findings of the given finding type. + UNSUPPORTED_FINDING_TYPE = 41; + + // The URL scheme of one or more of the supplied URLs is not supported. + UNSUPPORTED_URL_SCHEME = 42; + } + + // Output only. Indicates the reason code for a configuration failure. + Code code = 1; + + // Output only. Indicates the full name of the ScanConfig field that triggers this error, + // for example "scan_config.max_qps". This field is provided for + // troubleshooting purposes only and its actual value can change in the + // future. + string field_name = 2; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto new file mode 100644 index 00000000000..70f5b452316 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto @@ -0,0 +1,110 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.websecurityscanner.v1; + +import "google/cloud/websecurityscanner/v1/scan_run_error_trace.proto"; +import "google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// A ScanRun is a output-only resource representing an actual run of the scan. +// Next id: 12 +message ScanRun { + // Types of ScanRun execution state. + enum ExecutionState { + // Represents an invalid state caused by internal server error. This value + // should never be returned. + EXECUTION_STATE_UNSPECIFIED = 0; + + // The scan is waiting in the queue. + QUEUED = 1; + + // The scan is in progress. + SCANNING = 2; + + // The scan is either finished or stopped by user. + FINISHED = 3; + } + + // Types of ScanRun result state. + enum ResultState { + // Default value. This value is returned when the ScanRun is not yet + // finished. + RESULT_STATE_UNSPECIFIED = 0; + + // The scan finished without errors. + SUCCESS = 1; + + // The scan finished with errors. + ERROR = 2; + + // The scan was terminated by user. + KILLED = 3; + } + + // Output only. The resource name of the ScanRun. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + // The ScanRun IDs are generated by the system. + string name = 1; + + // Output only. The execution state of the ScanRun. + ExecutionState execution_state = 2; + + // Output only. The result state of the ScanRun. This field is only available after the + // execution state reaches "FINISHED". + ResultState result_state = 3; + + // Output only. The time at which the ScanRun started. + google.protobuf.Timestamp start_time = 4; + + // Output only. The time at which the ScanRun reached termination state - that the ScanRun + // is either finished or stopped by user. + google.protobuf.Timestamp end_time = 5; + + // Output only. The number of URLs crawled during this ScanRun. If the scan is in progress, + // the value represents the number of URLs crawled up to now. + int64 urls_crawled_count = 6; + + // Output only. The number of URLs tested during this ScanRun. If the scan is in progress, + // the value represents the number of URLs tested up to now. The number of + // URLs tested is usually larger than the number URLS crawled because + // typically a crawled URL is tested with multiple test payloads. + int64 urls_tested_count = 7; + + // Output only. Whether the scan run has found any vulnerabilities. + bool has_vulnerabilities = 8; + + // Output only. The percentage of total completion ranging from 0 to 100. + // If the scan is in queue, the value is 0. + // If the scan is running, the value ranges from 0 to 100. + // If the scan is finished, the value is 100. + int32 progress_percent = 9; + + // Output only. If result_state is an ERROR, this field provides the primary reason for + // scan's termination and more details, if such are available. + ScanRunErrorTrace error_trace = 10; + + // Output only. A list of warnings, if such are encountered during this scan run. + repeated ScanRunWarningTrace warning_traces = 11; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto new file mode 100644 index 00000000000..8f906a57f0d --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.websecurityscanner.v1; + +import "google/cloud/websecurityscanner/v1/scan_config_error.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunErrorTraceProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// Output only. +// Defines an error trace message for a ScanRun. +message ScanRunErrorTrace { + // Output only. + // Defines an error reason code. + // Next id: 8 + enum Code { + // Default value is never used. + CODE_UNSPECIFIED = 0; + + // Indicates that the scan run failed due to an internal server error. + INTERNAL_ERROR = 1; + + // Indicates a scan configuration error, usually due to outdated ScanConfig + // settings, such as starting_urls or the DNS configuration. + SCAN_CONFIG_ISSUE = 2; + + // Indicates an authentication error, usually due to outdated ScanConfig + // authentication settings. + AUTHENTICATION_CONFIG_ISSUE = 3; + + // Indicates a scan operation timeout, usually caused by a very large site. + TIMED_OUT_WHILE_SCANNING = 4; + + // Indicates that a scan encountered excessive redirects, either to + // authentication or some other page outside of the scan scope. + TOO_MANY_REDIRECTS = 5; + + // Indicates that a scan encountered numerous errors from the web site + // pages. When available, most_common_http_error_code field indicates the + // most common HTTP error code encountered during the scan. + TOO_MANY_HTTP_ERRORS = 6; + } + + // Output only. Indicates the error reason code. + Code code = 1; + + // Output only. If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + // message encountered during scan configuration validation that is performed + // before each scan run. + ScanConfigError scan_config_error = 2; + + // Output only. If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + // common HTTP error code, if such is available. For example, if this code is + // 404, the scan has encountered too many NOT_FOUND responses. + int32 most_common_http_error_code = 3; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_log.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_log.proto new file mode 100644 index 00000000000..c1692674de1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_log.proto @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.websecurityscanner.v1; + +import "google/cloud/websecurityscanner/v1/scan_run.proto"; +import "google/cloud/websecurityscanner/v1/scan_run_error_trace.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunLogProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// A ScanRunLog is an output-only proto used for Stackdriver customer logging. +// It is used for logs covering the start and end of scan pipelines. +// Other than an added summary, this is a subset of the ScanRun. +// Representation in logs is either a proto Struct, or converted to JSON. +// Next id: 9 +message ScanRunLog { + // Human friendly message about the event. + string summary = 1; + + // The resource name of the ScanRun being logged. + string name = 2; + + // The execution state of the ScanRun. + google.cloud.websecurityscanner.v1.ScanRun.ExecutionState execution_state = 3; + + // The result state of the ScanRun. + google.cloud.websecurityscanner.v1.ScanRun.ResultState result_state = 4; + + int64 urls_crawled_count = 5; + + int64 urls_tested_count = 6; + + bool has_findings = 7; + + google.cloud.websecurityscanner.v1.ScanRunErrorTrace error_trace = 8; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto new file mode 100644 index 00000000000..db9d9330055 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.websecurityscanner.v1; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunWarningTraceProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// Output only. +// Defines a warning trace message for ScanRun. Warning traces provide customers +// with useful information that helps make the scanning process more effective. +message ScanRunWarningTrace { + // Output only. + // Defines a warning message code. + // Next id: 6 + enum Code { + // Default value is never used. + CODE_UNSPECIFIED = 0; + + // Indicates that a scan discovered an unexpectedly low number of URLs. This + // is sometimes caused by complex navigation features or by using a single + // URL for numerous pages. + INSUFFICIENT_CRAWL_RESULTS = 1; + + // Indicates that a scan discovered too many URLs to test, or excessive + // redundant URLs. + TOO_MANY_CRAWL_RESULTS = 2; + + // Indicates that too many tests have been generated for the scan. Customer + // should try reducing the number of starting URLs, increasing the QPS rate, + // or narrowing down the scope of the scan using the excluded patterns. + TOO_MANY_FUZZ_TASKS = 3; + + // Indicates that a scan is blocked by IAP. + BLOCKED_BY_IAP = 4; + + // Indicates that no seeds is found for a scan + NO_STARTING_URL_FOUND_FOR_MANAGED_SCAN = 5; + } + + // Output only. Indicates the warning code. + Code code = 1; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto new file mode 100644 index 00000000000..141f432c190 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto @@ -0,0 +1,337 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.websecurityscanner.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/cloud/websecurityscanner/v1/crawled_url.proto"; +import "google/cloud/websecurityscanner/v1/finding.proto"; +import "google/cloud/websecurityscanner/v1/finding_type_stats.proto"; +import "google/cloud/websecurityscanner/v1/scan_config.proto"; +import "google/cloud/websecurityscanner/v1/scan_run.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "WebSecurityScannerProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// Web Security Scanner Service identifies security vulnerabilities in web +// applications hosted on Google Cloud. It crawls your application, and +// attempts to exercise as many user inputs and event handlers as possible. +service WebSecurityScanner { + option (google.api.default_host) = "websecurityscanner.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new ScanConfig. + rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/scanConfigs" + body: "scan_config" + }; + } + + // Deletes an existing ScanConfig and its child resources. + rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/scanConfigs/*}" + }; + } + + // Gets a ScanConfig. + rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/scanConfigs/*}" + }; + } + + // Lists ScanConfigs under a given project. + rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/scanConfigs" + }; + } + + // Updates a ScanConfig. This method support partial update of a ScanConfig. + rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + patch: "/v1/{scan_config.name=projects/*/scanConfigs/*}" + body: "scan_config" + }; + } + + // Start a ScanRun according to the given ScanConfig. + rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1/{name=projects/*/scanConfigs/*}:start" + body: "*" + }; + } + + // Gets a ScanRun. + rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + get: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*}" + }; + } + + // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + // stop time. + rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/scanConfigs/*}/scanRuns" + }; + } + + // Stops a ScanRun. The stopped ScanRun is returned. + rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" + body: "*" + }; + } + + // List CrawledUrls under a given ScanRun. + rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" + }; + } + + // Gets a Finding. + rpc GetFinding(GetFindingRequest) returns (Finding) { + option (google.api.http) = { + get: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" + }; + } + + // List Findings under a given ScanRun. + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" + }; + } + + // List all FindingTypeStats under a given ScanRun. + rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" + }; + } +} + +// Request for the `CreateScanConfig` method. +message CreateScanConfigRequest { + // Required. The parent resource name where the scan is created, which should be a + // project resource name in the format 'projects/{projectId}'. + string parent = 1; + + // Required. The ScanConfig to be created. + ScanConfig scan_config = 2; +} + +// Request for the `DeleteScanConfig` method. +message DeleteScanConfigRequest { + // Required. The resource name of the ScanConfig to be deleted. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1; +} + +// Request for the `GetScanConfig` method. +message GetScanConfigRequest { + // Required. The resource name of the ScanConfig to be returned. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1; +} + +// Request for the `ListScanConfigs` method. +message ListScanConfigsRequest { + // Required. The parent resource name, which should be a project resource name in the + // format 'projects/{projectId}'. + string parent = 1; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanConfigs to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Request for the `UpdateScanConfigRequest` method. +message UpdateScanConfigRequest { + // Required. The ScanConfig to be updated. The name field must be set to identify the + // resource to be updated. The values of fields not covered by the mask + // will be ignored. + ScanConfig scan_config = 2; + + // Required. The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 3; +} + +// Response for the `ListScanConfigs` method. +message ListScanConfigsResponse { + // The list of ScanConfigs returned. + repeated ScanConfig scan_configs = 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 for the `StartScanRun` method. +message StartScanRunRequest { + // Required. The resource name of the ScanConfig to be used. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1; +} + +// Request for the `GetScanRun` method. +message GetScanRunRequest { + // Required. The resource name of the ScanRun to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1; +} + +// Request for the `ListScanRuns` method. +message ListScanRunsRequest { + // Required. The parent resource name, which should be a scan resource name in the + // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string parent = 1; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanRuns to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListScanRuns` method. +message ListScanRunsResponse { + // The list of ScanRuns returned. + repeated ScanRun scan_runs = 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 for the `StopScanRun` method. +message StopScanRunRequest { + // Required. The resource name of the ScanRun to be stopped. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1; +} + +// Request for the `ListCrawledUrls` method. +message ListCrawledUrlsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of CrawledUrls to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListCrawledUrls` method. +message ListCrawledUrlsResponse { + // The list of CrawledUrls returned. + repeated CrawledUrl crawled_urls = 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 for the `GetFinding` method. +message GetFindingRequest { + // Required. The resource name of the Finding to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + string name = 1; +} + +// Request for the `ListFindings` method. +message ListFindingsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1; + + // The filter expression. The expression must be in the format: + // . + // Supported field: 'finding_type'. + // Supported operator: '='. + string filter = 2; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 3; + + // The maximum number of Findings to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 4; +} + +// Response for the `ListFindings` method. +message ListFindingsResponse { + // The list of Findings returned. + repeated Finding findings = 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 for the `ListFindingTypeStats` method. +message ListFindingTypeStatsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1; +} + +// Response for the `ListFindingTypeStats` method. +message ListFindingTypeStatsResponse { + // The list of FindingTypeStats returned. + repeated FindingTypeStats finding_type_stats = 1; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json new file mode 100644 index 00000000000..340564e435c --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json @@ -0,0 +1,579 @@ +{ + "clientLibrary": { + "name": "nodejs-websecurityscanner", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.websecurityscanner.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async", + "title": "WebSecurityScanner createScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new ScanConfig.", + "canonical": true, + "file": "web_security_scanner.create_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.CreateScanConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1.ScanConfig" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.CreateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async", + "title": "WebSecurityScanner deleteScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing ScanConfig and its child resources.", + "canonical": true, + "file": "web_security_scanner.delete_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.DeleteScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.DeleteScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async", + "title": "WebSecurityScanner getScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.get_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async", + "title": "WebSecurityScanner listScanConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanConfigs under a given project.", + "canonical": true, + "file": "web_security_scanner.list_scan_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ListScanConfigsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanConfigs", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async", + "title": "WebSecurityScanner updateScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.update_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.UpdateScanConfig", + "async": true, + "parameters": [ + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1.ScanConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.UpdateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async", + "title": "WebSecurityScanner startScanRun Sample", + "origin": "API_DEFINITION", + "description": " Start a ScanRun according to the given ScanConfig.", + "canonical": true, + "file": "web_security_scanner.start_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StartScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StartScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async", + "title": "WebSecurityScanner getScanRun Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanRun.", + "canonical": true, + "file": "web_security_scanner.get_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async", + "title": "WebSecurityScanner listScanRuns Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", + "canonical": true, + "file": "web_security_scanner.list_scan_runs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanRuns", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ListScanRunsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanRuns", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async", + "title": "WebSecurityScanner stopScanRun Sample", + "origin": "API_DEFINITION", + "description": " Stops a ScanRun. The stopped ScanRun is returned.", + "canonical": true, + "file": "web_security_scanner.stop_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StopScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StopScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async", + "title": "WebSecurityScanner listCrawledUrls Sample", + "origin": "API_DEFINITION", + "description": " List CrawledUrls under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_crawled_urls.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListCrawledUrls", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ListCrawledUrlsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListCrawledUrls", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async", + "title": "WebSecurityScanner getFinding Sample", + "origin": "API_DEFINITION", + "description": " Gets a Finding.", + "canonical": true, + "file": "web_security_scanner.get_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetFinding", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.Finding", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetFinding", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async", + "title": "WebSecurityScanner listFindings Sample", + "origin": "API_DEFINITION", + "description": " List Findings under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ListFindingsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindings", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async", + "title": "WebSecurityScanner listFindingTypeStats Sample", + "origin": "API_DEFINITION", + "description": " List all FindingTypeStats under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_finding_type_stats.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindingTypeStats", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindingTypeStats", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.create_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.create_scan_config.js new file mode 100644 index 00000000000..2291e68e828 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.create_scan_config.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * Required. The ScanConfig to be created. + */ + // const scanConfig = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callCreateScanConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.createScanConfig(request); + console.log(response); + } + + callCreateScanConfig(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js new file mode 100644 index 00000000000..abf67d7997a --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.delete_scan_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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callDeleteScanConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.deleteScanConfig(request); + console.log(response); + } + + callDeleteScanConfig(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_finding.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_finding.js new file mode 100644 index 00000000000..61b49e6b8ea --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_finding.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetFinding() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.getFinding(request); + console.log(response); + } + + callGetFinding(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_config.js new file mode 100644 index 00000000000..343e7fe913b --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.getScanConfig(request); + console.log(response); + } + + callGetScanConfig(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_run.js new file mode 100644 index 00000000000..1679bce94a2 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_run.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanRun() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.getScanRun(request); + console.log(response); + } + + callGetScanRun(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js new file mode 100644 index 00000000000..a0fd84bfde6 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListCrawledUrls() { + // Construct request + const request = { + }; + + // Run request + const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCrawledUrls(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js new file mode 100644 index 00000000000..904991555ff --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindingTypeStats() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.listFindingTypeStats(request); + console.log(response); + } + + callListFindingTypeStats(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_findings.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_findings.js new file mode 100644 index 00000000000..49de41eb658 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_findings.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + */ + // const filter = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindings() { + // Construct request + const request = { + }; + + // Run request + const iterable = await websecurityscannerClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_configs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_configs.js new file mode 100644 index 00000000000..b3964c340c1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_configs.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a project resource name in the + * format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanConfigs() { + // Construct request + const request = { + }; + + // Run request + const iterable = await websecurityscannerClient.listScanConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanConfigs(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_runs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_runs.js new file mode 100644 index 00000000000..1687f03082a --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_runs.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanRuns() { + // Construct request + const request = { + }; + + // Run request + const iterable = await websecurityscannerClient.listScanRunsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanRuns(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.start_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.start_scan_run.js new file mode 100644 index 00000000000..09e58a9b8e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.start_scan_run.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 websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStartScanRun() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.startScanRun(request); + console.log(response); + } + + callStartScanRun(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js new file mode 100644 index 00000000000..a68f02893b8 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.stop_scan_run.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStopScanRun() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.stopScanRun(request); + console.log(response); + } + + callStopScanRun(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.update_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.update_scan_config.js new file mode 100644 index 00000000000..7db724c3216 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.update_scan_config.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + */ + // const scanConfig = {} + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callUpdateScanConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.updateScanConfig(request); + console.log(response); + } + + callUpdateScanConfig(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/index.ts new file mode 100644 index 00000000000..f20f26e652e --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 WebSecurityScannerClient = v1.WebSecurityScannerClient; +type WebSecurityScannerClient = v1.WebSecurityScannerClient; +export {v1, WebSecurityScannerClient}; +export default {v1, WebSecurityScannerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..6c589c52cb4 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/gapic_metadata.json @@ -0,0 +1,169 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.websecurityscanner.v1", + "libraryPackage": "@google-cloud/web-security-scanner", + "services": { + "WebSecurityScanner": { + "clients": { + "grpc": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/index.ts new file mode 100644 index 00000000000..c4b9ebe89d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client.ts new file mode 100644 index 00000000000..a77369d182b --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client.ts @@ -0,0 +1,1810 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/web_security_scanner_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './web_security_scanner_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Web Security Scanner Service identifies security vulnerabilities in web + * applications hosted on Google Cloud. It crawls your application, and + * attempts to exercise as many user inputs and event handlers as possible. + * @class + * @memberof v1 + */ +export class WebSecurityScannerClient { + 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}; + webSecurityScannerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WebSecurityScannerClient. + * + * @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 WebSecurityScannerClient({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 WebSecurityScannerClient; + 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 = { + findingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' + ), + }; + + // 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 = { + listScanConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), + listScanRuns: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), + listCrawledUrls: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.websecurityscanner.v1.WebSecurityScanner', 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.webSecurityScannerStub) { + return this.webSecurityScannerStub; + } + + // Put together the "service stub" for + // google.cloud.websecurityscanner.v1.WebSecurityScanner. + this.webSecurityScannerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1.WebSecurityScanner') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.websecurityscanner.v1.WebSecurityScanner, + 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 webSecurityScannerStubMethods = + ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; + for (const methodName of webSecurityScannerStubMethods) { + const callPromise = this.webSecurityScannerStub.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.webSecurityScannerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'websecurityscanner.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 'websecurityscanner.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 -- + // ------------------- +/** + * Creates a new ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig + * Required. The ScanConfig 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.websecurityscanner.v1.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.create_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async + */ + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|undefined, {}|undefined + ]>; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createScanConfig(request, options, callback); + } +/** + * Deletes an existing ScanConfig and its child resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/web_security_scanner.delete_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async + */ + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|undefined, {}|undefined + ]>; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteScanConfig(request, options, callback); + } +/** + * Gets a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.get_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async + */ + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|undefined, {}|undefined + ]>; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getScanConfig(request, options, callback); + } +/** + * Updates a ScanConfig. This method support partial update of a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * 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.websecurityscanner.v1.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.update_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async + */ + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|undefined, {}|undefined + ]>; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scan_config.name': request.scanConfig!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateScanConfig(request, options, callback); + } +/** + * Start a ScanRun according to the given ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.start_scan_run.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async + */ + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|undefined, {}|undefined + ]>; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.startScanRun(request, options, callback); + } +/** + * Gets a ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.get_scan_run.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async + */ + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|undefined, {}|undefined + ]>; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getScanRun(request, options, callback); + } +/** + * Stops a ScanRun. The stopped ScanRun is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.stop_scan_run.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async + */ + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|undefined, {}|undefined + ]>; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.stopScanRun(request, options, callback); + } +/** + * Gets a Finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.Finding|Finding}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.get_finding.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async + */ + getFinding( + request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|undefined, {}|undefined + ]>; + getFinding( + request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFinding(request, options, callback); + } +/** + * List all FindingTypeStats under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.list_finding_type_stats.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async + */ + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|undefined, {}|undefined + ]>; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFindingTypeStats(request, options, callback); + } + + /** + * Lists ScanConfigs under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1.ScanConfig|ScanConfig}. + * 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 `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig[], + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse + ]>; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig>): void; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig>): void; + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig[], + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listScanConfigs(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 name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1.ScanConfig|ScanConfig} 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 `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanConfigsStream( + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + 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['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.createStream( + this.innerApiCalls.listScanConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanConfigs`, 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 name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1.ScanConfig|ScanConfig}. 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/web_security_scanner.list_scan_configs.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async + */ + listScanConfigsAsync( + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + 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['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.asyncIterate( + this.innerApiCalls['listScanConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + * stop time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1.ScanRun|ScanRun}. + * 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 `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun[], + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse + ]>; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun>): void; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun>): void; + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun[], + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listScanRuns(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 name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1.ScanRun|ScanRun} 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 `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanRunsStream( + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + 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['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.createStream( + this.innerApiCalls.listScanRuns as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanRuns`, 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 name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1.ScanRun|ScanRun}. 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/web_security_scanner.list_scan_runs.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async + */ + listScanRunsAsync( + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + 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['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.asyncIterate( + this.innerApiCalls['listScanRuns'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List CrawledUrls under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1.CrawledUrl|CrawledUrl}. + * 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 `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse + ]>; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): void; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): void; + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listCrawledUrls(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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1.CrawledUrl|CrawledUrl} 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 `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCrawledUrlsStream( + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + 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['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.createStream( + this.innerApiCalls.listCrawledUrls as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCrawledUrls`, 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1.CrawledUrl|CrawledUrl}. 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/web_security_scanner.list_crawled_urls.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async + */ + listCrawledUrlsAsync( + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + 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['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.asyncIterate( + this.innerApiCalls['listCrawledUrls'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List Findings under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1.Finding|Finding}. + * 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 `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFindings( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IFinding[], + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IFinding>): void; + listFindings( + request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IFinding>): void; + listFindings( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IFinding>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IFinding>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IFinding[], + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFindings(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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1.Finding|Finding} 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 `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFindingsStream( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + 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['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.createStream( + this.innerApiCalls.listFindings as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFindings`, 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1.Finding|Finding}. 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/web_security_scanner.list_findings.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + 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['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.asyncIterate( + this.innerApiCalls['listFindings'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified finding resource name string. + * + * @param {string} project + * @param {string} scan_config + * @param {string} scan_run + * @param {string} finding + * @returns {string} Resource name string. + */ + findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { + return this.pathTemplates.findingPathTemplate.render({ + project: project, + scan_config: scanConfig, + scan_run: scanRun, + finding: finding, + }); + } + + /** + * Parse the project from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).project; + } + + /** + * Parse the scan_config from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; + } + + /** + * Parse the scan_run from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_run. + */ + matchScanRunFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; + } + + /** + * Parse the finding from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).finding; + } + + /** + * 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.webSecurityScannerStub && !this._terminated) { + return this.webSecurityScannerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client_config.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client_config.json new file mode 100644 index 00000000000..2e226cb1ff0 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client_config.json @@ -0,0 +1,91 @@ +{ + "interfaces": { + "google.cloud.websecurityscanner.v1.WebSecurityScanner": { + "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": { + "CreateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanConfigs": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanRuns": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "StopScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListCrawledUrls": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetFinding": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindingTypeStats": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_proto_list.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_proto_list.json new file mode 100644 index 00000000000..627b52eed99 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_proto_list.json @@ -0,0 +1,13 @@ +[ + "../../protos/google/cloud/websecurityscanner/v1/crawled_url.proto", + "../../protos/google/cloud/websecurityscanner/v1/finding.proto", + "../../protos/google/cloud/websecurityscanner/v1/finding_addon.proto", + "../../protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto", + "../../protos/google/cloud/websecurityscanner/v1/scan_config.proto", + "../../protos/google/cloud/websecurityscanner/v1/scan_config_error.proto", + "../../protos/google/cloud/websecurityscanner/v1/scan_run.proto", + "../../protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto", + "../../protos/google/cloud/websecurityscanner/v1/scan_run_log.proto", + "../../protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto", + "../../protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto" +] diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..54b6f3aa5e5 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 websecurityscanner = require('@google-cloud/web-security-scanner'); + +function main() { + const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..3bd84309184 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; + +// check that the client class type name can be used +function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const webSecurityScannerClient = new WebSecurityScannerClient(); + doStuffWithWebSecurityScannerClient(webSecurityScannerClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/install.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1/test/gapic_web_security_scanner_v1.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/test/gapic_web_security_scanner_v1.ts new file mode 100644 index 00000000000..cec6a4650c4 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1/test/gapic_web_security_scanner_v1.ts @@ -0,0 +1,2210 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 websecurityscannerModule 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.WebSecurityScannerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = websecurityscannerModule.v1.WebSecurityScannerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = websecurityscannerModule.v1.WebSecurityScannerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = websecurityscannerModule.v1.WebSecurityScannerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + await client.initialize(); + assert(client.webSecurityScannerStub); + }); + + it('has close method for the initialized client', done => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.webSecurityScannerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + 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 websecurityscannerModule.v1.WebSecurityScannerClient({ + 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('createScanConfig', () => { + it('invokes createScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig() + ); + client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig() + ); + client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createScanConfig(request), expectedError); + }); + }); + + describe('deleteScanConfig', () => { + it('invokes deleteScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteScanConfig( + 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.deleteScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteScanConfig(request), expectedError); + }); + }); + + describe('getScanConfig', () => { + it('invokes getScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig() + ); + client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig() + ); + client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanConfig(request), expectedError); + }); + }); + + describe('updateScanConfig', () => { + it('invokes updateScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig() + ); + client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig() + ); + client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateScanConfig(request), expectedError); + }); + }); + + describe('startScanRun', () => { + it('invokes startScanRun without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun() + ); + client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.startScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun() + ); + client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startScanRun with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.startScanRun(request), expectedError); + const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.startScanRun(request), expectedError); + }); + }); + + describe('getScanRun', () => { + it('invokes getScanRun without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun() + ); + client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.getScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun() + ); + client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanRun with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanRun(request), expectedError); + const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanRun(request), expectedError); + }); + }); + + describe('stopScanRun', () => { + it('invokes stopScanRun without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun() + ); + client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.stopScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun() + ); + client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopScanRun with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.stopScanRun(request), expectedError); + const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.stopScanRun(request), expectedError); + }); + }); + + describe('getFinding', () => { + it('invokes getFinding without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding() + ); + client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); + const [response] = await client.getFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFinding without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding() + ); + client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFinding( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFinding with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFinding(request), expectedError); + const actualRequest = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFinding with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFinding(request), expectedError); + }); + }); + + describe('listFindingTypeStats', () => { + it('invokes listFindingTypeStats without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse() + ); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); + const [response] = await client.listFindingTypeStats(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse() + ); + client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindingTypeStats( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + }); + }); + + describe('listScanConfigs', () => { + it('invokes listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listScanConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigs without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { + 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.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listScanConfigsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = []; + const iterable = client.listScanConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listScanRuns', () => { + it('invokes listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); + const [response] = await client.listScanRuns(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRuns without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanRuns( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanRuns(request), expectedError); + const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRunsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + ]; + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { + 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.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listScanRunsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + ]; + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = []; + const iterable = client.listScanRunsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanRunsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listCrawledUrls', () => { + it('invokes listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); + const [response] = await client.listCrawledUrls(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrls without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCrawledUrls( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCrawledUrls(request), expectedError); + const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrlsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { + 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.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listCrawledUrlsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = []; + const iterable = client.listCrawledUrlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCrawledUrlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IFinding[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindings(request), expectedError); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.Finding) => { + 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.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFindingsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.Finding) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('finding', () => { + const fakePath = "/rendered/path/finding"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + scan_run: "scanRunValue", + finding: "findingValue", + }; + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.findingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.findingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('findingPath', () => { + const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFindingName', () => { + const result = client.matchProjectFromFindingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromFindingName', () => { + const result = client.matchScanConfigFromFindingName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanRunFromFindingName', () => { + const result = client.matchScanRunFromFindingName(fakePath); + assert.strictEqual(result, "scanRunValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFindingName', () => { + const result = client.matchFindingFromFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/tsconfig.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1/webpack.config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/webpack.config.js new file mode 100644 index 00000000000..ad3467d60d6 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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: 'WebSecurityScanner', + filename: './web-security-scanner.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-websecurityscanner/v1alpha/.eslintignore b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintrc.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.gitignore b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1alpha/.jsdoc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.jsdoc.js new file mode 100644 index 00000000000..efbbc504438 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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/web-security-scanner', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.mocharc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1alpha/.prettierrc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1alpha/README.md b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/README.md new file mode 100644 index 00000000000..727d3b68aef --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/README.md @@ -0,0 +1 @@ +Websecurityscanner: Nodejs Client diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/package.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/package.json new file mode 100644 index 00000000000..e7d7667cbd2 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/web-security-scanner", + "version": "0.1.0", + "description": "Websecurityscanner client for Node.js", + "repository": "googleapis/nodejs-websecurityscanner", + "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 websecurityscanner", + "websecurityscanner", + "web security scanner" + ], + "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-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto new file mode 100644 index 00000000000..57d53c9ef53 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto @@ -0,0 +1,38 @@ +// 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.websecurityscanner.v1alpha; + +option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "CrawledUrlProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web +// Security Scanner Service crawls the web applications, following all links +// within the scope of sites, to find the URLs to test against. +message CrawledUrl { + // Output only. The http method of the request that was used to visit the URL, in + // uppercase. + string http_method = 1; + + // Output only. The URL that was crawled. + string url = 2; + + // Output only. The body of the request that was used to visit the URL. + string body = 3; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto new file mode 100644 index 00000000000..55987fe0950 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto @@ -0,0 +1,152 @@ +// 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.websecurityscanner.v1alpha; + +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1alpha/finding_addon.proto"; + +option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "FindingProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// A Finding resource represents a vulnerability instance identified during a +// ScanRun. +message Finding { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/Finding" + pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" + }; + + // Types of Findings. + enum FindingType { + // The invalid finding type. + FINDING_TYPE_UNSPECIFIED = 0; + + // A page that was served over HTTPS also resources over HTTP. A + // man-in-the-middle attacker could tamper with the HTTP resource and gain + // full access to the website that loads the resource or to monitor the + // actions taken by the user. + MIXED_CONTENT = 1; + + // The version of an included library is known to contain a security issue. + // The scanner checks the version of library in use against a known list of + // vulnerable libraries. False positives are possible if the version + // detection fails or if the library has been manually patched. + OUTDATED_LIBRARY = 2; + + // This type of vulnerability occurs when the value of a request parameter + // is reflected at the beginning of the response, for example, in requests + // using JSONP. Under certain circumstances, an attacker may be able to + // supply an alphanumeric-only Flash file in the vulnerable parameter + // causing the browser to execute the Flash file as if it originated on the + // vulnerable server. + ROSETTA_FLASH = 5; + + // A cross-site scripting (XSS) bug is found via JavaScript callback. For + // detailed explanations on XSS, see + // https://www.google.com/about/appsecurity/learning/xss/. + XSS_CALLBACK = 3; + + // A potential cross-site scripting (XSS) bug due to JavaScript breakage. + // In some circumstances, the application under test might modify the test + // string before it is parsed by the browser. When the browser attempts to + // runs this modified test string, it will likely break and throw a + // JavaScript execution error, thus an injection issue is occurring. + // However, it may not be exploitable. Manual verification is needed to see + // if the test string modifications can be evaded and confirm that the issue + // is in fact an XSS vulnerability. For detailed explanations on XSS, see + // https://www.google.com/about/appsecurity/learning/xss/. + XSS_ERROR = 4; + + // An application appears to be transmitting a password field in clear text. + // An attacker can eavesdrop network traffic and sniff the password field. + CLEAR_TEXT_PASSWORD = 6; + + // An application returns sensitive content with an invalid content type, + // or without an 'X-Content-Type-Options: nosniff' header. + INVALID_CONTENT_TYPE = 7; + + // A cross-site scripting (XSS) vulnerability in AngularJS module that + // occurs when a user-provided string is interpolated by Angular. + XSS_ANGULAR_CALLBACK = 8; + + // A malformed or invalid valued header. + INVALID_HEADER = 9; + + // Misspelled security header name. + MISSPELLED_SECURITY_HEADER_NAME = 10; + + // Mismatching values in a duplicate security header. + MISMATCHING_SECURITY_HEADER_VALUES = 11; + } + + // The resource name of the Finding. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + // The finding IDs are generated by the system. + string name = 1; + + // The type of the Finding. + FindingType finding_type = 2; + + // The http method of the request that triggered the vulnerability, in + // uppercase. + string http_method = 3; + + // The URL produced by the server-side fuzzer and used in the request that + // triggered the vulnerability. + string fuzzed_url = 4; + + // The body of the request that triggered the vulnerability. + string body = 5; + + // The description of the vulnerability. + string description = 6; + + // The URL containing human-readable payload that user can leverage to + // reproduce the vulnerability. + string reproduction_url = 7; + + // If the vulnerability was originated from nested IFrame, the immediate + // parent IFrame is reported. + string frame_url = 8; + + // The URL where the browser lands when the vulnerability is detected. + string final_url = 9; + + // The tracking ID uniquely identifies a vulnerability instance across + // multiple ScanRuns. + string tracking_id = 10; + + // An addon containing information about outdated libraries. + OutdatedLibrary outdated_library = 11; + + // An addon containing detailed information regarding any resource causing the + // vulnerability such as JavaScript sources, image, audio files, etc. + ViolatingResource violating_resource = 12; + + // An addon containing information about vulnerable or missing HTTP headers. + VulnerableHeaders vulnerable_headers = 15; + + // An addon containing information about request parameters which were found + // to be vulnerable. + VulnerableParameters vulnerable_parameters = 13; + + // An addon containing information reported for an XSS, if any. + Xss xss = 14; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto new file mode 100644 index 00000000000..f16b53ccf79 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto @@ -0,0 +1,78 @@ +// 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.websecurityscanner.v1alpha; + +option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "FindingAddonProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// Information reported for an outdated library. +message OutdatedLibrary { + // The name of the outdated library. + string library_name = 1; + + // The version number. + string version = 2; + + // URLs to learn more information about the vulnerabilities in the library. + repeated string learn_more_urls = 3; +} + +// Information regarding any resource causing the vulnerability such +// as JavaScript sources, image, audio files, etc. +message ViolatingResource { + // The MIME type of this resource. + string content_type = 1; + + // URL of this violating resource. + string resource_url = 2; +} + +// Information about vulnerable request parameters. +message VulnerableParameters { + // The vulnerable parameter names. + repeated string parameter_names = 1; +} + +// Information about vulnerable or missing HTTP Headers. +message VulnerableHeaders { + // Describes a HTTP Header. + message Header { + // Header name. + string name = 1; + + // Header value. + string value = 2; + } + + // List of vulnerable headers. + repeated Header headers = 1; + + // List of missing headers. + repeated Header missing_headers = 2; +} + +// Information reported for an XSS. +message Xss { + // Stack traces leading to the point where the XSS occurred. + repeated string stack_traces = 1; + + // An error message generated by a javascript breakage. + string error_message = 2; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto new file mode 100644 index 00000000000..4b8545a75c1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto @@ -0,0 +1,35 @@ +// 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.websecurityscanner.v1alpha; + +import "google/cloud/websecurityscanner/v1alpha/finding.proto"; + +option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "FindingTypeStatsProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// A FindingTypeStats resource represents stats regarding a specific FindingType +// of Findings under a given ScanRun. +message FindingTypeStats { + // The finding type associated with the stats. + Finding.FindingType finding_type = 1; + + // The count of findings belonging to this finding type. + int32 finding_count = 2; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto new file mode 100644 index 00000000000..e2cd7fe7135 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto @@ -0,0 +1,157 @@ +// 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.websecurityscanner.v1alpha; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1alpha/scan_run.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanConfigProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// A ScanConfig resource contains the configurations to launch a scan. +// next id: 12 +message ScanConfig { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + pattern: "projects/{project}/scanConfigs/{scan_config}" + }; + + // Scan authentication configuration. + message Authentication { + // Describes authentication configuration that uses a Google account. + message GoogleAccount { + // Required. The user name of the Google account. + string username = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. The password of the Google account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + } + + // Describes authentication configuration that uses a custom account. + message CustomAccount { + // Required. The user name of the custom account. + string username = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. The password of the custom account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + + // Required. The login form URL of the website. + string login_url = 3 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. + // Authentication configuration + oneof authentication { + // Authentication using a Google account. + GoogleAccount google_account = 1; + + // Authentication using a custom account. + CustomAccount custom_account = 2; + } + } + + // Scan schedule configuration. + message Schedule { + // A timestamp indicates when the next run will be scheduled. The value is + // refreshed by the server after each run. If unspecified, it will default + // to current server time, which means the scan will be scheduled to start + // immediately. + google.protobuf.Timestamp schedule_time = 1; + + // Required. The duration of time between executions in days. + int32 interval_duration_days = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Type of user agents used for scanning. + enum UserAgent { + // The user agent is unknown. Service will default to CHROME_LINUX. + USER_AGENT_UNSPECIFIED = 0; + + // Chrome on Linux. This is the service default if unspecified. + CHROME_LINUX = 1; + + // Chrome on Android. + CHROME_ANDROID = 2; + + // Safari on IPhone. + SAFARI_IPHONE = 3; + } + + // Cloud platforms supported by Cloud Web Security Scanner. + enum TargetPlatform { + // The target platform is unknown. Requests with this enum value will be + // rejected with INVALID_ARGUMENT error. + TARGET_PLATFORM_UNSPECIFIED = 0; + + // Google App Engine service. + APP_ENGINE = 1; + + // Google Compute Engine service. + COMPUTE = 2; + } + + // The resource name of the ScanConfig. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + // generated by the system. + string name = 1; + + // Required. The user provided display name of the ScanConfig. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // The maximum QPS during scanning. A valid value ranges from 5 to 20 + // inclusively. If the field is unspecified or its value is set 0, server will + // default to 15. Other values outside of [5, 20] range will be rejected with + // INVALID_ARGUMENT error. + int32 max_qps = 3; + + // Required. The starting URLs from which the scanner finds site pages. + repeated string starting_urls = 4 [(google.api.field_behavior) = REQUIRED]; + + // The authentication configuration. If specified, service will use the + // authentication configuration during scanning. + Authentication authentication = 5; + + // The user agent used during scanning. + UserAgent user_agent = 6; + + // The blacklist URL patterns as described in + // https://cloud.google.com/security-scanner/docs/excluded-urls + repeated string blacklist_patterns = 7; + + // The schedule of the ScanConfig. + Schedule schedule = 8; + + // Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be + // used as a default. + repeated TargetPlatform target_platforms = 9; + + // Latest ScanRun if available. + ScanRun latest_run = 11; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto new file mode 100644 index 00000000000..72d281a7d42 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto @@ -0,0 +1,104 @@ +// 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.websecurityscanner.v1alpha; + +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// A ScanRun is a output-only resource representing an actual run of the scan. +message ScanRun { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/ScanRun" + pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}" + }; + + // Types of ScanRun execution state. + enum ExecutionState { + // Represents an invalid state caused by internal server error. This value + // should never be returned. + EXECUTION_STATE_UNSPECIFIED = 0; + + // The scan is waiting in the queue. + QUEUED = 1; + + // The scan is in progress. + SCANNING = 2; + + // The scan is either finished or stopped by user. + FINISHED = 3; + } + + // Types of ScanRun result state. + enum ResultState { + // Default value. This value is returned when the ScanRun is not yet + // finished. + RESULT_STATE_UNSPECIFIED = 0; + + // The scan finished without errors. + SUCCESS = 1; + + // The scan finished with errors. + ERROR = 2; + + // The scan was terminated by user. + KILLED = 3; + } + + // The resource name of the ScanRun. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + // The ScanRun IDs are generated by the system. + string name = 1; + + // The execution state of the ScanRun. + ExecutionState execution_state = 2; + + // The result state of the ScanRun. This field is only available after the + // execution state reaches "FINISHED". + ResultState result_state = 3; + + // The time at which the ScanRun started. + google.protobuf.Timestamp start_time = 4; + + // The time at which the ScanRun reached termination state - that the ScanRun + // is either finished or stopped by user. + google.protobuf.Timestamp end_time = 5; + + // The number of URLs crawled during this ScanRun. If the scan is in progress, + // the value represents the number of URLs crawled up to now. + int64 urls_crawled_count = 6; + + // The number of URLs tested during this ScanRun. If the scan is in progress, + // the value represents the number of URLs tested up to now. The number of + // URLs tested is usually larger than the number URLS crawled because + // typically a crawled URL is tested with multiple test payloads. + int64 urls_tested_count = 7; + + // Whether the scan run has found any vulnerabilities. + bool has_vulnerabilities = 8; + + // The percentage of total completion ranging from 0 to 100. + // If the scan is in queue, the value is 0. + // If the scan is running, the value ranges from 0 to 100. + // If the scan is finished, the value is 100. + int32 progress_percent = 9; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto new file mode 100644 index 00000000000..13ed469e7dc --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto @@ -0,0 +1,410 @@ +// 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.websecurityscanner.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/websecurityscanner/v1alpha/crawled_url.proto"; +import "google/cloud/websecurityscanner/v1alpha/finding.proto"; +import "google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto"; +import "google/cloud/websecurityscanner/v1alpha/scan_config.proto"; +import "google/cloud/websecurityscanner/v1alpha/scan_run.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "WebSecurityScannerProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// Cloud Web Security Scanner Service identifies security vulnerabilities in web +// applications hosted on Google Cloud Platform. It crawls your application, and +// attempts to exercise as many user inputs and event handlers as possible. +service WebSecurityScanner { + option (google.api.default_host) = "websecurityscanner.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new ScanConfig. + rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*}/scanConfigs" + body: "scan_config" + }; + option (google.api.method_signature) = "parent,scan_config"; + } + + // Deletes an existing ScanConfig and its child resources. + rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/scanConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a ScanConfig. + rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/scanConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists ScanConfigs under a given project. + rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*}/scanConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates a ScanConfig. This method support partial update of a ScanConfig. + rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + patch: "/v1alpha/{scan_config.name=projects/*/scanConfigs/*}" + body: "scan_config" + }; + option (google.api.method_signature) = "scan_config,update_mask"; + } + + // Start a ScanRun according to the given ScanConfig. + rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1alpha/{name=projects/*/scanConfigs/*}:start" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a ScanRun. + rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + // stop time. + rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/scanConfigs/*}/scanRuns" + }; + option (google.api.method_signature) = "parent"; + } + + // Stops a ScanRun. The stopped ScanRun is returned. + rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // List CrawledUrls under a given ScanRun. + rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a Finding. + rpc GetFinding(GetFindingRequest) returns (Finding) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List Findings under a given ScanRun. + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" + }; + option (google.api.method_signature) = "parent,filter"; + } + + // List all FindingTypeStats under a given ScanRun. + rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request for the `CreateScanConfig` method. +message CreateScanConfigRequest { + // Required. The parent resource name where the scan is created, which should be a + // project resource name in the format 'projects/{projectId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The ScanConfig to be created. + ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `DeleteScanConfig` method. +message DeleteScanConfigRequest { + // Required. The resource name of the ScanConfig to be deleted. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `GetScanConfig` method. +message GetScanConfigRequest { + // Required. The resource name of the ScanConfig to be returned. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `ListScanConfigs` method. +message ListScanConfigsRequest { + // Required. The parent resource name, which should be a project resource name in the + // format 'projects/{projectId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanConfigs to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Request for the `UpdateScanConfigRequest` method. +message UpdateScanConfigRequest { + // Required. The ScanConfig to be updated. The name field must be set to identify the + // resource to be updated. The values of fields not covered by the mask + // will be ignored. + ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response for the `ListScanConfigs` method. +message ListScanConfigsResponse { + // The list of ScanConfigs returned. + repeated ScanConfig scan_configs = 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 for the `StartScanRun` method. +message StartScanRunRequest { + // Required. The resource name of the ScanConfig to be used. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `GetScanRun` method. +message GetScanRunRequest { + // Required. The resource name of the ScanRun to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Request for the `ListScanRuns` method. +message ListScanRunsRequest { + // Required. The parent resource name, which should be a scan resource name in the + // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanRuns to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListScanRuns` method. +message ListScanRunsResponse { + // The list of ScanRuns returned. + repeated ScanRun scan_runs = 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 for the `StopScanRun` method. +message StopScanRunRequest { + // Required. The resource name of the ScanRun to be stopped. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Request for the `ListCrawledUrls` method. +message ListCrawledUrlsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of CrawledUrls to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListCrawledUrls` method. +message ListCrawledUrlsResponse { + // The list of CrawledUrls returned. + repeated CrawledUrl crawled_urls = 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 for the `GetFinding` method. +message GetFindingRequest { + // Required. The resource name of the Finding to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/Finding" + } + ]; +} + +// Request for the `ListFindings` method. +message ListFindingsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; + + // Required. The filter expression. The expression must be in the format: + // . + // Supported field: 'finding_type'. + // Supported operator: '='. + string filter = 2 [(google.api.field_behavior) = REQUIRED]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 3; + + // The maximum number of Findings to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 4; +} + +// Response for the `ListFindings` method. +message ListFindingsResponse { + // The list of Findings returned. + repeated Finding findings = 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 for the `ListFindingTypeStats` method. +message ListFindingTypeStatsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Response for the `ListFindingTypeStats` method. +message ListFindingTypeStatsResponse { + // The list of FindingTypeStats returned. + repeated FindingTypeStats finding_type_stats = 1; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json new file mode 100644 index 00000000000..c0c051282be --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json @@ -0,0 +1,579 @@ +{ + "clientLibrary": { + "name": "nodejs-websecurityscanner", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.websecurityscanner.v1alpha", + "version": "v1alpha" + } + ] + }, + "snippets": [ + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async", + "title": "WebSecurityScanner createScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new ScanConfig.", + "canonical": true, + "file": "web_security_scanner.create_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.CreateScanConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1alpha.ScanConfig" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.CreateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async", + "title": "WebSecurityScanner deleteScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing ScanConfig and its child resources.", + "canonical": true, + "file": "web_security_scanner.delete_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.DeleteScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.DeleteScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async", + "title": "WebSecurityScanner getScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.get_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async", + "title": "WebSecurityScanner listScanConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanConfigs under a given project.", + "canonical": true, + "file": "web_security_scanner.list_scan_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ListScanConfigsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanConfigs", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async", + "title": "WebSecurityScanner updateScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.update_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.UpdateScanConfig", + "async": true, + "parameters": [ + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1alpha.ScanConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.UpdateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async", + "title": "WebSecurityScanner startScanRun Sample", + "origin": "API_DEFINITION", + "description": " Start a ScanRun according to the given ScanConfig.", + "canonical": true, + "file": "web_security_scanner.start_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StartScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StartScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async", + "title": "WebSecurityScanner getScanRun Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanRun.", + "canonical": true, + "file": "web_security_scanner.get_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async", + "title": "WebSecurityScanner listScanRuns Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", + "canonical": true, + "file": "web_security_scanner.list_scan_runs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanRuns", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ListScanRunsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanRuns", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async", + "title": "WebSecurityScanner stopScanRun Sample", + "origin": "API_DEFINITION", + "description": " Stops a ScanRun. The stopped ScanRun is returned.", + "canonical": true, + "file": "web_security_scanner.stop_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StopScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StopScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async", + "title": "WebSecurityScanner listCrawledUrls Sample", + "origin": "API_DEFINITION", + "description": " List CrawledUrls under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_crawled_urls.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListCrawledUrls", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListCrawledUrls", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async", + "title": "WebSecurityScanner getFinding Sample", + "origin": "API_DEFINITION", + "description": " Gets a Finding.", + "canonical": true, + "file": "web_security_scanner.get_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetFinding", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.Finding", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetFinding", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async", + "title": "WebSecurityScanner listFindings Sample", + "origin": "API_DEFINITION", + "description": " List Findings under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ListFindingsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindings", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async", + "title": "WebSecurityScanner listFindingTypeStats Sample", + "origin": "API_DEFINITION", + "description": " List all FindingTypeStats under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_finding_type_stats.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindingTypeStats", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindingTypeStats", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js new file mode 100644 index 00000000000..178f60414d9 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_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(parent, scanConfig) { + // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * Required. The ScanConfig to be created. + */ + // const scanConfig = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callCreateScanConfig() { + // Construct request + const request = { + parent, + scanConfig, + }; + + // Run request + const response = await websecurityscannerClient.createScanConfig(request); + console.log(response); + } + + callCreateScanConfig(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js new file mode 100644 index 00000000000..de78e80f4f8 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_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 websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callDeleteScanConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.deleteScanConfig(request); + console.log(response); + } + + callDeleteScanConfig(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js new file mode 100644 index 00000000000..dab3d184220 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetFinding() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getFinding(request); + console.log(response); + } + + callGetFinding(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js new file mode 100644 index 00000000000..44a624e911b --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getScanConfig(request); + console.log(response); + } + + callGetScanConfig(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js new file mode 100644 index 00000000000..d434cf5c561 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getScanRun(request); + console.log(response); + } + + callGetScanRun(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js new file mode 100644 index 00000000000..ef54718cc0d --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.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 websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListCrawledUrls() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCrawledUrls(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js new file mode 100644 index 00000000000..fc1996b0a8d --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.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(parent) { + // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindingTypeStats() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await websecurityscannerClient.listFindingTypeStats(request); + console.log(response); + } + + callListFindingTypeStats(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js new file mode 100644 index 00000000000..cd95431ff4e --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.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, filter) { + // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + */ + // const filter = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindings() { + // Construct request + const request = { + parent, + filter, + }; + + // Run request + const iterable = await websecurityscannerClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js new file mode 100644 index 00000000000..1a3477fc70d --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.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) { + // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a project resource name in the + * format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listScanConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanConfigs(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js new file mode 100644 index 00000000000..b3393f41df2 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.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) { + // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanRuns() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listScanRunsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanRuns(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js new file mode 100644 index 00000000000..4b89d6318e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.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 websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStartScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.startScanRun(request); + console.log(response); + } + + callStartScanRun(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js new file mode 100644 index 00000000000..3239232bcf4 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.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 websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStopScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.stopScanRun(request); + console.log(response); + } + + callStopScanRun(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js new file mode 100644 index 00000000000..3fa9f1b4fa3 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.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(scanConfig, updateMask) { + // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + */ + // const scanConfig = {} + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callUpdateScanConfig() { + // Construct request + const request = { + scanConfig, + updateMask, + }; + + // Run request + const response = await websecurityscannerClient.updateScanConfig(request); + console.log(response); + } + + callUpdateScanConfig(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/index.ts new file mode 100644 index 00000000000..5584b1fbb22 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 WebSecurityScannerClient = v1alpha.WebSecurityScannerClient; +type WebSecurityScannerClient = v1alpha.WebSecurityScannerClient; +export {v1alpha, WebSecurityScannerClient}; +export default {v1alpha, WebSecurityScannerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/gapic_metadata.json new file mode 100644 index 00000000000..72e2c6b7bde --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/gapic_metadata.json @@ -0,0 +1,169 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.websecurityscanner.v1alpha", + "libraryPackage": "@google-cloud/web-security-scanner", + "services": { + "WebSecurityScanner": { + "clients": { + "grpc": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/index.ts new file mode 100644 index 00000000000..c4b9ebe89d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client.ts new file mode 100644 index 00000000000..38aed2a115b --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client.ts @@ -0,0 +1,1927 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1alpha/web_security_scanner_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './web_security_scanner_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Cloud Web Security Scanner Service identifies security vulnerabilities in web + * applications hosted on Google Cloud Platform. It crawls your application, and + * attempts to exercise as many user inputs and event handlers as possible. + * @class + * @memberof v1alpha + */ +export class WebSecurityScannerClient { + 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}; + webSecurityScannerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WebSecurityScannerClient. + * + * @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 WebSecurityScannerClient({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 WebSecurityScannerClient; + 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 = { + findingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + scanConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}' + ), + scanRunPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}' + ), + }; + + // 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 = { + listScanConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), + listScanRuns: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), + listCrawledUrls: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.websecurityscanner.v1alpha.WebSecurityScanner', 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.webSecurityScannerStub) { + return this.webSecurityScannerStub; + } + + // Put together the "service stub" for + // google.cloud.websecurityscanner.v1alpha.WebSecurityScanner. + this.webSecurityScannerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1alpha.WebSecurityScanner') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.websecurityscanner.v1alpha.WebSecurityScanner, + 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 webSecurityScannerStubMethods = + ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; + for (const methodName of webSecurityScannerStubMethods) { + const callPromise = this.webSecurityScannerStub.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.webSecurityScannerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'websecurityscanner.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 'websecurityscanner.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 -- + // ------------------- +/** + * Creates a new ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig + * Required. The ScanConfig 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.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. + * Please see the {@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/web_security_scanner.create_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async + */ + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|undefined, {}|undefined + ]>; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createScanConfig(request, options, callback); + } +/** + * Deletes an existing ScanConfig and its child resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1alpha/web_security_scanner.delete_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async + */ + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|undefined, {}|undefined + ]>; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteScanConfig(request, options, callback); + } +/** + * Gets a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. + * Please see the {@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/web_security_scanner.get_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async + */ + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|undefined, {}|undefined + ]>; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getScanConfig(request, options, callback); + } +/** + * Updates a ScanConfig. This method support partial update of a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * 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.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. + * Please see the {@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/web_security_scanner.update_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async + */ + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|undefined, {}|undefined + ]>; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scan_config.name': request.scanConfig!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateScanConfig(request, options, callback); + } +/** + * Start a ScanRun according to the given ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. + * Please see the {@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/web_security_scanner.start_scan_run.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async + */ + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|undefined, {}|undefined + ]>; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.startScanRun(request, options, callback); + } +/** + * Gets a ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. + * Please see the {@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/web_security_scanner.get_scan_run.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async + */ + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|undefined, {}|undefined + ]>; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getScanRun(request, options, callback); + } +/** + * Stops a ScanRun. The stopped ScanRun is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. + * Please see the {@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/web_security_scanner.stop_scan_run.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async + */ + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|undefined, {}|undefined + ]>; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.stopScanRun(request, options, callback); + } +/** + * Gets a Finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.Finding|Finding}. + * Please see the {@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/web_security_scanner.get_finding.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async + */ + getFinding( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|undefined, {}|undefined + ]>; + getFinding( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFinding(request, options, callback); + } +/** + * List all FindingTypeStats under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. + * Please see the {@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/web_security_scanner.list_finding_type_stats.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async + */ + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|undefined, {}|undefined + ]>; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFindingTypeStats(request, options, callback); + } + + /** + * Lists ScanConfigs under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. + * 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 `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse + ]>; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): void; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): void; + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listScanConfigs(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 name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1alpha.ScanConfig|ScanConfig} 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 `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanConfigsStream( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + 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['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.createStream( + this.innerApiCalls.listScanConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanConfigs`, 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 name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. 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/web_security_scanner.list_scan_configs.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async + */ + listScanConfigsAsync( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + 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['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.asyncIterate( + this.innerApiCalls['listScanConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + * stop time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1alpha.ScanRun|ScanRun}. + * 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 `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse + ]>; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): void; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): void; + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listScanRuns(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 name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1alpha.ScanRun|ScanRun} 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 `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanRunsStream( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + 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['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.createStream( + this.innerApiCalls.listScanRuns as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanRuns`, 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 name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1alpha.ScanRun|ScanRun}. 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/web_security_scanner.list_scan_runs.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async + */ + listScanRunsAsync( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + 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['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.asyncIterate( + this.innerApiCalls['listScanRuns'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List CrawledUrls under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl}. + * 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 `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse + ]>; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): void; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): void; + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listCrawledUrls(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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl} 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 `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCrawledUrlsStream( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + 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['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.createStream( + this.innerApiCalls.listCrawledUrls as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCrawledUrls`, 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl}. 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/web_security_scanner.list_crawled_urls.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async + */ + listCrawledUrlsAsync( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + 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['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.asyncIterate( + this.innerApiCalls['listCrawledUrls'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List Findings under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1alpha.Finding|Finding}. + * 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 `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFindings( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IFinding[], + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding>): void; + listFindings( + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding>): void; + listFindings( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IFinding[], + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFindings(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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1alpha.Finding|Finding} 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 `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFindingsStream( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + 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['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.createStream( + this.innerApiCalls.listFindings as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFindings`, 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1alpha.Finding|Finding}. 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/web_security_scanner.list_findings.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + 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['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.asyncIterate( + this.innerApiCalls['listFindings'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified finding resource name string. + * + * @param {string} project + * @param {string} scan_config + * @param {string} scan_run + * @param {string} finding + * @returns {string} Resource name string. + */ + findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { + return this.pathTemplates.findingPathTemplate.render({ + project: project, + scan_config: scanConfig, + scan_run: scanRun, + finding: finding, + }); + } + + /** + * Parse the project from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).project; + } + + /** + * Parse the scan_config from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; + } + + /** + * Parse the scan_run from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_run. + */ + matchScanRunFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; + } + + /** + * Parse the finding from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).finding; + } + + /** + * 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 scanConfig resource name string. + * + * @param {string} project + * @param {string} scan_config + * @returns {string} Resource name string. + */ + scanConfigPath(project:string,scanConfig:string) { + return this.pathTemplates.scanConfigPathTemplate.render({ + project: project, + scan_config: scanConfig, + }); + } + + /** + * Parse the project from ScanConfig resource. + * + * @param {string} scanConfigName + * A fully-qualified path representing ScanConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromScanConfigName(scanConfigName: string) { + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).project; + } + + /** + * Parse the scan_config from ScanConfig resource. + * + * @param {string} scanConfigName + * A fully-qualified path representing ScanConfig resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromScanConfigName(scanConfigName: string) { + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).scan_config; + } + + /** + * Return a fully-qualified scanRun resource name string. + * + * @param {string} project + * @param {string} scan_config + * @param {string} scan_run + * @returns {string} Resource name string. + */ + scanRunPath(project:string,scanConfig:string,scanRun:string) { + return this.pathTemplates.scanRunPathTemplate.render({ + project: project, + scan_config: scanConfig, + scan_run: scanRun, + }); + } + + /** + * Parse the project from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the project. + */ + matchProjectFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).project; + } + + /** + * Parse the scan_config from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_config; + } + + /** + * Parse the scan_run from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the scan_run. + */ + matchScanRunFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_run; + } + + /** + * 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.webSecurityScannerStub && !this._terminated) { + return this.webSecurityScannerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client_config.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client_config.json new file mode 100644 index 00000000000..288b9b02400 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client_config.json @@ -0,0 +1,91 @@ +{ + "interfaces": { + "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner": { + "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": { + "CreateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanConfigs": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanRuns": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "StopScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListCrawledUrls": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetFinding": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindingTypeStats": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_proto_list.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_proto_list.json new file mode 100644 index 00000000000..1696775c642 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/finding.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto" +] diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..54b6f3aa5e5 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 websecurityscanner = require('@google-cloud/web-security-scanner'); + +function main() { + const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..3bd84309184 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; + +// check that the client class type name can be used +function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const webSecurityScannerClient = new WebSecurityScannerClient(); + doStuffWithWebSecurityScannerClient(webSecurityScannerClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/install.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1alpha/test/gapic_web_security_scanner_v1alpha.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/test/gapic_web_security_scanner_v1alpha.ts new file mode 100644 index 00000000000..a22ad5b370d --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/test/gapic_web_security_scanner_v1alpha.ts @@ -0,0 +1,2324 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 websecurityscannerModule 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('v1alpha.WebSecurityScannerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = websecurityscannerModule.v1alpha.WebSecurityScannerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = websecurityscannerModule.v1alpha.WebSecurityScannerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = websecurityscannerModule.v1alpha.WebSecurityScannerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + await client.initialize(); + assert(client.webSecurityScannerStub); + }); + + it('has close method for the initialized client', done => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.webSecurityScannerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + 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 websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + 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('createScanConfig', () => { + it('invokes createScanConfig without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() + ); + client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() + ); + client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createScanConfig(request), expectedError); + }); + }); + + describe('deleteScanConfig', () => { + it('invokes deleteScanConfig without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteScanConfig( + 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.deleteScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteScanConfig(request), expectedError); + }); + }); + + describe('getScanConfig', () => { + it('invokes getScanConfig without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() + ); + client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() + ); + client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanConfig(request), expectedError); + }); + }); + + describe('updateScanConfig', () => { + it('invokes updateScanConfig without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() + ); + client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() + ); + client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateScanConfig with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateScanConfig(request), expectedError); + }); + }); + + describe('startScanRun', () => { + it('invokes startScanRun without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() + ); + client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.startScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() + ); + client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startScanRun with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.startScanRun(request), expectedError); + const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.startScanRun(request), expectedError); + }); + }); + + describe('getScanRun', () => { + it('invokes getScanRun without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() + ); + client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.getScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() + ); + client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanRun with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanRun(request), expectedError); + const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanRun(request), expectedError); + }); + }); + + describe('stopScanRun', () => { + it('invokes stopScanRun without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() + ); + client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.stopScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() + ); + client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopScanRun with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.stopScanRun(request), expectedError); + const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.stopScanRun(request), expectedError); + }); + }); + + describe('getFinding', () => { + it('invokes getFinding without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding() + ); + client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); + const [response] = await client.getFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFinding without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding() + ); + client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFinding( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFinding with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFinding(request), expectedError); + const actualRequest = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFinding with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFinding(request), expectedError); + }); + }); + + describe('listFindingTypeStats', () => { + it('invokes listFindingTypeStats without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse() + ); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); + const [response] = await client.listFindingTypeStats(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse() + ); + client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindingTypeStats( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + }); + }); + + describe('listScanConfigs', () => { + it('invokes listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listScanConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigs without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigsStream without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig) => { + 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.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listScanConfigsStream with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = []; + const iterable = client.listScanConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listScanRuns', () => { + it('invokes listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); + const [response] = await client.listScanRuns(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRuns without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanRuns( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanRuns(request), expectedError); + const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRunsStream without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + ]; + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun) => { + 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.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listScanRunsStream with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + ]; + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = []; + const iterable = client.listScanRunsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanRunsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listCrawledUrls', () => { + it('invokes listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); + const [response] = await client.listCrawledUrls(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrls without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCrawledUrls( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCrawledUrls(request), expectedError); + const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrlsStream without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl) => { + 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.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listCrawledUrlsStream with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = []; + const iterable = client.listCrawledUrlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCrawledUrlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IFinding[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindings(request), expectedError); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingsStream without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.Finding) => { + 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.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFindingsStream with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.Finding) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('finding', () => { + const fakePath = "/rendered/path/finding"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + scan_run: "scanRunValue", + finding: "findingValue", + }; + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.findingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.findingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('findingPath', () => { + const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFindingName', () => { + const result = client.matchProjectFromFindingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromFindingName', () => { + const result = client.matchScanConfigFromFindingName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanRunFromFindingName', () => { + const result = client.matchScanRunFromFindingName(fakePath); + assert.strictEqual(result, "scanRunValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFindingName', () => { + const result = client.matchFindingFromFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + 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('scanConfig', () => { + const fakePath = "/rendered/path/scanConfig"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + }; + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.scanConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.scanConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('scanConfigPath', () => { + const result = client.scanConfigPath("projectValue", "scanConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.scanConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromScanConfigName', () => { + const result = client.matchProjectFromScanConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromScanConfigName', () => { + const result = client.matchScanConfigFromScanConfigName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('scanRun', () => { + const fakePath = "/rendered/path/scanRun"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + scan_run: "scanRunValue", + }; + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.scanRunPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.scanRunPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('scanRunPath', () => { + const result = client.scanRunPath("projectValue", "scanConfigValue", "scanRunValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.scanRunPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromScanRunName', () => { + const result = client.matchProjectFromScanRunName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromScanRunName', () => { + const result = client.matchScanConfigFromScanRunName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanRunFromScanRunName', () => { + const result = client.matchScanRunFromScanRunName(fakePath); + assert.strictEqual(result, "scanRunValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/tsconfig.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1alpha/webpack.config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/webpack.config.js new file mode 100644 index 00000000000..ad3467d60d6 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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: 'WebSecurityScanner', + filename: './web-security-scanner.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-websecurityscanner/v1beta/.eslintignore b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.gitignore b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.jsdoc.js new file mode 100644 index 00000000000..efbbc504438 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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/web-security-scanner', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1beta/README.md b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/README.md new file mode 100644 index 00000000000..727d3b68aef --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/README.md @@ -0,0 +1 @@ +Websecurityscanner: Nodejs Client diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/package.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/package.json new file mode 100644 index 00000000000..e7d7667cbd2 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/web-security-scanner", + "version": "0.1.0", + "description": "Websecurityscanner client for Node.js", + "repository": "googleapis/nodejs-websecurityscanner", + "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 websecurityscanner", + "websecurityscanner", + "web security scanner" + ], + "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-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto new file mode 100644 index 00000000000..235f8126469 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto @@ -0,0 +1,41 @@ +// 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.websecurityscanner.v1beta; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "CrawledUrlProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web +// Security Scanner Service crawls the web applications, following all links +// within the scope of sites, to find the URLs to test against. +message CrawledUrl { + // The http method of the request that was used to visit the URL, in + // uppercase. + string http_method = 1; + + // The URL that was crawled. + string url = 2; + + // The body of the request that was used to visit the URL. + string body = 3; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto new file mode 100644 index 00000000000..ca07cafd902 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto @@ -0,0 +1,98 @@ +// 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.websecurityscanner.v1beta; + +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1beta/finding_addon.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "FindingProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// A Finding resource represents a vulnerability instance identified during a +// ScanRun. +message Finding { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/Finding" + pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" + }; + + // The resource name of the Finding. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + // The finding IDs are generated by the system. + string name = 1; + + // The type of the Finding. + // Detailed and up-to-date information on findings can be found here: + // https://cloud.google.com/security-scanner/docs/scan-result-details + string finding_type = 2; + + // The http method of the request that triggered the vulnerability, in + // uppercase. + string http_method = 3; + + // The URL produced by the server-side fuzzer and used in the request that + // triggered the vulnerability. + string fuzzed_url = 4; + + // The body of the request that triggered the vulnerability. + string body = 5; + + // The description of the vulnerability. + string description = 6; + + // The URL containing human-readable payload that user can leverage to + // reproduce the vulnerability. + string reproduction_url = 7; + + // If the vulnerability was originated from nested IFrame, the immediate + // parent IFrame is reported. + string frame_url = 8; + + // The URL where the browser lands when the vulnerability is detected. + string final_url = 9; + + // The tracking ID uniquely identifies a vulnerability instance across + // multiple ScanRuns. + string tracking_id = 10; + + // An addon containing information reported for a vulnerability with an HTML + // form, if any. + Form form = 16; + + // An addon containing information about outdated libraries. + OutdatedLibrary outdated_library = 11; + + // An addon containing detailed information regarding any resource causing the + // vulnerability such as JavaScript sources, image, audio files, etc. + ViolatingResource violating_resource = 12; + + // An addon containing information about vulnerable or missing HTTP headers. + VulnerableHeaders vulnerable_headers = 15; + + // An addon containing information about request parameters which were found + // to be vulnerable. + VulnerableParameters vulnerable_parameters = 13; + + // An addon containing information reported for an XSS, if any. + Xss xss = 14; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto new file mode 100644 index 00000000000..a64fbf8e1df --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto @@ -0,0 +1,90 @@ +// 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.websecurityscanner.v1beta; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "FindingAddonProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// ! Information about a vulnerability with an HTML. +message Form { + // ! The URI where to send the form when it's submitted. + string action_uri = 1; + + // ! The names of form fields related to the vulnerability. + repeated string fields = 2; +} + +// Information reported for an outdated library. +message OutdatedLibrary { + // The name of the outdated library. + string library_name = 1; + + // The version number. + string version = 2; + + // URLs to learn more information about the vulnerabilities in the library. + repeated string learn_more_urls = 3; +} + +// Information regarding any resource causing the vulnerability such +// as JavaScript sources, image, audio files, etc. +message ViolatingResource { + // The MIME type of this resource. + string content_type = 1; + + // URL of this violating resource. + string resource_url = 2; +} + +// Information about vulnerable request parameters. +message VulnerableParameters { + // The vulnerable parameter names. + repeated string parameter_names = 1; +} + +// Information about vulnerable or missing HTTP Headers. +message VulnerableHeaders { + // Describes a HTTP Header. + message Header { + // Header name. + string name = 1; + + // Header value. + string value = 2; + } + + // List of vulnerable headers. + repeated Header headers = 1; + + // List of missing headers. + repeated Header missing_headers = 2; +} + +// Information reported for an XSS. +message Xss { + // Stack traces leading to the point where the XSS occurred. + repeated string stack_traces = 1; + + // An error message generated by a javascript breakage. + string error_message = 2; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto new file mode 100644 index 00000000000..842a9f359e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto @@ -0,0 +1,36 @@ +// 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.websecurityscanner.v1beta; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "FindingTypeStatsProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// A FindingTypeStats resource represents stats regarding a specific FindingType +// of Findings under a given ScanRun. +message FindingTypeStats { + // The finding type associated with the stats. + string finding_type = 1; + + // The count of findings belonging to this finding type. + int32 finding_count = 2; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto new file mode 100644 index 00000000000..550e2e736a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto @@ -0,0 +1,193 @@ +// 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.websecurityscanner.v1beta; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1beta/scan_run.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanConfigProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// A ScanConfig resource contains the configurations to launch a scan. +message ScanConfig { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + pattern: "projects/{project}/scanConfigs/{scan_config}" + }; + + // Scan authentication configuration. + message Authentication { + // Describes authentication configuration that uses a Google account. + message GoogleAccount { + // Required. The user name of the Google account. + string username = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. The password of the Google account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + } + + // Describes authentication configuration that uses a custom account. + message CustomAccount { + // Required. The user name of the custom account. + string username = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. The password of the custom account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + + // Required. The login form URL of the website. + string login_url = 3 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. + // Authentication configuration + oneof authentication { + // Authentication using a Google account. + GoogleAccount google_account = 1; + + // Authentication using a custom account. + CustomAccount custom_account = 2; + } + } + + // Scan schedule configuration. + message Schedule { + // A timestamp indicates when the next run will be scheduled. The value is + // refreshed by the server after each run. If unspecified, it will default + // to current server time, which means the scan will be scheduled to start + // immediately. + google.protobuf.Timestamp schedule_time = 1; + + // Required. The duration of time between executions in days. + int32 interval_duration_days = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Type of user agents used for scanning. + enum UserAgent { + // The user agent is unknown. Service will default to CHROME_LINUX. + USER_AGENT_UNSPECIFIED = 0; + + // Chrome on Linux. This is the service default if unspecified. + CHROME_LINUX = 1; + + // Chrome on Android. + CHROME_ANDROID = 2; + + // Safari on IPhone. + SAFARI_IPHONE = 3; + } + + // Cloud platforms supported by Cloud Web Security Scanner. + enum TargetPlatform { + // The target platform is unknown. Requests with this enum value will be + // rejected with INVALID_ARGUMENT error. + TARGET_PLATFORM_UNSPECIFIED = 0; + + // Google App Engine service. + APP_ENGINE = 1; + + // Google Compute Engine service. + COMPUTE = 2; + } + + // Scan risk levels supported by Cloud Web Security Scanner. LOW impact + // scanning will minimize requests with the potential to modify data. To + // achieve the maximum scan coverage, NORMAL risk level is recommended. + enum RiskLevel { + // Use default, which is NORMAL. + RISK_LEVEL_UNSPECIFIED = 0; + + // Normal scanning (Recommended) + NORMAL = 1; + + // Lower impact scanning + LOW = 2; + } + + // Controls export of scan configurations and results to Cloud Security + // Command Center. + enum ExportToSecurityCommandCenter { + // Use default, which is ENABLED. + EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; + + // Export results of this scan to Cloud Security Command Center. + ENABLED = 1; + + // Do not export results of this scan to Cloud Security Command Center. + DISABLED = 2; + } + + // The resource name of the ScanConfig. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + // generated by the system. + string name = 1; + + // Required. The user provided display name of the ScanConfig. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // The maximum QPS during scanning. A valid value ranges from 5 to 20 + // inclusively. If the field is unspecified or its value is set 0, server will + // default to 15. Other values outside of [5, 20] range will be rejected with + // INVALID_ARGUMENT error. + int32 max_qps = 3; + + // Required. The starting URLs from which the scanner finds site pages. + repeated string starting_urls = 4 [(google.api.field_behavior) = REQUIRED]; + + // The authentication configuration. If specified, service will use the + // authentication configuration during scanning. + Authentication authentication = 5; + + // The user agent used during scanning. + UserAgent user_agent = 6; + + // The blacklist URL patterns as described in + // https://cloud.google.com/security-scanner/docs/excluded-urls + repeated string blacklist_patterns = 7; + + // The schedule of the ScanConfig. + Schedule schedule = 8; + + // Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be + // used as a default. + repeated TargetPlatform target_platforms = 9; + + // Controls export of scan configurations and results to Cloud Security + // Command Center. + ExportToSecurityCommandCenter export_to_security_command_center = 10; + + // Latest ScanRun if available. + ScanRun latest_run = 11; + + // The risk level selected for the scan + RiskLevel risk_level = 12; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto new file mode 100644 index 00000000000..3030f9f264f --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto @@ -0,0 +1,190 @@ +// 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.websecurityscanner.v1beta; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanConfigErrorProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// Defines a custom error message used by CreateScanConfig and UpdateScanConfig +// APIs when scan configuration validation fails. It is also reported as part of +// a ScanRunErrorTrace message if scan validation fails due to a scan +// configuration error. +message ScanConfigError { + // Output only. + // Defines an error reason code. + // Next id: 44 + enum Code { + option allow_alias = true; + + // There is no error. + CODE_UNSPECIFIED = 0; + + // There is no error. + OK = 0; + + // Indicates an internal server error. + // Please DO NOT USE THIS ERROR CODE unless the root cause is truly unknown. + INTERNAL_ERROR = 1; + + // One of the seed URLs is an App Engine URL but we cannot validate the scan + // settings due to an App Engine API backend error. + APPENGINE_API_BACKEND_ERROR = 2; + + // One of the seed URLs is an App Engine URL but we cannot access the + // App Engine API to validate scan settings. + APPENGINE_API_NOT_ACCESSIBLE = 3; + + // One of the seed URLs is an App Engine URL but the Default Host of the + // App Engine is not set. + APPENGINE_DEFAULT_HOST_MISSING = 4; + + // Google corporate accounts can not be used for scanning. + CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; + + // The account of the scan creator can not be used for scanning. + CANNOT_USE_OWNER_ACCOUNT = 7; + + // This scan targets Compute Engine, but we cannot validate scan settings + // due to a Compute Engine API backend error. + COMPUTE_API_BACKEND_ERROR = 8; + + // This scan targets Compute Engine, but we cannot access the Compute Engine + // API to validate the scan settings. + COMPUTE_API_NOT_ACCESSIBLE = 9; + + // The Custom Login URL does not belong to the current project. + CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; + + // The Custom Login URL is malformed (can not be parsed). + CUSTOM_LOGIN_URL_MALFORMED = 11; + + // The Custom Login URL is mapped to a non-routable IP address in DNS. + CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; + + // The Custom Login URL is mapped to an IP address which is not reserved for + // the current project. + CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; + + // The Custom Login URL has a non-routable IP address. + CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; + + // The Custom Login URL has an IP address which is not reserved for the + // current project. + CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; + + // Another scan with the same name (case-sensitive) already exists. + DUPLICATE_SCAN_NAME = 16; + + // A field is set to an invalid value. + INVALID_FIELD_VALUE = 18; + + // There was an error trying to authenticate to the scan target. + FAILED_TO_AUTHENTICATE_TO_TARGET = 19; + + // Finding type value is not specified in the list findings request. + FINDING_TYPE_UNSPECIFIED = 20; + + // Scan targets Compute Engine, yet current project was not whitelisted for + // Google Compute Engine Scanning Alpha access. + FORBIDDEN_TO_SCAN_COMPUTE = 21; + + // User tries to update managed scan + FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; + + // The supplied filter is malformed. For example, it can not be parsed, does + // not have a filter type in expression, or the same filter type appears + // more than once. + MALFORMED_FILTER = 22; + + // The supplied resource name is malformed (can not be parsed). + MALFORMED_RESOURCE_NAME = 23; + + // The current project is not in an active state. + PROJECT_INACTIVE = 24; + + // A required field is not set. + REQUIRED_FIELD = 25; + + // Project id, scanconfig id, scanrun id, or finding id are not consistent + // with each other in resource name. + RESOURCE_NAME_INCONSISTENT = 26; + + // The scan being requested to start is already running. + SCAN_ALREADY_RUNNING = 27; + + // The scan that was requested to be stopped is not running. + SCAN_NOT_RUNNING = 28; + + // One of the seed URLs does not belong to the current project. + SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; + + // One of the seed URLs is malformed (can not be parsed). + SEED_URL_MALFORMED = 30; + + // One of the seed URLs is mapped to a non-routable IP address in DNS. + SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; + + // One of the seed URLs is mapped to an IP address which is not reserved + // for the current project. + SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; + + // One of the seed URLs has on-routable IP address. + SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; + + // One of the seed URLs has an IP address that is not reserved + // for the current project. + SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; + + // The Cloud Security Scanner service account is not configured under the + // project. + SERVICE_ACCOUNT_NOT_CONFIGURED = 36; + + // A project has reached the maximum number of scans. + TOO_MANY_SCANS = 37; + + // Resolving the details of the current project fails. + UNABLE_TO_RESOLVE_PROJECT_INFO = 38; + + // One or more blacklist patterns were in the wrong format. + UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; + + // The supplied filter is not supported. + UNSUPPORTED_FILTER = 40; + + // The supplied finding type is not supported. For example, we do not + // provide findings of the given finding type. + UNSUPPORTED_FINDING_TYPE = 41; + + // The URL scheme of one or more of the supplied URLs is not supported. + UNSUPPORTED_URL_SCHEME = 42; + } + + // Indicates the reason code for a configuration failure. + Code code = 1; + + // Indicates the full name of the ScanConfig field that triggers this error, + // for example "scan_config.max_qps". This field is provided for + // troubleshooting purposes only and its actual value can change in the + // future. + string field_name = 2; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto new file mode 100644 index 00000000000..da45e0a681e --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto @@ -0,0 +1,117 @@ +// 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.websecurityscanner.v1beta; + +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto"; +import "google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// A ScanRun is a output-only resource representing an actual run of the scan. +// Next id: 12 +message ScanRun { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/ScanRun" + pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}" + }; + + // Types of ScanRun execution state. + enum ExecutionState { + // Represents an invalid state caused by internal server error. This value + // should never be returned. + EXECUTION_STATE_UNSPECIFIED = 0; + + // The scan is waiting in the queue. + QUEUED = 1; + + // The scan is in progress. + SCANNING = 2; + + // The scan is either finished or stopped by user. + FINISHED = 3; + } + + // Types of ScanRun result state. + enum ResultState { + // Default value. This value is returned when the ScanRun is not yet + // finished. + RESULT_STATE_UNSPECIFIED = 0; + + // The scan finished without errors. + SUCCESS = 1; + + // The scan finished with errors. + ERROR = 2; + + // The scan was terminated by user. + KILLED = 3; + } + + // The resource name of the ScanRun. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + // The ScanRun IDs are generated by the system. + string name = 1; + + // The execution state of the ScanRun. + ExecutionState execution_state = 2; + + // The result state of the ScanRun. This field is only available after the + // execution state reaches "FINISHED". + ResultState result_state = 3; + + // The time at which the ScanRun started. + google.protobuf.Timestamp start_time = 4; + + // The time at which the ScanRun reached termination state - that the ScanRun + // is either finished or stopped by user. + google.protobuf.Timestamp end_time = 5; + + // The number of URLs crawled during this ScanRun. If the scan is in progress, + // the value represents the number of URLs crawled up to now. + int64 urls_crawled_count = 6; + + // The number of URLs tested during this ScanRun. If the scan is in progress, + // the value represents the number of URLs tested up to now. The number of + // URLs tested is usually larger than the number URLS crawled because + // typically a crawled URL is tested with multiple test payloads. + int64 urls_tested_count = 7; + + // Whether the scan run has found any vulnerabilities. + bool has_vulnerabilities = 8; + + // The percentage of total completion ranging from 0 to 100. + // If the scan is in queue, the value is 0. + // If the scan is running, the value ranges from 0 to 100. + // If the scan is finished, the value is 100. + int32 progress_percent = 9; + + // If result_state is an ERROR, this field provides the primary reason for + // scan's termination and more details, if such are available. + ScanRunErrorTrace error_trace = 10; + + // A list of warnings, if such are encountered during this scan run. + repeated ScanRunWarningTrace warning_traces = 11; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto new file mode 100644 index 00000000000..5eedd11503d --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto @@ -0,0 +1,76 @@ +// 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.websecurityscanner.v1beta; + +import "google/cloud/websecurityscanner/v1beta/scan_config_error.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunErrorTraceProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// Output only. +// Defines an error trace message for a ScanRun. +message ScanRunErrorTrace { + // Output only. + // Defines an error reason code. + // Next id: 7 + enum Code { + // Default value is never used. + CODE_UNSPECIFIED = 0; + + // Indicates that the scan run failed due to an internal server error. + INTERNAL_ERROR = 1; + + // Indicates a scan configuration error, usually due to outdated ScanConfig + // settings, such as starting_urls or the DNS configuration. + SCAN_CONFIG_ISSUE = 2; + + // Indicates an authentication error, usually due to outdated ScanConfig + // authentication settings. + AUTHENTICATION_CONFIG_ISSUE = 3; + + // Indicates a scan operation timeout, usually caused by a very large site. + TIMED_OUT_WHILE_SCANNING = 4; + + // Indicates that a scan encountered excessive redirects, either to + // authentication or some other page outside of the scan scope. + TOO_MANY_REDIRECTS = 5; + + // Indicates that a scan encountered numerous errors from the web site + // pages. When available, most_common_http_error_code field indicates the + // most common HTTP error code encountered during the scan. + TOO_MANY_HTTP_ERRORS = 6; + } + + // Indicates the error reason code. + Code code = 1; + + // If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + // message encountered during scan configuration validation that is performed + // before each scan run. + ScanConfigError scan_config_error = 2; + + // If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + // common HTTP error code, if such is available. For example, if this code is + // 404, the scan has encountered too many NOT_FOUND responses. + int32 most_common_http_error_code = 3; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto new file mode 100644 index 00000000000..0786e94d160 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto @@ -0,0 +1,59 @@ +// 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.websecurityscanner.v1beta; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunWarningTraceProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// Output only. +// Defines a warning trace message for ScanRun. Warning traces provide customers +// with useful information that helps make the scanning process more effective. +message ScanRunWarningTrace { + // Output only. + // Defines a warning message code. + // Next id: 6 + enum Code { + // Default value is never used. + CODE_UNSPECIFIED = 0; + + // Indicates that a scan discovered an unexpectedly low number of URLs. This + // is sometimes caused by complex navigation features or by using a single + // URL for numerous pages. + INSUFFICIENT_CRAWL_RESULTS = 1; + + // Indicates that a scan discovered too many URLs to test, or excessive + // redundant URLs. + TOO_MANY_CRAWL_RESULTS = 2; + + // Indicates that too many tests have been generated for the scan. Customer + // should try reducing the number of starting URLs, increasing the QPS rate, + // or narrowing down the scope of the scan using the excluded patterns. + TOO_MANY_FUZZ_TASKS = 3; + + // Indicates that a scan is blocked by IAP. + BLOCKED_BY_IAP = 4; + } + + // Indicates the warning code. + Code code = 1; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto new file mode 100644 index 00000000000..211affc4cc2 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto @@ -0,0 +1,413 @@ +// 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.websecurityscanner.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/websecurityscanner/v1beta/crawled_url.proto"; +import "google/cloud/websecurityscanner/v1beta/finding.proto"; +import "google/cloud/websecurityscanner/v1beta/finding_type_stats.proto"; +import "google/cloud/websecurityscanner/v1beta/scan_config.proto"; +import "google/cloud/websecurityscanner/v1beta/scan_run.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; +option java_multiple_files = true; +option java_outer_classname = "WebSecurityScannerProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// Cloud Web Security Scanner Service identifies security vulnerabilities in web +// applications hosted on Google Cloud Platform. It crawls your application, and +// attempts to exercise as many user inputs and event handlers as possible. +service WebSecurityScanner { + option (google.api.default_host) = "websecurityscanner.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new ScanConfig. + rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*}/scanConfigs" + body: "scan_config" + }; + option (google.api.method_signature) = "parent,scan_config"; + } + + // Deletes an existing ScanConfig and its child resources. + rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/scanConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a ScanConfig. + rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/scanConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists ScanConfigs under a given project. + rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*}/scanConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates a ScanConfig. This method support partial update of a ScanConfig. + rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + patch: "/v1beta/{scan_config.name=projects/*/scanConfigs/*}" + body: "scan_config" + }; + option (google.api.method_signature) = "scan_config,update_mask"; + } + + // Start a ScanRun according to the given ScanConfig. + rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1beta/{name=projects/*/scanConfigs/*}:start" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a ScanRun. + rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + // stop time. + rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/scanConfigs/*}/scanRuns" + }; + option (google.api.method_signature) = "parent"; + } + + // Stops a ScanRun. The stopped ScanRun is returned. + rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // List CrawledUrls under a given ScanRun. + rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a Finding. + rpc GetFinding(GetFindingRequest) returns (Finding) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List Findings under a given ScanRun. + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" + }; + option (google.api.method_signature) = "parent,filter"; + } + + // List all FindingTypeStats under a given ScanRun. + rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request for the `CreateScanConfig` method. +message CreateScanConfigRequest { + // Required. The parent resource name where the scan is created, which should be a + // project resource name in the format 'projects/{projectId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The ScanConfig to be created. + ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `DeleteScanConfig` method. +message DeleteScanConfigRequest { + // Required. The resource name of the ScanConfig to be deleted. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `GetScanConfig` method. +message GetScanConfigRequest { + // Required. The resource name of the ScanConfig to be returned. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `ListScanConfigs` method. +message ListScanConfigsRequest { + // Required. The parent resource name, which should be a project resource name in the + // format 'projects/{projectId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanConfigs to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Request for the `UpdateScanConfigRequest` method. +message UpdateScanConfigRequest { + // Required. The ScanConfig to be updated. The name field must be set to identify the + // resource to be updated. The values of fields not covered by the mask + // will be ignored. + ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response for the `ListScanConfigs` method. +message ListScanConfigsResponse { + // The list of ScanConfigs returned. + repeated ScanConfig scan_configs = 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 for the `StartScanRun` method. +message StartScanRunRequest { + // Required. The resource name of the ScanConfig to be used. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `GetScanRun` method. +message GetScanRunRequest { + // Required. The resource name of the ScanRun to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Request for the `ListScanRuns` method. +message ListScanRunsRequest { + // Required. The parent resource name, which should be a scan resource name in the + // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanRuns to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListScanRuns` method. +message ListScanRunsResponse { + // The list of ScanRuns returned. + repeated ScanRun scan_runs = 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 for the `StopScanRun` method. +message StopScanRunRequest { + // Required. The resource name of the ScanRun to be stopped. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Request for the `ListCrawledUrls` method. +message ListCrawledUrlsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of CrawledUrls to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListCrawledUrls` method. +message ListCrawledUrlsResponse { + // The list of CrawledUrls returned. + repeated CrawledUrl crawled_urls = 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 for the `GetFinding` method. +message GetFindingRequest { + // Required. The resource name of the Finding to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/Finding" + } + ]; +} + +// Request for the `ListFindings` method. +message ListFindingsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; + + // Required. The filter expression. The expression must be in the format: + // . + // Supported field: 'finding_type'. + // Supported operator: '='. + string filter = 2 [(google.api.field_behavior) = REQUIRED]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 3; + + // The maximum number of Findings to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 4; +} + +// Response for the `ListFindings` method. +message ListFindingsResponse { + // The list of Findings returned. + repeated Finding findings = 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 for the `ListFindingTypeStats` method. +message ListFindingTypeStatsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Response for the `ListFindingTypeStats` method. +message ListFindingTypeStatsResponse { + // The list of FindingTypeStats returned. + repeated FindingTypeStats finding_type_stats = 1; +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json new file mode 100644 index 00000000000..88fc2b3b4de --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json @@ -0,0 +1,579 @@ +{ + "clientLibrary": { + "name": "nodejs-websecurityscanner", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.websecurityscanner.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async", + "title": "WebSecurityScanner createScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new ScanConfig.", + "canonical": true, + "file": "web_security_scanner.create_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.CreateScanConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1beta.ScanConfig" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.CreateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async", + "title": "WebSecurityScanner deleteScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing ScanConfig and its child resources.", + "canonical": true, + "file": "web_security_scanner.delete_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.DeleteScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.DeleteScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async", + "title": "WebSecurityScanner getScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.get_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async", + "title": "WebSecurityScanner listScanConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanConfigs under a given project.", + "canonical": true, + "file": "web_security_scanner.list_scan_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ListScanConfigsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanConfigs", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async", + "title": "WebSecurityScanner updateScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.update_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.UpdateScanConfig", + "async": true, + "parameters": [ + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1beta.ScanConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.UpdateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async", + "title": "WebSecurityScanner startScanRun Sample", + "origin": "API_DEFINITION", + "description": " Start a ScanRun according to the given ScanConfig.", + "canonical": true, + "file": "web_security_scanner.start_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StartScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StartScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async", + "title": "WebSecurityScanner getScanRun Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanRun.", + "canonical": true, + "file": "web_security_scanner.get_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async", + "title": "WebSecurityScanner listScanRuns Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", + "canonical": true, + "file": "web_security_scanner.list_scan_runs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanRuns", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ListScanRunsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanRuns", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async", + "title": "WebSecurityScanner stopScanRun Sample", + "origin": "API_DEFINITION", + "description": " Stops a ScanRun. The stopped ScanRun is returned.", + "canonical": true, + "file": "web_security_scanner.stop_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StopScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StopScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async", + "title": "WebSecurityScanner listCrawledUrls Sample", + "origin": "API_DEFINITION", + "description": " List CrawledUrls under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_crawled_urls.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListCrawledUrls", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ListCrawledUrlsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListCrawledUrls", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async", + "title": "WebSecurityScanner getFinding Sample", + "origin": "API_DEFINITION", + "description": " Gets a Finding.", + "canonical": true, + "file": "web_security_scanner.get_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetFinding", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.Finding", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetFinding", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async", + "title": "WebSecurityScanner listFindings Sample", + "origin": "API_DEFINITION", + "description": " List Findings under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ListFindingsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindings", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async", + "title": "WebSecurityScanner listFindingTypeStats Sample", + "origin": "API_DEFINITION", + "description": " List all FindingTypeStats under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_finding_type_stats.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindingTypeStats", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindingTypeStats", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js new file mode 100644 index 00000000000..e4467b5df85 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_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(parent, scanConfig) { + // [START websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * Required. The ScanConfig to be created. + */ + // const scanConfig = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callCreateScanConfig() { + // Construct request + const request = { + parent, + scanConfig, + }; + + // Run request + const response = await websecurityscannerClient.createScanConfig(request); + console.log(response); + } + + callCreateScanConfig(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js new file mode 100644 index 00000000000..9da6d0f71f2 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_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 websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callDeleteScanConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.deleteScanConfig(request); + console.log(response); + } + + callDeleteScanConfig(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js new file mode 100644 index 00000000000..4f1654f5b1e --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetFinding() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getFinding(request); + console.log(response); + } + + callGetFinding(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js new file mode 100644 index 00000000000..bd8361ad4e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getScanConfig(request); + console.log(response); + } + + callGetScanConfig(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js new file mode 100644 index 00000000000..09f165b14e2 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getScanRun(request); + console.log(response); + } + + callGetScanRun(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js new file mode 100644 index 00000000000..80a10d20dda --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.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 websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListCrawledUrls() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCrawledUrls(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js new file mode 100644 index 00000000000..1e3e18c1ae4 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.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(parent) { + // [START websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindingTypeStats() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await websecurityscannerClient.listFindingTypeStats(request); + console.log(response); + } + + callListFindingTypeStats(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js new file mode 100644 index 00000000000..91eb930b6f8 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.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, filter) { + // [START websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + */ + // const filter = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindings() { + // Construct request + const request = { + parent, + filter, + }; + + // Run request + const iterable = await websecurityscannerClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js new file mode 100644 index 00000000000..b0e43fc1ffe --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.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) { + // [START websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a project resource name in the + * format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listScanConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanConfigs(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js new file mode 100644 index 00000000000..aa7864be349 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.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) { + // [START websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanRuns() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listScanRunsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanRuns(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js new file mode 100644 index 00000000000..9a77e49f494 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.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 websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStartScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.startScanRun(request); + console.log(response); + } + + callStartScanRun(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js new file mode 100644 index 00000000000..f9484ca36ab --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.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 websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStopScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.stopScanRun(request); + console.log(response); + } + + callStopScanRun(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js new file mode 100644 index 00000000000..243e4ef4686 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.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(scanConfig, updateMask) { + // [START websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + */ + // const scanConfig = {} + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callUpdateScanConfig() { + // Construct request + const request = { + scanConfig, + updateMask, + }; + + // Run request + const response = await websecurityscannerClient.updateScanConfig(request); + console.log(response); + } + + callUpdateScanConfig(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/index.ts new file mode 100644 index 00000000000..e31a247796d --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 WebSecurityScannerClient = v1beta.WebSecurityScannerClient; +type WebSecurityScannerClient = v1beta.WebSecurityScannerClient; +export {v1beta, WebSecurityScannerClient}; +export default {v1beta, WebSecurityScannerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/gapic_metadata.json new file mode 100644 index 00000000000..c531caa029b --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/gapic_metadata.json @@ -0,0 +1,169 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.websecurityscanner.v1beta", + "libraryPackage": "@google-cloud/web-security-scanner", + "services": { + "WebSecurityScanner": { + "clients": { + "grpc": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/index.ts new file mode 100644 index 00000000000..c4b9ebe89d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client.ts new file mode 100644 index 00000000000..51d2f80dd97 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client.ts @@ -0,0 +1,1927 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1beta/web_security_scanner_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './web_security_scanner_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Cloud Web Security Scanner Service identifies security vulnerabilities in web + * applications hosted on Google Cloud Platform. It crawls your application, and + * attempts to exercise as many user inputs and event handlers as possible. + * @class + * @memberof v1beta + */ +export class WebSecurityScannerClient { + 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}; + webSecurityScannerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WebSecurityScannerClient. + * + * @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 WebSecurityScannerClient({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 WebSecurityScannerClient; + 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 = { + findingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + scanConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}' + ), + scanRunPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}' + ), + }; + + // 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 = { + listScanConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), + listScanRuns: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), + listCrawledUrls: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.websecurityscanner.v1beta.WebSecurityScanner', 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.webSecurityScannerStub) { + return this.webSecurityScannerStub; + } + + // Put together the "service stub" for + // google.cloud.websecurityscanner.v1beta.WebSecurityScanner. + this.webSecurityScannerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1beta.WebSecurityScanner') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.websecurityscanner.v1beta.WebSecurityScanner, + 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 webSecurityScannerStubMethods = + ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; + for (const methodName of webSecurityScannerStubMethods) { + const callPromise = this.webSecurityScannerStub.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.webSecurityScannerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'websecurityscanner.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 'websecurityscanner.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 -- + // ------------------- +/** + * Creates a new ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig + * Required. The ScanConfig 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.websecurityscanner.v1beta.ScanConfig|ScanConfig}. + * Please see the {@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/web_security_scanner.create_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async + */ + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|undefined, {}|undefined + ]>; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createScanConfig(request, options, callback); + } +/** + * Deletes an existing ScanConfig and its child resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1beta/web_security_scanner.delete_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async + */ + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|undefined, {}|undefined + ]>; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteScanConfig(request, options, callback); + } +/** + * Gets a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. + * Please see the {@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/web_security_scanner.get_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async + */ + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|undefined, {}|undefined + ]>; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getScanConfig(request, options, callback); + } +/** + * Updates a ScanConfig. This method support partial update of a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * 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.websecurityscanner.v1beta.ScanConfig|ScanConfig}. + * Please see the {@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/web_security_scanner.update_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async + */ + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|undefined, {}|undefined + ]>; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scan_config.name': request.scanConfig!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateScanConfig(request, options, callback); + } +/** + * Start a ScanRun according to the given ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. + * Please see the {@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/web_security_scanner.start_scan_run.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async + */ + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|undefined, {}|undefined + ]>; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.startScanRun(request, options, callback); + } +/** + * Gets a ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. + * Please see the {@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/web_security_scanner.get_scan_run.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async + */ + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|undefined, {}|undefined + ]>; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getScanRun(request, options, callback); + } +/** + * Stops a ScanRun. The stopped ScanRun is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. + * Please see the {@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/web_security_scanner.stop_scan_run.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async + */ + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|undefined, {}|undefined + ]>; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.stopScanRun(request, options, callback); + } +/** + * Gets a Finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.Finding|Finding}. + * Please see the {@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/web_security_scanner.get_finding.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async + */ + getFinding( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|undefined, {}|undefined + ]>; + getFinding( + request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFinding(request, options, callback); + } +/** + * List all FindingTypeStats under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. + * Please see the {@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/web_security_scanner.list_finding_type_stats.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async + */ + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|undefined, {}|undefined + ]>; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFindingTypeStats(request, options, callback); + } + + /** + * Lists ScanConfigs under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1beta.ScanConfig|ScanConfig}. + * 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 `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse + ]>; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): void; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): void; + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listScanConfigs(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 name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1beta.ScanConfig|ScanConfig} 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 `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanConfigsStream( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + 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['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.createStream( + this.innerApiCalls.listScanConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanConfigs`, 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 name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1beta.ScanConfig|ScanConfig}. 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/web_security_scanner.list_scan_configs.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async + */ + listScanConfigsAsync( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + 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['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.asyncIterate( + this.innerApiCalls['listScanConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + * stop time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1beta.ScanRun|ScanRun}. + * 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 `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun[], + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse + ]>; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun>): void; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun>): void; + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun[], + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listScanRuns(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 name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1beta.ScanRun|ScanRun} 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 `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listScanRunsStream( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + 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['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.createStream( + this.innerApiCalls.listScanRuns as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanRuns`, 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 name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1beta.ScanRun|ScanRun}. 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/web_security_scanner.list_scan_runs.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async + */ + listScanRunsAsync( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + 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['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.asyncIterate( + this.innerApiCalls['listScanRuns'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List CrawledUrls under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1beta.CrawledUrl|CrawledUrl}. + * 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 `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse + ]>; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): void; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): void; + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listCrawledUrls(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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1beta.CrawledUrl|CrawledUrl} 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 `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCrawledUrlsStream( + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + 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['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.createStream( + this.innerApiCalls.listCrawledUrls as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCrawledUrls`, 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1beta.CrawledUrl|CrawledUrl}. 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/web_security_scanner.list_crawled_urls.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async + */ + listCrawledUrlsAsync( + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + 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['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.asyncIterate( + this.innerApiCalls['listCrawledUrls'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List Findings under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1beta.Finding|Finding}. + * 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 `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFindings( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IFinding[], + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding>): void; + listFindings( + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding>): void; + listFindings( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IFinding[], + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFindings(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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1beta.Finding|Finding} 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 `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFindingsStream( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + 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['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.createStream( + this.innerApiCalls.listFindings as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFindings`, 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 name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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.websecurityscanner.v1beta.Finding|Finding}. 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/web_security_scanner.list_findings.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + 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['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.asyncIterate( + this.innerApiCalls['listFindings'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified finding resource name string. + * + * @param {string} project + * @param {string} scan_config + * @param {string} scan_run + * @param {string} finding + * @returns {string} Resource name string. + */ + findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { + return this.pathTemplates.findingPathTemplate.render({ + project: project, + scan_config: scanConfig, + scan_run: scanRun, + finding: finding, + }); + } + + /** + * Parse the project from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).project; + } + + /** + * Parse the scan_config from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; + } + + /** + * Parse the scan_run from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_run. + */ + matchScanRunFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; + } + + /** + * Parse the finding from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).finding; + } + + /** + * 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 scanConfig resource name string. + * + * @param {string} project + * @param {string} scan_config + * @returns {string} Resource name string. + */ + scanConfigPath(project:string,scanConfig:string) { + return this.pathTemplates.scanConfigPathTemplate.render({ + project: project, + scan_config: scanConfig, + }); + } + + /** + * Parse the project from ScanConfig resource. + * + * @param {string} scanConfigName + * A fully-qualified path representing ScanConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromScanConfigName(scanConfigName: string) { + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).project; + } + + /** + * Parse the scan_config from ScanConfig resource. + * + * @param {string} scanConfigName + * A fully-qualified path representing ScanConfig resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromScanConfigName(scanConfigName: string) { + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).scan_config; + } + + /** + * Return a fully-qualified scanRun resource name string. + * + * @param {string} project + * @param {string} scan_config + * @param {string} scan_run + * @returns {string} Resource name string. + */ + scanRunPath(project:string,scanConfig:string,scanRun:string) { + return this.pathTemplates.scanRunPathTemplate.render({ + project: project, + scan_config: scanConfig, + scan_run: scanRun, + }); + } + + /** + * Parse the project from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the project. + */ + matchProjectFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).project; + } + + /** + * Parse the scan_config from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_config; + } + + /** + * Parse the scan_run from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the scan_run. + */ + matchScanRunFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_run; + } + + /** + * 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.webSecurityScannerStub && !this._terminated) { + return this.webSecurityScannerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client_config.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client_config.json new file mode 100644 index 00000000000..ecb06a1b541 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client_config.json @@ -0,0 +1,91 @@ +{ + "interfaces": { + "google.cloud.websecurityscanner.v1beta.WebSecurityScanner": { + "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": { + "CreateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanConfigs": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanRuns": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "StopScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListCrawledUrls": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetFinding": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindingTypeStats": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_proto_list.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_proto_list.json new file mode 100644 index 00000000000..abb184881d5 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/finding.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/scan_config.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/scan_run.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto" +] diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..54b6f3aa5e5 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 websecurityscanner = require('@google-cloud/web-security-scanner'); + +function main() { + const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..3bd84309184 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; + +// check that the client class type name can be used +function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const webSecurityScannerClient = new WebSecurityScannerClient(); + doStuffWithWebSecurityScannerClient(webSecurityScannerClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1beta/test/gapic_web_security_scanner_v1beta.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/test/gapic_web_security_scanner_v1beta.ts new file mode 100644 index 00000000000..00fc295313a --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/test/gapic_web_security_scanner_v1beta.ts @@ -0,0 +1,2324 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 websecurityscannerModule 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('v1beta.WebSecurityScannerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = websecurityscannerModule.v1beta.WebSecurityScannerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = websecurityscannerModule.v1beta.WebSecurityScannerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = websecurityscannerModule.v1beta.WebSecurityScannerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + await client.initialize(); + assert(client.webSecurityScannerStub); + }); + + it('has close method for the initialized client', done => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.webSecurityScannerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + 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 websecurityscannerModule.v1beta.WebSecurityScannerClient({ + 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('createScanConfig', () => { + it('invokes createScanConfig without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() + ); + client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() + ); + client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createScanConfig(request), expectedError); + }); + }); + + describe('deleteScanConfig', () => { + it('invokes deleteScanConfig without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteScanConfig( + 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.deleteScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteScanConfig(request), expectedError); + }); + }); + + describe('getScanConfig', () => { + it('invokes getScanConfig without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() + ); + client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() + ); + client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanConfig(request), expectedError); + }); + }); + + describe('updateScanConfig', () => { + it('invokes updateScanConfig without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() + ); + client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() + ); + client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateScanConfig with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateScanConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() + ); + request.scanConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); + request.scanConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateScanConfig(request), expectedError); + }); + }); + + describe('startScanRun', () => { + it('invokes startScanRun without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun() + ); + client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.startScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun() + ); + client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startScanRun with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.startScanRun(request), expectedError); + const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.startScanRun(request), expectedError); + }); + }); + + describe('getScanRun', () => { + it('invokes getScanRun without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun() + ); + client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.getScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun() + ); + client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanRun with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanRun(request), expectedError); + const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanRun(request), expectedError); + }); + }); + + describe('stopScanRun', () => { + it('invokes stopScanRun without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun() + ); + client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.stopScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun() + ); + client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopScanRun with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.stopScanRun(request), expectedError); + const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.stopScanRun(request), expectedError); + }); + }); + + describe('getFinding', () => { + it('invokes getFinding without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding() + ); + client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); + const [response] = await client.getFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFinding without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding() + ); + client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFinding( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFinding with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFinding(request), expectedError); + const actualRequest = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFinding with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFinding(request), expectedError); + }); + }); + + describe('listFindingTypeStats', () => { + it('invokes listFindingTypeStats without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse() + ); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); + const [response] = await client.listFindingTypeStats(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse() + ); + client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindingTypeStats( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + }); + }); + + describe('listScanConfigs', () => { + it('invokes listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listScanConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigs without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigsStream without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig) => { + 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.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listScanConfigsStream with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = []; + const iterable = client.listScanConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listScanRuns', () => { + it('invokes listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); + const [response] = await client.listScanRuns(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRuns without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanRuns( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanRuns(request), expectedError); + const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRunsStream without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + ]; + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { + 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.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listScanRunsStream with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + ]; + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = []; + const iterable = client.listScanRunsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanRunsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listCrawledUrls', () => { + it('invokes listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); + const [response] = await client.listCrawledUrls(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrls without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCrawledUrls( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCrawledUrls(request), expectedError); + const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrlsStream without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl) => { + 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.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listCrawledUrlsStream with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = []; + const iterable = client.listCrawledUrlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCrawledUrlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IFinding[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindings(request), expectedError); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingsStream without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { + 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.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFindingsStream with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('finding', () => { + const fakePath = "/rendered/path/finding"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + scan_run: "scanRunValue", + finding: "findingValue", + }; + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.findingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.findingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('findingPath', () => { + const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFindingName', () => { + const result = client.matchProjectFromFindingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromFindingName', () => { + const result = client.matchScanConfigFromFindingName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanRunFromFindingName', () => { + const result = client.matchScanRunFromFindingName(fakePath); + assert.strictEqual(result, "scanRunValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFindingName', () => { + const result = client.matchFindingFromFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + 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('scanConfig', () => { + const fakePath = "/rendered/path/scanConfig"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + }; + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.scanConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.scanConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('scanConfigPath', () => { + const result = client.scanConfigPath("projectValue", "scanConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.scanConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromScanConfigName', () => { + const result = client.matchProjectFromScanConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromScanConfigName', () => { + const result = client.matchScanConfigFromScanConfigName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('scanRun', () => { + const fakePath = "/rendered/path/scanRun"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + scan_run: "scanRunValue", + }; + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.scanRunPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.scanRunPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('scanRunPath', () => { + const result = client.scanRunPath("projectValue", "scanConfigValue", "scanRunValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.scanRunPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromScanRunName', () => { + const result = client.matchProjectFromScanRunName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromScanRunName', () => { + const result = client.matchScanConfigFromScanRunName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanRunFromScanRunName', () => { + const result = client.matchScanRunFromScanRunName(fakePath); + assert.strictEqual(result, "scanRunValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/webpack.config.js new file mode 100644 index 00000000000..ad3467d60d6 --- /dev/null +++ b/owl-bot-staging/google-cloud-websecurityscanner/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: 'WebSecurityScanner', + filename: './web-security-scanner.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-workflows-executions/executions/v1/.eslintignore b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintrc.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.gitignore b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1/.jsdoc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.jsdoc.js new file mode 100644 index 00000000000..b828ae8128e --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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/workflow-executions', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.mocharc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1/.prettierrc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1/README.md b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/README.md new file mode 100644 index 00000000000..79032bbed45 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/README.md @@ -0,0 +1 @@ +Executions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/package.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/package.json new file mode 100644 index 00000000000..e8d6c4f5a1c --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/workflow-executions", + "version": "0.1.0", + "description": "Executions client for Node.js", + "repository": "googleapis/nodejs-executions", + "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 executions", + "executions", + "executions" + ], + "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-workflows-executions/executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto new file mode 100644 index 00000000000..0c6bc12cbed --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto @@ -0,0 +1,399 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.workflows.executions.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/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/workflows/executions/apiv1/executionspb;executionspb"; +option java_multiple_files = true; +option java_outer_classname = "ExecutionsProto"; +option java_package = "com.google.cloud.workflows.executions.v1"; +option (google.api.resource_definition) = { + type: "workflows.googleapis.com/Workflow" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}" +}; + +// Executions is used to start and manage running instances of +// [Workflows][google.cloud.workflows.v1.Workflow] called executions. +service Executions { + option (google.api.default_host) = "workflowexecutions.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a list of executions which belong to the workflow with + // the given name. The method returns executions of all workflow + // revisions. Returned executions are ordered by their start time (newest + // first). + rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/workflows/*}/executions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new execution using the latest revision of the given workflow. + rpc CreateExecution(CreateExecutionRequest) returns (Execution) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/workflows/*}/executions" + body: "execution" + }; + option (google.api.method_signature) = "parent,execution"; + } + + // Returns an execution of the given name. + rpc GetExecution(GetExecutionRequest) returns (Execution) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Cancels an execution of the given name. + rpc CancelExecution(CancelExecutionRequest) returns (Execution) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}:cancel" + body: "*" + }; + option (google.api.method_signature) = "name"; + } +} + +// A running instance of a +// [Workflow](/workflows/docs/reference/rest/v1/projects.locations.workflows). +message Execution { + option (google.api.resource) = { + type: "workflowexecutions.googleapis.com/Execution" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}" + }; + + // Describes the current state of the execution. More states might be added + // in the future. + enum State { + // Invalid state. + STATE_UNSPECIFIED = 0; + + // The execution is in progress. + ACTIVE = 1; + + // The execution finished successfully. + SUCCEEDED = 2; + + // The execution failed with an error. + FAILED = 3; + + // The execution was stopped intentionally. + CANCELLED = 4; + + // Execution data is unavailable. See the `state_error` field. + UNAVAILABLE = 5; + + // Request has been placed in the backlog for processing at a later time. + QUEUED = 6; + } + + // A single stack element (frame) where an error occurred. + message StackTraceElement { + // Position contains source position information about the stack trace + // element such as line number, column number and length of the code block + // in bytes. + message Position { + // The source code line number the current instruction was generated from. + int64 line = 1; + + // The source code column position (of the line) the current instruction + // was generated from. + int64 column = 2; + + // The number of bytes of source code making up this stack trace element. + int64 length = 3; + } + + // The step the error occurred at. + string step = 1; + + // The routine where the error occurred. + string routine = 2; + + // The source position information of the stack trace element. + Position position = 3; + } + + // A collection of stack elements (frames) where an error occurred. + message StackTrace { + // An array of stack elements. + repeated StackTraceElement elements = 1; + } + + // Error describes why the execution was abnormally terminated. + message Error { + // Error message and data returned represented as a JSON string. + string payload = 1; + + // Human-readable stack trace string. + string context = 2; + + // Stack trace with detailed information of where error was generated. + StackTrace stack_trace = 3; + } + + // Describes the level of platform logging to apply to calls and call + // responses during workflow executions. + enum CallLogLevel { + // No call logging level specified. + CALL_LOG_LEVEL_UNSPECIFIED = 0; + + // Log all call steps within workflows, all call returns, and all exceptions + // raised. + LOG_ALL_CALLS = 1; + + // Log only exceptions that are raised from call steps within workflows. + LOG_ERRORS_ONLY = 2; + + // Explicitly log nothing. + LOG_NONE = 3; + } + + // Represents the current status of this execution. + message Status { + // Represents a step of the workflow this execution is running. + message Step { + // Name of a routine within the workflow. + string routine = 1; + + // Name of a step within the routine. + string step = 2; + } + + // A list of currently executing or last executed step names for the + // workflow execution currently running. If the workflow has succeeded or + // failed, this is the last attempted or executed step. Presently, if the + // current step is inside a subworkflow, the list only includes that step. + // In the future, the list will contain items for each step in the call + // stack, starting with the outermost step in the `main` subworkflow, and + // ending with the most deeply nested step. + repeated Step current_steps = 1; + } + + // Describes an error related to the current state of the Execution resource. + message StateError { + // Describes the possible types of a state error. + enum Type { + // No type specified. + TYPE_UNSPECIFIED = 0; + + // Caused by an issue with KMS. + KMS_ERROR = 1; + } + + // Provides specifics about the error. + string details = 1; + + // The type of this state error. + Type type = 2; + } + + // Output only. The resource name of the execution. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Marks the beginning of execution. + google.protobuf.Timestamp start_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Marks the end of execution, successful or not. + google.protobuf.Timestamp end_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Measures the duration of the execution. + google.protobuf.Duration duration = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Current state of the execution. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input parameters of the execution represented as a JSON string. + // The size limit is 32KB. + // + // *Note*: If you are using the REST API directly to run your workflow, you + // must escape any JSON string value of `argument`. Example: + // `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'` + string argument = 5; + + // Output only. Output of the execution represented as a JSON string. The + // value can only be present if the execution's state is `SUCCEEDED`. + string result = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The error which caused the execution to finish prematurely. + // The value is only present if the execution's state is `FAILED` + // or `CANCELLED`. + Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Revision of the workflow this execution is using. + string workflow_revision_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The call logging level associated to this execution. + CallLogLevel call_log_level = 9; + + // Output only. Status tracks the current steps and progress data of this + // execution. + Status status = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this execution. + // Labels can contain at most 64 entries. Keys and values can be no longer + // than 63 characters and can only contain lowercase letters, numeric + // characters, underscores, and dashes. Label keys must start with a letter. + // International characters are allowed. + // By default, labels are inherited from the workflow but are overridden by + // any labels associated with the execution. + map labels = 11; + + // Output only. Error regarding the state of the Execution resource. For + // example, this field will have error details if the execution data is + // unavailable due to revoked KMS key permissions. + StateError state_error = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for the +// [ListExecutions][] +// method. +message ListExecutionsRequest { + // Required. Name of the workflow for which the executions should be listed. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; + + // Maximum number of executions to return per call. + // Max supported value depends on the selected Execution view: it's 1000 for + // BASIC and 100 for FULL. The default value used if the field is not + // specified is 100, regardless of the selected view. Values greater than + // the max value will be coerced down to it. + int32 page_size = 2; + + // A page token, received from a previous `ListExecutions` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListExecutions` must + // match the call that provided the page token. + // + // Note that pagination is applied to dynamic data. The list of executions + // returned can change between page requests. + string page_token = 3; + + // Optional. A view defining which fields should be filled in the returned + // executions. The API will default to the BASIC view. + ExecutionView view = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Filters applied to the [Executions.ListExecutions] results. + // The following fields are supported for filtering: + // executionID, state, startTime, endTime, duration, workflowRevisionID, + // stepName, and label. + string filter = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The ordering applied to the [Executions.ListExecutions] results. + // By default the ordering is based on descending start time. + // The following fields are supported for order by: + // executionID, startTime, endTime, duration, state, and workflowRevisionID. + string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for the +// [ListExecutions][google.cloud.workflows.executions.v1.Executions.ListExecutions] +// method. +message ListExecutionsResponse { + // The executions which match the request. + repeated Execution executions = 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 for the +// [CreateExecution][google.cloud.workflows.executions.v1.Executions.CreateExecution] +// method. +message CreateExecutionRequest { + // Required. Name of the workflow for which an execution should be created. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + // The latest revision of the workflow will be used. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; + + // Required. Execution to be created. + Execution execution = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the +// [GetExecution][google.cloud.workflows.executions.v1.Executions.GetExecution] +// method. +message GetExecutionRequest { + // Required. Name of the execution to be retrieved. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflowexecutions.googleapis.com/Execution" + } + ]; + + // Optional. A view defining which fields should be filled in the returned + // execution. The API will default to the FULL view. + ExecutionView view = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the +// [CancelExecution][google.cloud.workflows.executions.v1.Executions.CancelExecution] +// method. +message CancelExecutionRequest { + // Required. Name of the execution to be cancelled. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflowexecutions.googleapis.com/Execution" + } + ]; +} + +// Defines possible views for execution resource. +enum ExecutionView { + // The default / unset value. + EXECUTION_VIEW_UNSPECIFIED = 0; + + // Includes only basic metadata about the execution. + // The following fields are returned: name, start_time, end_time, duration, + // state, and workflow_revision_id. + BASIC = 1; + + // Includes all data. + FULL = 2; +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.cancel_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.cancel_execution.js new file mode 100644 index 00000000000..b8a19229162 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.cancel_execution.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 workflowexecutions_v1_generated_Executions_CancelExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + */ + // const name = 'abc123' + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callCancelExecution() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await executionsClient.cancelExecution(request); + console.log(response); + } + + callCancelExecution(); + // [END workflowexecutions_v1_generated_Executions_CancelExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.create_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.create_execution.js new file mode 100644 index 00000000000..bf837b7d241 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.create_execution.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(parent, execution) { + // [START workflowexecutions_v1_generated_Executions_CreateExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + */ + // const parent = 'abc123' + /** + * Required. Execution to be created. + */ + // const execution = {} + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callCreateExecution() { + // Construct request + const request = { + parent, + execution, + }; + + // Run request + const response = await executionsClient.createExecution(request); + console.log(response); + } + + callCreateExecution(); + // [END workflowexecutions_v1_generated_Executions_CreateExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.get_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.get_execution.js new file mode 100644 index 00000000000..ffd888596ee --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.get_execution.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 workflowexecutions_v1_generated_Executions_GetExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + */ + // const name = 'abc123' + /** + * Optional. A view defining which fields should be filled in the returned + * execution. The API will default to the FULL view. + */ + // const view = {} + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callGetExecution() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await executionsClient.getExecution(request); + console.log(response); + } + + callGetExecution(); + // [END workflowexecutions_v1_generated_Executions_GetExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.list_executions.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.list_executions.js new file mode 100644 index 00000000000..ac929e06a2f --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.list_executions.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(parent) { + // [START workflowexecutions_v1_generated_Executions_ListExecutions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + */ + // const parent = 'abc123' + /** + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + */ + // const pageToken = 'abc123' + /** + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + */ + // const view = {} + /** + * Optional. Filters applied to the Executions.ListExecutions results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + */ + // const filter = 'abc123' + /** + * Optional. The ordering applied to the Executions.ListExecutions results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + */ + // const orderBy = 'abc123' + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callListExecutions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await executionsClient.listExecutionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListExecutions(); + // [END workflowexecutions_v1_generated_Executions_ListExecutions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json new file mode 100644 index 00000000000..f17cc1ffd26 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json @@ -0,0 +1,203 @@ +{ + "clientLibrary": { + "name": "nodejs-executions", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.workflows.executions.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "workflowexecutions_v1_generated_Executions_ListExecutions_async", + "title": "Executions listExecutions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).", + "canonical": true, + "file": "executions.list_executions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 92, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListExecutions", + "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", + "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.workflows.executions.v1.ExecutionView" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.executions.v1.ListExecutionsResponse", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" + }, + "method": { + "shortName": "ListExecutions", + "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1_generated_Executions_CreateExecution_async", + "title": "Executions createExecution Sample", + "origin": "API_DEFINITION", + "description": " Creates a new execution using the latest revision of the given workflow.", + "canonical": true, + "file": "executions.create_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "execution", + "type": ".google.cloud.workflows.executions.v1.Execution" + } + ], + "resultType": ".google.cloud.workflows.executions.v1.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" + }, + "method": { + "shortName": "CreateExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1_generated_Executions_GetExecution_async", + "title": "Executions getExecution Sample", + "origin": "API_DEFINITION", + "description": " Returns an execution of the given name.", + "canonical": true, + "file": "executions.get_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.workflows.executions.v1.ExecutionView" + } + ], + "resultType": ".google.cloud.workflows.executions.v1.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" + }, + "method": { + "shortName": "GetExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1_generated_Executions_CancelExecution_async", + "title": "Executions cancelExecution Sample", + "origin": "API_DEFINITION", + "description": " Cancels an execution of the given name.", + "canonical": true, + "file": "executions.cancel_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CancelExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.executions.v1.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" + }, + "method": { + "shortName": "CancelExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1.Executions" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/index.ts new file mode 100644 index 00000000000..ff3697c6287 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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 ExecutionsClient = v1.ExecutionsClient; +type ExecutionsClient = v1.ExecutionsClient; +export {v1, ExecutionsClient}; +export default {v1, ExecutionsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client.ts new file mode 100644 index 00000000000..4ad0a31c467 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client.ts @@ -0,0 +1,909 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/executions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './executions_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Executions is used to start and manage running instances of + * {@link protos.google.cloud.workflows.v1.Workflow|Workflows} called executions. + * @class + * @memberof v1 + */ +export class ExecutionsClient { + 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}; + executionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ExecutionsClient. + * + * @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 ExecutionsClient({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 ExecutionsClient; + 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 = { + executionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}' + ), + workflowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}' + ), + }; + + // 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 = { + listExecutions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.workflows.executions.v1.Executions', 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.executionsStub) { + return this.executionsStub; + } + + // Put together the "service stub" for + // google.cloud.workflows.executions.v1.Executions. + this.executionsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1.Executions') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workflows.executions.v1.Executions, + 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 executionsStubMethods = + ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; + for (const methodName of executionsStubMethods) { + const callPromise = this.executionsStub.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.executionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'workflowexecutions.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 'workflowexecutions.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 -- + // ------------------- +/** + * Creates a new execution using the latest revision of the given workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @param {google.cloud.workflows.executions.v1.Execution} request.execution + * Required. Execution 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.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.create_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_CreateExecution_async + */ + createExecution( + request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined + ]>; + createExecution( + request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; + createExecution( + request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; + createExecution( + request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createExecution(request, options, callback); + } +/** + * Returns an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * execution. The API will default to the FULL 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.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.get_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_GetExecution_async + */ + getExecution( + request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined + ]>; + getExecution( + request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; + getExecution( + request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; + getExecution( + request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getExecution(request, options, callback); + } +/** + * Cancels an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.cancel_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_CancelExecution_async + */ + cancelExecution( + request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined + ]>; + cancelExecution( + request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; + cancelExecution( + request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; + cancelExecution( + request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.cancelExecution(request, options, callback); + } + + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.workflows.executions.v1.Execution|Execution}. + * 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExecutions( + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution[], + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + ]>; + listExecutions( + request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>): void; + listExecutions( + request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>): void; + listExecutions( + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>, + callback?: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution[], + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @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.workflows.executions.v1.Execution|Execution} 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExecutionsStream( + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + 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['listExecutions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExecutions.createStream( + this.innerApiCalls.listExecutions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @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.workflows.executions.v1.Execution|Execution}. 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/executions.list_executions.js + * region_tag:workflowexecutions_v1_generated_Executions_ListExecutions_async + */ + listExecutionsAsync( + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + 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['listExecutions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExecutions.asyncIterate( + this.innerApiCalls['listExecutions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified execution resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @param {string} execution + * @returns {string} Resource name string. + */ + executionPath(project:string,location:string,workflow:string,execution:string) { + return this.pathTemplates.executionPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + execution: execution, + }); + } + + /** + * Parse the project from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the project. + */ + matchProjectFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).project; + } + + /** + * Parse the location from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the location. + */ + matchLocationFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).location; + } + + /** + * Parse the workflow from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).workflow; + } + + /** + * Parse the execution from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the execution. + */ + matchExecutionFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).execution; + } + + /** + * Return a fully-qualified workflow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @returns {string} Resource name string. + */ + workflowPath(project:string,location:string,workflow:string) { + return this.pathTemplates.workflowPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + }); + } + + /** + * Parse the project from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).project; + } + + /** + * Parse the location from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).location; + } + + /** + * Parse the workflow from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; + } + + /** + * 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.executionsStub && !this._terminated) { + return this.executionsStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client_config.json new file mode 100644 index 00000000000..ea2d78fc822 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client_config.json @@ -0,0 +1,42 @@ +{ + "interfaces": { + "google.cloud.workflows.executions.v1.Executions": { + "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": { + "ListExecutions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CancelExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_proto_list.json new file mode 100644 index 00000000000..3cffd5df199 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/workflows/executions/v1/executions.proto" +] diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..aea61267fec --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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.workflows.executions.v1", + "libraryPackage": "@google-cloud/workflow-executions", + "services": { + "Executions": { + "clients": { + "grpc": { + "libraryClient": "ExecutionsClient", + "rpcs": { + "CreateExecution": { + "methods": [ + "createExecution" + ] + }, + "GetExecution": { + "methods": [ + "getExecution" + ] + }, + "CancelExecution": { + "methods": [ + "cancelExecution" + ] + }, + "ListExecutions": { + "methods": [ + "listExecutions", + "listExecutionsStream", + "listExecutionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ExecutionsClient", + "rpcs": { + "CreateExecution": { + "methods": [ + "createExecution" + ] + }, + "GetExecution": { + "methods": [ + "getExecution" + ] + }, + "CancelExecution": { + "methods": [ + "cancelExecution" + ] + }, + "ListExecutions": { + "methods": [ + "listExecutions", + "listExecutionsStream", + "listExecutionsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/index.ts new file mode 100644 index 00000000000..a89e8389c4c --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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 {ExecutionsClient} from './executions_client'; diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..bc1d8c8fefe --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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 executions = require('@google-cloud/workflow-executions'); + +function main() { + const executionsClient = new executions.ExecutionsClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..74314a42866 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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 {ExecutionsClient} from '@google-cloud/workflow-executions'; + +// check that the client class type name can be used +function doStuffWithExecutionsClient(client: ExecutionsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const executionsClient = new ExecutionsClient(); + doStuffWithExecutionsClient(executionsClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/install.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1/test/gapic_executions_v1.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/test/gapic_executions_v1.ts new file mode 100644 index 00000000000..b971ac138bd --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/test/gapic_executions_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 executionsModule 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.ExecutionsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = executionsModule.v1.ExecutionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = executionsModule.v1.ExecutionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = executionsModule.v1.ExecutionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new executionsModule.v1.ExecutionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new executionsModule.v1.ExecutionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + await client.initialize(); + assert(client.executionsStub); + }); + + it('has close method for the initialized client', done => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.executionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1.ExecutionsClient({ + 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 executionsModule.v1.ExecutionsClient({ + 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('createExecution', () => { + it('invokes createExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); + const [response] = await client.createExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createExecution(request), expectedError); + }); + }); + + describe('getExecution', () => { + it('invokes getExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); + const [response] = await client.getExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getExecution(request), expectedError); + }); + }); + + describe('cancelExecution', () => { + it('invokes cancelExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); + const [response] = await client.cancelExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelExecution(request), expectedError); + }); + }); + + describe('listExecutions', () => { + it('invokes listExecutions without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); + const [response] = await client.listExecutions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutions without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutions( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutions with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listExecutions(request), expectedError); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutionsStream without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { + 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.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listExecutionsStream with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExecutions without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; + const iterable = client.listExecutionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExecutions with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('execution', () => { + const fakePath = "/rendered/path/execution"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + execution: "executionValue", + }; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.executionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.executionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('executionPath', () => { + const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.executionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromExecutionName', () => { + const result = client.matchProjectFromExecutionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromExecutionName', () => { + const result = client.matchLocationFromExecutionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromExecutionName', () => { + const result = client.matchWorkflowFromExecutionName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExecutionFromExecutionName', () => { + const result = client.matchExecutionFromExecutionName(fakePath); + assert.strictEqual(result, "executionValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workflow', () => { + const fakePath = "/rendered/path/workflow"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + }; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/tsconfig.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1/webpack.config.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/webpack.config.js new file mode 100644 index 00000000000..7de187a074a --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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: 'Executions', + filename: './executions.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-workflows-executions/executions/v1beta/.eslintignore b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.gitignore b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.jsdoc.js new file mode 100644 index 00000000000..beb79aa941b --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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/workflows-executions', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1beta/README.md b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/README.md new file mode 100644 index 00000000000..79032bbed45 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/README.md @@ -0,0 +1 @@ +Executions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/package.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/package.json new file mode 100644 index 00000000000..403d72cb7c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/workflows-executions", + "version": "0.1.0", + "description": "Executions client for Node.js", + "repository": "googleapis/nodejs-executions", + "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 executions", + "executions", + "executions" + ], + "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-workflows-executions/executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto new file mode 100644 index 00000000000..dd37f3b88b5 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto @@ -0,0 +1,252 @@ +// 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.workflows.executions.v1beta; + +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 go_package = "cloud.google.com/go/workflows/executions/apiv1beta/executionspb;executionspb"; +option java_multiple_files = true; +option java_outer_classname = "ExecutionsProto"; +option java_package = "com.google.cloud.workflows.executions.v1beta"; +option (google.api.resource_definition) = { + type: "workflows.googleapis.com/Workflow" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}" +}; + +// Executions is used to start and manage running instances of +// [Workflows][google.cloud.workflows.v1beta.Workflow] called executions. +service Executions { + option (google.api.default_host) = "workflowexecutions.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a list of executions which belong to the workflow with + // the given name. The method returns executions of all workflow + // revisions. Returned executions are ordered by their start time (newest + // first). + rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*/workflows/*}/executions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new execution using the latest revision of the given workflow. + rpc CreateExecution(CreateExecutionRequest) returns (Execution) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*/workflows/*}/executions" + body: "execution" + }; + option (google.api.method_signature) = "parent,execution"; + } + + // Returns an execution of the given name. + rpc GetExecution(GetExecutionRequest) returns (Execution) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Cancels an execution of the given name. + rpc CancelExecution(CancelExecutionRequest) returns (Execution) { + option (google.api.http) = { + post: "/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}:cancel" + body: "*" + }; + option (google.api.method_signature) = "name"; + } +} + +// A running instance of a [Workflow][google.cloud.workflows.v1beta.Workflow]. +message Execution { + option (google.api.resource) = { + type: "workflowexecutions.googleapis.com/Execution" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}" + }; + + // Error describes why the execution was abnormally terminated. + message Error { + // Error payload returned by the execution, represented as a JSON string. + string payload = 1; + + // Human readable error context, helpful for debugging purposes. + string context = 2; + } + + // Describes the current state of the execution. More states may be added + // in the future. + enum State { + // Invalid state. + STATE_UNSPECIFIED = 0; + + // The execution is in progress. + ACTIVE = 1; + + // The execution finished successfully. + SUCCEEDED = 2; + + // The execution failed with an error. + FAILED = 3; + + // The execution was stopped intentionally. + CANCELLED = 4; + } + + // Output only. The resource name of the execution. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Marks the beginning of execution. + google.protobuf.Timestamp start_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Marks the end of execution, successful or not. + google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Current state of the execution. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input parameters of the execution represented as a JSON string. + // The size limit is 32KB. + string argument = 5; + + // Output only. Output of the execution represented as a JSON string. The + // value can only be present if the execution's state is `SUCCEEDED`. + string result = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The error which caused the execution to finish prematurely. + // The value is only present if the execution's state is `FAILED` + // or `CANCELLED`. + Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Revision of the workflow this execution is using. + string workflow_revision_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for the +// [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] +// method. +message ListExecutionsRequest { + // Required. Name of the workflow for which the executions should be listed. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; + + // Maximum number of executions to return per call. + // Max supported value depends on the selected Execution view: it's 10000 for + // BASIC and 100 for FULL. The default value used if the field is not + // specified is 100, regardless of the selected view. Values greater than + // the max value will be coerced down to it. + int32 page_size = 2; + + // A page token, received from a previous `ListExecutions` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListExecutions` must + // match the call that provided the page token. + string page_token = 3; + + // Optional. A view defining which fields should be filled in the returned executions. + // The API will default to the BASIC view. + ExecutionView view = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for the +// [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] +// method. +message ListExecutionsResponse { + // The executions which match the request. + repeated Execution executions = 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 for the +// [CreateExecution][google.cloud.workflows.executions.v1beta.Executions.CreateExecution] +// method. +message CreateExecutionRequest { + // Required. Name of the workflow for which an execution should be created. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + // The latest revision of the workflow will be used. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; + + // Required. Execution to be created. + Execution execution = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the +// [GetExecution][google.cloud.workflows.executions.v1beta.Executions.GetExecution] +// method. +message GetExecutionRequest { + // Required. Name of the execution to be retrieved. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflowexecutions.googleapis.com/Execution" + } + ]; + + // Optional. A view defining which fields should be filled in the returned execution. + // The API will default to the FULL view. + ExecutionView view = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the +// [CancelExecution][google.cloud.workflows.executions.v1beta.Executions.CancelExecution] +// method. +message CancelExecutionRequest { + // Required. Name of the execution to be cancelled. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflowexecutions.googleapis.com/Execution" + } + ]; +} + +// Defines possible views for execution resource. +enum ExecutionView { + // The default / unset value. + EXECUTION_VIEW_UNSPECIFIED = 0; + + // Includes only basic metadata about the execution. + // Following fields are returned: name, start_time, end_time, state + // and workflow_revision_id. + BASIC = 1; + + // Includes all data. + FULL = 2; +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js new file mode 100644 index 00000000000..3767b5aabea --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.cancel_execution.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 workflowexecutions_v1beta_generated_Executions_CancelExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + */ + // const name = 'abc123' + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callCancelExecution() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await executionsClient.cancelExecution(request); + console.log(response); + } + + callCancelExecution(); + // [END workflowexecutions_v1beta_generated_Executions_CancelExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.create_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.create_execution.js new file mode 100644 index 00000000000..ff47d779839 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.create_execution.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(parent, execution) { + // [START workflowexecutions_v1beta_generated_Executions_CreateExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + */ + // const parent = 'abc123' + /** + * Required. Execution to be created. + */ + // const execution = {} + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callCreateExecution() { + // Construct request + const request = { + parent, + execution, + }; + + // Run request + const response = await executionsClient.createExecution(request); + console.log(response); + } + + callCreateExecution(); + // [END workflowexecutions_v1beta_generated_Executions_CreateExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.get_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.get_execution.js new file mode 100644 index 00000000000..1bcfe963326 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.get_execution.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 workflowexecutions_v1beta_generated_Executions_GetExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + */ + // const name = 'abc123' + /** + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL view. + */ + // const view = {} + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callGetExecution() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await executionsClient.getExecution(request); + console.log(response); + } + + callGetExecution(); + // [END workflowexecutions_v1beta_generated_Executions_GetExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.list_executions.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.list_executions.js new file mode 100644 index 00000000000..8edec13e293 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.list_executions.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 workflowexecutions_v1beta_generated_Executions_ListExecutions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + */ + // const parent = 'abc123' + /** + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC view. + */ + // const view = {} + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callListExecutions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await executionsClient.listExecutionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListExecutions(); + // [END workflowexecutions_v1beta_generated_Executions_ListExecutions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json new file mode 100644 index 00000000000..388d6848833 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json @@ -0,0 +1,195 @@ +{ + "clientLibrary": { + "name": "nodejs-executions", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.workflows.executions.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "workflowexecutions_v1beta_generated_Executions_ListExecutions_async", + "title": "Executions listExecutions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).", + "canonical": true, + "file": "executions.list_executions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListExecutions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", + "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.workflows.executions.v1beta.ExecutionView" + } + ], + "resultType": ".google.cloud.workflows.executions.v1beta.ListExecutionsResponse", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" + }, + "method": { + "shortName": "ListExecutions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1beta_generated_Executions_CreateExecution_async", + "title": "Executions createExecution Sample", + "origin": "API_DEFINITION", + "description": " Creates a new execution using the latest revision of the given workflow.", + "canonical": true, + "file": "executions.create_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "execution", + "type": ".google.cloud.workflows.executions.v1beta.Execution" + } + ], + "resultType": ".google.cloud.workflows.executions.v1beta.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" + }, + "method": { + "shortName": "CreateExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1beta_generated_Executions_GetExecution_async", + "title": "Executions getExecution Sample", + "origin": "API_DEFINITION", + "description": " Returns an execution of the given name.", + "canonical": true, + "file": "executions.get_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.workflows.executions.v1beta.ExecutionView" + } + ], + "resultType": ".google.cloud.workflows.executions.v1beta.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" + }, + "method": { + "shortName": "GetExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1beta_generated_Executions_CancelExecution_async", + "title": "Executions cancelExecution Sample", + "origin": "API_DEFINITION", + "description": " Cancels an execution of the given name.", + "canonical": true, + "file": "executions.cancel_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CancelExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.executions.v1beta.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" + }, + "method": { + "shortName": "CancelExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/index.ts new file mode 100644 index 00000000000..bd02df6447c --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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 ExecutionsClient = v1beta.ExecutionsClient; +type ExecutionsClient = v1beta.ExecutionsClient; +export {v1beta, ExecutionsClient}; +export default {v1beta, ExecutionsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client.ts new file mode 100644 index 00000000000..d9acaa01415 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client.ts @@ -0,0 +1,870 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1beta/executions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './executions_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Executions is used to start and manage running instances of + * {@link protos.google.cloud.workflows.v1beta.Workflow|Workflows} called executions. + * @class + * @memberof v1beta + */ +export class ExecutionsClient { + 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}; + executionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ExecutionsClient. + * + * @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 ExecutionsClient({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 ExecutionsClient; + 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 = { + executionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}' + ), + workflowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}' + ), + }; + + // 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 = { + listExecutions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.workflows.executions.v1beta.Executions', 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.executionsStub) { + return this.executionsStub; + } + + // Put together the "service stub" for + // google.cloud.workflows.executions.v1beta.Executions. + this.executionsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1beta.Executions') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workflows.executions.v1beta.Executions, + 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 executionsStubMethods = + ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; + for (const methodName of executionsStubMethods) { + const callPromise = this.executionsStub.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.executionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'workflowexecutions.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 'workflowexecutions.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 -- + // ------------------- +/** + * Creates a new execution using the latest revision of the given workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @param {google.cloud.workflows.executions.v1beta.Execution} request.execution + * Required. Execution 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.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.create_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_CreateExecution_async + */ + createExecution( + request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined + ]>; + createExecution( + request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; + createExecution( + request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; + createExecution( + request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createExecution(request, options, callback); + } +/** + * Returns an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL 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.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.get_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_GetExecution_async + */ + getExecution( + request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined + ]>; + getExecution( + request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; + getExecution( + request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; + getExecution( + request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getExecution(request, options, callback); + } +/** + * Cancels an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.cancel_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_CancelExecution_async + */ + cancelExecution( + request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined + ]>; + cancelExecution( + request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; + cancelExecution( + request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; + cancelExecution( + request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.cancelExecution(request, options, callback); + } + + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. + * 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExecutions( + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution[], + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + ]>; + listExecutions( + request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>): void; + listExecutions( + request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>): void; + listExecutions( + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>, + callback?: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution[], + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution} 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExecutionsStream( + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + 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['listExecutions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExecutions.createStream( + this.innerApiCalls.listExecutions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. 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/executions.list_executions.js + * region_tag:workflowexecutions_v1beta_generated_Executions_ListExecutions_async + */ + listExecutionsAsync( + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + 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['listExecutions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExecutions.asyncIterate( + this.innerApiCalls['listExecutions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified execution resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @param {string} execution + * @returns {string} Resource name string. + */ + executionPath(project:string,location:string,workflow:string,execution:string) { + return this.pathTemplates.executionPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + execution: execution, + }); + } + + /** + * Parse the project from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the project. + */ + matchProjectFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).project; + } + + /** + * Parse the location from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the location. + */ + matchLocationFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).location; + } + + /** + * Parse the workflow from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).workflow; + } + + /** + * Parse the execution from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the execution. + */ + matchExecutionFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).execution; + } + + /** + * Return a fully-qualified workflow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @returns {string} Resource name string. + */ + workflowPath(project:string,location:string,workflow:string) { + return this.pathTemplates.workflowPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + }); + } + + /** + * Parse the project from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).project; + } + + /** + * Parse the location from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).location; + } + + /** + * Parse the workflow from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; + } + + /** + * 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.executionsStub && !this._terminated) { + return this.executionsStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client_config.json new file mode 100644 index 00000000000..bf2692e9a8d --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client_config.json @@ -0,0 +1,42 @@ +{ + "interfaces": { + "google.cloud.workflows.executions.v1beta.Executions": { + "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": { + "ListExecutions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CancelExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_proto_list.json new file mode 100644 index 00000000000..245066757b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/workflows/executions/v1beta/executions.proto" +] diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/gapic_metadata.json new file mode 100644 index 00000000000..254e6e294a7 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/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.workflows.executions.v1beta", + "libraryPackage": "@google-cloud/workflows-executions", + "services": { + "Executions": { + "clients": { + "grpc": { + "libraryClient": "ExecutionsClient", + "rpcs": { + "CreateExecution": { + "methods": [ + "createExecution" + ] + }, + "GetExecution": { + "methods": [ + "getExecution" + ] + }, + "CancelExecution": { + "methods": [ + "cancelExecution" + ] + }, + "ListExecutions": { + "methods": [ + "listExecutions", + "listExecutionsStream", + "listExecutionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ExecutionsClient", + "rpcs": { + "CreateExecution": { + "methods": [ + "createExecution" + ] + }, + "GetExecution": { + "methods": [ + "getExecution" + ] + }, + "CancelExecution": { + "methods": [ + "cancelExecution" + ] + }, + "ListExecutions": { + "methods": [ + "listExecutions", + "listExecutionsStream", + "listExecutionsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/index.ts new file mode 100644 index 00000000000..a89e8389c4c --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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 {ExecutionsClient} from './executions_client'; diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..1a0275d5916 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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 executions = require('@google-cloud/workflows-executions'); + +function main() { + const executionsClient = new executions.ExecutionsClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..04bf0d25710 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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 {ExecutionsClient} from '@google-cloud/workflows-executions'; + +// check that the client class type name can be used +function doStuffWithExecutionsClient(client: ExecutionsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const executionsClient = new ExecutionsClient(); + doStuffWithExecutionsClient(executionsClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1beta/test/gapic_executions_v1beta.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/test/gapic_executions_v1beta.ts new file mode 100644 index 00000000000..aabf52f4cda --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/test/gapic_executions_v1beta.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 executionsModule 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('v1beta.ExecutionsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = executionsModule.v1beta.ExecutionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = executionsModule.v1beta.ExecutionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = executionsModule.v1beta.ExecutionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new executionsModule.v1beta.ExecutionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + await client.initialize(); + assert(client.executionsStub); + }); + + it('has close method for the initialized client', done => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.executionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1beta.ExecutionsClient({ + 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 executionsModule.v1beta.ExecutionsClient({ + 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('createExecution', () => { + it('invokes createExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); + const [response] = await client.createExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createExecution(request), expectedError); + }); + }); + + describe('getExecution', () => { + it('invokes getExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); + const [response] = await client.getExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getExecution(request), expectedError); + }); + }); + + describe('cancelExecution', () => { + it('invokes cancelExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); + const [response] = await client.cancelExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelExecution(request), expectedError); + }); + }); + + describe('listExecutions', () => { + it('invokes listExecutions without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); + const [response] = await client.listExecutions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutions without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutions( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutions with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listExecutions(request), expectedError); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutionsStream without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { + 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.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listExecutionsStream with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExecutions without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; + const iterable = client.listExecutionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExecutions with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('execution', () => { + const fakePath = "/rendered/path/execution"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + execution: "executionValue", + }; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.executionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.executionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('executionPath', () => { + const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.executionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromExecutionName', () => { + const result = client.matchProjectFromExecutionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromExecutionName', () => { + const result = client.matchLocationFromExecutionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromExecutionName', () => { + const result = client.matchWorkflowFromExecutionName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExecutionFromExecutionName', () => { + const result = client.matchExecutionFromExecutionName(fakePath); + assert.strictEqual(result, "executionValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workflow', () => { + const fakePath = "/rendered/path/workflow"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + }; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/webpack.config.js new file mode 100644 index 00000000000..7de187a074a --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/executions/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: 'Executions', + filename: './executions.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-workflows-executions/v1/.eslintignore b/owl-bot-staging/google-cloud-workflows-executions/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/.eslintrc.json b/owl-bot-staging/google-cloud-workflows-executions/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/.gitignore b/owl-bot-staging/google-cloud-workflows-executions/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1/.jsdoc.js b/owl-bot-staging/google-cloud-workflows-executions/v1/.jsdoc.js new file mode 100644 index 00000000000..e7b50866513 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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/workflows', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/.mocharc.js b/owl-bot-staging/google-cloud-workflows-executions/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1/.prettierrc.js b/owl-bot-staging/google-cloud-workflows-executions/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1/README.md b/owl-bot-staging/google-cloud-workflows-executions/v1/README.md new file mode 100644 index 00000000000..50496d9d5fb --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/README.md @@ -0,0 +1 @@ +Workflows: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/package.json b/owl-bot-staging/google-cloud-workflows-executions/v1/package.json new file mode 100644 index 00000000000..b0fb2328d81 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/workflows", + "version": "0.1.0", + "description": "Workflows client for Node.js", + "repository": "googleapis/nodejs-workflows", + "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 workflows", + "workflows", + "workflows" + ], + "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-workflows-executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto b/owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto new file mode 100644 index 00000000000..0c6bc12cbed --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto @@ -0,0 +1,399 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.workflows.executions.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/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/workflows/executions/apiv1/executionspb;executionspb"; +option java_multiple_files = true; +option java_outer_classname = "ExecutionsProto"; +option java_package = "com.google.cloud.workflows.executions.v1"; +option (google.api.resource_definition) = { + type: "workflows.googleapis.com/Workflow" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}" +}; + +// Executions is used to start and manage running instances of +// [Workflows][google.cloud.workflows.v1.Workflow] called executions. +service Executions { + option (google.api.default_host) = "workflowexecutions.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a list of executions which belong to the workflow with + // the given name. The method returns executions of all workflow + // revisions. Returned executions are ordered by their start time (newest + // first). + rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/workflows/*}/executions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new execution using the latest revision of the given workflow. + rpc CreateExecution(CreateExecutionRequest) returns (Execution) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/workflows/*}/executions" + body: "execution" + }; + option (google.api.method_signature) = "parent,execution"; + } + + // Returns an execution of the given name. + rpc GetExecution(GetExecutionRequest) returns (Execution) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Cancels an execution of the given name. + rpc CancelExecution(CancelExecutionRequest) returns (Execution) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}:cancel" + body: "*" + }; + option (google.api.method_signature) = "name"; + } +} + +// A running instance of a +// [Workflow](/workflows/docs/reference/rest/v1/projects.locations.workflows). +message Execution { + option (google.api.resource) = { + type: "workflowexecutions.googleapis.com/Execution" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}" + }; + + // Describes the current state of the execution. More states might be added + // in the future. + enum State { + // Invalid state. + STATE_UNSPECIFIED = 0; + + // The execution is in progress. + ACTIVE = 1; + + // The execution finished successfully. + SUCCEEDED = 2; + + // The execution failed with an error. + FAILED = 3; + + // The execution was stopped intentionally. + CANCELLED = 4; + + // Execution data is unavailable. See the `state_error` field. + UNAVAILABLE = 5; + + // Request has been placed in the backlog for processing at a later time. + QUEUED = 6; + } + + // A single stack element (frame) where an error occurred. + message StackTraceElement { + // Position contains source position information about the stack trace + // element such as line number, column number and length of the code block + // in bytes. + message Position { + // The source code line number the current instruction was generated from. + int64 line = 1; + + // The source code column position (of the line) the current instruction + // was generated from. + int64 column = 2; + + // The number of bytes of source code making up this stack trace element. + int64 length = 3; + } + + // The step the error occurred at. + string step = 1; + + // The routine where the error occurred. + string routine = 2; + + // The source position information of the stack trace element. + Position position = 3; + } + + // A collection of stack elements (frames) where an error occurred. + message StackTrace { + // An array of stack elements. + repeated StackTraceElement elements = 1; + } + + // Error describes why the execution was abnormally terminated. + message Error { + // Error message and data returned represented as a JSON string. + string payload = 1; + + // Human-readable stack trace string. + string context = 2; + + // Stack trace with detailed information of where error was generated. + StackTrace stack_trace = 3; + } + + // Describes the level of platform logging to apply to calls and call + // responses during workflow executions. + enum CallLogLevel { + // No call logging level specified. + CALL_LOG_LEVEL_UNSPECIFIED = 0; + + // Log all call steps within workflows, all call returns, and all exceptions + // raised. + LOG_ALL_CALLS = 1; + + // Log only exceptions that are raised from call steps within workflows. + LOG_ERRORS_ONLY = 2; + + // Explicitly log nothing. + LOG_NONE = 3; + } + + // Represents the current status of this execution. + message Status { + // Represents a step of the workflow this execution is running. + message Step { + // Name of a routine within the workflow. + string routine = 1; + + // Name of a step within the routine. + string step = 2; + } + + // A list of currently executing or last executed step names for the + // workflow execution currently running. If the workflow has succeeded or + // failed, this is the last attempted or executed step. Presently, if the + // current step is inside a subworkflow, the list only includes that step. + // In the future, the list will contain items for each step in the call + // stack, starting with the outermost step in the `main` subworkflow, and + // ending with the most deeply nested step. + repeated Step current_steps = 1; + } + + // Describes an error related to the current state of the Execution resource. + message StateError { + // Describes the possible types of a state error. + enum Type { + // No type specified. + TYPE_UNSPECIFIED = 0; + + // Caused by an issue with KMS. + KMS_ERROR = 1; + } + + // Provides specifics about the error. + string details = 1; + + // The type of this state error. + Type type = 2; + } + + // Output only. The resource name of the execution. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Marks the beginning of execution. + google.protobuf.Timestamp start_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Marks the end of execution, successful or not. + google.protobuf.Timestamp end_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Measures the duration of the execution. + google.protobuf.Duration duration = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Current state of the execution. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input parameters of the execution represented as a JSON string. + // The size limit is 32KB. + // + // *Note*: If you are using the REST API directly to run your workflow, you + // must escape any JSON string value of `argument`. Example: + // `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'` + string argument = 5; + + // Output only. Output of the execution represented as a JSON string. The + // value can only be present if the execution's state is `SUCCEEDED`. + string result = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The error which caused the execution to finish prematurely. + // The value is only present if the execution's state is `FAILED` + // or `CANCELLED`. + Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Revision of the workflow this execution is using. + string workflow_revision_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The call logging level associated to this execution. + CallLogLevel call_log_level = 9; + + // Output only. Status tracks the current steps and progress data of this + // execution. + Status status = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this execution. + // Labels can contain at most 64 entries. Keys and values can be no longer + // than 63 characters and can only contain lowercase letters, numeric + // characters, underscores, and dashes. Label keys must start with a letter. + // International characters are allowed. + // By default, labels are inherited from the workflow but are overridden by + // any labels associated with the execution. + map labels = 11; + + // Output only. Error regarding the state of the Execution resource. For + // example, this field will have error details if the execution data is + // unavailable due to revoked KMS key permissions. + StateError state_error = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for the +// [ListExecutions][] +// method. +message ListExecutionsRequest { + // Required. Name of the workflow for which the executions should be listed. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; + + // Maximum number of executions to return per call. + // Max supported value depends on the selected Execution view: it's 1000 for + // BASIC and 100 for FULL. The default value used if the field is not + // specified is 100, regardless of the selected view. Values greater than + // the max value will be coerced down to it. + int32 page_size = 2; + + // A page token, received from a previous `ListExecutions` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListExecutions` must + // match the call that provided the page token. + // + // Note that pagination is applied to dynamic data. The list of executions + // returned can change between page requests. + string page_token = 3; + + // Optional. A view defining which fields should be filled in the returned + // executions. The API will default to the BASIC view. + ExecutionView view = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Filters applied to the [Executions.ListExecutions] results. + // The following fields are supported for filtering: + // executionID, state, startTime, endTime, duration, workflowRevisionID, + // stepName, and label. + string filter = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The ordering applied to the [Executions.ListExecutions] results. + // By default the ordering is based on descending start time. + // The following fields are supported for order by: + // executionID, startTime, endTime, duration, state, and workflowRevisionID. + string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for the +// [ListExecutions][google.cloud.workflows.executions.v1.Executions.ListExecutions] +// method. +message ListExecutionsResponse { + // The executions which match the request. + repeated Execution executions = 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 for the +// [CreateExecution][google.cloud.workflows.executions.v1.Executions.CreateExecution] +// method. +message CreateExecutionRequest { + // Required. Name of the workflow for which an execution should be created. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + // The latest revision of the workflow will be used. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; + + // Required. Execution to be created. + Execution execution = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the +// [GetExecution][google.cloud.workflows.executions.v1.Executions.GetExecution] +// method. +message GetExecutionRequest { + // Required. Name of the execution to be retrieved. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflowexecutions.googleapis.com/Execution" + } + ]; + + // Optional. A view defining which fields should be filled in the returned + // execution. The API will default to the FULL view. + ExecutionView view = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the +// [CancelExecution][google.cloud.workflows.executions.v1.Executions.CancelExecution] +// method. +message CancelExecutionRequest { + // Required. Name of the execution to be cancelled. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflowexecutions.googleapis.com/Execution" + } + ]; +} + +// Defines possible views for execution resource. +enum ExecutionView { + // The default / unset value. + EXECUTION_VIEW_UNSPECIFIED = 0; + + // Includes only basic metadata about the execution. + // The following fields are returned: name, start_time, end_time, duration, + // state, and workflow_revision_id. + BASIC = 1; + + // Includes all data. + FULL = 2; +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/v1/workflows.proto b/owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/v1/workflows.proto new file mode 100644 index 00000000000..772ca653789 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/v1/workflows.proto @@ -0,0 +1,409 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.workflows.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"; + +option go_package = "cloud.google.com/go/workflows/apiv1/workflowspb;workflowspb"; +option java_multiple_files = true; +option java_outer_classname = "WorkflowsProto"; +option java_package = "com.google.cloud.workflows.v1"; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}" +}; + +// Workflows is used to deploy and execute workflow programs. +// Workflows makes sure the program executes reliably, despite hardware and +// networking interruptions. +service Workflows { + option (google.api.default_host) = "workflows.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists workflows in a given project and location. + // The default order is not specified. + rpc ListWorkflows(ListWorkflowsRequest) returns (ListWorkflowsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/workflows" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single workflow. + rpc GetWorkflow(GetWorkflowRequest) returns (Workflow) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/workflows/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new workflow. If a workflow with the specified name already + // exists in the specified project and location, the long running operation + // returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. + rpc CreateWorkflow(CreateWorkflowRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/workflows" + body: "workflow" + }; + option (google.api.method_signature) = "parent,workflow,workflow_id"; + option (google.longrunning.operation_info) = { + response_type: "Workflow" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a workflow with the specified name. + // This method also cancels and deletes all running executions of the + // workflow. + rpc DeleteWorkflow(DeleteWorkflowRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/workflows/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing workflow. + // Running this method has no impact on already running executions of the + // workflow. A new revision of the workflow might be created as a result of a + // successful update operation. In that case, the new revision is used + // in new workflow executions. + rpc UpdateWorkflow(UpdateWorkflowRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{workflow.name=projects/*/locations/*/workflows/*}" + body: "workflow" + }; + option (google.api.method_signature) = "workflow,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Workflow" + metadata_type: "OperationMetadata" + }; + } +} + +// Workflow program to be executed by Workflows. +message Workflow { + option (google.api.resource) = { + type: "workflows.googleapis.com/Workflow" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}" + }; + + // Describes the current state of workflow deployment. + enum State { + // Invalid state. + STATE_UNSPECIFIED = 0; + + // The workflow has been deployed successfully and is serving. + ACTIVE = 1; + + // Workflow data is unavailable. See the `state_error` field. + UNAVAILABLE = 2; + } + + // Describes an error related to the current state of the workflow. + message StateError { + // Describes the possibled types of a state error. + enum Type { + // No type specified. + TYPE_UNSPECIFIED = 0; + + // Caused by an issue with KMS. + KMS_ERROR = 1; + } + + // Provides specifics about the error. + string details = 1; + + // The type of this state error. + Type type = 2; + } + + // Describes the level of platform logging to apply to calls and call + // responses during workflow executions. + enum CallLogLevel { + // No call logging level specified. + CALL_LOG_LEVEL_UNSPECIFIED = 0; + + // Log all call steps within workflows, all call returns, and all exceptions + // raised. + LOG_ALL_CALLS = 1; + + // Log only exceptions that are raised from call steps within workflows. + LOG_ERRORS_ONLY = 2; + + // Explicitly log nothing. + LOG_NONE = 3; + } + + // The resource name of the workflow. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + string name = 1; + + // Description of the workflow provided by the user. + // Must be at most 1000 unicode characters long. + string description = 2; + + // Output only. State of the workflow deployment. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The revision of the workflow. + // A new revision of a workflow is created as a result of updating the + // following properties of a workflow: + // + // - [Service account][google.cloud.workflows.v1.Workflow.service_account] + // - [Workflow code to be + // executed][google.cloud.workflows.v1.Workflow.source_contents] + // + // The format is "000001-a4d", where the first six characters define + // the zero-padded revision ordinal number. They are followed by a hyphen and + // three hexadecimal random characters. + string revision_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp for when the workflow was created. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp for when the workflow was last updated. + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp for the latest revision of the workflow's + // creation. + google.protobuf.Timestamp revision_create_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this workflow. + // Labels can contain at most 64 entries. Keys and values can be no longer + // than 63 characters and can only contain lowercase letters, numeric + // characters, underscores, and dashes. Label keys must start with a letter. + // International characters are allowed. + map labels = 8; + + // The service account associated with the latest workflow version. + // This service account represents the identity of the workflow and determines + // what permissions the workflow has. + // Format: projects/{project}/serviceAccounts/{account} or {account} + // + // Using `-` as a wildcard for the `{project}` or not providing one at all + // will infer the project from the account. The `{account}` value can be the + // `email` address or the `unique_id` of the service account. + // + // If not provided, workflow will use the project's default service account. + // Modifying this field for an existing workflow results in a new workflow + // revision. + string service_account = 9; + + // Required. Location of the workflow source code. + // Modifying this field for an existing workflow results in a new workflow + // revision. + oneof source_code { + // Workflow code to be executed. The size limit is 128KB. + string source_contents = 10; + } + + // Optional. The resource name of a KMS crypto key used to encrypt or decrypt + // the data associated with the workflow. + // + // Format: + // projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey} + // + // Using `-` as a wildcard for the `{project}` or not providing one at all + // will infer the project from the account. + // + // If not provided, data associated with the workflow will not be + // CMEK-encrypted. + string crypto_key_name = 11 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Output only. Error regarding the state of the workflow. For example, this + // field will have error details if the execution data is unavailable due to + // revoked KMS key permissions. + StateError state_error = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Describes the level of platform logging to apply to calls and + // call responses during executions of this workflow. If both the workflow and + // the execution specify a logging level, the execution level takes + // precedence. + CallLogLevel call_log_level = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. User-defined environment variables associated with this workflow + // revision. This map has a maximum length of 20. Each string can take up to + // 40KiB. Keys cannot be empty strings and cannot start with “GOOGLE” or + // “WORKFLOWS". + map user_env_vars = 14 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the +// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows] +// method. +message ListWorkflowsRequest { + // Required. Project and location from which the workflows should be listed. + // Format: projects/{project}/locations/{location} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Maximum number of workflows to return per call. The service might return + // fewer than this value even if not at the end of the collection. If a value + // is not specified, a default value of 500 is used. The maximum permitted + // value is 1000 and values greater than 1000 are coerced down to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListWorkflows` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListWorkflows` must + // match the call that provided the page token. + string page_token = 3; + + // Filter to restrict results to specific workflows. + string filter = 4; + + // Comma-separated list of fields that specify the order of the results. + // Default sorting order for a field is ascending. To specify descending order + // for a field, append a "desc" suffix. + // If not specified, the results are returned in an unspecified order. + string order_by = 5; +} + +// Response for the +// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows] +// method. +message ListWorkflowsResponse { + // The workflows that match the request. + repeated Workflow workflows = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Request for the +// [GetWorkflow][google.cloud.workflows.v1.Workflows.GetWorkflow] method. +message GetWorkflowRequest { + // Required. Name of the workflow for which information should be retrieved. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; + + // Optional. The revision of the workflow to retrieve. If the revision_id is + // empty, the latest revision is retrieved. + // The format is "000001-a4d", where the first six characters define + // the zero-padded decimal revision number. They are followed by a hyphen and + // three hexadecimal characters. + string revision_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the +// [CreateWorkflow][google.cloud.workflows.v1.Workflows.CreateWorkflow] +// method. +message CreateWorkflowRequest { + // Required. Project and location in which the workflow should be created. + // Format: projects/{project}/locations/{location} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Workflow to be created. + Workflow workflow = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the workflow to be created. It has to fulfill the + // following requirements: + // + // * Must contain only letters, numbers, underscores and hyphens. + // * Must start with a letter. + // * Must be between 1-64 characters. + // * Must end with a number or a letter. + // * Must be unique within the customer project and location. + string workflow_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the +// [DeleteWorkflow][google.cloud.workflows.v1.Workflows.DeleteWorkflow] +// method. +message DeleteWorkflowRequest { + // Required. Name of the workflow to be deleted. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; +} + +// Request for the +// [UpdateWorkflow][google.cloud.workflows.v1.Workflows.UpdateWorkflow] +// method. +message UpdateWorkflowRequest { + // Required. Workflow to be updated. + Workflow workflow = 1 [(google.api.field_behavior) = REQUIRED]; + + // List of fields to be updated. If not present, the entire workflow + // will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// 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; + + // API version used to start the operation. + string api_version = 5; +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.cancel_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.cancel_execution.js new file mode 100644 index 00000000000..b8a19229162 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.cancel_execution.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 workflowexecutions_v1_generated_Executions_CancelExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + */ + // const name = 'abc123' + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callCancelExecution() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await executionsClient.cancelExecution(request); + console.log(response); + } + + callCancelExecution(); + // [END workflowexecutions_v1_generated_Executions_CancelExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.create_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.create_execution.js new file mode 100644 index 00000000000..bf837b7d241 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.create_execution.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(parent, execution) { + // [START workflowexecutions_v1_generated_Executions_CreateExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + */ + // const parent = 'abc123' + /** + * Required. Execution to be created. + */ + // const execution = {} + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callCreateExecution() { + // Construct request + const request = { + parent, + execution, + }; + + // Run request + const response = await executionsClient.createExecution(request); + console.log(response); + } + + callCreateExecution(); + // [END workflowexecutions_v1_generated_Executions_CreateExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.get_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.get_execution.js new file mode 100644 index 00000000000..ffd888596ee --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.get_execution.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 workflowexecutions_v1_generated_Executions_GetExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + */ + // const name = 'abc123' + /** + * Optional. A view defining which fields should be filled in the returned + * execution. The API will default to the FULL view. + */ + // const view = {} + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callGetExecution() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await executionsClient.getExecution(request); + console.log(response); + } + + callGetExecution(); + // [END workflowexecutions_v1_generated_Executions_GetExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.list_executions.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.list_executions.js new file mode 100644 index 00000000000..ac929e06a2f --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.list_executions.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(parent) { + // [START workflowexecutions_v1_generated_Executions_ListExecutions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + */ + // const parent = 'abc123' + /** + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + */ + // const pageToken = 'abc123' + /** + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + */ + // const view = {} + /** + * Optional. Filters applied to the Executions.ListExecutions results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + */ + // const filter = 'abc123' + /** + * Optional. The ordering applied to the Executions.ListExecutions results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + */ + // const orderBy = 'abc123' + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callListExecutions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await executionsClient.listExecutionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListExecutions(); + // [END workflowexecutions_v1_generated_Executions_ListExecutions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json new file mode 100644 index 00000000000..f17cc1ffd26 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json @@ -0,0 +1,203 @@ +{ + "clientLibrary": { + "name": "nodejs-executions", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.workflows.executions.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "workflowexecutions_v1_generated_Executions_ListExecutions_async", + "title": "Executions listExecutions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).", + "canonical": true, + "file": "executions.list_executions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 92, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListExecutions", + "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", + "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.workflows.executions.v1.ExecutionView" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.executions.v1.ListExecutionsResponse", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" + }, + "method": { + "shortName": "ListExecutions", + "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1_generated_Executions_CreateExecution_async", + "title": "Executions createExecution Sample", + "origin": "API_DEFINITION", + "description": " Creates a new execution using the latest revision of the given workflow.", + "canonical": true, + "file": "executions.create_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "execution", + "type": ".google.cloud.workflows.executions.v1.Execution" + } + ], + "resultType": ".google.cloud.workflows.executions.v1.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" + }, + "method": { + "shortName": "CreateExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1_generated_Executions_GetExecution_async", + "title": "Executions getExecution Sample", + "origin": "API_DEFINITION", + "description": " Returns an execution of the given name.", + "canonical": true, + "file": "executions.get_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.workflows.executions.v1.ExecutionView" + } + ], + "resultType": ".google.cloud.workflows.executions.v1.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" + }, + "method": { + "shortName": "GetExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1_generated_Executions_CancelExecution_async", + "title": "Executions cancelExecution Sample", + "origin": "API_DEFINITION", + "description": " Cancels an execution of the given name.", + "canonical": true, + "file": "executions.cancel_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CancelExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.executions.v1.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" + }, + "method": { + "shortName": "CancelExecution", + "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1.Executions" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json new file mode 100644 index 00000000000..085a08022e8 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json @@ -0,0 +1,247 @@ +{ + "clientLibrary": { + "name": "nodejs-workflows", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.workflows.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "workflows_v1_generated_Workflows_ListWorkflows_async", + "title": "Workflows listWorkflows Sample", + "origin": "API_DEFINITION", + "description": " Lists workflows in a given project and location. The default order is not specified.", + "canonical": true, + "file": "workflows.list_workflows.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkflows", + "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflows", + "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.workflows.v1.ListWorkflowsResponse", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1.WorkflowsClient" + }, + "method": { + "shortName": "ListWorkflows", + "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflows", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1_generated_Workflows_GetWorkflow_async", + "title": "Workflows getWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single workflow.", + "canonical": true, + "file": "workflows.get_workflow.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.GetWorkflow", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "revision_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.v1.Workflow", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1.WorkflowsClient" + }, + "method": { + "shortName": "GetWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.GetWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1_generated_Workflows_CreateWorkflow_async", + "title": "Workflows createWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.", + "canonical": true, + "file": "workflows.create_workflow.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.CreateWorkflow", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "workflow", + "type": ".google.cloud.workflows.v1.Workflow" + }, + { + "name": "workflow_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1.WorkflowsClient" + }, + "method": { + "shortName": "CreateWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.CreateWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1_generated_Workflows_DeleteWorkflow_async", + "title": "Workflows deleteWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.", + "canonical": true, + "file": "workflows.delete_workflow.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.DeleteWorkflow", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1.WorkflowsClient" + }, + "method": { + "shortName": "DeleteWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.DeleteWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1_generated_Workflows_UpdateWorkflow_async", + "title": "Workflows updateWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.", + "canonical": true, + "file": "workflows.update_workflow.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.UpdateWorkflow", + "async": true, + "parameters": [ + { + "name": "workflow", + "type": ".google.cloud.workflows.v1.Workflow" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1.WorkflowsClient" + }, + "method": { + "shortName": "UpdateWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.UpdateWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1.Workflows" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.create_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.create_workflow.js new file mode 100644 index 00000000000..47480e9abd0 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.create_workflow.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, workflow, workflowId) { + // [START workflows_v1_generated_Workflows_CreateWorkflow_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + */ + // const parent = 'abc123' + /** + * Required. Workflow to be created. + */ + // const workflow = {} + /** + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + */ + // const workflowId = 'abc123' + + // Imports the Workflows library + const {WorkflowsClient} = require('@google-cloud/workflows').v1; + + // Instantiates a client + const workflowsClient = new WorkflowsClient(); + + async function callCreateWorkflow() { + // Construct request + const request = { + parent, + workflow, + workflowId, + }; + + // Run request + const [operation] = await workflowsClient.createWorkflow(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateWorkflow(); + // [END workflows_v1_generated_Workflows_CreateWorkflow_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.delete_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.delete_workflow.js new file mode 100644 index 00000000000..a0ea6310c25 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.delete_workflow.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 workflows_v1_generated_Workflows_DeleteWorkflow_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + */ + // const name = 'abc123' + + // Imports the Workflows library + const {WorkflowsClient} = require('@google-cloud/workflows').v1; + + // Instantiates a client + const workflowsClient = new WorkflowsClient(); + + async function callDeleteWorkflow() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workflowsClient.deleteWorkflow(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteWorkflow(); + // [END workflows_v1_generated_Workflows_DeleteWorkflow_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.get_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.get_workflow.js new file mode 100644 index 00000000000..517ec375d36 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.get_workflow.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(name) { + // [START workflows_v1_generated_Workflows_GetWorkflow_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow for which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + */ + // const name = 'abc123' + /** + * Optional. The revision of the workflow to retrieve. If the revision_id is + * empty, the latest revision is retrieved. + * The format is "000001-a4d", where the first six characters define + * the zero-padded decimal revision number. They are followed by a hyphen and + * three hexadecimal characters. + */ + // const revisionId = 'abc123' + + // Imports the Workflows library + const {WorkflowsClient} = require('@google-cloud/workflows').v1; + + // Instantiates a client + const workflowsClient = new WorkflowsClient(); + + async function callGetWorkflow() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await workflowsClient.getWorkflow(request); + console.log(response); + } + + callGetWorkflow(); + // [END workflows_v1_generated_Workflows_GetWorkflow_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.list_workflows.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.list_workflows.js new file mode 100644 index 00000000000..be6dfd9fbdb --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.list_workflows.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) { + // [START workflows_v1_generated_Workflows_ListWorkflows_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + */ + // const parent = 'abc123' + /** + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Filter to restrict results to specific workflows. + */ + // const filter = 'abc123' + /** + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified order. + */ + // const orderBy = 'abc123' + + // Imports the Workflows library + const {WorkflowsClient} = require('@google-cloud/workflows').v1; + + // Instantiates a client + const workflowsClient = new WorkflowsClient(); + + async function callListWorkflows() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workflowsClient.listWorkflowsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListWorkflows(); + // [END workflows_v1_generated_Workflows_ListWorkflows_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.update_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.update_workflow.js new file mode 100644 index 00000000000..09b8e0198ea --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.update_workflow.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(workflow) { + // [START workflows_v1_generated_Workflows_UpdateWorkflow_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Workflow to be updated. + */ + // const workflow = {} + /** + * List of fields to be updated. If not present, the entire workflow + * will be updated. + */ + // const updateMask = {} + + // Imports the Workflows library + const {WorkflowsClient} = require('@google-cloud/workflows').v1; + + // Instantiates a client + const workflowsClient = new WorkflowsClient(); + + async function callUpdateWorkflow() { + // Construct request + const request = { + workflow, + }; + + // Run request + const [operation] = await workflowsClient.updateWorkflow(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateWorkflow(); + // [END workflows_v1_generated_Workflows_UpdateWorkflow_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/src/index.ts new file mode 100644 index 00000000000..b4c9dd81035 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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 WorkflowsClient = v1.WorkflowsClient; +type WorkflowsClient = v1.WorkflowsClient; +export {v1, WorkflowsClient}; +export default {v1, WorkflowsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client.ts new file mode 100644 index 00000000000..4ad0a31c467 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client.ts @@ -0,0 +1,909 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/executions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './executions_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Executions is used to start and manage running instances of + * {@link protos.google.cloud.workflows.v1.Workflow|Workflows} called executions. + * @class + * @memberof v1 + */ +export class ExecutionsClient { + 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}; + executionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ExecutionsClient. + * + * @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 ExecutionsClient({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 ExecutionsClient; + 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 = { + executionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}' + ), + workflowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}' + ), + }; + + // 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 = { + listExecutions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.workflows.executions.v1.Executions', 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.executionsStub) { + return this.executionsStub; + } + + // Put together the "service stub" for + // google.cloud.workflows.executions.v1.Executions. + this.executionsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1.Executions') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workflows.executions.v1.Executions, + 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 executionsStubMethods = + ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; + for (const methodName of executionsStubMethods) { + const callPromise = this.executionsStub.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.executionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'workflowexecutions.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 'workflowexecutions.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 -- + // ------------------- +/** + * Creates a new execution using the latest revision of the given workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @param {google.cloud.workflows.executions.v1.Execution} request.execution + * Required. Execution 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.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.create_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_CreateExecution_async + */ + createExecution( + request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined + ]>; + createExecution( + request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; + createExecution( + request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; + createExecution( + request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createExecution(request, options, callback); + } +/** + * Returns an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * execution. The API will default to the FULL 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.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.get_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_GetExecution_async + */ + getExecution( + request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined + ]>; + getExecution( + request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; + getExecution( + request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; + getExecution( + request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getExecution(request, options, callback); + } +/** + * Cancels an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.cancel_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_CancelExecution_async + */ + cancelExecution( + request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined + ]>; + cancelExecution( + request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; + cancelExecution( + request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; + cancelExecution( + request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.cancelExecution(request, options, callback); + } + + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.workflows.executions.v1.Execution|Execution}. + * 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExecutions( + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution[], + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + ]>; + listExecutions( + request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>): void; + listExecutions( + request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>): void; + listExecutions( + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>, + callback?: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution[], + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @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.workflows.executions.v1.Execution|Execution} 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExecutionsStream( + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + 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['listExecutions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExecutions.createStream( + this.innerApiCalls.listExecutions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @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.workflows.executions.v1.Execution|Execution}. 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/executions.list_executions.js + * region_tag:workflowexecutions_v1_generated_Executions_ListExecutions_async + */ + listExecutionsAsync( + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + 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['listExecutions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExecutions.asyncIterate( + this.innerApiCalls['listExecutions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified execution resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @param {string} execution + * @returns {string} Resource name string. + */ + executionPath(project:string,location:string,workflow:string,execution:string) { + return this.pathTemplates.executionPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + execution: execution, + }); + } + + /** + * Parse the project from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the project. + */ + matchProjectFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).project; + } + + /** + * Parse the location from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the location. + */ + matchLocationFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).location; + } + + /** + * Parse the workflow from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).workflow; + } + + /** + * Parse the execution from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the execution. + */ + matchExecutionFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).execution; + } + + /** + * Return a fully-qualified workflow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @returns {string} Resource name string. + */ + workflowPath(project:string,location:string,workflow:string) { + return this.pathTemplates.workflowPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + }); + } + + /** + * Parse the project from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).project; + } + + /** + * Parse the location from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).location; + } + + /** + * Parse the workflow from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; + } + + /** + * 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.executionsStub && !this._terminated) { + return this.executionsStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client_config.json new file mode 100644 index 00000000000..ea2d78fc822 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client_config.json @@ -0,0 +1,42 @@ +{ + "interfaces": { + "google.cloud.workflows.executions.v1.Executions": { + "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": { + "ListExecutions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CancelExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_proto_list.json new file mode 100644 index 00000000000..3cffd5df199 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/workflows/executions/v1/executions.proto" +] diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..4beac113fbb --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/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.workflows.v1", + "libraryPackage": "@google-cloud/workflows", + "services": { + "Workflows": { + "clients": { + "grpc": { + "libraryClient": "WorkflowsClient", + "rpcs": { + "GetWorkflow": { + "methods": [ + "getWorkflow" + ] + }, + "CreateWorkflow": { + "methods": [ + "createWorkflow" + ] + }, + "DeleteWorkflow": { + "methods": [ + "deleteWorkflow" + ] + }, + "UpdateWorkflow": { + "methods": [ + "updateWorkflow" + ] + }, + "ListWorkflows": { + "methods": [ + "listWorkflows", + "listWorkflowsStream", + "listWorkflowsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WorkflowsClient", + "rpcs": { + "GetWorkflow": { + "methods": [ + "getWorkflow" + ] + }, + "CreateWorkflow": { + "methods": [ + "createWorkflow" + ] + }, + "DeleteWorkflow": { + "methods": [ + "deleteWorkflow" + ] + }, + "UpdateWorkflow": { + "methods": [ + "updateWorkflow" + ] + }, + "ListWorkflows": { + "methods": [ + "listWorkflows", + "listWorkflowsStream", + "listWorkflowsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/index.ts new file mode 100644 index 00000000000..4efcde817e9 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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 {WorkflowsClient} from './workflows_client'; diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client.ts new file mode 100644 index 00000000000..18d1152ede6 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client.ts @@ -0,0 +1,1371 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/workflows_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './workflows_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Workflows is used to deploy and execute workflow programs. + * Workflows makes sure the program executes reliably, despite hardware and + * networking interruptions. + * @class + * @memberof v1 + */ +export class WorkflowsClient { + 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; + workflowsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WorkflowsClient. + * + * @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 WorkflowsClient({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 WorkflowsClient; + 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 = { + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + workflowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}' + ), + }; + + // 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 = { + listWorkflows: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workflows') + }; + + 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.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 createWorkflowResponse = protoFilesRoot.lookup( + '.google.cloud.workflows.v1.Workflow') as gax.protobuf.Type; + const createWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; + const deleteWorkflowResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; + const updateWorkflowResponse = protoFilesRoot.lookup( + '.google.cloud.workflows.v1.Workflow') as gax.protobuf.Type; + const updateWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkflowResponse.decode.bind(createWorkflowResponse), + createWorkflowMetadata.decode.bind(createWorkflowMetadata)), + deleteWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkflowResponse.decode.bind(deleteWorkflowResponse), + deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata)), + updateWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkflowResponse.decode.bind(updateWorkflowResponse), + updateWorkflowMetadata.decode.bind(updateWorkflowMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.workflows.v1.Workflows', 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.workflowsStub) { + return this.workflowsStub; + } + + // Put together the "service stub" for + // google.cloud.workflows.v1.Workflows. + this.workflowsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workflows.v1.Workflows') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workflows.v1.Workflows, + 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 workflowsStubMethods = + ['listWorkflows', 'getWorkflow', 'createWorkflow', 'deleteWorkflow', 'updateWorkflow']; + for (const methodName of workflowsStubMethods) { + const callPromise = this.workflowsStub.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.workflowsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'workflows.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 'workflows.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 workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow for which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {string} [request.revisionId] + * Optional. The revision of the workflow to retrieve. If the revision_id is + * empty, the latest revision is retrieved. + * The format is "000001-a4d", where the first six characters define + * the zero-padded decimal revision number. They are followed by a hyphen and + * three hexadecimal 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.workflows.v1.Workflow|Workflow}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.get_workflow.js + * region_tag:workflows_v1_generated_Workflows_GetWorkflow_async + */ + getWorkflow( + request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest|undefined, {}|undefined + ]>; + getWorkflow( + request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): void; + getWorkflow( + request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + callback: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): void; + getWorkflow( + request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getWorkflow(request, options, callback); + } + +/** + * Creates a new workflow. If a workflow with the specified name already + * exists in the specified project and location, the long running operation + * returns a {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * @param {google.cloud.workflows.v1.Workflow} request.workflow + * Required. Workflow to be created. + * @param {string} request.workflowId + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and 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/workflows.create_workflow.js + * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async + */ + createWorkflow( + request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createWorkflow( + request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkflow( + request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkflow( + request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createWorkflow(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.create_workflow.js + * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async + */ + async checkCreateWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a workflow with the specified name. + * This method also cancels and deletes all running executions of the + * workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.delete_workflow.js + * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async + */ + deleteWorkflow( + request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteWorkflow( + request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkflow( + request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkflow( + request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteWorkflow(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.delete_workflow.js + * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async + */ + async checkDeleteWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing workflow. + * Running this method has no impact on already running executions of the + * workflow. A new revision of the workflow might be created as a result of a + * successful update operation. In that case, the new revision is used + * in new workflow executions. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workflows.v1.Workflow} request.workflow + * Required. Workflow to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * List of fields to be updated. If not present, the entire workflow + * 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/v1/workflows.update_workflow.js + * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async + */ + updateWorkflow( + request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateWorkflow( + request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkflow( + request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkflow( + request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workflow.name': request.workflow!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateWorkflow(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.update_workflow.js + * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async + */ + async checkUpdateWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists workflows in a given project and location. + * The default order is not specified. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. + * 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflows( + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowsRequest|null, + protos.google.cloud.workflows.v1.IListWorkflowsResponse + ]>; + listWorkflows( + request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1.IWorkflow>): void; + listWorkflows( + request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1.IWorkflow>): void; + listWorkflows( + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1.IWorkflow>, + callback?: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1.IWorkflow>): + Promise<[ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowsRequest|null, + protos.google.cloud.workflows.v1.IListWorkflowsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listWorkflows(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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow} 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflowsStream( + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + 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['listWorkflows']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkflows.createStream( + this.innerApiCalls.listWorkflows as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. 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/workflows.list_workflows.js + * region_tag:workflows_v1_generated_Workflows_ListWorkflows_async + */ + listWorkflowsAsync( + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + 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['listWorkflows']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkflows.asyncIterate( + this.innerApiCalls['listWorkflows'] 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 cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} keyRing + * @param {string} cryptoKey + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + keyRing: keyRing, + cryptoKey: 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 keyRing from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the keyRing. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).keyRing; + } + + /** + * Parse the cryptoKey from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the cryptoKey. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).cryptoKey; + } + + /** + * 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 workflow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @returns {string} Resource name string. + */ + workflowPath(project:string,location:string,workflow:string) { + return this.pathTemplates.workflowPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + }); + } + + /** + * Parse the project from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).project; + } + + /** + * Parse the location from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).location; + } + + /** + * Parse the workflow from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; + } + + /** + * 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.workflowsStub && !this._terminated) { + return this.workflowsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client_config.json new file mode 100644 index 00000000000..02f67fcb3f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.workflows.v1.Workflows": { + "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": { + "ListWorkflows": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_proto_list.json new file mode 100644 index 00000000000..46c65a972d7 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/workflows/v1/workflows.proto" +] diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..c7a7c423f62 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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 workflows = require('@google-cloud/workflows'); + +function main() { + const workflowsClient = new workflows.WorkflowsClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..9e04ae05724 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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 {WorkflowsClient} from '@google-cloud/workflows'; + +// check that the client class type name can be used +function doStuffWithWorkflowsClient(client: WorkflowsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const workflowsClient = new WorkflowsClient(); + doStuffWithWorkflowsClient(workflowsClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/install.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1/test/gapic_executions_v1.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_executions_v1.ts new file mode 100644 index 00000000000..b971ac138bd --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_executions_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 executionsModule 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.ExecutionsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = executionsModule.v1.ExecutionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = executionsModule.v1.ExecutionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = executionsModule.v1.ExecutionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new executionsModule.v1.ExecutionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new executionsModule.v1.ExecutionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + await client.initialize(); + assert(client.executionsStub); + }); + + it('has close method for the initialized client', done => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.executionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1.ExecutionsClient({ + 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 executionsModule.v1.ExecutionsClient({ + 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('createExecution', () => { + it('invokes createExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); + const [response] = await client.createExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createExecution(request), expectedError); + }); + }); + + describe('getExecution', () => { + it('invokes getExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); + const [response] = await client.getExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getExecution(request), expectedError); + }); + }); + + describe('cancelExecution', () => { + it('invokes cancelExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); + const [response] = await client.cancelExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelExecution(request), expectedError); + }); + }); + + describe('listExecutions', () => { + it('invokes listExecutions without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); + const [response] = await client.listExecutions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutions without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutions( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutions with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listExecutions(request), expectedError); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutionsStream without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { + 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.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listExecutionsStream with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExecutions without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; + const iterable = client.listExecutionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExecutions with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('execution', () => { + const fakePath = "/rendered/path/execution"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + execution: "executionValue", + }; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.executionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.executionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('executionPath', () => { + const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.executionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromExecutionName', () => { + const result = client.matchProjectFromExecutionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromExecutionName', () => { + const result = client.matchLocationFromExecutionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromExecutionName', () => { + const result = client.matchWorkflowFromExecutionName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExecutionFromExecutionName', () => { + const result = client.matchExecutionFromExecutionName(fakePath); + assert.strictEqual(result, "executionValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workflow', () => { + const fakePath = "/rendered/path/workflow"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + }; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_workflows_v1.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_workflows_v1.ts new file mode 100644 index 00000000000..c1de3a97d3f --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_workflows_v1.ts @@ -0,0 +1,1594 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 workflowsModule 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.WorkflowsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = workflowsModule.v1.WorkflowsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = workflowsModule.v1.WorkflowsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = workflowsModule.v1.WorkflowsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new workflowsModule.v1.WorkflowsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new workflowsModule.v1.WorkflowsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + await client.initialize(); + assert(client.workflowsStub); + }); + + it('has close method for the initialized client', done => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.workflowsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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('getWorkflow', () => { + it('invokes getWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1.Workflow() + ); + client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkflow(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1.Workflow() + ); + client.innerApiCalls.getWorkflow = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkflow( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.v1.IWorkflow|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkflow = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow with closed client', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkflow(request), expectedError); + }); + }); + + describe('createWorkflow', () => { + it('invokes createWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteWorkflow', () => { + it('invokes deleteWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateWorkflow', () => { + it('invokes updateWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listWorkflows', () => { + it('invokes listWorkflows without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkflows(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflows without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkflows( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.v1.IWorkflow[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflows with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkflows = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkflows(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflowsStream without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1.Workflow[] = []; + stream.on('data', (response: protos.google.cloud.workflows.v1.Workflow) => { + 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.listWorkflows.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkflowsStream with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1.Workflow[] = []; + stream.on('data', (response: protos.google.cloud.workflows.v1.Workflow) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkflows without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; + const iterable = client.listWorkflowsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkflows with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkflowsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkflows.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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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('cryptoKey', () => { + const fakePath = "/rendered/path/cryptoKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + keyRing: "keyRingValue", + cryptoKey: "cryptoKeyValue", + }; + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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('workflow', () => { + const fakePath = "/rendered/path/workflow"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + }; + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/tsconfig.json b/owl-bot-staging/google-cloud-workflows-executions/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1/webpack.config.js b/owl-bot-staging/google-cloud-workflows-executions/v1/webpack.config.js new file mode 100644 index 00000000000..5a6fddf6078 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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: 'Workflows', + filename: './workflows.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-workflows-executions/v1beta/.eslintignore b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/.gitignore b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.jsdoc.js new file mode 100644 index 00000000000..e7b50866513 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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/workflows', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1beta/README.md b/owl-bot-staging/google-cloud-workflows-executions/v1beta/README.md new file mode 100644 index 00000000000..50496d9d5fb --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/README.md @@ -0,0 +1 @@ +Workflows: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/package.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/package.json new file mode 100644 index 00000000000..b0fb2328d81 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/workflows", + "version": "0.1.0", + "description": "Workflows client for Node.js", + "repository": "googleapis/nodejs-workflows", + "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 workflows", + "workflows", + "workflows" + ], + "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-workflows-executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto b/owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto new file mode 100644 index 00000000000..dd37f3b88b5 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto @@ -0,0 +1,252 @@ +// 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.workflows.executions.v1beta; + +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 go_package = "cloud.google.com/go/workflows/executions/apiv1beta/executionspb;executionspb"; +option java_multiple_files = true; +option java_outer_classname = "ExecutionsProto"; +option java_package = "com.google.cloud.workflows.executions.v1beta"; +option (google.api.resource_definition) = { + type: "workflows.googleapis.com/Workflow" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}" +}; + +// Executions is used to start and manage running instances of +// [Workflows][google.cloud.workflows.v1beta.Workflow] called executions. +service Executions { + option (google.api.default_host) = "workflowexecutions.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a list of executions which belong to the workflow with + // the given name. The method returns executions of all workflow + // revisions. Returned executions are ordered by their start time (newest + // first). + rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*/workflows/*}/executions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new execution using the latest revision of the given workflow. + rpc CreateExecution(CreateExecutionRequest) returns (Execution) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*/workflows/*}/executions" + body: "execution" + }; + option (google.api.method_signature) = "parent,execution"; + } + + // Returns an execution of the given name. + rpc GetExecution(GetExecutionRequest) returns (Execution) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Cancels an execution of the given name. + rpc CancelExecution(CancelExecutionRequest) returns (Execution) { + option (google.api.http) = { + post: "/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}:cancel" + body: "*" + }; + option (google.api.method_signature) = "name"; + } +} + +// A running instance of a [Workflow][google.cloud.workflows.v1beta.Workflow]. +message Execution { + option (google.api.resource) = { + type: "workflowexecutions.googleapis.com/Execution" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}" + }; + + // Error describes why the execution was abnormally terminated. + message Error { + // Error payload returned by the execution, represented as a JSON string. + string payload = 1; + + // Human readable error context, helpful for debugging purposes. + string context = 2; + } + + // Describes the current state of the execution. More states may be added + // in the future. + enum State { + // Invalid state. + STATE_UNSPECIFIED = 0; + + // The execution is in progress. + ACTIVE = 1; + + // The execution finished successfully. + SUCCEEDED = 2; + + // The execution failed with an error. + FAILED = 3; + + // The execution was stopped intentionally. + CANCELLED = 4; + } + + // Output only. The resource name of the execution. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Marks the beginning of execution. + google.protobuf.Timestamp start_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Marks the end of execution, successful or not. + google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Current state of the execution. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input parameters of the execution represented as a JSON string. + // The size limit is 32KB. + string argument = 5; + + // Output only. Output of the execution represented as a JSON string. The + // value can only be present if the execution's state is `SUCCEEDED`. + string result = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The error which caused the execution to finish prematurely. + // The value is only present if the execution's state is `FAILED` + // or `CANCELLED`. + Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Revision of the workflow this execution is using. + string workflow_revision_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for the +// [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] +// method. +message ListExecutionsRequest { + // Required. Name of the workflow for which the executions should be listed. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; + + // Maximum number of executions to return per call. + // Max supported value depends on the selected Execution view: it's 10000 for + // BASIC and 100 for FULL. The default value used if the field is not + // specified is 100, regardless of the selected view. Values greater than + // the max value will be coerced down to it. + int32 page_size = 2; + + // A page token, received from a previous `ListExecutions` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListExecutions` must + // match the call that provided the page token. + string page_token = 3; + + // Optional. A view defining which fields should be filled in the returned executions. + // The API will default to the BASIC view. + ExecutionView view = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for the +// [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] +// method. +message ListExecutionsResponse { + // The executions which match the request. + repeated Execution executions = 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 for the +// [CreateExecution][google.cloud.workflows.executions.v1beta.Executions.CreateExecution] +// method. +message CreateExecutionRequest { + // Required. Name of the workflow for which an execution should be created. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + // The latest revision of the workflow will be used. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; + + // Required. Execution to be created. + Execution execution = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the +// [GetExecution][google.cloud.workflows.executions.v1beta.Executions.GetExecution] +// method. +message GetExecutionRequest { + // Required. Name of the execution to be retrieved. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflowexecutions.googleapis.com/Execution" + } + ]; + + // Optional. A view defining which fields should be filled in the returned execution. + // The API will default to the FULL view. + ExecutionView view = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the +// [CancelExecution][google.cloud.workflows.executions.v1beta.Executions.CancelExecution] +// method. +message CancelExecutionRequest { + // Required. Name of the execution to be cancelled. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflowexecutions.googleapis.com/Execution" + } + ]; +} + +// Defines possible views for execution resource. +enum ExecutionView { + // The default / unset value. + EXECUTION_VIEW_UNSPECIFIED = 0; + + // Includes only basic metadata about the execution. + // Following fields are returned: name, start_time, end_time, state + // and workflow_revision_id. + BASIC = 1; + + // Includes all data. + FULL = 2; +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/v1beta/workflows.proto b/owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/v1beta/workflows.proto new file mode 100644 index 00000000000..d929f2006d7 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/v1beta/workflows.proto @@ -0,0 +1,314 @@ +// 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.workflows.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/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/workflows/apiv1beta/workflowspb;workflowspb"; +option java_multiple_files = true; +option java_outer_classname = "WorkflowsProto"; +option java_package = "com.google.cloud.workflows.v1beta"; + +// Workflows is used to deploy and execute workflow programs. +// Workflows makes sure the program executes reliably, despite hardware and +// networking interruptions. +service Workflows { + option (google.api.default_host) = "workflows.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists Workflows in a given project and location. + // The default order is not specified. + rpc ListWorkflows(ListWorkflowsRequest) returns (ListWorkflowsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*}/workflows" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single Workflow. + rpc GetWorkflow(GetWorkflowRequest) returns (Workflow) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/workflows/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new workflow. If a workflow with the specified name already + // exists in the specified project and location, the long running operation + // will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. + rpc CreateWorkflow(CreateWorkflowRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*}/workflows" + body: "workflow" + }; + option (google.api.method_signature) = "parent,workflow,workflow_id"; + option (google.longrunning.operation_info) = { + response_type: "Workflow" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a workflow with the specified name. + // This method also cancels and deletes all running executions of the + // workflow. + rpc DeleteWorkflow(DeleteWorkflowRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/locations/*/workflows/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing workflow. + // Running this method has no impact on already running executions of the + // workflow. A new revision of the workflow may be created as a result of a + // successful update operation. In that case, such revision will be used + // in new workflow executions. + rpc UpdateWorkflow(UpdateWorkflowRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta/{workflow.name=projects/*/locations/*/workflows/*}" + body: "workflow" + }; + option (google.api.method_signature) = "workflow,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Workflow" + metadata_type: "OperationMetadata" + }; + } +} + +// Workflow program to be executed by Workflows. +message Workflow { + option (google.api.resource) = { + type: "workflows.googleapis.com/Workflow" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}" + }; + + // Describes the current state of workflow deployment. More states may be + // added in the future. + enum State { + // Invalid state. + STATE_UNSPECIFIED = 0; + + // The workflow has been deployed successfully and is serving. + ACTIVE = 1; + } + + // The resource name of the workflow. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + string name = 1; + + // Description of the workflow provided by the user. + // Must be at most 1000 unicode characters long. + string description = 2; + + // Output only. State of the workflow deployment. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The revision of the workflow. + // A new revision of a workflow is created as a result of updating the + // following fields of a workflow: + // - `source_code` + // - `service_account` + // The format is "000001-a4d", where the first 6 characters define + // the zero-padded revision ordinal number. They are followed by a hyphen and + // 3 hexadecimal random characters. + string revision_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp of when the workflow was created. + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of the workflow. + google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp that the latest revision of the workflow + // was created. + google.protobuf.Timestamp revision_create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this workflow. + // Labels can contain at most 64 entries. Keys and values can be no longer + // than 63 characters and can only contain lowercase letters, numeric + // characters, underscores and dashes. Label keys must start with a letter. + // International characters are allowed. + map labels = 8; + + // Name of the service account associated with the latest workflow version. + // This service account represents the identity of the workflow and determines + // what permissions the workflow has. + // Format: projects/{project}/serviceAccounts/{account} + // + // Using `-` as a wildcard for the `{project}` will infer the project from + // the account. The `{account}` value can be the `email` address or the + // `unique_id` of the service account. + // + // If not provided, workflow will use the project's default service account. + // Modifying this field for an existing workflow results in a new workflow + // revision. + string service_account = 9; + + // Required. Location of the workflow source code. + // Modifying this field for an existing workflow results in a new workflow + // revision. + oneof source_code { + // Workflow code to be executed. The size limit is 32KB. + string source_contents = 10; + } +} + +// Request for the +// [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows] +// method. +message ListWorkflowsRequest { + // Required. Project and location from which the workflows should be listed. + // Format: projects/{project}/locations/{location} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Maximum number of workflows to return per call. The service may return + // fewer than this value. If the value is not specified, a default value of + // 500 will be used. The maximum permitted value is 1000 and values greater + // than 1000 will be coerced down to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListWorkflows` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListWorkflows` must + // match the call that provided the page token. + string page_token = 3; + + // Filter to restrict results to specific workflows. + string filter = 4; + + // Comma-separated list of fields that that specify the order of the results. + // Default sorting order for a field is ascending. To specify descending order + // for a field, append a " desc" suffix. + // If not specified, the results will be returned in an unspecified order. + string order_by = 5; +} + +// Response for the +// [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows] +// method. +message ListWorkflowsResponse { + // The workflows which match the request. + repeated Workflow workflows = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Request for the +// [GetWorkflow][google.cloud.workflows.v1beta.Workflows.GetWorkflow] method. +message GetWorkflowRequest { + // Required. Name of the workflow which information should be retrieved. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; +} + +// Request for the +// [CreateWorkflow][google.cloud.workflows.v1beta.Workflows.CreateWorkflow] +// method. +message CreateWorkflowRequest { + // Required. Project and location in which the workflow should be created. + // Format: projects/{project}/locations/{location} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Workflow to be created. + Workflow workflow = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the workflow to be created. It has to fulfill the + // following requirements: + // + // * Must contain only letters, numbers, underscores and hyphens. + // * Must start with a letter. + // * Must be between 1-64 characters. + // * Must end with a number or a letter. + // * Must be unique within the customer project and location. + string workflow_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the +// [DeleteWorkflow][google.cloud.workflows.v1beta.Workflows.DeleteWorkflow] +// method. +message DeleteWorkflowRequest { + // Required. Name of the workflow to be deleted. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; +} + +// Request for the +// [UpdateWorkflow][google.cloud.workflows.v1beta.Workflows.UpdateWorkflow] +// method. +message UpdateWorkflowRequest { + // Required. Workflow to be updated. + Workflow workflow = 1 [(google.api.field_behavior) = REQUIRED]; + + // List of fields to be updated. If not present, the entire workflow + // will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// 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; + + // API version used to start the operation. + string api_version = 5; +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js new file mode 100644 index 00000000000..3767b5aabea --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.cancel_execution.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 workflowexecutions_v1beta_generated_Executions_CancelExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + */ + // const name = 'abc123' + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callCancelExecution() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await executionsClient.cancelExecution(request); + console.log(response); + } + + callCancelExecution(); + // [END workflowexecutions_v1beta_generated_Executions_CancelExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.create_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.create_execution.js new file mode 100644 index 00000000000..ff47d779839 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.create_execution.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(parent, execution) { + // [START workflowexecutions_v1beta_generated_Executions_CreateExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + */ + // const parent = 'abc123' + /** + * Required. Execution to be created. + */ + // const execution = {} + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callCreateExecution() { + // Construct request + const request = { + parent, + execution, + }; + + // Run request + const response = await executionsClient.createExecution(request); + console.log(response); + } + + callCreateExecution(); + // [END workflowexecutions_v1beta_generated_Executions_CreateExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.get_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.get_execution.js new file mode 100644 index 00000000000..1bcfe963326 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.get_execution.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 workflowexecutions_v1beta_generated_Executions_GetExecution_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + */ + // const name = 'abc123' + /** + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL view. + */ + // const view = {} + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callGetExecution() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await executionsClient.getExecution(request); + console.log(response); + } + + callGetExecution(); + // [END workflowexecutions_v1beta_generated_Executions_GetExecution_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.list_executions.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.list_executions.js new file mode 100644 index 00000000000..8edec13e293 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.list_executions.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 workflowexecutions_v1beta_generated_Executions_ListExecutions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + */ + // const parent = 'abc123' + /** + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC view. + */ + // const view = {} + + // Imports the Executions library + const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; + + // Instantiates a client + const executionsClient = new ExecutionsClient(); + + async function callListExecutions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await executionsClient.listExecutionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListExecutions(); + // [END workflowexecutions_v1beta_generated_Executions_ListExecutions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json new file mode 100644 index 00000000000..388d6848833 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json @@ -0,0 +1,195 @@ +{ + "clientLibrary": { + "name": "nodejs-executions", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.workflows.executions.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "workflowexecutions_v1beta_generated_Executions_ListExecutions_async", + "title": "Executions listExecutions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).", + "canonical": true, + "file": "executions.list_executions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListExecutions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", + "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.workflows.executions.v1beta.ExecutionView" + } + ], + "resultType": ".google.cloud.workflows.executions.v1beta.ListExecutionsResponse", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" + }, + "method": { + "shortName": "ListExecutions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1beta_generated_Executions_CreateExecution_async", + "title": "Executions createExecution Sample", + "origin": "API_DEFINITION", + "description": " Creates a new execution using the latest revision of the given workflow.", + "canonical": true, + "file": "executions.create_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "execution", + "type": ".google.cloud.workflows.executions.v1beta.Execution" + } + ], + "resultType": ".google.cloud.workflows.executions.v1beta.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" + }, + "method": { + "shortName": "CreateExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1beta_generated_Executions_GetExecution_async", + "title": "Executions getExecution Sample", + "origin": "API_DEFINITION", + "description": " Returns an execution of the given name.", + "canonical": true, + "file": "executions.get_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.workflows.executions.v1beta.ExecutionView" + } + ], + "resultType": ".google.cloud.workflows.executions.v1beta.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" + }, + "method": { + "shortName": "GetExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions" + } + } + } + }, + { + "regionTag": "workflowexecutions_v1beta_generated_Executions_CancelExecution_async", + "title": "Executions cancelExecution Sample", + "origin": "API_DEFINITION", + "description": " Cancels an execution of the given name.", + "canonical": true, + "file": "executions.cancel_execution.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CancelExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.executions.v1beta.Execution", + "client": { + "shortName": "ExecutionsClient", + "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" + }, + "method": { + "shortName": "CancelExecution", + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", + "service": { + "shortName": "Executions", + "fullName": "google.cloud.workflows.executions.v1beta.Executions" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json new file mode 100644 index 00000000000..400f73d4c9b --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json @@ -0,0 +1,243 @@ +{ + "clientLibrary": { + "name": "nodejs-workflows", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.workflows.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "workflows_v1beta_generated_Workflows_ListWorkflows_async", + "title": "Workflows listWorkflows Sample", + "origin": "API_DEFINITION", + "description": " Lists Workflows in a given project and location. The default order is not specified.", + "canonical": true, + "file": "workflows.list_workflows.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkflows", + "fullName": "google.cloud.workflows.v1beta.Workflows.ListWorkflows", + "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.workflows.v1beta.ListWorkflowsResponse", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" + }, + "method": { + "shortName": "ListWorkflows", + "fullName": "google.cloud.workflows.v1beta.Workflows.ListWorkflows", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1beta.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1beta_generated_Workflows_GetWorkflow_async", + "title": "Workflows getWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Workflow.", + "canonical": true, + "file": "workflows.get_workflow.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.GetWorkflow", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.v1beta.Workflow", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" + }, + "method": { + "shortName": "GetWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.GetWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1beta.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1beta_generated_Workflows_CreateWorkflow_async", + "title": "Workflows createWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.", + "canonical": true, + "file": "workflows.create_workflow.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.CreateWorkflow", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "workflow", + "type": ".google.cloud.workflows.v1beta.Workflow" + }, + { + "name": "workflow_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" + }, + "method": { + "shortName": "CreateWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.CreateWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1beta.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1beta_generated_Workflows_DeleteWorkflow_async", + "title": "Workflows deleteWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.", + "canonical": true, + "file": "workflows.delete_workflow.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.DeleteWorkflow", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" + }, + "method": { + "shortName": "DeleteWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.DeleteWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1beta.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1beta_generated_Workflows_UpdateWorkflow_async", + "title": "Workflows updateWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow may be created as a result of a successful update operation. In that case, such revision will be used in new workflow executions.", + "canonical": true, + "file": "workflows.update_workflow.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.UpdateWorkflow", + "async": true, + "parameters": [ + { + "name": "workflow", + "type": ".google.cloud.workflows.v1beta.Workflow" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" + }, + "method": { + "shortName": "UpdateWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.UpdateWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1beta.Workflows" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.create_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.create_workflow.js new file mode 100644 index 00000000000..acaf5af0d6d --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.create_workflow.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, workflow, workflowId) { + // [START workflows_v1beta_generated_Workflows_CreateWorkflow_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + */ + // const parent = 'abc123' + /** + * Required. Workflow to be created. + */ + // const workflow = {} + /** + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + */ + // const workflowId = 'abc123' + + // Imports the Workflows library + const {WorkflowsClient} = require('@google-cloud/workflows').v1beta; + + // Instantiates a client + const workflowsClient = new WorkflowsClient(); + + async function callCreateWorkflow() { + // Construct request + const request = { + parent, + workflow, + workflowId, + }; + + // Run request + const [operation] = await workflowsClient.createWorkflow(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateWorkflow(); + // [END workflows_v1beta_generated_Workflows_CreateWorkflow_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.delete_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.delete_workflow.js new file mode 100644 index 00000000000..2afa40e9c32 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.delete_workflow.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 workflows_v1beta_generated_Workflows_DeleteWorkflow_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + */ + // const name = 'abc123' + + // Imports the Workflows library + const {WorkflowsClient} = require('@google-cloud/workflows').v1beta; + + // Instantiates a client + const workflowsClient = new WorkflowsClient(); + + async function callDeleteWorkflow() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workflowsClient.deleteWorkflow(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteWorkflow(); + // [END workflows_v1beta_generated_Workflows_DeleteWorkflow_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.get_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.get_workflow.js new file mode 100644 index 00000000000..6e1d7258fd4 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.get_workflow.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 workflows_v1beta_generated_Workflows_GetWorkflow_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workflow which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + */ + // const name = 'abc123' + + // Imports the Workflows library + const {WorkflowsClient} = require('@google-cloud/workflows').v1beta; + + // Instantiates a client + const workflowsClient = new WorkflowsClient(); + + async function callGetWorkflow() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await workflowsClient.getWorkflow(request); + console.log(response); + } + + callGetWorkflow(); + // [END workflows_v1beta_generated_Workflows_GetWorkflow_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.list_workflows.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.list_workflows.js new file mode 100644 index 00000000000..864c24f97d2 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.list_workflows.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) { + // [START workflows_v1beta_generated_Workflows_ListWorkflows_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + */ + // const parent = 'abc123' + /** + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Filter to restrict results to specific workflows. + */ + // const filter = 'abc123' + /** + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified order. + */ + // const orderBy = 'abc123' + + // Imports the Workflows library + const {WorkflowsClient} = require('@google-cloud/workflows').v1beta; + + // Instantiates a client + const workflowsClient = new WorkflowsClient(); + + async function callListWorkflows() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workflowsClient.listWorkflowsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListWorkflows(); + // [END workflows_v1beta_generated_Workflows_ListWorkflows_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.update_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.update_workflow.js new file mode 100644 index 00000000000..303f42ff21b --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.update_workflow.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(workflow) { + // [START workflows_v1beta_generated_Workflows_UpdateWorkflow_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Workflow to be updated. + */ + // const workflow = {} + /** + * List of fields to be updated. If not present, the entire workflow + * will be updated. + */ + // const updateMask = {} + + // Imports the Workflows library + const {WorkflowsClient} = require('@google-cloud/workflows').v1beta; + + // Instantiates a client + const workflowsClient = new WorkflowsClient(); + + async function callUpdateWorkflow() { + // Construct request + const request = { + workflow, + }; + + // Run request + const [operation] = await workflowsClient.updateWorkflow(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateWorkflow(); + // [END workflows_v1beta_generated_Workflows_UpdateWorkflow_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/index.ts new file mode 100644 index 00000000000..83c1f7863fc --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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 WorkflowsClient = v1beta.WorkflowsClient; +type WorkflowsClient = v1beta.WorkflowsClient; +export {v1beta, WorkflowsClient}; +export default {v1beta, WorkflowsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client.ts new file mode 100644 index 00000000000..d9acaa01415 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client.ts @@ -0,0 +1,870 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1beta/executions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './executions_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Executions is used to start and manage running instances of + * {@link protos.google.cloud.workflows.v1beta.Workflow|Workflows} called executions. + * @class + * @memberof v1beta + */ +export class ExecutionsClient { + 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}; + executionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ExecutionsClient. + * + * @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 ExecutionsClient({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 ExecutionsClient; + 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 = { + executionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}' + ), + workflowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}' + ), + }; + + // 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 = { + listExecutions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.workflows.executions.v1beta.Executions', 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.executionsStub) { + return this.executionsStub; + } + + // Put together the "service stub" for + // google.cloud.workflows.executions.v1beta.Executions. + this.executionsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1beta.Executions') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workflows.executions.v1beta.Executions, + 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 executionsStubMethods = + ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; + for (const methodName of executionsStubMethods) { + const callPromise = this.executionsStub.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.executionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'workflowexecutions.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 'workflowexecutions.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 -- + // ------------------- +/** + * Creates a new execution using the latest revision of the given workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @param {google.cloud.workflows.executions.v1beta.Execution} request.execution + * Required. Execution 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.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.create_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_CreateExecution_async + */ + createExecution( + request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined + ]>; + createExecution( + request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; + createExecution( + request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; + createExecution( + request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createExecution(request, options, callback); + } +/** + * Returns an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL 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.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.get_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_GetExecution_async + */ + getExecution( + request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined + ]>; + getExecution( + request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; + getExecution( + request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; + getExecution( + request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getExecution(request, options, callback); + } +/** + * Cancels an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.cancel_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_CancelExecution_async + */ + cancelExecution( + request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined + ]>; + cancelExecution( + request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; + cancelExecution( + request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; + cancelExecution( + request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.cancelExecution(request, options, callback); + } + + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. + * 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExecutions( + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution[], + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + ]>; + listExecutions( + request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>): void; + listExecutions( + request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>): void; + listExecutions( + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>, + callback?: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution[], + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution} 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExecutionsStream( + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + 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['listExecutions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExecutions.createStream( + this.innerApiCalls.listExecutions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. 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/executions.list_executions.js + * region_tag:workflowexecutions_v1beta_generated_Executions_ListExecutions_async + */ + listExecutionsAsync( + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + 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['listExecutions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExecutions.asyncIterate( + this.innerApiCalls['listExecutions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified execution resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @param {string} execution + * @returns {string} Resource name string. + */ + executionPath(project:string,location:string,workflow:string,execution:string) { + return this.pathTemplates.executionPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + execution: execution, + }); + } + + /** + * Parse the project from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the project. + */ + matchProjectFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).project; + } + + /** + * Parse the location from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the location. + */ + matchLocationFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).location; + } + + /** + * Parse the workflow from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).workflow; + } + + /** + * Parse the execution from Execution resource. + * + * @param {string} executionName + * A fully-qualified path representing Execution resource. + * @returns {string} A string representing the execution. + */ + matchExecutionFromExecutionName(executionName: string) { + return this.pathTemplates.executionPathTemplate.match(executionName).execution; + } + + /** + * Return a fully-qualified workflow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @returns {string} Resource name string. + */ + workflowPath(project:string,location:string,workflow:string) { + return this.pathTemplates.workflowPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + }); + } + + /** + * Parse the project from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).project; + } + + /** + * Parse the location from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).location; + } + + /** + * Parse the workflow from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; + } + + /** + * 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.executionsStub && !this._terminated) { + return this.executionsStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client_config.json new file mode 100644 index 00000000000..bf2692e9a8d --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client_config.json @@ -0,0 +1,42 @@ +{ + "interfaces": { + "google.cloud.workflows.executions.v1beta.Executions": { + "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": { + "ListExecutions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CancelExecution": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_proto_list.json new file mode 100644 index 00000000000..245066757b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/workflows/executions/v1beta/executions.proto" +] diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/gapic_metadata.json new file mode 100644 index 00000000000..72f32dbfb64 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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.workflows.v1beta", + "libraryPackage": "@google-cloud/workflows", + "services": { + "Workflows": { + "clients": { + "grpc": { + "libraryClient": "WorkflowsClient", + "rpcs": { + "GetWorkflow": { + "methods": [ + "getWorkflow" + ] + }, + "CreateWorkflow": { + "methods": [ + "createWorkflow" + ] + }, + "DeleteWorkflow": { + "methods": [ + "deleteWorkflow" + ] + }, + "UpdateWorkflow": { + "methods": [ + "updateWorkflow" + ] + }, + "ListWorkflows": { + "methods": [ + "listWorkflows", + "listWorkflowsStream", + "listWorkflowsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WorkflowsClient", + "rpcs": { + "GetWorkflow": { + "methods": [ + "getWorkflow" + ] + }, + "CreateWorkflow": { + "methods": [ + "createWorkflow" + ] + }, + "DeleteWorkflow": { + "methods": [ + "deleteWorkflow" + ] + }, + "UpdateWorkflow": { + "methods": [ + "updateWorkflow" + ] + }, + "ListWorkflows": { + "methods": [ + "listWorkflows", + "listWorkflowsStream", + "listWorkflowsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/index.ts new file mode 100644 index 00000000000..4efcde817e9 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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 {WorkflowsClient} from './workflows_client'; diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client.ts new file mode 100644 index 00000000000..28c018c5a47 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client.ts @@ -0,0 +1,1040 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/workflows_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './workflows_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Workflows is used to deploy and execute workflow programs. + * Workflows makes sure the program executes reliably, despite hardware and + * networking interruptions. + * @class + * @memberof v1beta + */ +export class WorkflowsClient { + 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; + workflowsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WorkflowsClient. + * + * @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 WorkflowsClient({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 WorkflowsClient; + 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}' + ), + workflowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}' + ), + }; + + // 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 = { + listWorkflows: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workflows') + }; + + 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.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 createWorkflowResponse = protoFilesRoot.lookup( + '.google.cloud.workflows.v1beta.Workflow') as gax.protobuf.Type; + const createWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; + const deleteWorkflowResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; + const updateWorkflowResponse = protoFilesRoot.lookup( + '.google.cloud.workflows.v1beta.Workflow') as gax.protobuf.Type; + const updateWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkflowResponse.decode.bind(createWorkflowResponse), + createWorkflowMetadata.decode.bind(createWorkflowMetadata)), + deleteWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkflowResponse.decode.bind(deleteWorkflowResponse), + deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata)), + updateWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkflowResponse.decode.bind(updateWorkflowResponse), + updateWorkflowMetadata.decode.bind(updateWorkflowMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.workflows.v1beta.Workflows', 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.workflowsStub) { + return this.workflowsStub; + } + + // Put together the "service stub" for + // google.cloud.workflows.v1beta.Workflows. + this.workflowsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workflows.v1beta.Workflows') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workflows.v1beta.Workflows, + 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 workflowsStubMethods = + ['listWorkflows', 'getWorkflow', 'createWorkflow', 'deleteWorkflow', 'updateWorkflow']; + for (const methodName of workflowsStubMethods) { + const callPromise = this.workflowsStub.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.workflowsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'workflows.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 'workflows.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 Workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workflows.v1beta.Workflow|Workflow}. + * Please see the {@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/workflows.get_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_GetWorkflow_async + */ + getWorkflow( + request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|undefined, {}|undefined + ]>; + getWorkflow( + request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): void; + getWorkflow( + request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + callback: Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): void; + getWorkflow( + request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getWorkflow(request, options, callback); + } + +/** + * Creates a new workflow. If a workflow with the specified name already + * exists in the specified project and location, the long running operation + * will return {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * @param {google.cloud.workflows.v1beta.Workflow} request.workflow + * Required. Workflow to be created. + * @param {string} request.workflowId + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and 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/v1beta/workflows.create_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async + */ + createWorkflow( + request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createWorkflow( + request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkflow( + request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkflow( + request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createWorkflow(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workflows.create_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async + */ + async checkCreateWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a workflow with the specified name. + * This method also cancels and deletes all running executions of the + * workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workflows.delete_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async + */ + deleteWorkflow( + request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteWorkflow( + request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkflow( + request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkflow( + request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteWorkflow(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workflows.delete_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async + */ + async checkDeleteWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing workflow. + * Running this method has no impact on already running executions of the + * workflow. A new revision of the workflow may be created as a result of a + * successful update operation. In that case, such revision will be used + * in new workflow executions. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workflows.v1beta.Workflow} request.workflow + * Required. Workflow to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * List of fields to be updated. If not present, the entire workflow + * 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/v1beta/workflows.update_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async + */ + updateWorkflow( + request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateWorkflow( + request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkflow( + request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkflow( + request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workflow.name': request.workflow!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateWorkflow(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workflows.update_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async + */ + async checkUpdateWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Workflows in a given project and location. + * The default order is not specified. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. + * 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflows( + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.v1beta.IWorkflow[], + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest|null, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + ]>; + listWorkflows( + request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1beta.IWorkflow>): void; + listWorkflows( + request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1beta.IWorkflow>): void; + listWorkflows( + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1beta.IWorkflow>, + callback?: PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1beta.IWorkflow>): + Promise<[ + protos.google.cloud.workflows.v1beta.IWorkflow[], + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest|null, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listWorkflows(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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow} 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflowsStream( + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + 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['listWorkflows']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkflows.createStream( + this.innerApiCalls.listWorkflows as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. 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/workflows.list_workflows.js + * region_tag:workflows_v1beta_generated_Workflows_ListWorkflows_async + */ + listWorkflowsAsync( + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + 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['listWorkflows']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkflows.asyncIterate( + this.innerApiCalls['listWorkflows'] 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 workflow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @returns {string} Resource name string. + */ + workflowPath(project:string,location:string,workflow:string) { + return this.pathTemplates.workflowPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + }); + } + + /** + * Parse the project from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).project; + } + + /** + * Parse the location from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).location; + } + + /** + * Parse the workflow from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; + } + + /** + * 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.workflowsStub && !this._terminated) { + return this.workflowsStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client_config.json new file mode 100644 index 00000000000..bccc9e1babb --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.workflows.v1beta.Workflows": { + "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": { + "ListWorkflows": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_proto_list.json new file mode 100644 index 00000000000..c9d0fa6bc07 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/workflows/v1beta/workflows.proto" +] diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..c7a7c423f62 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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 workflows = require('@google-cloud/workflows'); + +function main() { + const workflowsClient = new workflows.WorkflowsClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..9e04ae05724 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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 {WorkflowsClient} from '@google-cloud/workflows'; + +// check that the client class type name can be used +function doStuffWithWorkflowsClient(client: WorkflowsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const workflowsClient = new WorkflowsClient(); + doStuffWithWorkflowsClient(workflowsClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1beta/test/gapic_executions_v1beta.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_executions_v1beta.ts new file mode 100644 index 00000000000..aabf52f4cda --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_executions_v1beta.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 executionsModule 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('v1beta.ExecutionsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = executionsModule.v1beta.ExecutionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = executionsModule.v1beta.ExecutionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = executionsModule.v1beta.ExecutionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new executionsModule.v1beta.ExecutionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + await client.initialize(); + assert(client.executionsStub); + }); + + it('has close method for the initialized client', done => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.executionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1beta.ExecutionsClient({ + 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 executionsModule.v1beta.ExecutionsClient({ + 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('createExecution', () => { + it('invokes createExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); + const [response] = await client.createExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createExecution(request), expectedError); + }); + }); + + describe('getExecution', () => { + it('invokes getExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); + const [response] = await client.getExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getExecution(request), expectedError); + }); + }); + + describe('cancelExecution', () => { + it('invokes cancelExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); + const [response] = await client.cancelExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelExecution(request), expectedError); + }); + }); + + describe('listExecutions', () => { + it('invokes listExecutions without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); + const [response] = await client.listExecutions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutions without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutions( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutions with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listExecutions(request), expectedError); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listExecutionsStream without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { + 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.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listExecutionsStream with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExecutions without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; + const iterable = client.listExecutionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listExecutions with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('execution', () => { + const fakePath = "/rendered/path/execution"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + execution: "executionValue", + }; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.executionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.executionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('executionPath', () => { + const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.executionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromExecutionName', () => { + const result = client.matchProjectFromExecutionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromExecutionName', () => { + const result = client.matchLocationFromExecutionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromExecutionName', () => { + const result = client.matchWorkflowFromExecutionName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExecutionFromExecutionName', () => { + const result = client.matchExecutionFromExecutionName(fakePath); + assert.strictEqual(result, "executionValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workflow', () => { + const fakePath = "/rendered/path/workflow"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + }; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_workflows_v1beta.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_workflows_v1beta.ts new file mode 100644 index 00000000000..b444a534938 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_workflows_v1beta.ts @@ -0,0 +1,1119 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 workflowsModule 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.WorkflowsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = workflowsModule.v1beta.WorkflowsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = workflowsModule.v1beta.WorkflowsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = workflowsModule.v1beta.WorkflowsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new workflowsModule.v1beta.WorkflowsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + await client.initialize(); + assert(client.workflowsStub); + }); + + it('has close method for the initialized client', done => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.workflowsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1beta.WorkflowsClient({ + 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 workflowsModule.v1beta.WorkflowsClient({ + 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('getWorkflow', () => { + it('invokes getWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ); + client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkflow(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ); + client.innerApiCalls.getWorkflow = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkflow( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.v1beta.IWorkflow|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkflow = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow with closed client', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkflow(request), expectedError); + }); + }); + + describe('createWorkflow', () => { + it('invokes createWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteWorkflow', () => { + it('invokes deleteWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateWorkflow', () => { + it('invokes updateWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listWorkflows', () => { + it('invokes listWorkflows without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkflows(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflows without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkflows( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.v1beta.IWorkflow[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflows with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkflows = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkflows(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflowsStream without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + ]; + client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; + stream.on('data', (response: protos.google.cloud.workflows.v1beta.Workflow) => { + 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.listWorkflows.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkflowsStream with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; + stream.on('data', (response: protos.google.cloud.workflows.v1beta.Workflow) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkflows without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + ]; + client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; + const iterable = client.listWorkflowsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkflows with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkflowsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkflows.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 workflowsModule.v1beta.WorkflowsClient({ + 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('workflow', () => { + const fakePath = "/rendered/path/workflow"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + }; + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/webpack.config.js new file mode 100644 index 00000000000..5a6fddf6078 --- /dev/null +++ b/owl-bot-staging/google-cloud-workflows-executions/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: 'Workflows', + filename: './workflows.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-workstations/v1/.eslintignore b/owl-bot-staging/google-cloud-workstations/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-workstations/v1/.eslintrc.json b/owl-bot-staging/google-cloud-workstations/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-workstations/v1/.gitignore b/owl-bot-staging/google-cloud-workstations/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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-workstations/v1/.jsdoc.js b/owl-bot-staging/google-cloud-workstations/v1/.jsdoc.js new file mode 100644 index 00000000000..6398f035d9b --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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/workstations', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-workstations/v1/.mocharc.js b/owl-bot-staging/google-cloud-workstations/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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-workstations/v1/.prettierrc.js b/owl-bot-staging/google-cloud-workstations/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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-workstations/v1/README.md b/owl-bot-staging/google-cloud-workstations/v1/README.md new file mode 100644 index 00000000000..8ef3807738a --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/README.md @@ -0,0 +1 @@ +Workstations: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workstations/v1/package.json b/owl-bot-staging/google-cloud-workstations/v1/package.json new file mode 100644 index 00000000000..94fc6760f48 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/workstations", + "version": "0.1.0", + "description": "Workstations client for Node.js", + "repository": "googleapis/nodejs-workstations", + "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 workstations", + "workstations", + "workstations" + ], + "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-workstations/v1/protos/google/cloud/workstations/v1/workstations.proto b/owl-bot-staging/google-cloud-workstations/v1/protos/google/cloud/workstations/v1/workstations.proto new file mode 100644 index 00000000000..b6082157195 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/protos/google/cloud/workstations/v1/workstations.proto @@ -0,0 +1,1182 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.workstations.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/rpc/status.proto"; + +option go_package = "cloud.google.com/go/workstations/apiv1/workstationspb;workstationspb"; +option java_multiple_files = true; +option java_outer_classname = "WorkstationsProto"; +option java_package = "com.google.cloud.workstations.v1"; + +// Service for interacting with Cloud Workstations. +service Workstations { + option (google.api.default_host) = "workstations.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Returns the requested workstation cluster. + rpc GetWorkstationCluster(GetWorkstationClusterRequest) + returns (WorkstationCluster) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/workstationClusters/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns all workstation clusters in the specified location. + rpc ListWorkstationClusters(ListWorkstationClustersRequest) + returns (ListWorkstationClustersResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/workstationClusters" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new workstation cluster. + rpc CreateWorkstationCluster(CreateWorkstationClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/workstationClusters" + body: "workstation_cluster" + }; + option (google.api.method_signature) = + "parent,workstation_cluster,workstation_cluster_id"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationCluster" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing workstation cluster. + rpc UpdateWorkstationCluster(UpdateWorkstationClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{workstation_cluster.name=projects/*/locations/*/workstationClusters/*}" + body: "workstation_cluster" + }; + option (google.api.method_signature) = "workstation_cluster,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationCluster" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the specified workstation cluster. + rpc DeleteWorkstationCluster(DeleteWorkstationClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/workstationClusters/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationCluster" + metadata_type: "OperationMetadata" + }; + } + + // Returns the requested workstation configuration. + rpc GetWorkstationConfig(GetWorkstationConfigRequest) + returns (WorkstationConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns all workstation configurations in the specified cluster. + rpc ListWorkstationConfigs(ListWorkstationConfigsRequest) + returns (ListWorkstationConfigsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns all workstation configurations in the specified cluster on which + // the caller has the "workstations.workstation.create" permission. + rpc ListUsableWorkstationConfigs(ListUsableWorkstationConfigsRequest) + returns (ListUsableWorkstationConfigsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs:listUsable" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new workstation configuration. + rpc CreateWorkstationConfig(CreateWorkstationConfigRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs" + body: "workstation_config" + }; + option (google.api.method_signature) = + "parent,workstation_config,workstation_config_id"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationConfig" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing workstation configuration. + rpc UpdateWorkstationConfig(UpdateWorkstationConfigRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{workstation_config.name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" + body: "workstation_config" + }; + option (google.api.method_signature) = "workstation_config,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationConfig" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the specified workstation configuration. + rpc DeleteWorkstationConfig(DeleteWorkstationConfigRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationConfig" + metadata_type: "OperationMetadata" + }; + } + + // Returns the requested workstation. + rpc GetWorkstation(GetWorkstationRequest) returns (Workstation) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns all Workstations using the specified workstation configuration. + rpc ListWorkstations(ListWorkstationsRequest) + returns (ListWorkstationsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns all workstations using the specified workstation configuration + // on which the caller has the "workstations.workstations.use" permission. + rpc ListUsableWorkstations(ListUsableWorkstationsRequest) + returns (ListUsableWorkstationsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations:listUsable" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new workstation. + rpc CreateWorkstation(CreateWorkstationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations" + body: "workstation" + }; + option (google.api.method_signature) = "parent,workstation,workstation_id"; + option (google.longrunning.operation_info) = { + response_type: "Workstation" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing workstation. + rpc UpdateWorkstation(UpdateWorkstationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{workstation.name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" + body: "workstation" + }; + option (google.api.method_signature) = "workstation,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Workstation" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the specified workstation. + rpc DeleteWorkstation(DeleteWorkstationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Workstation" + metadata_type: "OperationMetadata" + }; + } + + // Starts running a workstation so that users can connect to it. + rpc StartWorkstation(StartWorkstationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:start" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Workstation" + metadata_type: "OperationMetadata" + }; + } + + // Stops running a workstation, reducing costs. + rpc StopWorkstation(StopWorkstationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:stop" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Workstation" + metadata_type: "OperationMetadata" + }; + } + + // Returns a short-lived credential that can be used to send authenticated and + // authorized traffic to a workstation. + rpc GenerateAccessToken(GenerateAccessTokenRequest) + returns (GenerateAccessTokenResponse) { + option (google.api.http) = { + post: "/v1/{workstation=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:generateAccessToken" + body: "*" + }; + option (google.api.method_signature) = "workstation"; + } +} + +// A grouping of workstation configurations and the associated workstations +// in that region. +message WorkstationCluster { + option (google.api.resource) = { + type: "workstations.googleapis.com/WorkstationCluster" + pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}" + style: DECLARATIVE_FRIENDLY + }; + + // Configuration options for private clusters. + message PrivateClusterConfig { + // Immutable. Whether Workstations endpoint is private. + bool enable_private_endpoint = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. Hostname for the workstation cluster. This field will be + // populated only when private endpoint is enabled. To access workstations + // in the cluster, create a new DNS zone mapping this domain name to an + // internal IP address and a forwarding rule mapping that address to the + // service attachment. + string cluster_hostname = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Service attachment URI for the workstation cluster. The + // service attachemnt is created when private endpoint is enabled. To access + // workstations in the cluster, configure access to the managed service + // using [Private Service + // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-services). + string service_attachment_uri = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Additional projects that are allowed to attach to the workstation + // cluster's service attachment. By default, the workstation cluster's + // project and the VPC host project (if different) are allowed. + repeated string allowed_projects = 4; + } + + // Full name of this resource. + string name = 1; + + // Human-readable name for this resource. + string display_name = 2; + + // Output only. A system-assigned unique identified for this resource. + string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates whether this resource is currently being updated to + // match its intended state. + bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Client-specified annotations. + map annotations = 5; + + // Client-specified labels that are applied to the resource and that are also + // propagated to the underlying Compute Engine resources. + map labels = 15; + + // Output only. Time when this resource was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was most recently updated. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was soft-deleted. + google.protobuf.Timestamp delete_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Checksum computed by the server. May be sent on update and delete requests + // to make sure that the client has an up-to-date value before proceeding. + string etag = 9; + + // Immutable. Name of the Compute Engine network in which instances associated + // with this cluster will be created. + string network = 10 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Name of the Compute Engine subnetwork in which instances + // associated with this cluster will be created. Must be part of the + // subnetwork specified for this cluster. + string subnetwork = 11 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The private IP address of the control plane for this cluster. + // Workstation VMs need access to this IP address to work with the service, so + // make sure that your firewall rules allow egress from the workstation VMs to + // this address. + string control_plane_ip = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Configuration for private cluster. + PrivateClusterConfig private_cluster_config = 12; + + // Output only. Whether this resource is in degraded mode, in which case it + // may require user action to restore full functionality. Details can be found + // in the `conditions` field. + bool degraded = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Status conditions describing the current resource state. + repeated google.rpc.Status conditions = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A set of configuration options describing how a workstation will be run. +// Workstation configurations are intended to be shared across multiple +// workstations. +message WorkstationConfig { + option (google.api.resource) = { + type: "workstations.googleapis.com/WorkstationConfig" + pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}" + style: DECLARATIVE_FRIENDLY + }; + + // Runtime host for a workstation. + message Host { + // A runtime using a Compute Engine instance. + message GceInstance { + // A set of Compute Engine Shielded instance options. + message GceShieldedInstanceConfig { + // Whether the instance has Secure Boot enabled. + bool enable_secure_boot = 1; + + // Whether the instance has the vTPM enabled. + bool enable_vtpm = 2; + + // Whether the instance has integrity monitoring enabled. + bool enable_integrity_monitoring = 3; + } + + // A set of Compute Engine Confidential VM instance options. + message GceConfidentialInstanceConfig { + // Whether the instance has confidential compute enabled. + bool enable_confidential_compute = 1; + } + + // The name of a Compute Engine machine type. + string machine_type = 1; + + // Email address of the service account used on VM instances + // used to support this configuration. If not set, VMs run with a + // Google-managed service account. This service account must have + // permission to pull the specified container image; otherwise, the image + // must be publicly accessible. + string service_account = 2; + + // Network tags to add to the Compute Engine machines backing the + // Workstations. + repeated string tags = 4; + + // Number of instances to pool for faster workstation startup. + int32 pool_size = 5; + + // Output only. Number of instances currently available in the pool for + // faster workstation startup. + int32 pooled_instances = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Whether instances have no public IP address. + bool disable_public_ip_addresses = 6; + + // Whether to enable nested virtualization on instances. + bool enable_nested_virtualization = 7; + + // A set of Compute Engine Shielded instance options. + GceShieldedInstanceConfig shielded_instance_config = 8; + + // A set of Compute Engine Confidential VM instance options. + GceConfidentialInstanceConfig confidential_instance_config = 10; + + // Size of the boot disk in GB. Defaults to 50. + int32 boot_disk_size_gb = 9; + } + + // Type of host that will be used for the workstation's runtime. + oneof config { + // Specifies a Compute Engine instance as the host. + GceInstance gce_instance = 1; + } + } + + // A directory to persist across workstation sessions. + message PersistentDirectory { + // A PersistentDirectory backed by a Compute Engine regional persistent + // disk. + message GceRegionalPersistentDisk { + // Value representing what should happen to the disk after the workstation + // is deleted. + enum ReclaimPolicy { + // Do not use. + RECLAIM_POLICY_UNSPECIFIED = 0; + + // The persistent disk will be deleted with the workstation. + DELETE = 1; + + // The persistent disk will be remain after the workstation is deleted, + // and the administrator must manually delete the disk. + RETAIN = 2; + } + + // Size of the disk in GB. Must be empty if source_snapshot is set. + // Defaults to 200. + int32 size_gb = 1; + + // Type of file system that the disk should be formatted with. The + // workstation image must support this file system type. Must be empty + // if source_snapshot is set. Defaults to ext4. + string fs_type = 2; + + // Type of the disk to use. Defaults to pd-standard. + string disk_type = 3; + + // Name of the snapshot to use as the source for the disk. If set, + // size_gb and fs_type must be empty. + string source_snapshot = 5; + + // What should happen to the disk after the workstation is deleted. + // Defaults to DELETE. + ReclaimPolicy reclaim_policy = 4; + } + + // How a persistent directory should be implemented. + oneof directory_type { + // A PersistentDirectory backed by a Compute Engine persistent disk. + GceRegionalPersistentDisk gce_pd = 2; + } + + // Location of this directory in the running workstation. + string mount_path = 1; + } + + // A Docker container. + message Container { + // Docker image defining the container. This image must be accessible by the + // service account specified in the workstation configuration. + string image = 1; + + // If set, overrides the default ENTRYPOINT specified by the image. + repeated string command = 2; + + // Arguments passed to the entrypoint. + repeated string args = 3; + + // Environment variables passed to the container's entrypoint. + map env = 4; + + // If set, overrides the default DIR specified by the image. + string working_dir = 5; + + // If set, overrides the USER specified in the image with the given uid. + int32 run_as_user = 6; + } + + // A customer-managed encryption key for the Compute Engine resources + // of this workstation configuration. + message CustomerEncryptionKey { + // Immutable. The name of the Google Cloud KMS encryption key. For example, + // `projects/PROJECT_ID/locations/REGION/keyRings/KEY_RING/cryptoKeys/KEY_NAME`. + string kms_key = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. The service account to use with the specified + // KMS key. We recommend that you use a separate service account + // and follow KMS best practices. For more information, see + // [Separation of + // duties](https://cloud.google.com/kms/docs/separation-of-duties) and + // `gcloud kms keys add-iam-policy-binding` + // [`--member`](https://cloud.google.com/sdk/gcloud/reference/kms/keys/add-iam-policy-binding#--member). + string kms_key_service_account = 2 + [(google.api.field_behavior) = IMMUTABLE]; + } + + // Full name of this resource. + string name = 1; + + // Human-readable name for this resource. + string display_name = 2; + + // Output only. A system-assigned unique identified for this resource. + string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates whether this resource is currently being updated to + // match its intended state. + bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Client-specified annotations. + map annotations = 5; + + // Client-specified labels that are applied to the resource and that are also + // propagated to the underlying Compute Engine resources. + map labels = 18; + + // Output only. Time when this resource was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was most recently updated. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was soft-deleted. + google.protobuf.Timestamp delete_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Checksum computed by the server. May be sent on update and delete requests + // to make sure that the client has an up-to-date value before proceeding. + string etag = 9; + + // How long to wait before automatically stopping an instance that hasn't + // received any user traffic. A value of 0 indicates that this instance + // should never time out due to idleness. Defaults to 20 minutes. + google.protobuf.Duration idle_timeout = 10; + + // How long to wait before automatically stopping a workstation after it + // started. A value of 0 indicates that workstations using this configuration + // should never time out. Must be greater than 0 and less than 24 hours if + // encryption_key is set. Defaults to 12 hours. + google.protobuf.Duration running_timeout = 11; + + // Runtime host for the workstation. + Host host = 12; + + // Directories to persist across workstation sessions. + repeated PersistentDirectory persistent_directories = 13; + + // Container that will be run for each workstation using this configuration + // when that workstation is started. + Container container = 14; + + // Immutable. Encrypts resources of this workstation configuration using a + // customer-managed encryption key. + // + // If specified, the boot disk of the Compute Engine instance and the + // persistent disk are encrypted using this encryption key. If + // this field is not set, the disks are encrypted using a generated + // key. Customer-managed encryption keys do not protect disk metadata. + // + // If the customer-managed encryption key is rotated, when the workstation + // instance is stopped, the system attempts to recreate the + // persistent disk with the new version of the key. Be sure to keep + // older versions of the key until the persistent disk is recreated. + // Otherwise, data on the persistent disk will be lost. + // + // If the encryption key is revoked, the workstation session will + // automatically be stopped within 7 hours. + // + // Immutable after the workstation configuration is created. + CustomerEncryptionKey encryption_key = 17 + [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. Whether this resource is degraded, in which case it may + // require user action to restore full functionality. See also the + // `conditions` field. + bool degraded = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Status conditions describing the current resource state. + repeated google.rpc.Status conditions = 16 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A single instance of a developer workstation with its own persistent storage. +message Workstation { + option (google.api.resource) = { + type: "workstations.googleapis.com/Workstation" + pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}/workstations/{workstation}" + style: DECLARATIVE_FRIENDLY + }; + + // Whether a workstation is running and ready to receive user requests. + enum State { + // Do not use. + STATE_UNSPECIFIED = 0; + + // The workstation is not yet ready to accept requests from users but will + // be soon. + STATE_STARTING = 1; + + // The workstation is ready to accept requests from users. + STATE_RUNNING = 2; + + // The workstation is being stopped. + STATE_STOPPING = 3; + + // The workstation is stopped and will not be able to receive requests until + // it is started. + STATE_STOPPED = 4; + } + + // Full name of this resource. + string name = 1; + + // Human-readable name for this resource. + string display_name = 2; + + // Output only. A system-assigned unique identified for this resource. + string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates whether this resource is currently being updated to + // match its intended state. + bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Client-specified annotations. + map annotations = 5; + + // Client-specified labels that are applied to the resource and that are also + // propagated to the underlying Compute Engine resources. + map labels = 13; + + // Output only. Time when this resource was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was most recently updated. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was soft-deleted. + google.protobuf.Timestamp delete_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Checksum computed by the server. May be sent on update and delete requests + // to make sure that the client has an up-to-date value before proceeding. + string etag = 9; + + // Output only. Current state of the workstation. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Host to which clients can send HTTPS traffic that will be + // received by the workstation. Authorized traffic will be received to the + // workstation as HTTP on port 80. To send traffic to a different port, + // clients may prefix the host with the destination port in the format + // `{port}-{host}`. + string host = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for GetWorkstationCluster. +message GetWorkstationClusterRequest { + // Required. Name of the requested resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationCluster" + } + ]; +} + +// Request message for ListWorkstationClusters. +message ListWorkstationClustersRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // Maximum number of items to return. + int32 page_size = 2; + + // next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response message for ListWorkstationClusters. +message ListWorkstationClustersResponse { + // The requested workstation clusters. + repeated WorkstationCluster workstation_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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Message for creating a CreateWorkstationCluster. +message CreateWorkstationClusterRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // Required. ID to use for the workstation cluster. + string workstation_cluster_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Workstation cluster to create. + WorkstationCluster workstation_cluster = 3 + [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 4; +} + +// Request message for UpdateWorkstationCluster. +message UpdateWorkstationClusterRequest { + // Required. Workstation cluster to update. + WorkstationCluster workstation_cluster = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask that specifies which fields in the workstation cluster + // should be updated. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 3; + + // If set, and the workstation cluster is not found, a new workstation + // cluster will be created. In this situation, update_mask is ignored. + bool allow_missing = 4; +} + +// Message for deleting a workstation cluster. +message DeleteWorkstationClusterRequest { + // Required. Name of the workstation cluster to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // If set, validate the request and preview the review, but do not apply it. + bool validate_only = 2; + + // If set, the request will be rejected if the latest version of the + // workstation cluster on the server does not have this ETag. + string etag = 3; + + // If set, any workstation configurations and workstations in the + // workstation cluster are also deleted. Otherwise, the request only + // works if the workstation cluster has no configurations or workstations. + bool force = 4; +} + +// Request message for GetWorkstationConfig. +message GetWorkstationConfigRequest { + // Required. Name of the requested resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationConfig" + } + ]; +} + +// Request message for ListWorkstationConfigs. +message ListWorkstationConfigsRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // Maximum number of items to return. + int32 page_size = 2; + + // next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response message for ListWorkstationConfigs. +message ListWorkstationConfigsResponse { + // The requested configs. + repeated WorkstationConfig workstation_configs = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Request message for ListUsableWorkstationConfigs. +message ListUsableWorkstationConfigsRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // Maximum number of items to return. + int32 page_size = 2; + + // next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response message for ListUsableWorkstationConfigs. +message ListUsableWorkstationConfigsResponse { + // The requested configs. + repeated WorkstationConfig workstation_configs = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Message for creating a CreateWorkstationConfig. +message CreateWorkstationConfigRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // Required. ID to use for the workstation configuration. + string workstation_config_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Config to create. + WorkstationConfig workstation_config = 3 + [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 4; +} + +// Request message for UpdateWorkstationConfig. +message UpdateWorkstationConfigRequest { + // Required. Config to update. + WorkstationConfig workstation_config = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask specifying which fields in the workstation configuration + // should be updated. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 3; + + // If set and the workstation configuration is not found, a new + // workstation configuration will be created. In this situation, + // update_mask is ignored. + bool allow_missing = 4; +} + +// Message for deleting a workstation configuration. +message DeleteWorkstationConfigRequest { + // Required. Name of the workstation configuration to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationConfig" + } + ]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 2; + + // If set, the request is rejected if the latest version of the + // workstation configuration on the server does not have this ETag. + string etag = 3; + + // If set, any workstations in the workstation configuration are also deleted. + // Otherwise, the request works only if the workstation configuration has + // no workstations. + bool force = 4; +} + +// Request message for GetWorkstation. +message GetWorkstationRequest { + // Required. Name of the requested resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/Workstation" + } + ]; +} + +// Request message for ListWorkstations. +message ListWorkstationsRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationConfig" + } + ]; + + // Maximum number of items to return. + int32 page_size = 2; + + // next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response message for ListWorkstations. +message ListWorkstationsResponse { + // The requested workstations. + repeated Workstation workstations = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Request message for ListUsableWorkstations. +message ListUsableWorkstationsRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationConfig" + } + ]; + + // Maximum number of items to return. + int32 page_size = 2; + + // next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response message for ListUsableWorkstations. +message ListUsableWorkstationsResponse { + // The requested workstations. + repeated Workstation workstations = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Message for creating a CreateWorkstation. +message CreateWorkstationRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationConfig" + } + ]; + + // Required. ID to use for the workstation. + string workstation_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Workstation to create. + Workstation workstation = 3 [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 4; +} + +// Request message for UpdateWorkstation. +message UpdateWorkstationRequest { + // Required. Workstation to update. + Workstation workstation = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask specifying which fields in the workstation configuration + // should be updated. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 3; + + // If set and the workstation configuration is not found, a new + // workstation configuration is created. In this situation, update_mask + // is ignored. + bool allow_missing = 4; +} + +// Request message for DeleteWorkstation. +message DeleteWorkstationRequest { + // Required. Name of the workstation to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/Workstation" + } + ]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 2; + + // If set, the request will be rejected if the latest version of the + // workstation on the server does not have this ETag. + string etag = 3; +} + +// Request message for StartWorkstation. +message StartWorkstationRequest { + // Required. Name of the workstation to start. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/Workstation" + } + ]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 2; + + // If set, the request will be rejected if the latest version of the + // workstation on the server does not have this ETag. + string etag = 3; +} + +// Request message for StopWorkstation. +message StopWorkstationRequest { + // Required. Name of the workstation to stop. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/Workstation" + } + ]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 2; + + // If set, the request will be rejected if the latest version of the + // workstation on the server does not have this ETag. + string etag = 3; +} + +// Request message for GenerateAccessToken. +message GenerateAccessTokenRequest { + // Desired expiration or lifetime of the access token. + oneof expiration { + // Desired expiration time of the access token. This value must + // be at most 24 hours in the future. If a value is not specified, the + // token's expiration time will be set to a default value of 1 hour in the + // future. + google.protobuf.Timestamp expire_time = 2; + + // Desired lifetime duration of the access token. This value must + // be at most 24 hours. If a value is not specified, the token's lifetime + // will be set to a default value of 1 hour. + google.protobuf.Duration ttl = 3; + } + + // Required. Name of the workstation for which the access token should be + // generated. + string workstation = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/Workstation" + } + ]; +} + +// Response message for GenerateAccessToken. +message GenerateAccessTokenResponse { + // The generated bearer access token. To use this token, include it in an + // Authorization header of an HTTP request sent to the associated + // workstation's hostname—for example, `Authorization: Bearer + // `. + string access_token = 1; + + // Time at which the generated token will expire. + google.protobuf.Timestamp expire_time = 2; +} + +// Metadata for long-running operations. +message OperationMetadata { + // Output only. Time that the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time that 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. + 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-workstations/v1/samples/generated/v1/snippet_metadata_google.cloud.workstations.v1.json b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/snippet_metadata_google.cloud.workstations.v1.json new file mode 100644 index 00000000000..d03d881f904 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/snippet_metadata_google.cloud.workstations.v1.json @@ -0,0 +1,983 @@ +{ + "clientLibrary": { + "name": "nodejs-workstations", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.workstations.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "workstations_v1_generated_Workstations_GetWorkstationCluster_async", + "title": "Workstations getWorkstationCluster Sample", + "origin": "API_DEFINITION", + "description": " Returns the requested workstation cluster.", + "canonical": true, + "file": "workstations.get_workstation_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkstationCluster", + "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstationCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1.WorkstationCluster", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "GetWorkstationCluster", + "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstationCluster", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_ListWorkstationClusters_async", + "title": "Workstations listWorkstationClusters Sample", + "origin": "API_DEFINITION", + "description": " Returns all workstation clusters in the specified location.", + "canonical": true, + "file": "workstations.list_workstation_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkstationClusters", + "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstationClusters", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1.ListWorkstationClustersResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "ListWorkstationClusters", + "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstationClusters", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_CreateWorkstationCluster_async", + "title": "Workstations createWorkstationCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a new workstation cluster.", + "canonical": true, + "file": "workstations.create_workstation_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkstationCluster", + "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstationCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "workstation_cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "workstation_cluster", + "type": ".google.cloud.workstations.v1.WorkstationCluster" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "CreateWorkstationCluster", + "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstationCluster", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_UpdateWorkstationCluster_async", + "title": "Workstations updateWorkstationCluster Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing workstation cluster.", + "canonical": true, + "file": "workstations.update_workstation_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkstationCluster", + "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstationCluster", + "async": true, + "parameters": [ + { + "name": "workstation_cluster", + "type": ".google.cloud.workstations.v1.WorkstationCluster" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "UpdateWorkstationCluster", + "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstationCluster", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_DeleteWorkstationCluster_async", + "title": "Workstations deleteWorkstationCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified workstation cluster.", + "canonical": true, + "file": "workstations.delete_workstation_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkstationCluster", + "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstationCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "DeleteWorkstationCluster", + "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstationCluster", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_GetWorkstationConfig_async", + "title": "Workstations getWorkstationConfig Sample", + "origin": "API_DEFINITION", + "description": " Returns the requested workstation configuration.", + "canonical": true, + "file": "workstations.get_workstation_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkstationConfig", + "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1.WorkstationConfig", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "GetWorkstationConfig", + "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstationConfig", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_ListWorkstationConfigs_async", + "title": "Workstations listWorkstationConfigs Sample", + "origin": "API_DEFINITION", + "description": " Returns all workstation configurations in the specified cluster.", + "canonical": true, + "file": "workstations.list_workstation_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkstationConfigs", + "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstationConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1.ListWorkstationConfigsResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "ListWorkstationConfigs", + "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstationConfigs", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_ListUsableWorkstationConfigs_async", + "title": "Workstations listUsableWorkstationConfigs Sample", + "origin": "API_DEFINITION", + "description": " Returns all workstation configurations in the specified cluster on which the caller has the \"workstations.workstation.create\" permission.", + "canonical": true, + "file": "workstations.list_usable_workstation_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListUsableWorkstationConfigs", + "fullName": "google.cloud.workstations.v1.Workstations.ListUsableWorkstationConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1.ListUsableWorkstationConfigsResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "ListUsableWorkstationConfigs", + "fullName": "google.cloud.workstations.v1.Workstations.ListUsableWorkstationConfigs", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_CreateWorkstationConfig_async", + "title": "Workstations createWorkstationConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new workstation configuration.", + "canonical": true, + "file": "workstations.create_workstation_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkstationConfig", + "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstationConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "workstation_config_id", + "type": "TYPE_STRING" + }, + { + "name": "workstation_config", + "type": ".google.cloud.workstations.v1.WorkstationConfig" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "CreateWorkstationConfig", + "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstationConfig", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_UpdateWorkstationConfig_async", + "title": "Workstations updateWorkstationConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing workstation configuration.", + "canonical": true, + "file": "workstations.update_workstation_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkstationConfig", + "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstationConfig", + "async": true, + "parameters": [ + { + "name": "workstation_config", + "type": ".google.cloud.workstations.v1.WorkstationConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "UpdateWorkstationConfig", + "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstationConfig", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_DeleteWorkstationConfig_async", + "title": "Workstations deleteWorkstationConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified workstation configuration.", + "canonical": true, + "file": "workstations.delete_workstation_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkstationConfig", + "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "DeleteWorkstationConfig", + "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstationConfig", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_GetWorkstation_async", + "title": "Workstations getWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Returns the requested workstation.", + "canonical": true, + "file": "workstations.get_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1.Workstation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "GetWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_ListWorkstations_async", + "title": "Workstations listWorkstations Sample", + "origin": "API_DEFINITION", + "description": " Returns all Workstations using the specified workstation configuration.", + "canonical": true, + "file": "workstations.list_workstations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkstations", + "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1.ListWorkstationsResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "ListWorkstations", + "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstations", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_ListUsableWorkstations_async", + "title": "Workstations listUsableWorkstations Sample", + "origin": "API_DEFINITION", + "description": " Returns all workstations using the specified workstation configuration on which the caller has the \"workstations.workstations.use\" permission.", + "canonical": true, + "file": "workstations.list_usable_workstations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListUsableWorkstations", + "fullName": "google.cloud.workstations.v1.Workstations.ListUsableWorkstations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1.ListUsableWorkstationsResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "ListUsableWorkstations", + "fullName": "google.cloud.workstations.v1.Workstations.ListUsableWorkstations", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_CreateWorkstation_async", + "title": "Workstations createWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Creates a new workstation.", + "canonical": true, + "file": "workstations.create_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "workstation_id", + "type": "TYPE_STRING" + }, + { + "name": "workstation", + "type": ".google.cloud.workstations.v1.Workstation" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "CreateWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_UpdateWorkstation_async", + "title": "Workstations updateWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing workstation.", + "canonical": true, + "file": "workstations.update_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstation", + "async": true, + "parameters": [ + { + "name": "workstation", + "type": ".google.cloud.workstations.v1.Workstation" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "UpdateWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_DeleteWorkstation_async", + "title": "Workstations deleteWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified workstation.", + "canonical": true, + "file": "workstations.delete_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "DeleteWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_StartWorkstation_async", + "title": "Workstations startWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Starts running a workstation so that users can connect to it.", + "canonical": true, + "file": "workstations.start_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.StartWorkstation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "StartWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.StartWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_StopWorkstation_async", + "title": "Workstations stopWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Stops running a workstation, reducing costs.", + "canonical": true, + "file": "workstations.stop_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.StopWorkstation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "StopWorkstation", + "fullName": "google.cloud.workstations.v1.Workstations.StopWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1_generated_Workstations_GenerateAccessToken_async", + "title": "Workstations generateAccessToken Sample", + "origin": "API_DEFINITION", + "description": " Returns a short-lived credential that can be used to send authenticated and authorized traffic to a workstation.", + "canonical": true, + "file": "workstations.generate_access_token.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateAccessToken", + "fullName": "google.cloud.workstations.v1.Workstations.GenerateAccessToken", + "async": true, + "parameters": [ + { + "name": "expire_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "ttl", + "type": ".google.protobuf.Duration" + }, + { + "name": "workstation", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1.GenerateAccessTokenResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1.WorkstationsClient" + }, + "method": { + "shortName": "GenerateAccessToken", + "fullName": "google.cloud.workstations.v1.Workstations.GenerateAccessToken", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1.Workstations" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation.js new file mode 100644 index 00000000000..a81d5dbadd8 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation.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, workstationId, workstation) { + // [START workstations_v1_generated_Workstations_CreateWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Required. ID to use for the workstation. + */ + // const workstationId = 'abc123' + /** + * Required. Workstation to create. + */ + // const workstation = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callCreateWorkstation() { + // Construct request + const request = { + parent, + workstationId, + workstation, + }; + + // Run request + const [operation] = await workstationsClient.createWorkstation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateWorkstation(); + // [END workstations_v1_generated_Workstations_CreateWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_cluster.js new file mode 100644 index 00000000000..21b02bbd7c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_cluster.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, workstationClusterId, workstationCluster) { + // [START workstations_v1_generated_Workstations_CreateWorkstationCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Required. ID to use for the workstation cluster. + */ + // const workstationClusterId = 'abc123' + /** + * Required. Workstation cluster to create. + */ + // const workstationCluster = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callCreateWorkstationCluster() { + // Construct request + const request = { + parent, + workstationClusterId, + workstationCluster, + }; + + // Run request + const [operation] = await workstationsClient.createWorkstationCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateWorkstationCluster(); + // [END workstations_v1_generated_Workstations_CreateWorkstationCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_config.js new file mode 100644 index 00000000000..33c9e27bda5 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_config.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, workstationConfigId, workstationConfig) { + // [START workstations_v1_generated_Workstations_CreateWorkstationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Required. ID to use for the workstation configuration. + */ + // const workstationConfigId = 'abc123' + /** + * Required. Config to create. + */ + // const workstationConfig = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callCreateWorkstationConfig() { + // Construct request + const request = { + parent, + workstationConfigId, + workstationConfig, + }; + + // Run request + const [operation] = await workstationsClient.createWorkstationConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateWorkstationConfig(); + // [END workstations_v1_generated_Workstations_CreateWorkstationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation.js new file mode 100644 index 00000000000..5e3cb409309 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation.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) { + // [START workstations_v1_generated_Workstations_DeleteWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workstation to delete. + */ + // const name = 'abc123' + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this ETag. + */ + // const etag = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callDeleteWorkstation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workstationsClient.deleteWorkstation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteWorkstation(); + // [END workstations_v1_generated_Workstations_DeleteWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_cluster.js new file mode 100644 index 00000000000..9b25cc73f57 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_cluster.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 workstations_v1_generated_Workstations_DeleteWorkstationCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workstation cluster to delete. + */ + // const name = 'abc123' + /** + * If set, validate the request and preview the review, but do not apply it. + */ + // const validateOnly = true + /** + * If set, the request will be rejected if the latest version of the + * workstation cluster on the server does not have this ETag. + */ + // const etag = 'abc123' + /** + * If set, any workstation configurations and workstations in the + * workstation cluster are also deleted. Otherwise, the request only + * works if the workstation cluster has no configurations or workstations. + */ + // const force = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callDeleteWorkstationCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workstationsClient.deleteWorkstationCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteWorkstationCluster(); + // [END workstations_v1_generated_Workstations_DeleteWorkstationCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_config.js new file mode 100644 index 00000000000..e97506ccfd9 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_config.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(name) { + // [START workstations_v1_generated_Workstations_DeleteWorkstationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workstation configuration to delete. + */ + // const name = 'abc123' + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set, the request is rejected if the latest version of the + * workstation configuration on the server does not have this ETag. + */ + // const etag = 'abc123' + /** + * If set, any workstations in the workstation configuration are also deleted. + * Otherwise, the request works only if the workstation configuration has + * no workstations. + */ + // const force = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callDeleteWorkstationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workstationsClient.deleteWorkstationConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteWorkstationConfig(); + // [END workstations_v1_generated_Workstations_DeleteWorkstationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.generate_access_token.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.generate_access_token.js new file mode 100644 index 00000000000..84a042a8964 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.generate_access_token.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(workstation) { + // [START workstations_v1_generated_Workstations_GenerateAccessToken_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Desired expiration time of the access token. This value must + * be at most 24 hours in the future. If a value is not specified, the + * token's expiration time will be set to a default value of 1 hour in the + * future. + */ + // const expireTime = {} + /** + * Desired lifetime duration of the access token. This value must + * be at most 24 hours. If a value is not specified, the token's lifetime + * will be set to a default value of 1 hour. + */ + // const ttl = {} + /** + * Required. Name of the workstation for which the access token should be + * generated. + */ + // const workstation = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callGenerateAccessToken() { + // Construct request + const request = { + workstation, + }; + + // Run request + const response = await workstationsClient.generateAccessToken(request); + console.log(response); + } + + callGenerateAccessToken(); + // [END workstations_v1_generated_Workstations_GenerateAccessToken_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation.js new file mode 100644 index 00000000000..44fd5c9394e --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation.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 workstations_v1_generated_Workstations_GetWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 requested resource. + */ + // const name = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callGetWorkstation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await workstationsClient.getWorkstation(request); + console.log(response); + } + + callGetWorkstation(); + // [END workstations_v1_generated_Workstations_GetWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_cluster.js new file mode 100644 index 00000000000..af52420b163 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_cluster.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 workstations_v1_generated_Workstations_GetWorkstationCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 requested resource. + */ + // const name = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callGetWorkstationCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await workstationsClient.getWorkstationCluster(request); + console.log(response); + } + + callGetWorkstationCluster(); + // [END workstations_v1_generated_Workstations_GetWorkstationCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_config.js new file mode 100644 index 00000000000..6e3e86070fd --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_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 workstations_v1_generated_Workstations_GetWorkstationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 requested resource. + */ + // const name = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callGetWorkstationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await workstationsClient.getWorkstationConfig(request); + console.log(response); + } + + callGetWorkstationConfig(); + // [END workstations_v1_generated_Workstations_GetWorkstationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstation_configs.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstation_configs.js new file mode 100644 index 00000000000..e4393f0e08b --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstation_configs.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(parent) { + // [START workstations_v1_generated_Workstations_ListUsableWorkstationConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Maximum number of items to return. + */ + // const pageSize = 1234 + /** + * next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callListUsableWorkstationConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workstationsClient.listUsableWorkstationConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListUsableWorkstationConfigs(); + // [END workstations_v1_generated_Workstations_ListUsableWorkstationConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstations.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstations.js new file mode 100644 index 00000000000..d3f09434d14 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstations.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(parent) { + // [START workstations_v1_generated_Workstations_ListUsableWorkstations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Maximum number of items to return. + */ + // const pageSize = 1234 + /** + * next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callListUsableWorkstations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workstationsClient.listUsableWorkstationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListUsableWorkstations(); + // [END workstations_v1_generated_Workstations_ListUsableWorkstations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_clusters.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_clusters.js new file mode 100644 index 00000000000..d46b9ee5fc8 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_clusters.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(parent) { + // [START workstations_v1_generated_Workstations_ListWorkstationClusters_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Maximum number of items to return. + */ + // const pageSize = 1234 + /** + * next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callListWorkstationClusters() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workstationsClient.listWorkstationClustersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListWorkstationClusters(); + // [END workstations_v1_generated_Workstations_ListWorkstationClusters_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_configs.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_configs.js new file mode 100644 index 00000000000..f26affab431 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_configs.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(parent) { + // [START workstations_v1_generated_Workstations_ListWorkstationConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Maximum number of items to return. + */ + // const pageSize = 1234 + /** + * next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callListWorkstationConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workstationsClient.listWorkstationConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListWorkstationConfigs(); + // [END workstations_v1_generated_Workstations_ListWorkstationConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstations.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstations.js new file mode 100644 index 00000000000..78be2ba4e2b --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstations.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(parent) { + // [START workstations_v1_generated_Workstations_ListWorkstations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Maximum number of items to return. + */ + // const pageSize = 1234 + /** + * next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callListWorkstations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workstationsClient.listWorkstationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListWorkstations(); + // [END workstations_v1_generated_Workstations_ListWorkstations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.start_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.start_workstation.js new file mode 100644 index 00000000000..dd5a70e0bb0 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.start_workstation.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) { + // [START workstations_v1_generated_Workstations_StartWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workstation to start. + */ + // const name = 'abc123' + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this ETag. + */ + // const etag = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callStartWorkstation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workstationsClient.startWorkstation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStartWorkstation(); + // [END workstations_v1_generated_Workstations_StartWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.stop_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.stop_workstation.js new file mode 100644 index 00000000000..2c33aeaecb9 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.stop_workstation.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) { + // [START workstations_v1_generated_Workstations_StopWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workstation to stop. + */ + // const name = 'abc123' + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this ETag. + */ + // const etag = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callStopWorkstation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workstationsClient.stopWorkstation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStopWorkstation(); + // [END workstations_v1_generated_Workstations_StopWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation.js new file mode 100644 index 00000000000..5f69359861f --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation.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(workstation, updateMask) { + // [START workstations_v1_generated_Workstations_UpdateWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Workstation to update. + */ + // const workstation = {} + /** + * Required. Mask specifying which fields in the workstation configuration + * should be updated. + */ + // const updateMask = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set and the workstation configuration is not found, a new + * workstation configuration is created. In this situation, update_mask + * is ignored. + */ + // const allowMissing = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callUpdateWorkstation() { + // Construct request + const request = { + workstation, + updateMask, + }; + + // Run request + const [operation] = await workstationsClient.updateWorkstation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateWorkstation(); + // [END workstations_v1_generated_Workstations_UpdateWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_cluster.js new file mode 100644 index 00000000000..9a27e3ef296 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_cluster.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(workstationCluster, updateMask) { + // [START workstations_v1_generated_Workstations_UpdateWorkstationCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Workstation cluster to update. + */ + // const workstationCluster = {} + /** + * Required. Mask that specifies which fields in the workstation cluster + * should be updated. + */ + // const updateMask = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set, and the workstation cluster is not found, a new workstation + * cluster will be created. In this situation, update_mask is ignored. + */ + // const allowMissing = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callUpdateWorkstationCluster() { + // Construct request + const request = { + workstationCluster, + updateMask, + }; + + // Run request + const [operation] = await workstationsClient.updateWorkstationCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateWorkstationCluster(); + // [END workstations_v1_generated_Workstations_UpdateWorkstationCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_config.js new file mode 100644 index 00000000000..b9213a81e2b --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_config.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(workstationConfig, updateMask) { + // [START workstations_v1_generated_Workstations_UpdateWorkstationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Config to update. + */ + // const workstationConfig = {} + /** + * Required. Mask specifying which fields in the workstation configuration + * should be updated. + */ + // const updateMask = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set and the workstation configuration is not found, a new + * workstation configuration will be created. In this situation, + * update_mask is ignored. + */ + // const allowMissing = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callUpdateWorkstationConfig() { + // Construct request + const request = { + workstationConfig, + updateMask, + }; + + // Run request + const [operation] = await workstationsClient.updateWorkstationConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateWorkstationConfig(); + // [END workstations_v1_generated_Workstations_UpdateWorkstationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/src/index.ts b/owl-bot-staging/google-cloud-workstations/v1/src/index.ts new file mode 100644 index 00000000000..dbc99d055ad --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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 WorkstationsClient = v1.WorkstationsClient; +type WorkstationsClient = v1.WorkstationsClient; +export {v1, WorkstationsClient}; +export default {v1, WorkstationsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-workstations/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-workstations/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..aad5c9cc0d2 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/src/v1/gapic_metadata.json @@ -0,0 +1,243 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.workstations.v1", + "libraryPackage": "@google-cloud/workstations", + "services": { + "Workstations": { + "clients": { + "grpc": { + "libraryClient": "WorkstationsClient", + "rpcs": { + "GetWorkstationCluster": { + "methods": [ + "getWorkstationCluster" + ] + }, + "GetWorkstationConfig": { + "methods": [ + "getWorkstationConfig" + ] + }, + "GetWorkstation": { + "methods": [ + "getWorkstation" + ] + }, + "GenerateAccessToken": { + "methods": [ + "generateAccessToken" + ] + }, + "CreateWorkstationCluster": { + "methods": [ + "createWorkstationCluster" + ] + }, + "UpdateWorkstationCluster": { + "methods": [ + "updateWorkstationCluster" + ] + }, + "DeleteWorkstationCluster": { + "methods": [ + "deleteWorkstationCluster" + ] + }, + "CreateWorkstationConfig": { + "methods": [ + "createWorkstationConfig" + ] + }, + "UpdateWorkstationConfig": { + "methods": [ + "updateWorkstationConfig" + ] + }, + "DeleteWorkstationConfig": { + "methods": [ + "deleteWorkstationConfig" + ] + }, + "CreateWorkstation": { + "methods": [ + "createWorkstation" + ] + }, + "UpdateWorkstation": { + "methods": [ + "updateWorkstation" + ] + }, + "DeleteWorkstation": { + "methods": [ + "deleteWorkstation" + ] + }, + "StartWorkstation": { + "methods": [ + "startWorkstation" + ] + }, + "StopWorkstation": { + "methods": [ + "stopWorkstation" + ] + }, + "ListWorkstationClusters": { + "methods": [ + "listWorkstationClusters", + "listWorkstationClustersStream", + "listWorkstationClustersAsync" + ] + }, + "ListWorkstationConfigs": { + "methods": [ + "listWorkstationConfigs", + "listWorkstationConfigsStream", + "listWorkstationConfigsAsync" + ] + }, + "ListUsableWorkstationConfigs": { + "methods": [ + "listUsableWorkstationConfigs", + "listUsableWorkstationConfigsStream", + "listUsableWorkstationConfigsAsync" + ] + }, + "ListWorkstations": { + "methods": [ + "listWorkstations", + "listWorkstationsStream", + "listWorkstationsAsync" + ] + }, + "ListUsableWorkstations": { + "methods": [ + "listUsableWorkstations", + "listUsableWorkstationsStream", + "listUsableWorkstationsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WorkstationsClient", + "rpcs": { + "GetWorkstationCluster": { + "methods": [ + "getWorkstationCluster" + ] + }, + "GetWorkstationConfig": { + "methods": [ + "getWorkstationConfig" + ] + }, + "GetWorkstation": { + "methods": [ + "getWorkstation" + ] + }, + "GenerateAccessToken": { + "methods": [ + "generateAccessToken" + ] + }, + "CreateWorkstationCluster": { + "methods": [ + "createWorkstationCluster" + ] + }, + "UpdateWorkstationCluster": { + "methods": [ + "updateWorkstationCluster" + ] + }, + "DeleteWorkstationCluster": { + "methods": [ + "deleteWorkstationCluster" + ] + }, + "CreateWorkstationConfig": { + "methods": [ + "createWorkstationConfig" + ] + }, + "UpdateWorkstationConfig": { + "methods": [ + "updateWorkstationConfig" + ] + }, + "DeleteWorkstationConfig": { + "methods": [ + "deleteWorkstationConfig" + ] + }, + "CreateWorkstation": { + "methods": [ + "createWorkstation" + ] + }, + "UpdateWorkstation": { + "methods": [ + "updateWorkstation" + ] + }, + "DeleteWorkstation": { + "methods": [ + "deleteWorkstation" + ] + }, + "StartWorkstation": { + "methods": [ + "startWorkstation" + ] + }, + "StopWorkstation": { + "methods": [ + "stopWorkstation" + ] + }, + "ListWorkstationClusters": { + "methods": [ + "listWorkstationClusters", + "listWorkstationClustersStream", + "listWorkstationClustersAsync" + ] + }, + "ListWorkstationConfigs": { + "methods": [ + "listWorkstationConfigs", + "listWorkstationConfigsStream", + "listWorkstationConfigsAsync" + ] + }, + "ListUsableWorkstationConfigs": { + "methods": [ + "listUsableWorkstationConfigs", + "listUsableWorkstationConfigsStream", + "listUsableWorkstationConfigsAsync" + ] + }, + "ListWorkstations": { + "methods": [ + "listWorkstations", + "listWorkstationsStream", + "listWorkstationsAsync" + ] + }, + "ListUsableWorkstations": { + "methods": [ + "listUsableWorkstations", + "listUsableWorkstationsStream", + "listUsableWorkstationsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workstations/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-workstations/v1/src/v1/index.ts new file mode 100644 index 00000000000..8fd62185321 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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 {WorkstationsClient} from './workstations_client'; diff --git a/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client.ts b/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client.ts new file mode 100644 index 00000000000..ffff24e033f --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client.ts @@ -0,0 +1,3315 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/workstations_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './workstations_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for interacting with Cloud Workstations. + * @class + * @memberof v1 + */ +export class WorkstationsClient { + 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; + workstationsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WorkstationsClient. + * + * @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 WorkstationsClient({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 WorkstationsClient; + 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}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + workstationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}/workstations/{workstation}' + ), + workstationClusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}' + ), + workstationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listWorkstationClusters: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationClusters'), + listWorkstationConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationConfigs'), + listUsableWorkstationConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationConfigs'), + listWorkstations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstations'), + listUsableWorkstations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstations') + }; + + 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.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}: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 createWorkstationClusterResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.WorkstationCluster') as gax.protobuf.Type; + const createWorkstationClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; + const updateWorkstationClusterResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.WorkstationCluster') as gax.protobuf.Type; + const updateWorkstationClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; + const deleteWorkstationClusterResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.WorkstationCluster') as gax.protobuf.Type; + const deleteWorkstationClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; + const createWorkstationConfigResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.WorkstationConfig') as gax.protobuf.Type; + const createWorkstationConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; + const updateWorkstationConfigResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.WorkstationConfig') as gax.protobuf.Type; + const updateWorkstationConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; + const deleteWorkstationConfigResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.WorkstationConfig') as gax.protobuf.Type; + const deleteWorkstationConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; + const createWorkstationResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.Workstation') as gax.protobuf.Type; + const createWorkstationMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; + const updateWorkstationResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.Workstation') as gax.protobuf.Type; + const updateWorkstationMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; + const deleteWorkstationResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.Workstation') as gax.protobuf.Type; + const deleteWorkstationMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; + const startWorkstationResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.Workstation') as gax.protobuf.Type; + const startWorkstationMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; + const stopWorkstationResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.Workstation') as gax.protobuf.Type; + const stopWorkstationMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createWorkstationCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkstationClusterResponse.decode.bind(createWorkstationClusterResponse), + createWorkstationClusterMetadata.decode.bind(createWorkstationClusterMetadata)), + updateWorkstationCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkstationClusterResponse.decode.bind(updateWorkstationClusterResponse), + updateWorkstationClusterMetadata.decode.bind(updateWorkstationClusterMetadata)), + deleteWorkstationCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkstationClusterResponse.decode.bind(deleteWorkstationClusterResponse), + deleteWorkstationClusterMetadata.decode.bind(deleteWorkstationClusterMetadata)), + createWorkstationConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkstationConfigResponse.decode.bind(createWorkstationConfigResponse), + createWorkstationConfigMetadata.decode.bind(createWorkstationConfigMetadata)), + updateWorkstationConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkstationConfigResponse.decode.bind(updateWorkstationConfigResponse), + updateWorkstationConfigMetadata.decode.bind(updateWorkstationConfigMetadata)), + deleteWorkstationConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkstationConfigResponse.decode.bind(deleteWorkstationConfigResponse), + deleteWorkstationConfigMetadata.decode.bind(deleteWorkstationConfigMetadata)), + createWorkstation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkstationResponse.decode.bind(createWorkstationResponse), + createWorkstationMetadata.decode.bind(createWorkstationMetadata)), + updateWorkstation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkstationResponse.decode.bind(updateWorkstationResponse), + updateWorkstationMetadata.decode.bind(updateWorkstationMetadata)), + deleteWorkstation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkstationResponse.decode.bind(deleteWorkstationResponse), + deleteWorkstationMetadata.decode.bind(deleteWorkstationMetadata)), + startWorkstation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + startWorkstationResponse.decode.bind(startWorkstationResponse), + startWorkstationMetadata.decode.bind(startWorkstationMetadata)), + stopWorkstation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + stopWorkstationResponse.decode.bind(stopWorkstationResponse), + stopWorkstationMetadata.decode.bind(stopWorkstationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.workstations.v1.Workstations', 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.workstationsStub) { + return this.workstationsStub; + } + + // Put together the "service stub" for + // google.cloud.workstations.v1.Workstations. + this.workstationsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workstations.v1.Workstations') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workstations.v1.Workstations, + 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 workstationsStubMethods = + ['getWorkstationCluster', 'listWorkstationClusters', 'createWorkstationCluster', 'updateWorkstationCluster', 'deleteWorkstationCluster', 'getWorkstationConfig', 'listWorkstationConfigs', 'listUsableWorkstationConfigs', 'createWorkstationConfig', 'updateWorkstationConfig', 'deleteWorkstationConfig', 'getWorkstation', 'listWorkstations', 'listUsableWorkstations', 'createWorkstation', 'updateWorkstation', 'deleteWorkstation', 'startWorkstation', 'stopWorkstation', 'generateAccessToken']; + for (const methodName of workstationsStubMethods) { + const callPromise = this.workstationsStub.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.workstationsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'workstations.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 'workstations.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 the requested workstation cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the requested 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.workstations.v1.WorkstationCluster|WorkstationCluster}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.get_workstation_cluster.js + * region_tag:workstations_v1_generated_Workstations_GetWorkstationCluster_async + */ + getWorkstationCluster( + request?: protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstationCluster, + protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|undefined, {}|undefined + ]>; + getWorkstationCluster( + request: protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workstations.v1.IWorkstationCluster, + protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|null|undefined, + {}|null|undefined>): void; + getWorkstationCluster( + request: protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest, + callback: Callback< + protos.google.cloud.workstations.v1.IWorkstationCluster, + protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|null|undefined, + {}|null|undefined>): void; + getWorkstationCluster( + request?: protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workstations.v1.IWorkstationCluster, + protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workstations.v1.IWorkstationCluster, + protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstationCluster, + protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getWorkstationCluster(request, options, callback); + } +/** + * Returns the requested workstation configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the requested 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.workstations.v1.WorkstationConfig|WorkstationConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.get_workstation_config.js + * region_tag:workstations_v1_generated_Workstations_GetWorkstationConfig_async + */ + getWorkstationConfig( + request?: protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstationConfig, + protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|undefined, {}|undefined + ]>; + getWorkstationConfig( + request: protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workstations.v1.IWorkstationConfig, + protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|null|undefined, + {}|null|undefined>): void; + getWorkstationConfig( + request: protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest, + callback: Callback< + protos.google.cloud.workstations.v1.IWorkstationConfig, + protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|null|undefined, + {}|null|undefined>): void; + getWorkstationConfig( + request?: protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workstations.v1.IWorkstationConfig, + protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workstations.v1.IWorkstationConfig, + protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstationConfig, + protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getWorkstationConfig(request, options, callback); + } +/** + * Returns the requested workstation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the requested 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.workstations.v1.Workstation|Workstation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.get_workstation.js + * region_tag:workstations_v1_generated_Workstations_GetWorkstation_async + */ + getWorkstation( + request?: protos.google.cloud.workstations.v1.IGetWorkstationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstation, + protos.google.cloud.workstations.v1.IGetWorkstationRequest|undefined, {}|undefined + ]>; + getWorkstation( + request: protos.google.cloud.workstations.v1.IGetWorkstationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workstations.v1.IWorkstation, + protos.google.cloud.workstations.v1.IGetWorkstationRequest|null|undefined, + {}|null|undefined>): void; + getWorkstation( + request: protos.google.cloud.workstations.v1.IGetWorkstationRequest, + callback: Callback< + protos.google.cloud.workstations.v1.IWorkstation, + protos.google.cloud.workstations.v1.IGetWorkstationRequest|null|undefined, + {}|null|undefined>): void; + getWorkstation( + request?: protos.google.cloud.workstations.v1.IGetWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workstations.v1.IWorkstation, + protos.google.cloud.workstations.v1.IGetWorkstationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workstations.v1.IWorkstation, + protos.google.cloud.workstations.v1.IGetWorkstationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstation, + protos.google.cloud.workstations.v1.IGetWorkstationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getWorkstation(request, options, callback); + } +/** + * Returns a short-lived credential that can be used to send authenticated and + * authorized traffic to a workstation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.Timestamp} request.expireTime + * Desired expiration time of the access token. This value must + * be at most 24 hours in the future. If a value is not specified, the + * token's expiration time will be set to a default value of 1 hour in the + * future. + * @param {google.protobuf.Duration} request.ttl + * Desired lifetime duration of the access token. This value must + * be at most 24 hours. If a value is not specified, the token's lifetime + * will be set to a default value of 1 hour. + * @param {string} request.workstation + * Required. Name of the workstation for which the access token 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.workstations.v1.GenerateAccessTokenResponse|GenerateAccessTokenResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.generate_access_token.js + * region_tag:workstations_v1_generated_Workstations_GenerateAccessToken_async + */ + generateAccessToken( + request?: protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|undefined, {}|undefined + ]>; + generateAccessToken( + request: protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>): void; + generateAccessToken( + request: protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest, + callback: Callback< + protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>): void; + generateAccessToken( + request?: protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workstation': request.workstation ?? '', + }); + this.initialize(); + return this.innerApiCalls.generateAccessToken(request, options, callback); + } + +/** + * Creates a new workstation cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {string} request.workstationClusterId + * Required. ID to use for the workstation cluster. + * @param {google.cloud.workstations.v1.WorkstationCluster} request.workstationCluster + * Required. Workstation cluster to create. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.create_workstation_cluster.js + * region_tag:workstations_v1_generated_Workstations_CreateWorkstationCluster_async + */ + createWorkstationCluster( + request?: protos.google.cloud.workstations.v1.ICreateWorkstationClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createWorkstationCluster( + request: protos.google.cloud.workstations.v1.ICreateWorkstationClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstationCluster( + request: protos.google.cloud.workstations.v1.ICreateWorkstationClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstationCluster( + request?: protos.google.cloud.workstations.v1.ICreateWorkstationClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createWorkstationCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createWorkstationCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.create_workstation_cluster.js + * region_tag:workstations_v1_generated_Workstations_CreateWorkstationCluster_async + */ + async checkCreateWorkstationClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing workstation cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workstations.v1.WorkstationCluster} request.workstationCluster + * Required. Workstation cluster to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask that specifies which fields in the workstation cluster + * should be updated. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {boolean} request.allowMissing + * If set, and the workstation cluster is not found, a new workstation + * cluster will be created. In this situation, update_mask is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.update_workstation_cluster.js + * region_tag:workstations_v1_generated_Workstations_UpdateWorkstationCluster_async + */ + updateWorkstationCluster( + request?: protos.google.cloud.workstations.v1.IUpdateWorkstationClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateWorkstationCluster( + request: protos.google.cloud.workstations.v1.IUpdateWorkstationClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstationCluster( + request: protos.google.cloud.workstations.v1.IUpdateWorkstationClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstationCluster( + request?: protos.google.cloud.workstations.v1.IUpdateWorkstationClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workstation_cluster.name': request.workstationCluster!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateWorkstationCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateWorkstationCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.update_workstation_cluster.js + * region_tag:workstations_v1_generated_Workstations_UpdateWorkstationCluster_async + */ + async checkUpdateWorkstationClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the specified workstation cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workstation cluster to delete. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not apply it. + * @param {string} request.etag + * If set, the request will be rejected if the latest version of the + * workstation cluster on the server does not have this ETag. + * @param {boolean} request.force + * If set, any workstation configurations and workstations in the + * workstation cluster are also deleted. Otherwise, the request only + * works if the workstation cluster has no configurations or workstations. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.delete_workstation_cluster.js + * region_tag:workstations_v1_generated_Workstations_DeleteWorkstationCluster_async + */ + deleteWorkstationCluster( + request?: protos.google.cloud.workstations.v1.IDeleteWorkstationClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteWorkstationCluster( + request: protos.google.cloud.workstations.v1.IDeleteWorkstationClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstationCluster( + request: protos.google.cloud.workstations.v1.IDeleteWorkstationClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstationCluster( + request?: protos.google.cloud.workstations.v1.IDeleteWorkstationClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteWorkstationCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteWorkstationCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.delete_workstation_cluster.js + * region_tag:workstations_v1_generated_Workstations_DeleteWorkstationCluster_async + */ + async checkDeleteWorkstationClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new workstation configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {string} request.workstationConfigId + * Required. ID to use for the workstation configuration. + * @param {google.cloud.workstations.v1.WorkstationConfig} request.workstationConfig + * Required. Config to create. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.create_workstation_config.js + * region_tag:workstations_v1_generated_Workstations_CreateWorkstationConfig_async + */ + createWorkstationConfig( + request?: protos.google.cloud.workstations.v1.ICreateWorkstationConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createWorkstationConfig( + request: protos.google.cloud.workstations.v1.ICreateWorkstationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstationConfig( + request: protos.google.cloud.workstations.v1.ICreateWorkstationConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstationConfig( + request?: protos.google.cloud.workstations.v1.ICreateWorkstationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createWorkstationConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createWorkstationConfig()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.create_workstation_config.js + * region_tag:workstations_v1_generated_Workstations_CreateWorkstationConfig_async + */ + async checkCreateWorkstationConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing workstation configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workstations.v1.WorkstationConfig} request.workstationConfig + * Required. Config to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask specifying which fields in the workstation configuration + * should be updated. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {boolean} request.allowMissing + * If set and the workstation configuration is not found, a new + * workstation configuration will be created. In this situation, + * update_mask is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.update_workstation_config.js + * region_tag:workstations_v1_generated_Workstations_UpdateWorkstationConfig_async + */ + updateWorkstationConfig( + request?: protos.google.cloud.workstations.v1.IUpdateWorkstationConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateWorkstationConfig( + request: protos.google.cloud.workstations.v1.IUpdateWorkstationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstationConfig( + request: protos.google.cloud.workstations.v1.IUpdateWorkstationConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstationConfig( + request?: protos.google.cloud.workstations.v1.IUpdateWorkstationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workstation_config.name': request.workstationConfig!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateWorkstationConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateWorkstationConfig()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.update_workstation_config.js + * region_tag:workstations_v1_generated_Workstations_UpdateWorkstationConfig_async + */ + async checkUpdateWorkstationConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the specified workstation configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workstation configuration to delete. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {string} request.etag + * If set, the request is rejected if the latest version of the + * workstation configuration on the server does not have this ETag. + * @param {boolean} request.force + * If set, any workstations in the workstation configuration are also deleted. + * Otherwise, the request works only if the workstation configuration has + * no workstations. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.delete_workstation_config.js + * region_tag:workstations_v1_generated_Workstations_DeleteWorkstationConfig_async + */ + deleteWorkstationConfig( + request?: protos.google.cloud.workstations.v1.IDeleteWorkstationConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteWorkstationConfig( + request: protos.google.cloud.workstations.v1.IDeleteWorkstationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstationConfig( + request: protos.google.cloud.workstations.v1.IDeleteWorkstationConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstationConfig( + request?: protos.google.cloud.workstations.v1.IDeleteWorkstationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteWorkstationConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteWorkstationConfig()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.delete_workstation_config.js + * region_tag:workstations_v1_generated_Workstations_DeleteWorkstationConfig_async + */ + async checkDeleteWorkstationConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new workstation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {string} request.workstationId + * Required. ID to use for the workstation. + * @param {google.cloud.workstations.v1.Workstation} request.workstation + * Required. Workstation to create. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.create_workstation.js + * region_tag:workstations_v1_generated_Workstations_CreateWorkstation_async + */ + createWorkstation( + request?: protos.google.cloud.workstations.v1.ICreateWorkstationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createWorkstation( + request: protos.google.cloud.workstations.v1.ICreateWorkstationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstation( + request: protos.google.cloud.workstations.v1.ICreateWorkstationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstation( + request?: protos.google.cloud.workstations.v1.ICreateWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createWorkstation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createWorkstation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.create_workstation.js + * region_tag:workstations_v1_generated_Workstations_CreateWorkstation_async + */ + async checkCreateWorkstationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing workstation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workstations.v1.Workstation} request.workstation + * Required. Workstation to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask specifying which fields in the workstation configuration + * should be updated. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {boolean} request.allowMissing + * If set and the workstation configuration is not found, a new + * workstation configuration is created. In this situation, update_mask + * is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.update_workstation.js + * region_tag:workstations_v1_generated_Workstations_UpdateWorkstation_async + */ + updateWorkstation( + request?: protos.google.cloud.workstations.v1.IUpdateWorkstationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateWorkstation( + request: protos.google.cloud.workstations.v1.IUpdateWorkstationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstation( + request: protos.google.cloud.workstations.v1.IUpdateWorkstationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstation( + request?: protos.google.cloud.workstations.v1.IUpdateWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workstation.name': request.workstation!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateWorkstation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateWorkstation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.update_workstation.js + * region_tag:workstations_v1_generated_Workstations_UpdateWorkstation_async + */ + async checkUpdateWorkstationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the specified workstation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workstation to delete. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {string} request.etag + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.delete_workstation.js + * region_tag:workstations_v1_generated_Workstations_DeleteWorkstation_async + */ + deleteWorkstation( + request?: protos.google.cloud.workstations.v1.IDeleteWorkstationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteWorkstation( + request: protos.google.cloud.workstations.v1.IDeleteWorkstationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstation( + request: protos.google.cloud.workstations.v1.IDeleteWorkstationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstation( + request?: protos.google.cloud.workstations.v1.IDeleteWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteWorkstation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteWorkstation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.delete_workstation.js + * region_tag:workstations_v1_generated_Workstations_DeleteWorkstation_async + */ + async checkDeleteWorkstationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Starts running a workstation so that users can connect to it. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workstation to start. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {string} request.etag + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.start_workstation.js + * region_tag:workstations_v1_generated_Workstations_StartWorkstation_async + */ + startWorkstation( + request?: protos.google.cloud.workstations.v1.IStartWorkstationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + startWorkstation( + request: protos.google.cloud.workstations.v1.IStartWorkstationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startWorkstation( + request: protos.google.cloud.workstations.v1.IStartWorkstationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startWorkstation( + request?: protos.google.cloud.workstations.v1.IStartWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.startWorkstation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `startWorkstation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.start_workstation.js + * region_tag:workstations_v1_generated_Workstations_StartWorkstation_async + */ + async checkStartWorkstationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.startWorkstation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Stops running a workstation, reducing costs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workstation to stop. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {string} request.etag + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.stop_workstation.js + * region_tag:workstations_v1_generated_Workstations_StopWorkstation_async + */ + stopWorkstation( + request?: protos.google.cloud.workstations.v1.IStopWorkstationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + stopWorkstation( + request: protos.google.cloud.workstations.v1.IStopWorkstationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopWorkstation( + request: protos.google.cloud.workstations.v1.IStopWorkstationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopWorkstation( + request?: protos.google.cloud.workstations.v1.IStopWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.stopWorkstation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `stopWorkstation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workstations.stop_workstation.js + * region_tag:workstations_v1_generated_Workstations_StopWorkstation_async + */ + async checkStopWorkstationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.stopWorkstation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Returns all workstation clusters in the specified location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.WorkstationCluster|WorkstationCluster}. + * 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 `listWorkstationClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstationClusters( + request?: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstationCluster[], + protos.google.cloud.workstations.v1.IListWorkstationClustersRequest|null, + protos.google.cloud.workstations.v1.IListWorkstationClustersResponse + ]>; + listWorkstationClusters( + request: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, + protos.google.cloud.workstations.v1.IListWorkstationClustersResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationCluster>): void; + listWorkstationClusters( + request: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, + callback: PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, + protos.google.cloud.workstations.v1.IListWorkstationClustersResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationCluster>): void; + listWorkstationClusters( + request?: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, + protos.google.cloud.workstations.v1.IListWorkstationClustersResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationCluster>, + callback?: PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, + protos.google.cloud.workstations.v1.IListWorkstationClustersResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationCluster>): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstationCluster[], + protos.google.cloud.workstations.v1.IListWorkstationClustersRequest|null, + protos.google.cloud.workstations.v1.IListWorkstationClustersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listWorkstationClusters(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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.WorkstationCluster|WorkstationCluster} 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 `listWorkstationClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstationClustersStream( + request?: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, + 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['listWorkstationClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstationClusters.createStream( + this.innerApiCalls.listWorkstationClusters as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listWorkstationClusters`, 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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.WorkstationCluster|WorkstationCluster}. 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/workstations.list_workstation_clusters.js + * region_tag:workstations_v1_generated_Workstations_ListWorkstationClusters_async + */ + listWorkstationClustersAsync( + request?: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, + 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['listWorkstationClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstationClusters.asyncIterate( + this.innerApiCalls['listWorkstationClusters'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns all workstation configurations in the specified cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig}. + * 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 `listWorkstationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstationConfigs( + request?: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstationConfig[], + protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest|null, + protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse + ]>; + listWorkstationConfigs( + request: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, + protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationConfig>): void; + listWorkstationConfigs( + request: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, + protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationConfig>): void; + listWorkstationConfigs( + request?: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, + protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationConfig>, + callback?: PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, + protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationConfig>): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstationConfig[], + protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest|null, + protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listWorkstationConfigs(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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig} 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 `listWorkstationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstationConfigsStream( + request?: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, + 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['listWorkstationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstationConfigs.createStream( + this.innerApiCalls.listWorkstationConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listWorkstationConfigs`, 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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig}. 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/workstations.list_workstation_configs.js + * region_tag:workstations_v1_generated_Workstations_ListWorkstationConfigs_async + */ + listWorkstationConfigsAsync( + request?: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, + 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['listWorkstationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstationConfigs.asyncIterate( + this.innerApiCalls['listWorkstationConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns all workstation configurations in the specified cluster on which + * the caller has the "workstations.workstation.create" permission. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig}. + * 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 `listUsableWorkstationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableWorkstationConfigs( + request?: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstationConfig[], + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest|null, + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse + ]>; + listUsableWorkstationConfigs( + request: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationConfig>): void; + listUsableWorkstationConfigs( + request: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationConfig>): void; + listUsableWorkstationConfigs( + request?: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationConfig>, + callback?: PaginationCallback< + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstationConfig>): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstationConfig[], + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest|null, + protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listUsableWorkstationConfigs(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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig} 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 `listUsableWorkstationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableWorkstationConfigsStream( + request?: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, + 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['listUsableWorkstationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableWorkstationConfigs.createStream( + this.innerApiCalls.listUsableWorkstationConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listUsableWorkstationConfigs`, 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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig}. 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/workstations.list_usable_workstation_configs.js + * region_tag:workstations_v1_generated_Workstations_ListUsableWorkstationConfigs_async + */ + listUsableWorkstationConfigsAsync( + request?: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, + 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['listUsableWorkstationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableWorkstationConfigs.asyncIterate( + this.innerApiCalls['listUsableWorkstationConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns all Workstations using the specified workstation configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation}. + * 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 `listWorkstationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstations( + request?: protos.google.cloud.workstations.v1.IListWorkstationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstation[], + protos.google.cloud.workstations.v1.IListWorkstationsRequest|null, + protos.google.cloud.workstations.v1.IListWorkstationsResponse + ]>; + listWorkstations( + request: protos.google.cloud.workstations.v1.IListWorkstationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationsRequest, + protos.google.cloud.workstations.v1.IListWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstation>): void; + listWorkstations( + request: protos.google.cloud.workstations.v1.IListWorkstationsRequest, + callback: PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationsRequest, + protos.google.cloud.workstations.v1.IListWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstation>): void; + listWorkstations( + request?: protos.google.cloud.workstations.v1.IListWorkstationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationsRequest, + protos.google.cloud.workstations.v1.IListWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstation>, + callback?: PaginationCallback< + protos.google.cloud.workstations.v1.IListWorkstationsRequest, + protos.google.cloud.workstations.v1.IListWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstation>): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstation[], + protos.google.cloud.workstations.v1.IListWorkstationsRequest|null, + protos.google.cloud.workstations.v1.IListWorkstationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listWorkstations(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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation} 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 `listWorkstationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstationsStream( + request?: protos.google.cloud.workstations.v1.IListWorkstationsRequest, + 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['listWorkstations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstations.createStream( + this.innerApiCalls.listWorkstations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listWorkstations`, 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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation}. 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/workstations.list_workstations.js + * region_tag:workstations_v1_generated_Workstations_ListWorkstations_async + */ + listWorkstationsAsync( + request?: protos.google.cloud.workstations.v1.IListWorkstationsRequest, + 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['listWorkstations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstations.asyncIterate( + this.innerApiCalls['listWorkstations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns all workstations using the specified workstation configuration + * on which the caller has the "workstations.workstations.use" permission. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation}. + * 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 `listUsableWorkstationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableWorkstations( + request?: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstation[], + protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest|null, + protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse + ]>; + listUsableWorkstations( + request: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, + protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstation>): void; + listUsableWorkstations( + request: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, + callback: PaginationCallback< + protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, + protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstation>): void; + listUsableWorkstations( + request?: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, + protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstation>, + callback?: PaginationCallback< + protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, + protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1.IWorkstation>): + Promise<[ + protos.google.cloud.workstations.v1.IWorkstation[], + protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest|null, + protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listUsableWorkstations(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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation} 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 `listUsableWorkstationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableWorkstationsStream( + request?: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, + 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['listUsableWorkstations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableWorkstations.createStream( + this.innerApiCalls.listUsableWorkstations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listUsableWorkstations`, 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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation}. 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/workstations.list_usable_workstations.js + * region_tag:workstations_v1_generated_Workstations_ListUsableWorkstations_async + */ + listUsableWorkstationsAsync( + request?: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, + 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['listUsableWorkstations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableWorkstations.asyncIterate( + this.innerApiCalls['listUsableWorkstations'] 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 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 workstation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workstation_cluster + * @param {string} workstation_config + * @param {string} workstation + * @returns {string} Resource name string. + */ + workstationPath(project:string,location:string,workstationCluster:string,workstationConfig:string,workstation:string) { + return this.pathTemplates.workstationPathTemplate.render({ + project: project, + location: location, + workstation_cluster: workstationCluster, + workstation_config: workstationConfig, + workstation: workstation, + }); + } + + /** + * Parse the project from Workstation resource. + * + * @param {string} workstationName + * A fully-qualified path representing Workstation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkstationName(workstationName: string) { + return this.pathTemplates.workstationPathTemplate.match(workstationName).project; + } + + /** + * Parse the location from Workstation resource. + * + * @param {string} workstationName + * A fully-qualified path representing Workstation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkstationName(workstationName: string) { + return this.pathTemplates.workstationPathTemplate.match(workstationName).location; + } + + /** + * Parse the workstation_cluster from Workstation resource. + * + * @param {string} workstationName + * A fully-qualified path representing Workstation resource. + * @returns {string} A string representing the workstation_cluster. + */ + matchWorkstationClusterFromWorkstationName(workstationName: string) { + return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation_cluster; + } + + /** + * Parse the workstation_config from Workstation resource. + * + * @param {string} workstationName + * A fully-qualified path representing Workstation resource. + * @returns {string} A string representing the workstation_config. + */ + matchWorkstationConfigFromWorkstationName(workstationName: string) { + return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation_config; + } + + /** + * Parse the workstation from Workstation resource. + * + * @param {string} workstationName + * A fully-qualified path representing Workstation resource. + * @returns {string} A string representing the workstation. + */ + matchWorkstationFromWorkstationName(workstationName: string) { + return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation; + } + + /** + * Return a fully-qualified workstationCluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workstation_cluster + * @returns {string} Resource name string. + */ + workstationClusterPath(project:string,location:string,workstationCluster:string) { + return this.pathTemplates.workstationClusterPathTemplate.render({ + project: project, + location: location, + workstation_cluster: workstationCluster, + }); + } + + /** + * Parse the project from WorkstationCluster resource. + * + * @param {string} workstationClusterName + * A fully-qualified path representing WorkstationCluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkstationClusterName(workstationClusterName: string) { + return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).project; + } + + /** + * Parse the location from WorkstationCluster resource. + * + * @param {string} workstationClusterName + * A fully-qualified path representing WorkstationCluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkstationClusterName(workstationClusterName: string) { + return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).location; + } + + /** + * Parse the workstation_cluster from WorkstationCluster resource. + * + * @param {string} workstationClusterName + * A fully-qualified path representing WorkstationCluster resource. + * @returns {string} A string representing the workstation_cluster. + */ + matchWorkstationClusterFromWorkstationClusterName(workstationClusterName: string) { + return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).workstation_cluster; + } + + /** + * Return a fully-qualified workstationConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workstation_cluster + * @param {string} workstation_config + * @returns {string} Resource name string. + */ + workstationConfigPath(project:string,location:string,workstationCluster:string,workstationConfig:string) { + return this.pathTemplates.workstationConfigPathTemplate.render({ + project: project, + location: location, + workstation_cluster: workstationCluster, + workstation_config: workstationConfig, + }); + } + + /** + * Parse the project from WorkstationConfig resource. + * + * @param {string} workstationConfigName + * A fully-qualified path representing WorkstationConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkstationConfigName(workstationConfigName: string) { + return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).project; + } + + /** + * Parse the location from WorkstationConfig resource. + * + * @param {string} workstationConfigName + * A fully-qualified path representing WorkstationConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkstationConfigName(workstationConfigName: string) { + return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).location; + } + + /** + * Parse the workstation_cluster from WorkstationConfig resource. + * + * @param {string} workstationConfigName + * A fully-qualified path representing WorkstationConfig resource. + * @returns {string} A string representing the workstation_cluster. + */ + matchWorkstationClusterFromWorkstationConfigName(workstationConfigName: string) { + return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).workstation_cluster; + } + + /** + * Parse the workstation_config from WorkstationConfig resource. + * + * @param {string} workstationConfigName + * A fully-qualified path representing WorkstationConfig resource. + * @returns {string} A string representing the workstation_config. + */ + matchWorkstationConfigFromWorkstationConfigName(workstationConfigName: string) { + return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).workstation_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.workstationsStub && !this._terminated) { + return this.workstationsStub.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-workstations/v1/src/v1/workstations_client_config.json b/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client_config.json new file mode 100644 index 00000000000..eadd39f3056 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client_config.json @@ -0,0 +1,138 @@ +{ + "interfaces": { + "google.cloud.workstations.v1.Workstations": { + "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": { + "GetWorkstationCluster": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListWorkstationClusters": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateWorkstationCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkstationCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteWorkstationCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetWorkstationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListWorkstationConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListUsableWorkstationConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateWorkstationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkstationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteWorkstationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListWorkstations": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListUsableWorkstations": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StopWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateAccessToken": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_proto_list.json b/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_proto_list.json new file mode 100644 index 00000000000..e55bee79a1c --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/workstations/v1/workstations.proto" +] diff --git a/owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..baefb289660 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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 workstations = require('@google-cloud/workstations'); + +function main() { + const workstationsClient = new workstations.WorkstationsClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..74cd8e0b246 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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 {WorkstationsClient} from '@google-cloud/workstations'; + +// check that the client class type name can be used +function doStuffWithWorkstationsClient(client: WorkstationsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const workstationsClient = new WorkstationsClient(); + doStuffWithWorkstationsClient(workstationsClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workstations/v1/system-test/install.ts b/owl-bot-staging/google-cloud-workstations/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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-workstations/v1/test/gapic_workstations_v1.ts b/owl-bot-staging/google-cloud-workstations/v1/test/gapic_workstations_v1.ts new file mode 100644 index 00000000000..e76362ab871 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1/test/gapic_workstations_v1.ts @@ -0,0 +1,4506 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 workstationsModule 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.WorkstationsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = workstationsModule.v1.WorkstationsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = workstationsModule.v1.WorkstationsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = workstationsModule.v1.WorkstationsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new workstationsModule.v1.WorkstationsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new workstationsModule.v1.WorkstationsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workstationsStub, undefined); + await client.initialize(); + assert(client.workstationsStub); + }); + + it('has close method for the initialized client', done => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.workstationsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workstationsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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('getWorkstationCluster', () => { + it('invokes getWorkstationCluster without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1.WorkstationCluster() + ); + client.innerApiCalls.getWorkstationCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkstationCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationCluster without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1.WorkstationCluster() + ); + client.innerApiCalls.getWorkstationCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkstationCluster( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstationCluster|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationCluster with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkstationCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkstationCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationCluster with closed client', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkstationCluster(request), expectedError); + }); + }); + + describe('getWorkstationConfig', () => { + it('invokes getWorkstationConfig without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1.WorkstationConfig() + ); + client.innerApiCalls.getWorkstationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkstationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationConfig without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1.WorkstationConfig() + ); + client.innerApiCalls.getWorkstationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkstationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationConfig with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkstationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkstationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationConfig with closed client', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkstationConfig(request), expectedError); + }); + }); + + describe('getWorkstation', () => { + it('invokes getWorkstation without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1.Workstation() + ); + client.innerApiCalls.getWorkstation = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkstation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstation without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1.Workstation() + ); + client.innerApiCalls.getWorkstation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkstation( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstation with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkstation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstation with closed client', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GetWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkstation(request), expectedError); + }); + }); + + describe('generateAccessToken', () => { + it('invokes generateAccessToken without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GenerateAccessTokenRequest', ['workstation']); + request.workstation = defaultValue1; + const expectedHeaderRequestParams = `workstation=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1.GenerateAccessTokenResponse() + ); + client.innerApiCalls.generateAccessToken = stubSimpleCall(expectedResponse); + const [response] = await client.generateAccessToken(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAccessToken without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GenerateAccessTokenRequest', ['workstation']); + request.workstation = defaultValue1; + const expectedHeaderRequestParams = `workstation=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1.GenerateAccessTokenResponse() + ); + client.innerApiCalls.generateAccessToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateAccessToken( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAccessToken with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GenerateAccessTokenRequest', ['workstation']); + request.workstation = defaultValue1; + const expectedHeaderRequestParams = `workstation=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateAccessToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateAccessToken(request), expectedError); + const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAccessToken with closed client', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.GenerateAccessTokenRequest', ['workstation']); + request.workstation = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateAccessToken(request), expectedError); + }); + }); + + describe('createWorkstationCluster', () => { + it('invokes createWorkstationCluster without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkstationCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationCluster without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkstationCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationCluster with call error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkstationCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationCluster with LRO error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkstationCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateWorkstationClusterProgress without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkstationClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkstationClusterProgress with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkstationClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateWorkstationCluster', () => { + it('invokes updateWorkstationCluster without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationClusterRequest() + ); + request.workstationCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); + request.workstationCluster.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkstationCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationCluster without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationClusterRequest() + ); + request.workstationCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); + request.workstationCluster.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkstationCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationCluster with call error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationClusterRequest() + ); + request.workstationCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); + request.workstationCluster.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkstationCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationCluster with LRO error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationClusterRequest() + ); + request.workstationCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); + request.workstationCluster.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkstationCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateWorkstationClusterProgress without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkstationClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkstationClusterProgress with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkstationClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteWorkstationCluster', () => { + it('invokes deleteWorkstationCluster without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkstationCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationCluster without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkstationCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationCluster with call error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkstationCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationCluster with LRO error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkstationCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteWorkstationClusterProgress without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkstationClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkstationClusterProgress with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkstationClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createWorkstationConfig', () => { + it('invokes createWorkstationConfig without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkstationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationConfig without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkstationConfig( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationConfig with call error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkstationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationConfig with LRO error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkstationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateWorkstationConfigProgress without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkstationConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkstationConfigProgress with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkstationConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateWorkstationConfig', () => { + it('invokes updateWorkstationConfig without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationConfigRequest() + ); + request.workstationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); + request.workstationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkstationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationConfig without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationConfigRequest() + ); + request.workstationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); + request.workstationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkstationConfig( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationConfig with call error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationConfigRequest() + ); + request.workstationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); + request.workstationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkstationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationConfig with LRO error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationConfigRequest() + ); + request.workstationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); + request.workstationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkstationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateWorkstationConfigProgress without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkstationConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkstationConfigProgress with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkstationConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteWorkstationConfig', () => { + it('invokes deleteWorkstationConfig without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkstationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationConfig without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkstationConfig( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationConfig with call error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkstationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationConfig with LRO error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkstationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteWorkstationConfigProgress without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkstationConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkstationConfigProgress with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkstationConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createWorkstation', () => { + it('invokes createWorkstation without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstation = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkstation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstation without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkstation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstation with call error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstation with LRO error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.CreateWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkstation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateWorkstationProgress without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkstationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkstationProgress with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkstationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateWorkstation', () => { + it('invokes updateWorkstation without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationRequest() + ); + request.workstation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationRequest', ['workstation', 'name']); + request.workstation.name = defaultValue1; + const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstation = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkstation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstation without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationRequest() + ); + request.workstation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationRequest', ['workstation', 'name']); + request.workstation.name = defaultValue1; + const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkstation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstation with call error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationRequest() + ); + request.workstation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationRequest', ['workstation', 'name']); + request.workstation.name = defaultValue1; + const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstation with LRO error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.UpdateWorkstationRequest() + ); + request.workstation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationRequest', ['workstation', 'name']); + request.workstation.name = defaultValue1; + const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkstation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateWorkstationProgress without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkstationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkstationProgress with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkstationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteWorkstation', () => { + it('invokes deleteWorkstation without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstation = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkstation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstation without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkstation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstation with call error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstation with LRO error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.DeleteWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkstation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteWorkstationProgress without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkstationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkstationProgress with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkstationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('startWorkstation', () => { + it('invokes startWorkstation without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.StartWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.StartWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startWorkstation = stubLongRunningCall(expectedResponse); + const [operation] = await client.startWorkstation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startWorkstation without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.StartWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.StartWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startWorkstation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startWorkstation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startWorkstation with call error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.StartWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.StartWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startWorkstation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.startWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startWorkstation with LRO error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.StartWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.StartWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startWorkstation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.startWorkstation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStartWorkstationProgress without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkStartWorkstationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStartWorkstationProgress with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkStartWorkstationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('stopWorkstation', () => { + it('invokes stopWorkstation without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.StopWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.StopWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopWorkstation = stubLongRunningCall(expectedResponse); + const [operation] = await client.stopWorkstation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopWorkstation without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.StopWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.StopWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopWorkstation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopWorkstation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopWorkstation with call error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.StopWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.StopWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopWorkstation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.stopWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopWorkstation with LRO error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.StopWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.StopWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopWorkstation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.stopWorkstation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStopWorkstationProgress without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkStopWorkstationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStopWorkstationProgress with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkStopWorkstationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listWorkstationClusters', () => { + it('invokes listWorkstationClusters without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + ]; + client.innerApiCalls.listWorkstationClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkstationClusters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationClusters without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + ]; + client.innerApiCalls.listWorkstationClusters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkstationClusters( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstationCluster[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationClusters with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkstationClusters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkstationClusters(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationClustersStream without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + ]; + client.descriptors.page.listWorkstationClusters.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkstationClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1.WorkstationCluster[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationCluster) => { + 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.listWorkstationClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstationClusters, request)); + assert( + (client.descriptors.page.listWorkstationClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkstationClustersStream with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstationClusters.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkstationClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1.WorkstationCluster[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationCluster) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkstationClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstationClusters, request)); + assert( + (client.descriptors.page.listWorkstationClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstationClusters without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), + ]; + client.descriptors.page.listWorkstationClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workstations.v1.IWorkstationCluster[] = []; + const iterable = client.listWorkstationClustersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstationClusters with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstationClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkstationClustersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workstations.v1.IWorkstationCluster[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listWorkstationConfigs', () => { + it('invokes listWorkstationConfigs without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + ]; + client.innerApiCalls.listWorkstationConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkstationConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationConfigs without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + ]; + client.innerApiCalls.listWorkstationConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkstationConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstationConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationConfigs with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkstationConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkstationConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationConfigsStream without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + ]; + client.descriptors.page.listWorkstationConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkstationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1.WorkstationConfig[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationConfig) => { + 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.listWorkstationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstationConfigs, request)); + assert( + (client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkstationConfigsStream with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkstationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1.WorkstationConfig[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstationConfigs, request)); + assert( + (client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstationConfigs without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + ]; + client.descriptors.page.listWorkstationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workstations.v1.IWorkstationConfig[] = []; + const iterable = client.listWorkstationConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstationConfigs with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkstationConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workstations.v1.IWorkstationConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listUsableWorkstationConfigs', () => { + it('invokes listUsableWorkstationConfigs without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + ]; + client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listUsableWorkstationConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstationConfigs without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + ]; + client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUsableWorkstationConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstationConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstationConfigs with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listUsableWorkstationConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstationConfigsStream without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + ]; + client.descriptors.page.listUsableWorkstationConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listUsableWorkstationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1.WorkstationConfig[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationConfig) => { + 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.listUsableWorkstationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstationConfigs, request)); + assert( + (client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listUsableWorkstationConfigsStream with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableWorkstationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listUsableWorkstationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1.WorkstationConfig[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstationConfigs, request)); + assert( + (client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableWorkstationConfigs without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), + ]; + client.descriptors.page.listUsableWorkstationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workstations.v1.IWorkstationConfig[] = []; + const iterable = client.listUsableWorkstationConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableWorkstationConfigs with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableWorkstationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUsableWorkstationConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workstations.v1.IWorkstationConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listWorkstations', () => { + it('invokes listWorkstations without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + ]; + client.innerApiCalls.listWorkstations = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkstations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstations without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + ]; + client.innerApiCalls.listWorkstations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkstations( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstations with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkstations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkstations(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationsStream without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + ]; + client.descriptors.page.listWorkstations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkstationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1.Workstation[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1.Workstation) => { + 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.listWorkstations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstations, request)); + assert( + (client.descriptors.page.listWorkstations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkstationsStream with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkstationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1.Workstation[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1.Workstation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkstations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstations, request)); + assert( + (client.descriptors.page.listWorkstations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstations without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + ]; + client.descriptors.page.listWorkstations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workstations.v1.IWorkstation[] = []; + const iterable = client.listWorkstationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstations with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkstationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workstations.v1.IWorkstation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listUsableWorkstations', () => { + it('invokes listUsableWorkstations without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + ]; + client.innerApiCalls.listUsableWorkstations = stubSimpleCall(expectedResponse); + const [response] = await client.listUsableWorkstations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstations without error using callback', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + ]; + client.innerApiCalls.listUsableWorkstations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUsableWorkstations( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstations with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listUsableWorkstations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listUsableWorkstations(request), expectedError); + const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstationsStream without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + ]; + client.descriptors.page.listUsableWorkstations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listUsableWorkstationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1.Workstation[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1.Workstation) => { + 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.listUsableWorkstations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstations, request)); + assert( + (client.descriptors.page.listUsableWorkstations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listUsableWorkstationsStream with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableWorkstations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listUsableWorkstationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1.Workstation[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1.Workstation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listUsableWorkstations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstations, request)); + assert( + (client.descriptors.page.listUsableWorkstations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableWorkstations without error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), + ]; + client.descriptors.page.listUsableWorkstations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workstations.v1.IWorkstation[] = []; + const iterable = client.listUsableWorkstationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableWorkstations with error', async () => { + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableWorkstations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUsableWorkstationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workstations.v1.IWorkstation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableWorkstations.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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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 workstationsModule.v1.WorkstationsClient({ + 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('workstation', () => { + const fakePath = "/rendered/path/workstation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workstation_cluster: "workstationClusterValue", + workstation_config: "workstationConfigValue", + workstation: "workstationValue", + }; + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workstationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workstationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workstationPath', () => { + const result = client.workstationPath("projectValue", "locationValue", "workstationClusterValue", "workstationConfigValue", "workstationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workstationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkstationName', () => { + const result = client.matchProjectFromWorkstationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkstationName', () => { + const result = client.matchLocationFromWorkstationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationClusterFromWorkstationName', () => { + const result = client.matchWorkstationClusterFromWorkstationName(fakePath); + assert.strictEqual(result, "workstationClusterValue"); + assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationConfigFromWorkstationName', () => { + const result = client.matchWorkstationConfigFromWorkstationName(fakePath); + assert.strictEqual(result, "workstationConfigValue"); + assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationFromWorkstationName', () => { + const result = client.matchWorkstationFromWorkstationName(fakePath); + assert.strictEqual(result, "workstationValue"); + assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workstationCluster', () => { + const fakePath = "/rendered/path/workstationCluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workstation_cluster: "workstationClusterValue", + }; + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workstationClusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workstationClusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workstationClusterPath', () => { + const result = client.workstationClusterPath("projectValue", "locationValue", "workstationClusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workstationClusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkstationClusterName', () => { + const result = client.matchProjectFromWorkstationClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkstationClusterName', () => { + const result = client.matchLocationFromWorkstationClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationClusterFromWorkstationClusterName', () => { + const result = client.matchWorkstationClusterFromWorkstationClusterName(fakePath); + assert.strictEqual(result, "workstationClusterValue"); + assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workstationConfig', () => { + const fakePath = "/rendered/path/workstationConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workstation_cluster: "workstationClusterValue", + workstation_config: "workstationConfigValue", + }; + const client = new workstationsModule.v1.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workstationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workstationConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workstationConfigPath', () => { + const result = client.workstationConfigPath("projectValue", "locationValue", "workstationClusterValue", "workstationConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workstationConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkstationConfigName', () => { + const result = client.matchProjectFromWorkstationConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkstationConfigName', () => { + const result = client.matchLocationFromWorkstationConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationClusterFromWorkstationConfigName', () => { + const result = client.matchWorkstationClusterFromWorkstationConfigName(fakePath); + assert.strictEqual(result, "workstationClusterValue"); + assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationConfigFromWorkstationConfigName', () => { + const result = client.matchWorkstationConfigFromWorkstationConfigName(fakePath); + assert.strictEqual(result, "workstationConfigValue"); + assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-workstations/v1/tsconfig.json b/owl-bot-staging/google-cloud-workstations/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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-workstations/v1/webpack.config.js b/owl-bot-staging/google-cloud-workstations/v1/webpack.config.js new file mode 100644 index 00000000000..46aed65f9a2 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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: 'Workstations', + filename: './workstations.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-workstations/v1beta/.eslintignore b/owl-bot-staging/google-cloud-workstations/v1beta/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-workstations/v1beta/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/.gitignore b/owl-bot-staging/google-cloud-workstations/v1beta/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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-workstations/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-workstations/v1beta/.jsdoc.js new file mode 100644 index 00000000000..6398f035d9b --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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/workstations', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-workstations/v1beta/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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-workstations/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-workstations/v1beta/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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-workstations/v1beta/README.md b/owl-bot-staging/google-cloud-workstations/v1beta/README.md new file mode 100644 index 00000000000..8ef3807738a --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/README.md @@ -0,0 +1 @@ +Workstations: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/package.json b/owl-bot-staging/google-cloud-workstations/v1beta/package.json new file mode 100644 index 00000000000..94fc6760f48 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/workstations", + "version": "0.1.0", + "description": "Workstations client for Node.js", + "repository": "googleapis/nodejs-workstations", + "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 workstations", + "workstations", + "workstations" + ], + "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-workstations/v1beta/protos/google/cloud/workstations/v1beta/workstations.proto b/owl-bot-staging/google-cloud-workstations/v1beta/protos/google/cloud/workstations/v1beta/workstations.proto new file mode 100644 index 00000000000..98951e8be83 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/protos/google/cloud/workstations/v1beta/workstations.proto @@ -0,0 +1,1217 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.workstations.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/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option go_package = "cloud.google.com/go/workstations/apiv1beta/workstationspb;workstationspb"; +option java_multiple_files = true; +option java_outer_classname = "WorkstationsProto"; +option java_package = "com.google.cloud.workstations.v1beta"; + +// Service for interacting with Cloud Workstations. +service Workstations { + option (google.api.default_host) = "workstations.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Returns the requested workstation cluster. + rpc GetWorkstationCluster(GetWorkstationClusterRequest) + returns (WorkstationCluster) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/workstationClusters/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns all workstation clusters in the specified location. + rpc ListWorkstationClusters(ListWorkstationClustersRequest) + returns (ListWorkstationClustersResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*}/workstationClusters" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new workstation cluster. + rpc CreateWorkstationCluster(CreateWorkstationClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*}/workstationClusters" + body: "workstation_cluster" + }; + option (google.api.method_signature) = + "parent,workstation_cluster,workstation_cluster_id"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationCluster" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing workstation cluster. + rpc UpdateWorkstationCluster(UpdateWorkstationClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta/{workstation_cluster.name=projects/*/locations/*/workstationClusters/*}" + body: "workstation_cluster" + }; + option (google.api.method_signature) = "workstation_cluster,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationCluster" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the specified workstation cluster. + rpc DeleteWorkstationCluster(DeleteWorkstationClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/locations/*/workstationClusters/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationCluster" + metadata_type: "OperationMetadata" + }; + } + + // Returns the requested workstation configuration. + rpc GetWorkstationConfig(GetWorkstationConfigRequest) + returns (WorkstationConfig) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns all workstation configurations in the specified cluster. + rpc ListWorkstationConfigs(ListWorkstationConfigsRequest) + returns (ListWorkstationConfigsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns all workstation configurations in the specified cluster on which + // the caller has the "workstations.workstation.create" permission. + rpc ListUsableWorkstationConfigs(ListUsableWorkstationConfigsRequest) + returns (ListUsableWorkstationConfigsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs:listUsable" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new workstation configuration. + rpc CreateWorkstationConfig(CreateWorkstationConfigRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs" + body: "workstation_config" + }; + option (google.api.method_signature) = + "parent,workstation_config,workstation_config_id"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationConfig" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing workstation configuration. + rpc UpdateWorkstationConfig(UpdateWorkstationConfigRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta/{workstation_config.name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" + body: "workstation_config" + }; + option (google.api.method_signature) = "workstation_config,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationConfig" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the specified workstation configuration. + rpc DeleteWorkstationConfig(DeleteWorkstationConfigRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "WorkstationConfig" + metadata_type: "OperationMetadata" + }; + } + + // Returns the requested workstation. + rpc GetWorkstation(GetWorkstationRequest) returns (Workstation) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns all Workstations using the specified workstation configuration. + rpc ListWorkstations(ListWorkstationsRequest) + returns (ListWorkstationsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns all workstations using the specified workstation configuration + // on which the caller has the "workstations.workstations.use" permission. + rpc ListUsableWorkstations(ListUsableWorkstationsRequest) + returns (ListUsableWorkstationsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations:listUsable" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new workstation. + rpc CreateWorkstation(CreateWorkstationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations" + body: "workstation" + }; + option (google.api.method_signature) = "parent,workstation,workstation_id"; + option (google.longrunning.operation_info) = { + response_type: "Workstation" + metadata_type: "OperationMetadata" + }; + } + + // Updates an existing workstation. + rpc UpdateWorkstation(UpdateWorkstationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta/{workstation.name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" + body: "workstation" + }; + option (google.api.method_signature) = "workstation,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Workstation" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the specified workstation. + rpc DeleteWorkstation(DeleteWorkstationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Workstation" + metadata_type: "OperationMetadata" + }; + } + + // Starts running a workstation so that users can connect to it. + rpc StartWorkstation(StartWorkstationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:start" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Workstation" + metadata_type: "OperationMetadata" + }; + } + + // Stops running a workstation, reducing costs. + rpc StopWorkstation(StopWorkstationRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:stop" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Workstation" + metadata_type: "OperationMetadata" + }; + } + + // Returns a short-lived credential that can be used to send authenticated and + // authorized traffic to a workstation. + rpc GenerateAccessToken(GenerateAccessTokenRequest) + returns (GenerateAccessTokenResponse) { + option (google.api.http) = { + post: "/v1beta/{workstation=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:generateAccessToken" + body: "*" + }; + option (google.api.method_signature) = "workstation"; + } +} + +// A grouping of workstation configurations and the associated workstations +// in that region. +message WorkstationCluster { + option (google.api.resource) = { + type: "workstations.googleapis.com/WorkstationCluster" + pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}" + style: DECLARATIVE_FRIENDLY + }; + + // Configuration options for private clusters. + message PrivateClusterConfig { + // Immutable. Whether Workstations endpoint is private. + bool enable_private_endpoint = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. Hostname for the workstation cluster. This field will be + // populated only when private endpoint is enabled. To access workstations + // in the cluster, create a new DNS zone mapping this domain name to an + // internal IP address and a forwarding rule mapping that address to the + // service attachment. + string cluster_hostname = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Service attachment URI for the workstation cluster. The + // service attachemnt is created when private endpoint is enabled. To access + // workstations in the cluster, configure access to the managed service + // using [Private Service + // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-services). + string service_attachment_uri = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Additional projects that are allowed to attach to the workstation + // cluster's service attachment. By default, the workstation cluster's + // project and the VPC host project (if different) are allowed. + repeated string allowed_projects = 4; + } + + // Full name of this resource. + string name = 1; + + // Human-readable name for this resource. + string display_name = 2; + + // Output only. A system-assigned unique identified for this resource. + string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates whether this resource is currently being updated to + // match its intended state. + bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Client-specified annotations. + map annotations = 5; + + // Client-specified labels that are applied to the resource and that are also + // propagated to the underlying Compute Engine resources. + map labels = 15; + + // Output only. Time when this resource was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was most recently updated. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was soft-deleted. + google.protobuf.Timestamp delete_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Checksum computed by the server. May be sent on update and delete requests + // to make sure that the client has an up-to-date value before proceeding. + string etag = 9; + + // Immutable. Name of the Compute Engine network in which instances associated + // with this cluster will be created. + string network = 10 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Name of the Compute Engine subnetwork in which instances + // associated with this cluster will be created. Must be part of the + // subnetwork specified for this cluster. + string subnetwork = 11 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The private IP address of the control plane for this cluster. + // Workstation VMs need access to this IP address to work with the service, so + // make sure that your firewall rules allow egress from the workstation VMs to + // this address. + string control_plane_ip = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Configuration for private cluster. + PrivateClusterConfig private_cluster_config = 12; + + // Output only. Whether this resource is in degraded mode, in which case it + // may require user action to restore full functionality. Details can be found + // in the `conditions` field. + bool degraded = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Status conditions describing the current resource state. + repeated google.rpc.Status conditions = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A set of configuration options describing how a workstation will be run. +// Workstation configurations are intended to be shared across multiple +// workstations. +message WorkstationConfig { + option (google.api.resource) = { + type: "workstations.googleapis.com/WorkstationConfig" + pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}" + style: DECLARATIVE_FRIENDLY + }; + + // Runtime host for a workstation. + message Host { + // A runtime using a Compute Engine instance. + message GceInstance { + // A set of Compute Engine Shielded instance options. + message GceShieldedInstanceConfig { + // Whether the instance has Secure Boot enabled. + bool enable_secure_boot = 1; + + // Whether the instance has the vTPM enabled. + bool enable_vtpm = 2; + + // Whether the instance has integrity monitoring enabled. + bool enable_integrity_monitoring = 3; + } + + // A set of Compute Engine Confidential VM instance options. + message GceConfidentialInstanceConfig { + // Whether the instance has confidential compute enabled. + bool enable_confidential_compute = 1; + } + + // An accelerator card attached to the instance. + message Accelerator { + // Type of accelerator resource to attach to the instance, for example, + // "nvidia-tesla-p100". + string type = 1; + + // Number of accelerator cards exposed to the instance. + int32 count = 2; + } + + // The name of a Compute Engine machine type. + string machine_type = 1; + + // Email address of the service account used on VM instances + // used to support this configuration. If not set, VMs run with a + // Google-managed service account. This service account must have + // permission to pull the specified container image; otherwise, the image + // must be publicly accessible. + string service_account = 2; + + // Network tags to add to the Compute Engine machines backing the + // Workstations. + repeated string tags = 4; + + // Number of instances to pool for faster workstation startup. + int32 pool_size = 5; + + // Output only. Number of instances currently available in the pool for + // faster workstation startup. + int32 pooled_instances = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Whether instances have no public IP address. + bool disable_public_ip_addresses = 6; + + // A set of Compute Engine Shielded instance options. + GceShieldedInstanceConfig shielded_instance_config = 8; + + // A set of Compute Engine Confidential VM instance options. + GceConfidentialInstanceConfig confidential_instance_config = 10; + + // Size of the boot disk in GB. Defaults to 50. + int32 boot_disk_size_gb = 9; + + // A list of the type and count of accelerator cards attached to the + // instance. + repeated Accelerator accelerators = 11; + } + + // Type of host that will be used for the workstation's runtime. + oneof config { + // Specifies a Compute Engine instance as the host. + GceInstance gce_instance = 1; + } + } + + // A directory to persist across workstation sessions. + message PersistentDirectory { + // A PersistentDirectory backed by a Compute Engine regional persistent + // disk. + message GceRegionalPersistentDisk { + // Value representing what should happen to the disk after the workstation + // is deleted. + enum ReclaimPolicy { + // Do not use. + RECLAIM_POLICY_UNSPECIFIED = 0; + + // The persistent disk will be deleted with the workstation. + DELETE = 1; + + // The persistent disk will be remain after the workstation is deleted, + // and the administrator must manually delete the disk. + RETAIN = 2; + } + + // Size of the disk in GB. Must be empty if source_snapshot is set. + // Defaults to 200. + int32 size_gb = 1; + + // Type of file system that the disk should be formatted with. The + // workstation image must support this file system type. Must be empty + // if source_snapshot is set. Defaults to ext4. + string fs_type = 2; + + // Type of the disk to use. Defaults to pd-standard. + string disk_type = 3; + + // Name of the snapshot to use as the source for the disk. If set, + // size_gb and fs_type must be empty. + string source_snapshot = 5; + + // What should happen to the disk after the workstation is deleted. + // Defaults to DELETE. + ReclaimPolicy reclaim_policy = 4; + } + + // Location of this directory in the running workstation. + string mount_path = 1; + + // How a persistent directory should be implemented. + oneof directory_type { + // A PersistentDirectory backed by a Compute Engine persistent disk. + GceRegionalPersistentDisk gce_pd = 2; + } + } + + // A Docker container. + message Container { + // Docker image defining the container. This image must be accessible by the + // service account specified in the workstation configuration. + string image = 1; + + // If set, overrides the default ENTRYPOINT specified by the image. + repeated string command = 2; + + // Arguments passed to the entrypoint. + repeated string args = 3; + + // Environment variables passed to the container's entrypoint. + map env = 4; + + // If set, overrides the default DIR specified by the image. + string working_dir = 5; + + // If set, overrides the USER specified in the image with the given uid. + int32 run_as_user = 6; + } + + // A customer-managed encryption key for the Compute Engine resources + // of this workstation configuration. + message CustomerEncryptionKey { + // Immutable. The name of the Google Cloud KMS encryption key. For example, + // `projects/PROJECT_ID/locations/REGION/keyRings/KEY_RING/cryptoKeys/KEY_NAME`. + string kms_key = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. The service account to use with the specified + // KMS key. We recommend that you use a separate service account + // and follow KMS best practices. For more information, see + // [Separation of + // duties](https://cloud.google.com/kms/docs/separation-of-duties) and + // `gcloud kms keys add-iam-policy-binding` + // [`--member`](https://cloud.google.com/sdk/gcloud/reference/kms/keys/add-iam-policy-binding#--member). + string kms_key_service_account = 2 + [(google.api.field_behavior) = IMMUTABLE]; + } + + // A readiness check to be performed on a workstation. + message ReadinessCheck { + // Path to which the request should be sent. + string path = 1; + + // Port to which the request should be sent. + int32 port = 2; + } + + // Full name of this resource. + string name = 1; + + // Human-readable name for this resource. + string display_name = 2; + + // Output only. A system-assigned unique identified for this resource. + string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates whether this resource is currently being updated to + // match its intended state. + bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Client-specified annotations. + map annotations = 5; + + // Client-specified labels that are applied to the resource and that are also + // propagated to the underlying Compute Engine resources. + map labels = 18; + + // Output only. Time when this resource was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was most recently updated. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was soft-deleted. + google.protobuf.Timestamp delete_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Checksum computed by the server. May be sent on update and delete requests + // to make sure that the client has an up-to-date value before proceeding. + string etag = 9; + + // How long to wait before automatically stopping an instance that hasn't + // received any user traffic. A value of 0 indicates that this instance + // should never time out due to idleness. Defaults to 20 minutes. + google.protobuf.Duration idle_timeout = 10; + + // How long to wait before automatically stopping a workstation after it + // started. A value of 0 indicates that workstations using this configuration + // should never time out. Must be greater than 0 and less than 24 hours if + // encryption_key is set. Defaults to 12 hours. + google.protobuf.Duration running_timeout = 11; + + // Runtime host for the workstation. + Host host = 12; + + // Directories to persist across workstation sessions. + repeated PersistentDirectory persistent_directories = 13; + + // Container that will be run for each workstation using this configuration + // when that workstation is started. + Container container = 14; + + // Immutable. Encrypts resources of this workstation configuration using a + // customer-managed encryption key. + // + // If specified, the boot disk of the Compute Engine instance and the + // persistent disk are encrypted using this encryption key. If + // this field is not set, the disks are encrypted using a generated + // key. Customer-managed encryption keys do not protect disk metadata. + // + // If the customer-managed encryption key is rotated, when the workstation + // instance is stopped, the system attempts to recreate the + // persistent disk with the new version of the key. Be sure to keep + // older versions of the key until the persistent disk is recreated. + // Otherwise, data on the persistent disk will be lost. + // + // If the encryption key is revoked, the workstation session will + // automatically be stopped within 7 hours. + // + // Immutable after the workstation configuration is created. + CustomerEncryptionKey encryption_key = 17 + [(google.api.field_behavior) = IMMUTABLE]; + + // Readiness checks to perform when starting a workstation using this + // workstation configuration. Mark a workstation as running only after all + // specified readiness checks return 200 status codes. + repeated ReadinessCheck readiness_checks = 19; + + // Output only. Whether this resource is in degraded mode, in which case it + // may require user action to restore full functionality. Details can be found + // in the `conditions` field. + bool degraded = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Status conditions describing the current resource state. + repeated google.rpc.Status conditions = 16 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Whether to enable linux auditd logging on the workstation. When enabled, a + // service account must also be specified that has logging.buckets.write + // permission on the project. Operating system audit logging is distinct from + // [Cloud Audit + // Logs](https://cloud.google.com/workstations/docs/audit-logging). + bool enable_audit_agent = 20; +} + +// A single instance of a developer workstation with its own persistent storage. +message Workstation { + option (google.api.resource) = { + type: "workstations.googleapis.com/Workstation" + pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}/workstations/{workstation}" + style: DECLARATIVE_FRIENDLY + }; + + // Whether a workstation is running and ready to receive user requests. + enum State { + // Do not use. + STATE_UNSPECIFIED = 0; + + // The workstation is not yet ready to accept requests from users but will + // be soon. + STATE_STARTING = 1; + + // The workstation is ready to accept requests from users. + STATE_RUNNING = 2; + + // The workstation is being stopped. + STATE_STOPPING = 3; + + // The workstation is stopped and will not be able to receive requests until + // it is started. + STATE_STOPPED = 4; + } + + // Full name of this resource. + string name = 1; + + // Human-readable name for this resource. + string display_name = 2; + + // Output only. A system-assigned unique identified for this resource. + string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates whether this resource is currently being updated to + // match its intended state. + bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Client-specified annotations. + map annotations = 5; + + // Client-specified labels that are applied to the resource and that are also + // propagated to the underlying Compute Engine resources. + map labels = 13; + + // Output only. Time when this resource was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was most recently updated. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this resource was soft-deleted. + google.protobuf.Timestamp delete_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Checksum computed by the server. May be sent on update and delete requests + // to make sure that the client has an up-to-date value before proceeding. + string etag = 9; + + // Output only. Current state of the workstation. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Host to which clients can send HTTPS traffic that will be + // received by the workstation. Authorized traffic will be received to the + // workstation as HTTP on port 80. To send traffic to a different port, + // clients may prefix the host with the destination port in the format + // `{port}-{host}`. + string host = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Environment variables passed to the workstation container's entrypoint. + map env = 12; +} + +// Request message for GetWorkstationCluster. +message GetWorkstationClusterRequest { + // Required. Name of the requested resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationCluster" + } + ]; +} + +// Request message for ListWorkstationClusters. +message ListWorkstationClustersRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // Maximum number of items to return. + int32 page_size = 2; + + // next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response message for ListWorkstationClusters. +message ListWorkstationClustersResponse { + // The requested workstation clusters. + repeated WorkstationCluster workstation_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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Message for creating a CreateWorkstationCluster. +message CreateWorkstationClusterRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // Required. ID to use for the workstation cluster. + string workstation_cluster_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Workstation cluster to create. + WorkstationCluster workstation_cluster = 3 + [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 4; +} + +// Request message for UpdateWorkstationCluster. +message UpdateWorkstationClusterRequest { + // Required. Workstation cluster to update. + WorkstationCluster workstation_cluster = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask that specifies which fields in the workstation cluster + // should be updated. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 3; + + // If set, and the workstation cluster is not found, a new workstation + // cluster will be created. In this situation, update_mask is ignored. + bool allow_missing = 4; +} + +// Message for deleting a workstation cluster. +message DeleteWorkstationClusterRequest { + // Required. Name of the workstation cluster to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // If set, validate the request and preview the review, but do not apply it. + bool validate_only = 2; + + // If set, the request will be rejected if the latest version of the + // workstation cluster on the server does not have this ETag. + string etag = 3; + + // If set, any workstation configurations and workstations in the + // workstation cluster are also deleted. Otherwise, the request only + // works if the workstation cluster has no configurations or workstations. + bool force = 4; +} + +// Request message for GetWorkstationConfig. +message GetWorkstationConfigRequest { + // Required. Name of the requested resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationConfig" + } + ]; +} + +// Request message for ListWorkstationConfigs. +message ListWorkstationConfigsRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // Maximum number of items to return. + int32 page_size = 2; + + // next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response message for ListWorkstationConfigs. +message ListWorkstationConfigsResponse { + // The requested configs. + repeated WorkstationConfig workstation_configs = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Request message for ListUsableWorkstationConfigs. +message ListUsableWorkstationConfigsRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // Maximum number of items to return. + int32 page_size = 2; + + // next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response message for ListUsableWorkstationConfigs. +message ListUsableWorkstationConfigsResponse { + // The requested configs. + repeated WorkstationConfig workstation_configs = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Message for creating a CreateWorkstationConfig. +message CreateWorkstationConfigRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationCluster" + } + ]; + + // Required. ID to use for the workstation configuration. + string workstation_config_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Config to create. + WorkstationConfig workstation_config = 3 + [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 4; +} + +// Request message for UpdateWorkstationConfig. +message UpdateWorkstationConfigRequest { + // Required. Config to update. + WorkstationConfig workstation_config = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask specifying which fields in the workstation configuration + // should be updated. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 3; + + // If set and the workstation configuration is not found, a new + // workstation configuration will be created. In this situation, + // update_mask is ignored. + bool allow_missing = 4; +} + +// Message for deleting a workstation configuration. +message DeleteWorkstationConfigRequest { + // Required. Name of the workstation configuration to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationConfig" + } + ]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 2; + + // If set, the request is rejected if the latest version of the + // workstation configuration on the server does not have this ETag. + string etag = 3; + + // If set, any workstations in the workstation configuration are also deleted. + // Otherwise, the request works only if the workstation configuration has + // no workstations. + bool force = 4; +} + +// Request message for GetWorkstation. +message GetWorkstationRequest { + // Required. Name of the requested resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/Workstation" + } + ]; +} + +// Request message for ListWorkstations. +message ListWorkstationsRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationConfig" + } + ]; + + // Maximum number of items to return. + int32 page_size = 2; + + // next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response message for ListWorkstations. +message ListWorkstationsResponse { + // The requested workstations. + repeated Workstation workstations = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Request message for ListUsableWorkstations. +message ListUsableWorkstationsRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationConfig" + } + ]; + + // Maximum number of items to return. + int32 page_size = 2; + + // next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response message for ListUsableWorkstations. +message ListUsableWorkstationsResponse { + // The requested workstations. + repeated Workstation workstations = 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; + + // Unreachable resources. + repeated string unreachable = 3; +} + +// Message for creating a CreateWorkstation. +message CreateWorkstationRequest { + // Required. Parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/WorkstationConfig" + } + ]; + + // Required. ID to use for the workstation. + string workstation_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Workstation to create. + Workstation workstation = 3 [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 4; +} + +// Request message for UpdateWorkstation. +message UpdateWorkstationRequest { + // Required. Workstation to update. + Workstation workstation = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask specifying which fields in the workstation configuration + // should be updated. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 3; + + // If set and the workstation configuration is not found, a new + // workstation configuration is created. In this situation, update_mask + // is ignored. + bool allow_missing = 4; +} + +// Request message for DeleteWorkstation. +message DeleteWorkstationRequest { + // Required. Name of the workstation to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/Workstation" + } + ]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 2; + + // If set, the request will be rejected if the latest version of the + // workstation on the server does not have this ETag. + string etag = 3; +} + +// Request message for StartWorkstation. +message StartWorkstationRequest { + // Required. Name of the workstation to start. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/Workstation" + } + ]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 2; + + // If set, the request will be rejected if the latest version of the + // workstation on the server does not have this ETag. + string etag = 3; +} + +// Request message for StopWorkstation. +message StopWorkstationRequest { + // Required. Name of the workstation to stop. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/Workstation" + } + ]; + + // If set, validate the request and preview the review, but do not actually + // apply it. + bool validate_only = 2; + + // If set, the request will be rejected if the latest version of the + // workstation on the server does not have this ETag. + string etag = 3; +} + +// Request message for GenerateAccessToken. +message GenerateAccessTokenRequest { + // Required. Name of the workstation for which the access token should be + // generated. + string workstation = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workstations.googleapis.com/Workstation" + } + ]; + + // Desired expiration or lifetime of the access token. + oneof expiration { + // Desired expiration time of the access token. This value must + // be at most 24 hours in the future. If a value is not specified, the + // token's expiration time will be set to a default value of 1 hour in the + // future. + google.protobuf.Timestamp expire_time = 2; + + // Desired lifetime duration of the access token. This value must + // be at most 24 hours. If a value is not specified, the token's lifetime + // will be set to a default value of 1 hour. + google.protobuf.Duration ttl = 3; + } +} + +// Response message for GenerateAccessToken. +message GenerateAccessTokenResponse { + // The generated bearer access token. To use this token, include it in an + // Authorization header of an HTTP request sent to the associated + // workstation's hostname—for example, `Authorization: Bearer + // `. + string access_token = 1; + + // Time at which the generated token will expire. + google.protobuf.Timestamp expire_time = 2; +} + +// Metadata for long-running operations. +message OperationMetadata { + // Output only. Time that the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time that 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. + 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-workstations/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workstations.v1beta.json b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workstations.v1beta.json new file mode 100644 index 00000000000..a1e3de6d395 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workstations.v1beta.json @@ -0,0 +1,983 @@ +{ + "clientLibrary": { + "name": "nodejs-workstations", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.workstations.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "workstations_v1beta_generated_Workstations_GetWorkstationCluster_async", + "title": "Workstations getWorkstationCluster Sample", + "origin": "API_DEFINITION", + "description": " Returns the requested workstation cluster.", + "canonical": true, + "file": "workstations.get_workstation_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkstationCluster", + "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstationCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1beta.WorkstationCluster", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "GetWorkstationCluster", + "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstationCluster", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_ListWorkstationClusters_async", + "title": "Workstations listWorkstationClusters Sample", + "origin": "API_DEFINITION", + "description": " Returns all workstation clusters in the specified location.", + "canonical": true, + "file": "workstations.list_workstation_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkstationClusters", + "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstationClusters", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1beta.ListWorkstationClustersResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "ListWorkstationClusters", + "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstationClusters", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_CreateWorkstationCluster_async", + "title": "Workstations createWorkstationCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a new workstation cluster.", + "canonical": true, + "file": "workstations.create_workstation_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkstationCluster", + "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstationCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "workstation_cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "workstation_cluster", + "type": ".google.cloud.workstations.v1beta.WorkstationCluster" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "CreateWorkstationCluster", + "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstationCluster", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_UpdateWorkstationCluster_async", + "title": "Workstations updateWorkstationCluster Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing workstation cluster.", + "canonical": true, + "file": "workstations.update_workstation_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkstationCluster", + "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstationCluster", + "async": true, + "parameters": [ + { + "name": "workstation_cluster", + "type": ".google.cloud.workstations.v1beta.WorkstationCluster" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "UpdateWorkstationCluster", + "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstationCluster", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_DeleteWorkstationCluster_async", + "title": "Workstations deleteWorkstationCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified workstation cluster.", + "canonical": true, + "file": "workstations.delete_workstation_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkstationCluster", + "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstationCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "DeleteWorkstationCluster", + "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstationCluster", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_GetWorkstationConfig_async", + "title": "Workstations getWorkstationConfig Sample", + "origin": "API_DEFINITION", + "description": " Returns the requested workstation configuration.", + "canonical": true, + "file": "workstations.get_workstation_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkstationConfig", + "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1beta.WorkstationConfig", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "GetWorkstationConfig", + "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstationConfig", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_ListWorkstationConfigs_async", + "title": "Workstations listWorkstationConfigs Sample", + "origin": "API_DEFINITION", + "description": " Returns all workstation configurations in the specified cluster.", + "canonical": true, + "file": "workstations.list_workstation_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkstationConfigs", + "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstationConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1beta.ListWorkstationConfigsResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "ListWorkstationConfigs", + "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstationConfigs", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_ListUsableWorkstationConfigs_async", + "title": "Workstations listUsableWorkstationConfigs Sample", + "origin": "API_DEFINITION", + "description": " Returns all workstation configurations in the specified cluster on which the caller has the \"workstations.workstation.create\" permission.", + "canonical": true, + "file": "workstations.list_usable_workstation_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListUsableWorkstationConfigs", + "fullName": "google.cloud.workstations.v1beta.Workstations.ListUsableWorkstationConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1beta.ListUsableWorkstationConfigsResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "ListUsableWorkstationConfigs", + "fullName": "google.cloud.workstations.v1beta.Workstations.ListUsableWorkstationConfigs", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_CreateWorkstationConfig_async", + "title": "Workstations createWorkstationConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new workstation configuration.", + "canonical": true, + "file": "workstations.create_workstation_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkstationConfig", + "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstationConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "workstation_config_id", + "type": "TYPE_STRING" + }, + { + "name": "workstation_config", + "type": ".google.cloud.workstations.v1beta.WorkstationConfig" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "CreateWorkstationConfig", + "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstationConfig", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_UpdateWorkstationConfig_async", + "title": "Workstations updateWorkstationConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing workstation configuration.", + "canonical": true, + "file": "workstations.update_workstation_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkstationConfig", + "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstationConfig", + "async": true, + "parameters": [ + { + "name": "workstation_config", + "type": ".google.cloud.workstations.v1beta.WorkstationConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "UpdateWorkstationConfig", + "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstationConfig", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_DeleteWorkstationConfig_async", + "title": "Workstations deleteWorkstationConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified workstation configuration.", + "canonical": true, + "file": "workstations.delete_workstation_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkstationConfig", + "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "DeleteWorkstationConfig", + "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstationConfig", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_GetWorkstation_async", + "title": "Workstations getWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Returns the requested workstation.", + "canonical": true, + "file": "workstations.get_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1beta.Workstation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "GetWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_ListWorkstations_async", + "title": "Workstations listWorkstations Sample", + "origin": "API_DEFINITION", + "description": " Returns all Workstations using the specified workstation configuration.", + "canonical": true, + "file": "workstations.list_workstations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkstations", + "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1beta.ListWorkstationsResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "ListWorkstations", + "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstations", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_ListUsableWorkstations_async", + "title": "Workstations listUsableWorkstations Sample", + "origin": "API_DEFINITION", + "description": " Returns all workstations using the specified workstation configuration on which the caller has the \"workstations.workstations.use\" permission.", + "canonical": true, + "file": "workstations.list_usable_workstations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListUsableWorkstations", + "fullName": "google.cloud.workstations.v1beta.Workstations.ListUsableWorkstations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workstations.v1beta.ListUsableWorkstationsResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "ListUsableWorkstations", + "fullName": "google.cloud.workstations.v1beta.Workstations.ListUsableWorkstations", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_CreateWorkstation_async", + "title": "Workstations createWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Creates a new workstation.", + "canonical": true, + "file": "workstations.create_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "workstation_id", + "type": "TYPE_STRING" + }, + { + "name": "workstation", + "type": ".google.cloud.workstations.v1beta.Workstation" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "CreateWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_UpdateWorkstation_async", + "title": "Workstations updateWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing workstation.", + "canonical": true, + "file": "workstations.update_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstation", + "async": true, + "parameters": [ + { + "name": "workstation", + "type": ".google.cloud.workstations.v1beta.Workstation" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "UpdateWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_DeleteWorkstation_async", + "title": "Workstations deleteWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified workstation.", + "canonical": true, + "file": "workstations.delete_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "DeleteWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_StartWorkstation_async", + "title": "Workstations startWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Starts running a workstation so that users can connect to it.", + "canonical": true, + "file": "workstations.start_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.StartWorkstation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "StartWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.StartWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_StopWorkstation_async", + "title": "Workstations stopWorkstation Sample", + "origin": "API_DEFINITION", + "description": " Stops running a workstation, reducing costs.", + "canonical": true, + "file": "workstations.stop_workstation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.StopWorkstation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "StopWorkstation", + "fullName": "google.cloud.workstations.v1beta.Workstations.StopWorkstation", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + }, + { + "regionTag": "workstations_v1beta_generated_Workstations_GenerateAccessToken_async", + "title": "Workstations generateAccessToken Sample", + "origin": "API_DEFINITION", + "description": " Returns a short-lived credential that can be used to send authenticated and authorized traffic to a workstation.", + "canonical": true, + "file": "workstations.generate_access_token.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateAccessToken", + "fullName": "google.cloud.workstations.v1beta.Workstations.GenerateAccessToken", + "async": true, + "parameters": [ + { + "name": "workstation", + "type": "TYPE_STRING" + }, + { + "name": "expire_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "ttl", + "type": ".google.protobuf.Duration" + } + ], + "resultType": ".google.cloud.workstations.v1beta.GenerateAccessTokenResponse", + "client": { + "shortName": "WorkstationsClient", + "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" + }, + "method": { + "shortName": "GenerateAccessToken", + "fullName": "google.cloud.workstations.v1beta.Workstations.GenerateAccessToken", + "service": { + "shortName": "Workstations", + "fullName": "google.cloud.workstations.v1beta.Workstations" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation.js new file mode 100644 index 00000000000..8f06f4e3ed2 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation.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, workstationId, workstation) { + // [START workstations_v1beta_generated_Workstations_CreateWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Required. ID to use for the workstation. + */ + // const workstationId = 'abc123' + /** + * Required. Workstation to create. + */ + // const workstation = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callCreateWorkstation() { + // Construct request + const request = { + parent, + workstationId, + workstation, + }; + + // Run request + const [operation] = await workstationsClient.createWorkstation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateWorkstation(); + // [END workstations_v1beta_generated_Workstations_CreateWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_cluster.js new file mode 100644 index 00000000000..cee2f671720 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_cluster.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, workstationClusterId, workstationCluster) { + // [START workstations_v1beta_generated_Workstations_CreateWorkstationCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Required. ID to use for the workstation cluster. + */ + // const workstationClusterId = 'abc123' + /** + * Required. Workstation cluster to create. + */ + // const workstationCluster = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callCreateWorkstationCluster() { + // Construct request + const request = { + parent, + workstationClusterId, + workstationCluster, + }; + + // Run request + const [operation] = await workstationsClient.createWorkstationCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateWorkstationCluster(); + // [END workstations_v1beta_generated_Workstations_CreateWorkstationCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_config.js new file mode 100644 index 00000000000..06b8cdb0a1b --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_config.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, workstationConfigId, workstationConfig) { + // [START workstations_v1beta_generated_Workstations_CreateWorkstationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Required. ID to use for the workstation configuration. + */ + // const workstationConfigId = 'abc123' + /** + * Required. Config to create. + */ + // const workstationConfig = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callCreateWorkstationConfig() { + // Construct request + const request = { + parent, + workstationConfigId, + workstationConfig, + }; + + // Run request + const [operation] = await workstationsClient.createWorkstationConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateWorkstationConfig(); + // [END workstations_v1beta_generated_Workstations_CreateWorkstationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation.js new file mode 100644 index 00000000000..2bbc0c5091a --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation.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) { + // [START workstations_v1beta_generated_Workstations_DeleteWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workstation to delete. + */ + // const name = 'abc123' + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this ETag. + */ + // const etag = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callDeleteWorkstation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workstationsClient.deleteWorkstation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteWorkstation(); + // [END workstations_v1beta_generated_Workstations_DeleteWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_cluster.js new file mode 100644 index 00000000000..e6b9d1833ed --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_cluster.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 workstations_v1beta_generated_Workstations_DeleteWorkstationCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workstation cluster to delete. + */ + // const name = 'abc123' + /** + * If set, validate the request and preview the review, but do not apply it. + */ + // const validateOnly = true + /** + * If set, the request will be rejected if the latest version of the + * workstation cluster on the server does not have this ETag. + */ + // const etag = 'abc123' + /** + * If set, any workstation configurations and workstations in the + * workstation cluster are also deleted. Otherwise, the request only + * works if the workstation cluster has no configurations or workstations. + */ + // const force = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callDeleteWorkstationCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workstationsClient.deleteWorkstationCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteWorkstationCluster(); + // [END workstations_v1beta_generated_Workstations_DeleteWorkstationCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_config.js new file mode 100644 index 00000000000..689d9f063ca --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_config.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(name) { + // [START workstations_v1beta_generated_Workstations_DeleteWorkstationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workstation configuration to delete. + */ + // const name = 'abc123' + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set, the request is rejected if the latest version of the + * workstation configuration on the server does not have this ETag. + */ + // const etag = 'abc123' + /** + * If set, any workstations in the workstation configuration are also deleted. + * Otherwise, the request works only if the workstation configuration has + * no workstations. + */ + // const force = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callDeleteWorkstationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workstationsClient.deleteWorkstationConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteWorkstationConfig(); + // [END workstations_v1beta_generated_Workstations_DeleteWorkstationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.generate_access_token.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.generate_access_token.js new file mode 100644 index 00000000000..4daa06ed5a1 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.generate_access_token.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(workstation) { + // [START workstations_v1beta_generated_Workstations_GenerateAccessToken_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workstation for which the access token should be + * generated. + */ + // const workstation = 'abc123' + /** + * Desired expiration time of the access token. This value must + * be at most 24 hours in the future. If a value is not specified, the + * token's expiration time will be set to a default value of 1 hour in the + * future. + */ + // const expireTime = {} + /** + * Desired lifetime duration of the access token. This value must + * be at most 24 hours. If a value is not specified, the token's lifetime + * will be set to a default value of 1 hour. + */ + // const ttl = {} + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callGenerateAccessToken() { + // Construct request + const request = { + workstation, + }; + + // Run request + const response = await workstationsClient.generateAccessToken(request); + console.log(response); + } + + callGenerateAccessToken(); + // [END workstations_v1beta_generated_Workstations_GenerateAccessToken_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation.js new file mode 100644 index 00000000000..b530e0495fd --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation.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 workstations_v1beta_generated_Workstations_GetWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 requested resource. + */ + // const name = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callGetWorkstation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await workstationsClient.getWorkstation(request); + console.log(response); + } + + callGetWorkstation(); + // [END workstations_v1beta_generated_Workstations_GetWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_cluster.js new file mode 100644 index 00000000000..428a03d1285 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_cluster.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 workstations_v1beta_generated_Workstations_GetWorkstationCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 requested resource. + */ + // const name = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callGetWorkstationCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await workstationsClient.getWorkstationCluster(request); + console.log(response); + } + + callGetWorkstationCluster(); + // [END workstations_v1beta_generated_Workstations_GetWorkstationCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_config.js new file mode 100644 index 00000000000..65085239d8b --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_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 workstations_v1beta_generated_Workstations_GetWorkstationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 requested resource. + */ + // const name = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callGetWorkstationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await workstationsClient.getWorkstationConfig(request); + console.log(response); + } + + callGetWorkstationConfig(); + // [END workstations_v1beta_generated_Workstations_GetWorkstationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstation_configs.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstation_configs.js new file mode 100644 index 00000000000..e00acc5c95f --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstation_configs.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(parent) { + // [START workstations_v1beta_generated_Workstations_ListUsableWorkstationConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Maximum number of items to return. + */ + // const pageSize = 1234 + /** + * next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callListUsableWorkstationConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workstationsClient.listUsableWorkstationConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListUsableWorkstationConfigs(); + // [END workstations_v1beta_generated_Workstations_ListUsableWorkstationConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstations.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstations.js new file mode 100644 index 00000000000..78ba41a96df --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstations.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(parent) { + // [START workstations_v1beta_generated_Workstations_ListUsableWorkstations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Maximum number of items to return. + */ + // const pageSize = 1234 + /** + * next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callListUsableWorkstations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workstationsClient.listUsableWorkstationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListUsableWorkstations(); + // [END workstations_v1beta_generated_Workstations_ListUsableWorkstations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_clusters.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_clusters.js new file mode 100644 index 00000000000..5077a5eeea0 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_clusters.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(parent) { + // [START workstations_v1beta_generated_Workstations_ListWorkstationClusters_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Maximum number of items to return. + */ + // const pageSize = 1234 + /** + * next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callListWorkstationClusters() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workstationsClient.listWorkstationClustersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListWorkstationClusters(); + // [END workstations_v1beta_generated_Workstations_ListWorkstationClusters_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_configs.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_configs.js new file mode 100644 index 00000000000..84059dd3381 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_configs.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(parent) { + // [START workstations_v1beta_generated_Workstations_ListWorkstationConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Maximum number of items to return. + */ + // const pageSize = 1234 + /** + * next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callListWorkstationConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workstationsClient.listWorkstationConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListWorkstationConfigs(); + // [END workstations_v1beta_generated_Workstations_ListWorkstationConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstations.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstations.js new file mode 100644 index 00000000000..40a4c1fc3bc --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstations.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(parent) { + // [START workstations_v1beta_generated_Workstations_ListWorkstations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + */ + // const parent = 'abc123' + /** + * Maximum number of items to return. + */ + // const pageSize = 1234 + /** + * next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callListWorkstations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await workstationsClient.listWorkstationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListWorkstations(); + // [END workstations_v1beta_generated_Workstations_ListWorkstations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.start_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.start_workstation.js new file mode 100644 index 00000000000..80b23015d70 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.start_workstation.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) { + // [START workstations_v1beta_generated_Workstations_StartWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workstation to start. + */ + // const name = 'abc123' + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this ETag. + */ + // const etag = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callStartWorkstation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workstationsClient.startWorkstation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStartWorkstation(); + // [END workstations_v1beta_generated_Workstations_StartWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.stop_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.stop_workstation.js new file mode 100644 index 00000000000..16ad243fe8d --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.stop_workstation.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) { + // [START workstations_v1beta_generated_Workstations_StopWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 workstation to stop. + */ + // const name = 'abc123' + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this ETag. + */ + // const etag = 'abc123' + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callStopWorkstation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await workstationsClient.stopWorkstation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStopWorkstation(); + // [END workstations_v1beta_generated_Workstations_StopWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation.js new file mode 100644 index 00000000000..3dcab94e56f --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation.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(workstation, updateMask) { + // [START workstations_v1beta_generated_Workstations_UpdateWorkstation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Workstation to update. + */ + // const workstation = {} + /** + * Required. Mask specifying which fields in the workstation configuration + * should be updated. + */ + // const updateMask = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set and the workstation configuration is not found, a new + * workstation configuration is created. In this situation, update_mask + * is ignored. + */ + // const allowMissing = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callUpdateWorkstation() { + // Construct request + const request = { + workstation, + updateMask, + }; + + // Run request + const [operation] = await workstationsClient.updateWorkstation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateWorkstation(); + // [END workstations_v1beta_generated_Workstations_UpdateWorkstation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_cluster.js new file mode 100644 index 00000000000..763ce7d3aee --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_cluster.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(workstationCluster, updateMask) { + // [START workstations_v1beta_generated_Workstations_UpdateWorkstationCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Workstation cluster to update. + */ + // const workstationCluster = {} + /** + * Required. Mask that specifies which fields in the workstation cluster + * should be updated. + */ + // const updateMask = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set, and the workstation cluster is not found, a new workstation + * cluster will be created. In this situation, update_mask is ignored. + */ + // const allowMissing = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callUpdateWorkstationCluster() { + // Construct request + const request = { + workstationCluster, + updateMask, + }; + + // Run request + const [operation] = await workstationsClient.updateWorkstationCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateWorkstationCluster(); + // [END workstations_v1beta_generated_Workstations_UpdateWorkstationCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_config.js new file mode 100644 index 00000000000..1d4a94bc91a --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_config.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(workstationConfig, updateMask) { + // [START workstations_v1beta_generated_Workstations_UpdateWorkstationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Config to update. + */ + // const workstationConfig = {} + /** + * Required. Mask specifying which fields in the workstation configuration + * should be updated. + */ + // const updateMask = {} + /** + * If set, validate the request and preview the review, but do not actually + * apply it. + */ + // const validateOnly = true + /** + * If set and the workstation configuration is not found, a new + * workstation configuration will be created. In this situation, + * update_mask is ignored. + */ + // const allowMissing = true + + // Imports the Workstations library + const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; + + // Instantiates a client + const workstationsClient = new WorkstationsClient(); + + async function callUpdateWorkstationConfig() { + // Construct request + const request = { + workstationConfig, + updateMask, + }; + + // Run request + const [operation] = await workstationsClient.updateWorkstationConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateWorkstationConfig(); + // [END workstations_v1beta_generated_Workstations_UpdateWorkstationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/src/index.ts b/owl-bot-staging/google-cloud-workstations/v1beta/src/index.ts new file mode 100644 index 00000000000..ef3f0b62af2 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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 WorkstationsClient = v1beta.WorkstationsClient; +type WorkstationsClient = v1beta.WorkstationsClient; +export {v1beta, WorkstationsClient}; +export default {v1beta, WorkstationsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/gapic_metadata.json new file mode 100644 index 00000000000..14443a3ae14 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/gapic_metadata.json @@ -0,0 +1,243 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.workstations.v1beta", + "libraryPackage": "@google-cloud/workstations", + "services": { + "Workstations": { + "clients": { + "grpc": { + "libraryClient": "WorkstationsClient", + "rpcs": { + "GetWorkstationCluster": { + "methods": [ + "getWorkstationCluster" + ] + }, + "GetWorkstationConfig": { + "methods": [ + "getWorkstationConfig" + ] + }, + "GetWorkstation": { + "methods": [ + "getWorkstation" + ] + }, + "GenerateAccessToken": { + "methods": [ + "generateAccessToken" + ] + }, + "CreateWorkstationCluster": { + "methods": [ + "createWorkstationCluster" + ] + }, + "UpdateWorkstationCluster": { + "methods": [ + "updateWorkstationCluster" + ] + }, + "DeleteWorkstationCluster": { + "methods": [ + "deleteWorkstationCluster" + ] + }, + "CreateWorkstationConfig": { + "methods": [ + "createWorkstationConfig" + ] + }, + "UpdateWorkstationConfig": { + "methods": [ + "updateWorkstationConfig" + ] + }, + "DeleteWorkstationConfig": { + "methods": [ + "deleteWorkstationConfig" + ] + }, + "CreateWorkstation": { + "methods": [ + "createWorkstation" + ] + }, + "UpdateWorkstation": { + "methods": [ + "updateWorkstation" + ] + }, + "DeleteWorkstation": { + "methods": [ + "deleteWorkstation" + ] + }, + "StartWorkstation": { + "methods": [ + "startWorkstation" + ] + }, + "StopWorkstation": { + "methods": [ + "stopWorkstation" + ] + }, + "ListWorkstationClusters": { + "methods": [ + "listWorkstationClusters", + "listWorkstationClustersStream", + "listWorkstationClustersAsync" + ] + }, + "ListWorkstationConfigs": { + "methods": [ + "listWorkstationConfigs", + "listWorkstationConfigsStream", + "listWorkstationConfigsAsync" + ] + }, + "ListUsableWorkstationConfigs": { + "methods": [ + "listUsableWorkstationConfigs", + "listUsableWorkstationConfigsStream", + "listUsableWorkstationConfigsAsync" + ] + }, + "ListWorkstations": { + "methods": [ + "listWorkstations", + "listWorkstationsStream", + "listWorkstationsAsync" + ] + }, + "ListUsableWorkstations": { + "methods": [ + "listUsableWorkstations", + "listUsableWorkstationsStream", + "listUsableWorkstationsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WorkstationsClient", + "rpcs": { + "GetWorkstationCluster": { + "methods": [ + "getWorkstationCluster" + ] + }, + "GetWorkstationConfig": { + "methods": [ + "getWorkstationConfig" + ] + }, + "GetWorkstation": { + "methods": [ + "getWorkstation" + ] + }, + "GenerateAccessToken": { + "methods": [ + "generateAccessToken" + ] + }, + "CreateWorkstationCluster": { + "methods": [ + "createWorkstationCluster" + ] + }, + "UpdateWorkstationCluster": { + "methods": [ + "updateWorkstationCluster" + ] + }, + "DeleteWorkstationCluster": { + "methods": [ + "deleteWorkstationCluster" + ] + }, + "CreateWorkstationConfig": { + "methods": [ + "createWorkstationConfig" + ] + }, + "UpdateWorkstationConfig": { + "methods": [ + "updateWorkstationConfig" + ] + }, + "DeleteWorkstationConfig": { + "methods": [ + "deleteWorkstationConfig" + ] + }, + "CreateWorkstation": { + "methods": [ + "createWorkstation" + ] + }, + "UpdateWorkstation": { + "methods": [ + "updateWorkstation" + ] + }, + "DeleteWorkstation": { + "methods": [ + "deleteWorkstation" + ] + }, + "StartWorkstation": { + "methods": [ + "startWorkstation" + ] + }, + "StopWorkstation": { + "methods": [ + "stopWorkstation" + ] + }, + "ListWorkstationClusters": { + "methods": [ + "listWorkstationClusters", + "listWorkstationClustersStream", + "listWorkstationClustersAsync" + ] + }, + "ListWorkstationConfigs": { + "methods": [ + "listWorkstationConfigs", + "listWorkstationConfigsStream", + "listWorkstationConfigsAsync" + ] + }, + "ListUsableWorkstationConfigs": { + "methods": [ + "listUsableWorkstationConfigs", + "listUsableWorkstationConfigsStream", + "listUsableWorkstationConfigsAsync" + ] + }, + "ListWorkstations": { + "methods": [ + "listWorkstations", + "listWorkstationsStream", + "listWorkstationsAsync" + ] + }, + "ListUsableWorkstations": { + "methods": [ + "listUsableWorkstations", + "listUsableWorkstationsStream", + "listUsableWorkstationsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/index.ts new file mode 100644 index 00000000000..8fd62185321 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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 {WorkstationsClient} from './workstations_client'; diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client.ts b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client.ts new file mode 100644 index 00000000000..717821738c9 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client.ts @@ -0,0 +1,3315 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/workstations_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './workstations_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for interacting with Cloud Workstations. + * @class + * @memberof v1beta + */ +export class WorkstationsClient { + 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; + workstationsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WorkstationsClient. + * + * @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 WorkstationsClient({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 WorkstationsClient; + 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}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + workstationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}/workstations/{workstation}' + ), + workstationClusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}' + ), + workstationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listWorkstationClusters: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationClusters'), + listWorkstationConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationConfigs'), + listUsableWorkstationConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationConfigs'), + listWorkstations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstations'), + listUsableWorkstations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstations') + }; + + 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.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}: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 createWorkstationClusterResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.WorkstationCluster') as gax.protobuf.Type; + const createWorkstationClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; + const updateWorkstationClusterResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.WorkstationCluster') as gax.protobuf.Type; + const updateWorkstationClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; + const deleteWorkstationClusterResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.WorkstationCluster') as gax.protobuf.Type; + const deleteWorkstationClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; + const createWorkstationConfigResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.WorkstationConfig') as gax.protobuf.Type; + const createWorkstationConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; + const updateWorkstationConfigResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.WorkstationConfig') as gax.protobuf.Type; + const updateWorkstationConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; + const deleteWorkstationConfigResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.WorkstationConfig') as gax.protobuf.Type; + const deleteWorkstationConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; + const createWorkstationResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.Workstation') as gax.protobuf.Type; + const createWorkstationMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; + const updateWorkstationResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.Workstation') as gax.protobuf.Type; + const updateWorkstationMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; + const deleteWorkstationResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.Workstation') as gax.protobuf.Type; + const deleteWorkstationMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; + const startWorkstationResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.Workstation') as gax.protobuf.Type; + const startWorkstationMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; + const stopWorkstationResponse = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.Workstation') as gax.protobuf.Type; + const stopWorkstationMetadata = protoFilesRoot.lookup( + '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createWorkstationCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkstationClusterResponse.decode.bind(createWorkstationClusterResponse), + createWorkstationClusterMetadata.decode.bind(createWorkstationClusterMetadata)), + updateWorkstationCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkstationClusterResponse.decode.bind(updateWorkstationClusterResponse), + updateWorkstationClusterMetadata.decode.bind(updateWorkstationClusterMetadata)), + deleteWorkstationCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkstationClusterResponse.decode.bind(deleteWorkstationClusterResponse), + deleteWorkstationClusterMetadata.decode.bind(deleteWorkstationClusterMetadata)), + createWorkstationConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkstationConfigResponse.decode.bind(createWorkstationConfigResponse), + createWorkstationConfigMetadata.decode.bind(createWorkstationConfigMetadata)), + updateWorkstationConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkstationConfigResponse.decode.bind(updateWorkstationConfigResponse), + updateWorkstationConfigMetadata.decode.bind(updateWorkstationConfigMetadata)), + deleteWorkstationConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkstationConfigResponse.decode.bind(deleteWorkstationConfigResponse), + deleteWorkstationConfigMetadata.decode.bind(deleteWorkstationConfigMetadata)), + createWorkstation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkstationResponse.decode.bind(createWorkstationResponse), + createWorkstationMetadata.decode.bind(createWorkstationMetadata)), + updateWorkstation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkstationResponse.decode.bind(updateWorkstationResponse), + updateWorkstationMetadata.decode.bind(updateWorkstationMetadata)), + deleteWorkstation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkstationResponse.decode.bind(deleteWorkstationResponse), + deleteWorkstationMetadata.decode.bind(deleteWorkstationMetadata)), + startWorkstation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + startWorkstationResponse.decode.bind(startWorkstationResponse), + startWorkstationMetadata.decode.bind(startWorkstationMetadata)), + stopWorkstation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + stopWorkstationResponse.decode.bind(stopWorkstationResponse), + stopWorkstationMetadata.decode.bind(stopWorkstationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.workstations.v1beta.Workstations', 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.workstationsStub) { + return this.workstationsStub; + } + + // Put together the "service stub" for + // google.cloud.workstations.v1beta.Workstations. + this.workstationsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workstations.v1beta.Workstations') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workstations.v1beta.Workstations, + 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 workstationsStubMethods = + ['getWorkstationCluster', 'listWorkstationClusters', 'createWorkstationCluster', 'updateWorkstationCluster', 'deleteWorkstationCluster', 'getWorkstationConfig', 'listWorkstationConfigs', 'listUsableWorkstationConfigs', 'createWorkstationConfig', 'updateWorkstationConfig', 'deleteWorkstationConfig', 'getWorkstation', 'listWorkstations', 'listUsableWorkstations', 'createWorkstation', 'updateWorkstation', 'deleteWorkstation', 'startWorkstation', 'stopWorkstation', 'generateAccessToken']; + for (const methodName of workstationsStubMethods) { + const callPromise = this.workstationsStub.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.workstationsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'workstations.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 'workstations.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 the requested workstation cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the requested 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.workstations.v1beta.WorkstationCluster|WorkstationCluster}. + * Please see the {@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/workstations.get_workstation_cluster.js + * region_tag:workstations_v1beta_generated_Workstations_GetWorkstationCluster_async + */ + getWorkstationCluster( + request?: protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstationCluster, + protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|undefined, {}|undefined + ]>; + getWorkstationCluster( + request: protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workstations.v1beta.IWorkstationCluster, + protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|null|undefined, + {}|null|undefined>): void; + getWorkstationCluster( + request: protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest, + callback: Callback< + protos.google.cloud.workstations.v1beta.IWorkstationCluster, + protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|null|undefined, + {}|null|undefined>): void; + getWorkstationCluster( + request?: protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workstations.v1beta.IWorkstationCluster, + protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workstations.v1beta.IWorkstationCluster, + protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstationCluster, + protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getWorkstationCluster(request, options, callback); + } +/** + * Returns the requested workstation configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the requested 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.workstations.v1beta.WorkstationConfig|WorkstationConfig}. + * Please see the {@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/workstations.get_workstation_config.js + * region_tag:workstations_v1beta_generated_Workstations_GetWorkstationConfig_async + */ + getWorkstationConfig( + request?: protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstationConfig, + protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|undefined, {}|undefined + ]>; + getWorkstationConfig( + request: protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workstations.v1beta.IWorkstationConfig, + protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|null|undefined, + {}|null|undefined>): void; + getWorkstationConfig( + request: protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest, + callback: Callback< + protos.google.cloud.workstations.v1beta.IWorkstationConfig, + protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|null|undefined, + {}|null|undefined>): void; + getWorkstationConfig( + request?: protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workstations.v1beta.IWorkstationConfig, + protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workstations.v1beta.IWorkstationConfig, + protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstationConfig, + protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getWorkstationConfig(request, options, callback); + } +/** + * Returns the requested workstation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the requested 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.workstations.v1beta.Workstation|Workstation}. + * Please see the {@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/workstations.get_workstation.js + * region_tag:workstations_v1beta_generated_Workstations_GetWorkstation_async + */ + getWorkstation( + request?: protos.google.cloud.workstations.v1beta.IGetWorkstationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstation, + protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|undefined, {}|undefined + ]>; + getWorkstation( + request: protos.google.cloud.workstations.v1beta.IGetWorkstationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workstations.v1beta.IWorkstation, + protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|null|undefined, + {}|null|undefined>): void; + getWorkstation( + request: protos.google.cloud.workstations.v1beta.IGetWorkstationRequest, + callback: Callback< + protos.google.cloud.workstations.v1beta.IWorkstation, + protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|null|undefined, + {}|null|undefined>): void; + getWorkstation( + request?: protos.google.cloud.workstations.v1beta.IGetWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workstations.v1beta.IWorkstation, + protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workstations.v1beta.IWorkstation, + protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstation, + protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getWorkstation(request, options, callback); + } +/** + * Returns a short-lived credential that can be used to send authenticated and + * authorized traffic to a workstation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.workstation + * Required. Name of the workstation for which the access token should be + * generated. + * @param {google.protobuf.Timestamp} request.expireTime + * Desired expiration time of the access token. This value must + * be at most 24 hours in the future. If a value is not specified, the + * token's expiration time will be set to a default value of 1 hour in the + * future. + * @param {google.protobuf.Duration} request.ttl + * Desired lifetime duration of the access token. This value must + * be at most 24 hours. If a value is not specified, the token's lifetime + * will be set to a default value of 1 hour. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workstations.v1beta.GenerateAccessTokenResponse|GenerateAccessTokenResponse}. + * Please see the {@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/workstations.generate_access_token.js + * region_tag:workstations_v1beta_generated_Workstations_GenerateAccessToken_async + */ + generateAccessToken( + request?: protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|undefined, {}|undefined + ]>; + generateAccessToken( + request: protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>): void; + generateAccessToken( + request: protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest, + callback: Callback< + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>): void; + generateAccessToken( + request?: protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, + protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workstation': request.workstation ?? '', + }); + this.initialize(); + return this.innerApiCalls.generateAccessToken(request, options, callback); + } + +/** + * Creates a new workstation cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {string} request.workstationClusterId + * Required. ID to use for the workstation cluster. + * @param {google.cloud.workstations.v1beta.WorkstationCluster} request.workstationCluster + * Required. Workstation cluster to create. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workstations.create_workstation_cluster.js + * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstationCluster_async + */ + createWorkstationCluster( + request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createWorkstationCluster( + request: protos.google.cloud.workstations.v1beta.ICreateWorkstationClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstationCluster( + request: protos.google.cloud.workstations.v1beta.ICreateWorkstationClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstationCluster( + request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createWorkstationCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createWorkstationCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workstations.create_workstation_cluster.js + * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstationCluster_async + */ + async checkCreateWorkstationClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing workstation cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workstations.v1beta.WorkstationCluster} request.workstationCluster + * Required. Workstation cluster to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask that specifies which fields in the workstation cluster + * should be updated. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {boolean} request.allowMissing + * If set, and the workstation cluster is not found, a new workstation + * cluster will be created. In this situation, update_mask is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workstations.update_workstation_cluster.js + * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstationCluster_async + */ + updateWorkstationCluster( + request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateWorkstationCluster( + request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstationCluster( + request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstationCluster( + request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workstation_cluster.name': request.workstationCluster!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateWorkstationCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateWorkstationCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workstations.update_workstation_cluster.js + * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstationCluster_async + */ + async checkUpdateWorkstationClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the specified workstation cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workstation cluster to delete. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not apply it. + * @param {string} request.etag + * If set, the request will be rejected if the latest version of the + * workstation cluster on the server does not have this ETag. + * @param {boolean} request.force + * If set, any workstation configurations and workstations in the + * workstation cluster are also deleted. Otherwise, the request only + * works if the workstation cluster has no configurations or workstations. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workstations.delete_workstation_cluster.js + * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstationCluster_async + */ + deleteWorkstationCluster( + request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteWorkstationCluster( + request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstationCluster( + request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstationCluster( + request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteWorkstationCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteWorkstationCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workstations.delete_workstation_cluster.js + * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstationCluster_async + */ + async checkDeleteWorkstationClusterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new workstation configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {string} request.workstationConfigId + * Required. ID to use for the workstation configuration. + * @param {google.cloud.workstations.v1beta.WorkstationConfig} request.workstationConfig + * Required. Config to create. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workstations.create_workstation_config.js + * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstationConfig_async + */ + createWorkstationConfig( + request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createWorkstationConfig( + request: protos.google.cloud.workstations.v1beta.ICreateWorkstationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstationConfig( + request: protos.google.cloud.workstations.v1beta.ICreateWorkstationConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstationConfig( + request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createWorkstationConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createWorkstationConfig()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workstations.create_workstation_config.js + * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstationConfig_async + */ + async checkCreateWorkstationConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing workstation configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workstations.v1beta.WorkstationConfig} request.workstationConfig + * Required. Config to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask specifying which fields in the workstation configuration + * should be updated. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {boolean} request.allowMissing + * If set and the workstation configuration is not found, a new + * workstation configuration will be created. In this situation, + * update_mask is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workstations.update_workstation_config.js + * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstationConfig_async + */ + updateWorkstationConfig( + request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateWorkstationConfig( + request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstationConfig( + request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstationConfig( + request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workstation_config.name': request.workstationConfig!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateWorkstationConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateWorkstationConfig()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workstations.update_workstation_config.js + * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstationConfig_async + */ + async checkUpdateWorkstationConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the specified workstation configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workstation configuration to delete. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {string} request.etag + * If set, the request is rejected if the latest version of the + * workstation configuration on the server does not have this ETag. + * @param {boolean} request.force + * If set, any workstations in the workstation configuration are also deleted. + * Otherwise, the request works only if the workstation configuration has + * no workstations. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workstations.delete_workstation_config.js + * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstationConfig_async + */ + deleteWorkstationConfig( + request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteWorkstationConfig( + request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstationConfig( + request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstationConfig( + request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteWorkstationConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteWorkstationConfig()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workstations.delete_workstation_config.js + * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstationConfig_async + */ + async checkDeleteWorkstationConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new workstation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {string} request.workstationId + * Required. ID to use for the workstation. + * @param {google.cloud.workstations.v1beta.Workstation} request.workstation + * Required. Workstation to create. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workstations.create_workstation.js + * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstation_async + */ + createWorkstation( + request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createWorkstation( + request: protos.google.cloud.workstations.v1beta.ICreateWorkstationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstation( + request: protos.google.cloud.workstations.v1beta.ICreateWorkstationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkstation( + request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createWorkstation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createWorkstation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workstations.create_workstation.js + * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstation_async + */ + async checkCreateWorkstationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an existing workstation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workstations.v1beta.Workstation} request.workstation + * Required. Workstation to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask specifying which fields in the workstation configuration + * should be updated. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {boolean} request.allowMissing + * If set and the workstation configuration is not found, a new + * workstation configuration is created. In this situation, update_mask + * is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workstations.update_workstation.js + * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstation_async + */ + updateWorkstation( + request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateWorkstation( + request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstation( + request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkstation( + request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workstation.name': request.workstation!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateWorkstation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateWorkstation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workstations.update_workstation.js + * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstation_async + */ + async checkUpdateWorkstationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the specified workstation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workstation to delete. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {string} request.etag + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workstations.delete_workstation.js + * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstation_async + */ + deleteWorkstation( + request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteWorkstation( + request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstation( + request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkstation( + request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteWorkstation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteWorkstation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workstations.delete_workstation.js + * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstation_async + */ + async checkDeleteWorkstationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Starts running a workstation so that users can connect to it. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workstation to start. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {string} request.etag + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workstations.start_workstation.js + * region_tag:workstations_v1beta_generated_Workstations_StartWorkstation_async + */ + startWorkstation( + request?: protos.google.cloud.workstations.v1beta.IStartWorkstationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + startWorkstation( + request: protos.google.cloud.workstations.v1beta.IStartWorkstationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startWorkstation( + request: protos.google.cloud.workstations.v1beta.IStartWorkstationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startWorkstation( + request?: protos.google.cloud.workstations.v1beta.IStartWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.startWorkstation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `startWorkstation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workstations.start_workstation.js + * region_tag:workstations_v1beta_generated_Workstations_StartWorkstation_async + */ + async checkStartWorkstationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.startWorkstation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Stops running a workstation, reducing costs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workstation to stop. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * apply it. + * @param {string} request.etag + * If set, the request will be rejected if the latest version of the + * workstation on the server does not have this 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workstations.stop_workstation.js + * region_tag:workstations_v1beta_generated_Workstations_StopWorkstation_async + */ + stopWorkstation( + request?: protos.google.cloud.workstations.v1beta.IStopWorkstationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + stopWorkstation( + request: protos.google.cloud.workstations.v1beta.IStopWorkstationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopWorkstation( + request: protos.google.cloud.workstations.v1beta.IStopWorkstationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopWorkstation( + request?: protos.google.cloud.workstations.v1beta.IStopWorkstationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.stopWorkstation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `stopWorkstation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workstations.stop_workstation.js + * region_tag:workstations_v1beta_generated_Workstations_StopWorkstation_async + */ + async checkStopWorkstationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.stopWorkstation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Returns all workstation clusters in the specified location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationCluster|WorkstationCluster}. + * 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 `listWorkstationClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstationClusters( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstationCluster[], + protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest|null, + protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse + ]>; + listWorkstationClusters( + request: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationCluster>): void; + listWorkstationClusters( + request: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, + callback: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationCluster>): void; + listWorkstationClusters( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationCluster>, + callback?: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationCluster>): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstationCluster[], + protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest|null, + protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listWorkstationClusters(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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationCluster|WorkstationCluster} 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 `listWorkstationClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstationClustersStream( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, + 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['listWorkstationClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstationClusters.createStream( + this.innerApiCalls.listWorkstationClusters as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listWorkstationClusters`, 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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationCluster|WorkstationCluster}. 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/workstations.list_workstation_clusters.js + * region_tag:workstations_v1beta_generated_Workstations_ListWorkstationClusters_async + */ + listWorkstationClustersAsync( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, + 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['listWorkstationClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstationClusters.asyncIterate( + this.innerApiCalls['listWorkstationClusters'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns all workstation configurations in the specified cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig}. + * 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 `listWorkstationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstationConfigs( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstationConfig[], + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest|null, + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse + ]>; + listWorkstationConfigs( + request: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationConfig>): void; + listWorkstationConfigs( + request: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationConfig>): void; + listWorkstationConfigs( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationConfig>, + callback?: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationConfig>): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstationConfig[], + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest|null, + protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listWorkstationConfigs(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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig} 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 `listWorkstationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstationConfigsStream( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, + 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['listWorkstationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstationConfigs.createStream( + this.innerApiCalls.listWorkstationConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listWorkstationConfigs`, 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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig}. 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/workstations.list_workstation_configs.js + * region_tag:workstations_v1beta_generated_Workstations_ListWorkstationConfigs_async + */ + listWorkstationConfigsAsync( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, + 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['listWorkstationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstationConfigs.asyncIterate( + this.innerApiCalls['listWorkstationConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns all workstation configurations in the specified cluster on which + * the caller has the "workstations.workstation.create" permission. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig}. + * 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 `listUsableWorkstationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableWorkstationConfigs( + request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstationConfig[], + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest|null, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse + ]>; + listUsableWorkstationConfigs( + request: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationConfig>): void; + listUsableWorkstationConfigs( + request: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationConfig>): void; + listUsableWorkstationConfigs( + request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationConfig>, + callback?: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstationConfig>): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstationConfig[], + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest|null, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listUsableWorkstationConfigs(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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig} 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 `listUsableWorkstationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableWorkstationConfigsStream( + request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, + 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['listUsableWorkstationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableWorkstationConfigs.createStream( + this.innerApiCalls.listUsableWorkstationConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listUsableWorkstationConfigs`, 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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig}. 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/workstations.list_usable_workstation_configs.js + * region_tag:workstations_v1beta_generated_Workstations_ListUsableWorkstationConfigs_async + */ + listUsableWorkstationConfigsAsync( + request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, + 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['listUsableWorkstationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableWorkstationConfigs.asyncIterate( + this.innerApiCalls['listUsableWorkstationConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns all Workstations using the specified workstation configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation}. + * 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 `listWorkstationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstations( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstation[], + protos.google.cloud.workstations.v1beta.IListWorkstationsRequest|null, + protos.google.cloud.workstations.v1beta.IListWorkstationsResponse + ]>; + listWorkstations( + request: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstation>): void; + listWorkstations( + request: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, + callback: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstation>): void; + listWorkstations( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstation>, + callback?: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, + protos.google.cloud.workstations.v1beta.IListWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstation>): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstation[], + protos.google.cloud.workstations.v1beta.IListWorkstationsRequest|null, + protos.google.cloud.workstations.v1beta.IListWorkstationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listWorkstations(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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation} 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 `listWorkstationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkstationsStream( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, + 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['listWorkstations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstations.createStream( + this.innerApiCalls.listWorkstations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listWorkstations`, 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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation}. 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/workstations.list_workstations.js + * region_tag:workstations_v1beta_generated_Workstations_ListWorkstations_async + */ + listWorkstationsAsync( + request?: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, + 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['listWorkstations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkstations.asyncIterate( + this.innerApiCalls['listWorkstations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns all workstations using the specified workstation configuration + * on which the caller has the "workstations.workstations.use" permission. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation}. + * 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 `listUsableWorkstationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableWorkstations( + request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstation[], + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest|null, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse + ]>; + listUsableWorkstations( + request: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstation>): void; + listUsableWorkstations( + request: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, + callback: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstation>): void; + listUsableWorkstations( + request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstation>, + callback?: PaginationCallback< + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse|null|undefined, + protos.google.cloud.workstations.v1beta.IWorkstation>): + Promise<[ + protos.google.cloud.workstations.v1beta.IWorkstation[], + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest|null, + protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listUsableWorkstations(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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation} 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 `listUsableWorkstationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableWorkstationsStream( + request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, + 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['listUsableWorkstations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableWorkstations.createStream( + this.innerApiCalls.listUsableWorkstations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listUsableWorkstations`, 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 resource name. + * @param {number} request.pageSize + * Maximum number of items to return. + * @param {string} request.pageToken + * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation}. 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/workstations.list_usable_workstations.js + * region_tag:workstations_v1beta_generated_Workstations_ListUsableWorkstations_async + */ + listUsableWorkstationsAsync( + request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, + 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['listUsableWorkstations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableWorkstations.asyncIterate( + this.innerApiCalls['listUsableWorkstations'] 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 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 workstation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workstation_cluster + * @param {string} workstation_config + * @param {string} workstation + * @returns {string} Resource name string. + */ + workstationPath(project:string,location:string,workstationCluster:string,workstationConfig:string,workstation:string) { + return this.pathTemplates.workstationPathTemplate.render({ + project: project, + location: location, + workstation_cluster: workstationCluster, + workstation_config: workstationConfig, + workstation: workstation, + }); + } + + /** + * Parse the project from Workstation resource. + * + * @param {string} workstationName + * A fully-qualified path representing Workstation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkstationName(workstationName: string) { + return this.pathTemplates.workstationPathTemplate.match(workstationName).project; + } + + /** + * Parse the location from Workstation resource. + * + * @param {string} workstationName + * A fully-qualified path representing Workstation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkstationName(workstationName: string) { + return this.pathTemplates.workstationPathTemplate.match(workstationName).location; + } + + /** + * Parse the workstation_cluster from Workstation resource. + * + * @param {string} workstationName + * A fully-qualified path representing Workstation resource. + * @returns {string} A string representing the workstation_cluster. + */ + matchWorkstationClusterFromWorkstationName(workstationName: string) { + return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation_cluster; + } + + /** + * Parse the workstation_config from Workstation resource. + * + * @param {string} workstationName + * A fully-qualified path representing Workstation resource. + * @returns {string} A string representing the workstation_config. + */ + matchWorkstationConfigFromWorkstationName(workstationName: string) { + return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation_config; + } + + /** + * Parse the workstation from Workstation resource. + * + * @param {string} workstationName + * A fully-qualified path representing Workstation resource. + * @returns {string} A string representing the workstation. + */ + matchWorkstationFromWorkstationName(workstationName: string) { + return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation; + } + + /** + * Return a fully-qualified workstationCluster resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workstation_cluster + * @returns {string} Resource name string. + */ + workstationClusterPath(project:string,location:string,workstationCluster:string) { + return this.pathTemplates.workstationClusterPathTemplate.render({ + project: project, + location: location, + workstation_cluster: workstationCluster, + }); + } + + /** + * Parse the project from WorkstationCluster resource. + * + * @param {string} workstationClusterName + * A fully-qualified path representing WorkstationCluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkstationClusterName(workstationClusterName: string) { + return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).project; + } + + /** + * Parse the location from WorkstationCluster resource. + * + * @param {string} workstationClusterName + * A fully-qualified path representing WorkstationCluster resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkstationClusterName(workstationClusterName: string) { + return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).location; + } + + /** + * Parse the workstation_cluster from WorkstationCluster resource. + * + * @param {string} workstationClusterName + * A fully-qualified path representing WorkstationCluster resource. + * @returns {string} A string representing the workstation_cluster. + */ + matchWorkstationClusterFromWorkstationClusterName(workstationClusterName: string) { + return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).workstation_cluster; + } + + /** + * Return a fully-qualified workstationConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workstation_cluster + * @param {string} workstation_config + * @returns {string} Resource name string. + */ + workstationConfigPath(project:string,location:string,workstationCluster:string,workstationConfig:string) { + return this.pathTemplates.workstationConfigPathTemplate.render({ + project: project, + location: location, + workstation_cluster: workstationCluster, + workstation_config: workstationConfig, + }); + } + + /** + * Parse the project from WorkstationConfig resource. + * + * @param {string} workstationConfigName + * A fully-qualified path representing WorkstationConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkstationConfigName(workstationConfigName: string) { + return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).project; + } + + /** + * Parse the location from WorkstationConfig resource. + * + * @param {string} workstationConfigName + * A fully-qualified path representing WorkstationConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkstationConfigName(workstationConfigName: string) { + return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).location; + } + + /** + * Parse the workstation_cluster from WorkstationConfig resource. + * + * @param {string} workstationConfigName + * A fully-qualified path representing WorkstationConfig resource. + * @returns {string} A string representing the workstation_cluster. + */ + matchWorkstationClusterFromWorkstationConfigName(workstationConfigName: string) { + return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).workstation_cluster; + } + + /** + * Parse the workstation_config from WorkstationConfig resource. + * + * @param {string} workstationConfigName + * A fully-qualified path representing WorkstationConfig resource. + * @returns {string} A string representing the workstation_config. + */ + matchWorkstationConfigFromWorkstationConfigName(workstationConfigName: string) { + return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).workstation_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.workstationsStub && !this._terminated) { + return this.workstationsStub.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-workstations/v1beta/src/v1beta/workstations_client_config.json b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client_config.json new file mode 100644 index 00000000000..4562a0c7736 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client_config.json @@ -0,0 +1,138 @@ +{ + "interfaces": { + "google.cloud.workstations.v1beta.Workstations": { + "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": { + "GetWorkstationCluster": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListWorkstationClusters": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateWorkstationCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkstationCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteWorkstationCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetWorkstationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListWorkstationConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListUsableWorkstationConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateWorkstationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkstationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteWorkstationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListWorkstations": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListUsableWorkstations": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StopWorkstation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateAccessToken": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_proto_list.json b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_proto_list.json new file mode 100644 index 00000000000..8903eb0e8bd --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/workstations/v1beta/workstations.proto" +] diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..baefb289660 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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 workstations = require('@google-cloud/workstations'); + +function main() { + const workstationsClient = new workstations.WorkstationsClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..74cd8e0b246 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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 {WorkstationsClient} from '@google-cloud/workstations'; + +// check that the client class type name can be used +function doStuffWithWorkstationsClient(client: WorkstationsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const workstationsClient = new WorkstationsClient(); + doStuffWithWorkstationsClient(workstationsClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-workstations/v1beta/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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-workstations/v1beta/test/gapic_workstations_v1beta.ts b/owl-bot-staging/google-cloud-workstations/v1beta/test/gapic_workstations_v1beta.ts new file mode 100644 index 00000000000..185427a6376 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/v1beta/test/gapic_workstations_v1beta.ts @@ -0,0 +1,4506 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 workstationsModule 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.WorkstationsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = workstationsModule.v1beta.WorkstationsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = workstationsModule.v1beta.WorkstationsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = workstationsModule.v1beta.WorkstationsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new workstationsModule.v1beta.WorkstationsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workstationsStub, undefined); + await client.initialize(); + assert(client.workstationsStub); + }); + + it('has close method for the initialized client', done => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.workstationsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workstationsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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('getWorkstationCluster', () => { + it('invokes getWorkstationCluster without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.WorkstationCluster() + ); + client.innerApiCalls.getWorkstationCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkstationCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationCluster without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.WorkstationCluster() + ); + client.innerApiCalls.getWorkstationCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkstationCluster( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstationCluster|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationCluster with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkstationCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkstationCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationCluster with closed client', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkstationCluster(request), expectedError); + }); + }); + + describe('getWorkstationConfig', () => { + it('invokes getWorkstationConfig without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.WorkstationConfig() + ); + client.innerApiCalls.getWorkstationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkstationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationConfig without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.WorkstationConfig() + ); + client.innerApiCalls.getWorkstationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkstationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationConfig with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkstationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkstationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstationConfig with closed client', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkstationConfig(request), expectedError); + }); + }); + + describe('getWorkstation', () => { + it('invokes getWorkstation without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.Workstation() + ); + client.innerApiCalls.getWorkstation = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkstation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstation without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.Workstation() + ); + client.innerApiCalls.getWorkstation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkstation( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstation with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkstation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkstation with closed client', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GetWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkstation(request), expectedError); + }); + }); + + describe('generateAccessToken', () => { + it('invokes generateAccessToken without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GenerateAccessTokenRequest', ['workstation']); + request.workstation = defaultValue1; + const expectedHeaderRequestParams = `workstation=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GenerateAccessTokenResponse() + ); + client.innerApiCalls.generateAccessToken = stubSimpleCall(expectedResponse); + const [response] = await client.generateAccessToken(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAccessToken without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GenerateAccessTokenRequest', ['workstation']); + request.workstation = defaultValue1; + const expectedHeaderRequestParams = `workstation=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GenerateAccessTokenResponse() + ); + client.innerApiCalls.generateAccessToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateAccessToken( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAccessToken with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GenerateAccessTokenRequest', ['workstation']); + request.workstation = defaultValue1; + const expectedHeaderRequestParams = `workstation=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateAccessToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateAccessToken(request), expectedError); + const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAccessToken with closed client', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.GenerateAccessTokenRequest', ['workstation']); + request.workstation = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateAccessToken(request), expectedError); + }); + }); + + describe('createWorkstationCluster', () => { + it('invokes createWorkstationCluster without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkstationCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationCluster without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkstationCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationCluster with call error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkstationCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationCluster with LRO error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkstationCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateWorkstationClusterProgress without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkstationClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkstationClusterProgress with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkstationClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateWorkstationCluster', () => { + it('invokes updateWorkstationCluster without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest() + ); + request.workstationCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); + request.workstationCluster.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkstationCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationCluster without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest() + ); + request.workstationCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); + request.workstationCluster.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkstationCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationCluster with call error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest() + ); + request.workstationCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); + request.workstationCluster.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkstationCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationCluster with LRO error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest() + ); + request.workstationCluster ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); + request.workstationCluster.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkstationCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateWorkstationClusterProgress without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkstationClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkstationClusterProgress with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkstationClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteWorkstationCluster', () => { + it('invokes deleteWorkstationCluster without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkstationCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationCluster without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkstationCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationCluster with call error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkstationCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationCluster with LRO error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkstationCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteWorkstationClusterProgress without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkstationClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkstationClusterProgress with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkstationClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createWorkstationConfig', () => { + it('invokes createWorkstationConfig without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkstationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationConfig without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkstationConfig( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationConfig with call error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkstationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstationConfig with LRO error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkstationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateWorkstationConfigProgress without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkstationConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkstationConfigProgress with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkstationConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateWorkstationConfig', () => { + it('invokes updateWorkstationConfig without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest() + ); + request.workstationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); + request.workstationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkstationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationConfig without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest() + ); + request.workstationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); + request.workstationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkstationConfig( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationConfig with call error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest() + ); + request.workstationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); + request.workstationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkstationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstationConfig with LRO error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest() + ); + request.workstationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); + request.workstationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkstationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateWorkstationConfigProgress without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkstationConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkstationConfigProgress with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkstationConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteWorkstationConfig', () => { + it('invokes deleteWorkstationConfig without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkstationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationConfig without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkstationConfig( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationConfig with call error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkstationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstationConfig with LRO error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkstationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteWorkstationConfigProgress without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkstationConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkstationConfigProgress with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkstationConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createWorkstation', () => { + it('invokes createWorkstation without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstation = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkstation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstation without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkstation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkstation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstation with call error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkstation with LRO error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.CreateWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkstation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkstation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateWorkstationProgress without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkstationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkstationProgress with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkstationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateWorkstation', () => { + it('invokes updateWorkstation without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationRequest() + ); + request.workstation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationRequest', ['workstation', 'name']); + request.workstation.name = defaultValue1; + const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstation = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkstation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstation without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationRequest() + ); + request.workstation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationRequest', ['workstation', 'name']); + request.workstation.name = defaultValue1; + const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkstation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkstation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstation with call error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationRequest() + ); + request.workstation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationRequest', ['workstation', 'name']); + request.workstation.name = defaultValue1; + const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkstation with LRO error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.UpdateWorkstationRequest() + ); + request.workstation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationRequest', ['workstation', 'name']); + request.workstation.name = defaultValue1; + const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkstation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkstation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateWorkstationProgress without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkstationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkstationProgress with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkstationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteWorkstation', () => { + it('invokes deleteWorkstation without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstation = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkstation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstation without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkstation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkstation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstation with call error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkstation with LRO error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.DeleteWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkstation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkstation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteWorkstationProgress without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkstationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkstationProgress with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkstationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('startWorkstation', () => { + it('invokes startWorkstation without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.StartWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.StartWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startWorkstation = stubLongRunningCall(expectedResponse); + const [operation] = await client.startWorkstation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startWorkstation without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.StartWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.StartWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startWorkstation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startWorkstation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startWorkstation with call error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.StartWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.StartWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startWorkstation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.startWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startWorkstation with LRO error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.StartWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.StartWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startWorkstation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.startWorkstation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStartWorkstationProgress without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkStartWorkstationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStartWorkstationProgress with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkStartWorkstationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('stopWorkstation', () => { + it('invokes stopWorkstation without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.StopWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.StopWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopWorkstation = stubLongRunningCall(expectedResponse); + const [operation] = await client.stopWorkstation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopWorkstation without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.StopWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.StopWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopWorkstation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopWorkstation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopWorkstation with call error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.StopWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.StopWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopWorkstation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.stopWorkstation(request), expectedError); + const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopWorkstation with LRO error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.StopWorkstationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.StopWorkstationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopWorkstation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.stopWorkstation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStopWorkstationProgress without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkStopWorkstationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStopWorkstationProgress with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkStopWorkstationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listWorkstationClusters', () => { + it('invokes listWorkstationClusters without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + ]; + client.innerApiCalls.listWorkstationClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkstationClusters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationClusters without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + ]; + client.innerApiCalls.listWorkstationClusters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkstationClusters( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstationCluster[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationClusters with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkstationClusters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkstationClusters(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationClustersStream without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + ]; + client.descriptors.page.listWorkstationClusters.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkstationClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1beta.WorkstationCluster[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationCluster) => { + 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.listWorkstationClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstationClusters, request)); + assert( + (client.descriptors.page.listWorkstationClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkstationClustersStream with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstationClusters.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkstationClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1beta.WorkstationCluster[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationCluster) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkstationClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstationClusters, request)); + assert( + (client.descriptors.page.listWorkstationClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstationClusters without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), + ]; + client.descriptors.page.listWorkstationClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workstations.v1beta.IWorkstationCluster[] = []; + const iterable = client.listWorkstationClustersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstationClusters with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstationClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkstationClustersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workstations.v1beta.IWorkstationCluster[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listWorkstationConfigs', () => { + it('invokes listWorkstationConfigs without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + ]; + client.innerApiCalls.listWorkstationConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkstationConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationConfigs without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + ]; + client.innerApiCalls.listWorkstationConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkstationConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstationConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationConfigs with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkstationConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkstationConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationConfigsStream without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + ]; + client.descriptors.page.listWorkstationConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkstationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1beta.WorkstationConfig[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationConfig) => { + 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.listWorkstationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstationConfigs, request)); + assert( + (client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkstationConfigsStream with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkstationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1beta.WorkstationConfig[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstationConfigs, request)); + assert( + (client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstationConfigs without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + ]; + client.descriptors.page.listWorkstationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workstations.v1beta.IWorkstationConfig[] = []; + const iterable = client.listWorkstationConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstationConfigs with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkstationConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workstations.v1beta.IWorkstationConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listUsableWorkstationConfigs', () => { + it('invokes listUsableWorkstationConfigs without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + ]; + client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listUsableWorkstationConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstationConfigs without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + ]; + client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUsableWorkstationConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstationConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstationConfigs with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listUsableWorkstationConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstationConfigsStream without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + ]; + client.descriptors.page.listUsableWorkstationConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listUsableWorkstationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1beta.WorkstationConfig[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationConfig) => { + 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.listUsableWorkstationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstationConfigs, request)); + assert( + (client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listUsableWorkstationConfigsStream with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableWorkstationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listUsableWorkstationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1beta.WorkstationConfig[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstationConfigs, request)); + assert( + (client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableWorkstationConfigs without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), + ]; + client.descriptors.page.listUsableWorkstationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workstations.v1beta.IWorkstationConfig[] = []; + const iterable = client.listUsableWorkstationConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableWorkstationConfigs with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableWorkstationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUsableWorkstationConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workstations.v1beta.IWorkstationConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listWorkstations', () => { + it('invokes listWorkstations without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + ]; + client.innerApiCalls.listWorkstations = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkstations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstations without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + ]; + client.innerApiCalls.listWorkstations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkstations( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstations with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkstations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkstations(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkstationsStream without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + ]; + client.descriptors.page.listWorkstations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkstationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1beta.Workstation[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1beta.Workstation) => { + 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.listWorkstations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstations, request)); + assert( + (client.descriptors.page.listWorkstations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkstationsStream with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkstationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1beta.Workstation[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1beta.Workstation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkstations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkstations, request)); + assert( + (client.descriptors.page.listWorkstations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstations without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + ]; + client.descriptors.page.listWorkstations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workstations.v1beta.IWorkstation[] = []; + const iterable = client.listWorkstationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkstations with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkstations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkstationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workstations.v1beta.IWorkstation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listUsableWorkstations', () => { + it('invokes listUsableWorkstations without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + ]; + client.innerApiCalls.listUsableWorkstations = stubSimpleCall(expectedResponse); + const [response] = await client.listUsableWorkstations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstations without error using callback', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + ]; + client.innerApiCalls.listUsableWorkstations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUsableWorkstations( + request, + (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstations with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listUsableWorkstations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listUsableWorkstations(request), expectedError); + const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableWorkstationsStream without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + ]; + client.descriptors.page.listUsableWorkstations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listUsableWorkstationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1beta.Workstation[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1beta.Workstation) => { + 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.listUsableWorkstations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstations, request)); + assert( + (client.descriptors.page.listUsableWorkstations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listUsableWorkstationsStream with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableWorkstations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listUsableWorkstationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workstations.v1beta.Workstation[] = []; + stream.on('data', (response: protos.google.cloud.workstations.v1beta.Workstation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listUsableWorkstations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstations, request)); + assert( + (client.descriptors.page.listUsableWorkstations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableWorkstations without error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), + ]; + client.descriptors.page.listUsableWorkstations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workstations.v1beta.IWorkstation[] = []; + const iterable = client.listUsableWorkstationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableWorkstations with error', async () => { + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableWorkstations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUsableWorkstationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workstations.v1beta.IWorkstation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableWorkstations.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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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 workstationsModule.v1beta.WorkstationsClient({ + 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('workstation', () => { + const fakePath = "/rendered/path/workstation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workstation_cluster: "workstationClusterValue", + workstation_config: "workstationConfigValue", + workstation: "workstationValue", + }; + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workstationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workstationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workstationPath', () => { + const result = client.workstationPath("projectValue", "locationValue", "workstationClusterValue", "workstationConfigValue", "workstationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workstationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkstationName', () => { + const result = client.matchProjectFromWorkstationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkstationName', () => { + const result = client.matchLocationFromWorkstationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationClusterFromWorkstationName', () => { + const result = client.matchWorkstationClusterFromWorkstationName(fakePath); + assert.strictEqual(result, "workstationClusterValue"); + assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationConfigFromWorkstationName', () => { + const result = client.matchWorkstationConfigFromWorkstationName(fakePath); + assert.strictEqual(result, "workstationConfigValue"); + assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationFromWorkstationName', () => { + const result = client.matchWorkstationFromWorkstationName(fakePath); + assert.strictEqual(result, "workstationValue"); + assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workstationCluster', () => { + const fakePath = "/rendered/path/workstationCluster"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workstation_cluster: "workstationClusterValue", + }; + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workstationClusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workstationClusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workstationClusterPath', () => { + const result = client.workstationClusterPath("projectValue", "locationValue", "workstationClusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workstationClusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkstationClusterName', () => { + const result = client.matchProjectFromWorkstationClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkstationClusterName', () => { + const result = client.matchLocationFromWorkstationClusterName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationClusterFromWorkstationClusterName', () => { + const result = client.matchWorkstationClusterFromWorkstationClusterName(fakePath); + assert.strictEqual(result, "workstationClusterValue"); + assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workstationConfig', () => { + const fakePath = "/rendered/path/workstationConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workstation_cluster: "workstationClusterValue", + workstation_config: "workstationConfigValue", + }; + const client = new workstationsModule.v1beta.WorkstationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workstationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workstationConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workstationConfigPath', () => { + const result = client.workstationConfigPath("projectValue", "locationValue", "workstationClusterValue", "workstationConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workstationConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkstationConfigName', () => { + const result = client.matchProjectFromWorkstationConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkstationConfigName', () => { + const result = client.matchLocationFromWorkstationConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationClusterFromWorkstationConfigName', () => { + const result = client.matchWorkstationClusterFromWorkstationConfigName(fakePath); + assert.strictEqual(result, "workstationClusterValue"); + assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkstationConfigFromWorkstationConfigName', () => { + const result = client.matchWorkstationConfigFromWorkstationConfigName(fakePath); + assert.strictEqual(result, "workstationConfigValue"); + assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-workstations/v1beta/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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-workstations/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-workstations/v1beta/webpack.config.js new file mode 100644 index 00000000000..46aed65f9a2 --- /dev/null +++ b/owl-bot-staging/google-cloud-workstations/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: 'Workstations', + filename: './workstations.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-container/v1/.eslintignore b/owl-bot-staging/google-container/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-container/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-container/v1/.eslintrc.json b/owl-bot-staging/google-container/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-container/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-container/v1/.gitignore b/owl-bot-staging/google-container/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-container/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-container/v1/.jsdoc.js b/owl-bot-staging/google-container/v1/.jsdoc.js new file mode 100644 index 00000000000..6dc18e81193 --- /dev/null +++ b/owl-bot-staging/google-container/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/container', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-container/v1/.mocharc.js b/owl-bot-staging/google-container/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-container/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-container/v1/.prettierrc.js b/owl-bot-staging/google-container/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-container/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-container/v1/README.md b/owl-bot-staging/google-container/v1/README.md new file mode 100644 index 00000000000..f32441d7e6b --- /dev/null +++ b/owl-bot-staging/google-container/v1/README.md @@ -0,0 +1 @@ +Container: Nodejs Client diff --git a/owl-bot-staging/google-container/v1/package.json b/owl-bot-staging/google-container/v1/package.json new file mode 100644 index 00000000000..b2ac12ed35f --- /dev/null +++ b/owl-bot-staging/google-container/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/container", + "version": "0.1.0", + "description": "Container client for Node.js", + "repository": "googleapis/nodejs-container", + "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 container", + "container", + "cluster 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-container/v1/protos/google/container/v1/cluster_service.proto b/owl-bot-staging/google-container/v1/protos/google/container/v1/cluster_service.proto new file mode 100644 index 00000000000..4af79729da6 --- /dev/null +++ b/owl-bot-staging/google-container/v1/protos/google/container/v1/cluster_service.proto @@ -0,0 +1,5214 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.container.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/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/rpc/code.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Container.V1"; +option go_package = "cloud.google.com/go/container/apiv1/containerpb;containerpb"; +option java_multiple_files = true; +option java_outer_classname = "ClusterServiceProto"; +option java_package = "com.google.container.v1"; +option php_namespace = "Google\\Cloud\\Container\\V1"; +option ruby_package = "Google::Cloud::Container::V1"; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; + +// Google Kubernetes Engine Cluster Manager v1 +service ClusterManager { + option (google.api.default_host) = "container.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all clusters owned by a project in either the specified zone or all + // zones. + rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/clusters" + additional_bindings { + get: "/v1/projects/{project_id}/zones/{zone}/clusters" + } + }; + option (google.api.method_signature) = "project_id,zone"; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a specific cluster. + rpc GetCluster(GetClusterRequest) returns (Cluster) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/clusters/*}" + additional_bindings { + get: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id"; + option (google.api.method_signature) = "name"; + } + + // Creates a cluster, consisting of the specified number and type of Google + // Compute Engine instances. + // + // By default, the cluster is created in the project's + // [default + // network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). + // + // One firewall is added for the cluster. After cluster creation, + // the Kubelet creates routes for each node to allow the containers + // on that node to communicate with all other instances in the + // cluster. + // + // Finally, an entry is added to the project's global metadata indicating + // which CIDR range the cluster is using. + rpc CreateCluster(CreateClusterRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/clusters" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster"; + option (google.api.method_signature) = "parent,cluster"; + } + + // Updates the settings of a specific cluster. + rpc UpdateCluster(UpdateClusterRequest) returns (Operation) { + option (google.api.http) = { + put: "/v1/{name=projects/*/locations/*/clusters/*}" + body: "*" + additional_bindings { + put: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id,update"; + option (google.api.method_signature) = "name,update"; + } + + // Updates the version and/or image type for the specified node pool. + rpc UpdateNodePool(UpdateNodePoolRequest) returns (Operation) { + option (google.api.http) = { + put: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/update" + body: "*" + } + }; + } + + // Sets the autoscaling settings for the specified node pool. + rpc SetNodePoolAutoscaling(SetNodePoolAutoscalingRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setAutoscaling" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/autoscaling" + body: "*" + } + }; + } + + // Sets the logging service for a specific cluster. + rpc SetLoggingService(SetLoggingServiceRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:setLogging" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/logging" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,logging_service"; + option (google.api.method_signature) = "name,logging_service"; + } + + // Sets the monitoring service for a specific cluster. + rpc SetMonitoringService(SetMonitoringServiceRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:setMonitoring" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/monitoring" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,monitoring_service"; + option (google.api.method_signature) = "name,monitoring_service"; + } + + // Sets the addons for a specific cluster. + rpc SetAddonsConfig(SetAddonsConfigRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:setAddons" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/addons" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,addons_config"; + option (google.api.method_signature) = "name,addons_config"; + } + + // Sets the locations for a specific cluster. + // Deprecated. Use + // [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/update) + // instead. + rpc SetLocations(SetLocationsRequest) returns (Operation) { + option deprecated = true; + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:setLocations" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/locations" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,locations"; + option (google.api.method_signature) = "name,locations"; + } + + // Updates the master for a specific cluster. + rpc UpdateMaster(UpdateMasterRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:updateMaster" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/master" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,master_version"; + option (google.api.method_signature) = "name,master_version"; + } + + // Sets master auth materials. Currently supports changing the admin password + // or a specific cluster, either via password generation or explicitly setting + // the password. + rpc SetMasterAuth(SetMasterAuthRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:setMasterAuth" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMasterAuth" + body: "*" + } + }; + } + + // Deletes the cluster, including the Kubernetes endpoint and all worker + // nodes. + // + // Firewalls and routes that were configured during cluster creation + // are also deleted. + // + // Other Google Compute Engine resources that might be in use by the cluster, + // such as load balancer resources, are not deleted if they weren't present + // when the cluster was initially created. + rpc DeleteCluster(DeleteClusterRequest) returns (Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/clusters/*}" + additional_bindings { + delete: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id"; + option (google.api.method_signature) = "name"; + } + + // Lists all operations in a project in a specific zone or all zones. + rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/operations" + additional_bindings { + get: "/v1/projects/{project_id}/zones/{zone}/operations" + } + }; + option (google.api.method_signature) = "project_id,zone"; + } + + // Gets the specified operation. + rpc GetOperation(GetOperationRequest) returns (Operation) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/operations/*}" + additional_bindings { + get: "/v1/projects/{project_id}/zones/{zone}/operations/{operation_id}" + } + }; + option (google.api.method_signature) = "project_id,zone,operation_id"; + option (google.api.method_signature) = "name"; + } + + // Cancels the specified operation. + rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/operations/*}:cancel" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/operations/{operation_id}:cancel" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,operation_id"; + option (google.api.method_signature) = "name"; + } + + // Returns configuration info about the Google Kubernetes Engine service. + rpc GetServerConfig(GetServerConfigRequest) returns (ServerConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*}/serverConfig" + additional_bindings { + get: "/v1/projects/{project_id}/zones/{zone}/serverconfig" + } + }; + option (google.api.method_signature) = "project_id,zone"; + option (google.api.method_signature) = "name"; + } + + // Gets the public component of the cluster signing keys in + // JSON Web Key format. + // This API is not yet intended for general use, and is not available for all + // clusters. + rpc GetJSONWebKeys(GetJSONWebKeysRequest) returns (GetJSONWebKeysResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/clusters/*}/jwks" + }; + } + + // Lists the node pools for a cluster. + rpc ListNodePools(ListNodePoolsRequest) returns (ListNodePoolsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/clusters/*}/nodePools" + additional_bindings { + get: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id"; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the requested node pool. + rpc GetNodePool(GetNodePoolRequest) returns (NodePool) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}" + additional_bindings { + get: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,node_pool_id"; + option (google.api.method_signature) = "name"; + } + + // Creates a node pool for a cluster. + rpc CreateNodePool(CreateNodePoolRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/clusters/*}/nodePools" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,node_pool"; + option (google.api.method_signature) = "parent,node_pool"; + } + + // Deletes a node pool from a cluster. + rpc DeleteNodePool(DeleteNodePoolRequest) returns (Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}" + additional_bindings { + delete: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,node_pool_id"; + option (google.api.method_signature) = "name"; + } + + // CompleteNodePoolUpgrade will signal an on-going node pool upgrade to + // complete. + rpc CompleteNodePoolUpgrade(CompleteNodePoolUpgradeRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:completeUpgrade" + body: "*" + }; + } + + // Rolls back a previously Aborted or Failed NodePool upgrade. + // This makes no changes if the last upgrade successfully completed. + rpc RollbackNodePoolUpgrade(RollbackNodePoolUpgradeRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:rollback" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}:rollback" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,node_pool_id"; + option (google.api.method_signature) = "name"; + } + + // Sets the NodeManagement options for a node pool. + rpc SetNodePoolManagement(SetNodePoolManagementRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setManagement" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setManagement" + body: "*" + } + }; + } + + // Sets labels on a cluster. + rpc SetLabels(SetLabelsRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:setResourceLabels" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/resourceLabels" + body: "*" + } + }; + } + + // Enables or disables the ABAC authorization mechanism on a cluster. + rpc SetLegacyAbac(SetLegacyAbacRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:setLegacyAbac" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/legacyAbac" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id,enabled"; + option (google.api.method_signature) = "name,enabled"; + } + + // Starts master IP rotation. + rpc StartIPRotation(StartIPRotationRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:startIpRotation" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:startIpRotation" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id"; + option (google.api.method_signature) = "name"; + } + + // Completes master IP rotation. + rpc CompleteIPRotation(CompleteIPRotationRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:completeIpRotation" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:completeIpRotation" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id"; + option (google.api.method_signature) = "name"; + } + + // Sets the size for a specific node pool. The new size will be used for all + // replicas, including future replicas created by modifying + // [NodePool.locations][google.container.v1.NodePool.locations]. + rpc SetNodePoolSize(SetNodePoolSizeRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setSize" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setSize" + body: "*" + } + }; + } + + // Enables or disables Network Policy for a cluster. + rpc SetNetworkPolicy(SetNetworkPolicyRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:setNetworkPolicy" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setNetworkPolicy" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,network_policy"; + option (google.api.method_signature) = "name,network_policy"; + } + + // Sets the maintenance policy for a cluster. + rpc SetMaintenancePolicy(SetMaintenancePolicyRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/clusters/*}:setMaintenancePolicy" + body: "*" + additional_bindings { + post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMaintenancePolicy" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,maintenance_policy"; + option (google.api.method_signature) = "name,maintenance_policy"; + } + + // Lists subnetworks that are usable for creating clusters in a project. + rpc ListUsableSubnetworks(ListUsableSubnetworksRequest) + returns (ListUsableSubnetworksResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/aggregated/usableSubnetworks" + }; + } + + // Checks the cluster compatibility with Autopilot mode, and returns a list of + // compatibility issues. + rpc CheckAutopilotCompatibility(CheckAutopilotCompatibilityRequest) + returns (CheckAutopilotCompatibilityResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/clusters/*}:checkAutopilotCompatibility" + }; + } +} + +// Parameters that can be configured on Linux nodes. +message LinuxNodeConfig { + // Possible cgroup modes that can be used. + enum CgroupMode { + // CGROUP_MODE_UNSPECIFIED is when unspecified cgroup configuration is used. + // The default for the GKE node OS image will be used. + CGROUP_MODE_UNSPECIFIED = 0; + + // CGROUP_MODE_V1 specifies to use cgroupv1 for the cgroup configuration on + // the node image. + CGROUP_MODE_V1 = 1; + + // CGROUP_MODE_V2 specifies to use cgroupv2 for the cgroup configuration on + // the node image. + CGROUP_MODE_V2 = 2; + } + + // The Linux kernel parameters to be applied to the nodes and all pods running + // on the nodes. + // + // The following parameters are supported. + // + // net.core.busy_poll + // net.core.busy_read + // net.core.netdev_max_backlog + // net.core.rmem_max + // net.core.wmem_default + // net.core.wmem_max + // net.core.optmem_max + // net.core.somaxconn + // net.ipv4.tcp_rmem + // net.ipv4.tcp_wmem + // net.ipv4.tcp_tw_reuse + map sysctls = 1; + + // cgroup_mode specifies the cgroup mode to be used on the node. + CgroupMode cgroup_mode = 2; +} + +// Parameters that can be configured on Windows nodes. +// Windows Node Config that define the parameters that will be used to +// configure the Windows node pool settings +message WindowsNodeConfig { + // Possible OS version that can be used. + enum OSVersion { + // When OSVersion is not specified + OS_VERSION_UNSPECIFIED = 0; + + // LTSC2019 specifies to use LTSC2019 as the Windows Servercore Base Image + OS_VERSION_LTSC2019 = 1; + + // LTSC2022 specifies to use LTSC2022 as the Windows Servercore Base Image + OS_VERSION_LTSC2022 = 2; + } + + // OSVersion specifies the Windows node config to be used on the node + OSVersion os_version = 1; +} + +// Node kubelet configs. +message NodeKubeletConfig { + // Control the CPU management policy on the node. + // See + // https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/ + // + // The following values are allowed. + // * "none": the default, which represents the existing scheduling behavior. + // * "static": allows pods with certain resource characteristics to be granted + // increased CPU affinity and exclusivity on the node. + // The default value is 'none' if unspecified. + string cpu_manager_policy = 1; + + // Enable CPU CFS quota enforcement for containers that specify CPU limits. + // + // This option is enabled by default which makes kubelet use CFS quota + // (https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt) to + // enforce container CPU limits. Otherwise, CPU limits will not be enforced at + // all. + // + // Disable this option to mitigate CPU throttling problems while still having + // your pods to be in Guaranteed QoS class by specifying the CPU limits. + // + // The default value is 'true' if unspecified. + google.protobuf.BoolValue cpu_cfs_quota = 2; + + // Set the CPU CFS quota period value 'cpu.cfs_period_us'. + // + // The string must be a sequence of decimal numbers, each with optional + // fraction and a unit suffix, such as "300ms". + // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + // The value must be a positive duration. + string cpu_cfs_quota_period = 3; + + // Set the Pod PID limits. See + // https://kubernetes.io/docs/concepts/policy/pid-limiting/#pod-pid-limits + // + // Controls the maximum number of processes allowed to run in a pod. The value + // must be greater than or equal to 1024 and less than 4194304. + int64 pod_pids_limit = 4; + + // Enable or disable Kubelet read only port. + optional bool insecure_kubelet_readonly_port_enabled = 7; +} + +// Parameters that describe the nodes in a cluster. +// +// GKE Autopilot clusters do not +// recognize parameters in `NodeConfig`. Use +// [AutoprovisioningNodePoolDefaults][google.container.v1.AutoprovisioningNodePoolDefaults] +// instead. +message NodeConfig { + // The name of a Google Compute Engine [machine + // type](https://cloud.google.com/compute/docs/machine-types) + // + // If unspecified, the default machine type is `e2-medium`. + string machine_type = 1; + + // Size of the disk attached to each node, specified in GB. + // The smallest allowed disk size is 10GB. + // + // If unspecified, the default disk size is 100GB. + int32 disk_size_gb = 2; + + // The set of Google API scopes to be made available on all of the + // node VMs under the "default" service account. + // + // The following scopes are recommended, but not required, and by default are + // not included: + // + // * `https://www.googleapis.com/auth/compute` is required for mounting + // persistent storage on your nodes. + // * `https://www.googleapis.com/auth/devstorage.read_only` is required for + // communicating with **gcr.io** + // (the [Google Container + // Registry](https://cloud.google.com/container-registry/)). + // + // If unspecified, no scopes are added, unless Cloud Logging or Cloud + // Monitoring are enabled, in which case their required scopes will be added. + repeated string oauth_scopes = 3; + + // The Google Cloud Platform Service Account to be used by the node VMs. + // Specify the email address of the Service Account; otherwise, if no Service + // Account is specified, the "default" service account is used. + string service_account = 9; + + // The metadata key/value pairs assigned to instances in the cluster. + // + // Keys must conform to the regexp `[a-zA-Z0-9-_]+` and be less than 128 bytes + // in length. These are reflected as part of a URL in the metadata server. + // Additionally, to avoid ambiguity, keys must not conflict with any other + // metadata keys for the project or be one of the reserved keys: + // + // - "cluster-location" + // - "cluster-name" + // - "cluster-uid" + // - "configure-sh" + // - "containerd-configure-sh" + // - "enable-os-login" + // - "gci-ensure-gke-docker" + // - "gci-metrics-enabled" + // - "gci-update-strategy" + // - "instance-template" + // - "kube-env" + // - "startup-script" + // - "user-data" + // - "disable-address-manager" + // - "windows-startup-script-ps1" + // - "common-psm1" + // - "k8s-node-setup-psm1" + // - "install-ssh-psm1" + // - "user-profile-psm1" + // + // Values are free-form strings, and only have meaning as interpreted by + // the image running in the instance. The only restriction placed on them is + // that each value's size must be less than or equal to 32 KB. + // + // The total size of all keys and values must be less than 512 KB. + map metadata = 4; + + // The image type to use for this node. Note that for a given image type, + // the latest version of it will be used. Please see + // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for + // available image types. + string image_type = 5; + + // The map of Kubernetes labels (key/value pairs) to be applied to each node. + // These will added in addition to any default label(s) that + // Kubernetes may apply to the node. + // In case of conflict in label keys, the applied set may differ depending on + // the Kubernetes version -- it's best to assume the behavior is undefined + // and conflicts should be avoided. + // For more information, including usage and the valid values, see: + // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + map labels = 6; + + // The number of local SSD disks to be attached to the node. + // + // The limit for this value is dependent upon the maximum number of + // disks available on a machine per zone. See: + // https://cloud.google.com/compute/docs/disks/local-ssd + // for more information. + int32 local_ssd_count = 7; + + // The list of instance tags applied to all nodes. Tags are used to identify + // valid sources or targets for network firewalls and are specified by + // the client during cluster or node pool creation. Each tag within the list + // must comply with RFC1035. + repeated string tags = 8; + + // Whether the nodes are created as preemptible VM instances. See: + // https://cloud.google.com/compute/docs/instances/preemptible for more + // information about preemptible VM instances. + bool preemptible = 10; + + // A list of hardware accelerators to be attached to each node. + // See https://cloud.google.com/compute/docs/gpus for more information about + // support for GPUs. + repeated AcceleratorConfig accelerators = 11; + + // Type of the disk attached to each node (e.g. 'pd-standard', 'pd-ssd' or + // 'pd-balanced') + // + // If unspecified, the default disk type is 'pd-standard' + string disk_type = 12; + + // Minimum CPU platform to be used by this instance. The instance may be + // scheduled on the specified or newer CPU platform. Applicable values are the + // friendly names of CPU platforms, such as + // `minCpuPlatform: "Intel Haswell"` or + // `minCpuPlatform: "Intel Sandy Bridge"`. For more + // information, read [how to specify min CPU + // platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform) + string min_cpu_platform = 13; + + // The workload metadata configuration for this node. + WorkloadMetadataConfig workload_metadata_config = 14; + + // List of kubernetes taints to be applied to each node. + // + // For more information, including usage and the valid values, see: + // https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + repeated NodeTaint taints = 15; + + // Sandbox configuration for this node. + SandboxConfig sandbox_config = 17; + + // Setting this field will assign instances of this + // pool to run on the specified node group. This is useful for running + // workloads on [sole tenant + // nodes](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes). + string node_group = 18; + + // The optional reservation affinity. Setting this field will apply + // the specified [Zonal Compute + // Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) + // to this node pool. + ReservationAffinity reservation_affinity = 19; + + // Shielded Instance options. + ShieldedInstanceConfig shielded_instance_config = 20; + + // Parameters that can be configured on Linux nodes. + LinuxNodeConfig linux_node_config = 21; + + // Node kubelet configs. + NodeKubeletConfig kubelet_config = 22; + + // + // The Customer Managed Encryption Key used to encrypt the boot disk attached + // to each node in the node pool. This should be of the form + // projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. + // For more information about protecting resources with Cloud KMS Keys please + // see: + // https://cloud.google.com/compute/docs/disks/customer-managed-encryption + string boot_disk_kms_key = 23; + + // Google Container File System (image streaming) configs. + GcfsConfig gcfs_config = 25; + + // Advanced features for the Compute Engine VM. + AdvancedMachineFeatures advanced_machine_features = 26; + + // Enable or disable gvnic in the node pool. + VirtualNIC gvnic = 29; + + // Spot flag for enabling Spot VM, which is a rebrand of + // the existing preemptible flag. + bool spot = 32; + + // Confidential nodes config. + // All the nodes in the node pool will be Confidential VM once enabled. + ConfidentialNodes confidential_nodes = 35; + + // Enable or disable NCCL fast socket for the node pool. + optional FastSocket fast_socket = 36; + + // The resource labels for the node pool to use to annotate any related + // Google Compute Engine resources. + map resource_labels = 37; + + // Logging configuration. + NodePoolLoggingConfig logging_config = 38; + + // Parameters that can be configured on Windows nodes. + WindowsNodeConfig windows_node_config = 39; + + // Parameters for using raw-block Local NVMe SSDs. + LocalNvmeSsdBlockConfig local_nvme_ssd_block_config = 40; + + // Parameters for the node ephemeral storage using Local SSDs. + // If unspecified, ephemeral storage is backed by the boot disk. + EphemeralStorageLocalSsdConfig ephemeral_storage_local_ssd_config = 41; + + // Parameters for node pools to be backed by shared sole tenant node groups. + SoleTenantConfig sole_tenant_config = 42; +} + +// Specifies options for controlling advanced machine features. +message AdvancedMachineFeatures { + // The number of threads per physical core. To disable simultaneous + // multithreading (SMT) set this to 1. If unset, the maximum number of threads + // supported per core by the underlying processor is assumed. + optional int64 threads_per_core = 1; +} + +// Parameters for node pool-level network config. +message NodeNetworkConfig { + // Configuration of all network bandwidth tiers + message NetworkPerformanceConfig { + // Node network tier + enum Tier { + // Default value + TIER_UNSPECIFIED = 0; + + // Higher bandwidth, actual values based on VM size. + TIER_1 = 1; + } + + // Specifies the total network bandwidth tier for the NodePool. + optional Tier total_egress_bandwidth_tier = 1; + } + + // Input only. Whether to create a new range for pod IPs in this node pool. + // Defaults are provided for `pod_range` and `pod_ipv4_cidr_block` if they + // are not specified. + // + // If neither `create_pod_range` or `pod_range` are specified, the + // cluster-level default (`ip_allocation_policy.cluster_ipv4_cidr_block`) is + // used. + // + // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. + // + // This field cannot be changed after the node pool has been created. + bool create_pod_range = 4 [(google.api.field_behavior) = INPUT_ONLY]; + + // The ID of the secondary range for pod IPs. + // If `create_pod_range` is true, this ID is used for the new range. + // If `create_pod_range` is false, uses an existing secondary range with this + // ID. + // + // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. + // + // This field cannot be changed after the node pool has been created. + string pod_range = 5; + + // The IP address range for pod IPs in this node pool. + // + // Only applicable if `create_pod_range` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) to pick a specific range to use. + // + // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. + // + // This field cannot be changed after the node pool has been created. + string pod_ipv4_cidr_block = 6; + + // Whether nodes have internal IP addresses only. + // If enable_private_nodes is not specified, then the value is derived from + // [cluster.privateClusterConfig.enablePrivateNodes][google.container.v1beta1.PrivateClusterConfig.enablePrivateNodes] + optional bool enable_private_nodes = 9; + + // Network bandwidth tier configuration. + optional NetworkPerformanceConfig network_performance_config = 11; + + // [PRIVATE FIELD] + // Pod CIDR size overprovisioning config for the nodepool. + // + // Pod CIDR size per node depends on max_pods_per_node. By default, the value + // of max_pods_per_node is rounded off to next power of 2 and we then double + // that to get the size of pod CIDR block per node. + // Example: max_pods_per_node of 30 would result in 64 IPs (/26). + // + // This config can disable the doubling of IPs (we still round off to next + // power of 2) + // Example: max_pods_per_node of 30 will result in 32 IPs (/27) when + // overprovisioning is disabled. + PodCIDROverprovisionConfig pod_cidr_overprovision_config = 13; + + // We specify the additional node networks for this node pool using this list. + // Each node network corresponds to an additional interface + repeated AdditionalNodeNetworkConfig additional_node_network_configs = 14; + + // We specify the additional pod networks for this node pool using this list. + // Each pod network corresponds to an additional alias IP range for the node + repeated AdditionalPodNetworkConfig additional_pod_network_configs = 15; + + // Output only. [Output only] The utilization of the IPv4 range for the pod. + // The ratio is Usage/[Total number of IPs in the secondary range], + // Usage=numNodes*numZones*podIPsPerNode. + double pod_ipv4_range_utilization = 16 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// AdditionalNodeNetworkConfig is the configuration for additional node networks +// within the NodeNetworkConfig message +message AdditionalNodeNetworkConfig { + // Name of the VPC where the additional interface belongs + string network = 1; + + // Name of the subnetwork where the additional interface belongs + string subnetwork = 2; +} + +// AdditionalPodNetworkConfig is the configuration for additional pod networks +// within the NodeNetworkConfig message +message AdditionalPodNetworkConfig { + // Name of the subnetwork where the additional pod network belongs + string subnetwork = 1; + + // The name of the secondary range on the subnet which provides IP address for + // this pod range + string secondary_pod_range = 2; + + // The maximum number of pods per node which use this pod network + optional MaxPodsConstraint max_pods_per_node = 3; +} + +// A set of Shielded Instance options. +message ShieldedInstanceConfig { + // Defines whether the instance has Secure Boot enabled. + // + // Secure Boot helps ensure that the system only runs authentic software by + // verifying the digital signature of all boot components, and halting the + // boot process if signature verification fails. + bool enable_secure_boot = 1; + + // Defines whether the instance has integrity monitoring enabled. + // + // Enables monitoring and attestation of the boot integrity of the instance. + // The attestation is performed against the integrity policy baseline. This + // baseline is initially derived from the implicitly trusted boot image when + // the instance is created. + bool enable_integrity_monitoring = 2; +} + +// SandboxConfig contains configurations of the sandbox to use for the node. +message SandboxConfig { + // Possible types of sandboxes. + enum Type { + // Default value. This should not be used. + UNSPECIFIED = 0; + + // Run sandbox using gvisor. + GVISOR = 1; + } + + // Type of the sandbox to use for the node. + Type type = 2; +} + +// GcfsConfig contains configurations of Google Container File System +// (image streaming). +message GcfsConfig { + // Whether to use GCFS. + bool enabled = 1; +} + +// [ReservationAffinity](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) +// is the configuration of desired reservation which instances could take +// capacity from. +message ReservationAffinity { + // Indicates whether to consume capacity from a reservation or not. + enum Type { + // Default value. This should not be used. + UNSPECIFIED = 0; + + // Do not consume from any reserved capacity. + NO_RESERVATION = 1; + + // Consume any reservation available. + ANY_RESERVATION = 2; + + // Must consume from a specific reservation. Must specify key value fields + // for specifying the reservations. + SPECIFIC_RESERVATION = 3; + } + + // Corresponds to the type of reservation consumption. + Type consume_reservation_type = 1; + + // Corresponds to the label key of a reservation resource. To target a + // SPECIFIC_RESERVATION by name, specify + // "compute.googleapis.com/reservation-name" as the key and specify the name + // of your reservation as its value. + string key = 2; + + // Corresponds to the label value(s) of reservation resource(s). + repeated string values = 3; +} + +// SoleTenantConfig contains the NodeAffinities to specify what shared sole +// tenant node groups should back the node pool. +message SoleTenantConfig { + // Specifies the NodeAffinity key, values, and affinity operator according to + // [shared sole tenant node group + // affinities](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes#node_affinity_and_anti-affinity). + message NodeAffinity { + // Operator allows user to specify affinity or anti-affinity for the + // given key values. + enum Operator { + // Invalid or unspecified affinity operator. + OPERATOR_UNSPECIFIED = 0; + + // Affinity operator. + IN = 1; + + // Anti-affinity operator. + NOT_IN = 2; + } + + // Key for NodeAffinity. + string key = 1; + + // Operator for NodeAffinity. + Operator operator = 2; + + // Values for NodeAffinity. + repeated string values = 3; + } + + // NodeAffinities used to match to a shared sole tenant node group. + repeated NodeAffinity node_affinities = 1; +} + +// Kubernetes taint is composed of three fields: key, value, and effect. Effect +// can only be one of three types: NoSchedule, PreferNoSchedule or NoExecute. +// +// See +// [here](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration) +// for more information, including usage and the valid values. +message NodeTaint { + // Possible values for Effect in taint. + enum Effect { + // Not set + EFFECT_UNSPECIFIED = 0; + + // NoSchedule + NO_SCHEDULE = 1; + + // PreferNoSchedule + PREFER_NO_SCHEDULE = 2; + + // NoExecute + NO_EXECUTE = 3; + } + + // Key for taint. + string key = 1; + + // Value for taint. + string value = 2; + + // Effect for taint. + Effect effect = 3; +} + +// Collection of Kubernetes [node +// taints](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration). +message NodeTaints { + // List of node taints. + repeated NodeTaint taints = 1; +} + +// Collection of node-level [Kubernetes +// labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels). +message NodeLabels { + // Map of node label keys and node label values. + map labels = 1; +} + +// Collection of [GCP +// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels). +message ResourceLabels { + // Map of node label keys and node label values. + map labels = 1; +} + +// Collection of Compute Engine network tags that can be applied to a node's +// underlying VM instance. +message NetworkTags { + // List of network tags. + repeated string tags = 1; +} + +// The authentication information for accessing the master endpoint. +// Authentication can be done using HTTP basic auth or using client +// certificates. +message MasterAuth { + // The username to use for HTTP basic authentication to the master endpoint. + // For clusters v1.6.0 and later, basic authentication can be disabled by + // leaving username unspecified (or setting it to the empty string). + // + // Warning: basic authentication is deprecated, and will be removed in GKE + // control plane versions 1.19 and newer. For a list of recommended + // authentication methods, see: + // https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication + string username = 1 [deprecated = true]; + + // The password to use for HTTP basic authentication to the master endpoint. + // Because the master endpoint is open to the Internet, you should create a + // strong password. If a password is provided for cluster creation, username + // must be non-empty. + // + // Warning: basic authentication is deprecated, and will be removed in GKE + // control plane versions 1.19 and newer. For a list of recommended + // authentication methods, see: + // https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication + string password = 2 [deprecated = true]; + + // Configuration for client certificate authentication on the cluster. For + // clusters before v1.12, if no configuration is specified, a client + // certificate is issued. + ClientCertificateConfig client_certificate_config = 3; + + // [Output only] Base64-encoded public certificate that is the root of + // trust for the cluster. + string cluster_ca_certificate = 100; + + // [Output only] Base64-encoded public certificate used by clients to + // authenticate to the cluster endpoint. + string client_certificate = 101; + + // [Output only] Base64-encoded private key used by clients to authenticate + // to the cluster endpoint. + string client_key = 102; +} + +// Configuration for client certificates on the cluster. +message ClientCertificateConfig { + // Issue a client certificate. + bool issue_client_certificate = 1; +} + +// Configuration for the addons that can be automatically spun up in the +// cluster, enabling additional functionality. +message AddonsConfig { + // Configuration for the HTTP (L7) load balancing controller addon, which + // makes it easy to set up HTTP load balancers for services in a cluster. + HttpLoadBalancing http_load_balancing = 1; + + // Configuration for the horizontal pod autoscaling feature, which + // increases or decreases the number of replica pods a replication controller + // has based on the resource usage of the existing pods. + HorizontalPodAutoscaling horizontal_pod_autoscaling = 2; + + // Configuration for the Kubernetes Dashboard. + // This addon is deprecated, and will be disabled in 1.15. It is recommended + // to use the Cloud Console to manage and monitor your Kubernetes clusters, + // workloads and applications. For more information, see: + // https://cloud.google.com/kubernetes-engine/docs/concepts/dashboards + KubernetesDashboard kubernetes_dashboard = 3 [deprecated = true]; + + // Configuration for NetworkPolicy. This only tracks whether the addon + // is enabled or not on the Master, it does not track whether network policy + // is enabled for the nodes. + NetworkPolicyConfig network_policy_config = 4; + + // Configuration for the Cloud Run addon, which allows the user to use a + // managed Knative service. + CloudRunConfig cloud_run_config = 7; + + // Configuration for NodeLocalDNS, a dns cache running on cluster nodes + DnsCacheConfig dns_cache_config = 8; + + // Configuration for the ConfigConnector add-on, a Kubernetes + // extension to manage hosted GCP services through the Kubernetes API + ConfigConnectorConfig config_connector_config = 10; + + // Configuration for the Compute Engine Persistent Disk CSI driver. + GcePersistentDiskCsiDriverConfig gce_persistent_disk_csi_driver_config = 11; + + // Configuration for the GCP Filestore CSI driver. + GcpFilestoreCsiDriverConfig gcp_filestore_csi_driver_config = 14; + + // Configuration for the Backup for GKE agent addon. + GkeBackupAgentConfig gke_backup_agent_config = 16; + + // Configuration for the Cloud Storage Fuse CSI driver. + GcsFuseCsiDriverConfig gcs_fuse_csi_driver_config = 17; +} + +// Configuration options for the HTTP (L7) load balancing controller addon, +// which makes it easy to set up HTTP load balancers for services in a cluster. +message HttpLoadBalancing { + // Whether the HTTP Load Balancing controller is enabled in the cluster. + // When enabled, it runs a small pod in the cluster that manages the load + // balancers. + bool disabled = 1; +} + +// Configuration options for the horizontal pod autoscaling feature, which +// increases or decreases the number of replica pods a replication controller +// has based on the resource usage of the existing pods. +message HorizontalPodAutoscaling { + // Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. + // When enabled, it ensures that metrics are collected into Stackdriver + // Monitoring. + bool disabled = 1; +} + +// Configuration for the Kubernetes Dashboard. +message KubernetesDashboard { + // Whether the Kubernetes Dashboard is enabled for this cluster. + bool disabled = 1; +} + +// Configuration for NetworkPolicy. This only tracks whether the addon +// is enabled or not on the Master, it does not track whether network policy +// is enabled for the nodes. +message NetworkPolicyConfig { + // Whether NetworkPolicy is enabled for this cluster. + bool disabled = 1; +} + +// Configuration for NodeLocal DNSCache +message DnsCacheConfig { + // Whether NodeLocal DNSCache is enabled for this cluster. + bool enabled = 1; +} + +// Configuration for controlling master global access settings. +message PrivateClusterMasterGlobalAccessConfig { + // Whenever master is accessible globally or not. + bool enabled = 1; +} + +// Configuration options for private clusters. +message PrivateClusterConfig { + // Whether nodes have internal IP addresses only. If enabled, all nodes are + // given only RFC 1918 private addresses and communicate with the master via + // private networking. + bool enable_private_nodes = 1; + + // Whether the master's internal IP address is used as the cluster endpoint. + bool enable_private_endpoint = 2; + + // The IP range in CIDR notation to use for the hosted master network. This + // range will be used for assigning internal IP addresses to the master or + // set of masters, as well as the ILB VIP. This range must not overlap with + // any other ranges in use within the cluster's network. + string master_ipv4_cidr_block = 3; + + // Output only. The internal IP address of this cluster's master endpoint. + string private_endpoint = 4; + + // Output only. The external IP address of this cluster's master endpoint. + string public_endpoint = 5; + + // Output only. The peering name in the customer VPC used by this cluster. + string peering_name = 7; + + // Controls master global access settings. + PrivateClusterMasterGlobalAccessConfig master_global_access_config = 8; + + // Subnet to provision the master's private endpoint during cluster creation. + // Specified in projects/*/regions/*/subnetworks/* format. + string private_endpoint_subnetwork = 10; +} + +// Configuration for returning group information from authenticators. +message AuthenticatorGroupsConfig { + // Whether this cluster should return group membership lookups + // during authentication using a group of security groups. + bool enabled = 1; + + // The name of the security group-of-groups to be used. Only relevant + // if enabled = true. + string security_group = 2; +} + +// Configuration options for the Cloud Run feature. +message CloudRunConfig { + // Load balancer type of ingress service of Cloud Run. + enum LoadBalancerType { + // Load balancer type for Cloud Run is unspecified. + LOAD_BALANCER_TYPE_UNSPECIFIED = 0; + + // Install external load balancer for Cloud Run. + LOAD_BALANCER_TYPE_EXTERNAL = 1; + + // Install internal load balancer for Cloud Run. + LOAD_BALANCER_TYPE_INTERNAL = 2; + } + + // Whether Cloud Run addon is enabled for this cluster. + bool disabled = 1; + + // Which load balancer type is installed for Cloud Run. + LoadBalancerType load_balancer_type = 3; +} + +// Configuration options for the Config Connector add-on. +message ConfigConnectorConfig { + // Whether Cloud Connector is enabled for this cluster. + bool enabled = 1; +} + +// Configuration for the Compute Engine PD CSI driver. +message GcePersistentDiskCsiDriverConfig { + // Whether the Compute Engine PD CSI driver is enabled for this cluster. + bool enabled = 1; +} + +// Configuration for the GCP Filestore CSI driver. +message GcpFilestoreCsiDriverConfig { + // Whether the GCP Filestore CSI driver is enabled for this cluster. + bool enabled = 1; +} + +// Configuration for the Cloud Storage Fuse CSI driver. +message GcsFuseCsiDriverConfig { + // Whether the Cloud Storage Fuse CSI driver is enabled for this cluster. + bool enabled = 1; +} + +// Configuration for the Backup for GKE Agent. +message GkeBackupAgentConfig { + // Whether the Backup for GKE agent is enabled for this cluster. + bool enabled = 1; +} + +// Configuration options for the master authorized networks feature. Enabled +// master authorized networks will disallow all external traffic to access +// Kubernetes master through HTTPS except traffic from the given CIDR blocks, +// Google Compute Engine Public IPs and Google Prod IPs. +message MasterAuthorizedNetworksConfig { + // CidrBlock contains an optional name and one CIDR block. + message CidrBlock { + // display_name is an optional field for users to identify CIDR blocks. + string display_name = 1; + + // cidr_block must be specified in CIDR notation. + string cidr_block = 2; + } + + // Whether or not master authorized networks is enabled. + bool enabled = 1; + + // cidr_blocks define up to 50 external networks that could access + // Kubernetes master through HTTPS. + repeated CidrBlock cidr_blocks = 2; + + // Whether master is accessbile via Google Compute Engine Public IP addresses. + optional bool gcp_public_cidrs_access_enabled = 3; +} + +// Configuration for the legacy Attribute Based Access Control authorization +// mode. +message LegacyAbac { + // Whether the ABAC authorizer is enabled for this cluster. When enabled, + // identities in the system, including service accounts, nodes, and + // controllers, will have statically granted permissions beyond those + // provided by the RBAC configuration or IAM. + bool enabled = 1; +} + +// Configuration options for the NetworkPolicy feature. +// https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ +message NetworkPolicy { + // Allowed Network Policy providers. + enum Provider { + // Not set + PROVIDER_UNSPECIFIED = 0; + + // Tigera (Calico Felix). + CALICO = 1; + } + + // The selected network policy provider. + Provider provider = 1; + + // Whether network policy is enabled on the cluster. + bool enabled = 2; +} + +// Configuration for Binary Authorization. +message BinaryAuthorization { + // Binary Authorization mode of operation. + enum EvaluationMode { + // Default value + EVALUATION_MODE_UNSPECIFIED = 0; + + // Disable BinaryAuthorization + DISABLED = 1; + + // Enforce Kubernetes admission requests with BinaryAuthorization using the + // project's singleton policy. This is equivalent to setting the + // enabled boolean to true. + PROJECT_SINGLETON_POLICY_ENFORCE = 2; + } + + // This field is deprecated. Leave this unset and instead configure + // BinaryAuthorization using evaluation_mode. If evaluation_mode is set to + // anything other than EVALUATION_MODE_UNSPECIFIED, this field is ignored. + bool enabled = 1 [deprecated = true]; + + // Mode of operation for binauthz policy evaluation. If unspecified, defaults + // to DISABLED. + EvaluationMode evaluation_mode = 2; +} + +// [PRIVATE FIELD] +// Config for pod CIDR size overprovisioning. +message PodCIDROverprovisionConfig { + // Whether Pod CIDR overprovisioning is disabled. + // Note: Pod CIDR overprovisioning is enabled by default. + bool disable = 1; +} + +// Configuration for controlling how IPs are allocated in the cluster. +message IPAllocationPolicy { + // Whether alias IPs will be used for pod IPs in the cluster. + // This is used in conjunction with use_routes. It cannot + // be true if use_routes is true. If both use_ip_aliases and use_routes are + // false, then the server picks the default IP allocation mode + bool use_ip_aliases = 1; + + // Whether a new subnetwork will be created automatically for the cluster. + // + // This field is only applicable when `use_ip_aliases` is true. + bool create_subnetwork = 2; + + // A custom subnetwork name to be used if `create_subnetwork` is true. If + // this field is empty, then an automatic name will be chosen for the new + // subnetwork. + string subnetwork_name = 3; + + // This field is deprecated, use cluster_ipv4_cidr_block. + string cluster_ipv4_cidr = 4 [deprecated = true]; + + // This field is deprecated, use node_ipv4_cidr_block. + string node_ipv4_cidr = 5 [deprecated = true]; + + // This field is deprecated, use services_ipv4_cidr_block. + string services_ipv4_cidr = 6 [deprecated = true]; + + // The name of the secondary range to be used for the cluster CIDR + // block. The secondary range will be used for pod IP + // addresses. This must be an existing secondary range associated + // with the cluster subnetwork. + // + // This field is only applicable with use_ip_aliases is true and + // create_subnetwork is false. + string cluster_secondary_range_name = 7; + + // The name of the secondary range to be used as for the services + // CIDR block. The secondary range will be used for service + // ClusterIPs. This must be an existing secondary range associated + // with the cluster subnetwork. + // + // This field is only applicable with use_ip_aliases is true and + // create_subnetwork is false. + string services_secondary_range_name = 8; + + // The IP address range for the cluster pod IPs. If this field is set, then + // `cluster.cluster_ipv4_cidr` must be left blank. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string cluster_ipv4_cidr_block = 9; + + // The IP address range of the instance IPs in this cluster. + // + // This is applicable only if `create_subnetwork` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string node_ipv4_cidr_block = 10; + + // The IP address range of the services IPs in this cluster. If blank, a range + // will be automatically chosen with the default size. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string services_ipv4_cidr_block = 11; + + // The IP address range of the Cloud TPUs in this cluster. If unspecified, a + // range will be automatically chosen with the default size. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // If unspecified, the range will use the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string tpu_ipv4_cidr_block = 13; + + // Whether routes will be used for pod IPs in the cluster. + // This is used in conjunction with use_ip_aliases. It cannot be true if + // use_ip_aliases is true. If both use_ip_aliases and use_routes are false, + // then the server picks the default IP allocation mode + bool use_routes = 15; + + // The IP stack type of the cluster + StackType stack_type = 16; + + // The ipv6 access type (internal or external) when create_subnetwork is true + IPv6AccessType ipv6_access_type = 17; + + // [PRIVATE FIELD] + // Pod CIDR size overprovisioning config for the cluster. + // + // Pod CIDR size per node depends on max_pods_per_node. By default, the value + // of max_pods_per_node is doubled and then rounded off to next power of 2 to + // get the size of pod CIDR block per node. + // Example: max_pods_per_node of 30 would result in 64 IPs (/26). + // + // This config can disable the doubling of IPs (we still round off to next + // power of 2) + // Example: max_pods_per_node of 30 will result in 32 IPs (/27) when + // overprovisioning is disabled. + PodCIDROverprovisionConfig pod_cidr_overprovision_config = 21; + + // Output only. [Output only] The subnet's IPv6 CIDR block used by nodes and + // pods. + string subnet_ipv6_cidr_block = 22 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. [Output only] The services IPv6 CIDR block for the cluster. + string services_ipv6_cidr_block = 23 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. [Output only] The additional pod ranges that are added to the + // cluster. These pod ranges can be used by new node pools to allocate pod IPs + // automatically. Once the range is removed it will not show up in + // IPAllocationPolicy. + AdditionalPodRangesConfig additional_pod_ranges_config = 24 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. [Output only] The utilization of the cluster default IPv4 + // range for the pod. The ratio is Usage/[Total number of IPs in the secondary + // range], Usage=numNodes*numZones*podIPsPerNode. + double default_pod_ipv4_range_utilization = 25 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A Google Kubernetes Engine cluster. +message Cluster { + // The current status of the cluster. + enum Status { + // Not set. + STATUS_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 master or node software. Details can + // be found in the `statusMessage` field. + RECONCILING = 3; + + // The STOPPING state indicates the cluster is being deleted. + STOPPING = 4; + + // The ERROR state indicates the cluster is unusable. It will be + // automatically deleted. Details can be found in the `statusMessage` field. + ERROR = 5; + + // The DEGRADED state indicates the cluster requires user action to restore + // full functionality. Details can be found in the `statusMessage` field. + DEGRADED = 6; + } + + // The name of this cluster. The name must be unique within this project + // and location (e.g. zone or region), and can be up to 40 characters with + // the following restrictions: + // + // * Lowercase letters, numbers, and hyphens only. + // * Must start with a letter. + // * Must end with a number or a letter. + string name = 1; + + // An optional description of this cluster. + string description = 2; + + // The number of nodes to create in this cluster. You must ensure that your + // Compute Engine [resource quota](https://cloud.google.com/compute/quotas) + // is sufficient for this number of instances. You must also have available + // firewall and routes quota. + // For requests, this field should only be used in lieu of a + // "node_pool" object, since this configuration (along with the + // "node_config") will be used to create a "NodePool" object with an + // auto-generated name. Do not use this and a node_pool at the same time. + // + // This field is deprecated, use node_pool.initial_node_count instead. + int32 initial_node_count = 3 [deprecated = true]; + + // Parameters used in creating the cluster's nodes. + // For requests, this field should only be used in lieu of a + // "node_pool" object, since this configuration (along with the + // "initial_node_count") will be used to create a "NodePool" object with an + // auto-generated name. Do not use this and a node_pool at the same time. + // For responses, this field will be populated with the node configuration of + // the first node pool. (For configuration of each node pool, see + // `node_pool.config`) + // + // If unspecified, the defaults are used. + // This field is deprecated, use node_pool.config instead. + NodeConfig node_config = 4 [deprecated = true]; + + // The authentication information for accessing the master endpoint. + // If unspecified, the defaults are used: + // For clusters before v1.12, if master_auth is unspecified, `username` will + // be set to "admin", a random password will be generated, and a client + // certificate will be issued. + MasterAuth master_auth = 5; + + // The logging service the cluster should use to write logs. + // Currently available options: + // + // * `logging.googleapis.com/kubernetes` - The Cloud Logging + // service with a Kubernetes-native resource model + // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer + // available as of GKE 1.15). + // * `none` - no logs will be exported from the cluster. + // + // If left as an empty string,`logging.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. + string logging_service = 6; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring + // service with a Kubernetes-native resource model + // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no + // longer available as of GKE 1.15). + // * `none` - No metrics will be exported from the cluster. + // + // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. + string monitoring_service = 7; + + // The name of the Google Compute Engine + // [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) + // to which the cluster is connected. If left unspecified, the `default` + // network will be used. + string network = 8; + + // The IP address range of the container pods in this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`). Leave blank to have + // one automatically chosen or specify a `/14` block in `10.0.0.0/8`. + string cluster_ipv4_cidr = 9; + + // Configurations for the various addons available to run in the cluster. + AddonsConfig addons_config = 10; + + // The name of the Google Compute Engine + // [subnetwork](https://cloud.google.com/compute/docs/subnetworks) to which + // the cluster is connected. + string subnetwork = 11; + + // The node pools associated with this cluster. + // This field should not be set if "node_config" or "initial_node_count" are + // specified. + repeated NodePool node_pools = 12; + + // The list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster's nodes should be located. + // + // This field provides a default value if + // [NodePool.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools#NodePool.FIELDS.locations) + // are not specified during node pool creation. + // + // Warning: changing cluster locations will update the + // [NodePool.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools#NodePool.FIELDS.locations) + // of all node pools and will result in nodes being added and/or removed. + repeated string locations = 13; + + // Kubernetes alpha features are enabled on this cluster. This includes alpha + // API groups (e.g. v1alpha1) and features that may not be production ready in + // the kubernetes version of the master and nodes. + // The cluster has no SLA for uptime and master/node upgrades are disabled. + // Alpha enabled clusters are automatically deleted thirty days after + // creation. + bool enable_kubernetes_alpha = 14; + + // The resource labels for the cluster to use to annotate any related + // Google Compute Engine resources. + map resource_labels = 15; + + // The fingerprint of the set of labels for this cluster. + string label_fingerprint = 16; + + // Configuration for the legacy ABAC authorization mode. + LegacyAbac legacy_abac = 18; + + // Configuration options for the NetworkPolicy feature. + NetworkPolicy network_policy = 19; + + // Configuration for cluster IP allocation. + IPAllocationPolicy ip_allocation_policy = 20; + + // The configuration options for master authorized networks feature. + MasterAuthorizedNetworksConfig master_authorized_networks_config = 22; + + // Configure the maintenance policy for this cluster. + MaintenancePolicy maintenance_policy = 23; + + // Configuration for Binary Authorization. + BinaryAuthorization binary_authorization = 24; + + // Cluster-level autoscaling configuration. + ClusterAutoscaling autoscaling = 26; + + // Configuration for cluster networking. + NetworkConfig network_config = 27; + + // The default constraint on the maximum number of pods that can be run + // simultaneously on a node in the node pool of this cluster. Only honored + // if cluster created with IP Alias support. + MaxPodsConstraint default_max_pods_constraint = 30; + + // Configuration for exporting resource usages. Resource usage export is + // disabled when this config is unspecified. + ResourceUsageExportConfig resource_usage_export_config = 33; + + // Configuration controlling RBAC group membership information. + AuthenticatorGroupsConfig authenticator_groups_config = 34; + + // Configuration for private cluster. + PrivateClusterConfig private_cluster_config = 37; + + // Configuration of etcd encryption. + DatabaseEncryption database_encryption = 38; + + // Cluster-level Vertical Pod Autoscaling configuration. + VerticalPodAutoscaling vertical_pod_autoscaling = 39; + + // Shielded Nodes configuration. + ShieldedNodes shielded_nodes = 40; + + // Release channel configuration. If left unspecified on cluster creation and + // a version is specified, the cluster is enrolled in the most mature release + // channel where the version is available (first checking STABLE, then + // REGULAR, and finally RAPID). Otherwise, if no release channel + // configuration and no version is specified, the cluster is enrolled in the + // REGULAR channel with its default version. + ReleaseChannel release_channel = 41; + + // Configuration for the use of Kubernetes Service Accounts in GCP IAM + // policies. + WorkloadIdentityConfig workload_identity_config = 43; + + // Configuration for issuance of mTLS keys and certificates to Kubernetes + // pods. + MeshCertificates mesh_certificates = 67; + + // Configuration for the fine-grained cost management feature. + CostManagementConfig cost_management_config = 45; + + // Notification configuration of the cluster. + NotificationConfig notification_config = 49; + + // Configuration of Confidential Nodes. + // All the nodes in the cluster will be Confidential VM once enabled. + ConfidentialNodes confidential_nodes = 50; + + // Configuration for Identity Service component. + IdentityServiceConfig identity_service_config = 54; + + // [Output only] Server-defined URL for the resource. + string self_link = 100; + + // [Output only] The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field is deprecated, use location instead. + string zone = 101 [deprecated = true]; + + // [Output only] The IP address of this cluster's master endpoint. + // The endpoint can be accessed from the internet at + // `https://username:password@endpoint/`. + // + // See the `masterAuth` property of this resource for username and + // password information. + string endpoint = 102; + + // The initial Kubernetes version for this cluster. Valid versions are those + // found in validMasterVersions returned by getServerConfig. The version can + // be upgraded over time; such upgrades are reflected in + // currentMasterVersion and currentNodeVersion. + // + // Users may specify either explicit versions offered by + // Kubernetes Engine or version aliases, which have the following behavior: + // + // - "latest": picks the highest valid Kubernetes version + // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + // - "1.X.Y-gke.N": picks an explicit Kubernetes version + // - "","-": picks the default Kubernetes version + string initial_cluster_version = 103; + + // [Output only] The current software version of the master endpoint. + string current_master_version = 104; + + // [Output only] Deprecated, use + // [NodePools.version](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools) + // instead. The current version of the node software components. If they are + // currently at multiple versions because they're in the process of being + // upgraded, this reflects the minimum version of all nodes. + string current_node_version = 105 [deprecated = true]; + + // [Output only] The time the cluster was created, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string create_time = 106; + + // [Output only] The current status of this cluster. + Status status = 107; + + // [Output only] Deprecated. Use conditions instead. + // Additional information about the current status of this + // cluster, if available. + string status_message = 108 [deprecated = true]; + + // [Output only] The size of the address space on each node for hosting + // containers. This is provisioned from within the `container_ipv4_cidr` + // range. This field will only be set when cluster is in route-based network + // mode. + int32 node_ipv4_cidr_size = 109; + + // [Output only] The IP address range of the Kubernetes services in + // this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `1.2.3.4/29`). Service addresses are + // typically put in the last `/16` from the container CIDR. + string services_ipv4_cidr = 110; + + // Deprecated. Use node_pools.instance_group_urls. + repeated string instance_group_urls = 111 [deprecated = true]; + + // [Output only] The number of nodes currently in the cluster. Deprecated. + // Call Kubernetes API directly to retrieve node information. + int32 current_node_count = 112 [deprecated = true]; + + // [Output only] The time the cluster will be automatically + // deleted in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string expire_time = 113; + + // [Output only] The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) + // or + // [region](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) + // in which the cluster resides. + string location = 114; + + // Enable the ability to use Cloud TPUs in this cluster. + bool enable_tpu = 115; + + // [Output only] The IP address range of the Cloud TPUs in this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `1.2.3.4/29`). + string tpu_ipv4_cidr_block = 116; + + // Which conditions caused the current cluster state. + repeated StatusCondition conditions = 118; + + // Autopilot configuration for the cluster. + Autopilot autopilot = 128; + + // Output only. Unique id for the cluster. + string id = 129 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Default NodePool settings for the entire cluster. These settings are + // overridden if specified on the specific NodePool object. + optional NodePoolDefaults node_pool_defaults = 131; + + // Logging configuration for the cluster. + LoggingConfig logging_config = 132; + + // Monitoring configuration for the cluster. + MonitoringConfig monitoring_config = 133; + + // Node pool configs that apply to all auto-provisioned node pools + // in autopilot clusters and node auto-provisioning enabled clusters. + NodePoolAutoConfig node_pool_auto_config = 136; + + // This checksum is computed by the server based on the value of cluster + // fields, and may be sent on update requests to ensure the client has an + // up-to-date value before proceeding. + string etag = 139; + + // Fleet information for the cluster. + Fleet fleet = 140; + + // Enable/Disable Security Posture API features for the cluster. + SecurityPostureConfig security_posture_config = 145; + + // Beta APIs Config + K8sBetaAPIConfig enable_k8s_beta_apis = 143; +} + +// K8sBetaAPIConfig , configuration for beta APIs +message K8sBetaAPIConfig { + // Enabled k8s beta APIs. + repeated string enabled_apis = 1; +} + +// SecurityPostureConfig defines the flags needed to enable/disable features for +// the Security Posture API. +message SecurityPostureConfig { + // Mode defines enablement mode for GKE Security posture features. + enum Mode { + // Default value not specified. + MODE_UNSPECIFIED = 0; + + // Disables Security Posture features on the cluster. + DISABLED = 1; + + // Applies Security Posture features on the cluster. + BASIC = 2; + } + + // VulnerabilityMode defines enablement mode for vulnerability scanning. + enum VulnerabilityMode { + // Default value not specified. + VULNERABILITY_MODE_UNSPECIFIED = 0; + + // Disables vulnerability scanning on the cluster. + VULNERABILITY_DISABLED = 1; + + // Applies basic vulnerability scanning on the cluster. + VULNERABILITY_BASIC = 2; + } + + // Sets which mode to use for Security Posture features. + optional Mode mode = 1; + + // Sets which mode to use for vulnerability scanning. + optional VulnerabilityMode vulnerability_mode = 2; +} + +// Node pool configs that apply to all auto-provisioned node pools +// in autopilot clusters and node auto-provisioning enabled clusters. +message NodePoolAutoConfig { + // The list of instance tags applied to all nodes. Tags are used to identify + // valid sources or targets for network firewalls and are specified by + // the client during cluster creation. Each tag within the list + // must comply with RFC1035. + NetworkTags network_tags = 1; +} + +// Subset of Nodepool message that has defaults. +message NodePoolDefaults { + // Subset of NodeConfig message that has defaults. + NodeConfigDefaults node_config_defaults = 1; +} + +// Subset of NodeConfig message that has defaults. +message NodeConfigDefaults { + // GCFS (Google Container File System, also known as Riptide) options. + GcfsConfig gcfs_config = 1; + + // Logging configuration for node pools. + NodePoolLoggingConfig logging_config = 3; +} + +// ClusterUpdate describes an update to the cluster. Exactly one update can +// be applied to a cluster with each request, so at most one field can be +// provided. +message ClusterUpdate { + // The Kubernetes version to change the nodes to (typically an + // upgrade). + // + // Users may specify either explicit versions offered by + // Kubernetes Engine or version aliases, which have the following behavior: + // + // - "latest": picks the highest valid Kubernetes version + // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + // - "1.X.Y-gke.N": picks an explicit Kubernetes version + // - "-": picks the Kubernetes master version + string desired_node_version = 4; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring + // service with a Kubernetes-native resource model + // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no + // longer available as of GKE 1.15). + // * `none` - No metrics will be exported from the cluster. + // + // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. + string desired_monitoring_service = 5; + + // Configurations for the various addons available to run in the cluster. + AddonsConfig desired_addons_config = 6; + + // The node pool to be upgraded. This field is mandatory if + // "desired_node_version", "desired_image_family" or + // "desired_node_pool_autoscaling" is specified and there is more than one + // node pool on the cluster. + string desired_node_pool_id = 7; + + // The desired image type for the node pool. + // NOTE: Set the "desired_node_pool" field as well. + string desired_image_type = 8; + + // Configuration of etcd encryption. + DatabaseEncryption desired_database_encryption = 46; + + // Configuration for Workload Identity. + WorkloadIdentityConfig desired_workload_identity_config = 47; + + // Configuration for issuance of mTLS keys and certificates to Kubernetes + // pods. + MeshCertificates desired_mesh_certificates = 67; + + // Configuration for Shielded Nodes. + ShieldedNodes desired_shielded_nodes = 48; + + // The desired configuration for the fine-grained cost management feature. + CostManagementConfig desired_cost_management_config = 49; + + // DNSConfig contains clusterDNS config for this cluster. + DNSConfig desired_dns_config = 53; + + // Autoscaler configuration for the node pool specified in + // desired_node_pool_id. If there is only one pool in the + // cluster and desired_node_pool_id is not provided then + // the change applies to that single node pool. + NodePoolAutoscaling desired_node_pool_autoscaling = 9; + + // The desired list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster's nodes should be located. + // + // This list must always include the cluster's primary zone. + // + // Warning: changing cluster locations will update the locations of all node + // pools and will result in nodes being added and/or removed. + repeated string desired_locations = 10; + + // The desired configuration options for master authorized networks feature. + MasterAuthorizedNetworksConfig desired_master_authorized_networks_config = 12; + + // Cluster-level autoscaling configuration. + ClusterAutoscaling desired_cluster_autoscaling = 15; + + // The desired configuration options for the Binary Authorization feature. + BinaryAuthorization desired_binary_authorization = 16; + + // The logging service the cluster should use to write logs. + // Currently available options: + // + // * `logging.googleapis.com/kubernetes` - The Cloud Logging + // service with a Kubernetes-native resource model + // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer + // available as of GKE 1.15). + // * `none` - no logs will be exported from the cluster. + // + // If left as an empty string,`logging.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. + string desired_logging_service = 19; + + // The desired configuration for exporting resource usage. + ResourceUsageExportConfig desired_resource_usage_export_config = 21; + + // Cluster-level Vertical Pod Autoscaling configuration. + VerticalPodAutoscaling desired_vertical_pod_autoscaling = 22; + + // The desired private cluster configuration. + PrivateClusterConfig desired_private_cluster_config = 25; + + // The desired config of Intra-node visibility. + IntraNodeVisibilityConfig desired_intra_node_visibility_config = 26; + + // The desired status of whether to disable default sNAT for this cluster. + DefaultSnatStatus desired_default_snat_status = 28; + + // The desired release channel configuration. + ReleaseChannel desired_release_channel = 31; + + // The desired L4 Internal Load Balancer Subsetting configuration. + ILBSubsettingConfig desired_l4ilb_subsetting_config = 39; + + // The desired datapath provider for the cluster. + DatapathProvider desired_datapath_provider = 50; + + // The desired state of IPv6 connectivity to Google Services. + PrivateIPv6GoogleAccess desired_private_ipv6_google_access = 51; + + // The desired notification configuration. + NotificationConfig desired_notification_config = 55; + + // The desired authenticator groups config for the cluster. + AuthenticatorGroupsConfig desired_authenticator_groups_config = 63; + + // The desired logging configuration. + LoggingConfig desired_logging_config = 64; + + // The desired monitoring configuration. + MonitoringConfig desired_monitoring_config = 65; + + // The desired Identity Service component configuration. + IdentityServiceConfig desired_identity_service_config = 66; + + // ServiceExternalIPsConfig specifies the config for the use of Services with + // ExternalIPs field. + ServiceExternalIPsConfig desired_service_external_ips_config = 60; + + // Enable/Disable private endpoint for the cluster's master. + optional bool desired_enable_private_endpoint = 71; + + // The Kubernetes version to change the master to. + // + // Users may specify either explicit versions offered by + // Kubernetes Engine or version aliases, which have the following behavior: + // + // - "latest": picks the highest valid Kubernetes version + // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + // - "1.X.Y-gke.N": picks an explicit Kubernetes version + // - "-": picks the default Kubernetes version + string desired_master_version = 100; + + // The desired GCFS config for the cluster + GcfsConfig desired_gcfs_config = 109; + + // The desired network tags that apply to all auto-provisioned node pools + // in autopilot clusters and node auto-provisioning enabled clusters. + NetworkTags desired_node_pool_auto_config_network_tags = 110; + + // The desired config of Gateway API on this cluster. + GatewayAPIConfig desired_gateway_api_config = 114; + + // The current etag of the cluster. + // If an etag is provided and does not match the current etag of the cluster, + // update will be blocked and an ABORTED error will be returned. + string etag = 115; + + // The desired node pool logging configuration defaults for the cluster. + NodePoolLoggingConfig desired_node_pool_logging_config = 116; + + // The desired fleet configuration for the cluster. + Fleet desired_fleet = 117; + + // The desired stack type of the cluster. + // If a stack type is provided and does not match the current stack type of + // the cluster, update will attempt to change the stack type to the new type. + StackType desired_stack_type = 119; + + // The additional pod ranges to be added to the cluster. These pod ranges + // can be used by node pools to allocate pod IPs. + AdditionalPodRangesConfig additional_pod_ranges_config = 120; + + // The additional pod ranges that are to be removed from the cluster. + // The pod ranges specified here must have been specified earlier in the + // 'additional_pod_ranges_config' argument. + AdditionalPodRangesConfig removed_additional_pod_ranges_config = 121; + + // Kubernetes open source beta apis enabled on the cluster. Only beta apis + K8sBetaAPIConfig enable_k8s_beta_apis = 122; + + // Enable/Disable Security Posture API features for the cluster. + SecurityPostureConfig desired_security_posture_config = 124; + + // The desired network performance config. + NetworkConfig.ClusterNetworkPerformanceConfig + desired_network_performance_config = 125; + + // Enable/Disable FQDN Network Policy for the cluster. + optional bool desired_enable_fqdn_network_policy = 126; + + // The desired workload policy configuration for the autopilot cluster. + WorkloadPolicyConfig desired_autopilot_workload_policy_config = 128; + + // Desired Beta APIs to be enabled for cluster. + K8sBetaAPIConfig desired_k8s_beta_apis = 131; +} + +// AdditionalPodRangesConfig is the configuration for additional pod secondary +// ranges supporting the ClusterUpdate message. +message AdditionalPodRangesConfig { + // Name for pod secondary ipv4 range which has the actual range defined ahead. + repeated string pod_range_names = 1; + + // Output only. [Output only] Information for additional pod range. + repeated RangeInfo pod_range_info = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// RangeInfo contains the range name and the range utilization by this cluster. +message RangeInfo { + // Output only. [Output only] Name of a range. + string range_name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. [Output only] The utilization of the range. + double utilization = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// This operation resource represents operations that may have happened or are +// happening on the cluster. All fields are output only. +message Operation { + // Current status of the operation. + enum Status { + // Not set. + STATUS_UNSPECIFIED = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is currently running. + RUNNING = 2; + + // The operation is done, either cancelled or completed. + DONE = 3; + + // The operation is aborting. + ABORTING = 4; + } + + // Operation type categorizes the operation. + enum Type { + // Not set. + TYPE_UNSPECIFIED = 0; + + // The cluster is being created. The cluster should be assumed to be + // unusable until the operation finishes. + // + // In the event of the operation failing, the cluster will enter the [ERROR + // state][Cluster.Status.ERROR] and eventually be deleted. + CREATE_CLUSTER = 1; + + // The cluster is being deleted. The cluster should be assumed to be + // unusable as soon as this operation starts. + // + // In the event of the operation failing, the cluster will enter the [ERROR + // state][Cluster.Status.ERROR] and the deletion will be automatically + // retried until completed. + DELETE_CLUSTER = 2; + + // The [cluster + // version][google.container.v1.ClusterUpdate.desired_master_version] is + // being updated. Note that this includes "upgrades" to the same version, + // which are simply a recreation. This also includes + // [auto-upgrades](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-upgrades#upgrading_automatically). + // For more details, see [documentation on cluster + // upgrades](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-upgrades#cluster_upgrades). + UPGRADE_MASTER = 3; + + // A node pool is being updated. Despite calling this an "upgrade", this + // includes most forms of updates to node pools. This also includes + // [auto-upgrades](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-upgrades). + // + // This operation sets the + // [progress][google.container.v1.Operation.progress] field and may be + // [canceled][google.container.v1.ClusterManager.CancelOperation]. + // + // The upgrade strategy depends on [node pool + // configuration](https://cloud.google.com/kubernetes-engine/docs/concepts/node-pool-upgrade-strategies). + // The nodes are generally still usable during this operation. + UPGRADE_NODES = 4; + + // A problem has been detected with the control plane and is being repaired. + // This operation type is initiated by GKE. For more details, see + // [documentation on + // repairs](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions#repairs). + REPAIR_CLUSTER = 5; + + // The cluster is being updated. This is a broad category of operations and + // includes operations that only change metadata as well as those that must + // recreate the entire cluster. If the control plane must be recreated, this + // will cause temporary downtime for zonal clusters. + // + // Some features require recreating the nodes as well. Those will be + // recreated as separate operations and the update may not be completely + // functional until the node pools recreations finish. Node recreations will + // generally follow [maintenance + // policies](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions). + // + // Some GKE-initiated operations use this type. This includes certain types + // of auto-upgrades and incident mitigations. + UPDATE_CLUSTER = 6; + + // A node pool is being created. The node pool should be assumed to be + // unusable until this operation finishes. In the event of an error, the + // node pool may be partially created. + // + // If enabled, [node + // autoprovisioning](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-provisioning) + // may have automatically initiated such operations. + CREATE_NODE_POOL = 7; + + // The node pool is being deleted. The node pool should be assumed to be + // unusable as soon as this operation starts. + DELETE_NODE_POOL = 8; + + // The node pool's [manamagent][google.container.v1.NodePool.management] + // field is being updated. These operations only update metadata and may be + // concurrent with most other operations. + SET_NODE_POOL_MANAGEMENT = 9; + + // A problem has been detected with nodes and [they are being + // repaired](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-repair). + // This operation type is initiated by GKE, typically automatically. This + // operation may be concurrent with other operations and there may be + // multiple repairs occurring on the same node pool. + AUTO_REPAIR_NODES = 10; + + // Unused. Automatic node upgrade uses + // [UPGRADE_NODES][google.container.v1.Operation.Type.UPGRADE_NODES]. + AUTO_UPGRADE_NODES = 11 [deprecated = true]; + + // Unused. Updating labels uses + // [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. + SET_LABELS = 12 [deprecated = true]; + + // Unused. Updating master auth uses + // [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. + SET_MASTER_AUTH = 13 [deprecated = true]; + + // The node pool is being resized. With the exception of resizing to or from + // size zero, the node pool is generally usable during this operation. + SET_NODE_POOL_SIZE = 14; + + // Unused. Updating network policy uses + // [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. + SET_NETWORK_POLICY = 15 [deprecated = true]; + + // Unused. Updating maintenance policy uses + // [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. + SET_MAINTENANCE_POLICY = 16 [deprecated = true]; + + // The control plane is being resized. This operation type is initiated by + // GKE. These operations are often performed preemptively to ensure that the + // control plane has sufficient resources and is not typically an indication + // of issues. For more details, see + // [documentation on + // resizes](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions#repairs). + RESIZE_CLUSTER = 18; + } + + // The server-assigned ID for the operation. + string name = 1; + + // The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // operation is taking place. This field is deprecated, use location instead. + string zone = 2 [deprecated = true]; + + // The operation type. + Type operation_type = 3; + + // The current status of the operation. + Status status = 4; + + // Detailed operation progress, if available. + string detail = 8; + + // Output only. If an error has occurred, a textual description of the error. + // Deprecated. Use the field error instead. + string status_message = 5 + [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; + + // Server-defined URI for the operation. Example: + // `https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123`. + string self_link = 6; + + // Server-defined URI for the target of the operation. The format of this is a + // URI to the resource being modified (such as a cluster, node pool, or node). + // For node pool repairs, there may be multiple nodes being repaired, but only + // one will be the target. + // + // Examples: + // + // - + // ## + // `https://container.googleapis.com/v1/projects/123/locations/us-central1/clusters/my-cluster` + // + // ## + // `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np` + // + // `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np/node/my-node` + string target_link = 7; + + // [Output only] The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) + // or + // [region](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) + // in which the cluster resides. + string location = 9; + + // [Output only] The time the operation started, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string start_time = 10; + + // [Output only] The time the operation completed, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string end_time = 11; + + // Output only. [Output only] Progress information for an operation. + OperationProgress progress = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Which conditions caused the current cluster state. + // Deprecated. Use field error instead. + repeated StatusCondition cluster_conditions = 13 [deprecated = true]; + + // Which conditions caused the current node pool state. + // Deprecated. Use field error instead. + repeated StatusCondition nodepool_conditions = 14 [deprecated = true]; + + // The error result of the operation in case of failure. + google.rpc.Status error = 15; +} + +// Information about operation (or operation stage) progress. +message OperationProgress { + // Progress metric is (string, int|float|string) pair. + message Metric { + // Required. Metric name, e.g., "nodes total", "percent done". + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Strictly one of the values is required. + oneof value { + // For metrics with integer value. + int64 int_value = 2; + + // For metrics with floating point value. + double double_value = 3; + + // For metrics with custom values (ratios, visual progress, etc.). + string string_value = 4; + } + } + + // A non-parameterized string describing an operation stage. + // Unset for single-stage operations. + string name = 1; + + // Status of an operation stage. + // Unset for single-stage operations. + Operation.Status status = 2; + + // Progress metric bundle, for example: + // metrics: [{name: "nodes done", int_value: 15}, + // {name: "nodes total", int_value: 32}] + // or + // metrics: [{name: "progress", double_value: 0.56}, + // {name: "progress scale", double_value: 1.0}] + repeated Metric metrics = 3; + + // Substages of an operation or a stage. + repeated OperationProgress stages = 4; +} + +// CreateClusterRequest creates a cluster. +message CreateClusterRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the parent field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the parent + // field. + string zone = 2 [deprecated = true]; + + // Required. A [cluster + // resource](https://cloud.google.com/container-engine/reference/rest/v1/projects.locations.clusters) + Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED]; + + // The parent (project and location) where the cluster will be created. + // Specified in the format `projects/*/locations/*`. + string parent = 5; +} + +// GetClusterRequest gets the settings of a cluster. +message GetClusterRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to retrieve. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // The name (project, location, cluster) of the cluster to retrieve. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 5; +} + +// UpdateClusterRequest updates the settings of a cluster. +message UpdateClusterRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Required. A description of the update. + ClusterUpdate update = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to update. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 5; +} + +// UpdateNodePoolRequests update a node pool's image and/or version. +message UpdateNodePoolRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Deprecated. The name of the node pool to upgrade. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 [deprecated = true]; + + // Required. The Kubernetes version to change the nodes to (typically an + // upgrade). + // + // Users may specify either explicit versions offered by Kubernetes Engine or + // version aliases, which have the following behavior: + // + // - "latest": picks the highest valid Kubernetes version + // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + // - "1.X.Y-gke.N": picks an explicit Kubernetes version + // - "-": picks the Kubernetes master version + string node_version = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. The desired image type for the node pool. Please see + // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for + // available image types. + string image_type = 6 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster, node pool) of the node pool to + // update. Specified in the format + // `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 8; + + // The desired list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // node pool's nodes should be located. Changing the locations for a node pool + // will result in nodes being either created or removed from the node pool, + // depending on whether locations are being added or removed. + repeated string locations = 13; + + // The desired workload metadata config for the node pool. + WorkloadMetadataConfig workload_metadata_config = 14; + + // Upgrade settings control disruption and speed of the upgrade. + NodePool.UpgradeSettings upgrade_settings = 15; + + // The desired network tags to be applied to all nodes in the node pool. + // If this field is not present, the tags will not be changed. Otherwise, + // the existing network tags will be *replaced* with the provided tags. + NetworkTags tags = 16; + + // The desired node taints to be applied to all nodes in the node pool. + // If this field is not present, the taints will not be changed. Otherwise, + // the existing node taints will be *replaced* with the provided taints. + NodeTaints taints = 17; + + // The desired node labels to be applied to all nodes in the node pool. + // If this field is not present, the labels will not be changed. Otherwise, + // the existing node labels will be *replaced* with the provided labels. + NodeLabels labels = 18; + + // Parameters that can be configured on Linux nodes. + LinuxNodeConfig linux_node_config = 19; + + // Node kubelet configs. + NodeKubeletConfig kubelet_config = 20; + + // Node network config. + NodeNetworkConfig node_network_config = 21; + + // GCFS config. + GcfsConfig gcfs_config = 22; + + // Confidential nodes config. + // All the nodes in the node pool will be Confidential VM once enabled. + ConfidentialNodes confidential_nodes = 23; + + // Enable or disable gvnic on the node pool. + VirtualNIC gvnic = 29; + + // The current etag of the node pool. + // If an etag is provided and does not match the current etag of the node + // pool, update will be blocked and an ABORTED error will be returned. + string etag = 30; + + // Enable or disable NCCL fast socket for the node pool. + FastSocket fast_socket = 31; + + // Logging configuration. + NodePoolLoggingConfig logging_config = 32; + + // The resource labels for the node pool to use to annotate any related + // Google Compute Engine resources. + ResourceLabels resource_labels = 33; + + // Parameters that can be configured on Windows nodes. + WindowsNodeConfig windows_node_config = 34; +} + +// SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool. +message SetNodePoolAutoscalingRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Deprecated. The name of the node pool to upgrade. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 [deprecated = true]; + + // Required. Autoscaling configuration for the node pool. + NodePoolAutoscaling autoscaling = 5 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster, node pool) of the node pool to set + // autoscaler settings. Specified in the format + // `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 6; +} + +// SetLoggingServiceRequest sets the logging service of a cluster. +message SetLoggingServiceRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Required. The logging service the cluster should use to write logs. + // Currently available options: + // + // * `logging.googleapis.com/kubernetes` - The Cloud Logging + // service with a Kubernetes-native resource model + // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer + // available as of GKE 1.15). + // * `none` - no logs will be exported from the cluster. + // + // If left as an empty string,`logging.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. + string logging_service = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to set logging. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 5; +} + +// SetMonitoringServiceRequest sets the monitoring service of a cluster. +message SetMonitoringServiceRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Required. The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring + // service with a Kubernetes-native resource model + // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no + // longer available as of GKE 1.15). + // * `none` - No metrics will be exported from the cluster. + // + // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. + string monitoring_service = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to set monitoring. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; +} + +// SetAddonsConfigRequest sets the addons associated with the cluster. +message SetAddonsConfigRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Required. The desired configurations for the various addons available to + // run in the cluster. + AddonsConfig addons_config = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to set addons. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; +} + +// SetLocationsRequest sets the locations of the cluster. +message SetLocationsRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Required. The desired list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster's nodes should be located. Changing the locations a cluster is in + // will result in nodes being either created or removed from the cluster, + // depending on whether locations are being added or removed. + // + // This list must always include the cluster's primary zone. + repeated string locations = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to set locations. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; +} + +// UpdateMasterRequest updates the master of the cluster. +message UpdateMasterRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Required. The Kubernetes version to change the master to. + // + // Users may specify either explicit versions offered by Kubernetes Engine or + // version aliases, which have the following behavior: + // + // - "latest": picks the highest valid Kubernetes version + // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + // - "1.X.Y-gke.N": picks an explicit Kubernetes version + // - "-": picks the default Kubernetes version + string master_version = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to update. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 7; +} + +// SetMasterAuthRequest updates the admin password of a cluster. +message SetMasterAuthRequest { + // Operation type: what type update to perform. + enum Action { + // Operation is unknown and will error out. + UNKNOWN = 0; + + // Set the password to a user generated value. + SET_PASSWORD = 1; + + // Generate a new password and set it to that. + GENERATE_PASSWORD = 2; + + // Set the username. If an empty username is provided, basic authentication + // is disabled for the cluster. If a non-empty username is provided, basic + // authentication is enabled, with either a provided password or a generated + // one. + SET_USERNAME = 3; + } + + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Required. The exact form of action to be taken on the master auth. + Action action = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. A description of the update. + MasterAuth update = 5 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to set auth. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 7; +} + +// DeleteClusterRequest deletes a cluster. +message DeleteClusterRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to delete. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // The name (project, location, cluster) of the cluster to delete. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 4; +} + +// ListClustersRequest lists clusters. +message ListClustersRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the parent field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides, or "-" for all zones. This field has been deprecated and + // replaced by the parent field. + string zone = 2 [deprecated = true]; + + // The parent (project and location) where the clusters will be listed. + // Specified in the format `projects/*/locations/*`. + // Location "-" matches all zones and all regions. + string parent = 4; +} + +// ListClustersResponse is the result of ListClustersRequest. +message ListClustersResponse { + // A list of clusters in the project in the specified zone, or + // across all ones. + repeated Cluster clusters = 1; + + // If any zones are listed here, the list of clusters returned + // may be missing those zones. + repeated string missing_zones = 2; +} + +// GetOperationRequest gets a single operation. +message GetOperationRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The server-assigned `name` of the operation. + // This field has been deprecated and replaced by the name field. + string operation_id = 3 [deprecated = true]; + + // The name (project, location, operation id) of the operation to get. + // Specified in the format `projects/*/locations/*/operations/*`. + string name = 5; +} + +// ListOperationsRequest lists operations. +message ListOperationsRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the parent field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) to return + // operations for, or `-` for all zones. This field has been deprecated and + // replaced by the parent field. + string zone = 2 [deprecated = true]; + + // The parent (project and location) where the operations will be listed. + // Specified in the format `projects/*/locations/*`. + // Location "-" matches all zones and all regions. + string parent = 4; +} + +// CancelOperationRequest cancels a single operation. +message CancelOperationRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // operation resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The server-assigned `name` of the operation. + // This field has been deprecated and replaced by the name field. + string operation_id = 3 [deprecated = true]; + + // The name (project, location, operation id) of the operation to cancel. + // Specified in the format `projects/*/locations/*/operations/*`. + string name = 4; +} + +// ListOperationsResponse is the result of ListOperationsRequest. +message ListOperationsResponse { + // A list of operations in the project in the specified zone. + repeated Operation operations = 1; + + // If any zones are listed here, the list of operations returned + // may be missing the operations from those zones. + repeated string missing_zones = 2; +} + +// Gets the current Kubernetes Engine service configuration. +message GetServerConfigRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) to return + // operations for. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // The name (project and location) of the server config to get, + // specified in the format `projects/*/locations/*`. + string name = 4; +} + +// Kubernetes Engine service configuration. +message ServerConfig { + // ReleaseChannelConfig exposes configuration for a release channel. + message ReleaseChannelConfig { + // The release channel this configuration applies to. + ReleaseChannel.Channel channel = 1; + + // The default version for newly created clusters on the channel. + string default_version = 2; + + // List of valid versions for the channel. + repeated string valid_versions = 4; + } + + // Version of Kubernetes the service deploys by default. + string default_cluster_version = 1; + + // List of valid node upgrade target versions, in descending order. + repeated string valid_node_versions = 3; + + // Default image type. + string default_image_type = 4; + + // List of valid image types. + repeated string valid_image_types = 5; + + // List of valid master versions, in descending order. + repeated string valid_master_versions = 6; + + // List of release channel configurations. + repeated ReleaseChannelConfig channels = 9; +} + +// CreateNodePoolRequest creates a node pool for a cluster. +message CreateNodePoolRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the parent field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the parent + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the parent field. + string cluster_id = 3 [deprecated = true]; + + // Required. The node pool to create. + NodePool node_pool = 4 [(google.api.field_behavior) = REQUIRED]; + + // The parent (project, location, cluster name) where the node pool will be + // created. Specified in the format + // `projects/*/locations/*/clusters/*`. + string parent = 6; +} + +// DeleteNodePoolRequest deletes a node pool for a cluster. +message DeleteNodePoolRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Deprecated. The name of the node pool to delete. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 [deprecated = true]; + + // The name (project, location, cluster, node pool id) of the node pool to + // delete. Specified in the format + // `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 6; +} + +// ListNodePoolsRequest lists the node pool(s) for a cluster. +message ListNodePoolsRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the parent field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the parent + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the parent field. + string cluster_id = 3 [deprecated = true]; + + // The parent (project, location, cluster name) where the node pools will be + // listed. Specified in the format `projects/*/locations/*/clusters/*`. + string parent = 5; +} + +// GetNodePoolRequest retrieves a node pool for a cluster. +message GetNodePoolRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Deprecated. The name of the node pool. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 [deprecated = true]; + + // The name (project, location, cluster, node pool id) of the node pool to + // get. Specified in the format + // `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 6; +} + +// Settings for blue-green upgrade. +message BlueGreenSettings { + // Standard rollout policy is the default policy for blue-green. + message StandardRolloutPolicy { + // Blue pool size to drain in a batch. + oneof update_batch_size { + // Percentage of the blue pool nodes to drain in a batch. + // The range of this field should be (0.0, 1.0]. + float batch_percentage = 1; + + // Number of blue nodes to drain in a batch. + int32 batch_node_count = 2; + } + + // Soak time after each batch gets drained. Default to zero. + optional google.protobuf.Duration batch_soak_duration = 3; + } + + // The rollout policy controls the general rollout progress of blue-green. + oneof rollout_policy { + // Standard policy for the blue-green upgrade. + StandardRolloutPolicy standard_rollout_policy = 1; + } + + // Time needed after draining entire blue pool. After this period, blue pool + // will be cleaned up. + optional google.protobuf.Duration node_pool_soak_duration = 2; +} + +// NodePool contains the name and configuration for a cluster's node pool. +// Node pools are a set of nodes (i.e. VM's), with a common configuration and +// specification, under the control of the cluster master. They may have a set +// of Kubernetes labels applied to them, which may be used to reference them +// during pod scheduling. They may also be resized up or down, to accommodate +// the workload. +message NodePool { + // These upgrade settings control the level of parallelism and the level of + // disruption caused by an upgrade. + // + // maxUnavailable controls the number of nodes that can be simultaneously + // unavailable. + // + // maxSurge controls the number of additional nodes that can be added to the + // node pool temporarily for the time of the upgrade to increase the number of + // available nodes. + // + // (maxUnavailable + maxSurge) determines the level of parallelism (how many + // nodes are being upgraded at the same time). + // + // Note: upgrades inevitably introduce some disruption since workloads need to + // be moved from old nodes to new, upgraded ones. Even if maxUnavailable=0, + // this holds true. (Disruption stays within the limits of + // PodDisruptionBudget, if it is configured.) + // + // Consider a hypothetical node pool with 5 nodes having maxSurge=2, + // maxUnavailable=1. This means the upgrade process upgrades 3 nodes + // simultaneously. It creates 2 additional (upgraded) nodes, then it brings + // down 3 old (not yet upgraded) nodes at the same time. This ensures that + // there are always at least 4 nodes available. + // + // These upgrade settings configure the upgrade strategy for the node pool. + // Use strategy to switch between the strategies applied to the node pool. + // + // If the strategy is ROLLING, use max_surge and max_unavailable to control + // the level of parallelism and the level of disruption caused by upgrade. + // 1. maxSurge controls the number of additional nodes that can be added to + // the node pool temporarily for the time of the upgrade to increase the + // number of available nodes. + // 2. maxUnavailable controls the number of nodes that can be simultaneously + // unavailable. + // 3. (maxUnavailable + maxSurge) determines the level of parallelism (how + // many nodes are being upgraded at the same time). + // + // If the strategy is BLUE_GREEN, use blue_green_settings to configure the + // blue-green upgrade related settings. + // 1. standard_rollout_policy is the default policy. The policy is used to + // control the way blue pool gets drained. The draining is executed in the + // batch mode. The batch size could be specified as either percentage of the + // node pool size or the number of nodes. batch_soak_duration is the soak + // time after each batch gets drained. + // 2. node_pool_soak_duration is the soak time after all blue nodes are + // drained. After this period, the blue pool nodes will be deleted. + message UpgradeSettings { + // The maximum number of nodes that can be created beyond the current size + // of the node pool during the upgrade process. + int32 max_surge = 1; + + // The maximum number of nodes that can be simultaneously unavailable during + // the upgrade process. A node is considered available if its status is + // Ready. + int32 max_unavailable = 2; + + // Update strategy of the node pool. + optional NodePoolUpdateStrategy strategy = 3; + + // Settings for blue-green upgrade strategy. + optional BlueGreenSettings blue_green_settings = 4; + } + + // UpdateInfo contains resource (instance groups, etc), status and other + // intermediate information relevant to a node pool upgrade. + message UpdateInfo { + // Information relevant to blue-green upgrade. + message BlueGreenInfo { + // Phase represents the different stages blue-green upgrade is running in. + enum Phase { + // Unspecified phase. + PHASE_UNSPECIFIED = 0; + + // blue-green upgrade has been initiated. + UPDATE_STARTED = 1; + + // Start creating green pool nodes. + CREATING_GREEN_POOL = 2; + + // Start cordoning blue pool nodes. + CORDONING_BLUE_POOL = 3; + + // Start draining blue pool nodes. + DRAINING_BLUE_POOL = 4; + + // Start soaking time after draining entire blue pool. + NODE_POOL_SOAKING = 5; + + // Start deleting blue nodes. + DELETING_BLUE_POOL = 6; + + // Rollback has been initiated. + ROLLBACK_STARTED = 7; + } + + // Current blue-green upgrade phase. + Phase phase = 1; + + // The resource URLs of the [managed instance groups] + // (/compute/docs/instance-groups/creating-groups-of-managed-instances) + // associated with blue pool. + repeated string blue_instance_group_urls = 2; + + // The resource URLs of the [managed instance groups] + // (/compute/docs/instance-groups/creating-groups-of-managed-instances) + // associated with green pool. + repeated string green_instance_group_urls = 3; + + // Time to start deleting blue pool to complete blue-green upgrade, + // in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string blue_pool_deletion_start_time = 4; + + // Version of green pool. + string green_pool_version = 5; + } + + // Information of a blue-green upgrade. + BlueGreenInfo blue_green_info = 1; + } + + // The current status of the node pool instance. + enum Status { + // Not set. + STATUS_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 RUNNING_WITH_ERROR state indicates the node pool has been created + // and is partially usable. Some error state has occurred and some + // functionality may be impaired. Customer may need to reissue a request + // or trigger a new update. + RUNNING_WITH_ERROR = 3; + + // The RECONCILING state indicates that some work is actively being done on + // the node pool, such as upgrading node software. Details can + // be found in the `statusMessage` field. + RECONCILING = 4; + + // The STOPPING state indicates the node pool is being deleted. + STOPPING = 5; + + // The ERROR state indicates the node pool may be unusable. Details + // can be found in the `statusMessage` field. + ERROR = 6; + } + + // PlacementPolicy defines the placement policy used by the node pool. + message PlacementPolicy { + // Type defines the type of placement policy. + enum Type { + // TYPE_UNSPECIFIED specifies no requirements on nodes + // placement. + TYPE_UNSPECIFIED = 0; + + // COMPACT specifies node placement in the same availability domain to + // ensure low communication latency. + COMPACT = 1; + } + + // The type of placement. + Type type = 1; + + // If set, refers to the name of a custom resource policy supplied by the + // user. The resource policy must be in the same project and region as the + // node pool. If not found, InvalidArgument error is returned. + string policy_name = 3; + } + + // The name of the node pool. + string name = 1; + + // The node configuration of the pool. + NodeConfig config = 2; + + // The initial node count for the pool. You must ensure that your + // Compute Engine [resource quota](https://cloud.google.com/compute/quotas) + // is sufficient for this number of instances. You must also have available + // firewall and routes quota. + int32 initial_node_count = 3; + + // The list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // NodePool's nodes should be located. + // + // If this value is unspecified during node pool creation, the + // [Cluster.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters#Cluster.FIELDS.locations) + // value will be used, instead. + // + // Warning: changing node pool locations will result in nodes being added + // and/or removed. + repeated string locations = 13; + + // Networking configuration for this NodePool. If specified, it overrides the + // cluster-level defaults. + NodeNetworkConfig network_config = 14; + + // [Output only] Server-defined URL for the resource. + string self_link = 100; + + // The version of Kubernetes running on this NodePool's nodes. If unspecified, + // it defaults as described + // [here](https://cloud.google.com/kubernetes-engine/versioning#specifying_node_version). + string version = 101; + + // [Output only] The resource URLs of the [managed instance + // groups](https://cloud.google.com/compute/docs/instance-groups/creating-groups-of-managed-instances) + // associated with this node pool. + // During the node pool blue-green upgrade operation, the URLs contain both + // blue and green resources. + repeated string instance_group_urls = 102; + + // [Output only] The status of the nodes in this pool instance. + Status status = 103; + + // [Output only] Deprecated. Use conditions instead. + // Additional information about the current status of this + // node pool instance, if available. + string status_message = 104 [deprecated = true]; + + // Autoscaler configuration for this NodePool. Autoscaler is enabled + // only if a valid configuration is present. + NodePoolAutoscaling autoscaling = 4; + + // NodeManagement configuration for this NodePool. + NodeManagement management = 5; + + // The constraint on the maximum number of pods that can be run + // simultaneously on a node in the node pool. + MaxPodsConstraint max_pods_constraint = 6; + + // Which conditions caused the current node pool state. + repeated StatusCondition conditions = 105; + + // [Output only] The pod CIDR block size per node in this node pool. + int32 pod_ipv4_cidr_size = 7; + + // Upgrade settings control disruption and speed of the upgrade. + UpgradeSettings upgrade_settings = 107; + + // Specifies the node placement policy. + PlacementPolicy placement_policy = 108; + + // Output only. [Output only] Update info contains relevant information during + // a node pool update. + UpdateInfo update_info = 109 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // This checksum is computed by the server based on the value of node pool + // fields, and may be sent on update requests to ensure the client has an + // up-to-date value before proceeding. + string etag = 110; + + // Enable best effort provisioning for nodes + BestEffortProvisioning best_effort_provisioning = 113; +} + +// NodeManagement defines the set of node management services turned on for the +// node pool. +message NodeManagement { + // A flag that specifies whether node auto-upgrade is enabled for the node + // pool. If enabled, node auto-upgrade helps keep the nodes in your node pool + // up to date with the latest release version of Kubernetes. + bool auto_upgrade = 1; + + // A flag that specifies whether the node auto-repair is enabled for the node + // pool. If enabled, the nodes in this node pool will be monitored and, if + // they fail health checks too many times, an automatic repair action will be + // triggered. + bool auto_repair = 2; + + // Specifies the Auto Upgrade knobs for the node pool. + AutoUpgradeOptions upgrade_options = 10; +} + +// Best effort provisioning. +message BestEffortProvisioning { + // When this is enabled, cluster/node pool creations will ignore non-fatal + // errors like stockout to best provision as many nodes as possible right now + // and eventually bring up all target number of nodes + bool enabled = 1; + + // Minimum number of nodes to be provisioned to be considered as succeeded, + // and the rest of nodes will be provisioned gradually and eventually when + // stockout issue has been resolved. + int32 min_provision_nodes = 2; +} + +// AutoUpgradeOptions defines the set of options for the user to control how +// the Auto Upgrades will proceed. +message AutoUpgradeOptions { + // [Output only] This field is set when upgrades are about to commence + // with the approximate start time for the upgrades, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string auto_upgrade_start_time = 1; + + // [Output only] This field is set when upgrades are about to commence + // with the description of the upgrade. + string description = 2; +} + +// MaintenancePolicy defines the maintenance policy to be used for the cluster. +message MaintenancePolicy { + // Specifies the maintenance window in which maintenance may be performed. + MaintenanceWindow window = 1; + + // A hash identifying the version of this policy, so that updates to fields of + // the policy won't accidentally undo intermediate changes (and so that users + // of the API unaware of some fields won't accidentally remove other fields). + // Make a `get()` request to the cluster to get the current + // resource version and include it with requests to set the policy. + string resource_version = 3; +} + +// MaintenanceWindow defines the maintenance window to be used for the cluster. +message MaintenanceWindow { + oneof policy { + // DailyMaintenanceWindow specifies a daily maintenance operation window. + DailyMaintenanceWindow daily_maintenance_window = 2; + + // RecurringWindow specifies some number of recurring time periods for + // maintenance to occur. The time windows may be overlapping. If no + // maintenance windows are set, maintenance can occur at any time. + RecurringTimeWindow recurring_window = 3; + } + + // Exceptions to maintenance window. Non-emergency maintenance should not + // occur in these windows. + map maintenance_exclusions = 4; +} + +// Represents an arbitrary window of time. +message TimeWindow { + oneof options { + // MaintenanceExclusionOptions provides maintenance exclusion related + // options. + MaintenanceExclusionOptions maintenance_exclusion_options = 3; + } + + // The time that the window first starts. + google.protobuf.Timestamp start_time = 1; + + // The time that the window ends. The end time should take place after the + // start time. + google.protobuf.Timestamp end_time = 2; +} + +// Represents the Maintenance exclusion option. +message MaintenanceExclusionOptions { + // Scope of exclusion. + enum Scope { + // NO_UPGRADES excludes all upgrades, including patch upgrades and minor + // upgrades across control planes and nodes. This is the default exclusion + // behavior. + NO_UPGRADES = 0; + + // NO_MINOR_UPGRADES excludes all minor upgrades for the cluster, only + // patches are allowed. + NO_MINOR_UPGRADES = 1; + + // NO_MINOR_OR_NODE_UPGRADES excludes all minor upgrades for the cluster, + // and also exclude all node pool upgrades. Only control + // plane patches are allowed. + NO_MINOR_OR_NODE_UPGRADES = 2; + } + + // Scope specifies the upgrade scope which upgrades are blocked by the + // exclusion. + Scope scope = 1; +} + +// Represents an arbitrary window of time that recurs. +message RecurringTimeWindow { + // The window of the first recurrence. + TimeWindow window = 1; + + // An RRULE (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for how + // this window reccurs. They go on for the span of time between the start and + // end time. + // + // For example, to have something repeat every weekday, you'd use: + // `FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR` + // + // To repeat some window daily (equivalent to the DailyMaintenanceWindow): + // `FREQ=DAILY` + // + // For the first weekend of every month: + // `FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU` + // + // This specifies how frequently the window starts. Eg, if you wanted to have + // a 9-5 UTC-4 window every weekday, you'd use something like: + // ``` + // start time = 2019-01-01T09:00:00-0400 + // end time = 2019-01-01T17:00:00-0400 + // recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR + // ``` + // + // Windows can span multiple days. Eg, to make the window encompass every + // weekend from midnight Saturday till the last minute of Sunday UTC: + // ``` + // start time = 2019-01-05T00:00:00Z + // end time = 2019-01-07T23:59:00Z + // recurrence = FREQ=WEEKLY;BYDAY=SA + // ``` + // + // Note the start and end time's specific dates are largely arbitrary except + // to specify duration of the window and when it first starts. + // The FREQ values of HOURLY, MINUTELY, and SECONDLY are not supported. + string recurrence = 2; +} + +// Time window specified for daily maintenance operations. +message DailyMaintenanceWindow { + // Time within the maintenance window to start the maintenance operations. + // Time format should be in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) + // format "HH:MM", where HH : [00-23] and MM : [00-59] GMT. + string start_time = 2; + + // [Output only] Duration of the time window, automatically chosen to be + // smallest possible in the given scenario. + // Duration will be in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) + // format "PTnHnMnS". + string duration = 3; +} + +// SetNodePoolManagementRequest sets the node management properties of a node +// pool. +message SetNodePoolManagementRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to update. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Deprecated. The name of the node pool to update. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 [deprecated = true]; + + // Required. NodeManagement configuration for the node pool. + NodeManagement management = 5 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster, node pool id) of the node pool to set + // management properties. Specified in the format + // `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 7; +} + +// SetNodePoolSizeRequest sets the size of a node pool. +message SetNodePoolSizeRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to update. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Deprecated. The name of the node pool to update. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 [deprecated = true]; + + // Required. The desired node count for the pool. + int32 node_count = 5 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster, node pool id) of the node pool to set + // size. + // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 7; +} + +// CompleteNodePoolUpgradeRequest sets the name of target node pool to complete +// upgrade. +message CompleteNodePoolUpgradeRequest { + // The name (project, location, cluster, node pool id) of the node pool to + // complete upgrade. + // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 1; +} + +// RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed +// NodePool upgrade. This will be an no-op if the last upgrade successfully +// completed. +message RollbackNodePoolUpgradeRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to rollback. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Deprecated. The name of the node pool to rollback. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 [deprecated = true]; + + // The name (project, location, cluster, node pool id) of the node poll to + // rollback upgrade. + // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 6; + + // Option for rollback to ignore the PodDisruptionBudget. + // Default value is false. + bool respect_pdb = 7; +} + +// ListNodePoolsResponse is the result of ListNodePoolsRequest. +message ListNodePoolsResponse { + // A list of node pools for a cluster. + repeated NodePool node_pools = 1; +} + +// ClusterAutoscaling contains global, per-cluster information +// required by Cluster Autoscaler to automatically adjust +// the size of the cluster and create/delete +// node pools based on the current needs. +message ClusterAutoscaling { + // Defines possible options for autoscaling_profile field. + enum AutoscalingProfile { + // No change to autoscaling configuration. + PROFILE_UNSPECIFIED = 0; + + // Prioritize optimizing utilization of resources. + OPTIMIZE_UTILIZATION = 1; + + // Use default (balanced) autoscaling configuration. + BALANCED = 2; + } + + // Enables automatic node pool creation and deletion. + bool enable_node_autoprovisioning = 1; + + // Contains global constraints regarding minimum and maximum + // amount of resources in the cluster. + repeated ResourceLimit resource_limits = 2; + + // Defines autoscaling behaviour. + AutoscalingProfile autoscaling_profile = 3; + + // AutoprovisioningNodePoolDefaults contains defaults for a node pool + // created by NAP. + AutoprovisioningNodePoolDefaults autoprovisioning_node_pool_defaults = 4; + + // The list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // NodePool's nodes can be created by NAP. + repeated string autoprovisioning_locations = 5; +} + +// AutoprovisioningNodePoolDefaults contains defaults for a node pool created +// by NAP. +message AutoprovisioningNodePoolDefaults { + // Scopes that are used by NAP when creating node pools. + repeated string oauth_scopes = 1; + + // The Google Cloud Platform Service Account to be used by the node VMs. + string service_account = 2; + + // Specifies the upgrade settings for NAP created node pools + NodePool.UpgradeSettings upgrade_settings = 3; + + // Specifies the node management options for NAP created node-pools. + NodeManagement management = 4; + + // Deprecated. Minimum CPU platform to be used for NAP created node pools. + // The instance may be scheduled on the specified or newer CPU platform. + // Applicable values are the friendly names of CPU platforms, such as + // minCpuPlatform: Intel Haswell or + // minCpuPlatform: Intel Sandy Bridge. For more + // information, read [how to specify min CPU + // platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform). + // This field is deprecated, min_cpu_platform should be specified using + // `cloud.google.com/requested-min-cpu-platform` label selector on the pod. + // To unset the min cpu platform field pass "automatic" + // as field value. + string min_cpu_platform = 5 [deprecated = true]; + + // Size of the disk attached to each node, specified in GB. + // The smallest allowed disk size is 10GB. + // + // If unspecified, the default disk size is 100GB. + int32 disk_size_gb = 6; + + // Type of the disk attached to each node (e.g. 'pd-standard', 'pd-ssd' or + // 'pd-balanced') + // + // If unspecified, the default disk type is 'pd-standard' + string disk_type = 7; + + // Shielded Instance options. + ShieldedInstanceConfig shielded_instance_config = 8; + + // The Customer Managed Encryption Key used to encrypt the boot disk attached + // to each node in the node pool. This should be of the form + // projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. + // For more information about protecting resources with Cloud KMS Keys please + // see: + // https://cloud.google.com/compute/docs/disks/customer-managed-encryption + string boot_disk_kms_key = 9; + + // The image type to use for NAP created node. Please see + // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for + // available image types. + string image_type = 10; + + // Enable or disable Kubelet read only port. + optional bool insecure_kubelet_readonly_port_enabled = 13; +} + +// Contains information about amount of some resource in the cluster. +// For memory, value should be in GB. +message ResourceLimit { + // Resource name "cpu", "memory" or gpu-specific string. + string resource_type = 1; + + // Minimum amount of the resource in the cluster. + int64 minimum = 2; + + // Maximum amount of the resource in the cluster. + int64 maximum = 3; +} + +// NodePoolAutoscaling contains information required by cluster autoscaler to +// adjust the size of the node pool to the current cluster usage. +message NodePoolAutoscaling { + // Location policy specifies how zones are picked when scaling up the + // nodepool. + enum LocationPolicy { + // Not set. + LOCATION_POLICY_UNSPECIFIED = 0; + + // BALANCED is a best effort policy that aims to balance the sizes of + // different zones. + BALANCED = 1; + + // ANY policy picks zones that have the highest capacity available. + ANY = 2; + } + + // Is autoscaling enabled for this node pool. + bool enabled = 1; + + // Minimum number of nodes for one location in the NodePool. Must be >= 1 and + // <= max_node_count. + int32 min_node_count = 2; + + // Maximum number of nodes for one location in the NodePool. Must be >= + // min_node_count. There has to be enough quota to scale up the cluster. + int32 max_node_count = 3; + + // Can this node pool be deleted automatically. + bool autoprovisioned = 4; + + // Location policy used when scaling up a nodepool. + LocationPolicy location_policy = 5; + + // Minimum number of nodes in the node pool. Must be greater than 1 less than + // total_max_node_count. + // The total_*_node_count fields are mutually exclusive with the *_node_count + // fields. + int32 total_min_node_count = 6; + + // Maximum number of nodes in the node pool. Must be greater than + // total_min_node_count. There has to be enough quota to scale up the cluster. + // The total_*_node_count fields are mutually exclusive with the *_node_count + // fields. + int32 total_max_node_count = 7; +} + +// SetLabelsRequest sets the Google Cloud Platform labels on a Google Container +// Engine cluster, which will in turn set them for Google Compute Engine +// resources used by that cluster +message SetLabelsRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Required. The labels to set for that cluster. + map resource_labels = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The fingerprint of the previous set of labels for this resource, + // used to detect conflicts. The fingerprint is initially generated by + // Kubernetes Engine and changes after every request to modify or update + // labels. You must always provide an up-to-date fingerprint hash when + // updating or changing labels. Make a `get()` request to the + // resource to get the latest fingerprint. + string label_fingerprint = 5 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster name) of the cluster to set labels. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 7; +} + +// SetLegacyAbacRequest enables or disables the ABAC authorization mechanism for +// a cluster. +message SetLegacyAbacRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster to update. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Required. Whether ABAC authorization will be enabled in the cluster. + bool enabled = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster name) of the cluster to set legacy + // abac. Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; +} + +// StartIPRotationRequest creates a new IP for the cluster and then performs +// a node upgrade on each node pool to point to the new IP. +message StartIPRotationRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // The name (project, location, cluster name) of the cluster to start IP + // rotation. Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; + + // Whether to rotate credentials during IP rotation. + bool rotate_credentials = 7; +} + +// CompleteIPRotationRequest moves the cluster master back into single-IP mode. +message CompleteIPRotationRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // The name (project, location, cluster name) of the cluster to complete IP + // rotation. Specified in the format `projects/*/locations/*/clusters/*`. + string name = 7; +} + +// AcceleratorConfig represents a Hardware Accelerator request. +message AcceleratorConfig { + // The number of the accelerator cards exposed to an instance. + int64 accelerator_count = 1; + + // The accelerator type resource name. List of supported accelerators + // [here](https://cloud.google.com/compute/docs/gpus) + string accelerator_type = 2; + + // Size of partitions to create on the GPU. Valid values are described in the + // NVIDIA [mig user + // guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning). + string gpu_partition_size = 3; + + // The configuration for GPU sharing options. + optional GPUSharingConfig gpu_sharing_config = 5; + + // The configuration for auto installation of GPU driver. + optional GPUDriverInstallationConfig gpu_driver_installation_config = 6; +} + +// GPUSharingConfig represents the GPU sharing configuration for Hardware +// Accelerators. +message GPUSharingConfig { + // The type of GPU sharing strategy currently provided. + enum GPUSharingStrategy { + // Default value. + GPU_SHARING_STRATEGY_UNSPECIFIED = 0; + + // GPUs are time-shared between containers. + TIME_SHARING = 1; + } + + // The max number of containers that can share a physical GPU. + int64 max_shared_clients_per_gpu = 1; + + // The type of GPU sharing strategy to enable on the GPU node. + optional GPUSharingStrategy gpu_sharing_strategy = 2; +} + +// GPUDriverInstallationConfig specifies the version of GPU driver to be auto +// installed. +message GPUDriverInstallationConfig { + // The GPU driver version to install. + enum GPUDriverVersion { + // Default value is to not install any GPU driver. + GPU_DRIVER_VERSION_UNSPECIFIED = 0; + + // Disable GPU driver auto installation and needs manual installation + INSTALLATION_DISABLED = 1; + + // "Default" GPU driver in COS and Ubuntu. + DEFAULT = 2; + + // "Latest" GPU driver in COS. + LATEST = 3; + } + + // Mode for how the GPU driver is installed. + optional GPUDriverVersion gpu_driver_version = 1; +} + +// WorkloadMetadataConfig defines the metadata configuration to expose to +// workloads on the node pool. +message WorkloadMetadataConfig { + // Mode is the configuration for how to expose metadata to workloads running + // on the node. + enum Mode { + // Not set. + MODE_UNSPECIFIED = 0; + + // Expose all Compute Engine metadata to pods. + GCE_METADATA = 1; + + // Run the GKE Metadata Server on this node. The GKE Metadata Server exposes + // a metadata API to workloads that is compatible with the V1 Compute + // Metadata APIs exposed by the Compute Engine and App Engine Metadata + // Servers. This feature can only be enabled if Workload Identity is enabled + // at the cluster level. + GKE_METADATA = 2; + } + + // Mode is the configuration for how to expose metadata to workloads running + // on the node pool. + Mode mode = 2; +} + +// SetNetworkPolicyRequest enables/disables network policy for a cluster. +message SetNetworkPolicyRequest { + // Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 [deprecated = true]; + + // Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true]; + + // Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 [deprecated = true]; + + // Required. Configuration options for the NetworkPolicy feature. + NetworkPolicy network_policy = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster name) of the cluster to set networking + // policy. Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; +} + +// SetMaintenancePolicyRequest sets the maintenance policy for a cluster. +message SetMaintenancePolicyRequest { + // Required. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. + string zone = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the cluster to update. + string cluster_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The maintenance policy to be set for the cluster. An empty field + // clears the existing maintenance policy. + MaintenancePolicy maintenance_policy = 4 + [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster name) of the cluster to set + // maintenance policy. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 5; +} + +// StatusCondition describes why a cluster or a node pool has a certain status +// (e.g., ERROR or DEGRADED). +message StatusCondition { + // Code for each condition + enum Code { + // UNKNOWN indicates a generic condition. + UNKNOWN = 0; + + // GCE_STOCKOUT indicates that Google Compute Engine resources are + // temporarily unavailable. + GCE_STOCKOUT = 1; + + // GKE_SERVICE_ACCOUNT_DELETED indicates that the user deleted their robot + // service account. + GKE_SERVICE_ACCOUNT_DELETED = 2; + + // Google Compute Engine quota was exceeded. + GCE_QUOTA_EXCEEDED = 3; + + // Cluster state was manually changed by an SRE due to a system logic error. + SET_BY_OPERATOR = 4; + + // Unable to perform an encrypt operation against the CloudKMS key used for + // etcd level encryption. + CLOUD_KMS_KEY_ERROR = 7; + + // Cluster CA is expiring soon. + CA_EXPIRING = 9; + } + + // Machine-friendly representation of the condition + // Deprecated. Use canonical_code instead. + Code code = 1 [deprecated = true]; + + // Human-friendly representation of the condition + string message = 2; + + // Canonical code of the condition. + google.rpc.Code canonical_code = 3; +} + +// NetworkConfig reports the relative names of network & subnetwork. +message NetworkConfig { + // Configuration of network bandwidth tiers + message ClusterNetworkPerformanceConfig { + // Node network tier + enum Tier { + // Default value + TIER_UNSPECIFIED = 0; + + // Higher bandwidth, actual values based on VM size. + TIER_1 = 1; + } + + // Specifies the total network bandwidth tier for NodePools in the cluster. + optional Tier total_egress_bandwidth_tier = 1; + } + + // Output only. The relative name of the Google Compute Engine + // [network][google.container.v1.NetworkConfig.network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) + // to which the cluster is connected. Example: + // projects/my-project/global/networks/my-network + string network = 1; + + // Output only. The relative name of the Google Compute Engine + // [subnetwork](https://cloud.google.com/compute/docs/vpc) to which the + // cluster is connected. Example: + // projects/my-project/regions/us-central1/subnetworks/my-subnet + string subnetwork = 2; + + // Whether Intra-node visibility is enabled for this cluster. + // This makes same node pod to pod traffic visible for VPC network. + bool enable_intra_node_visibility = 5; + + // Whether the cluster disables default in-node sNAT rules. In-node sNAT rules + // will be disabled when default_snat_status is disabled. When disabled is set + // to false, default IP masquerade rules will be applied to the nodes to + // prevent sNAT on cluster internal traffic. + DefaultSnatStatus default_snat_status = 7; + + // Whether L4ILB Subsetting is enabled for this cluster. + bool enable_l4ilb_subsetting = 10; + + // The desired datapath provider for this cluster. By default, uses the + // IPTables-based kube-proxy implementation. + DatapathProvider datapath_provider = 11; + + // The desired state of IPv6 connectivity to Google Services. + // By default, no private IPv6 access to or from Google Services (all access + // will be via IPv4) + PrivateIPv6GoogleAccess private_ipv6_google_access = 12; + + // DNSConfig contains clusterDNS config for this cluster. + DNSConfig dns_config = 13; + + // ServiceExternalIPsConfig specifies if services with externalIPs field are + // blocked or not. + ServiceExternalIPsConfig service_external_ips_config = 15; + + // GatewayAPIConfig contains the desired config of Gateway API on this + // cluster. + GatewayAPIConfig gateway_api_config = 16; + + // Whether multi-networking is enabled for this cluster. + bool enable_multi_networking = 17; + + // Network bandwidth tier configuration. + ClusterNetworkPerformanceConfig network_performance_config = 18; + + // Whether FQDN Network Policy is enabled on this cluster. + optional bool enable_fqdn_network_policy = 19; +} + +// GatewayAPIConfig contains the desired config of Gateway API on this cluster. +message GatewayAPIConfig { + // Channel describes if/how Gateway API should be installed and implemented in + // a cluster. + enum Channel { + // Default value. + CHANNEL_UNSPECIFIED = 0; + + // Gateway API support is disabled + CHANNEL_DISABLED = 1; + + // Gateway API support is enabled, experimental CRDs are installed + CHANNEL_EXPERIMENTAL = 3; + + // Gateway API support is enabled, standard CRDs are installed + CHANNEL_STANDARD = 4; + } + + // The Gateway API release channel to use for Gateway API. + Channel channel = 1; +} + +// Config to block services with externalIPs field. +message ServiceExternalIPsConfig { + // Whether Services with ExternalIPs field are allowed or not. + bool enabled = 1; +} + +// GetOpenIDConfigRequest gets the OIDC discovery document for the +// cluster. See the OpenID Connect Discovery 1.0 specification for details. +message GetOpenIDConfigRequest { + // The cluster (project, location, cluster name) to get the discovery document + // for. Specified in the format `projects/*/locations/*/clusters/*`. + string parent = 1; +} + +// GetOpenIDConfigResponse is an OIDC discovery document for the cluster. +// See the OpenID Connect Discovery 1.0 specification for details. +message GetOpenIDConfigResponse { + // OIDC Issuer. + string issuer = 1; + + // JSON Web Key uri. + string jwks_uri = 2; + + // Supported response types. + repeated string response_types_supported = 3; + + // Supported subject types. + repeated string subject_types_supported = 4; + + // supported ID Token signing Algorithms. + repeated string id_token_signing_alg_values_supported = 5; + + // Supported claims. + repeated string claims_supported = 6; + + // Supported grant types. + repeated string grant_types = 7; +} + +// GetJSONWebKeysRequest gets the public component of the keys used by the +// cluster to sign token requests. This will be the jwks_uri for the discover +// document returned by getOpenIDConfig. See the OpenID Connect +// Discovery 1.0 specification for details. +message GetJSONWebKeysRequest { + // The cluster (project, location, cluster name) to get keys for. Specified in + // the format `projects/*/locations/*/clusters/*`. + string parent = 1; +} + +// Jwk is a JSON Web Key as specified in RFC 7517 +message Jwk { + // Key Type. + string kty = 1; + + // Algorithm. + string alg = 2; + + // Permitted uses for the public keys. + string use = 3; + + // Key ID. + string kid = 4; + + // Used for RSA keys. + string n = 5; + + // Used for RSA keys. + string e = 6; + + // Used for ECDSA keys. + string x = 7; + + // Used for ECDSA keys. + string y = 8; + + // Used for ECDSA keys. + string crv = 9; +} + +// GetJSONWebKeysResponse is a valid JSON Web Key Set as specififed in rfc 7517 +message GetJSONWebKeysResponse { + // The public component of the keys used by the cluster to sign token + // requests. + repeated Jwk keys = 1; +} + +// CheckAutopilotCompatibilityRequest requests getting the blockers for the +// given operation in the cluster. +message CheckAutopilotCompatibilityRequest { + // The name (project, location, cluster) of the cluster to retrieve. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 1; +} + +// AutopilotCompatibilityIssue contains information about a specific +// compatibility issue with Autopilot mode. +message AutopilotCompatibilityIssue { + // The type of the reported issue. + enum IssueType { + // Default value, should not be used. + UNSPECIFIED = 0; + + // Indicates that the issue is a known incompatibility between the + // cluster and Autopilot mode. + INCOMPATIBILITY = 1; + + // Indicates the issue is an incompatibility if customers take no further + // action to resolve. + ADDITIONAL_CONFIG_REQUIRED = 2; + + // Indicates the issue is not an incompatibility, but depending on the + // workloads business logic, there is a potential that they won't work on + // Autopilot. + PASSED_WITH_OPTIONAL_CONFIG = 3; + } + + // The last time when this issue was observed. + google.protobuf.Timestamp last_observation = 1; + + // The constraint type of the issue. + string constraint_type = 2; + + // The incompatibility type of this issue. + IssueType incompatibility_type = 3; + + // The name of the resources which are subject to this issue. + repeated string subjects = 4; + + // A URL to a public documnetation, which addresses resolving this issue. + string documentation_url = 5; + + // The description of the issue. + string description = 6; +} + +// CheckAutopilotCompatibilityResponse has a list of compatibility issues. +message CheckAutopilotCompatibilityResponse { + // The list of issues for the given operation. + repeated AutopilotCompatibilityIssue issues = 1; + + // The summary of the autopilot compatibility response. + string summary = 2; +} + +// ReleaseChannel indicates which release channel a cluster is +// subscribed to. Release channels are arranged in order of risk. +// +// When a cluster is subscribed to a release channel, Google maintains +// both the master version and the node version. Node auto-upgrade +// defaults to true and cannot be disabled. +message ReleaseChannel { + // Possible values for 'channel'. + enum Channel { + // No channel specified. + UNSPECIFIED = 0; + + // RAPID channel is offered on an early access basis for customers who want + // to test new releases. + // + // WARNING: Versions available in the RAPID Channel may be subject to + // unresolved issues with no known workaround and are not subject to any + // SLAs. + RAPID = 1; + + // Clusters subscribed to REGULAR receive versions that are considered GA + // quality. REGULAR is intended for production users who want to take + // advantage of new features. + REGULAR = 2; + + // Clusters subscribed to STABLE receive versions that are known to be + // stable and reliable in production. + STABLE = 3; + } + + // channel specifies which release channel the cluster is subscribed to. + Channel channel = 1; +} + +// Configuration for fine-grained cost management feature. +message CostManagementConfig { + // Whether the feature is enabled or not. + bool enabled = 1; +} + +// IntraNodeVisibilityConfig contains the desired config of the intra-node +// visibility on this cluster. +message IntraNodeVisibilityConfig { + // Enables intra node visibility for this cluster. + bool enabled = 1; +} + +// ILBSubsettingConfig contains the desired config of L4 Internal LoadBalancer +// subsetting on this cluster. +message ILBSubsettingConfig { + // Enables l4 ILB subsetting for this cluster. + bool enabled = 1; +} + +// DNSConfig contains the desired set of options for configuring clusterDNS. +message DNSConfig { + // Provider lists the various in-cluster DNS providers. + enum Provider { + // Default value + PROVIDER_UNSPECIFIED = 0; + + // Use GKE default DNS provider(kube-dns) for DNS resolution. + PLATFORM_DEFAULT = 1; + + // Use CloudDNS for DNS resolution. + CLOUD_DNS = 2; + + // Use KubeDNS for DNS resolution. + KUBE_DNS = 3; + } + + // DNSScope lists the various scopes of access to cluster DNS records. + enum DNSScope { + // Default value, will be inferred as cluster scope. + DNS_SCOPE_UNSPECIFIED = 0; + + // DNS records are accessible from within the cluster. + CLUSTER_SCOPE = 1; + + // DNS records are accessible from within the VPC. + VPC_SCOPE = 2; + } + + // cluster_dns indicates which in-cluster DNS provider should be used. + Provider cluster_dns = 1; + + // cluster_dns_scope indicates the scope of access to cluster DNS records. + DNSScope cluster_dns_scope = 2; + + // cluster_dns_domain is the suffix used for all cluster service records. + string cluster_dns_domain = 3; +} + +// Constraints applied to pods. +message MaxPodsConstraint { + // Constraint enforced on the max num of pods per node. + int64 max_pods_per_node = 1; +} + +// Configuration for the use of Kubernetes Service Accounts in GCP IAM +// policies. +message WorkloadIdentityConfig { + // The workload pool to attach all Kubernetes service accounts to. + string workload_pool = 2; +} + +// IdentityServiceConfig is configuration for Identity Service which allows +// customers to use external identity providers with the K8S API +message IdentityServiceConfig { + // Whether to enable the Identity Service component + bool enabled = 1; +} + +// Configuration for issuance of mTLS keys and certificates to Kubernetes pods. +message MeshCertificates { + // enable_certificates controls issuance of workload mTLS certificates. + // + // If set, the GKE Workload Identity Certificates controller and node agent + // will be deployed in the cluster, which can then be configured by creating a + // WorkloadCertificateConfig Custom Resource. + // + // Requires Workload Identity + // ([workload_pool][google.container.v1.WorkloadIdentityConfig.workload_pool] + // must be non-empty). + google.protobuf.BoolValue enable_certificates = 1; +} + +// Configuration of etcd encryption. +message DatabaseEncryption { + // State of etcd encryption. + enum State { + // Should never be set + UNKNOWN = 0; + + // Secrets in etcd are encrypted. + ENCRYPTED = 1; + + // Secrets in etcd are stored in plain text (at etcd level) - this is + // unrelated to Compute Engine level full disk encryption. + DECRYPTED = 2; + } + + // Name of CloudKMS key to use for the encryption of secrets in etcd. + // Ex. projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key + string key_name = 1; + + // The desired state of etcd encryption. + State state = 2; +} + +// ListUsableSubnetworksRequest requests the list of usable subnetworks +// available to a user for creating clusters. +message ListUsableSubnetworksRequest { + // The parent project where subnetworks are usable. + // Specified in the format `projects/*`. + string parent = 1; + + // Filtering currently only supports equality on the networkProjectId and must + // be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` + // is the project which owns the listed subnetworks. This defaults to the + // parent project ID. + string filter = 2; + + // The max number of results per page that should be returned. If the number + // of available results is larger than `page_size`, a `next_page_token` is + // returned which can be used to get the next page of results in subsequent + // requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + int32 page_size = 3; + + // Specifies a page token to use. Set this to the nextPageToken returned by + // previous list requests to get the next page of results. + string page_token = 4; +} + +// ListUsableSubnetworksResponse is the response of +// ListUsableSubnetworksRequest. +message ListUsableSubnetworksResponse { + // A list of usable subnetworks in the specified network project. + repeated UsableSubnetwork subnetworks = 1; + + // This token allows you to get the next page of results for list requests. + // If the number of results is larger than `page_size`, use the + // `next_page_token` as a value for the query parameter `page_token` in the + // next request. The value will become empty when there are no more pages. + string next_page_token = 2; +} + +// Secondary IP range of a usable subnetwork. +message UsableSubnetworkSecondaryRange { + // Status shows the current usage of a secondary IP range. + enum Status { + // UNKNOWN is the zero value of the Status enum. It's not a valid status. + UNKNOWN = 0; + + // UNUSED denotes that this range is unclaimed by any cluster. + UNUSED = 1; + + // IN_USE_SERVICE denotes that this range is claimed by cluster(s) for + // services. User-managed services range can be shared between clusters + // within the same subnetwork. + IN_USE_SERVICE = 2; + + // IN_USE_SHAREABLE_POD denotes this range was created by the network admin + // and is currently claimed by a cluster for pods. It can only be used by + // other clusters as a pod range. + IN_USE_SHAREABLE_POD = 3; + + // IN_USE_MANAGED_POD denotes this range was created by GKE and is claimed + // for pods. It cannot be used for other clusters. + IN_USE_MANAGED_POD = 4; + } + + // The name associated with this subnetwork secondary range, used when adding + // an alias IP range to a VM instance. + string range_name = 1; + + // The range of IP addresses belonging to this subnetwork secondary range. + string ip_cidr_range = 2; + + // This field is to determine the status of the secondary range programmably. + Status status = 3; +} + +// UsableSubnetwork resource returns the subnetwork name, its associated network +// and the primary CIDR range. +message UsableSubnetwork { + // Subnetwork Name. + // Example: projects/my-project/regions/us-central1/subnetworks/my-subnet + string subnetwork = 1; + + // Network Name. + // Example: projects/my-project/global/networks/my-network + string network = 2; + + // The range of internal addresses that are owned by this subnetwork. + string ip_cidr_range = 3; + + // Secondary IP ranges. + repeated UsableSubnetworkSecondaryRange secondary_ip_ranges = 4; + + // A human readable status message representing the reasons for cases where + // the caller cannot use the secondary ranges under the subnet. For example if + // the secondary_ip_ranges is empty due to a permission issue, an insufficient + // permission message will be given by status_message. + string status_message = 5; +} + +// Configuration for exporting cluster resource usages. +message ResourceUsageExportConfig { + // Parameters for using BigQuery as the destination of resource usage export. + message BigQueryDestination { + // The ID of a BigQuery Dataset. + string dataset_id = 1; + } + + // Parameters for controlling consumption metering. + message ConsumptionMeteringConfig { + // Whether to enable consumption metering for this cluster. If enabled, a + // second BigQuery table will be created to hold resource consumption + // records. + bool enabled = 1; + } + + // Configuration to use BigQuery as usage export destination. + BigQueryDestination bigquery_destination = 1; + + // Whether to enable network egress metering for this cluster. If enabled, a + // daemonset will be created in the cluster to meter network egress traffic. + bool enable_network_egress_metering = 2; + + // Configuration to enable resource consumption metering. + ConsumptionMeteringConfig consumption_metering_config = 3; +} + +// VerticalPodAutoscaling contains global, per-cluster information +// required by Vertical Pod Autoscaler to automatically adjust +// the resources of pods controlled by it. +message VerticalPodAutoscaling { + // Enables vertical pod autoscaling. + bool enabled = 1; +} + +// DefaultSnatStatus contains the desired state of whether default sNAT should +// be disabled on the cluster. +message DefaultSnatStatus { + // Disables cluster default sNAT rules. + bool disabled = 1; +} + +// Configuration of Shielded Nodes feature. +message ShieldedNodes { + // Whether Shielded Nodes features are enabled on all nodes in this cluster. + bool enabled = 1; +} + +// Configuration of gVNIC feature. +message VirtualNIC { + // Whether gVNIC features are enabled in the node pool. + bool enabled = 1; +} + +// Configuration of Fast Socket feature. +message FastSocket { + // Whether Fast Socket features are enabled in the node pool. + bool enabled = 1; +} + +// PrivateIPv6GoogleAccess controls whether and how the pods can communicate +// with Google Services through gRPC over IPv6. +enum PrivateIPv6GoogleAccess { + // Default value. Same as DISABLED + PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED = 0; + + // No private access to or from Google Services + PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED = 1; + + // Enables private IPv6 access to Google Services from GKE + PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE = 2; + + // Enables private IPv6 access to and from Google Services + PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL = 3; +} + +// NotificationConfig is the configuration of notifications. +message NotificationConfig { + // Types of notifications currently supported. Can be used to filter what + // notifications are sent. + enum EventType { + // Not set, will be ignored. + EVENT_TYPE_UNSPECIFIED = 0; + + // Corresponds with UpgradeAvailableEvent. + UPGRADE_AVAILABLE_EVENT = 1; + + // Corresponds with UpgradeEvent. + UPGRADE_EVENT = 2; + + // Corresponds with SecurityBulletinEvent. + SECURITY_BULLETIN_EVENT = 3; + } + + // Pub/Sub specific notification config. + message PubSub { + // Enable notifications for Pub/Sub. + bool enabled = 1; + + // The desired Pub/Sub topic to which notifications will be + // sent by GKE. Format is `projects/{project}/topics/{topic}`. + string topic = 2 [ + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; + + // Allows filtering to one or more specific event types. If no filter is + // specified, or if a filter is specified with no event types, all event + // types will be sent + Filter filter = 3; + } + + // Allows filtering to one or more specific event types. If event types are + // present, those and only those event types will be transmitted to the + // cluster. Other types will be skipped. If no filter is specified, or no + // event types are present, all event types will be sent + message Filter { + // Event types to allowlist. + repeated EventType event_type = 1; + } + + // Notification config for Pub/Sub. + PubSub pubsub = 1; +} + +// ConfidentialNodes is configuration for the confidential nodes feature, which +// makes nodes run on confidential VMs. +message ConfidentialNodes { + // Whether Confidential Nodes feature is enabled. + bool enabled = 1; +} + +// UpgradeResourceType is the resource type that is upgrading. It is used +// in upgrade notifications. +enum UpgradeResourceType { + // Default value. This shouldn't be used. + UPGRADE_RESOURCE_TYPE_UNSPECIFIED = 0; + + // Master / control plane + MASTER = 1; + + // Node pool + NODE_POOL = 2; +} + +// UpgradeEvent is a notification sent to customers by the cluster server when +// a resource is upgrading. +message UpgradeEvent { + // The resource type that is upgrading. + UpgradeResourceType resource_type = 1; + + // The operation associated with this upgrade. + string operation = 2; + + // The time when the operation was started. + google.protobuf.Timestamp operation_start_time = 3; + + // The current version before the upgrade. + string current_version = 4; + + // The target version for the upgrade. + string target_version = 5; + + // Optional relative path to the resource. For example in node pool upgrades, + // the relative path of the node pool. + string resource = 6; +} + +// UpgradeAvailableEvent is a notification sent to customers when a new +// available version is released. +message UpgradeAvailableEvent { + // The release version available for upgrade. + string version = 1; + + // The resource type of the release version. + UpgradeResourceType resource_type = 2; + + // The release channel of the version. If empty, it means a non-channel + // release. + ReleaseChannel release_channel = 3; + + // Optional relative path to the resource. For example, the relative path of + // the node pool. + string resource = 4; +} + +// SecurityBulletinEvent is a notification sent to customers when a security +// bulletin has been posted that they are vulnerable to. +message SecurityBulletinEvent { + // The resource type (node/control plane) that has the vulnerability. Multiple + // notifications (1 notification per resource type) will be sent for a + // vulnerability that affects > 1 resource type. + string resource_type_affected = 1; + + // The ID of the bulletin corresponding to the vulnerability. + string bulletin_id = 2; + + // The CVEs associated with this bulletin. + repeated string cve_ids = 3; + + // The severity of this bulletin as it relates to GKE. + string severity = 4; + + // The URI link to the bulletin on the website for more information. + string bulletin_uri = 5; + + // A brief description of the bulletin. See the bulletin pointed to by the + // bulletin_uri field for an expanded description. + string brief_description = 6; + + // The GKE minor versions affected by this vulnerability. + repeated string affected_supported_minors = 7; + + // The GKE versions where this vulnerability is patched. + repeated string patched_versions = 8; + + // This represents a version selected from the patched_versions field that + // the cluster receiving this notification should most likely want to upgrade + // to based on its current version. Note that if this notification is being + // received by a given cluster, it means that this version is currently + // available as an upgrade target in that cluster's location. + string suggested_upgrade_target = 9; + + // If this field is specified, it means there are manual steps that the user + // must take to make their clusters safe. + bool manual_steps_required = 10; +} + +// Autopilot is the configuration for Autopilot settings on the cluster. +message Autopilot { + // Enable Autopilot + bool enabled = 1; + + // Workload policy configuration for Autopilot. + WorkloadPolicyConfig workload_policy_config = 2; +} + +// WorkloadPolicyConfig is the configuration of workload policy for autopilot +// clusters. +message WorkloadPolicyConfig { + // If true, workloads can use NET_ADMIN capability. + optional bool allow_net_admin = 1; +} + +// LoggingConfig is cluster logging configuration. +message LoggingConfig { + // Logging components configuration + LoggingComponentConfig component_config = 1; +} + +// LoggingComponentConfig is cluster logging component configuration. +message LoggingComponentConfig { + // GKE components exposing logs + enum Component { + // Default value. This shouldn't be used. + COMPONENT_UNSPECIFIED = 0; + + // system components + SYSTEM_COMPONENTS = 1; + + // workloads + WORKLOADS = 2; + + // kube-apiserver + APISERVER = 3; + + // kube-scheduler + SCHEDULER = 4; + + // kube-controller-manager + CONTROLLER_MANAGER = 5; + } + + // Select components to collect logs. An empty set would disable all logging. + repeated Component enable_components = 1; +} + +// MonitoringConfig is cluster monitoring configuration. +message MonitoringConfig { + // Monitoring components configuration + MonitoringComponentConfig component_config = 1; + + // Enable Google Cloud Managed Service for Prometheus + // in the cluster. + ManagedPrometheusConfig managed_prometheus_config = 2; + + // Configuration of Advanced Datapath Observability features. + AdvancedDatapathObservabilityConfig advanced_datapath_observability_config = + 3; +} + +// AdvancedDatapathObservabilityConfig specifies configuration of observability +// features of advanced datapath. +message AdvancedDatapathObservabilityConfig { + // Supported Relay modes + enum RelayMode { + // Default value. This shouldn't be used. + RELAY_MODE_UNSPECIFIED = 0; + + // disabled + DISABLED = 1; + + // exposed via internal load balancer + INTERNAL_VPC_LB = 3; + + // exposed via external load balancer + EXTERNAL_LB = 4; + } + + // Expose flow metrics on nodes + bool enable_metrics = 1; + + // Method used to make Relay available + RelayMode relay_mode = 2; +} + +// NodePoolLoggingConfig specifies logging configuration for nodepools. +message NodePoolLoggingConfig { + // Logging variant configuration. + LoggingVariantConfig variant_config = 1; +} + +// LoggingVariantConfig specifies the behaviour of the logging component. +message LoggingVariantConfig { + // Logging component variants. + enum Variant { + // Default value. This shouldn't be used. + VARIANT_UNSPECIFIED = 0; + + // default logging variant. + DEFAULT = 1; + + // maximum logging throughput variant. + MAX_THROUGHPUT = 2; + } + + // Logging variant deployed on nodes. + Variant variant = 1; +} + +// MonitoringComponentConfig is cluster monitoring component configuration. +message MonitoringComponentConfig { + // GKE components exposing metrics + enum Component { + // Default value. This shouldn't be used. + COMPONENT_UNSPECIFIED = 0; + + // system components + SYSTEM_COMPONENTS = 1; + + // kube-apiserver + APISERVER = 3; + + // kube-scheduler + SCHEDULER = 4; + + // kube-controller-manager + CONTROLLER_MANAGER = 5; + + // Storage + STORAGE = 7; + + // Horizontal Pod Autoscaling + HPA = 8; + + // Pod + POD = 9; + + // DaemonSet + DAEMONSET = 10; + + // Deployment + DEPLOYMENT = 11; + + // Statefulset + STATEFULSET = 12; + } + + // Select components to collect metrics. An empty set would disable all + // monitoring. + repeated Component enable_components = 1; +} + +// The datapath provider selects the implementation of the Kubernetes networking +// model for service resolution and network policy enforcement. +enum DatapathProvider { + // Default value. + DATAPATH_PROVIDER_UNSPECIFIED = 0; + + // Use the IPTables implementation based on kube-proxy. + LEGACY_DATAPATH = 1; + + // Use the eBPF based GKE Dataplane V2 with additional features. See the [GKE + // Dataplane V2 + // documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/dataplane-v2) + // for more. + ADVANCED_DATAPATH = 2; +} + +// Strategy used for node pool update. +enum NodePoolUpdateStrategy { + // Default value if unset. GKE internally defaults the update strategy to + // SURGE for unspecified strategies. + NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED = 0; + + // blue-green upgrade. + BLUE_GREEN = 2; + + // SURGE is the traditional way of upgrade a node pool. + // max_surge and max_unavailable determines the level of upgrade parallelism. + SURGE = 3; +} + +// ManagedPrometheusConfig defines the configuration for +// Google Cloud Managed Service for Prometheus. +message ManagedPrometheusConfig { + // Enable Managed Collection. + bool enabled = 1; +} + +// Fleet is the fleet configuration for the cluster. +message Fleet { + // The Fleet host project(project ID or project number) where this cluster + // will be registered to. This field cannot be changed after the cluster has + // been registered. + string project = 1; + + // [Output only] The full resource name of the registered fleet membership of + // the cluster, in the format + // `//gkehub.googleapis.com/projects/*/locations/*/memberships/*`. + string membership = 2; + + // [Output only] Whether the cluster has been registered through the fleet + // API. + bool pre_registered = 3; +} + +// Possible values for IP stack type +enum StackType { + // Default value, will be defaulted as IPV4 only + STACK_TYPE_UNSPECIFIED = 0; + + // Cluster is IPV4 only + IPV4 = 1; + + // Cluster can use both IPv4 and IPv6 + IPV4_IPV6 = 2; +} + +// Possible values for IPv6 access type +enum IPv6AccessType { + // Default value, will be defaulted as type external. + IPV6_ACCESS_TYPE_UNSPECIFIED = 0; + + // Access type internal (all v6 addresses are internal IPs) + INTERNAL = 1; + + // Access type external (all v6 addresses are external IPs) + EXTERNAL = 2; +} + +// LocalNvmeSsdBlockConfig contains configuration for using raw-block local +// NVMe SSD. +message LocalNvmeSsdBlockConfig { + // The number of raw-block local NVMe SSD disks to be attached to the node. + // Each local SSD is 375 GB in size. If zero, it means no raw-block local NVMe + // SSD disks to be attached to the node. + // The limit for this value is dependent upon the maximum number of + // disks available on a machine per zone. See: + // https://cloud.google.com/compute/docs/disks/local-ssd + // for more information. + int32 local_ssd_count = 1; +} + +// EphemeralStorageLocalSsdConfig contains configuration for the node ephemeral +// storage using Local SSD. +message EphemeralStorageLocalSsdConfig { + // Number of local SSDs to use to back ephemeral storage. Uses NVMe + // interfaces. Each local SSD is 375 GB in size. + // If zero, it means to disable using local SSDs as ephemeral storage. + // The limit for this value is dependent upon the maximum number of + // disks available on a machine per zone. See: + // https://cloud.google.com/compute/docs/disks/local-ssd + // for more information. + int32 local_ssd_count = 1; +} diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.cancel_operation.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.cancel_operation.js new file mode 100644 index 00000000000..e556c2aaf76 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.cancel_operation.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 container_v1_generated_ClusterManager_CancelOperation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, operation id) of the operation to cancel. + * Specified in the format `projects/* /locations/* /operations/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCancelOperation() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.cancelOperation(request); + console.log(response); + } + + callCancelOperation(); + // [END container_v1_generated_ClusterManager_CancelOperation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.check_autopilot_compatibility.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.check_autopilot_compatibility.js new file mode 100644 index 00000000000..e4d731fc2d0 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.check_autopilot_compatibility.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 container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster) of the cluster to retrieve. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCheckAutopilotCompatibility() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.checkAutopilotCompatibility(request); + console.log(response); + } + + callCheckAutopilotCompatibility(); + // [END container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_i_p_rotation.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_i_p_rotation.js new file mode 100644 index 00000000000..82b71531860 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_i_p_rotation.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 container_v1_generated_ClusterManager_CompleteIPRotation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster name) of the cluster to complete IP + * rotation. Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCompleteIPRotation() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.completeIPRotation(request); + console.log(response); + } + + callCompleteIPRotation(); + // [END container_v1_generated_ClusterManager_CompleteIPRotation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_node_pool_upgrade.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_node_pool_upgrade.js new file mode 100644 index 00000000000..8cf74642faf --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_node_pool_upgrade.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() { + // [START container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster, node pool id) of the node pool to + * complete upgrade. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCompleteNodePoolUpgrade() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.completeNodePoolUpgrade(request); + console.log(response); + } + + callCompleteNodePoolUpgrade(); + // [END container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_cluster.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_cluster.js new file mode 100644 index 00000000000..bc132fbb109 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_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(cluster) { + // [START container_v1_generated_ClusterManager_CreateCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 cluster + * resource (https://cloud.google.com/container-engine/reference/rest/v1/projects.locations.clusters) + */ + // const cluster = {} + /** + * The parent (project and location) where the cluster will be created. + * Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCreateCluster() { + // Construct request + const request = { + cluster, + }; + + // Run request + const response = await containerClient.createCluster(request); + console.log(response); + } + + callCreateCluster(); + // [END container_v1_generated_ClusterManager_CreateCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_node_pool.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_node_pool.js new file mode 100644 index 00000000000..c2526e72425 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_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(nodePool) { + // [START container_v1_generated_ClusterManager_CreateNodePool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The node pool to create. + */ + // const nodePool = {} + /** + * The parent (project, location, cluster name) where the node pool will be + * created. Specified in the format + * `projects/* /locations/* /clusters/*`. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCreateNodePool() { + // Construct request + const request = { + nodePool, + }; + + // Run request + const response = await containerClient.createNodePool(request); + console.log(response); + } + + callCreateNodePool(); + // [END container_v1_generated_ClusterManager_CreateNodePool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_cluster.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_cluster.js new file mode 100644 index 00000000000..b7f789d7b80 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_cluster.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 container_v1_generated_ClusterManager_DeleteCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster) of the cluster to delete. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callDeleteCluster() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.deleteCluster(request); + console.log(response); + } + + callDeleteCluster(); + // [END container_v1_generated_ClusterManager_DeleteCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_node_pool.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_node_pool.js new file mode 100644 index 00000000000..1d286e9963b --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_node_pool.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() { + // [START container_v1_generated_ClusterManager_DeleteNodePool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster, node pool id) of the node pool to + * delete. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callDeleteNodePool() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.deleteNodePool(request); + console.log(response); + } + + callDeleteNodePool(); + // [END container_v1_generated_ClusterManager_DeleteNodePool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_cluster.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_cluster.js new file mode 100644 index 00000000000..565479929b5 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_cluster.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 container_v1_generated_ClusterManager_GetCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster) of the cluster to retrieve. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callGetCluster() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.getCluster(request); + console.log(response); + } + + callGetCluster(); + // [END container_v1_generated_ClusterManager_GetCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_j_s_o_n_web_keys.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_j_s_o_n_web_keys.js new file mode 100644 index 00000000000..ce76d378ce1 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_j_s_o_n_web_keys.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 container_v1_generated_ClusterManager_GetJSONWebKeys_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 cluster (project, location, cluster name) to get keys for. Specified in + * the format `projects/* /locations/* /clusters/*`. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callGetJSONWebKeys() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.getJSONWebKeys(request); + console.log(response); + } + + callGetJSONWebKeys(); + // [END container_v1_generated_ClusterManager_GetJSONWebKeys_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_node_pool.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_node_pool.js new file mode 100644 index 00000000000..fb3301234b1 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_node_pool.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() { + // [START container_v1_generated_ClusterManager_GetNodePool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster, node pool id) of the node pool to + * get. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callGetNodePool() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.getNodePool(request); + console.log(response); + } + + callGetNodePool(); + // [END container_v1_generated_ClusterManager_GetNodePool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_operation.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_operation.js new file mode 100644 index 00000000000..58a774ae645 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_operation.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 container_v1_generated_ClusterManager_GetOperation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, operation id) of the operation to get. + * Specified in the format `projects/* /locations/* /operations/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callGetOperation() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.getOperation(request); + console.log(response); + } + + callGetOperation(); + // [END container_v1_generated_ClusterManager_GetOperation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_server_config.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_server_config.js new file mode 100644 index 00000000000..6a1e2ef0e69 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_server_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() { + // [START container_v1_generated_ClusterManager_GetServerConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project and location) of the server config to get, + * specified in the format `projects/* /locations/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callGetServerConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.getServerConfig(request); + console.log(response); + } + + callGetServerConfig(); + // [END container_v1_generated_ClusterManager_GetServerConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_clusters.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_clusters.js new file mode 100644 index 00000000000..fb7dbc835b2 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_clusters.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() { + // [START container_v1_generated_ClusterManager_ListClusters_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 clusters will be listed. + * Specified in the format `projects/* /locations/*`. + * Location "-" matches all zones and all regions. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callListClusters() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.listClusters(request); + console.log(response); + } + + callListClusters(); + // [END container_v1_generated_ClusterManager_ListClusters_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_node_pools.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_node_pools.js new file mode 100644 index 00000000000..fa48c06009a --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_node_pools.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 container_v1_generated_ClusterManager_ListNodePools_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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, location, cluster name) where the node pools will be + * listed. Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callListNodePools() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.listNodePools(request); + console.log(response); + } + + callListNodePools(); + // [END container_v1_generated_ClusterManager_ListNodePools_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_operations.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_operations.js new file mode 100644 index 00000000000..69eb1730393 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_operations.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() { + // [START container_v1_generated_ClusterManager_ListOperations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 operations will be listed. + * Specified in the format `projects/* /locations/*`. + * Location "-" matches all zones and all regions. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callListOperations() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.listOperations(request); + console.log(response); + } + + callListOperations(); + // [END container_v1_generated_ClusterManager_ListOperations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_usable_subnetworks.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_usable_subnetworks.js new file mode 100644 index 00000000000..a70af157bf3 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_usable_subnetworks.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 container_v1_generated_ClusterManager_ListUsableSubnetworks_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 where subnetworks are usable. + * Specified in the format `projects/*`. + */ + // const parent = 'abc123' + /** + * Filtering currently only supports equality on the networkProjectId and must + * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` + * is the project which owns the listed subnetworks. This defaults to the + * parent project ID. + */ + // const filter = 'abc123' + /** + * The max number of results per page that should be returned. If the number + * of available results is larger than `page_size`, a `next_page_token` is + * returned which can be used to get the next page of results in subsequent + * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + */ + // const pageSize = 1234 + /** + * Specifies a page token to use. Set this to the nextPageToken returned by + * previous list requests to get the next page of results. + */ + // const pageToken = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callListUsableSubnetworks() { + // Construct request + const request = { + }; + + // Run request + const iterable = await containerClient.listUsableSubnetworksAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListUsableSubnetworks(); + // [END container_v1_generated_ClusterManager_ListUsableSubnetworks_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.rollback_node_pool_upgrade.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.rollback_node_pool_upgrade.js new file mode 100644 index 00000000000..3356c397660 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.rollback_node_pool_upgrade.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() { + // [START container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster, node pool id) of the node poll to + * rollback upgrade. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + /** + * Option for rollback to ignore the PodDisruptionBudget. + * Default value is false. + */ + // const respectPdb = true + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callRollbackNodePoolUpgrade() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.rollbackNodePoolUpgrade(request); + console.log(response); + } + + callRollbackNodePoolUpgrade(); + // [END container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_addons_config.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_addons_config.js new file mode 100644 index 00000000000..c6e24e63456 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_addons_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(addonsConfig) { + // [START container_v1_generated_ClusterManager_SetAddonsConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The desired configurations for the various addons available to + * run in the cluster. + */ + // const addonsConfig = {} + /** + * The name (project, location, cluster) of the cluster to set addons. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetAddonsConfig() { + // Construct request + const request = { + addonsConfig, + }; + + // Run request + const response = await containerClient.setAddonsConfig(request); + console.log(response); + } + + callSetAddonsConfig(); + // [END container_v1_generated_ClusterManager_SetAddonsConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_labels.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_labels.js new file mode 100644 index 00000000000..3d77f05457f --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_labels.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(resourceLabels, labelFingerprint) { + // [START container_v1_generated_ClusterManager_SetLabels_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The labels to set for that cluster. + */ + // const resourceLabels = [1,2,3,4] + /** + * Required. The fingerprint of the previous set of labels for this resource, + * used to detect conflicts. The fingerprint is initially generated by + * Kubernetes Engine and changes after every request to modify or update + * labels. You must always provide an up-to-date fingerprint hash when + * updating or changing labels. Make a `get()` request to the + * resource to get the latest fingerprint. + */ + // const labelFingerprint = 'abc123' + /** + * The name (project, location, cluster name) of the cluster to set labels. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetLabels() { + // Construct request + const request = { + resourceLabels, + labelFingerprint, + }; + + // Run request + const response = await containerClient.setLabels(request); + console.log(response); + } + + callSetLabels(); + // [END container_v1_generated_ClusterManager_SetLabels_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_legacy_abac.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_legacy_abac.js new file mode 100644 index 00000000000..9c2a450c361 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_legacy_abac.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(enabled) { + // [START container_v1_generated_ClusterManager_SetLegacyAbac_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Whether ABAC authorization will be enabled in the cluster. + */ + // const enabled = true + /** + * The name (project, location, cluster name) of the cluster to set legacy + * abac. Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetLegacyAbac() { + // Construct request + const request = { + enabled, + }; + + // Run request + const response = await containerClient.setLegacyAbac(request); + console.log(response); + } + + callSetLegacyAbac(); + // [END container_v1_generated_ClusterManager_SetLegacyAbac_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_locations.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_locations.js new file mode 100644 index 00000000000..ee8b451d6e9 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_locations.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(locations) { + // [START container_v1_generated_ClusterManager_SetLocations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The desired list of Google Compute Engine + * zones (https://cloud.google.com/compute/docs/zones#available) in which the + * cluster's nodes should be located. Changing the locations a cluster is in + * will result in nodes being either created or removed from the cluster, + * depending on whether locations are being added or removed. + * This list must always include the cluster's primary zone. + */ + // const locations = ['abc','def'] + /** + * The name (project, location, cluster) of the cluster to set locations. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetLocations() { + // Construct request + const request = { + locations, + }; + + // Run request + const response = await containerClient.setLocations(request); + console.log(response); + } + + callSetLocations(); + // [END container_v1_generated_ClusterManager_SetLocations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_logging_service.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_logging_service.js new file mode 100644 index 00000000000..3333d0219c5 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_logging_service.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(loggingService) { + // [START container_v1_generated_ClusterManager_SetLoggingService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The logging service the cluster should use to write logs. + * Currently available options: + * * `logging.googleapis.com/kubernetes` - The Cloud Logging + * service with a Kubernetes-native resource model + * * `logging.googleapis.com` - The legacy Cloud Logging service (no longer + * available as of GKE 1.15). + * * `none` - no logs will be exported from the cluster. + * If left as an empty string,`logging.googleapis.com/kubernetes` will be + * used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. + */ + // const loggingService = 'abc123' + /** + * The name (project, location, cluster) of the cluster to set logging. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetLoggingService() { + // Construct request + const request = { + loggingService, + }; + + // Run request + const response = await containerClient.setLoggingService(request); + console.log(response); + } + + callSetLoggingService(); + // [END container_v1_generated_ClusterManager_SetLoggingService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_maintenance_policy.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_maintenance_policy.js new file mode 100644 index 00000000000..4e675414de2 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_maintenance_policy.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(projectId, zone, clusterId, maintenancePolicy) { + // [START container_v1_generated_ClusterManager_SetMaintenancePolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Developers Console project ID or project + * number (https://cloud.google.com/resource-manager/docs/creating-managing-projects). + */ + // const projectId = 'abc123' + /** + * Required. The name of the Google Compute Engine + * zone (https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. + */ + // const zone = 'abc123' + /** + * Required. The name of the cluster to update. + */ + // const clusterId = 'abc123' + /** + * Required. The maintenance policy to be set for the cluster. An empty field + * clears the existing maintenance policy. + */ + // const maintenancePolicy = {} + /** + * The name (project, location, cluster name) of the cluster to set + * maintenance policy. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetMaintenancePolicy() { + // Construct request + const request = { + projectId, + zone, + clusterId, + maintenancePolicy, + }; + + // Run request + const response = await containerClient.setMaintenancePolicy(request); + console.log(response); + } + + callSetMaintenancePolicy(); + // [END container_v1_generated_ClusterManager_SetMaintenancePolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_master_auth.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_master_auth.js new file mode 100644 index 00000000000..4376ebb1adc --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_master_auth.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(action, update) { + // [START container_v1_generated_ClusterManager_SetMasterAuth_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The exact form of action to be taken on the master auth. + */ + // const action = {} + /** + * Required. A description of the update. + */ + // const update = {} + /** + * The name (project, location, cluster) of the cluster to set auth. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetMasterAuth() { + // Construct request + const request = { + action, + update, + }; + + // Run request + const response = await containerClient.setMasterAuth(request); + console.log(response); + } + + callSetMasterAuth(); + // [END container_v1_generated_ClusterManager_SetMasterAuth_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_monitoring_service.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_monitoring_service.js new file mode 100644 index 00000000000..5767da6da8f --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_monitoring_service.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(monitoringService) { + // [START container_v1_generated_ClusterManager_SetMonitoringService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The monitoring service the cluster should use to write metrics. + * Currently available options: + * * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring + * service with a Kubernetes-native resource model + * * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no + * longer available as of GKE 1.15). + * * `none` - No metrics will be exported from the cluster. + * If left as an empty string,`monitoring.googleapis.com/kubernetes` will be + * used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. + */ + // const monitoringService = 'abc123' + /** + * The name (project, location, cluster) of the cluster to set monitoring. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetMonitoringService() { + // Construct request + const request = { + monitoringService, + }; + + // Run request + const response = await containerClient.setMonitoringService(request); + console.log(response); + } + + callSetMonitoringService(); + // [END container_v1_generated_ClusterManager_SetMonitoringService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_network_policy.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_network_policy.js new file mode 100644 index 00000000000..70e4a954cd3 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_network_policy.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(networkPolicy) { + // [START container_v1_generated_ClusterManager_SetNetworkPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Configuration options for the NetworkPolicy feature. + */ + // const networkPolicy = {} + /** + * The name (project, location, cluster name) of the cluster to set networking + * policy. Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetNetworkPolicy() { + // Construct request + const request = { + networkPolicy, + }; + + // Run request + const response = await containerClient.setNetworkPolicy(request); + console.log(response); + } + + callSetNetworkPolicy(); + // [END container_v1_generated_ClusterManager_SetNetworkPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_autoscaling.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_autoscaling.js new file mode 100644 index 00000000000..fde99e8483c --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_autoscaling.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(autoscaling) { + // [START container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Autoscaling configuration for the node pool. + */ + // const autoscaling = {} + /** + * The name (project, location, cluster, node pool) of the node pool to set + * autoscaler settings. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetNodePoolAutoscaling() { + // Construct request + const request = { + autoscaling, + }; + + // Run request + const response = await containerClient.setNodePoolAutoscaling(request); + console.log(response); + } + + callSetNodePoolAutoscaling(); + // [END container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_management.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_management.js new file mode 100644 index 00000000000..e1ea4030588 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_management.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(management) { + // [START container_v1_generated_ClusterManager_SetNodePoolManagement_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. NodeManagement configuration for the node pool. + */ + // const management = {} + /** + * The name (project, location, cluster, node pool id) of the node pool to set + * management properties. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetNodePoolManagement() { + // Construct request + const request = { + management, + }; + + // Run request + const response = await containerClient.setNodePoolManagement(request); + console.log(response); + } + + callSetNodePoolManagement(); + // [END container_v1_generated_ClusterManager_SetNodePoolManagement_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_size.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_size.js new file mode 100644 index 00000000000..aedfdd9f71b --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_size.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(nodeCount) { + // [START container_v1_generated_ClusterManager_SetNodePoolSize_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The desired node count for the pool. + */ + // const nodeCount = 1234 + /** + * The name (project, location, cluster, node pool id) of the node pool to set + * size. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetNodePoolSize() { + // Construct request + const request = { + nodeCount, + }; + + // Run request + const response = await containerClient.setNodePoolSize(request); + console.log(response); + } + + callSetNodePoolSize(); + // [END container_v1_generated_ClusterManager_SetNodePoolSize_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.start_i_p_rotation.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.start_i_p_rotation.js new file mode 100644 index 00000000000..a8f65196353 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.start_i_p_rotation.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() { + // [START container_v1_generated_ClusterManager_StartIPRotation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster name) of the cluster to start IP + * rotation. Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + /** + * Whether to rotate credentials during IP rotation. + */ + // const rotateCredentials = true + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callStartIPRotation() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.startIPRotation(request); + console.log(response); + } + + callStartIPRotation(); + // [END container_v1_generated_ClusterManager_StartIPRotation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_cluster.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_cluster.js new file mode 100644 index 00000000000..b0280b7fea6 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_cluster.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(update) { + // [START container_v1_generated_ClusterManager_UpdateCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 description of the update. + */ + // const update = {} + /** + * The name (project, location, cluster) of the cluster to update. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callUpdateCluster() { + // Construct request + const request = { + update, + }; + + // Run request + const response = await containerClient.updateCluster(request); + console.log(response); + } + + callUpdateCluster(); + // [END container_v1_generated_ClusterManager_UpdateCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_master.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_master.js new file mode 100644 index 00000000000..37f555312f8 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_master.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(masterVersion) { + // [START container_v1_generated_ClusterManager_UpdateMaster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Kubernetes version to change the master to. + * Users may specify either explicit versions offered by Kubernetes Engine or + * version aliases, which have the following behavior: + * - "latest": picks the highest valid Kubernetes version + * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + * - "1.X.Y-gke.N": picks an explicit Kubernetes version + * - "-": picks the default Kubernetes version + */ + // const masterVersion = 'abc123' + /** + * The name (project, location, cluster) of the cluster to update. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callUpdateMaster() { + // Construct request + const request = { + masterVersion, + }; + + // Run request + const response = await containerClient.updateMaster(request); + console.log(response); + } + + callUpdateMaster(); + // [END container_v1_generated_ClusterManager_UpdateMaster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_node_pool.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_node_pool.js new file mode 100644 index 00000000000..4620b7c49e5 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_node_pool.js @@ -0,0 +1,164 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(nodeVersion, imageType) { + // [START container_v1_generated_ClusterManager_UpdateNodePool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Kubernetes version to change the nodes to (typically an + * upgrade). + * Users may specify either explicit versions offered by Kubernetes Engine or + * version aliases, which have the following behavior: + * - "latest": picks the highest valid Kubernetes version + * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + * - "1.X.Y-gke.N": picks an explicit Kubernetes version + * - "-": picks the Kubernetes master version + */ + // const nodeVersion = 'abc123' + /** + * Required. The desired image type for the node pool. Please see + * https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for + * available image types. + */ + // const imageType = 'abc123' + /** + * The name (project, location, cluster, node pool) of the node pool to + * update. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + /** + * The desired list of Google Compute Engine + * zones (https://cloud.google.com/compute/docs/zones#available) in which the + * node pool's nodes should be located. Changing the locations for a node pool + * will result in nodes being either created or removed from the node pool, + * depending on whether locations are being added or removed. + */ + // const locations = ['abc','def'] + /** + * The desired workload metadata config for the node pool. + */ + // const workloadMetadataConfig = {} + /** + * Upgrade settings control disruption and speed of the upgrade. + */ + // const upgradeSettings = {} + /** + * The desired network tags to be applied to all nodes in the node pool. + * If this field is not present, the tags will not be changed. Otherwise, + * the existing network tags will be *replaced* with the provided tags. + */ + // const tags = {} + /** + * The desired node taints to be applied to all nodes in the node pool. + * If this field is not present, the taints will not be changed. Otherwise, + * the existing node taints will be *replaced* with the provided taints. + */ + // const taints = {} + /** + * The desired node labels to be applied to all nodes in the node pool. + * If this field is not present, the labels will not be changed. Otherwise, + * the existing node labels will be *replaced* with the provided labels. + */ + // const labels = {} + /** + * Parameters that can be configured on Linux nodes. + */ + // const linuxNodeConfig = {} + /** + * Node kubelet configs. + */ + // const kubeletConfig = {} + /** + * Node network config. + */ + // const nodeNetworkConfig = {} + /** + * GCFS config. + */ + // const gcfsConfig = {} + /** + * Confidential nodes config. + * All the nodes in the node pool will be Confidential VM once enabled. + */ + // const confidentialNodes = {} + /** + * Enable or disable gvnic on the node pool. + */ + // const gvnic = {} + /** + * The current etag of the node pool. + * If an etag is provided and does not match the current etag of the node + * pool, update will be blocked and an ABORTED error will be returned. + */ + // const etag = 'abc123' + /** + * Enable or disable NCCL fast socket for the node pool. + */ + // const fastSocket = {} + /** + * Logging configuration. + */ + // const loggingConfig = {} + /** + * The resource labels for the node pool to use to annotate any related + * Google Compute Engine resources. + */ + // const resourceLabels = {} + /** + * Parameters that can be configured on Windows nodes. + */ + // const windowsNodeConfig = {} + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callUpdateNodePool() { + // Construct request + const request = { + nodeVersion, + imageType, + }; + + // Run request + const response = await containerClient.updateNodePool(request); + console.log(response); + } + + callUpdateNodePool(); + // [END container_v1_generated_ClusterManager_UpdateNodePool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/snippet_metadata_google.container.v1.json b/owl-bot-staging/google-container/v1/samples/generated/v1/snippet_metadata_google.container.v1.json new file mode 100644 index 00000000000..66a864e5ad7 --- /dev/null +++ b/owl-bot-staging/google-container/v1/samples/generated/v1/snippet_metadata_google.container.v1.json @@ -0,0 +1,1915 @@ +{ + "clientLibrary": { + "name": "nodejs-container", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.container.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "container_v1_generated_ClusterManager_ListClusters_async", + "title": "ClusterManager listClusters Sample", + "origin": "API_DEFINITION", + "description": " Lists all clusters owned by a project in either the specified zone or all zones.", + "canonical": true, + "file": "cluster_manager.list_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListClusters", + "fullName": "google.container.v1.ClusterManager.ListClusters", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.ListClustersResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "ListClusters", + "fullName": "google.container.v1.ClusterManager.ListClusters", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_GetCluster_async", + "title": "ClusterManager getCluster Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a specific cluster.", + "canonical": true, + "file": "cluster_manager.get_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCluster", + "fullName": "google.container.v1.ClusterManager.GetCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Cluster", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "GetCluster", + "fullName": "google.container.v1.ClusterManager.GetCluster", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_CreateCluster_async", + "title": "ClusterManager createCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's [default network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.", + "canonical": true, + "file": "cluster_manager.create_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCluster", + "fullName": "google.container.v1.ClusterManager.CreateCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster", + "type": ".google.container.v1.Cluster" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "CreateCluster", + "fullName": "google.container.v1.ClusterManager.CreateCluster", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_UpdateCluster_async", + "title": "ClusterManager updateCluster Sample", + "origin": "API_DEFINITION", + "description": " Updates the settings of a specific cluster.", + "canonical": true, + "file": "cluster_manager.update_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCluster", + "fullName": "google.container.v1.ClusterManager.UpdateCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "update", + "type": ".google.container.v1.ClusterUpdate" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "UpdateCluster", + "fullName": "google.container.v1.ClusterManager.UpdateCluster", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_UpdateNodePool_async", + "title": "ClusterManager updateNodePool Sample", + "origin": "API_DEFINITION", + "description": " Updates the version and/or image type for the specified node pool.", + "canonical": true, + "file": "cluster_manager.update_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 156, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNodePool", + "fullName": "google.container.v1.ClusterManager.UpdateNodePool", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "node_version", + "type": "TYPE_STRING" + }, + { + "name": "image_type", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "locations", + "type": "TYPE_STRING[]" + }, + { + "name": "workload_metadata_config", + "type": ".google.container.v1.WorkloadMetadataConfig" + }, + { + "name": "upgrade_settings", + "type": ".google.container.v1.NodePool.UpgradeSettings" + }, + { + "name": "tags", + "type": ".google.container.v1.NetworkTags" + }, + { + "name": "taints", + "type": ".google.container.v1.NodeTaints" + }, + { + "name": "labels", + "type": ".google.container.v1.NodeLabels" + }, + { + "name": "linux_node_config", + "type": ".google.container.v1.LinuxNodeConfig" + }, + { + "name": "kubelet_config", + "type": ".google.container.v1.NodeKubeletConfig" + }, + { + "name": "node_network_config", + "type": ".google.container.v1.NodeNetworkConfig" + }, + { + "name": "gcfs_config", + "type": ".google.container.v1.GcfsConfig" + }, + { + "name": "confidential_nodes", + "type": ".google.container.v1.ConfidentialNodes" + }, + { + "name": "gvnic", + "type": ".google.container.v1.VirtualNIC" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "fast_socket", + "type": ".google.container.v1.FastSocket" + }, + { + "name": "logging_config", + "type": ".google.container.v1.NodePoolLoggingConfig" + }, + { + "name": "resource_labels", + "type": ".google.container.v1.ResourceLabels" + }, + { + "name": "windows_node_config", + "type": ".google.container.v1.WindowsNodeConfig" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "UpdateNodePool", + "fullName": "google.container.v1.ClusterManager.UpdateNodePool", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async", + "title": "ClusterManager setNodePoolAutoscaling Sample", + "origin": "API_DEFINITION", + "description": " Sets the autoscaling settings for the specified node pool.", + "canonical": true, + "file": "cluster_manager.set_node_pool_autoscaling.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetNodePoolAutoscaling", + "fullName": "google.container.v1.ClusterManager.SetNodePoolAutoscaling", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "autoscaling", + "type": ".google.container.v1.NodePoolAutoscaling" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetNodePoolAutoscaling", + "fullName": "google.container.v1.ClusterManager.SetNodePoolAutoscaling", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetLoggingService_async", + "title": "ClusterManager setLoggingService Sample", + "origin": "API_DEFINITION", + "description": " Sets the logging service for a specific cluster.", + "canonical": true, + "file": "cluster_manager.set_logging_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetLoggingService", + "fullName": "google.container.v1.ClusterManager.SetLoggingService", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "logging_service", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetLoggingService", + "fullName": "google.container.v1.ClusterManager.SetLoggingService", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetMonitoringService_async", + "title": "ClusterManager setMonitoringService Sample", + "origin": "API_DEFINITION", + "description": " Sets the monitoring service for a specific cluster.", + "canonical": true, + "file": "cluster_manager.set_monitoring_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetMonitoringService", + "fullName": "google.container.v1.ClusterManager.SetMonitoringService", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "monitoring_service", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetMonitoringService", + "fullName": "google.container.v1.ClusterManager.SetMonitoringService", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetAddonsConfig_async", + "title": "ClusterManager setAddonsConfig Sample", + "origin": "API_DEFINITION", + "description": " Sets the addons for a specific cluster.", + "canonical": true, + "file": "cluster_manager.set_addons_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetAddonsConfig", + "fullName": "google.container.v1.ClusterManager.SetAddonsConfig", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "addons_config", + "type": ".google.container.v1.AddonsConfig" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetAddonsConfig", + "fullName": "google.container.v1.ClusterManager.SetAddonsConfig", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetLocations_async", + "title": "ClusterManager setLocations Sample", + "origin": "API_DEFINITION", + "description": " Sets the locations for a specific cluster. Deprecated. Use [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/update) instead.", + "canonical": true, + "file": "cluster_manager.set_locations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetLocations", + "fullName": "google.container.v1.ClusterManager.SetLocations", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "locations", + "type": "TYPE_STRING[]" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetLocations", + "fullName": "google.container.v1.ClusterManager.SetLocations", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_UpdateMaster_async", + "title": "ClusterManager updateMaster Sample", + "origin": "API_DEFINITION", + "description": " Updates the master for a specific cluster.", + "canonical": true, + "file": "cluster_manager.update_master.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMaster", + "fullName": "google.container.v1.ClusterManager.UpdateMaster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "master_version", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "UpdateMaster", + "fullName": "google.container.v1.ClusterManager.UpdateMaster", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetMasterAuth_async", + "title": "ClusterManager setMasterAuth Sample", + "origin": "API_DEFINITION", + "description": " Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.", + "canonical": true, + "file": "cluster_manager.set_master_auth.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetMasterAuth", + "fullName": "google.container.v1.ClusterManager.SetMasterAuth", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "action", + "type": ".google.container.v1.SetMasterAuthRequest.Action" + }, + { + "name": "update", + "type": ".google.container.v1.MasterAuth" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetMasterAuth", + "fullName": "google.container.v1.ClusterManager.SetMasterAuth", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_DeleteCluster_async", + "title": "ClusterManager deleteCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.", + "canonical": true, + "file": "cluster_manager.delete_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteCluster", + "fullName": "google.container.v1.ClusterManager.DeleteCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "DeleteCluster", + "fullName": "google.container.v1.ClusterManager.DeleteCluster", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_ListOperations_async", + "title": "ClusterManager listOperations Sample", + "origin": "API_DEFINITION", + "description": " Lists all operations in a project in a specific zone or all zones.", + "canonical": true, + "file": "cluster_manager.list_operations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListOperations", + "fullName": "google.container.v1.ClusterManager.ListOperations", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.ListOperationsResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "ListOperations", + "fullName": "google.container.v1.ClusterManager.ListOperations", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_GetOperation_async", + "title": "ClusterManager getOperation Sample", + "origin": "API_DEFINITION", + "description": " Gets the specified operation.", + "canonical": true, + "file": "cluster_manager.get_operation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOperation", + "fullName": "google.container.v1.ClusterManager.GetOperation", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "operation_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "GetOperation", + "fullName": "google.container.v1.ClusterManager.GetOperation", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_CancelOperation_async", + "title": "ClusterManager cancelOperation Sample", + "origin": "API_DEFINITION", + "description": " Cancels the specified operation.", + "canonical": true, + "file": "cluster_manager.cancel_operation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CancelOperation", + "fullName": "google.container.v1.ClusterManager.CancelOperation", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "operation_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "CancelOperation", + "fullName": "google.container.v1.ClusterManager.CancelOperation", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_GetServerConfig_async", + "title": "ClusterManager getServerConfig Sample", + "origin": "API_DEFINITION", + "description": " Returns configuration info about the Google Kubernetes Engine service.", + "canonical": true, + "file": "cluster_manager.get_server_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetServerConfig", + "fullName": "google.container.v1.ClusterManager.GetServerConfig", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.ServerConfig", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "GetServerConfig", + "fullName": "google.container.v1.ClusterManager.GetServerConfig", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_GetJSONWebKeys_async", + "title": "ClusterManager getJSONWebKeys Sample", + "origin": "API_DEFINITION", + "description": " Gets the public component of the cluster signing keys in JSON Web Key format. This API is not yet intended for general use, and is not available for all clusters.", + "canonical": true, + "file": "cluster_manager.get_j_s_o_n_web_keys.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetJSONWebKeys", + "fullName": "google.container.v1.ClusterManager.GetJSONWebKeys", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.GetJSONWebKeysResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "GetJSONWebKeys", + "fullName": "google.container.v1.ClusterManager.GetJSONWebKeys", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_ListNodePools_async", + "title": "ClusterManager listNodePools Sample", + "origin": "API_DEFINITION", + "description": " Lists the node pools for a cluster.", + "canonical": true, + "file": "cluster_manager.list_node_pools.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNodePools", + "fullName": "google.container.v1.ClusterManager.ListNodePools", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.ListNodePoolsResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "ListNodePools", + "fullName": "google.container.v1.ClusterManager.ListNodePools", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_GetNodePool_async", + "title": "ClusterManager getNodePool Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the requested node pool.", + "canonical": true, + "file": "cluster_manager.get_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNodePool", + "fullName": "google.container.v1.ClusterManager.GetNodePool", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.NodePool", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "GetNodePool", + "fullName": "google.container.v1.ClusterManager.GetNodePool", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_CreateNodePool_async", + "title": "ClusterManager createNodePool Sample", + "origin": "API_DEFINITION", + "description": " Creates a node pool for a cluster.", + "canonical": true, + "file": "cluster_manager.create_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNodePool", + "fullName": "google.container.v1.ClusterManager.CreateNodePool", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool", + "type": ".google.container.v1.NodePool" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "CreateNodePool", + "fullName": "google.container.v1.ClusterManager.CreateNodePool", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_DeleteNodePool_async", + "title": "ClusterManager deleteNodePool Sample", + "origin": "API_DEFINITION", + "description": " Deletes a node pool from a cluster.", + "canonical": true, + "file": "cluster_manager.delete_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNodePool", + "fullName": "google.container.v1.ClusterManager.DeleteNodePool", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "DeleteNodePool", + "fullName": "google.container.v1.ClusterManager.DeleteNodePool", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async", + "title": "ClusterManager completeNodePoolUpgrade Sample", + "origin": "API_DEFINITION", + "description": " CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.", + "canonical": true, + "file": "cluster_manager.complete_node_pool_upgrade.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteNodePoolUpgrade", + "fullName": "google.container.v1.ClusterManager.CompleteNodePoolUpgrade", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "CompleteNodePoolUpgrade", + "fullName": "google.container.v1.ClusterManager.CompleteNodePoolUpgrade", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async", + "title": "ClusterManager rollbackNodePoolUpgrade Sample", + "origin": "API_DEFINITION", + "description": " Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.", + "canonical": true, + "file": "cluster_manager.rollback_node_pool_upgrade.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RollbackNodePoolUpgrade", + "fullName": "google.container.v1.ClusterManager.RollbackNodePoolUpgrade", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "respect_pdb", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "RollbackNodePoolUpgrade", + "fullName": "google.container.v1.ClusterManager.RollbackNodePoolUpgrade", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetNodePoolManagement_async", + "title": "ClusterManager setNodePoolManagement Sample", + "origin": "API_DEFINITION", + "description": " Sets the NodeManagement options for a node pool.", + "canonical": true, + "file": "cluster_manager.set_node_pool_management.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetNodePoolManagement", + "fullName": "google.container.v1.ClusterManager.SetNodePoolManagement", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "management", + "type": ".google.container.v1.NodeManagement" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetNodePoolManagement", + "fullName": "google.container.v1.ClusterManager.SetNodePoolManagement", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetLabels_async", + "title": "ClusterManager setLabels Sample", + "origin": "API_DEFINITION", + "description": " Sets labels on a cluster.", + "canonical": true, + "file": "cluster_manager.set_labels.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetLabels", + "fullName": "google.container.v1.ClusterManager.SetLabels", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "resource_labels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "label_fingerprint", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetLabels", + "fullName": "google.container.v1.ClusterManager.SetLabels", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetLegacyAbac_async", + "title": "ClusterManager setLegacyAbac Sample", + "origin": "API_DEFINITION", + "description": " Enables or disables the ABAC authorization mechanism on a cluster.", + "canonical": true, + "file": "cluster_manager.set_legacy_abac.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetLegacyAbac", + "fullName": "google.container.v1.ClusterManager.SetLegacyAbac", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "enabled", + "type": "TYPE_BOOL" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetLegacyAbac", + "fullName": "google.container.v1.ClusterManager.SetLegacyAbac", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_StartIPRotation_async", + "title": "ClusterManager startIPRotation Sample", + "origin": "API_DEFINITION", + "description": " Starts master IP rotation.", + "canonical": true, + "file": "cluster_manager.start_i_p_rotation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartIPRotation", + "fullName": "google.container.v1.ClusterManager.StartIPRotation", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "rotate_credentials", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "StartIPRotation", + "fullName": "google.container.v1.ClusterManager.StartIPRotation", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_CompleteIPRotation_async", + "title": "ClusterManager completeIPRotation Sample", + "origin": "API_DEFINITION", + "description": " Completes master IP rotation.", + "canonical": true, + "file": "cluster_manager.complete_i_p_rotation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteIPRotation", + "fullName": "google.container.v1.ClusterManager.CompleteIPRotation", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "CompleteIPRotation", + "fullName": "google.container.v1.ClusterManager.CompleteIPRotation", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetNodePoolSize_async", + "title": "ClusterManager setNodePoolSize Sample", + "origin": "API_DEFINITION", + "description": " Sets the size for a specific node pool. The new size will be used for all replicas, including future replicas created by modifying [NodePool.locations][google.container.v1.NodePool.locations].", + "canonical": true, + "file": "cluster_manager.set_node_pool_size.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetNodePoolSize", + "fullName": "google.container.v1.ClusterManager.SetNodePoolSize", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "node_count", + "type": "TYPE_INT32" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetNodePoolSize", + "fullName": "google.container.v1.ClusterManager.SetNodePoolSize", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetNetworkPolicy_async", + "title": "ClusterManager setNetworkPolicy Sample", + "origin": "API_DEFINITION", + "description": " Enables or disables Network Policy for a cluster.", + "canonical": true, + "file": "cluster_manager.set_network_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetNetworkPolicy", + "fullName": "google.container.v1.ClusterManager.SetNetworkPolicy", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "network_policy", + "type": ".google.container.v1.NetworkPolicy" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetNetworkPolicy", + "fullName": "google.container.v1.ClusterManager.SetNetworkPolicy", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_SetMaintenancePolicy_async", + "title": "ClusterManager setMaintenancePolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the maintenance policy for a cluster.", + "canonical": true, + "file": "cluster_manager.set_maintenance_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetMaintenancePolicy", + "fullName": "google.container.v1.ClusterManager.SetMaintenancePolicy", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "maintenance_policy", + "type": ".google.container.v1.MaintenancePolicy" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "SetMaintenancePolicy", + "fullName": "google.container.v1.ClusterManager.SetMaintenancePolicy", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_ListUsableSubnetworks_async", + "title": "ClusterManager listUsableSubnetworks Sample", + "origin": "API_DEFINITION", + "description": " Lists subnetworks that are usable for creating clusters in a project.", + "canonical": true, + "file": "cluster_manager.list_usable_subnetworks.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListUsableSubnetworks", + "fullName": "google.container.v1.ClusterManager.ListUsableSubnetworks", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.ListUsableSubnetworksResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "ListUsableSubnetworks", + "fullName": "google.container.v1.ClusterManager.ListUsableSubnetworks", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async", + "title": "ClusterManager checkAutopilotCompatibility Sample", + "origin": "API_DEFINITION", + "description": " Checks the cluster compatibility with Autopilot mode, and returns a list of compatibility issues.", + "canonical": true, + "file": "cluster_manager.check_autopilot_compatibility.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CheckAutopilotCompatibility", + "fullName": "google.container.v1.ClusterManager.CheckAutopilotCompatibility", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1.CheckAutopilotCompatibilityResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1.ClusterManagerClient" + }, + "method": { + "shortName": "CheckAutopilotCompatibility", + "fullName": "google.container.v1.ClusterManager.CheckAutopilotCompatibility", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1.ClusterManager" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-container/v1/src/index.ts b/owl-bot-staging/google-container/v1/src/index.ts new file mode 100644 index 00000000000..7f3539e2b2d --- /dev/null +++ b/owl-bot-staging/google-container/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 ClusterManagerClient = v1.ClusterManagerClient; +type ClusterManagerClient = v1.ClusterManagerClient; +export {v1, ClusterManagerClient}; +export default {v1, ClusterManagerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client.ts b/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client.ts new file mode 100644 index 00000000000..46d1a94e37f --- /dev/null +++ b/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client.ts @@ -0,0 +1,3514 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/cluster_manager_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cluster_manager_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Google Kubernetes Engine Cluster Manager v1 + * @class + * @memberof v1 + */ +export class ClusterManagerClient { + 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}; + clusterManagerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ClusterManagerClient. + * + * @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 ClusterManagerClient({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 ClusterManagerClient; + 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 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 = { + listUsableSubnetworks: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'subnetworks') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.container.v1.ClusterManager', 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.clusterManagerStub) { + return this.clusterManagerStub; + } + + // Put together the "service stub" for + // google.container.v1.ClusterManager. + this.clusterManagerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.container.v1.ClusterManager') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.container.v1.ClusterManager, + 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 clusterManagerStubMethods = + ['listClusters', 'getCluster', 'createCluster', 'updateCluster', 'updateNodePool', 'setNodePoolAutoscaling', 'setLoggingService', 'setMonitoringService', 'setAddonsConfig', 'setLocations', 'updateMaster', 'setMasterAuth', 'deleteCluster', 'listOperations', 'getOperation', 'cancelOperation', 'getServerConfig', 'getJsonWebKeys', 'listNodePools', 'getNodePool', 'createNodePool', 'deleteNodePool', 'completeNodePoolUpgrade', 'rollbackNodePoolUpgrade', 'setNodePoolManagement', 'setLabels', 'setLegacyAbac', 'startIpRotation', 'completeIpRotation', 'setNodePoolSize', 'setNetworkPolicy', 'setMaintenancePolicy', 'listUsableSubnetworks', 'checkAutopilotCompatibility']; + for (const methodName of clusterManagerStubMethods) { + const callPromise = this.clusterManagerStub.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.clusterManagerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'container.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 'container.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 all clusters owned by a project in either the specified zone or all + * zones. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the parent field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides, or "-" for all zones. This field has been deprecated and + * replaced by the parent field. + * @param {string} request.parent + * The parent (project and location) where the clusters will be listed. + * Specified in the format `projects/* /locations/*`. + * Location "-" matches all zones and all regions. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.ListClustersResponse|ListClustersResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.list_clusters.js + * region_tag:container_v1_generated_ClusterManager_ListClusters_async + */ + listClusters( + request?: protos.google.container.v1.IListClustersRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IListClustersResponse, + protos.google.container.v1.IListClustersRequest|undefined, {}|undefined + ]>; + listClusters( + request: protos.google.container.v1.IListClustersRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IListClustersResponse, + protos.google.container.v1.IListClustersRequest|null|undefined, + {}|null|undefined>): void; + listClusters( + request: protos.google.container.v1.IListClustersRequest, + callback: Callback< + protos.google.container.v1.IListClustersResponse, + protos.google.container.v1.IListClustersRequest|null|undefined, + {}|null|undefined>): void; + listClusters( + request?: protos.google.container.v1.IListClustersRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IListClustersResponse, + protos.google.container.v1.IListClustersRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IListClustersResponse, + protos.google.container.v1.IListClustersRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IListClustersResponse, + protos.google.container.v1.IListClustersRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + }); + this.initialize(); + return this.innerApiCalls.listClusters(request, options, callback); + } +/** + * Gets the details of a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to retrieve. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to retrieve. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Cluster|Cluster}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.get_cluster.js + * region_tag:container_v1_generated_ClusterManager_GetCluster_async + */ + getCluster( + request?: protos.google.container.v1.IGetClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.ICluster, + protos.google.container.v1.IGetClusterRequest|undefined, {}|undefined + ]>; + getCluster( + request: protos.google.container.v1.IGetClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.ICluster, + protos.google.container.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; + getCluster( + request: protos.google.container.v1.IGetClusterRequest, + callback: Callback< + protos.google.container.v1.ICluster, + protos.google.container.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; + getCluster( + request?: protos.google.container.v1.IGetClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.ICluster, + protos.google.container.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.ICluster, + protos.google.container.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.ICluster, + protos.google.container.v1.IGetClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getCluster(request, options, callback); + } +/** + * Creates a cluster, consisting of the specified number and type of Google + * Compute Engine instances. + * + * By default, the cluster is created in the project's + * [default + * network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). + * + * One firewall is added for the cluster. After cluster creation, + * the Kubelet creates routes for each node to allow the containers + * on that node to communicate with all other instances in the + * cluster. + * + * Finally, an entry is added to the project's global metadata indicating + * which CIDR range the cluster is using. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the parent field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the parent + * field. + * @param {google.container.v1.Cluster} request.cluster + * Required. A [cluster + * resource](https://cloud.google.com/container-engine/reference/rest/v1/projects.locations.clusters) + * @param {string} request.parent + * The parent (project and location) where the cluster will be created. + * Specified in the format `projects/* /locations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.create_cluster.js + * region_tag:container_v1_generated_ClusterManager_CreateCluster_async + */ + createCluster( + request?: protos.google.container.v1.ICreateClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateClusterRequest|undefined, {}|undefined + ]>; + createCluster( + request: protos.google.container.v1.ICreateClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateClusterRequest|null|undefined, + {}|null|undefined>): void; + createCluster( + request: protos.google.container.v1.ICreateClusterRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateClusterRequest|null|undefined, + {}|null|undefined>): void; + createCluster( + request?: protos.google.container.v1.ICreateClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + }); + this.initialize(); + return this.innerApiCalls.createCluster(request, options, callback); + } +/** + * Updates the settings of a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1.ClusterUpdate} request.update + * Required. A description of the update. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to update. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.update_cluster.js + * region_tag:container_v1_generated_ClusterManager_UpdateCluster_async + */ + updateCluster( + request?: protos.google.container.v1.IUpdateClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateClusterRequest|undefined, {}|undefined + ]>; + updateCluster( + request: protos.google.container.v1.IUpdateClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateClusterRequest|null|undefined, + {}|null|undefined>): void; + updateCluster( + request: protos.google.container.v1.IUpdateClusterRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateClusterRequest|null|undefined, + {}|null|undefined>): void; + updateCluster( + request?: protos.google.container.v1.IUpdateClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCluster(request, options, callback); + } +/** + * Updates the version and/or image type for the specified node pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Deprecated. The name of the node pool to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodeVersion + * Required. The Kubernetes version to change the nodes to (typically an + * upgrade). + * + * Users may specify either explicit versions offered by Kubernetes Engine or + * version aliases, which have the following behavior: + * + * - "latest": picks the highest valid Kubernetes version + * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + * - "1.X.Y-gke.N": picks an explicit Kubernetes version + * - "-": picks the Kubernetes master version + * @param {string} request.imageType + * Required. The desired image type for the node pool. Please see + * https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for + * available image types. + * @param {string} request.name + * The name (project, location, cluster, node pool) of the node pool to + * update. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {string[]} request.locations + * The desired list of Google Compute Engine + * [zones](https://cloud.google.com/compute/docs/zones#available) in which the + * node pool's nodes should be located. Changing the locations for a node pool + * will result in nodes being either created or removed from the node pool, + * depending on whether locations are being added or removed. + * @param {google.container.v1.WorkloadMetadataConfig} request.workloadMetadataConfig + * The desired workload metadata config for the node pool. + * @param {google.container.v1.NodePool.UpgradeSettings} request.upgradeSettings + * Upgrade settings control disruption and speed of the upgrade. + * @param {google.container.v1.NetworkTags} request.tags + * The desired network tags to be applied to all nodes in the node pool. + * If this field is not present, the tags will not be changed. Otherwise, + * the existing network tags will be *replaced* with the provided tags. + * @param {google.container.v1.NodeTaints} request.taints + * The desired node taints to be applied to all nodes in the node pool. + * If this field is not present, the taints will not be changed. Otherwise, + * the existing node taints will be *replaced* with the provided taints. + * @param {google.container.v1.NodeLabels} request.labels + * The desired node labels to be applied to all nodes in the node pool. + * If this field is not present, the labels will not be changed. Otherwise, + * the existing node labels will be *replaced* with the provided labels. + * @param {google.container.v1.LinuxNodeConfig} request.linuxNodeConfig + * Parameters that can be configured on Linux nodes. + * @param {google.container.v1.NodeKubeletConfig} request.kubeletConfig + * Node kubelet configs. + * @param {google.container.v1.NodeNetworkConfig} request.nodeNetworkConfig + * Node network config. + * @param {google.container.v1.GcfsConfig} request.gcfsConfig + * GCFS config. + * @param {google.container.v1.ConfidentialNodes} request.confidentialNodes + * Confidential nodes config. + * All the nodes in the node pool will be Confidential VM once enabled. + * @param {google.container.v1.VirtualNIC} request.gvnic + * Enable or disable gvnic on the node pool. + * @param {string} request.etag + * The current etag of the node pool. + * If an etag is provided and does not match the current etag of the node + * pool, update will be blocked and an ABORTED error will be returned. + * @param {google.container.v1.FastSocket} request.fastSocket + * Enable or disable NCCL fast socket for the node pool. + * @param {google.container.v1.NodePoolLoggingConfig} request.loggingConfig + * Logging configuration. + * @param {google.container.v1.ResourceLabels} request.resourceLabels + * The resource labels for the node pool to use to annotate any related + * Google Compute Engine resources. + * @param {google.container.v1.WindowsNodeConfig} request.windowsNodeConfig + * Parameters that can be configured on Windows nodes. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.update_node_pool.js + * region_tag:container_v1_generated_ClusterManager_UpdateNodePool_async + */ + updateNodePool( + request?: protos.google.container.v1.IUpdateNodePoolRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateNodePoolRequest|undefined, {}|undefined + ]>; + updateNodePool( + request: protos.google.container.v1.IUpdateNodePoolRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateNodePoolRequest|null|undefined, + {}|null|undefined>): void; + updateNodePool( + request: protos.google.container.v1.IUpdateNodePoolRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateNodePoolRequest|null|undefined, + {}|null|undefined>): void; + updateNodePool( + request?: protos.google.container.v1.IUpdateNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateNodePoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateNodePoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateNodePoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateNodePool(request, options, callback); + } +/** + * Sets the autoscaling settings for the specified node pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Deprecated. The name of the node pool to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1.NodePoolAutoscaling} request.autoscaling + * Required. Autoscaling configuration for the node pool. + * @param {string} request.name + * The name (project, location, cluster, node pool) of the node pool to set + * autoscaler settings. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_node_pool_autoscaling.js + * region_tag:container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async + */ + setNodePoolAutoscaling( + request?: protos.google.container.v1.ISetNodePoolAutoscalingRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolAutoscalingRequest|undefined, {}|undefined + ]>; + setNodePoolAutoscaling( + request: protos.google.container.v1.ISetNodePoolAutoscalingRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolAutoscalingRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolAutoscaling( + request: protos.google.container.v1.ISetNodePoolAutoscalingRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolAutoscalingRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolAutoscaling( + request?: protos.google.container.v1.ISetNodePoolAutoscalingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolAutoscalingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolAutoscalingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolAutoscalingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setNodePoolAutoscaling(request, options, callback); + } +/** + * Sets the logging service for a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.loggingService + * Required. The logging service the cluster should use to write logs. + * Currently available options: + * + * * `logging.googleapis.com/kubernetes` - The Cloud Logging + * service with a Kubernetes-native resource model + * * `logging.googleapis.com` - The legacy Cloud Logging service (no longer + * available as of GKE 1.15). + * * `none` - no logs will be exported from the cluster. + * + * If left as an empty string,`logging.googleapis.com/kubernetes` will be + * used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to set logging. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_logging_service.js + * region_tag:container_v1_generated_ClusterManager_SetLoggingService_async + */ + setLoggingService( + request?: protos.google.container.v1.ISetLoggingServiceRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLoggingServiceRequest|undefined, {}|undefined + ]>; + setLoggingService( + request: protos.google.container.v1.ISetLoggingServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLoggingServiceRequest|null|undefined, + {}|null|undefined>): void; + setLoggingService( + request: protos.google.container.v1.ISetLoggingServiceRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLoggingServiceRequest|null|undefined, + {}|null|undefined>): void; + setLoggingService( + request?: protos.google.container.v1.ISetLoggingServiceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLoggingServiceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLoggingServiceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLoggingServiceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setLoggingService(request, options, callback); + } +/** + * Sets the monitoring service for a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.monitoringService + * Required. The monitoring service the cluster should use to write metrics. + * Currently available options: + * + * * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring + * service with a Kubernetes-native resource model + * * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no + * longer available as of GKE 1.15). + * * `none` - No metrics will be exported from the cluster. + * + * If left as an empty string,`monitoring.googleapis.com/kubernetes` will be + * used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to set monitoring. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_monitoring_service.js + * region_tag:container_v1_generated_ClusterManager_SetMonitoringService_async + */ + setMonitoringService( + request?: protos.google.container.v1.ISetMonitoringServiceRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMonitoringServiceRequest|undefined, {}|undefined + ]>; + setMonitoringService( + request: protos.google.container.v1.ISetMonitoringServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMonitoringServiceRequest|null|undefined, + {}|null|undefined>): void; + setMonitoringService( + request: protos.google.container.v1.ISetMonitoringServiceRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMonitoringServiceRequest|null|undefined, + {}|null|undefined>): void; + setMonitoringService( + request?: protos.google.container.v1.ISetMonitoringServiceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMonitoringServiceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMonitoringServiceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMonitoringServiceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setMonitoringService(request, options, callback); + } +/** + * Sets the addons for a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1.AddonsConfig} request.addonsConfig + * Required. The desired configurations for the various addons available to + * run in the cluster. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to set addons. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_addons_config.js + * region_tag:container_v1_generated_ClusterManager_SetAddonsConfig_async + */ + setAddonsConfig( + request?: protos.google.container.v1.ISetAddonsConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetAddonsConfigRequest|undefined, {}|undefined + ]>; + setAddonsConfig( + request: protos.google.container.v1.ISetAddonsConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetAddonsConfigRequest|null|undefined, + {}|null|undefined>): void; + setAddonsConfig( + request: protos.google.container.v1.ISetAddonsConfigRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetAddonsConfigRequest|null|undefined, + {}|null|undefined>): void; + setAddonsConfig( + request?: protos.google.container.v1.ISetAddonsConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetAddonsConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetAddonsConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetAddonsConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setAddonsConfig(request, options, callback); + } +/** + * Sets the locations for a specific cluster. + * Deprecated. Use + * [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/update) + * instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string[]} request.locations + * Required. The desired list of Google Compute Engine + * [zones](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster's nodes should be located. Changing the locations a cluster is in + * will result in nodes being either created or removed from the cluster, + * depending on whether locations are being added or removed. + * + * This list must always include the cluster's primary zone. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to set locations. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_locations.js + * region_tag:container_v1_generated_ClusterManager_SetLocations_async + * @deprecated SetLocations is deprecated and may be removed in a future version. + */ + setLocations( + request?: protos.google.container.v1.ISetLocationsRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLocationsRequest|undefined, {}|undefined + ]>; + setLocations( + request: protos.google.container.v1.ISetLocationsRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLocationsRequest|null|undefined, + {}|null|undefined>): void; + setLocations( + request: protos.google.container.v1.ISetLocationsRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLocationsRequest|null|undefined, + {}|null|undefined>): void; + setLocations( + request?: protos.google.container.v1.ISetLocationsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLocationsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLocationsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLocationsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + this.warn('DEP$ClusterManager-$SetLocations','SetLocations is deprecated and may be removed in a future version.', 'DeprecationWarning'); + return this.innerApiCalls.setLocations(request, options, callback); + } +/** + * Updates the master for a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.masterVersion + * Required. The Kubernetes version to change the master to. + * + * Users may specify either explicit versions offered by Kubernetes Engine or + * version aliases, which have the following behavior: + * + * - "latest": picks the highest valid Kubernetes version + * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + * - "1.X.Y-gke.N": picks an explicit Kubernetes version + * - "-": picks the default Kubernetes version + * @param {string} request.name + * The name (project, location, cluster) of the cluster to update. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.update_master.js + * region_tag:container_v1_generated_ClusterManager_UpdateMaster_async + */ + updateMaster( + request?: protos.google.container.v1.IUpdateMasterRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateMasterRequest|undefined, {}|undefined + ]>; + updateMaster( + request: protos.google.container.v1.IUpdateMasterRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateMasterRequest|null|undefined, + {}|null|undefined>): void; + updateMaster( + request: protos.google.container.v1.IUpdateMasterRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateMasterRequest|null|undefined, + {}|null|undefined>): void; + updateMaster( + request?: protos.google.container.v1.IUpdateMasterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateMasterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateMasterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IUpdateMasterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMaster(request, options, callback); + } +/** + * Sets master auth materials. Currently supports changing the admin password + * or a specific cluster, either via password generation or explicitly setting + * the password. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1.SetMasterAuthRequest.Action} request.action + * Required. The exact form of action to be taken on the master auth. + * @param {google.container.v1.MasterAuth} request.update + * Required. A description of the update. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to set auth. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_master_auth.js + * region_tag:container_v1_generated_ClusterManager_SetMasterAuth_async + */ + setMasterAuth( + request?: protos.google.container.v1.ISetMasterAuthRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMasterAuthRequest|undefined, {}|undefined + ]>; + setMasterAuth( + request: protos.google.container.v1.ISetMasterAuthRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMasterAuthRequest|null|undefined, + {}|null|undefined>): void; + setMasterAuth( + request: protos.google.container.v1.ISetMasterAuthRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMasterAuthRequest|null|undefined, + {}|null|undefined>): void; + setMasterAuth( + request?: protos.google.container.v1.ISetMasterAuthRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMasterAuthRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMasterAuthRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMasterAuthRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setMasterAuth(request, options, callback); + } +/** + * Deletes the cluster, including the Kubernetes endpoint and all worker + * nodes. + * + * Firewalls and routes that were configured during cluster creation + * are also deleted. + * + * Other Google Compute Engine resources that might be in use by the cluster, + * such as load balancer resources, are not deleted if they weren't present + * when the cluster was initially created. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to delete. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to delete. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.delete_cluster.js + * region_tag:container_v1_generated_ClusterManager_DeleteCluster_async + */ + deleteCluster( + request?: protos.google.container.v1.IDeleteClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteClusterRequest|undefined, {}|undefined + ]>; + deleteCluster( + request: protos.google.container.v1.IDeleteClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): void; + deleteCluster( + request: protos.google.container.v1.IDeleteClusterRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): void; + deleteCluster( + request?: protos.google.container.v1.IDeleteClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteCluster(request, options, callback); + } +/** + * Lists all operations in a project in a specific zone or all zones. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the parent field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) to return + * operations for, or `-` for all zones. This field has been deprecated and + * replaced by the parent field. + * @param {string} request.parent + * The parent (project and location) where the operations will be listed. + * Specified in the format `projects/* /locations/*`. + * Location "-" matches all zones and all regions. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.ListOperationsResponse|ListOperationsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.list_operations.js + * region_tag:container_v1_generated_ClusterManager_ListOperations_async + */ + listOperations( + request?: protos.google.container.v1.IListOperationsRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IListOperationsResponse, + protos.google.container.v1.IListOperationsRequest|undefined, {}|undefined + ]>; + listOperations( + request: protos.google.container.v1.IListOperationsRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IListOperationsResponse, + protos.google.container.v1.IListOperationsRequest|null|undefined, + {}|null|undefined>): void; + listOperations( + request: protos.google.container.v1.IListOperationsRequest, + callback: Callback< + protos.google.container.v1.IListOperationsResponse, + protos.google.container.v1.IListOperationsRequest|null|undefined, + {}|null|undefined>): void; + listOperations( + request?: protos.google.container.v1.IListOperationsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IListOperationsResponse, + protos.google.container.v1.IListOperationsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IListOperationsResponse, + protos.google.container.v1.IListOperationsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IListOperationsResponse, + protos.google.container.v1.IListOperationsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + }); + this.initialize(); + return this.innerApiCalls.listOperations(request, options, callback); + } +/** + * Gets the specified operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.operationId + * Deprecated. The server-assigned `name` of the operation. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, operation id) of the operation to get. + * Specified in the format `projects/* /locations/* /operations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.get_operation.js + * region_tag:container_v1_generated_ClusterManager_GetOperation_async + */ + getOperation( + request?: protos.google.container.v1.IGetOperationRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IGetOperationRequest|undefined, {}|undefined + ]>; + getOperation( + request: protos.google.container.v1.IGetOperationRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IGetOperationRequest|null|undefined, + {}|null|undefined>): void; + getOperation( + request: protos.google.container.v1.IGetOperationRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IGetOperationRequest|null|undefined, + {}|null|undefined>): void; + getOperation( + request?: protos.google.container.v1.IGetOperationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IGetOperationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IGetOperationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IGetOperationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'operation_id': request.operationId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getOperation(request, options, callback); + } +/** + * Cancels the specified operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * operation resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.operationId + * Deprecated. The server-assigned `name` of the operation. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, operation id) of the operation to cancel. + * Specified in the format `projects/* /locations/* /operations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/cluster_manager.cancel_operation.js + * region_tag:container_v1_generated_ClusterManager_CancelOperation_async + */ + cancelOperation( + request?: protos.google.container.v1.ICancelOperationRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICancelOperationRequest|undefined, {}|undefined + ]>; + cancelOperation( + request: protos.google.container.v1.ICancelOperationRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICancelOperationRequest|null|undefined, + {}|null|undefined>): void; + cancelOperation( + request: protos.google.container.v1.ICancelOperationRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICancelOperationRequest|null|undefined, + {}|null|undefined>): void; + cancelOperation( + request?: protos.google.container.v1.ICancelOperationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICancelOperationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICancelOperationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICancelOperationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'operation_id': request.operationId ?? '', + }); + this.initialize(); + return this.innerApiCalls.cancelOperation(request, options, callback); + } +/** + * Returns configuration info about the Google Kubernetes Engine service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) to return + * operations for. This field has been deprecated and replaced by the name + * field. + * @param {string} request.name + * The name (project and location) of the server config to get, + * specified in the format `projects/* /locations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.ServerConfig|ServerConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.get_server_config.js + * region_tag:container_v1_generated_ClusterManager_GetServerConfig_async + */ + getServerConfig( + request?: protos.google.container.v1.IGetServerConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IServerConfig, + protos.google.container.v1.IGetServerConfigRequest|undefined, {}|undefined + ]>; + getServerConfig( + request: protos.google.container.v1.IGetServerConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IServerConfig, + protos.google.container.v1.IGetServerConfigRequest|null|undefined, + {}|null|undefined>): void; + getServerConfig( + request: protos.google.container.v1.IGetServerConfigRequest, + callback: Callback< + protos.google.container.v1.IServerConfig, + protos.google.container.v1.IGetServerConfigRequest|null|undefined, + {}|null|undefined>): void; + getServerConfig( + request?: protos.google.container.v1.IGetServerConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IServerConfig, + protos.google.container.v1.IGetServerConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IServerConfig, + protos.google.container.v1.IGetServerConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IServerConfig, + protos.google.container.v1.IGetServerConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + }); + this.initialize(); + return this.innerApiCalls.getServerConfig(request, options, callback); + } +/** + * Gets the public component of the cluster signing keys in + * JSON Web Key format. + * This API is not yet intended for general use, and is not available for all + * clusters. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The cluster (project, location, cluster name) to get keys for. Specified in + * the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.GetJSONWebKeysResponse|GetJSONWebKeysResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.get_j_s_o_n_web_keys.js + * region_tag:container_v1_generated_ClusterManager_GetJSONWebKeys_async + */ + getJSONWebKeys( + request?: protos.google.container.v1.IGetJSONWebKeysRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IGetJSONWebKeysResponse, + protos.google.container.v1.IGetJSONWebKeysRequest|undefined, {}|undefined + ]>; + getJSONWebKeys( + request: protos.google.container.v1.IGetJSONWebKeysRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IGetJSONWebKeysResponse, + protos.google.container.v1.IGetJSONWebKeysRequest|null|undefined, + {}|null|undefined>): void; + getJSONWebKeys( + request: protos.google.container.v1.IGetJSONWebKeysRequest, + callback: Callback< + protos.google.container.v1.IGetJSONWebKeysResponse, + protos.google.container.v1.IGetJSONWebKeysRequest|null|undefined, + {}|null|undefined>): void; + getJSONWebKeys( + request?: protos.google.container.v1.IGetJSONWebKeysRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IGetJSONWebKeysResponse, + protos.google.container.v1.IGetJSONWebKeysRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IGetJSONWebKeysResponse, + protos.google.container.v1.IGetJSONWebKeysRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IGetJSONWebKeysResponse, + protos.google.container.v1.IGetJSONWebKeysRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.getJsonWebKeys(request, options, callback); + } +/** + * Lists the node pools for a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the parent field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the parent + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the parent field. + * @param {string} request.parent + * The parent (project, location, cluster name) where the node pools will be + * listed. Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.ListNodePoolsResponse|ListNodePoolsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.list_node_pools.js + * region_tag:container_v1_generated_ClusterManager_ListNodePools_async + */ + listNodePools( + request?: protos.google.container.v1.IListNodePoolsRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IListNodePoolsResponse, + protos.google.container.v1.IListNodePoolsRequest|undefined, {}|undefined + ]>; + listNodePools( + request: protos.google.container.v1.IListNodePoolsRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IListNodePoolsResponse, + protos.google.container.v1.IListNodePoolsRequest|null|undefined, + {}|null|undefined>): void; + listNodePools( + request: protos.google.container.v1.IListNodePoolsRequest, + callback: Callback< + protos.google.container.v1.IListNodePoolsResponse, + protos.google.container.v1.IListNodePoolsRequest|null|undefined, + {}|null|undefined>): void; + listNodePools( + request?: protos.google.container.v1.IListNodePoolsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IListNodePoolsResponse, + protos.google.container.v1.IListNodePoolsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IListNodePoolsResponse, + protos.google.container.v1.IListNodePoolsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IListNodePoolsResponse, + protos.google.container.v1.IListNodePoolsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.listNodePools(request, options, callback); + } +/** + * Retrieves the requested node pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Deprecated. The name of the node pool. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node pool to + * get. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.NodePool|NodePool}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.get_node_pool.js + * region_tag:container_v1_generated_ClusterManager_GetNodePool_async + */ + getNodePool( + request?: protos.google.container.v1.IGetNodePoolRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.INodePool, + protos.google.container.v1.IGetNodePoolRequest|undefined, {}|undefined + ]>; + getNodePool( + request: protos.google.container.v1.IGetNodePoolRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.INodePool, + protos.google.container.v1.IGetNodePoolRequest|null|undefined, + {}|null|undefined>): void; + getNodePool( + request: protos.google.container.v1.IGetNodePoolRequest, + callback: Callback< + protos.google.container.v1.INodePool, + protos.google.container.v1.IGetNodePoolRequest|null|undefined, + {}|null|undefined>): void; + getNodePool( + request?: protos.google.container.v1.IGetNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.INodePool, + protos.google.container.v1.IGetNodePoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.INodePool, + protos.google.container.v1.IGetNodePoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.INodePool, + protos.google.container.v1.IGetNodePoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getNodePool(request, options, callback); + } +/** + * Creates a node pool for a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the parent field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the parent + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the parent field. + * @param {google.container.v1.NodePool} request.nodePool + * Required. The node pool to create. + * @param {string} request.parent + * The parent (project, location, cluster name) where the node pool will be + * created. Specified in the format + * `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.create_node_pool.js + * region_tag:container_v1_generated_ClusterManager_CreateNodePool_async + */ + createNodePool( + request?: protos.google.container.v1.ICreateNodePoolRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateNodePoolRequest|undefined, {}|undefined + ]>; + createNodePool( + request: protos.google.container.v1.ICreateNodePoolRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateNodePoolRequest|null|undefined, + {}|null|undefined>): void; + createNodePool( + request: protos.google.container.v1.ICreateNodePoolRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateNodePoolRequest|null|undefined, + {}|null|undefined>): void; + createNodePool( + request?: protos.google.container.v1.ICreateNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateNodePoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateNodePoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ICreateNodePoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.createNodePool(request, options, callback); + } +/** + * Deletes a node pool from a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Deprecated. The name of the node pool to delete. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node pool to + * delete. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.delete_node_pool.js + * region_tag:container_v1_generated_ClusterManager_DeleteNodePool_async + */ + deleteNodePool( + request?: protos.google.container.v1.IDeleteNodePoolRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteNodePoolRequest|undefined, {}|undefined + ]>; + deleteNodePool( + request: protos.google.container.v1.IDeleteNodePoolRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteNodePoolRequest|null|undefined, + {}|null|undefined>): void; + deleteNodePool( + request: protos.google.container.v1.IDeleteNodePoolRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteNodePoolRequest|null|undefined, + {}|null|undefined>): void; + deleteNodePool( + request?: protos.google.container.v1.IDeleteNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteNodePoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteNodePoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IDeleteNodePoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteNodePool(request, options, callback); + } +/** + * CompleteNodePoolUpgrade will signal an on-going node pool upgrade to + * complete. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node pool to + * complete upgrade. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/cluster_manager.complete_node_pool_upgrade.js + * region_tag:container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async + */ + completeNodePoolUpgrade( + request?: protos.google.container.v1.ICompleteNodePoolUpgradeRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICompleteNodePoolUpgradeRequest|undefined, {}|undefined + ]>; + completeNodePoolUpgrade( + request: protos.google.container.v1.ICompleteNodePoolUpgradeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICompleteNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): void; + completeNodePoolUpgrade( + request: protos.google.container.v1.ICompleteNodePoolUpgradeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICompleteNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): void; + completeNodePoolUpgrade( + request?: protos.google.container.v1.ICompleteNodePoolUpgradeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICompleteNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICompleteNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.container.v1.ICompleteNodePoolUpgradeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.completeNodePoolUpgrade(request, options, callback); + } +/** + * Rolls back a previously Aborted or Failed NodePool upgrade. + * This makes no changes if the last upgrade successfully completed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to rollback. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Deprecated. The name of the node pool to rollback. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node poll to + * rollback upgrade. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {boolean} request.respectPdb + * Option for rollback to ignore the PodDisruptionBudget. + * 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.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.rollback_node_pool_upgrade.js + * region_tag:container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async + */ + rollbackNodePoolUpgrade( + request?: protos.google.container.v1.IRollbackNodePoolUpgradeRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IRollbackNodePoolUpgradeRequest|undefined, {}|undefined + ]>; + rollbackNodePoolUpgrade( + request: protos.google.container.v1.IRollbackNodePoolUpgradeRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IRollbackNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): void; + rollbackNodePoolUpgrade( + request: protos.google.container.v1.IRollbackNodePoolUpgradeRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IRollbackNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): void; + rollbackNodePoolUpgrade( + request?: protos.google.container.v1.IRollbackNodePoolUpgradeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IRollbackNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IRollbackNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IRollbackNodePoolUpgradeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.rollbackNodePoolUpgrade(request, options, callback); + } +/** + * Sets the NodeManagement options for a node pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to update. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Deprecated. The name of the node pool to update. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1.NodeManagement} request.management + * Required. NodeManagement configuration for the node pool. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node pool to set + * management properties. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_node_pool_management.js + * region_tag:container_v1_generated_ClusterManager_SetNodePoolManagement_async + */ + setNodePoolManagement( + request?: protos.google.container.v1.ISetNodePoolManagementRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolManagementRequest|undefined, {}|undefined + ]>; + setNodePoolManagement( + request: protos.google.container.v1.ISetNodePoolManagementRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolManagementRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolManagement( + request: protos.google.container.v1.ISetNodePoolManagementRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolManagementRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolManagement( + request?: protos.google.container.v1.ISetNodePoolManagementRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolManagementRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolManagementRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolManagementRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setNodePoolManagement(request, options, callback); + } +/** + * Sets labels on a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {number[]} request.resourceLabels + * Required. The labels to set for that cluster. + * @param {string} request.labelFingerprint + * Required. The fingerprint of the previous set of labels for this resource, + * used to detect conflicts. The fingerprint is initially generated by + * Kubernetes Engine and changes after every request to modify or update + * labels. You must always provide an up-to-date fingerprint hash when + * updating or changing labels. Make a `get()` request to the + * resource to get the latest fingerprint. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to set labels. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_labels.js + * region_tag:container_v1_generated_ClusterManager_SetLabels_async + */ + setLabels( + request?: protos.google.container.v1.ISetLabelsRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLabelsRequest|undefined, {}|undefined + ]>; + setLabels( + request: protos.google.container.v1.ISetLabelsRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLabelsRequest|null|undefined, + {}|null|undefined>): void; + setLabels( + request: protos.google.container.v1.ISetLabelsRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLabelsRequest|null|undefined, + {}|null|undefined>): void; + setLabels( + request?: protos.google.container.v1.ISetLabelsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLabelsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLabelsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLabelsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setLabels(request, options, callback); + } +/** + * Enables or disables the ABAC authorization mechanism on a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to update. + * This field has been deprecated and replaced by the name field. + * @param {boolean} request.enabled + * Required. Whether ABAC authorization will be enabled in the cluster. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to set legacy + * abac. Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_legacy_abac.js + * region_tag:container_v1_generated_ClusterManager_SetLegacyAbac_async + */ + setLegacyAbac( + request?: protos.google.container.v1.ISetLegacyAbacRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLegacyAbacRequest|undefined, {}|undefined + ]>; + setLegacyAbac( + request: protos.google.container.v1.ISetLegacyAbacRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLegacyAbacRequest|null|undefined, + {}|null|undefined>): void; + setLegacyAbac( + request: protos.google.container.v1.ISetLegacyAbacRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLegacyAbacRequest|null|undefined, + {}|null|undefined>): void; + setLegacyAbac( + request?: protos.google.container.v1.ISetLegacyAbacRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLegacyAbacRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLegacyAbacRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetLegacyAbacRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setLegacyAbac(request, options, callback); + } +/** + * Starts master IP rotation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to start IP + * rotation. Specified in the format `projects/* /locations/* /clusters/*`. + * @param {boolean} request.rotateCredentials + * Whether to rotate credentials during IP rotation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.start_i_p_rotation.js + * region_tag:container_v1_generated_ClusterManager_StartIPRotation_async + */ + startIPRotation( + request?: protos.google.container.v1.IStartIPRotationRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IStartIPRotationRequest|undefined, {}|undefined + ]>; + startIPRotation( + request: protos.google.container.v1.IStartIPRotationRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IStartIPRotationRequest|null|undefined, + {}|null|undefined>): void; + startIPRotation( + request: protos.google.container.v1.IStartIPRotationRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IStartIPRotationRequest|null|undefined, + {}|null|undefined>): void; + startIPRotation( + request?: protos.google.container.v1.IStartIPRotationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IStartIPRotationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.IStartIPRotationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.IStartIPRotationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.startIpRotation(request, options, callback); + } +/** + * Completes master IP rotation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to complete IP + * rotation. Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.complete_i_p_rotation.js + * region_tag:container_v1_generated_ClusterManager_CompleteIPRotation_async + */ + completeIPRotation( + request?: protos.google.container.v1.ICompleteIPRotationRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ICompleteIPRotationRequest|undefined, {}|undefined + ]>; + completeIPRotation( + request: protos.google.container.v1.ICompleteIPRotationRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICompleteIPRotationRequest|null|undefined, + {}|null|undefined>): void; + completeIPRotation( + request: protos.google.container.v1.ICompleteIPRotationRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICompleteIPRotationRequest|null|undefined, + {}|null|undefined>): void; + completeIPRotation( + request?: protos.google.container.v1.ICompleteIPRotationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICompleteIPRotationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ICompleteIPRotationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ICompleteIPRotationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.completeIpRotation(request, options, callback); + } +/** + * Sets the size for a specific node pool. The new size will be used for all + * replicas, including future replicas created by modifying + * {@link protos.google.container.v1.NodePool.locations|NodePool.locations}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster to update. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Deprecated. The name of the node pool to update. + * This field has been deprecated and replaced by the name field. + * @param {number} request.nodeCount + * Required. The desired node count for the pool. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node pool to set + * size. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_node_pool_size.js + * region_tag:container_v1_generated_ClusterManager_SetNodePoolSize_async + */ + setNodePoolSize( + request?: protos.google.container.v1.ISetNodePoolSizeRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolSizeRequest|undefined, {}|undefined + ]>; + setNodePoolSize( + request: protos.google.container.v1.ISetNodePoolSizeRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolSizeRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolSize( + request: protos.google.container.v1.ISetNodePoolSizeRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolSizeRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolSize( + request?: protos.google.container.v1.ISetNodePoolSizeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolSizeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolSizeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNodePoolSizeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setNodePoolSize(request, options, callback); + } +/** + * Enables or disables Network Policy for a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1.NetworkPolicy} request.networkPolicy + * Required. Configuration options for the NetworkPolicy feature. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to set networking + * policy. Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_network_policy.js + * region_tag:container_v1_generated_ClusterManager_SetNetworkPolicy_async + */ + setNetworkPolicy( + request?: protos.google.container.v1.ISetNetworkPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNetworkPolicyRequest|undefined, {}|undefined + ]>; + setNetworkPolicy( + request: protos.google.container.v1.ISetNetworkPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNetworkPolicyRequest|null|undefined, + {}|null|undefined>): void; + setNetworkPolicy( + request: protos.google.container.v1.ISetNetworkPolicyRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNetworkPolicyRequest|null|undefined, + {}|null|undefined>): void; + setNetworkPolicy( + request?: protos.google.container.v1.ISetNetworkPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNetworkPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNetworkPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetNetworkPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setNetworkPolicy(request, options, callback); + } +/** + * Sets the maintenance policy for a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * @param {string} request.zone + * Required. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. + * @param {string} request.clusterId + * Required. The name of the cluster to update. + * @param {google.container.v1.MaintenancePolicy} request.maintenancePolicy + * Required. The maintenance policy to be set for the cluster. An empty field + * clears the existing maintenance policy. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to set + * maintenance policy. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.set_maintenance_policy.js + * region_tag:container_v1_generated_ClusterManager_SetMaintenancePolicy_async + */ + setMaintenancePolicy( + request?: protos.google.container.v1.ISetMaintenancePolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMaintenancePolicyRequest|undefined, {}|undefined + ]>; + setMaintenancePolicy( + request: protos.google.container.v1.ISetMaintenancePolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMaintenancePolicyRequest|null|undefined, + {}|null|undefined>): void; + setMaintenancePolicy( + request: protos.google.container.v1.ISetMaintenancePolicyRequest, + callback: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMaintenancePolicyRequest|null|undefined, + {}|null|undefined>): void; + setMaintenancePolicy( + request?: protos.google.container.v1.ISetMaintenancePolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMaintenancePolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMaintenancePolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.IOperation, + protos.google.container.v1.ISetMaintenancePolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setMaintenancePolicy(request, options, callback); + } +/** + * Checks the cluster compatibility with Autopilot mode, and returns a list of + * compatibility issues. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to retrieve. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1.CheckAutopilotCompatibilityResponse|CheckAutopilotCompatibilityResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_manager.check_autopilot_compatibility.js + * region_tag:container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async + */ + checkAutopilotCompatibility( + request?: protos.google.container.v1.ICheckAutopilotCompatibilityRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1.ICheckAutopilotCompatibilityRequest|undefined, {}|undefined + ]>; + checkAutopilotCompatibility( + request: protos.google.container.v1.ICheckAutopilotCompatibilityRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1.ICheckAutopilotCompatibilityRequest|null|undefined, + {}|null|undefined>): void; + checkAutopilotCompatibility( + request: protos.google.container.v1.ICheckAutopilotCompatibilityRequest, + callback: Callback< + protos.google.container.v1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1.ICheckAutopilotCompatibilityRequest|null|undefined, + {}|null|undefined>): void; + checkAutopilotCompatibility( + request?: protos.google.container.v1.ICheckAutopilotCompatibilityRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1.ICheckAutopilotCompatibilityRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1.ICheckAutopilotCompatibilityRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1.ICheckAutopilotCompatibilityRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.checkAutopilotCompatibility(request, options, callback); + } + + /** + * Lists subnetworks that are usable for creating clusters in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent project where subnetworks are usable. + * Specified in the format `projects/*`. + * @param {string} request.filter + * Filtering currently only supports equality on the networkProjectId and must + * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` + * is the project which owns the listed subnetworks. This defaults to the + * parent project ID. + * @param {number} request.pageSize + * The max number of results per page that should be returned. If the number + * of available results is larger than `page_size`, a `next_page_token` is + * returned which can be used to get the next page of results in subsequent + * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + * @param {string} request.pageToken + * Specifies a page token to use. Set this to the nextPageToken returned by + * previous list requests to get 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.container.v1.UsableSubnetwork|UsableSubnetwork}. + * 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 `listUsableSubnetworksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableSubnetworks( + request?: protos.google.container.v1.IListUsableSubnetworksRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1.IUsableSubnetwork[], + protos.google.container.v1.IListUsableSubnetworksRequest|null, + protos.google.container.v1.IListUsableSubnetworksResponse + ]>; + listUsableSubnetworks( + request: protos.google.container.v1.IListUsableSubnetworksRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.container.v1.IListUsableSubnetworksRequest, + protos.google.container.v1.IListUsableSubnetworksResponse|null|undefined, + protos.google.container.v1.IUsableSubnetwork>): void; + listUsableSubnetworks( + request: protos.google.container.v1.IListUsableSubnetworksRequest, + callback: PaginationCallback< + protos.google.container.v1.IListUsableSubnetworksRequest, + protos.google.container.v1.IListUsableSubnetworksResponse|null|undefined, + protos.google.container.v1.IUsableSubnetwork>): void; + listUsableSubnetworks( + request?: protos.google.container.v1.IListUsableSubnetworksRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.container.v1.IListUsableSubnetworksRequest, + protos.google.container.v1.IListUsableSubnetworksResponse|null|undefined, + protos.google.container.v1.IUsableSubnetwork>, + callback?: PaginationCallback< + protos.google.container.v1.IListUsableSubnetworksRequest, + protos.google.container.v1.IListUsableSubnetworksResponse|null|undefined, + protos.google.container.v1.IUsableSubnetwork>): + Promise<[ + protos.google.container.v1.IUsableSubnetwork[], + protos.google.container.v1.IListUsableSubnetworksRequest|null, + protos.google.container.v1.IListUsableSubnetworksResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listUsableSubnetworks(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 where subnetworks are usable. + * Specified in the format `projects/*`. + * @param {string} request.filter + * Filtering currently only supports equality on the networkProjectId and must + * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` + * is the project which owns the listed subnetworks. This defaults to the + * parent project ID. + * @param {number} request.pageSize + * The max number of results per page that should be returned. If the number + * of available results is larger than `page_size`, a `next_page_token` is + * returned which can be used to get the next page of results in subsequent + * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + * @param {string} request.pageToken + * Specifies a page token to use. Set this to the nextPageToken returned by + * previous list requests to get 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.container.v1.UsableSubnetwork|UsableSubnetwork} 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 `listUsableSubnetworksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableSubnetworksStream( + request?: protos.google.container.v1.IListUsableSubnetworksRequest, + 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['listUsableSubnetworks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableSubnetworks.createStream( + this.innerApiCalls.listUsableSubnetworks as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listUsableSubnetworks`, 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 where subnetworks are usable. + * Specified in the format `projects/*`. + * @param {string} request.filter + * Filtering currently only supports equality on the networkProjectId and must + * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` + * is the project which owns the listed subnetworks. This defaults to the + * parent project ID. + * @param {number} request.pageSize + * The max number of results per page that should be returned. If the number + * of available results is larger than `page_size`, a `next_page_token` is + * returned which can be used to get the next page of results in subsequent + * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + * @param {string} request.pageToken + * Specifies a page token to use. Set this to the nextPageToken returned by + * previous list requests to get 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.container.v1.UsableSubnetwork|UsableSubnetwork}. 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/cluster_manager.list_usable_subnetworks.js + * region_tag:container_v1_generated_ClusterManager_ListUsableSubnetworks_async + */ + listUsableSubnetworksAsync( + request?: protos.google.container.v1.IListUsableSubnetworksRequest, + 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['listUsableSubnetworks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableSubnetworks.asyncIterate( + this.innerApiCalls['listUsableSubnetworks'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + + /** + * 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.clusterManagerStub && !this._terminated) { + return this.clusterManagerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client_config.json b/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client_config.json new file mode 100644 index 00000000000..33fb266b6bd --- /dev/null +++ b/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client_config.json @@ -0,0 +1,192 @@ +{ + "interfaces": { + "google.container.v1.ClusterManager": { + "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": { + "ListClusters": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetCluster": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateCluster": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateCluster": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNodePool": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNodePoolAutoscaling": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLoggingService": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetMonitoringService": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetAddonsConfig": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLocations": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateMaster": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetMasterAuth": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteCluster": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListOperations": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetOperation": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CancelOperation": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetServerConfig": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetJSONWebKeys": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListNodePools": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetNodePool": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateNodePool": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNodePool": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CompleteNodePoolUpgrade": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RollbackNodePoolUpgrade": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNodePoolManagement": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLabels": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLegacyAbac": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartIPRotation": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CompleteIPRotation": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNodePoolSize": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNetworkPolicy": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetMaintenancePolicy": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListUsableSubnetworks": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CheckAutopilotCompatibility": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-container/v1/src/v1/cluster_manager_proto_list.json b/owl-bot-staging/google-container/v1/src/v1/cluster_manager_proto_list.json new file mode 100644 index 00000000000..aa69748e51b --- /dev/null +++ b/owl-bot-staging/google-container/v1/src/v1/cluster_manager_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/container/v1/cluster_service.proto" +] diff --git a/owl-bot-staging/google-container/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-container/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..c08b06ded09 --- /dev/null +++ b/owl-bot-staging/google-container/v1/src/v1/gapic_metadata.json @@ -0,0 +1,367 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.container.v1", + "libraryPackage": "@google-cloud/container", + "services": { + "ClusterManager": { + "clients": { + "grpc": { + "libraryClient": "ClusterManagerClient", + "rpcs": { + "ListClusters": { + "methods": [ + "listClusters" + ] + }, + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "UpdateNodePool": { + "methods": [ + "updateNodePool" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "setNodePoolAutoscaling" + ] + }, + "SetLoggingService": { + "methods": [ + "setLoggingService" + ] + }, + "SetMonitoringService": { + "methods": [ + "setMonitoringService" + ] + }, + "SetAddonsConfig": { + "methods": [ + "setAddonsConfig" + ] + }, + "SetLocations": { + "methods": [ + "setLocations" + ] + }, + "UpdateMaster": { + "methods": [ + "updateMaster" + ] + }, + "SetMasterAuth": { + "methods": [ + "setMasterAuth" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "ListOperations": { + "methods": [ + "listOperations" + ] + }, + "GetOperation": { + "methods": [ + "getOperation" + ] + }, + "CancelOperation": { + "methods": [ + "cancelOperation" + ] + }, + "GetServerConfig": { + "methods": [ + "getServerConfig" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "getJSONWebKeys" + ] + }, + "ListNodePools": { + "methods": [ + "listNodePools" + ] + }, + "GetNodePool": { + "methods": [ + "getNodePool" + ] + }, + "CreateNodePool": { + "methods": [ + "createNodePool" + ] + }, + "DeleteNodePool": { + "methods": [ + "deleteNodePool" + ] + }, + "CompleteNodePoolUpgrade": { + "methods": [ + "completeNodePoolUpgrade" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollbackNodePoolUpgrade" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "setNodePoolManagement" + ] + }, + "SetLabels": { + "methods": [ + "setLabels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "setLegacyAbac" + ] + }, + "StartIPRotation": { + "methods": [ + "startIPRotation" + ] + }, + "CompleteIPRotation": { + "methods": [ + "completeIPRotation" + ] + }, + "SetNodePoolSize": { + "methods": [ + "setNodePoolSize" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "setNetworkPolicy" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "setMaintenancePolicy" + ] + }, + "CheckAutopilotCompatibility": { + "methods": [ + "checkAutopilotCompatibility" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "listUsableSubnetworks", + "listUsableSubnetworksStream", + "listUsableSubnetworksAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ClusterManagerClient", + "rpcs": { + "ListClusters": { + "methods": [ + "listClusters" + ] + }, + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "UpdateNodePool": { + "methods": [ + "updateNodePool" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "setNodePoolAutoscaling" + ] + }, + "SetLoggingService": { + "methods": [ + "setLoggingService" + ] + }, + "SetMonitoringService": { + "methods": [ + "setMonitoringService" + ] + }, + "SetAddonsConfig": { + "methods": [ + "setAddonsConfig" + ] + }, + "SetLocations": { + "methods": [ + "setLocations" + ] + }, + "UpdateMaster": { + "methods": [ + "updateMaster" + ] + }, + "SetMasterAuth": { + "methods": [ + "setMasterAuth" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "ListOperations": { + "methods": [ + "listOperations" + ] + }, + "GetOperation": { + "methods": [ + "getOperation" + ] + }, + "CancelOperation": { + "methods": [ + "cancelOperation" + ] + }, + "GetServerConfig": { + "methods": [ + "getServerConfig" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "getJSONWebKeys" + ] + }, + "ListNodePools": { + "methods": [ + "listNodePools" + ] + }, + "GetNodePool": { + "methods": [ + "getNodePool" + ] + }, + "CreateNodePool": { + "methods": [ + "createNodePool" + ] + }, + "DeleteNodePool": { + "methods": [ + "deleteNodePool" + ] + }, + "CompleteNodePoolUpgrade": { + "methods": [ + "completeNodePoolUpgrade" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollbackNodePoolUpgrade" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "setNodePoolManagement" + ] + }, + "SetLabels": { + "methods": [ + "setLabels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "setLegacyAbac" + ] + }, + "StartIPRotation": { + "methods": [ + "startIPRotation" + ] + }, + "CompleteIPRotation": { + "methods": [ + "completeIPRotation" + ] + }, + "SetNodePoolSize": { + "methods": [ + "setNodePoolSize" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "setNetworkPolicy" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "setMaintenancePolicy" + ] + }, + "CheckAutopilotCompatibility": { + "methods": [ + "checkAutopilotCompatibility" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "listUsableSubnetworks", + "listUsableSubnetworksStream", + "listUsableSubnetworksAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-container/v1/src/v1/index.ts b/owl-bot-staging/google-container/v1/src/v1/index.ts new file mode 100644 index 00000000000..b1b39233034 --- /dev/null +++ b/owl-bot-staging/google-container/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 {ClusterManagerClient} from './cluster_manager_client'; diff --git a/owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..1101d781caa --- /dev/null +++ b/owl-bot-staging/google-container/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 container = require('@google-cloud/container'); + +function main() { + const clusterManagerClient = new container.ClusterManagerClient(); +} + +main(); diff --git a/owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..6685b8649e6 --- /dev/null +++ b/owl-bot-staging/google-container/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 {ClusterManagerClient} from '@google-cloud/container'; + +// check that the client class type name can be used +function doStuffWithClusterManagerClient(client: ClusterManagerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const clusterManagerClient = new ClusterManagerClient(); + doStuffWithClusterManagerClient(clusterManagerClient); +} + +main(); diff --git a/owl-bot-staging/google-container/v1/system-test/install.ts b/owl-bot-staging/google-container/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-container/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-container/v1/test/gapic_cluster_manager_v1.ts b/owl-bot-staging/google-container/v1/test/gapic_cluster_manager_v1.ts new file mode 100644 index 00000000000..9632e377d3a --- /dev/null +++ b/owl-bot-staging/google-container/v1/test/gapic_cluster_manager_v1.ts @@ -0,0 +1,5130 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 clustermanagerModule 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.ClusterManagerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = clustermanagerModule.v1.ClusterManagerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = clustermanagerModule.v1.ClusterManagerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = clustermanagerModule.v1.ClusterManagerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new clustermanagerModule.v1.ClusterManagerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.clusterManagerStub, undefined); + await client.initialize(); + assert(client.clusterManagerStub); + }); + + it('has close method for the initialized client', done => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.clusterManagerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.clusterManagerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new clustermanagerModule.v1.ClusterManagerClient({ + 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 clustermanagerModule.v1.ClusterManagerClient({ + 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('listClusters', () => { + it('invokes listClusters without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.ListClustersResponse() + ); + client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listClusters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClusters without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.ListClustersResponse() + ); + client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listClusters( + request, + (err?: Error|null, result?: protos.google.container.v1.IListClustersResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClusters with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listClusters(request), expectedError); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClusters with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['zone']); + request.zone = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listClusters(request), expectedError); + }); + }); + + describe('getCluster', () => { + it('invokes getCluster without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Cluster() + ); + client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Cluster() + ); + client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCluster( + request, + (err?: Error|null, result?: protos.google.container.v1.ICluster|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCluster(request), expectedError); + }); + }); + + describe('createCluster', () => { + it('invokes createCluster without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.createCluster = stubSimpleCall(expectedResponse); + const [response] = await client.createCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.createCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCluster( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['zone']); + request.zone = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createCluster(request), expectedError); + }); + }); + + describe('updateCluster', () => { + it('invokes updateCluster without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.updateCluster = stubSimpleCall(expectedResponse); + const [response] = await client.updateCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.updateCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCluster( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCluster(request), expectedError); + }); + }); + + describe('updateNodePool', () => { + it('invokes updateNodePool without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.updateNodePool = stubSimpleCall(expectedResponse); + const [response] = await client.updateNodePool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNodePool without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.updateNodePool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNodePool( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNodePool with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNodePool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNodePool with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateNodePool(request), expectedError); + }); + }); + + describe('setNodePoolAutoscaling', () => { + it('invokes setNodePoolAutoscaling without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolAutoscalingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCall(expectedResponse); + const [response] = await client.setNodePoolAutoscaling(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolAutoscaling without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolAutoscalingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setNodePoolAutoscaling( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolAutoscaling with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolAutoscalingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setNodePoolAutoscaling(request), expectedError); + const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolAutoscaling with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolAutoscalingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setNodePoolAutoscaling(request), expectedError); + }); + }); + + describe('setLoggingService', () => { + it('invokes setLoggingService without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLoggingServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setLoggingService = stubSimpleCall(expectedResponse); + const [response] = await client.setLoggingService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLoggingService without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLoggingServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setLoggingService = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setLoggingService( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLoggingService with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLoggingServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setLoggingService = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setLoggingService(request), expectedError); + const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLoggingService with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLoggingServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setLoggingService(request), expectedError); + }); + }); + + describe('setMonitoringService', () => { + it('invokes setMonitoringService without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMonitoringServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setMonitoringService = stubSimpleCall(expectedResponse); + const [response] = await client.setMonitoringService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMonitoringService without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMonitoringServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setMonitoringService = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setMonitoringService( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMonitoringService with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMonitoringServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setMonitoringService = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setMonitoringService(request), expectedError); + const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMonitoringService with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMonitoringServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setMonitoringService(request), expectedError); + }); + }); + + describe('setAddonsConfig', () => { + it('invokes setAddonsConfig without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetAddonsConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setAddonsConfig = stubSimpleCall(expectedResponse); + const [response] = await client.setAddonsConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAddonsConfig without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetAddonsConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setAddonsConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setAddonsConfig( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAddonsConfig with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetAddonsConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setAddonsConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setAddonsConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAddonsConfig with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetAddonsConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setAddonsConfig(request), expectedError); + }); + }); + + describe('setLocations', () => { + it('invokes setLocations without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setLocations = stubSimpleCall(expectedResponse); + const [response] = await client.setLocations(request); + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLocations without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setLocations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setLocations( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLocations with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setLocations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setLocations(request), expectedError); + assert(stub.calledOnce); + const actualRequest = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLocations with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setLocations(request), expectedError); + assert(stub.calledOnce); + }); + }); + + describe('updateMaster', () => { + it('invokes updateMaster without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateMasterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.updateMaster = stubSimpleCall(expectedResponse); + const [response] = await client.updateMaster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMaster without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateMasterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.updateMaster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMaster( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMaster with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateMasterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMaster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateMaster(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMaster with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.UpdateMasterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateMaster(request), expectedError); + }); + }); + + describe('setMasterAuth', () => { + it('invokes setMasterAuth without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMasterAuthRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setMasterAuth = stubSimpleCall(expectedResponse); + const [response] = await client.setMasterAuth(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMasterAuth without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMasterAuthRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setMasterAuth = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setMasterAuth( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMasterAuth with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMasterAuthRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setMasterAuth = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setMasterAuth(request), expectedError); + const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMasterAuth with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMasterAuthRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setMasterAuth(request), expectedError); + }); + }); + + describe('deleteCluster', () => { + it('invokes deleteCluster without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.deleteCluster = stubSimpleCall(expectedResponse); + const [response] = await client.deleteCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.deleteCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCluster( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteCluster(request), expectedError); + }); + }); + + describe('listOperations', () => { + it('invokes listOperations without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListOperationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.ListOperationsResponse() + ); + client.innerApiCalls.listOperations = stubSimpleCall(expectedResponse); + const [response] = await client.listOperations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOperations without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListOperationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.ListOperationsResponse() + ); + client.innerApiCalls.listOperations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listOperations( + request, + (err?: Error|null, result?: protos.google.container.v1.IListOperationsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOperations with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListOperationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listOperations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listOperations(request), expectedError); + const actualRequest = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOperations with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListOperationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['zone']); + request.zone = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listOperations(request), expectedError); + }); + }); + + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.getOperation = stubSimpleCall(expectedResponse); + const [response] = await client.getOperation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOperation without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.getOperation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOperation( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOperation with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOperation(request), expectedError); + const actualRequest = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOperation with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOperation(request), expectedError); + }); + }); + + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CancelOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.cancelOperation = stubSimpleCall(expectedResponse); + const [response] = await client.cancelOperation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelOperation without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CancelOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.cancelOperation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelOperation( + 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.cancelOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelOperation with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CancelOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelOperation(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelOperation with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CancelOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelOperation(request), expectedError); + }); + }); + + describe('getServerConfig', () => { + it('invokes getServerConfig without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.ServerConfig() + ); + client.innerApiCalls.getServerConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getServerConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServerConfig without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.ServerConfig() + ); + client.innerApiCalls.getServerConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getServerConfig( + request, + (err?: Error|null, result?: protos.google.container.v1.IServerConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServerConfig with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getServerConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getServerConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServerConfig with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['zone']); + request.zone = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getServerConfig(request), expectedError); + }); + }); + + describe('getJSONWebKeys', () => { + it('invokes getJSONWebKeys without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetJSONWebKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetJSONWebKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.GetJSONWebKeysResponse() + ); + client.innerApiCalls.getJsonWebKeys = stubSimpleCall(expectedResponse); + const [response] = await client.getJSONWebKeys(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJSONWebKeys without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetJSONWebKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetJSONWebKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.GetJSONWebKeysResponse() + ); + client.innerApiCalls.getJsonWebKeys = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJSONWebKeys( + request, + (err?: Error|null, result?: protos.google.container.v1.IGetJSONWebKeysResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJSONWebKeys with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetJSONWebKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetJSONWebKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getJsonWebKeys = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJSONWebKeys(request), expectedError); + const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJSONWebKeys with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetJSONWebKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetJSONWebKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getJSONWebKeys(request), expectedError); + }); + }); + + describe('listNodePools', () => { + it('invokes listNodePools without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.ListNodePoolsResponse() + ); + client.innerApiCalls.listNodePools = stubSimpleCall(expectedResponse); + const [response] = await client.listNodePools(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodePools without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.ListNodePoolsResponse() + ); + client.innerApiCalls.listNodePools = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodePools( + request, + (err?: Error|null, result?: protos.google.container.v1.IListNodePoolsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodePools with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNodePools = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNodePools(request), expectedError); + const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodePools with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listNodePools(request), expectedError); + }); + }); + + describe('getNodePool', () => { + it('invokes getNodePool without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.NodePool() + ); + client.innerApiCalls.getNodePool = stubSimpleCall(expectedResponse); + const [response] = await client.getNodePool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodePool without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.NodePool() + ); + client.innerApiCalls.getNodePool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNodePool( + request, + (err?: Error|null, result?: protos.google.container.v1.INodePool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodePool with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNodePool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodePool with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.GetNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNodePool(request), expectedError); + }); + }); + + describe('createNodePool', () => { + it('invokes createNodePool without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CreateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.createNodePool = stubSimpleCall(expectedResponse); + const [response] = await client.createNodePool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNodePool without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CreateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.createNodePool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNodePool( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNodePool with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CreateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNodePool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNodePool with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CreateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createNodePool(request), expectedError); + }); + }); + + describe('deleteNodePool', () => { + it('invokes deleteNodePool without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.DeleteNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.deleteNodePool = stubSimpleCall(expectedResponse); + const [response] = await client.deleteNodePool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNodePool without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.DeleteNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.deleteNodePool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNodePool( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNodePool with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.DeleteNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNodePool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNodePool with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.DeleteNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteNodePool(request), expectedError); + }); + }); + + describe('completeNodePoolUpgrade', () => { + it('invokes completeNodePoolUpgrade without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CompleteNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CompleteNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCall(expectedResponse); + const [response] = await client.completeNodePoolUpgrade(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeNodePoolUpgrade without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CompleteNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CompleteNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeNodePoolUpgrade( + 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.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeNodePoolUpgrade with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CompleteNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CompleteNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.completeNodePoolUpgrade(request), expectedError); + const actualRequest = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeNodePoolUpgrade with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CompleteNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CompleteNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.completeNodePoolUpgrade(request), expectedError); + }); + }); + + describe('rollbackNodePoolUpgrade', () => { + it('invokes rollbackNodePoolUpgrade without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.RollbackNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCall(expectedResponse); + const [response] = await client.rollbackNodePoolUpgrade(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackNodePoolUpgrade without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.RollbackNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rollbackNodePoolUpgrade( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackNodePoolUpgrade with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.RollbackNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.rollbackNodePoolUpgrade(request), expectedError); + const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackNodePoolUpgrade with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.RollbackNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.rollbackNodePoolUpgrade(request), expectedError); + }); + }); + + describe('setNodePoolManagement', () => { + it('invokes setNodePoolManagement without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolManagementRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setNodePoolManagement = stubSimpleCall(expectedResponse); + const [response] = await client.setNodePoolManagement(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolManagement without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolManagementRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setNodePoolManagement = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setNodePoolManagement( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolManagement with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolManagementRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setNodePoolManagement = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setNodePoolManagement(request), expectedError); + const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolManagement with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolManagementRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setNodePoolManagement(request), expectedError); + }); + }); + + describe('setLabels', () => { + it('invokes setLabels without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLabelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setLabels = stubSimpleCall(expectedResponse); + const [response] = await client.setLabels(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLabels without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLabelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setLabels = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setLabels( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLabels with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLabelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setLabels = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setLabels(request), expectedError); + const actualRequest = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLabels with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLabelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setLabels(request), expectedError); + }); + }); + + describe('setLegacyAbac', () => { + it('invokes setLegacyAbac without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLegacyAbacRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setLegacyAbac = stubSimpleCall(expectedResponse); + const [response] = await client.setLegacyAbac(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLegacyAbac without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLegacyAbacRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setLegacyAbac = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setLegacyAbac( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLegacyAbac with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLegacyAbacRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setLegacyAbac = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setLegacyAbac(request), expectedError); + const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLegacyAbac with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetLegacyAbacRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setLegacyAbac(request), expectedError); + }); + }); + + describe('startIPRotation', () => { + it('invokes startIPRotation without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.StartIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.startIpRotation = stubSimpleCall(expectedResponse); + const [response] = await client.startIPRotation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startIPRotation without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.StartIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.startIpRotation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startIPRotation( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startIPRotation with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.StartIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startIpRotation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.startIPRotation(request), expectedError); + const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startIPRotation with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.StartIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.startIPRotation(request), expectedError); + }); + }); + + describe('completeIPRotation', () => { + it('invokes completeIPRotation without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CompleteIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.completeIpRotation = stubSimpleCall(expectedResponse); + const [response] = await client.completeIPRotation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeIPRotation without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CompleteIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.completeIpRotation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeIPRotation( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeIPRotation with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CompleteIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.completeIpRotation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.completeIPRotation(request), expectedError); + const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeIPRotation with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CompleteIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.completeIPRotation(request), expectedError); + }); + }); + + describe('setNodePoolSize', () => { + it('invokes setNodePoolSize without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolSizeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setNodePoolSize = stubSimpleCall(expectedResponse); + const [response] = await client.setNodePoolSize(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolSize without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolSizeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setNodePoolSize = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setNodePoolSize( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolSize with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolSizeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setNodePoolSize = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setNodePoolSize(request), expectedError); + const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolSize with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNodePoolSizeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setNodePoolSize(request), expectedError); + }); + }); + + describe('setNetworkPolicy', () => { + it('invokes setNetworkPolicy without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setNetworkPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setNetworkPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNetworkPolicy without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setNetworkPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setNetworkPolicy( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNetworkPolicy with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setNetworkPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setNetworkPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNetworkPolicy with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setNetworkPolicy(request), expectedError); + }); + }); + + describe('setMaintenancePolicy', () => { + it('invokes setMaintenancePolicy without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMaintenancePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setMaintenancePolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setMaintenancePolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMaintenancePolicy without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMaintenancePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.Operation() + ); + client.innerApiCalls.setMaintenancePolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setMaintenancePolicy( + request, + (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMaintenancePolicy with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMaintenancePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setMaintenancePolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setMaintenancePolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMaintenancePolicy with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.SetMaintenancePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setMaintenancePolicy(request), expectedError); + }); + }); + + describe('checkAutopilotCompatibility', () => { + it('invokes checkAutopilotCompatibility without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CheckAutopilotCompatibilityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CheckAutopilotCompatibilityRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.CheckAutopilotCompatibilityResponse() + ); + client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCall(expectedResponse); + const [response] = await client.checkAutopilotCompatibility(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAutopilotCompatibility without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CheckAutopilotCompatibilityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CheckAutopilotCompatibilityRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1.CheckAutopilotCompatibilityResponse() + ); + client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.checkAutopilotCompatibility( + request, + (err?: Error|null, result?: protos.google.container.v1.ICheckAutopilotCompatibilityResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAutopilotCompatibility with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CheckAutopilotCompatibilityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CheckAutopilotCompatibilityRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkAutopilotCompatibility(request), expectedError); + const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAutopilotCompatibility with closed client', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.CheckAutopilotCompatibilityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.CheckAutopilotCompatibilityRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.checkAutopilotCompatibility(request), expectedError); + }); + }); + + describe('listUsableSubnetworks', () => { + it('invokes listUsableSubnetworks without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + ]; + client.innerApiCalls.listUsableSubnetworks = stubSimpleCall(expectedResponse); + const [response] = await client.listUsableSubnetworks(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableSubnetworks without error using callback', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + ]; + client.innerApiCalls.listUsableSubnetworks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUsableSubnetworks( + request, + (err?: Error|null, result?: protos.google.container.v1.IUsableSubnetwork[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableSubnetworks with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listUsableSubnetworks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listUsableSubnetworks(request), expectedError); + const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableSubnetworksStream without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + ]; + client.descriptors.page.listUsableSubnetworks.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listUsableSubnetworksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.container.v1.UsableSubnetwork[] = []; + stream.on('data', (response: protos.google.container.v1.UsableSubnetwork) => { + 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.listUsableSubnetworks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableSubnetworks, request)); + assert( + (client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listUsableSubnetworksStream with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableSubnetworks.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listUsableSubnetworksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.container.v1.UsableSubnetwork[] = []; + stream.on('data', (response: protos.google.container.v1.UsableSubnetwork) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableSubnetworks, request)); + assert( + (client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableSubnetworks without error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), + ]; + client.descriptors.page.listUsableSubnetworks.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.container.v1.IUsableSubnetwork[] = []; + const iterable = client.listUsableSubnetworksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableSubnetworks with error', async () => { + const client = new clustermanagerModule.v1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableSubnetworks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUsableSubnetworksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.container.v1.IUsableSubnetwork[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); +}); diff --git a/owl-bot-staging/google-container/v1/tsconfig.json b/owl-bot-staging/google-container/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-container/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-container/v1/webpack.config.js b/owl-bot-staging/google-container/v1/webpack.config.js new file mode 100644 index 00000000000..9032271af9d --- /dev/null +++ b/owl-bot-staging/google-container/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: 'ClusterManager', + filename: './cluster-manager.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-container/v1beta1/.eslintignore b/owl-bot-staging/google-container/v1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-container/v1beta1/.eslintrc.json b/owl-bot-staging/google-container/v1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-container/v1beta1/.gitignore b/owl-bot-staging/google-container/v1beta1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-container/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-container/v1beta1/.jsdoc.js b/owl-bot-staging/google-container/v1beta1/.jsdoc.js new file mode 100644 index 00000000000..6dc18e81193 --- /dev/null +++ b/owl-bot-staging/google-container/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/container', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-container/v1beta1/.mocharc.js b/owl-bot-staging/google-container/v1beta1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-container/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-container/v1beta1/.prettierrc.js b/owl-bot-staging/google-container/v1beta1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-container/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-container/v1beta1/README.md b/owl-bot-staging/google-container/v1beta1/README.md new file mode 100644 index 00000000000..f32441d7e6b --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/README.md @@ -0,0 +1 @@ +Container: Nodejs Client diff --git a/owl-bot-staging/google-container/v1beta1/package.json b/owl-bot-staging/google-container/v1beta1/package.json new file mode 100644 index 00000000000..b2ac12ed35f --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/container", + "version": "0.1.0", + "description": "Container client for Node.js", + "repository": "googleapis/nodejs-container", + "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 container", + "container", + "cluster 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-container/v1beta1/protos/google/container/v1beta1/cluster_service.proto b/owl-bot-staging/google-container/v1beta1/protos/google/container/v1beta1/cluster_service.proto new file mode 100644 index 00000000000..60ca0f57e8c --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/protos/google/container/v1beta1/cluster_service.proto @@ -0,0 +1,5733 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.container.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/rpc/code.proto"; +import "google/rpc/status.proto"; +import "google/type/date.proto"; + +option csharp_namespace = "Google.Cloud.Container.V1Beta1"; +option go_package = "cloud.google.com/go/container/apiv1beta1/containerpb;containerpb"; +option java_multiple_files = true; +option java_outer_classname = "ClusterServiceProto"; +option java_package = "com.google.container.v1beta1"; +option php_namespace = "Google\\Cloud\\Container\\V1beta1"; +option ruby_package = "Google::Cloud::Container::V1beta1"; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; + +// Google Kubernetes Engine Cluster Manager v1beta1 +service ClusterManager { + option (google.api.default_host) = "container.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all clusters owned by a project in either the specified zone or all + // zones. + rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*}/clusters" + additional_bindings { + get: "/v1beta1/projects/{project_id}/zones/{zone}/clusters" + } + }; + option (google.api.method_signature) = "project_id,zone"; + } + + // Gets the details for a specific cluster. + rpc GetCluster(GetClusterRequest) returns (Cluster) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/clusters/*}" + additional_bindings { + get: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id"; + } + + // Creates a cluster, consisting of the specified number and type of Google + // Compute Engine instances. + // + // By default, the cluster is created in the project's + // [default + // network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). + // + // One firewall is added for the cluster. After cluster creation, + // the Kubelet creates routes for each node to allow the containers + // on that node to communicate with all other instances in the + // cluster. + // + // Finally, an entry is added to the project's global metadata indicating + // which CIDR range the cluster is using. + rpc CreateCluster(CreateClusterRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*}/clusters" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster"; + } + + // Updates the settings for a specific cluster. + rpc UpdateCluster(UpdateClusterRequest) returns (Operation) { + option (google.api.http) = { + put: "/v1beta1/{name=projects/*/locations/*/clusters/*}" + body: "*" + additional_bindings { + put: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id,update"; + } + + // Updates the version and/or image type of a specific node pool. + rpc UpdateNodePool(UpdateNodePoolRequest) returns (Operation) { + option (google.api.http) = { + put: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/update" + body: "*" + } + }; + } + + // Sets the autoscaling settings of a specific node pool. + rpc SetNodePoolAutoscaling(SetNodePoolAutoscalingRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setAutoscaling" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/autoscaling" + body: "*" + } + }; + } + + // Sets the logging service for a specific cluster. + rpc SetLoggingService(SetLoggingServiceRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setLogging" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/logging" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,logging_service"; + } + + // Sets the monitoring service for a specific cluster. + rpc SetMonitoringService(SetMonitoringServiceRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setMonitoring" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/monitoring" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,monitoring_service"; + } + + // Sets the addons for a specific cluster. + rpc SetAddonsConfig(SetAddonsConfigRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setAddons" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/addons" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,addons_config"; + } + + // Sets the locations for a specific cluster. + // Deprecated. Use + // [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters/update) + // instead. + rpc SetLocations(SetLocationsRequest) returns (Operation) { + option deprecated = true; + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setLocations" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/locations" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,locations"; + } + + // Updates the master for a specific cluster. + rpc UpdateMaster(UpdateMasterRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:updateMaster" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/master" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,master_version"; + } + + // Sets master auth materials. Currently supports changing the admin password + // or a specific cluster, either via password generation or explicitly setting + // the password. + rpc SetMasterAuth(SetMasterAuthRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setMasterAuth" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMasterAuth" + body: "*" + } + }; + } + + // Deletes the cluster, including the Kubernetes endpoint and all worker + // nodes. + // + // Firewalls and routes that were configured during cluster creation + // are also deleted. + // + // Other Google Compute Engine resources that might be in use by the cluster, + // such as load balancer resources, are not deleted if they weren't present + // when the cluster was initially created. + rpc DeleteCluster(DeleteClusterRequest) returns (Operation) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/locations/*/clusters/*}" + additional_bindings { + delete: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id"; + } + + // Lists all operations in a project in the specified zone or all zones. + rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*}/operations" + additional_bindings { + get: "/v1beta1/projects/{project_id}/zones/{zone}/operations" + } + }; + option (google.api.method_signature) = "project_id,zone"; + } + + // Gets the specified operation. + rpc GetOperation(GetOperationRequest) returns (Operation) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/operations/*}" + additional_bindings { + get: "/v1beta1/projects/{project_id}/zones/{zone}/operations/{operation_id}" + } + }; + option (google.api.method_signature) = "project_id,zone,operation_id"; + } + + // Cancels the specified operation. + rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/operations/*}:cancel" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/operations/{operation_id}:cancel" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,operation_id"; + } + + // Returns configuration info about the Google Kubernetes Engine service. + rpc GetServerConfig(GetServerConfigRequest) returns (ServerConfig) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*}/serverConfig" + additional_bindings { + get: "/v1beta1/projects/{project_id}/zones/{zone}/serverconfig" + } + }; + option (google.api.method_signature) = "project_id,zone"; + } + + // Gets the public component of the cluster signing keys in + // JSON Web Key format. + // This API is not yet intended for general use, and is not available for all + // clusters. + rpc GetJSONWebKeys(GetJSONWebKeysRequest) returns (GetJSONWebKeysResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*/clusters/*}/jwks" + }; + } + + // Lists the node pools for a cluster. + rpc ListNodePools(ListNodePoolsRequest) returns (ListNodePoolsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*/clusters/*}/nodePools" + additional_bindings { + get: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id"; + } + + // Retrieves the requested node pool. + rpc GetNodePool(GetNodePoolRequest) returns (NodePool) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}" + additional_bindings { + get: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,node_pool_id"; + } + + // Creates a node pool for a cluster. + rpc CreateNodePool(CreateNodePoolRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*/clusters/*}/nodePools" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,node_pool"; + } + + // Deletes a node pool from a cluster. + rpc DeleteNodePool(DeleteNodePoolRequest) returns (Operation) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}" + additional_bindings { + delete: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,node_pool_id"; + } + + // CompleteNodePoolUpgrade will signal an on-going node pool upgrade to + // complete. + rpc CompleteNodePoolUpgrade(CompleteNodePoolUpgradeRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:completeUpgrade" + body: "*" + }; + } + + // Rolls back a previously Aborted or Failed NodePool upgrade. + // This makes no changes if the last upgrade successfully completed. + rpc RollbackNodePoolUpgrade(RollbackNodePoolUpgradeRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:rollback" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}:rollback" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,node_pool_id"; + } + + // Sets the NodeManagement options for a node pool. + rpc SetNodePoolManagement(SetNodePoolManagementRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setManagement" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setManagement" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,node_pool_id,management"; + } + + // Sets labels on a cluster. + rpc SetLabels(SetLabelsRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setResourceLabels" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/resourceLabels" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,resource_labels,label_fingerprint"; + } + + // Enables or disables the ABAC authorization mechanism on a cluster. + rpc SetLegacyAbac(SetLegacyAbacRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setLegacyAbac" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/legacyAbac" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id,enabled"; + } + + // Starts master IP rotation. + rpc StartIPRotation(StartIPRotationRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:startIpRotation" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:startIpRotation" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id"; + } + + // Completes master IP rotation. + rpc CompleteIPRotation(CompleteIPRotationRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:completeIpRotation" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:completeIpRotation" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,zone,cluster_id"; + } + + // SetNodePoolSizeRequest sets the size of a node pool. The new size will be + // used for all replicas, including future replicas created by modifying + // [NodePool.locations][google.container.v1beta1.NodePool.locations]. + rpc SetNodePoolSize(SetNodePoolSizeRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setSize" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setSize" + body: "*" + } + }; + } + + // Enables or disables Network Policy for a cluster. + rpc SetNetworkPolicy(SetNetworkPolicyRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setNetworkPolicy" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setNetworkPolicy" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,network_policy"; + } + + // Sets the maintenance policy for a cluster. + rpc SetMaintenancePolicy(SetMaintenancePolicyRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setMaintenancePolicy" + body: "*" + additional_bindings { + post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMaintenancePolicy" + body: "*" + } + }; + option (google.api.method_signature) = + "project_id,zone,cluster_id,maintenance_policy"; + } + + // Lists subnetworks that can be used for creating clusters in a project. + rpc ListUsableSubnetworks(ListUsableSubnetworksRequest) + returns (ListUsableSubnetworksResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*}/aggregated/usableSubnetworks" + }; + option (google.api.method_signature) = "parent"; + } + + // Checks the cluster compatibility with Autopilot mode, and returns a list of + // compatibility issues. + rpc CheckAutopilotCompatibility(CheckAutopilotCompatibilityRequest) + returns (CheckAutopilotCompatibilityResponse) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/clusters/*}:checkAutopilotCompatibility" + }; + } + + // Fetches locations that offer Google Kubernetes Engine. + rpc ListLocations(ListLocationsRequest) returns (ListLocationsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*}/locations" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Parameters that can be configured on Linux nodes. +message LinuxNodeConfig { + // Possible cgroup modes that can be used. + enum CgroupMode { + // CGROUP_MODE_UNSPECIFIED is when unspecified cgroup configuration is used. + // The default for the GKE node OS image will be used. + CGROUP_MODE_UNSPECIFIED = 0; + + // CGROUP_MODE_V1 specifies to use cgroupv1 for the cgroup configuration on + // the node image. + CGROUP_MODE_V1 = 1; + + // CGROUP_MODE_V2 specifies to use cgroupv2 for the cgroup configuration on + // the node image. + CGROUP_MODE_V2 = 2; + } + + // The Linux kernel parameters to be applied to the nodes and all pods running + // on the nodes. + // + // The following parameters are supported. + // + // net.core.busy_poll + // net.core.busy_read + // net.core.netdev_max_backlog + // net.core.rmem_max + // net.core.wmem_default + // net.core.wmem_max + // net.core.optmem_max + // net.core.somaxconn + // net.ipv4.tcp_rmem + // net.ipv4.tcp_wmem + // net.ipv4.tcp_tw_reuse + map sysctls = 1; + + // cgroup_mode specifies the cgroup mode to be used on the node. + CgroupMode cgroup_mode = 2; +} + +// Parameters that can be configured on Windows nodes. +// Windows Node Config that define the parameters that will be used to +// configure the Windows node pool settings +message WindowsNodeConfig { + // Possible OS version that can be used. + enum OSVersion { + // When OSVersion is not specified + OS_VERSION_UNSPECIFIED = 0; + + // LTSC2019 specifies to use LTSC2019 as the Windows Servercore Base Image + OS_VERSION_LTSC2019 = 1; + + // LTSC2022 specifies to use LTSC2022 as the Windows Servercore Base Image + OS_VERSION_LTSC2022 = 2; + } + + // OSVersion specifies the Windows node config to be used on the node + OSVersion os_version = 1; +} + +// Node kubelet configs. +message NodeKubeletConfig { + // Control the CPU management policy on the node. + // See + // https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/ + // + // The following values are allowed. + // * "none": the default, which represents the existing scheduling behavior. + // * "static": allows pods with certain resource characteristics to be granted + // increased CPU affinity and exclusivity on the node. + // The default value is 'none' if unspecified. + string cpu_manager_policy = 1; + + // Enable CPU CFS quota enforcement for containers that specify CPU limits. + // + // This option is enabled by default which makes kubelet use CFS quota + // (https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt) to + // enforce container CPU limits. Otherwise, CPU limits will not be enforced at + // all. + // + // Disable this option to mitigate CPU throttling problems while still having + // your pods to be in Guaranteed QoS class by specifying the CPU limits. + // + // The default value is 'true' if unspecified. + google.protobuf.BoolValue cpu_cfs_quota = 2; + + // Set the CPU CFS quota period value 'cpu.cfs_period_us'. + // + // The string must be a sequence of decimal numbers, each with optional + // fraction and a unit suffix, such as "300ms". + // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + // The value must be a positive duration. + string cpu_cfs_quota_period = 3; + + // Set the Pod PID limits. See + // https://kubernetes.io/docs/concepts/policy/pid-limiting/#pod-pid-limits + // + // Controls the maximum number of processes allowed to run in a pod. The value + // must be greater than or equal to 1024 and less than 4194304. + int64 pod_pids_limit = 4; + + // Enable or disable Kubelet read only port. + optional bool insecure_kubelet_readonly_port_enabled = 7; +} + +// Parameters that describe the nodes in a cluster. +// +// GKE Autopilot clusters do not +// recognize parameters in `NodeConfig`. Use +// [AutoprovisioningNodePoolDefaults][google.container.v1beta1.AutoprovisioningNodePoolDefaults] +// instead. +message NodeConfig { + // The name of a Google Compute Engine [machine + // type](https://cloud.google.com/compute/docs/machine-types). + // + // If unspecified, the default machine type is + // `e2-medium`. + string machine_type = 1; + + // Size of the disk attached to each node, specified in GB. + // The smallest allowed disk size is 10GB. + // + // If unspecified, the default disk size is 100GB. + int32 disk_size_gb = 2; + + // The set of Google API scopes to be made available on all of the + // node VMs under the "default" service account. + // + // The following scopes are recommended, but not required, and by default are + // not included: + // + // * `https://www.googleapis.com/auth/compute` is required for mounting + // persistent storage on your nodes. + // * `https://www.googleapis.com/auth/devstorage.read_only` is required for + // communicating with **gcr.io** + // (the [Google Container + // Registry](https://cloud.google.com/container-registry/)). + // + // If unspecified, no scopes are added, unless Cloud Logging or Cloud + // Monitoring are enabled, in which case their required scopes will be added. + repeated string oauth_scopes = 3; + + // The Google Cloud Platform Service Account to be used by the node VMs. + // Specify the email address of the Service Account; otherwise, if no Service + // Account is specified, the "default" service account is used. + string service_account = 9; + + // The metadata key/value pairs assigned to instances in the cluster. + // + // Keys must conform to the regexp `[a-zA-Z0-9-_]+` and be less than 128 bytes + // in length. These are reflected as part of a URL in the metadata server. + // Additionally, to avoid ambiguity, keys must not conflict with any other + // metadata keys for the project or be one of the reserved keys: + // + // - "cluster-location" + // - "cluster-name" + // - "cluster-uid" + // - "configure-sh" + // - "containerd-configure-sh" + // - "enable-oslogin" + // - "gci-ensure-gke-docker" + // - "gci-metrics-enabled" + // - "gci-update-strategy" + // - "instance-template" + // - "kube-env" + // - "startup-script" + // - "user-data" + // - "disable-address-manager" + // - "windows-startup-script-ps1" + // - "common-psm1" + // - "k8s-node-setup-psm1" + // - "install-ssh-psm1" + // - "user-profile-psm1" + // + // Values are free-form strings, and only have meaning as interpreted by + // the image running in the instance. The only restriction placed on them is + // that each value's size must be less than or equal to 32 KB. + // + // The total size of all keys and values must be less than 512 KB. + map metadata = 4; + + // The image type to use for this node. Note that for a given image type, + // the latest version of it will be used. Please see + // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for + // available image types. + string image_type = 5; + + // The map of Kubernetes labels (key/value pairs) to be applied to each node. + // These will added in addition to any default label(s) that + // Kubernetes may apply to the node. + // In case of conflict in label keys, the applied set may differ depending on + // the Kubernetes version -- it's best to assume the behavior is undefined + // and conflicts should be avoided. + // For more information, including usage and the valid values, see: + // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + map labels = 6; + + // The number of local SSD disks to be attached to the node. + // + // The limit for this value is dependent upon the maximum number of + // disks available on a machine per zone. See: + // https://cloud.google.com/compute/docs/disks/local-ssd + // for more information. + int32 local_ssd_count = 7; + + // The list of instance tags applied to all nodes. Tags are used to identify + // valid sources or targets for network firewalls and are specified by + // the client during cluster or node pool creation. Each tag within the list + // must comply with RFC1035. + repeated string tags = 8; + + // Whether the nodes are created as preemptible VM instances. See: + // https://cloud.google.com/compute/docs/instances/preemptible for more + // information about preemptible VM instances. + bool preemptible = 10; + + // A list of hardware accelerators to be attached to each node. + // See https://cloud.google.com/compute/docs/gpus for more information about + // support for GPUs. + repeated AcceleratorConfig accelerators = 11; + + // Sandbox configuration for this node. + SandboxConfig sandbox_config = 17; + + // Setting this field will assign instances of this + // pool to run on the specified node group. This is useful for running + // workloads on [sole tenant + // nodes](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes). + string node_group = 18; + + // The optional reservation affinity. Setting this field will apply + // the specified [Zonal Compute + // Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) + // to this node pool. + ReservationAffinity reservation_affinity = 19; + + // Type of the disk attached to each node (e.g. 'pd-standard', 'pd-ssd' or + // 'pd-balanced') + // + // If unspecified, the default disk type is 'pd-standard' + string disk_type = 12; + + // Minimum CPU platform to be used by this instance. The instance may be + // scheduled on the specified or newer CPU platform. Applicable values are the + // friendly names of CPU platforms, such as + // `minCpuPlatform: "Intel Haswell"` or + // `minCpuPlatform: "Intel Sandy Bridge"`. For more + // information, read [how to specify min CPU + // platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform). + string min_cpu_platform = 13; + + // The workload metadata configuration for this node. + WorkloadMetadataConfig workload_metadata_config = 14; + + // List of kubernetes taints to be applied to each node. + // + // For more information, including usage and the valid values, see: + // https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + repeated NodeTaint taints = 15; + + // + // The Customer Managed Encryption Key used to encrypt the boot disk attached + // to each node in the node pool. This should be of the form + // projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. + // For more information about protecting resources with Cloud KMS Keys please + // see: + // https://cloud.google.com/compute/docs/disks/customer-managed-encryption + string boot_disk_kms_key = 23; + + // Shielded Instance options. + ShieldedInstanceConfig shielded_instance_config = 20; + + // Parameters that can be configured on Linux nodes. + LinuxNodeConfig linux_node_config = 21; + + // Node kubelet configs. + NodeKubeletConfig kubelet_config = 22; + + // Parameters for the ephemeral storage filesystem. + // If unspecified, ephemeral storage is backed by the boot disk. + EphemeralStorageConfig ephemeral_storage_config = 24; + + // GCFS (Google Container File System) configs. + GcfsConfig gcfs_config = 25; + + // Advanced features for the Compute Engine VM. + AdvancedMachineFeatures advanced_machine_features = 26; + + // Enable or disable gvnic on the node pool. + VirtualNIC gvnic = 29; + + // Spot flag for enabling Spot VM, which is a rebrand of + // the existing preemptible flag. + bool spot = 32; + + // Confidential nodes config. + // All the nodes in the node pool will be Confidential VM once enabled. + ConfidentialNodes confidential_nodes = 35; + + // Enable or disable NCCL fast socket for the node pool. + optional FastSocket fast_socket = 36; + + // The resource labels for the node pool to use to annotate any related + // Google Compute Engine resources. + map resource_labels = 37; + + // Logging configuration. + NodePoolLoggingConfig logging_config = 38; + + // Parameters that can be configured on Windows nodes. + WindowsNodeConfig windows_node_config = 39; + + // Parameters for using raw-block Local NVMe SSDs. + LocalNvmeSsdBlockConfig local_nvme_ssd_block_config = 40; + + // Parameters for the node ephemeral storage using Local SSDs. + // If unspecified, ephemeral storage is backed by the boot disk. + // This field is functionally equivalent to the ephemeral_storage_config + EphemeralStorageLocalSsdConfig ephemeral_storage_local_ssd_config = 41; + + // Parameters for node pools to be backed by shared sole tenant node groups. + SoleTenantConfig sole_tenant_config = 42; + + // HostMaintenancePolicy contains the desired maintenance policy for the + // Google Compute Engine hosts. + HostMaintenancePolicy host_maintenance_policy = 44; +} + +// Specifies options for controlling advanced machine features. +message AdvancedMachineFeatures { + // The number of threads per physical core. To disable simultaneous + // multithreading (SMT) set this to 1. If unset, the maximum number of threads + // supported per core by the underlying processor is assumed. + optional int64 threads_per_core = 1; +} + +// Parameters for node pool-level network config. +message NodeNetworkConfig { + // Configuration of all network bandwidth tiers + message NetworkPerformanceConfig { + // Node network tier + enum Tier { + // Default value + TIER_UNSPECIFIED = 0; + + // Higher bandwidth, actual values based on VM size. + TIER_1 = 1; + } + + // Specifies the total network bandwidth tier for the NodePool. + optional Tier total_egress_bandwidth_tier = 1; + + // Specifies the network bandwidth tier for the NodePool for traffic to + // external/public IP addresses. + optional Tier external_ip_egress_bandwidth_tier = 2; + } + + // Input only. Whether to create a new range for pod IPs in this node pool. + // Defaults are provided for `pod_range` and `pod_ipv4_cidr_block` if they + // are not specified. + // + // If neither `create_pod_range` or `pod_range` are specified, the + // cluster-level default (`ip_allocation_policy.cluster_ipv4_cidr_block`) is + // used. + // + // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. + // + // This field cannot be changed after the node pool has been created. + bool create_pod_range = 4 [(google.api.field_behavior) = INPUT_ONLY]; + + // The ID of the secondary range for pod IPs. + // If `create_pod_range` is true, this ID is used for the new range. + // If `create_pod_range` is false, uses an existing secondary range with this + // ID. + // + // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. + // + // This field cannot be changed after the node pool has been created. + string pod_range = 5; + + // The IP address range for pod IPs in this node pool. + // + // Only applicable if `create_pod_range` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) to pick a specific range to use. + // + // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. + // + // This field cannot be changed after the node pool has been created. + string pod_ipv4_cidr_block = 6; + + // Whether nodes have internal IP addresses only. + // If enable_private_nodes is not specified, then the value is derived from + // [cluster.privateClusterConfig.enablePrivateNodes][google.container.v1beta1.PrivateClusterConfig.enablePrivateNodes] + optional bool enable_private_nodes = 9; + + // Network bandwidth tier configuration. + optional NetworkPerformanceConfig network_performance_config = 11; + + // [PRIVATE FIELD] + // Pod CIDR size overprovisioning config for the nodepool. + // + // Pod CIDR size per node depends on max_pods_per_node. By default, the value + // of max_pods_per_node is rounded off to next power of 2 and we then double + // that to get the size of pod CIDR block per node. + // Example: max_pods_per_node of 30 would result in 64 IPs (/26). + // + // This config can disable the doubling of IPs (we still round off to next + // power of 2) + // Example: max_pods_per_node of 30 will result in 32 IPs (/27) when + // overprovisioning is disabled. + PodCIDROverprovisionConfig pod_cidr_overprovision_config = 13; + + // We specify the additional node networks for this node pool using this list. + // Each node network corresponds to an additional interface + repeated AdditionalNodeNetworkConfig additional_node_network_configs = 14; + + // We specify the additional pod networks for this node pool using this list. + // Each pod network corresponds to an additional alias IP range for the node + repeated AdditionalPodNetworkConfig additional_pod_network_configs = 15; + + // Output only. [Output only] The utilization of the IPv4 range for the pod. + // The ratio is Usage/[Total number of IPs in the secondary range], + // Usage=numNodes*numZones*podIPsPerNode. + double pod_ipv4_range_utilization = 16 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// AdditionalNodeNetworkConfig is the configuration for additional node networks +// within the NodeNetworkConfig message +message AdditionalNodeNetworkConfig { + // Name of the VPC where the additional interface belongs + string network = 1; + + // Name of the subnetwork where the additional interface belongs + string subnetwork = 2; +} + +// AdditionalPodNetworkConfig is the configuration for additional pod networks +// within the NodeNetworkConfig message +message AdditionalPodNetworkConfig { + // Name of the subnetwork where the additional pod network belongs + string subnetwork = 1; + + // The name of the secondary range on the subnet which provides IP address for + // this pod range + string secondary_pod_range = 2; + + // The maximum number of pods per node which use this pod network + optional MaxPodsConstraint max_pods_per_node = 3; +} + +// A set of Shielded Instance options. +message ShieldedInstanceConfig { + // Defines whether the instance has Secure Boot enabled. + // + // Secure Boot helps ensure that the system only runs authentic software by + // verifying the digital signature of all boot components, and halting the + // boot process if signature verification fails. + bool enable_secure_boot = 1; + + // Defines whether the instance has integrity monitoring enabled. + // + // Enables monitoring and attestation of the boot integrity of the instance. + // The attestation is performed against the integrity policy baseline. This + // baseline is initially derived from the implicitly trusted boot image when + // the instance is created. + bool enable_integrity_monitoring = 2; +} + +// SandboxConfig contains configurations of the sandbox to use for the node. +message SandboxConfig { + // Possible types of sandboxes. + enum Type { + // Default value. This should not be used. + UNSPECIFIED = 0; + + // Run sandbox using gvisor. + GVISOR = 1; + } + + // Type of the sandbox to use for the node (e.g. 'gvisor') + string sandbox_type = 1 [deprecated = true]; + + // Type of the sandbox to use for the node. + Type type = 2; +} + +// EphemeralStorageConfig contains configuration for the ephemeral storage +// filesystem. +message EphemeralStorageConfig { + // Number of local SSDs to use to back ephemeral storage. Uses NVMe + // interfaces. Each local SSD is 375 GB in size. + // If zero, it means to disable using local SSDs as ephemeral storage. + int32 local_ssd_count = 1; +} + +// LocalNvmeSsdBlockConfig contains configuration for using raw-block local +// NVMe SSDs +message LocalNvmeSsdBlockConfig { + // The number of raw-block local NVMe SSD disks to be attached to the node. + // Each local SSD is 375 GB in size. If zero, it means no raw-block local NVMe + // SSD disks to be attached to the node. + // The limit for this value is dependent upon the maximum number of + // disks available on a machine per zone. See: + // https://cloud.google.com/compute/docs/disks/local-ssd + // for more information. + int32 local_ssd_count = 1; +} + +// EphemeralStorageLocalSsdConfig contains configuration for the node ephemeral +// storage using Local SSDs. +message EphemeralStorageLocalSsdConfig { + // Number of local SSDs to use to back ephemeral storage. Uses NVMe + // interfaces. Each local SSD is 375 GB in size. + // If zero, it means to disable using local SSDs as ephemeral storage. + // The limit for this value is dependent upon the maximum number of + // disks available on a machine per zone. See: + // https://cloud.google.com/compute/docs/disks/local-ssd + // for more information. + int32 local_ssd_count = 1; +} + +// GcfsConfig contains configurations of Google Container File System. +message GcfsConfig { + // Whether to use GCFS. + bool enabled = 1; +} + +// [ReservationAffinity](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) +// is the configuration of desired reservation which instances could take +// capacity from. +message ReservationAffinity { + // Indicates whether to consume capacity from a reservation or not. + enum Type { + // Default value. This should not be used. + UNSPECIFIED = 0; + + // Do not consume from any reserved capacity. + NO_RESERVATION = 1; + + // Consume any reservation available. + ANY_RESERVATION = 2; + + // Must consume from a specific reservation. Must specify key value fields + // for specifying the reservations. + SPECIFIC_RESERVATION = 3; + } + + // Corresponds to the type of reservation consumption. + Type consume_reservation_type = 1; + + // Corresponds to the label key of a reservation resource. To target a + // SPECIFIC_RESERVATION by name, specify + // "compute.googleapis.com/reservation-name" as the key and specify the name + // of your reservation as its value. + string key = 2; + + // Corresponds to the label value(s) of reservation resource(s). + repeated string values = 3; +} + +// SoleTenantConfig contains the NodeAffinities to specify what shared sole +// tenant node groups should back the node pool. +message SoleTenantConfig { + // Specifies the NodeAffinity key, values, and affinity operator according to + // [shared sole tenant node group + // affinities](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes#node_affinity_and_anti-affinity). + message NodeAffinity { + // Operator allows user to specify affinity or anti-affinity for the + // given key values. + enum Operator { + // Invalid or unspecified affinity operator. + OPERATOR_UNSPECIFIED = 0; + + // Affinity operator. + IN = 1; + + // Anti-affinity operator. + NOT_IN = 2; + } + + // Key for NodeAffinity. + string key = 1; + + // Operator for NodeAffinity. + Operator operator = 2; + + // Values for NodeAffinity. + repeated string values = 3; + } + + // NodeAffinities used to match to a shared sole tenant node group. + repeated NodeAffinity node_affinities = 1; +} + +// HostMaintenancePolicy contains the maintenance policy for the hosts on which +// the GKE VMs run on. +message HostMaintenancePolicy { + // Allows selecting how infrastructure upgrades should be applied to the + // cluster or node pool. + enum MaintenanceInterval { + // The maintenance interval is not explicitly specified. + MAINTENANCE_INTERVAL_UNSPECIFIED = 0; + + // Nodes are eligible to receive infrastructure and hypervisor updates as + // they become available. This may result in more maintenance operations + // (live migrations or terminations) for the node than the PERIODIC option. + AS_NEEDED = 1; + + // Nodes receive infrastructure and hypervisor updates on a periodic basis, + // minimizing the number of maintenance operations (live migrations or + // terminations) on an individual VM. This may mean underlying VMs will + // take longer to receive an update than if it was configured for + // AS_NEEDED. Security updates will still be applied as soon + // as they are available. + PERIODIC = 2; + } + + // Specifies the frequency of planned maintenance events. + optional MaintenanceInterval maintenance_interval = 1; +} + +// Kubernetes taint is composed of three fields: key, value, and effect. Effect +// can only be one of three types: NoSchedule, PreferNoSchedule or NoExecute. +// +// See +// [here](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration) +// for more information, including usage and the valid values. +message NodeTaint { + // Possible values for Effect in taint. + enum Effect { + // Not set + EFFECT_UNSPECIFIED = 0; + + // NoSchedule + NO_SCHEDULE = 1; + + // PreferNoSchedule + PREFER_NO_SCHEDULE = 2; + + // NoExecute + NO_EXECUTE = 3; + } + + // Key for taint. + string key = 1; + + // Value for taint. + string value = 2; + + // Effect for taint. + Effect effect = 3; +} + +// Collection of Kubernetes [node +// taints](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration). +message NodeTaints { + // List of node taints. + repeated NodeTaint taints = 1; +} + +// Collection of node-level [Kubernetes +// labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels). +message NodeLabels { + // Map of node label keys and node label values. + map labels = 1; +} + +// Collection of [GCP +// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels). +message ResourceLabels { + // Map of node label keys and node label values. + map labels = 1; +} + +// Collection of Compute Engine network tags that can be applied to a node's +// underlying VM instance. (See `tags` field in +// [`NodeConfig`](/kubernetes-engine/docs/reference/rest/v1/NodeConfig)). +message NetworkTags { + // List of network tags. + repeated string tags = 1; +} + +// The authentication information for accessing the master endpoint. +// Authentication can be done using HTTP basic auth or using client +// certificates. +message MasterAuth { + // The username to use for HTTP basic authentication to the master endpoint. + // For clusters v1.6.0 and later, basic authentication can be disabled by + // leaving username unspecified (or setting it to the empty string). + // + // Warning: basic authentication is deprecated, and will be removed in GKE + // control plane versions 1.19 and newer. For a list of recommended + // authentication methods, see: + // https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication + string username = 1 [deprecated = true]; + + // The password to use for HTTP basic authentication to the master endpoint. + // Because the master endpoint is open to the Internet, you should create a + // strong password. If a password is provided for cluster creation, username + // must be non-empty. + // + // Warning: basic authentication is deprecated, and will be removed in GKE + // control plane versions 1.19 and newer. For a list of recommended + // authentication methods, see: + // https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication + string password = 2 [deprecated = true]; + + // Configuration for client certificate authentication on the cluster. For + // clusters before v1.12, if no configuration is specified, a client + // certificate is issued. + ClientCertificateConfig client_certificate_config = 3; + + string cluster_ca_certificate = 100; + + // [Output only] Base64-encoded public certificate used by clients to + // authenticate to the cluster endpoint. + string client_certificate = 101; + + // [Output only] Base64-encoded private key used by clients to authenticate + // to the cluster endpoint. + string client_key = 102; +} + +// Configuration for client certificates on the cluster. +message ClientCertificateConfig { + // Issue a client certificate. + bool issue_client_certificate = 1; +} + +// Configuration for the addons that can be automatically spun up in the +// cluster, enabling additional functionality. +message AddonsConfig { + // Configuration for the HTTP (L7) load balancing controller addon, which + // makes it easy to set up HTTP load balancers for services in a cluster. + HttpLoadBalancing http_load_balancing = 1; + + // Configuration for the horizontal pod autoscaling feature, which + // increases or decreases the number of replica pods a replication controller + // has based on the resource usage of the existing pods. + HorizontalPodAutoscaling horizontal_pod_autoscaling = 2; + + // Configuration for the Kubernetes Dashboard. + // This addon is deprecated, and will be disabled in 1.15. It is recommended + // to use the Cloud Console to manage and monitor your Kubernetes clusters, + // workloads and applications. For more information, see: + // https://cloud.google.com/kubernetes-engine/docs/concepts/dashboards + KubernetesDashboard kubernetes_dashboard = 3 [deprecated = true]; + + // Configuration for NetworkPolicy. This only tracks whether the addon + // is enabled or not on the Master, it does not track whether network policy + // is enabled for the nodes. + NetworkPolicyConfig network_policy_config = 4; + + // Configuration for Istio, an open platform to connect, manage, and secure + // microservices. + IstioConfig istio_config = 5 [deprecated = true]; + + // Configuration for the Cloud Run addon. The `IstioConfig` addon must be + // enabled in order to enable Cloud Run addon. This option can only be enabled + // at cluster creation time. + CloudRunConfig cloud_run_config = 7; + + // Configuration for NodeLocalDNS, a dns cache running on cluster nodes + DnsCacheConfig dns_cache_config = 8; + + // Configuration for the ConfigConnector add-on, a Kubernetes + // extension to manage hosted GCP services through the Kubernetes API + ConfigConnectorConfig config_connector_config = 10; + + // Configuration for the Compute Engine Persistent Disk CSI driver. + GcePersistentDiskCsiDriverConfig gce_persistent_disk_csi_driver_config = 11; + + // Configuration for the KALM addon, which manages the lifecycle of k8s + // applications. + KalmConfig kalm_config = 12 [deprecated = true]; + + // Configuration for the GCP Filestore CSI driver. + GcpFilestoreCsiDriverConfig gcp_filestore_csi_driver_config = 14; + + // Configuration for the Backup for GKE agent addon. + GkeBackupAgentConfig gke_backup_agent_config = 16; + + // Configuration for the Cloud Storage Fuse CSI driver. + GcsFuseCsiDriverConfig gcs_fuse_csi_driver_config = 17; +} + +// Configuration options for the HTTP (L7) load balancing controller addon, +// which makes it easy to set up HTTP load balancers for services in a cluster. +message HttpLoadBalancing { + // Whether the HTTP Load Balancing controller is enabled in the cluster. + // When enabled, it runs a small pod in the cluster that manages the load + // balancers. + bool disabled = 1; +} + +// Configuration options for the horizontal pod autoscaling feature, which +// increases or decreases the number of replica pods a replication controller +// has based on the resource usage of the existing pods. +message HorizontalPodAutoscaling { + // Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. + // When enabled, it ensures that metrics are collected into Stackdriver + // Monitoring. + bool disabled = 1; +} + +// Configuration for the Kubernetes Dashboard. +message KubernetesDashboard { + // Whether the Kubernetes Dashboard is enabled for this cluster. + bool disabled = 1; +} + +// Configuration for NetworkPolicy. This only tracks whether the addon +// is enabled or not on the Master, it does not track whether network policy +// is enabled for the nodes. +message NetworkPolicyConfig { + // Whether NetworkPolicy is enabled for this cluster. + bool disabled = 1; +} + +// Configuration for NodeLocal DNSCache +message DnsCacheConfig { + // Whether NodeLocal DNSCache is enabled for this cluster. + bool enabled = 1; +} + +// Configuration options for the KALM addon. +message KalmConfig { + // Whether KALM is enabled for this cluster. + bool enabled = 1 [deprecated = true]; +} + +// Configuration for the Backup for GKE Agent. +message GkeBackupAgentConfig { + // Whether the Backup for GKE agent is enabled for this cluster. + bool enabled = 1; +} + +// Configuration options for the Config Connector add-on. +message ConfigConnectorConfig { + // Whether Cloud Connector is enabled for this cluster. + bool enabled = 1; +} + +// Configuration for the Compute Engine PD CSI driver. +message GcePersistentDiskCsiDriverConfig { + // Whether the Compute Engine PD CSI driver is enabled for this cluster. + bool enabled = 1; +} + +// Configuration for the GCP Filestore CSI driver. +message GcpFilestoreCsiDriverConfig { + // Whether the GCP Filestore CSI driver is enabled for this cluster. + bool enabled = 1; +} + +// Configuration for the Cloud Storage Fuse CSI driver. +message GcsFuseCsiDriverConfig { + // Whether the Cloud Storage Fuse CSI driver is enabled for this cluster. + bool enabled = 1; +} + +// Configuration for controlling master global access settings. +message PrivateClusterMasterGlobalAccessConfig { + // Whenever master is accessible globally or not. + bool enabled = 1; +} + +// Configuration options for private clusters. +message PrivateClusterConfig { + // Whether nodes have internal IP addresses only. If enabled, all nodes are + // given only RFC 1918 private addresses and communicate with the master via + // private networking. + bool enable_private_nodes = 1; + + // Whether the master's internal IP address is used as the cluster endpoint. + bool enable_private_endpoint = 2; + + // The IP range in CIDR notation to use for the hosted master network. This + // range will be used for assigning internal IP addresses to the master or + // set of masters, as well as the ILB VIP. This range must not overlap with + // any other ranges in use within the cluster's network. + string master_ipv4_cidr_block = 3; + + // Output only. The internal IP address of this cluster's master endpoint. + string private_endpoint = 4; + + // Output only. The external IP address of this cluster's master endpoint. + string public_endpoint = 5; + + // Output only. The peering name in the customer VPC used by this cluster. + string peering_name = 7; + + // Controls master global access settings. + PrivateClusterMasterGlobalAccessConfig master_global_access_config = 8; + + // Subnet to provision the master's private endpoint during cluster creation. + // Specified in projects/*/regions/*/subnetworks/* format. + string private_endpoint_subnetwork = 10; +} + +// Configuration options for Istio addon. +message IstioConfig { + // Istio auth mode, https://istio.io/docs/concepts/security/mutual-tls.html + enum IstioAuthMode { + // auth not enabled + AUTH_NONE = 0; + + // auth mutual TLS enabled + AUTH_MUTUAL_TLS = 1; + } + + // Whether Istio is enabled for this cluster. + bool disabled = 1 [deprecated = true]; + + // The specified Istio auth mode, either none, or mutual TLS. + IstioAuthMode auth = 2 [deprecated = true]; +} + +// Configuration options for the Cloud Run feature. +message CloudRunConfig { + // Load balancer type of ingress service of Cloud Run. + enum LoadBalancerType { + // Load balancer type for Cloud Run is unspecified. + LOAD_BALANCER_TYPE_UNSPECIFIED = 0; + + // Install external load balancer for Cloud Run. + LOAD_BALANCER_TYPE_EXTERNAL = 1; + + // Install internal load balancer for Cloud Run. + LOAD_BALANCER_TYPE_INTERNAL = 2; + } + + // Whether Cloud Run addon is enabled for this cluster. + bool disabled = 1; + + // Which load balancer type is installed for Cloud Run. + LoadBalancerType load_balancer_type = 3; +} + +// Configuration options for the master authorized networks feature. Enabled +// master authorized networks will disallow all external traffic to access +// Kubernetes master through HTTPS except traffic from the given CIDR blocks, +// Google Compute Engine Public IPs and Google Prod IPs. +message MasterAuthorizedNetworksConfig { + // CidrBlock contains an optional name and one CIDR block. + message CidrBlock { + // display_name is an optional field for users to identify CIDR blocks. + string display_name = 1; + + // cidr_block must be specified in CIDR notation. + string cidr_block = 2; + } + + // Whether or not master authorized networks is enabled. + bool enabled = 1; + + // cidr_blocks define up to 10 external networks that could access + // Kubernetes master through HTTPS. + repeated CidrBlock cidr_blocks = 2; + + // Whether master is accessbile via Google Compute Engine Public IP addresses. + optional bool gcp_public_cidrs_access_enabled = 3; +} + +// Configuration for the legacy Attribute Based Access Control authorization +// mode. +message LegacyAbac { + // Whether the ABAC authorizer is enabled for this cluster. When enabled, + // identities in the system, including service accounts, nodes, and + // controllers, will have statically granted permissions beyond those + // provided by the RBAC configuration or IAM. + bool enabled = 1; +} + +// Configuration options for the NetworkPolicy feature. +// https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ +message NetworkPolicy { + // Allowed Network Policy providers. + enum Provider { + // Not set + PROVIDER_UNSPECIFIED = 0; + + // Tigera (Calico Felix). + CALICO = 1; + } + + // The selected network policy provider. + Provider provider = 1; + + // Whether network policy is enabled on the cluster. + bool enabled = 2; +} + +// [PRIVATE FIELD] +// Config for pod CIDR size overprovisioning. +message PodCIDROverprovisionConfig { + // Whether Pod CIDR overprovisioning is disabled. + // Note: Pod CIDR overprovisioning is enabled by default. + bool disable = 1; +} + +// Configuration for controlling how IPs are allocated in the cluster. +message IPAllocationPolicy { + // Possible values for IP stack type + enum StackType { + // By default, the clusters will be IPV4 only + STACK_TYPE_UNSPECIFIED = 0; + + // The value used if the cluster is a IPV4 only + IPV4 = 1; + + // The value used if the cluster is a dual stack cluster + IPV4_IPV6 = 2; + } + + // IPv6 access type + enum IPv6AccessType { + // Default value, will be defaulted as type external. + IPV6_ACCESS_TYPE_UNSPECIFIED = 0; + + // Access type internal (all v6 addresses are internal IPs) + INTERNAL = 1; + + // Access type external (all v6 addresses are external IPs) + EXTERNAL = 2; + } + + // Whether alias IPs will be used for pod IPs in the cluster. + // This is used in conjunction with use_routes. It cannot + // be true if use_routes is true. If both use_ip_aliases and use_routes are + // false, then the server picks the default IP allocation mode + bool use_ip_aliases = 1; + + // Whether a new subnetwork will be created automatically for the cluster. + // + // This field is only applicable when `use_ip_aliases` is true. + bool create_subnetwork = 2; + + // A custom subnetwork name to be used if `create_subnetwork` is true. If + // this field is empty, then an automatic name will be chosen for the new + // subnetwork. + string subnetwork_name = 3; + + // This field is deprecated, use cluster_ipv4_cidr_block. + string cluster_ipv4_cidr = 4 [deprecated = true]; + + // This field is deprecated, use node_ipv4_cidr_block. + string node_ipv4_cidr = 5 [deprecated = true]; + + // This field is deprecated, use services_ipv4_cidr_block. + string services_ipv4_cidr = 6 [deprecated = true]; + + // The name of the secondary range to be used for the cluster CIDR + // block. The secondary range will be used for pod IP + // addresses. This must be an existing secondary range associated + // with the cluster subnetwork. + // + // This field is only applicable with use_ip_aliases and + // create_subnetwork is false. + string cluster_secondary_range_name = 7; + + // The name of the secondary range to be used as for the services + // CIDR block. The secondary range will be used for service + // ClusterIPs. This must be an existing secondary range associated + // with the cluster subnetwork. + // + // This field is only applicable with use_ip_aliases and + // create_subnetwork is false. + string services_secondary_range_name = 8; + + // The IP address range for the cluster pod IPs. If this field is set, then + // `cluster.cluster_ipv4_cidr` must be left blank. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string cluster_ipv4_cidr_block = 9; + + // The IP address range of the instance IPs in this cluster. + // + // This is applicable only if `create_subnetwork` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string node_ipv4_cidr_block = 10; + + // The IP address range of the services IPs in this cluster. If blank, a range + // will be automatically chosen with the default size. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string services_ipv4_cidr_block = 11; + + // If true, allow allocation of cluster CIDR ranges that overlap with certain + // kinds of network routes. By default we do not allow cluster CIDR ranges to + // intersect with any user declared routes. With allow_route_overlap == true, + // we allow overlapping with CIDR ranges that are larger than the cluster CIDR + // range. + // + // If this field is set to true, then cluster and services CIDRs must be + // fully-specified (e.g. `10.96.0.0/14`, but not `/14`), which means: + // 1) When `use_ip_aliases` is true, `cluster_ipv4_cidr_block` and + // `services_ipv4_cidr_block` must be fully-specified. + // 2) When `use_ip_aliases` is false, `cluster.cluster_ipv4_cidr` muse be + // fully-specified. + bool allow_route_overlap = 12; + + // The IP address range of the Cloud TPUs in this cluster. If unspecified, a + // range will be automatically chosen with the default size. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // If unspecified, the range will use the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + // This field is deprecated, use cluster.tpu_config.ipv4_cidr_block instead. + string tpu_ipv4_cidr_block = 13; + + // Whether routes will be used for pod IPs in the cluster. + // This is used in conjunction with use_ip_aliases. It cannot be true if + // use_ip_aliases is true. If both use_ip_aliases and use_routes are false, + // then the server picks the default IP allocation mode + bool use_routes = 15; + + // IP stack type + StackType stack_type = 16; + + // The ipv6 access type (internal or external) when create_subnetwork is true + IPv6AccessType ipv6_access_type = 17; + + // [PRIVATE FIELD] + // Pod CIDR size overprovisioning config for the cluster. + // + // Pod CIDR size per node depends on max_pods_per_node. By default, the value + // of max_pods_per_node is doubled and then rounded off to next power of 2 to + // get the size of pod CIDR block per node. + // Example: max_pods_per_node of 30 would result in 64 IPs (/26). + // + // This config can disable the doubling of IPs (we still round off to next + // power of 2) + // Example: max_pods_per_node of 30 will result in 32 IPs (/27) when + // overprovisioning is disabled. + PodCIDROverprovisionConfig pod_cidr_overprovision_config = 21; + + // Output only. [Output only] The subnet's IPv6 CIDR block used by nodes and + // pods. + string subnet_ipv6_cidr_block = 22 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. [Output only] The services IPv6 CIDR block for the cluster. + string services_ipv6_cidr_block = 23 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. [Output only] The additional pod ranges that are added to the + // cluster. These pod ranges can be used by new node pools to allocate pod IPs + // automatically. Once the range is removed it will not show up in + // IPAllocationPolicy. + AdditionalPodRangesConfig additional_pod_ranges_config = 24 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. [Output only] The utilization of the cluster default IPv4 + // range for the pod. The ratio is Usage/[Total number of IPs in the secondary + // range], Usage=numNodes*numZones*podIPsPerNode. + double default_pod_ipv4_range_utilization = 25 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration for Binary Authorization. +message BinaryAuthorization { + // Binary Authorization mode of operation. + enum EvaluationMode { + // Default value + EVALUATION_MODE_UNSPECIFIED = 0; + + // Disable BinaryAuthorization + DISABLED = 1; + + // Enforce Kubernetes admission requests with BinaryAuthorization using the + // project's singleton policy. This is equivalent to setting the + // enabled boolean to true. + PROJECT_SINGLETON_POLICY_ENFORCE = 2; + + // Use Binary Authorization with the policies specified in policy_bindings. + POLICY_BINDINGS = 5; + + // Use Binary Authorization with the policies specified in policy_bindings, + // and also with the project's singleton policy in enforcement mode. + POLICY_BINDINGS_AND_PROJECT_SINGLETON_POLICY_ENFORCE = 6; + } + + // Binauthz policy that applies to this cluster. + message PolicyBinding { + // The relative resource name of the binauthz platform policy to audit. GKE + // platform policies have the following format: + // `projects/{project_number}/platforms/gke/policies/{policy_id}`. + optional string name = 1; + } + + // This field is deprecated. Leave this unset and instead configure + // BinaryAuthorization using evaluation_mode. If evaluation_mode is set to + // anything other than EVALUATION_MODE_UNSPECIFIED, this field is ignored. + bool enabled = 1 [deprecated = true]; + + // Mode of operation for binauthz policy evaluation. If unspecified, defaults + // to DISABLED. + EvaluationMode evaluation_mode = 2; + + // Optional. Binauthz policies that apply to this cluster. + repeated PolicyBinding policy_bindings = 5 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration for the PodSecurityPolicy feature. +message PodSecurityPolicyConfig { + // Enable the PodSecurityPolicy controller for this cluster. If enabled, pods + // must be valid under a PodSecurityPolicy to be created. + bool enabled = 1; +} + +// Configuration for returning group information from authenticators. +message AuthenticatorGroupsConfig { + // Whether this cluster should return group membership lookups + // during authentication using a group of security groups. + bool enabled = 1; + + // The name of the security group-of-groups to be used. Only relevant + // if enabled = true. + string security_group = 2; +} + +// Telemetry integration for the cluster. +message ClusterTelemetry { + // Type of the integration. + enum Type { + // Not set. + UNSPECIFIED = 0; + + // Monitoring integration is disabled. + DISABLED = 1; + + // Monitoring integration is enabled. + ENABLED = 2; + + // Only system components are monitored and logged. + SYSTEM_ONLY = 3; + } + + // Type of the integration. + Type type = 1; +} + +// A Google Kubernetes Engine cluster. +message Cluster { + // The current status of the cluster. + enum Status { + // Not set. + STATUS_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 master or node software. Details can + // be found in the `statusMessage` field. + RECONCILING = 3; + + // The STOPPING state indicates the cluster is being deleted. + STOPPING = 4; + + // The ERROR state indicates the cluster may be unusable. Details + // can be found in the `statusMessage` field. + ERROR = 5; + + // The DEGRADED state indicates the cluster requires user action to restore + // full functionality. Details can be found in the `statusMessage` field. + DEGRADED = 6; + } + + // The name of this cluster. The name must be unique within this project + // and location (e.g. zone or region), and can be up to 40 characters with + // the following restrictions: + // + // * Lowercase letters, numbers, and hyphens only. + // * Must start with a letter. + // * Must end with a number or a letter. + string name = 1; + + // An optional description of this cluster. + string description = 2; + + // The number of nodes to create in this cluster. You must ensure that your + // Compute Engine [resource quota](https://cloud.google.com/compute/quotas) + // is sufficient for this number of instances. You must also have available + // firewall and routes quota. + // For requests, this field should only be used in lieu of a + // "node_pool" object, since this configuration (along with the + // "node_config") will be used to create a "NodePool" object with an + // auto-generated name. Do not use this and a node_pool at the same time. + // + // This field is deprecated, use node_pool.initial_node_count instead. + int32 initial_node_count = 3 [deprecated = true]; + + // Parameters used in creating the cluster's nodes. + // For requests, this field should only be used in lieu of a + // "node_pool" object, since this configuration (along with the + // "initial_node_count") will be used to create a "NodePool" object with an + // auto-generated name. Do not use this and a node_pool at the same time. + // For responses, this field will be populated with the node configuration of + // the first node pool. (For configuration of each node pool, see + // `node_pool.config`) + // + // If unspecified, the defaults are used. + // This field is deprecated, use node_pool.config instead. + NodeConfig node_config = 4 [deprecated = true]; + + // The authentication information for accessing the master endpoint. + // If unspecified, the defaults are used: + // For clusters before v1.12, if master_auth is unspecified, `username` will + // be set to "admin", a random password will be generated, and a client + // certificate will be issued. + MasterAuth master_auth = 5; + + // The logging service the cluster should use to write logs. + // Currently available options: + // + // * `logging.googleapis.com/kubernetes` - The Cloud Logging + // service with a Kubernetes-native resource model + // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer + // available as of GKE 1.15). + // * `none` - no logs will be exported from the cluster. + // + // If left as an empty string,`logging.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. + string logging_service = 6; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring + // service with a Kubernetes-native resource model + // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no + // longer available as of GKE 1.15). + // * `none` - No metrics will be exported from the cluster. + // + // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. + string monitoring_service = 7; + + // The name of the Google Compute Engine + // [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) + // to which the cluster is connected. If left unspecified, the `default` + // network will be used. On output this shows the network ID instead of the + // name. + string network = 8; + + // The IP address range of the container pods in this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`). Leave blank to have + // one automatically chosen or specify a `/14` block in `10.0.0.0/8`. + string cluster_ipv4_cidr = 9; + + // Configurations for the various addons available to run in the cluster. + AddonsConfig addons_config = 10; + + // The name of the Google Compute Engine + // [subnetwork](https://cloud.google.com/compute/docs/subnetworks) to which + // the cluster is connected. On output this shows the subnetwork ID instead of + // the name. + string subnetwork = 11; + + // The node pools associated with this cluster. + // This field should not be set if "node_config" or "initial_node_count" are + // specified. + repeated NodePool node_pools = 12; + + // The list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster's nodes should be located. + // + // This field provides a default value if + // [NodePool.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools#NodePool.FIELDS.locations) + // are not specified during node pool creation. + // + // Warning: changing cluster locations will update the + // [NodePool.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools#NodePool.FIELDS.locations) + // of all node pools and will result in nodes being added and/or removed. + repeated string locations = 13; + + // Kubernetes alpha features are enabled on this cluster. This includes alpha + // API groups (e.g. v1beta1) and features that may not be production ready in + // the kubernetes version of the master and nodes. + // The cluster has no SLA for uptime and master/node upgrades are disabled. + // Alpha enabled clusters are automatically deleted thirty days after + // creation. + bool enable_kubernetes_alpha = 14; + + // Kubernetes open source beta apis enabled on the cluster. Only beta apis. + K8sBetaAPIConfig enable_k8s_beta_apis = 143; + + // The resource labels for the cluster to use to annotate any related + // Google Compute Engine resources. + map resource_labels = 15; + + // The fingerprint of the set of labels for this cluster. + string label_fingerprint = 16; + + // Configuration for the legacy ABAC authorization mode. + LegacyAbac legacy_abac = 18; + + // Configuration options for the NetworkPolicy feature. + NetworkPolicy network_policy = 19; + + // Configuration for cluster IP allocation. + IPAllocationPolicy ip_allocation_policy = 20; + + // The configuration options for master authorized networks feature. + MasterAuthorizedNetworksConfig master_authorized_networks_config = 22; + + // Configure the maintenance policy for this cluster. + MaintenancePolicy maintenance_policy = 23; + + // Configuration for Binary Authorization. + BinaryAuthorization binary_authorization = 24; + + // Configuration for the PodSecurityPolicy feature. + PodSecurityPolicyConfig pod_security_policy_config = 25; + + // Cluster-level autoscaling configuration. + ClusterAutoscaling autoscaling = 26; + + // Configuration for cluster networking. + NetworkConfig network_config = 27; + + // If this is a private cluster setup. Private clusters are clusters that, by + // default have no external IP addresses on the nodes and where nodes and the + // master communicate over private IP addresses. + // This field is deprecated, use private_cluster_config.enable_private_nodes + // instead. + bool private_cluster = 28 [deprecated = true]; + + // The IP prefix in CIDR notation to use for the hosted master network. + // This prefix will be used for assigning private IP addresses to the + // master or set of masters, as well as the ILB VIP. + // This field is deprecated, use + // private_cluster_config.master_ipv4_cidr_block instead. + string master_ipv4_cidr_block = 29 [deprecated = true]; + + // The default constraint on the maximum number of pods that can be run + // simultaneously on a node in the node pool of this cluster. Only honored + // if cluster created with IP Alias support. + MaxPodsConstraint default_max_pods_constraint = 30; + + // Configuration for exporting resource usages. Resource usage export is + // disabled when this config unspecified. + ResourceUsageExportConfig resource_usage_export_config = 33; + + // Configuration controlling RBAC group membership information. + AuthenticatorGroupsConfig authenticator_groups_config = 34; + + // Configuration for private cluster. + PrivateClusterConfig private_cluster_config = 37; + + // Cluster-level Vertical Pod Autoscaling configuration. + VerticalPodAutoscaling vertical_pod_autoscaling = 39; + + // Shielded Nodes configuration. + ShieldedNodes shielded_nodes = 40; + + // Release channel configuration. If left unspecified on cluster creation and + // a version is specified, the cluster is enrolled in the most mature release + // channel where the version is available (first checking STABLE, then + // REGULAR, and finally RAPID). Otherwise, if no release channel + // configuration and no version is specified, the cluster is enrolled in the + // REGULAR channel with its default version. + ReleaseChannel release_channel = 41; + + // Configuration for the use of Kubernetes Service Accounts in GCP IAM + // policies. + WorkloadIdentityConfig workload_identity_config = 43; + + // Configuration for issuance of mTLS keys and certificates to Kubernetes + // pods. + WorkloadCertificates workload_certificates = 52; + + // Configuration for issuance of mTLS keys and certificates to Kubernetes + // pods. + MeshCertificates mesh_certificates = 67; + + // Configuration for direct-path (via ALTS) with workload identity. + WorkloadALTSConfig workload_alts_config = 53; + + // Configuration for the fine-grained cost management feature. + CostManagementConfig cost_management_config = 45; + + // Telemetry integration for the cluster. + ClusterTelemetry cluster_telemetry = 46; + + // Configuration for Cloud TPU support; + TpuConfig tpu_config = 47; + + // Notification configuration of the cluster. + NotificationConfig notification_config = 49; + + // Configuration of Confidential Nodes. + // All the nodes in the cluster will be Confidential VM once enabled. + ConfidentialNodes confidential_nodes = 50; + + // Configuration for Identity Service component. + IdentityServiceConfig identity_service_config = 54; + + // [Output only] Server-defined URL for the resource. + string self_link = 100; + + // [Output only] The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field is deprecated, use location instead. + string zone = 101 [deprecated = true]; + + // [Output only] The IP address of this cluster's master endpoint. + // The endpoint can be accessed from the internet at + // `https://username:password@endpoint/`. + // + // See the `masterAuth` property of this resource for username and + // password information. + string endpoint = 102; + + // The initial Kubernetes version for this cluster. Valid versions are those + // found in validMasterVersions returned by getServerConfig. The version can + // be upgraded over time; such upgrades are reflected in + // currentMasterVersion and currentNodeVersion. + // + // Users may specify either explicit versions offered by + // Kubernetes Engine or version aliases, which have the following behavior: + // + // - "latest": picks the highest valid Kubernetes version + // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + // - "1.X.Y-gke.N": picks an explicit Kubernetes version + // - "","-": picks the default Kubernetes version + string initial_cluster_version = 103; + + // [Output only] The current software version of the master endpoint. + string current_master_version = 104; + + // [Output only] Deprecated, use + // [NodePool.version](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters.nodePools) + // instead. The current version of the node software components. + // If they are currently at multiple versions because they're in the process + // of being upgraded, this reflects the minimum version of all nodes. + string current_node_version = 105 [deprecated = true]; + + // [Output only] The time the cluster was created, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string create_time = 106; + + // [Output only] The current status of this cluster. + Status status = 107; + + // [Output only] Deprecated. Use conditions instead. + // Additional information about the current status of this + // cluster, if available. + string status_message = 108 [deprecated = true]; + + // [Output only] The size of the address space on each node for hosting + // containers. This is provisioned from within the `container_ipv4_cidr` + // range. This field will only be set when cluster is in route-based network + // mode. + int32 node_ipv4_cidr_size = 109; + + // [Output only] The IP address range of the Kubernetes services in + // this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `1.2.3.4/29`). Service addresses are + // typically put in the last `/16` from the container CIDR. + string services_ipv4_cidr = 110; + + // Deprecated. Use node_pools.instance_group_urls. + repeated string instance_group_urls = 111 [deprecated = true]; + + // [Output only] The number of nodes currently in the cluster. Deprecated. + // Call Kubernetes API directly to retrieve node information. + int32 current_node_count = 112 [deprecated = true]; + + // [Output only] The time the cluster will be automatically + // deleted in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string expire_time = 113; + + // [Output only] The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) + // or + // [region](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) + // in which the cluster resides. + string location = 114; + + // Enable the ability to use Cloud TPUs in this cluster. + // This field is deprecated, use tpu_config.enabled instead. + bool enable_tpu = 115; + + // [Output only] The IP address range of the Cloud TPUs in this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `1.2.3.4/29`). + string tpu_ipv4_cidr_block = 116; + + // Configuration of etcd encryption. + DatabaseEncryption database_encryption = 38; + + // Which conditions caused the current cluster state. + repeated StatusCondition conditions = 118; + + // Configuration for master components. + Master master = 124; + + // Autopilot configuration for the cluster. + Autopilot autopilot = 128; + + // Output only. Unique id for the cluster. + string id = 129 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Default NodePool settings for the entire cluster. These settings are + // overridden if specified on the specific NodePool object. + optional NodePoolDefaults node_pool_defaults = 131; + + // Logging configuration for the cluster. + LoggingConfig logging_config = 132; + + // Monitoring configuration for the cluster. + MonitoringConfig monitoring_config = 133; + + // Node pool configs that apply to all auto-provisioned node pools + // in autopilot clusters and node auto-provisioning enabled clusters. + NodePoolAutoConfig node_pool_auto_config = 136; + + // Enable/Disable Protect API features for the cluster. + optional ProtectConfig protect_config = 137; + + // This checksum is computed by the server based on the value of cluster + // fields, and may be sent on update requests to ensure the client has an + // up-to-date value before proceeding. + string etag = 139; + + // Fleet information for the cluster. + Fleet fleet = 140; + + // Enable/Disable Security Posture API features for the cluster. + SecurityPostureConfig security_posture_config = 145; +} + +// Kubernetes open source beta apis enabled on the cluster. +message K8sBetaAPIConfig { + // api name, e.g. storage.k8s.io/v1beta1/csistoragecapacities. + repeated string enabled_apis = 1; +} + +// WorkloadConfig defines the flags to enable or disable the +// workload configurations for the cluster. +message WorkloadConfig { + // Mode defines how to audit the workload configs. + enum Mode { + // Default value meaning that no mode has been specified. + MODE_UNSPECIFIED = 0; + + // This disables Workload Configuration auditing on the cluster, + // meaning that nothing is surfaced. + DISABLED = 1; + + // Applies the default set of policy auditing to a cluster's workloads. + BASIC = 4; + + // Surfaces configurations that are not in line with the + // Pod Security Standard Baseline policy. + BASELINE = 2 [deprecated = true]; + + // Surfaces configurations that are not in line with the + // Pod Security Standard Restricted policy. + RESTRICTED = 3 [deprecated = true]; + } + + // Sets which mode of auditing should be used for the cluster's workloads. + optional Mode audit_mode = 1; +} + +// ProtectConfig defines the flags needed to enable/disable features for the +// Protect API. +message ProtectConfig { + // WorkloadVulnerabilityMode defines mode to perform vulnerability scanning. + enum WorkloadVulnerabilityMode { + // Default value not specified. + WORKLOAD_VULNERABILITY_MODE_UNSPECIFIED = 0; + + // Disables Workload Vulnerability Scanning feature on the cluster. + DISABLED = 1; + + // Applies basic vulnerability scanning settings for cluster workloads. + BASIC = 2; + } + + // WorkloadConfig defines which actions are enabled for a cluster's workload + // configurations. + optional WorkloadConfig workload_config = 1; + + // Sets which mode to use for Protect workload vulnerability scanning feature. + optional WorkloadVulnerabilityMode workload_vulnerability_mode = 2; +} + +// SecurityPostureConfig defines the flags needed to enable/disable features for +// the Security Posture API. +message SecurityPostureConfig { + // Mode defines enablement mode for GKE Security posture features. + enum Mode { + // Default value not specified. + MODE_UNSPECIFIED = 0; + + // Disables Security Posture features on the cluster. + DISABLED = 1; + + // Applies Security Posture features on the cluster. + BASIC = 2; + } + + // VulnerabilityMode defines enablement mode for vulnerability scanning. + enum VulnerabilityMode { + // Default value not specified. + VULNERABILITY_MODE_UNSPECIFIED = 0; + + // Disables vulnerability scanning on the cluster. + VULNERABILITY_DISABLED = 1; + + // Applies basic vulnerability scanning on the cluster. + VULNERABILITY_BASIC = 2; + } + + // Sets which mode to use for Security Posture features. + optional Mode mode = 1; + + // Sets which mode to use for vulnerability scanning. + optional VulnerabilityMode vulnerability_mode = 2; +} + +// Subset of Nodepool message that has defaults. +message NodePoolDefaults { + // Subset of NodeConfig message that has defaults. + NodeConfigDefaults node_config_defaults = 1; +} + +// Subset of NodeConfig message that has defaults. +message NodeConfigDefaults { + // GCFS (Google Container File System, also known as Riptide) options. + GcfsConfig gcfs_config = 1; + + // Logging configuration for node pools. + NodePoolLoggingConfig logging_config = 3; + + // HostMaintenancePolicy contains the desired maintenance policy for the + // Google Compute Engine hosts. + HostMaintenancePolicy host_maintenance_policy = 5; +} + +// node pool configs that apply to all auto-provisioned node pools +// in autopilot clusters and node auto-provisioning enabled clusters +message NodePoolAutoConfig { + // The list of instance tags applied to all nodes. Tags are used to identify + // valid sources or targets for network firewalls and are specified by + // the client during cluster creation. Each tag within the list + // must comply with RFC1035. + NetworkTags network_tags = 1; +} + +// ClusterUpdate describes an update to the cluster. Exactly one update can +// be applied to a cluster with each request, so at most one field can be +// provided. +message ClusterUpdate { + // The Kubernetes version to change the nodes to (typically an + // upgrade). + // + // Users may specify either explicit versions offered by + // Kubernetes Engine or version aliases, which have the following behavior: + // + // - "latest": picks the highest valid Kubernetes version + // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + // - "1.X.Y-gke.N": picks an explicit Kubernetes version + // - "-": picks the Kubernetes master version + string desired_node_version = 4; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring + // service with a Kubernetes-native resource model + // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no + // longer available as of GKE 1.15). + // * `none` - No metrics will be exported from the cluster. + // + // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. + string desired_monitoring_service = 5; + + // Configurations for the various addons available to run in the cluster. + AddonsConfig desired_addons_config = 6; + + // The node pool to be upgraded. This field is mandatory if + // "desired_node_version", "desired_image_family", + // "desired_node_pool_autoscaling", or "desired_workload_metadata_config" + // is specified and there is more than one node pool on the cluster. + string desired_node_pool_id = 7; + + // The desired image type for the node pool. + // NOTE: Set the "desired_node_pool" field as well. + string desired_image_type = 8; + + // Autoscaler configuration for the node pool specified in + // desired_node_pool_id. If there is only one pool in the + // cluster and desired_node_pool_id is not provided then + // the change applies to that single node pool. + NodePoolAutoscaling desired_node_pool_autoscaling = 9; + + // The desired list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster's nodes should be located. + // + // This list must always include the cluster's primary zone. + // + // Warning: changing cluster locations will update the locations of all node + // pools and will result in nodes being added and/or removed. + repeated string desired_locations = 10; + + // The desired configuration options for master authorized networks feature. + MasterAuthorizedNetworksConfig desired_master_authorized_networks_config = 12; + + // The desired configuration options for the PodSecurityPolicy feature. + PodSecurityPolicyConfig desired_pod_security_policy_config = 14; + + // Cluster-level autoscaling configuration. + ClusterAutoscaling desired_cluster_autoscaling = 15; + + // The desired configuration options for the Binary Authorization feature. + BinaryAuthorization desired_binary_authorization = 16; + + // The logging service the cluster should use to write logs. + // Currently available options: + // + // * `logging.googleapis.com/kubernetes` - The Cloud Logging + // service with a Kubernetes-native resource model + // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer + // available as of GKE 1.15). + // * `none` - no logs will be exported from the cluster. + // + // If left as an empty string,`logging.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. + string desired_logging_service = 19; + + // The desired configuration for exporting resource usage. + ResourceUsageExportConfig desired_resource_usage_export_config = 21; + + // Cluster-level Vertical Pod Autoscaling configuration. + VerticalPodAutoscaling desired_vertical_pod_autoscaling = 22; + + // The desired private cluster configuration. + PrivateClusterConfig desired_private_cluster_config = 25; + + // The desired config of Intra-node visibility. + IntraNodeVisibilityConfig desired_intra_node_visibility_config = 26; + + // The desired status of whether to disable default sNAT for this cluster. + DefaultSnatStatus desired_default_snat_status = 28; + + // The desired telemetry integration for the cluster. + ClusterTelemetry desired_cluster_telemetry = 30; + + // The desired release channel configuration. + ReleaseChannel desired_release_channel = 31; + + // The desired Cloud TPU configuration. + TpuConfig desired_tpu_config = 38; + + // The desired L4 Internal Load Balancer Subsetting configuration. + ILBSubsettingConfig desired_l4ilb_subsetting_config = 39; + + // The desired datapath provider for the cluster. + DatapathProvider desired_datapath_provider = 50; + + // The desired state of IPv6 connectivity to Google Services. + PrivateIPv6GoogleAccess desired_private_ipv6_google_access = 51; + + // The desired notification configuration. + NotificationConfig desired_notification_config = 55; + + // The Kubernetes version to change the master to. The only valid value is the + // latest supported version. + // + // Users may specify either explicit versions offered by + // Kubernetes Engine or version aliases, which have the following behavior: + // + // - "latest": picks the highest valid Kubernetes version + // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + // - "1.X.Y-gke.N": picks an explicit Kubernetes version + // - "-": picks the default Kubernetes version + string desired_master_version = 100; + + // The desired GCFS config for the cluster. + GcfsConfig desired_gcfs_config = 109; + + // Configuration of etcd encryption. + DatabaseEncryption desired_database_encryption = 46; + + // Configuration for Workload Identity. + WorkloadIdentityConfig desired_workload_identity_config = 47; + + // Configuration for issuance of mTLS keys and certificates to Kubernetes + // pods. + WorkloadCertificates desired_workload_certificates = 61; + + // Configuration for issuance of mTLS keys and certificates to Kubernetes + // pods. + MeshCertificates desired_mesh_certificates = 67; + + // Configuration for direct-path (via ALTS) with workload identity. + WorkloadALTSConfig desired_workload_alts_config = 62; + + // Configuration for Shielded Nodes. + ShieldedNodes desired_shielded_nodes = 48; + + // The desired configuration for the fine-grained cost management feature. + CostManagementConfig desired_cost_management_config = 49; + + // Configuration for master components. + Master desired_master = 52; + + // DNSConfig contains clusterDNS config for this cluster. + DNSConfig desired_dns_config = 53; + + // ServiceExternalIPsConfig specifies the config for the use of Services with + // ExternalIPs field. + ServiceExternalIPsConfig desired_service_external_ips_config = 60; + + // AuthenticatorGroupsConfig specifies the config for the cluster security + // groups settings. + AuthenticatorGroupsConfig desired_authenticator_groups_config = 63; + + // The desired logging configuration. + LoggingConfig desired_logging_config = 64; + + // The desired monitoring configuration. + MonitoringConfig desired_monitoring_config = 65; + + // The desired Identity Service component configuration. + IdentityServiceConfig desired_identity_service_config = 66; + + // Enable/Disable private endpoint for the cluster's master. + optional bool desired_enable_private_endpoint = 71; + + // The desired network tags that apply to all auto-provisioned node pools + // in autopilot clusters and node auto-provisioning enabled clusters. + NetworkTags desired_node_pool_auto_config_network_tags = 110; + + // Enable/Disable Protect API features for the cluster. + optional ProtectConfig desired_protect_config = 112; + + // The desired config of Gateway API on this cluster. + GatewayAPIConfig desired_gateway_api_config = 114; + + // The current etag of the cluster. + // If an etag is provided and does not match the current etag of the cluster, + // update will be blocked and an ABORTED error will be returned. + string etag = 115; + + // The desired node pool logging configuration defaults for the cluster. + NodePoolLoggingConfig desired_node_pool_logging_config = 116; + + // The desired fleet configuration for the cluster. + Fleet desired_fleet = 117; + + // The desired stack type of the cluster. + // If a stack type is provided and does not match the current stack type of + // the cluster, update will attempt to change the stack type to the new type. + StackType desired_stack_type = 119; + + // The additional pod ranges to be added to the cluster. These pod ranges + // can be used by node pools to allocate pod IPs. + AdditionalPodRangesConfig additional_pod_ranges_config = 120; + + // The additional pod ranges that are to be removed from the cluster. + // The pod ranges specified here must have been specified earlier in the + // 'additional_pod_ranges_config' argument. + AdditionalPodRangesConfig removed_additional_pod_ranges_config = 121; + + // Kubernetes open source beta apis enabled on the cluster. Only beta apis + K8sBetaAPIConfig enable_k8s_beta_apis = 122; + + // Enable/Disable Security Posture API features for the cluster. + SecurityPostureConfig desired_security_posture_config = 124; + + // The desired network performance config. + NetworkConfig.ClusterNetworkPerformanceConfig + desired_network_performance_config = 125; + + // Enable/Disable FQDN Network Policy for the cluster. + optional bool desired_enable_fqdn_network_policy = 126; + + // The desired workload policy configuration for the autopilot cluster. + WorkloadPolicyConfig desired_autopilot_workload_policy_config = 128; + + // Beta APIs enabled for cluster. + K8sBetaAPIConfig desired_k8s_beta_apis = 131; + + // HostMaintenancePolicy contains the desired maintenance policy for the + // Google Compute Engine hosts. + HostMaintenancePolicy desired_host_maintenance_policy = 132; +} + +// AdditionalPodRangesConfig is the configuration for additional pod secondary +// ranges supporting the ClusterUpdate message. +message AdditionalPodRangesConfig { + // Name for pod secondary ipv4 range which has the actual range defined ahead. + repeated string pod_range_names = 1; + + // Output only. [Output only] Information for additional pod range. + repeated RangeInfo pod_range_info = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// RangeInfo contains the range name and the range utilization by this cluster. +message RangeInfo { + // Output only. [Output only] Name of a range. + string range_name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. [Output only] The utilization of the range. + double utilization = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// This operation resource represents operations that may have happened or are +// happening on the cluster. All fields are output only. +message Operation { + // Current status of the operation. + enum Status { + // Not set. + STATUS_UNSPECIFIED = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is currently running. + RUNNING = 2; + + // The operation is done, either cancelled or completed. + DONE = 3; + + // The operation is aborting. + ABORTING = 4; + } + + // Operation type categorizes the operation. + enum Type { + // Not set. + TYPE_UNSPECIFIED = 0; + + // The cluster is being created. The cluster should be assumed to be + // unusable until the operation finishes. + // + // In the event of the operation failing, the cluster will enter the [ERROR + // state][Cluster.Status.ERROR] and eventually be deleted. + CREATE_CLUSTER = 1; + + // The cluster is being deleted. The cluster should be assumed to be + // unusable as soon as this operation starts. + // + // In the event of the operation failing, the cluster will enter the [ERROR + // state][Cluster.Status.ERROR] and the deletion will be automatically + // retried until completed. + DELETE_CLUSTER = 2; + + // The [cluster + // version][google.container.v1beta1.ClusterUpdate.desired_master_version] + // is being updated. Note that this includes "upgrades" to the same version, + // which are simply a recreation. This also includes + // [auto-upgrades](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-upgrades#upgrading_automatically). + // For more details, see [documentation on cluster + // upgrades](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-upgrades#cluster_upgrades). + UPGRADE_MASTER = 3; + + // A node pool is being updated. Despite calling this an "upgrade", this + // includes most forms of updates to node pools. This also includes + // [auto-upgrades](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-upgrades). + // + // This operation sets the + // [progress][google.container.v1beta1.Operation.progress] field and may be + // [canceled][google.container.v1beta1.ClusterManager.CancelOperation]. + // + // The upgrade strategy depends on [node pool + // configuration](https://cloud.google.com/kubernetes-engine/docs/concepts/node-pool-upgrade-strategies). + // The nodes are generally still usable during this operation. + UPGRADE_NODES = 4; + + // A problem has been detected with the control plane and is being repaired. + // This operation type is initiated by GKE. For more details, see + // [documentation on + // repairs](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions#repairs). + REPAIR_CLUSTER = 5; + + // The cluster is being updated. This is a broad category of operations and + // includes operations that only change metadata as well as those that must + // recreate the entire cluster. If the control plane must be recreated, this + // will cause temporary downtime for zonal clusters. + // + // Some features require recreating the nodes as well. Those will be + // recreated as separate operations and the update may not be completely + // functional until the node pools recreations finish. Node recreations will + // generally follow [maintenance + // policies](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions). + // + // Some GKE-initiated operations use this type. This includes certain types + // of auto-upgrades and incident mitigations. + UPDATE_CLUSTER = 6; + + // A node pool is being created. The node pool should be assumed to be + // unusable until this operation finishes. In the event of an error, the + // node pool may be partially created. + // + // If enabled, [node + // autoprovisioning](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-provisioning) + // may have automatically initiated such operations. + CREATE_NODE_POOL = 7; + + // The node pool is being deleted. The node pool should be assumed to be + // unusable as soon as this operation starts. + DELETE_NODE_POOL = 8; + + // The node pool's + // [manamagent][google.container.v1beta1.NodePool.management] field is being + // updated. These operations only update metadata and may be concurrent with + // most other operations. + SET_NODE_POOL_MANAGEMENT = 9; + + // A problem has been detected with nodes and [they are being + // repaired](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-repair). + // This operation type is initiated by GKE, typically automatically. This + // operation may be concurrent with other operations and there may be + // multiple repairs occurring on the same node pool. + AUTO_REPAIR_NODES = 10; + + // Unused. Automatic node upgrade uses + // [UPGRADE_NODES][google.container.v1beta1.Operation.Type.UPGRADE_NODES]. + AUTO_UPGRADE_NODES = 11 [deprecated = true]; + + // Unused. Updating labels uses + // [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. + SET_LABELS = 12 [deprecated = true]; + + // Unused. Updating master auth uses + // [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. + SET_MASTER_AUTH = 13 [deprecated = true]; + + // The node pool is being resized. With the exception of resizing to or from + // size zero, the node pool is generally usable during this operation. + SET_NODE_POOL_SIZE = 14; + + // Unused. Updating network policy uses + // [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. + SET_NETWORK_POLICY = 15 [deprecated = true]; + + // Unused. Updating maintenance policy uses + // [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. + SET_MAINTENANCE_POLICY = 16 [deprecated = true]; + + // The control plane is being resized. This operation type is initiated by + // GKE. These operations are often performed preemptively to ensure that the + // control plane has sufficient resources and is not typically an indication + // of issues. For more details, see + // [documentation on + // resizes](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions#repairs). + RESIZE_CLUSTER = 18; + } + + // The server-assigned ID for the operation. + string name = 1; + + // The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // operation is taking place. This field is deprecated, use location instead. + string zone = 2 [deprecated = true]; + + // The operation type. + Type operation_type = 3; + + // The current status of the operation. + Status status = 4; + + // Detailed operation progress, if available. + string detail = 8; + + // Output only. If an error has occurred, a textual description of the error. + // Deprecated. Use field error instead. + string status_message = 5 + [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; + + // Server-defined URI for the operation. Example: + // `https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123`. + string self_link = 6; + + // Server-defined URI for the target of the operation. The format of this is a + // URI to the resource being modified (such as a cluster, node pool, or node). + // For node pool repairs, there may be multiple nodes being repaired, but only + // one will be the target. + // + // Examples: + // + // - + // ## + // `https://container.googleapis.com/v1/projects/123/locations/us-central1/clusters/my-cluster` + // + // ## + // `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np` + // + // `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np/node/my-node` + string target_link = 7; + + // [Output only] The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) + // or + // [region](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) + // in which the cluster resides. + string location = 9; + + // [Output only] The time the operation started, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string start_time = 10; + + // [Output only] The time the operation completed, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string end_time = 11; + + // Output only. [Output only] Progress information for an operation. + OperationProgress progress = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Which conditions caused the current cluster state. + // Deprecated. Use field error instead. + repeated StatusCondition cluster_conditions = 13 [deprecated = true]; + + // Which conditions caused the current node pool state. + // Deprecated. Use field error instead. + repeated StatusCondition nodepool_conditions = 14 [deprecated = true]; + + // The error result of the operation in case of failure. + google.rpc.Status error = 15; +} + +// Information about operation (or operation stage) progress. +message OperationProgress { + // Progress metric is (string, int|float|string) pair. + message Metric { + // Required. Metric name, e.g., "nodes total", "percent done". + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Strictly one of the values is required. + oneof value { + // For metrics with integer value. + int64 int_value = 2; + + // For metrics with floating point value. + double double_value = 3; + + // For metrics with custom values (ratios, visual progress, etc.). + string string_value = 4; + } + } + + // A non-parameterized string describing an operation stage. + // Unset for single-stage operations. + string name = 1; + + // Status of an operation stage. + // Unset for single-stage operations. + Operation.Status status = 2; + + // Progress metric bundle, for example: + // metrics: [{name: "nodes done", int_value: 15}, + // {name: "nodes total", int_value: 32}] + // or + // metrics: [{name: "progress", double_value: 0.56}, + // {name: "progress scale", double_value: 1.0}] + repeated Metric metrics = 3; + + // Substages of an operation or a stage. + repeated OperationProgress stages = 4; +} + +// CreateClusterRequest creates a cluster. +message CreateClusterRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the parent field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the parent + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. A [cluster + // resource](https://cloud.google.com/container-engine/reference/rest/v1beta1/projects.locations.clusters) + Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED]; + + // The parent (project and location) where the cluster will be created. + // Specified in the format `projects/*/locations/*`. + string parent = 5; +} + +// GetClusterRequest gets the settings of a cluster. +message GetClusterRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to retrieve. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to retrieve. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 5; +} + +// UpdateClusterRequest updates the settings of a cluster. +message UpdateClusterRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. A description of the update. + ClusterUpdate update = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to update. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 5; +} + +// SetNodePoolVersionRequest updates the version of a node pool. +message UpdateNodePoolRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the node pool to upgrade. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. The Kubernetes version to change the nodes to (typically an + // upgrade). + // + // Users may specify either explicit versions offered by Kubernetes Engine or + // version aliases, which have the following behavior: + // + // - "latest": picks the highest valid Kubernetes version + // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + // - "1.X.Y-gke.N": picks an explicit Kubernetes version + // - "-": picks the Kubernetes master version + string node_version = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. The desired image type for the node pool. Please see + // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for + // available image types. + string image_type = 6 [(google.api.field_behavior) = REQUIRED]; + + // The desired list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // node pool's nodes should be located. Changing the locations for a node pool + // will result in nodes being either created or removed from the node pool, + // depending on whether locations are being added or removed. + repeated string locations = 13; + + // The desired workload metadata config for the node pool. + WorkloadMetadataConfig workload_metadata_config = 14; + + // The name (project, location, cluster, node pool) of the node pool to + // update. Specified in the format + // `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 8; + + // Upgrade settings control disruption and speed of the upgrade. + NodePool.UpgradeSettings upgrade_settings = 15; + + // The desired network tags to be applied to all nodes in the node pool. + // If this field is not present, the tags will not be changed. Otherwise, + // the existing network tags will be *replaced* with the provided tags. + NetworkTags tags = 16; + + // The desired node taints to be applied to all nodes in the node pool. + // If this field is not present, the taints will not be changed. Otherwise, + // the existing node taints will be *replaced* with the provided taints. + NodeTaints taints = 17; + + // The desired node labels to be applied to all nodes in the node pool. + // If this field is not present, the labels will not be changed. Otherwise, + // the existing node labels will be *replaced* with the provided labels. + NodeLabels labels = 18; + + // Parameters that can be configured on Linux nodes. + LinuxNodeConfig linux_node_config = 19; + + // Node kubelet configs. + NodeKubeletConfig kubelet_config = 20; + + // Node network config. + NodeNetworkConfig node_network_config = 21; + + // GCFS config. + GcfsConfig gcfs_config = 22; + + // Confidential nodes config. + // All the nodes in the node pool will be Confidential VM once enabled. + ConfidentialNodes confidential_nodes = 23; + + // Enable or disable gvnic on the node pool. + VirtualNIC gvnic = 29; + + // The current etag of the node pool. + // If an etag is provided and does not match the current etag of the node + // pool, update will be blocked and an ABORTED error will be returned. + string etag = 30; + + // Enable or disable NCCL fast socket for the node pool. + FastSocket fast_socket = 31; + + // Logging configuration. + NodePoolLoggingConfig logging_config = 32; + + // The resource labels for the node pool to use to annotate any related + // Google Compute Engine resources. + ResourceLabels resource_labels = 33; + + // Parameters that can be configured on Windows nodes. + WindowsNodeConfig windows_node_config = 34; +} + +// SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool. +message SetNodePoolAutoscalingRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the node pool to upgrade. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Autoscaling configuration for the node pool. + NodePoolAutoscaling autoscaling = 5 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster, node pool) of the node pool to set + // autoscaler settings. Specified in the format + // `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 6; +} + +// SetLoggingServiceRequest sets the logging service of a cluster. +message SetLoggingServiceRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. The logging service the cluster should use to write logs. + // Currently available options: + // + // * `logging.googleapis.com/kubernetes` - The Cloud Logging + // service with a Kubernetes-native resource model + // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer + // available as of GKE 1.15). + // * `none` - no logs will be exported from the cluster. + // + // If left as an empty string,`logging.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. + string logging_service = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to set logging. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 5; +} + +// SetMonitoringServiceRequest sets the monitoring service of a cluster. +message SetMonitoringServiceRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring + // service with a Kubernetes-native resource model + // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no + // longer available as of GKE 1.15). + // * `none` - No metrics will be exported from the cluster. + // + // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be + // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. + string monitoring_service = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to set monitoring. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; +} + +// SetAddonsRequest sets the addons associated with the cluster. +message SetAddonsConfigRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. The desired configurations for the various addons available to + // run in the cluster. + AddonsConfig addons_config = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to set addons. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; +} + +// SetLocationsRequest sets the locations of the cluster. +message SetLocationsRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. The desired list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster's nodes should be located. Changing the locations a cluster is in + // will result in nodes being either created or removed from the cluster, + // depending on whether locations are being added or removed. + // + // This list must always include the cluster's primary zone. + repeated string locations = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to set locations. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; +} + +// UpdateMasterRequest updates the master of the cluster. +message UpdateMasterRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. The Kubernetes version to change the master to. + // + // Users may specify either explicit versions offered by + // Kubernetes Engine or version aliases, which have the following behavior: + // + // - "latest": picks the highest valid Kubernetes version + // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + // - "1.X.Y-gke.N": picks an explicit Kubernetes version + // - "-": picks the default Kubernetes version + string master_version = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to update. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 7; +} + +// SetMasterAuthRequest updates the admin password of a cluster. +message SetMasterAuthRequest { + // Operation type: what type update to perform. + enum Action { + // Operation is unknown and will error out. + UNKNOWN = 0; + + // Set the password to a user generated value. + SET_PASSWORD = 1; + + // Generate a new password and set it to that. + GENERATE_PASSWORD = 2; + + // Set the username. If an empty username is provided, basic authentication + // is disabled for the cluster. If a non-empty username is provided, basic + // authentication is enabled, with either a provided password or a generated + // one. + SET_USERNAME = 3; + } + + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to upgrade. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. The exact form of action to be taken on the master auth. + Action action = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. A description of the update. + MasterAuth update = 5 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to set auth. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 7; +} + +// DeleteClusterRequest deletes a cluster. +message DeleteClusterRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to delete. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster) of the cluster to delete. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 4; +} + +// ListClustersRequest lists clusters. +message ListClustersRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the parent field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides, or "-" for all zones. This field has been deprecated and + // replaced by the parent field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The parent (project and location) where the clusters will be listed. + // Specified in the format `projects/*/locations/*`. + // Location "-" matches all zones and all regions. + string parent = 4; +} + +// ListClustersResponse is the result of ListClustersRequest. +message ListClustersResponse { + // A list of clusters in the project in the specified zone, or + // across all ones. + repeated Cluster clusters = 1; + + // If any zones are listed here, the list of clusters returned + // may be missing those zones. + repeated string missing_zones = 2; +} + +// GetOperationRequest gets a single operation. +message GetOperationRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The server-assigned `name` of the operation. + // This field has been deprecated and replaced by the name field. + string operation_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The name (project, location, operation id) of the operation to get. + // Specified in the format `projects/*/locations/*/operations/*`. + string name = 5; +} + +// ListOperationsRequest lists operations. +message ListOperationsRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the parent field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) to return + // operations for, or `-` for all zones. This field has been deprecated and + // replaced by the parent field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The parent (project and location) where the operations will be listed. + // Specified in the format `projects/*/locations/*`. + // Location "-" matches all zones and all regions. + string parent = 4; +} + +// CancelOperationRequest cancels a single operation. +message CancelOperationRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // operation resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The server-assigned `name` of the operation. + // This field has been deprecated and replaced by the name field. + string operation_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The name (project, location, operation id) of the operation to cancel. + // Specified in the format `projects/*/locations/*/operations/*`. + string name = 4; +} + +// ListOperationsResponse is the result of ListOperationsRequest. +message ListOperationsResponse { + // A list of operations in the project in the specified zone. + repeated Operation operations = 1; + + // If any zones are listed here, the list of operations returned + // may be missing the operations from those zones. + repeated string missing_zones = 2; +} + +// Gets the current Kubernetes Engine service configuration. +message GetServerConfigRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) to return + // operations for. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The name (project and location) of the server config to get, + // specified in the format `projects/*/locations/*`. + string name = 4; +} + +// Kubernetes Engine service configuration. +message ServerConfig { + // ReleaseChannelConfig exposes configuration for a release channel. + message ReleaseChannelConfig { + // Deprecated. + message AvailableVersion { + option deprecated = true; + + // Kubernetes version. + string version = 1; + + // Reason for availability. + string reason = 2; + } + + // The release channel this configuration applies to. + ReleaseChannel.Channel channel = 1; + + // The default version for newly created clusters on the channel. + string default_version = 2; + + // Deprecated. + // This field has been deprecated and replaced with the valid_versions + // field. + repeated AvailableVersion available_versions = 3 [deprecated = true]; + + // List of valid versions for the channel. + repeated string valid_versions = 4; + } + + // Version of Kubernetes the service deploys by default. + string default_cluster_version = 1; + + // List of valid node upgrade target versions, in descending order. + repeated string valid_node_versions = 3; + + // Default image type. + string default_image_type = 4; + + // List of valid image types. + repeated string valid_image_types = 5; + + // List of valid master versions, in descending order. + repeated string valid_master_versions = 6; + + // List of release channel configurations. + repeated ReleaseChannelConfig channels = 9; + + // Maps of Kubernetes version and supported Windows server versions. + map windows_version_maps = 10; +} + +// Best effort provisioning. +message BestEffortProvisioning { + // When this is enabled, cluster/node pool creations will ignore non-fatal + // errors like stockout to best provision as many nodes as possible right now + // and eventually bring up all target number of nodes + bool enabled = 1; + + // Minimum number of nodes to be provisioned to be considered as succeeded, + // and the rest of nodes will be provisioned gradually and eventually when + // stockout issue has been resolved. + int32 min_provision_nodes = 2; +} + +// Windows server versions. +message WindowsVersions { + // Windows server version. + message WindowsVersion { + // Windows server image type + string image_type = 1; + + // Windows server build number + string os_version = 2; + + // Mainstream support end date + google.type.Date support_end_date = 3; + } + + // List of Windows server versions. + repeated WindowsVersion windows_versions = 1; +} + +// CreateNodePoolRequest creates a node pool for a cluster. +message CreateNodePoolRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the parent field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the parent + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the parent field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. The node pool to create. + NodePool node_pool = 4 [(google.api.field_behavior) = REQUIRED]; + + // The parent (project, location, cluster name) where the node pool will be + // created. Specified in the format + // `projects/*/locations/*/clusters/*`. + string parent = 6; +} + +// DeleteNodePoolRequest deletes a node pool for a cluster. +message DeleteNodePoolRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the node pool to delete. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster, node pool id) of the node pool to + // delete. Specified in the format + // `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 6; +} + +// ListNodePoolsRequest lists the node pool(s) for a cluster. +message ListNodePoolsRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the parent field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the parent + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the parent field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The parent (project, location, cluster name) where the node pools will be + // listed. Specified in the format `projects/*/locations/*/clusters/*`. + string parent = 5; +} + +// GetNodePoolRequest retrieves a node pool for a cluster. +message GetNodePoolRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the node pool. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster, node pool id) of the node pool to + // get. Specified in the format + // `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 6; +} + +// Settings for blue-green upgrade. +message BlueGreenSettings { + // Standard rollout policy is the default policy for blue-green. + message StandardRolloutPolicy { + // Blue pool size to drain in a batch. + oneof update_batch_size { + // Percentage of the blue pool nodes to drain in a batch. + // The range of this field should be (0.0, 1.0]. + float batch_percentage = 1; + + // Number of blue nodes to drain in a batch. + int32 batch_node_count = 2; + } + + // Soak time after each batch gets drained. Default to zero. + optional google.protobuf.Duration batch_soak_duration = 3; + } + + // The rollout policy controls the general rollout progress of blue-green. + oneof rollout_policy { + // Standard policy for the blue-green upgrade. + StandardRolloutPolicy standard_rollout_policy = 1; + } + + // Time needed after draining entire blue pool. After this period, blue pool + // will be cleaned up. + optional google.protobuf.Duration node_pool_soak_duration = 2; +} + +// NodePool contains the name and configuration for a cluster's node pool. +// Node pools are a set of nodes (i.e. VM's), with a common configuration and +// specification, under the control of the cluster master. They may have a set +// of Kubernetes labels applied to them, which may be used to reference them +// during pod scheduling. They may also be resized up or down, to accommodate +// the workload. +// These upgrade settings control the level of parallelism and the level of +// disruption caused by an upgrade. +// +// maxUnavailable controls the number of nodes that can be simultaneously +// unavailable. +// +// maxSurge controls the number of additional nodes that can be added to the +// node pool temporarily for the time of the upgrade to increase the number of +// available nodes. +// +// (maxUnavailable + maxSurge) determines the level of parallelism (how many +// nodes are being upgraded at the same time). +// +// Note: upgrades inevitably introduce some disruption since workloads need to +// be moved from old nodes to new, upgraded ones. Even if maxUnavailable=0, +// this holds true. (Disruption stays within the limits of +// PodDisruptionBudget, if it is configured.) +// +// Consider a hypothetical node pool with 5 nodes having maxSurge=2, +// maxUnavailable=1. This means the upgrade process upgrades 3 nodes +// simultaneously. It creates 2 additional (upgraded) nodes, then it brings +// down 3 old (not yet upgraded) nodes at the same time. This ensures that +// there are always at least 4 nodes available. +message NodePool { + // These upgrade settings configure the upgrade strategy for the node pool. + // Use strategy to switch between the strategies applied to the node pool. + // + // If the strategy is SURGE, use max_surge and max_unavailable to control + // the level of parallelism and the level of disruption caused by upgrade. + // 1. maxSurge controls the number of additional nodes that can be added to + // the node pool temporarily for the time of the upgrade to increase the + // number of available nodes. + // 2. maxUnavailable controls the number of nodes that can be simultaneously + // unavailable. + // 3. (maxUnavailable + maxSurge) determines the level of parallelism (how + // many nodes are being upgraded at the same time). + // + // If the strategy is BLUE_GREEN, use blue_green_settings to configure the + // blue-green upgrade related settings. + // 1. standard_rollout_policy is the default policy. The policy is used to + // control the way blue pool gets drained. The draining is executed in the + // batch mode. The batch size could be specified as either percentage of the + // node pool size or the number of nodes. batch_soak_duration is the soak + // time after each batch gets drained. + // 2. node_pool_soak_duration is the soak time after all blue nodes are + // drained. After this period, the blue pool nodes will be deleted. + message UpgradeSettings { + // The maximum number of nodes that can be created beyond the current size + // of the node pool during the upgrade process. + int32 max_surge = 1; + + // The maximum number of nodes that can be simultaneously unavailable during + // the upgrade process. A node is considered available if its status is + // Ready. + int32 max_unavailable = 2; + + // Update strategy of the node pool. + optional NodePoolUpdateStrategy strategy = 3; + + // Settings for blue-green upgrade strategy. + optional BlueGreenSettings blue_green_settings = 4; + } + + // UpdateInfo contains resource (instance groups, etc), status and other + // intermediate information relevant to a node pool upgrade. + message UpdateInfo { + // Information relevant to blue-green upgrade. + message BlueGreenInfo { + // Phase represents the different stages blue-green upgrade is running in. + enum Phase { + // Unspecified phase. + PHASE_UNSPECIFIED = 0; + + // blue-green upgrade has been initiated. + UPDATE_STARTED = 1; + + // Start creating green pool nodes. + CREATING_GREEN_POOL = 2; + + // Start cordoning blue pool nodes. + CORDONING_BLUE_POOL = 3; + + // Start draining blue pool nodes. + DRAINING_BLUE_POOL = 4; + + // Start soaking time after draining entire blue pool. + NODE_POOL_SOAKING = 5; + + // Start deleting blue nodes. + DELETING_BLUE_POOL = 6; + + // Rollback has been initiated. + ROLLBACK_STARTED = 7; + } + + // Current blue-green upgrade phase. + Phase phase = 1; + + // The resource URLs of the [managed instance groups] + // (/compute/docs/instance-groups/creating-groups-of-managed-instances) + // associated with blue pool. + repeated string blue_instance_group_urls = 2; + + // The resource URLs of the [managed instance groups] + // (/compute/docs/instance-groups/creating-groups-of-managed-instances) + // associated with green pool. + repeated string green_instance_group_urls = 3; + + // Time to start deleting blue pool to complete blue-green upgrade, + // in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string blue_pool_deletion_start_time = 4; + + // Version of green pool. + string green_pool_version = 5; + } + + // Information of a blue-green upgrade. + BlueGreenInfo blue_green_info = 1; + } + + // The current status of the node pool instance. + enum Status { + // Not set. + STATUS_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 RUNNING_WITH_ERROR state indicates the node pool has been created + // and is partially usable. Some error state has occurred and some + // functionality may be impaired. Customer may need to reissue a request + // or trigger a new update. + RUNNING_WITH_ERROR = 3; + + // The RECONCILING state indicates that some work is actively being done on + // the node pool, such as upgrading node software. Details can + // be found in the `statusMessage` field. + RECONCILING = 4; + + // The STOPPING state indicates the node pool is being deleted. + STOPPING = 5; + + // The ERROR state indicates the node pool may be unusable. Details + // can be found in the `statusMessage` field. + ERROR = 6; + } + + // PlacementPolicy defines the placement policy used by the node pool. + message PlacementPolicy { + // Type defines the type of placement policy. + enum Type { + // TYPE_UNSPECIFIED specifies no requirements on nodes + // placement. + TYPE_UNSPECIFIED = 0; + + // COMPACT specifies node placement in the same availability domain to + // ensure low communication latency. + COMPACT = 1; + } + + // The type of placement. + Type type = 1; + + // TPU placement topology for pod slice node pool. + // https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies + string tpu_topology = 2; + + // If set, refers to the name of a custom resource policy supplied by the + // user. The resource policy must be in the same project and region as the + // node pool. If not found, InvalidArgument error is returned. + string policy_name = 3; + } + + // The name of the node pool. + string name = 1; + + // The node configuration of the pool. + NodeConfig config = 2; + + // The initial node count for the pool. You must ensure that your + // Compute Engine [resource quota](https://cloud.google.com/compute/quotas) + // is sufficient for this number of instances. You must also have available + // firewall and routes quota. + int32 initial_node_count = 3; + + // The list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // NodePool's nodes should be located. + // + // If this value is unspecified during node pool creation, the + // [Cluster.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters#Cluster.FIELDS.locations) + // value will be used, instead. + // + // Warning: changing node pool locations will result in nodes being added + // and/or removed. + repeated string locations = 13; + + // Networking configuration for this NodePool. If specified, it overrides the + // cluster-level defaults. + NodeNetworkConfig network_config = 14; + + // [Output only] Server-defined URL for the resource. + string self_link = 100; + + // The version of Kubernetes running on this NodePool's nodes. If unspecified, + // it defaults as described + // [here](https://cloud.google.com/kubernetes-engine/versioning#specifying_node_version). + string version = 101; + + // [Output only] The resource URLs of the [managed instance + // groups](https://cloud.google.com/compute/docs/instance-groups/creating-groups-of-managed-instances) + // associated with this node pool. + // During the node pool blue-green upgrade operation, the URLs contain both + // blue and green resources. + repeated string instance_group_urls = 102; + + // [Output only] The status of the nodes in this pool instance. + Status status = 103; + + // [Output only] Deprecated. Use conditions instead. + // Additional information about the current status of this + // node pool instance, if available. + string status_message = 104 [deprecated = true]; + + // Autoscaler configuration for this NodePool. Autoscaler is enabled + // only if a valid configuration is present. + NodePoolAutoscaling autoscaling = 4; + + // NodeManagement configuration for this NodePool. + NodeManagement management = 5; + + // The constraint on the maximum number of pods that can be run + // simultaneously on a node in the node pool. + MaxPodsConstraint max_pods_constraint = 6; + + // Which conditions caused the current node pool state. + repeated StatusCondition conditions = 105; + + // [Output only] The pod CIDR block size per node in this node pool. + int32 pod_ipv4_cidr_size = 7; + + // Upgrade settings control disruption and speed of the upgrade. + UpgradeSettings upgrade_settings = 107; + + // Specifies the node placement policy. + PlacementPolicy placement_policy = 108; + + // Output only. [Output only] Update info contains relevant information during + // a node pool update. + UpdateInfo update_info = 109 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // This checksum is computed by the server based on the value of node pool + // fields, and may be sent on update requests to ensure the client has an + // up-to-date value before proceeding. + string etag = 110; + + // Enable best effort provisioning for nodes + BestEffortProvisioning best_effort_provisioning = 113; +} + +// NodeManagement defines the set of node management services turned on for the +// node pool. +message NodeManagement { + // Whether the nodes will be automatically upgraded. + bool auto_upgrade = 1; + + // Whether the nodes will be automatically repaired. + bool auto_repair = 2; + + // Specifies the Auto Upgrade knobs for the node pool. + AutoUpgradeOptions upgrade_options = 10; +} + +// AutoUpgradeOptions defines the set of options for the user to control how +// the Auto Upgrades will proceed. +message AutoUpgradeOptions { + // [Output only] This field is set when upgrades are about to commence + // with the approximate start time for the upgrades, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string auto_upgrade_start_time = 1; + + // [Output only] This field is set when upgrades are about to commence + // with the description of the upgrade. + string description = 2; +} + +// MaintenancePolicy defines the maintenance policy to be used for the cluster. +message MaintenancePolicy { + // Specifies the maintenance window in which maintenance may be performed. + MaintenanceWindow window = 1; + + // A hash identifying the version of this policy, so that updates to fields of + // the policy won't accidentally undo intermediate changes (and so that users + // of the API unaware of some fields won't accidentally remove other fields). + // Make a `get()` request to the cluster to get the current + // resource version and include it with requests to set the policy. + string resource_version = 3; +} + +// MaintenanceWindow defines the maintenance window to be used for the cluster. +message MaintenanceWindow { + // Unimplemented, reserved for future use. + // HourlyMaintenanceWindow hourly_maintenance_window = 1; + oneof policy { + // DailyMaintenanceWindow specifies a daily maintenance operation window. + DailyMaintenanceWindow daily_maintenance_window = 2; + + // RecurringWindow specifies some number of recurring time periods for + // maintenance to occur. The time windows may be overlapping. If no + // maintenance windows are set, maintenance can occur at any time. + RecurringTimeWindow recurring_window = 3; + } + + // Exceptions to maintenance window. Non-emergency maintenance should not + // occur in these windows. + map maintenance_exclusions = 4; +} + +// Represents an arbitrary window of time. +message TimeWindow { + oneof options { + // MaintenanceExclusionOptions provides maintenance exclusion related + // options. + MaintenanceExclusionOptions maintenance_exclusion_options = 3; + } + + // The time that the window first starts. + google.protobuf.Timestamp start_time = 1; + + // The time that the window ends. The end time should take place after the + // start time. + google.protobuf.Timestamp end_time = 2; +} + +// Represents the Maintenance exclusion option. +message MaintenanceExclusionOptions { + // Scope of exclusion. + enum Scope { + // NO_UPGRADES excludes all upgrades, including patch upgrades and minor + // upgrades across control planes and nodes. This is the default exclusion + // behavior. + NO_UPGRADES = 0; + + // NO_MINOR_UPGRADES excludes all minor upgrades for the cluster, only + // patches are allowed. + NO_MINOR_UPGRADES = 1; + + // NO_MINOR_OR_NODE_UPGRADES excludes all minor upgrades for the cluster, + // and also exclude all node pool upgrades. Only control + // plane patches are allowed. + NO_MINOR_OR_NODE_UPGRADES = 2; + } + + // Scope specifies the upgrade scope which upgrades are blocked by the + // exclusion. + Scope scope = 1; +} + +// Represents an arbitrary window of time that recurs. +message RecurringTimeWindow { + // The window of the first recurrence. + TimeWindow window = 1; + + // An RRULE (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for how + // this window reccurs. They go on for the span of time between the start and + // end time. + // + // For example, to have something repeat every weekday, you'd use: + // `FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR` + // + // To repeat some window daily (equivalent to the DailyMaintenanceWindow): + // `FREQ=DAILY` + // + // For the first weekend of every month: + // `FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU` + // + // This specifies how frequently the window starts. Eg, if you wanted to have + // a 9-5 UTC-4 window every weekday, you'd use something like: + // ``` + // start time = 2019-01-01T09:00:00-0400 + // end time = 2019-01-01T17:00:00-0400 + // recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR + // ``` + // + // Windows can span multiple days. Eg, to make the window encompass every + // weekend from midnight Saturday till the last minute of Sunday UTC: + // ``` + // start time = 2019-01-05T00:00:00Z + // end time = 2019-01-07T23:59:00Z + // recurrence = FREQ=WEEKLY;BYDAY=SA + // ``` + // + // Note the start and end time's specific dates are largely arbitrary except + // to specify duration of the window and when it first starts. + // The FREQ values of HOURLY, MINUTELY, and SECONDLY are not supported. + string recurrence = 2; +} + +// Time window specified for daily maintenance operations. +message DailyMaintenanceWindow { + // Time within the maintenance window to start the maintenance operations. + // It must be in format "HH:MM", where HH : [00-23] and MM : [00-59] GMT. + string start_time = 2; + + // [Output only] Duration of the time window, automatically chosen to be + // smallest possible in the given scenario. + string duration = 3; +} + +// SetNodePoolManagementRequest sets the node management properties of a node +// pool. +message SetNodePoolManagementRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to update. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the node pool to update. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. NodeManagement configuration for the node pool. + NodeManagement management = 5 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster, node pool id) of the node pool to set + // management properties. Specified in the format + // `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 7; +} + +// SetNodePoolSizeRequest sets the size of a node pool. +message SetNodePoolSizeRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to update. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the node pool to update. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. The desired node count for the pool. + int32 node_count = 5 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster, node pool id) of the node pool to set + // size. + // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 7; +} + +// CompleteNodePoolUpgradeRequest sets the name of target node pool to complete +// upgrade. +message CompleteNodePoolUpgradeRequest { + // The name (project, location, cluster, node pool id) of the node pool to + // complete upgrade. + // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 1; +} + +// RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed +// NodePool upgrade. This will be an no-op if the last upgrade successfully +// completed. +message RollbackNodePoolUpgradeRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to rollback. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the node pool to rollback. + // This field has been deprecated and replaced by the name field. + string node_pool_id = 4 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster, node pool id) of the node poll to + // rollback upgrade. + // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. + string name = 6; + + // Option for rollback to ignore the PodDisruptionBudget. + // Default value is false. + bool respect_pdb = 7; +} + +// ListNodePoolsResponse is the result of ListNodePoolsRequest. +message ListNodePoolsResponse { + // A list of node pools for a cluster. + repeated NodePool node_pools = 1; +} + +// ClusterAutoscaling contains global, per-cluster information +// required by Cluster Autoscaler to automatically adjust +// the size of the cluster and create/delete +// node pools based on the current needs. +message ClusterAutoscaling { + // Defines possible options for autoscaling_profile field. + enum AutoscalingProfile { + // No change to autoscaling configuration. + PROFILE_UNSPECIFIED = 0; + + // Prioritize optimizing utilization of resources. + OPTIMIZE_UTILIZATION = 1; + + // Use default (balanced) autoscaling configuration. + BALANCED = 2; + } + + // Enables automatic node pool creation and deletion. + bool enable_node_autoprovisioning = 1; + + // Contains global constraints regarding minimum and maximum + // amount of resources in the cluster. + repeated ResourceLimit resource_limits = 2; + + // Defines autoscaling behaviour. + AutoscalingProfile autoscaling_profile = 3; + + // AutoprovisioningNodePoolDefaults contains defaults for a node pool + // created by NAP. + AutoprovisioningNodePoolDefaults autoprovisioning_node_pool_defaults = 4; + + // The list of Google Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) in which the + // NodePool's nodes can be created by NAP. + repeated string autoprovisioning_locations = 5; +} + +// AutoprovisioningNodePoolDefaults contains defaults for a node pool created +// by NAP. +message AutoprovisioningNodePoolDefaults { + // The set of Google API scopes to be made available on all of the + // node VMs under the "default" service account. + // + // The following scopes are recommended, but not required, and by default are + // not included: + // + // * `https://www.googleapis.com/auth/compute` is required for mounting + // persistent storage on your nodes. + // * `https://www.googleapis.com/auth/devstorage.read_only` is required for + // communicating with **gcr.io** + // (the [Google Container + // Registry](https://cloud.google.com/container-registry/)). + // + // If unspecified, no scopes are added, unless Cloud Logging or Cloud + // Monitoring are enabled, in which case their required scopes will be added. + repeated string oauth_scopes = 1; + + // The Google Cloud Platform Service Account to be used by the node VMs. + // Specify the email address of the Service Account; otherwise, if no Service + // Account is specified, the "default" service account is used. + string service_account = 2; + + // Upgrade settings control disruption and speed of the upgrade. + NodePool.UpgradeSettings upgrade_settings = 3; + + // NodeManagement configuration for this NodePool. + NodeManagement management = 4; + + // Deprecated. Minimum CPU platform to be used for NAP created node pools. + // The instance may be scheduled on the specified or newer CPU platform. + // Applicable values are the friendly names of CPU platforms, such as + // minCpuPlatform: Intel Haswell or + // minCpuPlatform: Intel Sandy Bridge. For more + // information, read [how to specify min CPU + // platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform). + // This field is deprecated, min_cpu_platform should be specified using + // `cloud.google.com/requested-min-cpu-platform` label selector on the pod. + // To unset the min cpu platform field pass "automatic" + // as field value. + string min_cpu_platform = 5 [deprecated = true]; + + // Size of the disk attached to each node, specified in GB. + // The smallest allowed disk size is 10GB. + // + // If unspecified, the default disk size is 100GB. + int32 disk_size_gb = 6; + + // Type of the disk attached to each node (e.g. 'pd-standard', 'pd-ssd' or + // 'pd-balanced') + // + // If unspecified, the default disk type is 'pd-standard' + string disk_type = 7; + + // Shielded Instance options. + ShieldedInstanceConfig shielded_instance_config = 8; + + // + // The Customer Managed Encryption Key used to encrypt the boot disk attached + // to each node in the node pool. This should be of the form + // projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. + // For more information about protecting resources with Cloud KMS Keys please + // see: + // https://cloud.google.com/compute/docs/disks/customer-managed-encryption + string boot_disk_kms_key = 9; + + // The image type to use for NAP created node. Please see + // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for + // available image types. + string image_type = 10; + + // Enable or disable Kubelet read only port. + optional bool insecure_kubelet_readonly_port_enabled = 13; +} + +// Contains information about amount of some resource in the cluster. +// For memory, value should be in GB. +message ResourceLimit { + // Resource name "cpu", "memory" or gpu-specific string. + string resource_type = 1; + + // Minimum amount of the resource in the cluster. + int64 minimum = 2; + + // Maximum amount of the resource in the cluster. + int64 maximum = 3; +} + +// NodePoolAutoscaling contains information required by cluster autoscaler to +// adjust the size of the node pool to the current cluster usage. +message NodePoolAutoscaling { + // Location policy specifies how zones are picked when scaling up the + // nodepool. + enum LocationPolicy { + // Not set. + LOCATION_POLICY_UNSPECIFIED = 0; + + // BALANCED is a best effort policy that aims to balance the sizes of + // different zones. + BALANCED = 1; + + // ANY policy picks zones that have the highest capacity available. + ANY = 2; + } + + // Is autoscaling enabled for this node pool. + bool enabled = 1; + + // Minimum number of nodes for one location in the NodePool. Must be >= 1 and + // <= max_node_count. + int32 min_node_count = 2; + + // Maximum number of nodes for one location in the NodePool. Must be >= + // min_node_count. There has to be enough quota to scale up the cluster. + int32 max_node_count = 3; + + // Can this node pool be deleted automatically. + bool autoprovisioned = 4; + + // Location policy used when scaling up a nodepool. + LocationPolicy location_policy = 5; + + // Minimum number of nodes in the node pool. Must be greater than 1 less than + // total_max_node_count. + // The total_*_node_count fields are mutually exclusive with the *_node_count + // fields. + int32 total_min_node_count = 6; + + // Maximum number of nodes in the node pool. Must be greater than + // total_min_node_count. There has to be enough quota to scale up the cluster. + // The total_*_node_count fields are mutually exclusive with the *_node_count + // fields. + int32 total_max_node_count = 7; +} + +// SetLabelsRequest sets the Google Cloud Platform labels on a Google Container +// Engine cluster, which will in turn set them for Google Compute Engine +// resources used by that cluster +message SetLabelsRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. The labels to set for that cluster. + map resource_labels = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The fingerprint of the previous set of labels for this resource, + // used to detect conflicts. The fingerprint is initially generated by + // Kubernetes Engine and changes after every request to modify or update + // labels. You must always provide an up-to-date fingerprint hash when + // updating or changing labels. Make a `get()` request to the + // resource to get the latest fingerprint. + string label_fingerprint = 5 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster name) of the cluster to set labels. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 7; +} + +// SetLegacyAbacRequest enables or disables the ABAC authorization mechanism for +// a cluster. +message SetLegacyAbacRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster to update. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Whether ABAC authorization will be enabled in the cluster. + bool enabled = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster name) of the cluster to set legacy + // abac. Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; +} + +// StartIPRotationRequest creates a new IP for the cluster and then performs +// a node upgrade on each node pool to point to the new IP. +message StartIPRotationRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster name) of the cluster to start IP + // rotation. Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; + + // Whether to rotate credentials during IP rotation. + bool rotate_credentials = 7; +} + +// CompleteIPRotationRequest moves the cluster master back into single-IP mode. +message CompleteIPRotationRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster name) of the cluster to complete IP + // rotation. Specified in the format `projects/*/locations/*/clusters/*`. + string name = 7; +} + +// AcceleratorConfig represents a Hardware Accelerator request. +message AcceleratorConfig { + // The number of the accelerator cards exposed to an instance. + int64 accelerator_count = 1; + + // The accelerator type resource name. List of supported accelerators + // [here](https://cloud.google.com/compute/docs/gpus) + string accelerator_type = 2; + + // Size of partitions to create on the GPU. Valid values are described in the + // NVIDIA [mig user + // guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning). + string gpu_partition_size = 3; + + // The number of time-shared GPU resources to expose for each physical GPU. + int64 max_time_shared_clients_per_gpu = 4 [deprecated = true]; + + // The configuration for GPU sharing options. + optional GPUSharingConfig gpu_sharing_config = 5; + + // The configuration for auto installation of GPU driver. + optional GPUDriverInstallationConfig gpu_driver_installation_config = 6; +} + +// GPUSharingConfig represents the GPU sharing configuration for Hardware +// Accelerators. +message GPUSharingConfig { + // The type of GPU sharing strategy currently provided. + enum GPUSharingStrategy { + // Default value. + GPU_SHARING_STRATEGY_UNSPECIFIED = 0; + + // GPUs are time-shared between containers. + TIME_SHARING = 1; + } + + // The max number of containers that can share a physical GPU. + int64 max_shared_clients_per_gpu = 1; + + // The type of GPU sharing strategy to enable on the GPU node. + optional GPUSharingStrategy gpu_sharing_strategy = 2; +} + +// GPUDriverInstallationConfig specifies the version of GPU driver to be auto +// installed. +message GPUDriverInstallationConfig { + // The GPU driver version to install. + enum GPUDriverVersion { + // Default value is to not install any GPU driver. + GPU_DRIVER_VERSION_UNSPECIFIED = 0; + + // Disable GPU driver auto installation and needs manual installation + INSTALLATION_DISABLED = 1; + + // "Default" GPU driver in COS and Ubuntu. + DEFAULT = 2; + + // "Latest" GPU driver in COS. + LATEST = 3; + } + + // Mode for how the GPU driver is installed. + optional GPUDriverVersion gpu_driver_version = 1; +} + +// ManagedPrometheusConfig defines the configuration for +// Google Cloud Managed Service for Prometheus. +message ManagedPrometheusConfig { + // Enable Managed Collection. + bool enabled = 1; +} + +// WorkloadMetadataConfig defines the metadata configuration to expose to +// workloads on the node pool. +message WorkloadMetadataConfig { + // NodeMetadata is the configuration for if and how to expose the node + // metadata to the workload running on the node. + enum NodeMetadata { + // Not set. + UNSPECIFIED = 0; + + // Prevent workloads not in hostNetwork from accessing certain VM metadata, + // specifically kube-env, which contains Kubelet credentials, and the + // instance identity token. + // + // Metadata concealment is a temporary security solution available while the + // bootstrapping process for cluster nodes is being redesigned with + // significant security improvements. This feature is scheduled to be + // deprecated in the future and later removed. + SECURE = 1; + + // Expose all VM metadata to pods. + EXPOSE = 2; + + // Run the GKE Metadata Server on this node. The GKE Metadata Server exposes + // a metadata API to workloads that is compatible with the V1 Compute + // Metadata APIs exposed by the Compute Engine and App Engine Metadata + // Servers. This feature can only be enabled if Workload Identity is enabled + // at the cluster level. + GKE_METADATA_SERVER = 3; + } + + // Mode is the configuration for how to expose metadata to workloads running + // on the node. + enum Mode { + // Not set. + MODE_UNSPECIFIED = 0; + + // Expose all Compute Engine metadata to pods. + GCE_METADATA = 1; + + // Run the GKE Metadata Server on this node. The GKE Metadata Server exposes + // a metadata API to workloads that is compatible with the V1 Compute + // Metadata APIs exposed by the Compute Engine and App Engine Metadata + // Servers. This feature can only be enabled if Workload Identity is enabled + // at the cluster level. + GKE_METADATA = 2; + } + + // NodeMetadata is the configuration for how to expose metadata to the + // workloads running on the node. + NodeMetadata node_metadata = 1 [deprecated = true]; + + // Mode is the configuration for how to expose metadata to workloads running + // on the node pool. + Mode mode = 2; +} + +// SetNetworkPolicyRequest enables/disables network policy for a cluster. +message SetNetworkPolicyRequest { + // Required. Deprecated. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + // This field has been deprecated and replaced by the name field. + string project_id = 1 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. This field has been deprecated and replaced by the name + // field. + string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Deprecated. The name of the cluster. + // This field has been deprecated and replaced by the name field. + string cluster_id = 3 + [deprecated = true, (google.api.field_behavior) = REQUIRED]; + + // Required. Configuration options for the NetworkPolicy feature. + NetworkPolicy network_policy = 4 [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster name) of the cluster to set networking + // policy. Specified in the format `projects/*/locations/*/clusters/*`. + string name = 6; +} + +// SetMaintenancePolicyRequest sets the maintenance policy for a cluster. +message SetMaintenancePolicyRequest { + // Required. The Google Developers Console [project ID or project + // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the Google Compute Engine + // [zone](https://cloud.google.com/compute/docs/zones#available) in which the + // cluster resides. + string zone = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the cluster to update. + string cluster_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The maintenance policy to be set for the cluster. An empty field + // clears the existing maintenance policy. + MaintenancePolicy maintenance_policy = 4 + [(google.api.field_behavior) = REQUIRED]; + + // The name (project, location, cluster name) of the cluster to set + // maintenance policy. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 5; +} + +// ListLocationsRequest is used to request the locations that offer GKE. +message ListLocationsRequest { + // Required. Contains the name of the resource requested. + // Specified in the format `projects/*`. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// ListLocationsResponse returns the list of all GKE locations and their +// recommendation state. +message ListLocationsResponse { + // A full list of GKE locations. + repeated Location locations = 1; + + // Only return ListLocationsResponse that occur after the page_token. This + // value should be populated from the ListLocationsResponse.next_page_token if + // that response token was set (which happens when listing more Locations than + // fit in a single ListLocationsResponse). + string next_page_token = 2; +} + +// Location returns the location name, and if the location is recommended +// for GKE cluster scheduling. +message Location { + // LocationType is the type of GKE location, regional or zonal. + enum LocationType { + // LOCATION_TYPE_UNSPECIFIED means the location type was not determined. + LOCATION_TYPE_UNSPECIFIED = 0; + + // A GKE Location where Zonal clusters can be created. + ZONE = 1; + + // A GKE Location where Regional clusters can be created. + REGION = 2; + } + + // Contains the type of location this Location is for. + // Regional or Zonal. + LocationType type = 1; + + // Contains the name of the resource requested. + // Specified in the format `projects/*/locations/*`. + string name = 2; + + // Whether the location is recommended for GKE cluster scheduling. + bool recommended = 3; +} + +// StatusCondition describes why a cluster or a node pool has a certain status +// (e.g., ERROR or DEGRADED). +message StatusCondition { + // Code for each condition + enum Code { + option deprecated = true; + + // UNKNOWN indicates a generic condition. + UNKNOWN = 0; + + // GCE_STOCKOUT indicates that Google Compute Engine resources are + // temporarily unavailable. + GCE_STOCKOUT = 1; + + // GKE_SERVICE_ACCOUNT_DELETED indicates that the user deleted their robot + // service account. + GKE_SERVICE_ACCOUNT_DELETED = 2; + + // Google Compute Engine quota was exceeded. + GCE_QUOTA_EXCEEDED = 3; + + // Cluster state was manually changed by an SRE due to a system logic error. + SET_BY_OPERATOR = 4; + + // Unable to perform an encrypt operation against the CloudKMS key used for + // etcd level encryption. + CLOUD_KMS_KEY_ERROR = 7; + + // Cluster CA is expiring soon. + // More codes TBA + CA_EXPIRING = 9; + } + + // Machine-friendly representation of the condition + // Deprecated. Use canonical_code instead. + Code code = 1 [deprecated = true]; + + // Human-friendly representation of the condition + string message = 2; + + // Canonical code of the condition. + google.rpc.Code canonical_code = 3; +} + +// NetworkConfig reports the relative names of network & subnetwork. +message NetworkConfig { + // Configuration of all network bandwidth tiers + message ClusterNetworkPerformanceConfig { + // Node network tier + enum Tier { + // Default value + TIER_UNSPECIFIED = 0; + + // Higher bandwidth, actual values based on VM size. + TIER_1 = 1; + } + + // Specifies the total network bandwidth tier for the NodePool. + optional Tier total_egress_bandwidth_tier = 1; + } + + // Output only. The relative name of the Google Compute Engine + // [network][google.container.v1beta1.NetworkConfig.network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) + // to which the cluster is connected. Example: + // projects/my-project/global/networks/my-network + string network = 1; + + // Output only. The relative name of the Google Compute Engine + // [subnetwork](https://cloud.google.com/compute/docs/vpc) to which the + // cluster is connected. Example: + // projects/my-project/regions/us-central1/subnetworks/my-subnet + string subnetwork = 2; + + // Whether Intra-node visibility is enabled for this cluster. + // This makes same node pod to pod traffic visible for VPC network. + bool enable_intra_node_visibility = 5; + + // Whether the cluster disables default in-node sNAT rules. In-node sNAT rules + // will be disabled when default_snat_status is disabled. When disabled is set + // to false, default IP masquerade rules will be applied to the nodes to + // prevent sNAT on cluster internal traffic. + DefaultSnatStatus default_snat_status = 7; + + // Whether L4ILB Subsetting is enabled for this cluster. + bool enable_l4ilb_subsetting = 10; + + // The desired datapath provider for this cluster. By default, uses the + // IPTables-based kube-proxy implementation. + DatapathProvider datapath_provider = 11; + + // The desired state of IPv6 connectivity to Google Services. + // By default, no private IPv6 access to or from Google Services (all access + // will be via IPv4) + PrivateIPv6GoogleAccess private_ipv6_google_access = 12; + + // DNSConfig contains clusterDNS config for this cluster. + DNSConfig dns_config = 13; + + // ServiceExternalIPsConfig specifies if services with externalIPs field are + // blocked or not. + ServiceExternalIPsConfig service_external_ips_config = 15; + + // GatewayAPIConfig contains the desired config of Gateway API on this + // cluster. + GatewayAPIConfig gateway_api_config = 16; + + // Whether multi-networking is enabled for this cluster. + bool enable_multi_networking = 17; + + // Network bandwidth tier configuration. + ClusterNetworkPerformanceConfig network_performance_config = 18; + + // Whether FQDN Network Policy is enabled on this cluster. + optional bool enable_fqdn_network_policy = 19; +} + +// GatewayAPIConfig contains the desired config of Gateway API on this cluster. +message GatewayAPIConfig { + // Channel describes if/how Gateway API should be installed and implemented in + // a cluster. + enum Channel { + // Default value. + CHANNEL_UNSPECIFIED = 0; + + // Gateway API support is disabled + CHANNEL_DISABLED = 1; + + // Gateway API support is enabled, experimental CRDs are installed + CHANNEL_EXPERIMENTAL = 3; + + // Gateway API support is enabled, standard CRDs are installed + CHANNEL_STANDARD = 4; + } + + // The Gateway API release channel to use for Gateway API. + Channel channel = 1; +} + +// Config to block services with externalIPs field. +message ServiceExternalIPsConfig { + // Whether Services with ExternalIPs field are allowed or not. + bool enabled = 1; +} + +// ListUsableSubnetworksRequest requests the list of usable subnetworks. +// available to a user for creating clusters. +message ListUsableSubnetworksRequest { + // Required. The parent project where subnetworks are usable. + // Specified in the format `projects/*`. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Filtering currently only supports equality on the networkProjectId and must + // be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` + // is the project which owns the listed subnetworks. This defaults to the + // parent project ID. + string filter = 2; + + // The max number of results per page that should be returned. If the number + // of available results is larger than `page_size`, a `next_page_token` is + // returned which can be used to get the next page of results in subsequent + // requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + int32 page_size = 3; + + // Specifies a page token to use. Set this to the nextPageToken returned by + // previous list requests to get the next page of results. + string page_token = 4; +} + +// ListUsableSubnetworksResponse is the response of +// ListUsableSubnetworksRequest. +message ListUsableSubnetworksResponse { + // A list of usable subnetworks in the specified network project. + repeated UsableSubnetwork subnetworks = 1; + + // This token allows you to get the next page of results for list requests. + // If the number of results is larger than `page_size`, use the + // `next_page_token` as a value for the query parameter `page_token` in the + // next request. The value will become empty when there are no more pages. + string next_page_token = 2; +} + +// Secondary IP range of a usable subnetwork. +message UsableSubnetworkSecondaryRange { + // Status shows the current usage of a secondary IP range. + enum Status { + // UNKNOWN is the zero value of the Status enum. It's not a valid status. + UNKNOWN = 0; + + // UNUSED denotes that this range is unclaimed by any cluster. + UNUSED = 1; + + // IN_USE_SERVICE denotes that this range is claimed by a cluster for + // services. It cannot be used for other clusters. + IN_USE_SERVICE = 2; + + // IN_USE_SHAREABLE_POD denotes this range was created by the network admin + // and is currently claimed by a cluster for pods. It can only be used by + // other clusters as a pod range. + IN_USE_SHAREABLE_POD = 3; + + // IN_USE_MANAGED_POD denotes this range was created by GKE and is claimed + // for pods. It cannot be used for other clusters. + IN_USE_MANAGED_POD = 4; + } + + // The name associated with this subnetwork secondary range, used when adding + // an alias IP range to a VM instance. + string range_name = 1; + + // The range of IP addresses belonging to this subnetwork secondary range. + string ip_cidr_range = 2; + + // This field is to determine the status of the secondary range programmably. + Status status = 3; +} + +// UsableSubnetwork resource returns the subnetwork name, its associated network +// and the primary CIDR range. +message UsableSubnetwork { + // Subnetwork Name. + // Example: projects/my-project/regions/us-central1/subnetworks/my-subnet + string subnetwork = 1; + + // Network Name. + // Example: projects/my-project/global/networks/my-network + string network = 2; + + // The range of internal addresses that are owned by this subnetwork. + string ip_cidr_range = 3; + + // Secondary IP ranges. + repeated UsableSubnetworkSecondaryRange secondary_ip_ranges = 4; + + // A human readable status message representing the reasons for cases where + // the caller cannot use the secondary ranges under the subnet. For example if + // the secondary_ip_ranges is empty due to a permission issue, an insufficient + // permission message will be given by status_message. + string status_message = 5; +} + +// VerticalPodAutoscaling contains global, per-cluster information +// required by Vertical Pod Autoscaler to automatically adjust +// the resources of pods controlled by it. +message VerticalPodAutoscaling { + // Enables vertical pod autoscaling. + bool enabled = 1; +} + +// DefaultSnatStatus contains the desired state of whether default sNAT should +// be disabled on the cluster. +message DefaultSnatStatus { + // Disables cluster default sNAT rules. + bool disabled = 1; +} + +// IntraNodeVisibilityConfig contains the desired config of the intra-node +// visibility on this cluster. +message IntraNodeVisibilityConfig { + // Enables intra node visibility for this cluster. + bool enabled = 1; +} + +// ILBSubsettingConfig contains the desired config of L4 Internal LoadBalancer +// subsetting on this cluster. +message ILBSubsettingConfig { + // Enables l4 ILB subsetting for this cluster + bool enabled = 1; +} + +// DNSConfig contains the desired set of options for configuring clusterDNS. +message DNSConfig { + // Provider lists the various in-cluster DNS providers. + enum Provider { + // Default value + PROVIDER_UNSPECIFIED = 0; + + // Use GKE default DNS provider(kube-dns) for DNS resolution. + PLATFORM_DEFAULT = 1; + + // Use CloudDNS for DNS resolution. + CLOUD_DNS = 2; + + // Use KubeDNS for DNS resolution. + KUBE_DNS = 3; + } + + // DNSScope lists the various scopes of access to cluster DNS records. + enum DNSScope { + // Default value, will be inferred as cluster scope. + DNS_SCOPE_UNSPECIFIED = 0; + + // DNS records are accessible from within the cluster. + CLUSTER_SCOPE = 1; + + // DNS records are accessible from within the VPC. + VPC_SCOPE = 2; + } + + // cluster_dns indicates which in-cluster DNS provider should be used. + Provider cluster_dns = 1; + + // cluster_dns_scope indicates the scope of access to cluster DNS records. + DNSScope cluster_dns_scope = 2; + + // cluster_dns_domain is the suffix used for all cluster service records. + string cluster_dns_domain = 3; +} + +// Constraints applied to pods. +message MaxPodsConstraint { + // Constraint enforced on the max num of pods per node. + int64 max_pods_per_node = 1; +} + +// Configuration for the use of Kubernetes Service Accounts in GCP IAM +// policies. +message WorkloadIdentityConfig { + // IAM Identity Namespace to attach all Kubernetes Service Accounts to. + string identity_namespace = 1 [deprecated = true]; + + // The workload pool to attach all Kubernetes service accounts to. + string workload_pool = 2; + + // identity provider is the third party identity provider. + string identity_provider = 3; +} + +// Configuration for direct-path (via ALTS) with workload identity. +message WorkloadALTSConfig { + // enable_alts controls whether the alts handshaker should be enabled or not + // for direct-path. + // + // Requires Workload Identity + // ([workload_pool][google.container.v1beta1.WorkloadIdentityConfig.workload_pool] + // must be non-empty). + google.protobuf.BoolValue enable_alts = 1; +} + +// Configuration for issuance of mTLS keys and certificates to Kubernetes pods. +message WorkloadCertificates { + // enable_certificates controls issuance of workload mTLS certificates. + // + // If set, the GKE Workload Identity Certificates controller and node agent + // will be deployed in the cluster, which can then be configured by creating a + // WorkloadCertificateConfig Custom Resource. + // + // Requires Workload Identity + // ([workload_pool][google.container.v1beta1.WorkloadIdentityConfig.workload_pool] + // must be non-empty). + google.protobuf.BoolValue enable_certificates = 1; +} + +// Configuration for issuance of mTLS keys and certificates to Kubernetes pods. +message MeshCertificates { + // enable_certificates controls issuance of workload mTLS certificates. + // + // If set, the GKE Workload Identity Certificates controller and node agent + // will be deployed in the cluster, which can then be configured by creating a + // WorkloadCertificateConfig Custom Resource. + // + // Requires Workload Identity + // ([workload_pool][google.container.v1alpha1.WorkloadIdentityConfig.workload_pool] + // must be non-empty). + google.protobuf.BoolValue enable_certificates = 1; +} + +// Configuration of etcd encryption. +message DatabaseEncryption { + // State of etcd encryption. + enum State { + // Should never be set + UNKNOWN = 0; + + // Secrets in etcd are encrypted. + ENCRYPTED = 1; + + // Secrets in etcd are stored in plain text (at etcd level) - this is + // unrelated to Compute Engine level full disk encryption. + DECRYPTED = 2; + } + + // Name of CloudKMS key to use for the encryption of secrets in etcd. + // Ex. projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key + string key_name = 1; + + // The desired state of etcd encryption. + State state = 2; +} + +// Configuration for exporting cluster resource usages. +message ResourceUsageExportConfig { + // Parameters for using BigQuery as the destination of resource usage export. + message BigQueryDestination { + // The ID of a BigQuery Dataset. + string dataset_id = 1; + } + + // Parameters for controlling consumption metering. + message ConsumptionMeteringConfig { + // Whether to enable consumption metering for this cluster. If enabled, a + // second BigQuery table will be created to hold resource consumption + // records. + bool enabled = 1; + } + + // Configuration to use BigQuery as usage export destination. + BigQueryDestination bigquery_destination = 1; + + // Whether to enable network egress metering for this cluster. If enabled, a + // daemonset will be created in the cluster to meter network egress traffic. + bool enable_network_egress_metering = 2; + + // Configuration to enable resource consumption metering. + ConsumptionMeteringConfig consumption_metering_config = 3; +} + +// Configuration of Shielded Nodes feature. +message ShieldedNodes { + // Whether Shielded Nodes features are enabled on all nodes in this cluster. + bool enabled = 1; +} + +// Configuration of gVNIC feature. +message VirtualNIC { + // Whether gVNIC features are enabled in the node pool. + bool enabled = 1; +} + +// Configuration of Fast Socket feature. +message FastSocket { + // Whether Fast Socket features are enabled in the node pool. + bool enabled = 1; +} + +// GetOpenIDConfigRequest gets the OIDC discovery document for the +// cluster. See the OpenID Connect Discovery 1.0 specification for details. +message GetOpenIDConfigRequest { + // The cluster (project, location, cluster name) to get the discovery document + // for. Specified in the format `projects/*/locations/*/clusters/*`. + string parent = 1; +} + +// GetOpenIDConfigResponse is an OIDC discovery document for the cluster. +// See the OpenID Connect Discovery 1.0 specification for details. +message GetOpenIDConfigResponse { + // OIDC Issuer. + string issuer = 1; + + // JSON Web Key uri. + string jwks_uri = 2; + + // Supported response types. + repeated string response_types_supported = 3; + + // Supported subject types. + repeated string subject_types_supported = 4; + + // supported ID Token signing Algorithms. + repeated string id_token_signing_alg_values_supported = 5; + + // Supported claims. + repeated string claims_supported = 6; + + // Supported grant types. + repeated string grant_types = 7; +} + +// GetJSONWebKeysRequest gets the public component of the keys used by the +// cluster to sign token requests. This will be the jwks_uri for the discover +// document returned by getOpenIDConfig. See the OpenID Connect +// Discovery 1.0 specification for details. +message GetJSONWebKeysRequest { + // The cluster (project, location, cluster name) to get keys for. Specified in + // the format `projects/*/locations/*/clusters/*`. + string parent = 1; +} + +// Jwk is a JSON Web Key as specified in RFC 7517 +message Jwk { + // Key Type. + string kty = 1; + + // Algorithm. + string alg = 2; + + // Permitted uses for the public keys. + string use = 3; + + // Key ID. + string kid = 4; + + // Used for RSA keys. + string n = 5; + + // Used for RSA keys. + string e = 6; + + // Used for ECDSA keys. + string x = 7; + + // Used for ECDSA keys. + string y = 8; + + // Used for ECDSA keys. + string crv = 9; +} + +// GetJSONWebKeysResponse is a valid JSON Web Key Set as specififed in rfc 7517 +message GetJSONWebKeysResponse { + // The public component of the keys used by the cluster to sign token + // requests. + repeated Jwk keys = 1; +} + +// CheckAutopilotCompatibilityRequest requests getting the blockers for the +// given operation in the cluster. +message CheckAutopilotCompatibilityRequest { + // The name (project, location, cluster) of the cluster to retrieve. + // Specified in the format `projects/*/locations/*/clusters/*`. + string name = 1; +} + +// AutopilotCompatibilityIssue contains information about a specific +// compatibility issue with Autopilot mode. +message AutopilotCompatibilityIssue { + // The type of the reported issue. + enum IssueType { + // Default value, should not be used. + UNSPECIFIED = 0; + + // Indicates that the issue is a known incompatibility between the + // cluster and Autopilot mode. + INCOMPATIBILITY = 1; + + // Indicates the issue is an incompatibility if customers take no further + // action to resolve. + ADDITIONAL_CONFIG_REQUIRED = 2; + + // Indicates the issue is not an incompatibility, but depending on the + // workloads business logic, there is a potential that they won't work on + // Autopilot. + PASSED_WITH_OPTIONAL_CONFIG = 3; + } + + // The last time when this issue was observed. + google.protobuf.Timestamp last_observation = 1; + + // The constraint type of the issue. + string constraint_type = 2; + + // The incompatibility type of this issue. + IssueType incompatibility_type = 3; + + // The name of the resources which are subject to this issue. + repeated string subjects = 4; + + // A URL to a public documnetation, which addresses resolving this issue. + string documentation_url = 5; + + // The description of the issue. + string description = 6; +} + +// CheckAutopilotCompatibilityResponse has a list of compatibility issues. +message CheckAutopilotCompatibilityResponse { + // The list of issues for the given operation. + repeated AutopilotCompatibilityIssue issues = 1; + + // The summary of the autopilot compatibility response. + string summary = 2; +} + +// ReleaseChannel indicates which release channel a cluster is +// subscribed to. Release channels are arranged in order of risk. +// +// When a cluster is subscribed to a release channel, Google maintains +// both the master version and the node version. Node auto-upgrade +// defaults to true and cannot be disabled. +message ReleaseChannel { + // Possible values for 'channel'. + enum Channel { + // No channel specified. + UNSPECIFIED = 0; + + // RAPID channel is offered on an early access basis for customers who want + // to test new releases. + // + // WARNING: Versions available in the RAPID Channel may be subject to + // unresolved issues with no known workaround and are not subject to any + // SLAs. + RAPID = 1; + + // Clusters subscribed to REGULAR receive versions that are considered GA + // quality. REGULAR is intended for production users who want to take + // advantage of new features. + REGULAR = 2; + + // Clusters subscribed to STABLE receive versions that are known to be + // stable and reliable in production. + STABLE = 3; + } + + // channel specifies which release channel the cluster is subscribed to. + Channel channel = 1; +} + +// Configuration for fine-grained cost management feature. +message CostManagementConfig { + // Whether the feature is enabled or not. + bool enabled = 1; +} + +// Configuration for Cloud TPU. +message TpuConfig { + // Whether Cloud TPU integration is enabled or not. + bool enabled = 1; + + // Whether to use service networking for Cloud TPU or not. + bool use_service_networking = 2; + + // IPv4 CIDR block reserved for Cloud TPU in the VPC. + string ipv4_cidr_block = 3; +} + +// PrivateIPv6GoogleAccess controls whether and how the pods can communicate +// with Google Services through gRPC over IPv6. +enum PrivateIPv6GoogleAccess { + // Default value. Same as DISABLED + PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED = 0; + + // No private access to or from Google Services + PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED = 1; + + // Enables private IPv6 access to Google Services from GKE + PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE = 2; + + // Enables private IPv6 access to and from Google Services + PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL = 3; +} + +// Master is the configuration for components on master. +message Master {} + +// Autopilot is the configuration for Autopilot settings on the cluster. +message Autopilot { + // Enable Autopilot + bool enabled = 1; + + // Workload policy configuration for Autopilot. + WorkloadPolicyConfig workload_policy_config = 2; +} + +// WorkloadPolicyConfig is the configuration of workload policy for autopilot +// clusters. +message WorkloadPolicyConfig { + // If true, workloads can use NET_ADMIN capability. + optional bool allow_net_admin = 1; +} + +// NotificationConfig is the configuration of notifications. +message NotificationConfig { + // Types of notifications currently supported. Can be used to filter what + // notifications are sent. + enum EventType { + // Not set, will be ignored. + EVENT_TYPE_UNSPECIFIED = 0; + + // Corresponds with UpgradeAvailableEvent. + UPGRADE_AVAILABLE_EVENT = 1; + + // Corresponds with UpgradeEvent. + UPGRADE_EVENT = 2; + + // Corresponds with SecurityBulletinEvent. + SECURITY_BULLETIN_EVENT = 3; + } + + // Pub/Sub specific notification config. + message PubSub { + // Enable notifications for Pub/Sub. + bool enabled = 1; + + // The desired Pub/Sub topic to which notifications will be + // sent by GKE. Format is `projects/{project}/topics/{topic}`. + string topic = 2 [ + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; + + // Allows filtering to one or more specific event types. If no filter is + // specified, or if a filter is specified with no event types, all event + // types will be sent + Filter filter = 3; + } + + // Allows filtering to one or more specific event types. If event types are + // present, those and only those event types will be transmitted to the + // cluster. Other types will be skipped. If no filter is specified, or no + // event types are present, all event types will be sent + message Filter { + // Event types to allowlist. + repeated EventType event_type = 1; + } + + // Notification config for Pub/Sub. + PubSub pubsub = 1; +} + +// ConfidentialNodes is configuration for the confidential nodes feature, which +// makes nodes run on confidential VMs. +message ConfidentialNodes { + // Whether Confidential Nodes feature is enabled. + bool enabled = 1; +} + +// UpgradeResourceType is the resource type that is upgrading. It is used +// in upgrade notifications. +enum UpgradeResourceType { + // Default value. This shouldn't be used. + UPGRADE_RESOURCE_TYPE_UNSPECIFIED = 0; + + // Master / control plane + MASTER = 1; + + // Node pool + NODE_POOL = 2; +} + +// UpgradeEvent is a notification sent to customers by the cluster server when +// a resource is upgrading. +message UpgradeEvent { + // The resource type that is upgrading. + UpgradeResourceType resource_type = 1; + + // The operation associated with this upgrade. + string operation = 2; + + // The time when the operation was started. + google.protobuf.Timestamp operation_start_time = 3; + + // The current version before the upgrade. + string current_version = 4; + + // The target version for the upgrade. + string target_version = 5; + + // Optional relative path to the resource. For example in node pool upgrades, + // the relative path of the node pool. + string resource = 6; +} + +// UpgradeAvailableEvent is a notification sent to customers when a new +// available version is released. +message UpgradeAvailableEvent { + // The release version available for upgrade. + string version = 1; + + // The resource type of the release version. + UpgradeResourceType resource_type = 2; + + // The release channel of the version. If empty, it means a non-channel + // release. + ReleaseChannel release_channel = 3; + + // Optional relative path to the resource. For example, the relative path of + // the node pool. + string resource = 4; + + // Windows node versions info. + WindowsVersions windows_versions = 5; +} + +// SecurityBulletinEvent is a notification sent to customers when a security +// bulletin has been posted that they are vulnerable to. +message SecurityBulletinEvent { + // The resource type (node/control plane) that has the vulnerability. Multiple + // notifications (1 notification per resource type) will be sent for a + // vulnerability that affects > 1 resource type. + string resource_type_affected = 1; + + // The ID of the bulletin corresponding to the vulnerability. + string bulletin_id = 2; + + // The CVEs associated with this bulletin. + repeated string cve_ids = 3; + + // The severity of this bulletin as it relates to GKE. + string severity = 4; + + // The URI link to the bulletin on the website for more information. + string bulletin_uri = 5; + + // A brief description of the bulletin. See the bulletin pointed to by the + // bulletin_uri field for an expanded description. + string brief_description = 6; + + // The GKE minor versions affected by this vulnerability. + repeated string affected_supported_minors = 7; + + // The GKE versions where this vulnerability is patched. + repeated string patched_versions = 8; + + // This represents a version selected from the patched_versions field that + // the cluster receiving this notification should most likely want to upgrade + // to based on its current version. Note that if this notification is being + // received by a given cluster, it means that this version is currently + // available as an upgrade target in that cluster's location. + string suggested_upgrade_target = 9; + + // If this field is specified, it means there are manual steps that the user + // must take to make their clusters safe. + bool manual_steps_required = 10; +} + +// IdentityServiceConfig is configuration for Identity Service which allows +// customers to use external identity providers with the K8S API +message IdentityServiceConfig { + // Whether to enable the Identity Service component + bool enabled = 1; +} + +// Strategy used for node pool update. +enum NodePoolUpdateStrategy { + // Default value if unset. GKE internally defaults the update strategy to + // SURGE for unspecified strategies. + NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED = 0; + + // blue-green upgrade. + BLUE_GREEN = 2; + + // SURGE is the traditional way of upgrading a node pool. + // max_surge and max_unavailable determines the level of upgrade parallelism. + SURGE = 3; +} + +// LoggingConfig is cluster logging configuration. +message LoggingConfig { + // Logging components configuration + LoggingComponentConfig component_config = 1; +} + +// LoggingComponentConfig is cluster logging component configuration. +message LoggingComponentConfig { + // GKE components exposing logs + enum Component { + // Default value. This shouldn't be used. + COMPONENT_UNSPECIFIED = 0; + + // system components + SYSTEM_COMPONENTS = 1; + + // workloads + WORKLOADS = 2; + + // kube-apiserver + APISERVER = 3; + + // kube-scheduler + SCHEDULER = 4; + + // kube-controller-manager + CONTROLLER_MANAGER = 5; + } + + // Select components to collect logs. An empty set would disable all logging. + repeated Component enable_components = 1; +} + +// MonitoringConfig is cluster monitoring configuration. +message MonitoringConfig { + // Monitoring components configuration + MonitoringComponentConfig component_config = 1; + + // Enable Google Cloud Managed Service for Prometheus + // in the cluster. + ManagedPrometheusConfig managed_prometheus_config = 2; + + // Configuration of Advanced Datapath Observability features. + AdvancedDatapathObservabilityConfig advanced_datapath_observability_config = + 3; +} + +// AdvancedDatapathObservabilityConfig specifies configuration of observability +// features of advanced datapath. +message AdvancedDatapathObservabilityConfig { + // Supported Relay modes + enum RelayMode { + // Default value. This shouldn't be used. + RELAY_MODE_UNSPECIFIED = 0; + + // disabled + DISABLED = 1; + + // exposed via internal load balancer + INTERNAL_VPC_LB = 3; + + // exposed via external load balancer + EXTERNAL_LB = 4; + } + + // Expose flow metrics on nodes + bool enable_metrics = 1; + + // Method used to make Relay available + RelayMode relay_mode = 2; +} + +// NodePoolLoggingConfig specifies logging configuration for nodepools. +message NodePoolLoggingConfig { + // Logging variant configuration. + LoggingVariantConfig variant_config = 1; +} + +// LoggingVariantConfig specifies the behaviour of the logging component. +message LoggingVariantConfig { + // Logging component variants. + enum Variant { + // Default value. This shouldn't be used. + VARIANT_UNSPECIFIED = 0; + + // default logging variant. + DEFAULT = 1; + + // maximum logging throughput variant. + MAX_THROUGHPUT = 2; + } + + // Logging variant deployed on nodes. + Variant variant = 1; +} + +// MonitoringComponentConfig is cluster monitoring component configuration. +message MonitoringComponentConfig { + // GKE components exposing metrics + enum Component { + // Default value. This shouldn't be used. + COMPONENT_UNSPECIFIED = 0; + + // system components + SYSTEM_COMPONENTS = 1; + + // Deprecated: Use Google Cloud Managed Service for Prometheus. + WORKLOADS = 2 [deprecated = true]; + + // kube-apiserver + APISERVER = 3; + + // kube-scheduler + SCHEDULER = 4; + + // kube-controller-manager + CONTROLLER_MANAGER = 5; + + // Storage + STORAGE = 7; + + // Horizontal Pod Autoscaling + HPA = 8; + + // Pod + POD = 9; + + // DaemonSet + DAEMONSET = 10; + + // Deployment + DEPLOYMENT = 11; + + // Statefulset + STATEFULSET = 12; + } + + // Select components to collect metrics. An empty set would disable all + // monitoring. + repeated Component enable_components = 1; +} + +// The datapath provider selects the implementation of the Kubernetes networking +// model for service resolution and network policy enforcement. +enum DatapathProvider { + // Default value. + DATAPATH_PROVIDER_UNSPECIFIED = 0; + + // Use the IPTables implementation based on kube-proxy. + LEGACY_DATAPATH = 1; + + // Use the eBPF based GKE Dataplane V2 with additional features. See the [GKE + // Dataplane V2 + // documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/dataplane-v2) + // for more. + ADVANCED_DATAPATH = 2; +} + +// Fleet is the fleet configuration for the cluster. +message Fleet { + // The Fleet host project(project ID or project number) where this cluster + // will be registered to. This field cannot be changed after the cluster has + // been registered. + string project = 1; + + // [Output only] The full resource name of the registered fleet membership of + // the cluster, in the format + // `//gkehub.googleapis.com/projects/*/locations/*/memberships/*`. + string membership = 2; + + // [Output only] Whether the cluster has been registered through the fleet + // API. + bool pre_registered = 3; +} + +// Possible values for IP stack type +enum StackType { + // By default, the clusters will be IPV4 only + STACK_TYPE_UNSPECIFIED = 0; + + // The value used if the cluster is a IPV4 only + IPV4 = 1; + + // The value used if the cluster is a dual stack cluster + IPV4_IPV6 = 2; +} diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.cancel_operation.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.cancel_operation.js new file mode 100644 index 00000000000..939c8c4aaca --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.cancel_operation.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(projectId, zone, operationId) { + // [START container_v1beta1_generated_ClusterManager_CancelOperation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, operation id) of the operation to cancel. + * Specified in the format `projects/* /locations/* /operations/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCancelOperation() { + // Construct request + const request = { + projectId, + zone, + operationId, + }; + + // Run request + const response = await containerClient.cancelOperation(request); + console.log(response); + } + + callCancelOperation(); + // [END container_v1beta1_generated_ClusterManager_CancelOperation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.check_autopilot_compatibility.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.check_autopilot_compatibility.js new file mode 100644 index 00000000000..4511c66ce17 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.check_autopilot_compatibility.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 container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster) of the cluster to retrieve. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCheckAutopilotCompatibility() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.checkAutopilotCompatibility(request); + console.log(response); + } + + callCheckAutopilotCompatibility(); + // [END container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_i_p_rotation.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_i_p_rotation.js new file mode 100644 index 00000000000..57cb300a08f --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_i_p_rotation.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(projectId, zone, clusterId) { + // [START container_v1beta1_generated_ClusterManager_CompleteIPRotation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster name) of the cluster to complete IP + * rotation. Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCompleteIPRotation() { + // Construct request + const request = { + projectId, + zone, + clusterId, + }; + + // Run request + const response = await containerClient.completeIPRotation(request); + console.log(response); + } + + callCompleteIPRotation(); + // [END container_v1beta1_generated_ClusterManager_CompleteIPRotation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_node_pool_upgrade.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_node_pool_upgrade.js new file mode 100644 index 00000000000..152c6971b1b --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_node_pool_upgrade.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() { + // [START container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster, node pool id) of the node pool to + * complete upgrade. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCompleteNodePoolUpgrade() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.completeNodePoolUpgrade(request); + console.log(response); + } + + callCompleteNodePoolUpgrade(); + // [END container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_cluster.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_cluster.js new file mode 100644 index 00000000000..4414e1ca9d3 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_cluster.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(projectId, zone, cluster) { + // [START container_v1beta1_generated_ClusterManager_CreateCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 cluster + * resource (https://cloud.google.com/container-engine/reference/rest/v1beta1/projects.locations.clusters) + */ + // const cluster = {} + /** + * The parent (project and location) where the cluster will be created. + * Specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCreateCluster() { + // Construct request + const request = { + projectId, + zone, + cluster, + }; + + // Run request + const response = await containerClient.createCluster(request); + console.log(response); + } + + callCreateCluster(); + // [END container_v1beta1_generated_ClusterManager_CreateCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_node_pool.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_node_pool.js new file mode 100644 index 00000000000..9d53c6be79e --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_node_pool.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(projectId, zone, clusterId, nodePool) { + // [START container_v1beta1_generated_ClusterManager_CreateNodePool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The node pool to create. + */ + // const nodePool = {} + /** + * The parent (project, location, cluster name) where the node pool will be + * created. Specified in the format + * `projects/* /locations/* /clusters/*`. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callCreateNodePool() { + // Construct request + const request = { + projectId, + zone, + clusterId, + nodePool, + }; + + // Run request + const response = await containerClient.createNodePool(request); + console.log(response); + } + + callCreateNodePool(); + // [END container_v1beta1_generated_ClusterManager_CreateNodePool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_cluster.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_cluster.js new file mode 100644 index 00000000000..d387c456166 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_cluster.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(projectId, zone, clusterId) { + // [START container_v1beta1_generated_ClusterManager_DeleteCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster) of the cluster to delete. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callDeleteCluster() { + // Construct request + const request = { + projectId, + zone, + clusterId, + }; + + // Run request + const response = await containerClient.deleteCluster(request); + console.log(response); + } + + callDeleteCluster(); + // [END container_v1beta1_generated_ClusterManager_DeleteCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_node_pool.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_node_pool.js new file mode 100644 index 00000000000..d406bb8686c --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_node_pool.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(projectId, zone, clusterId, nodePoolId) { + // [START container_v1beta1_generated_ClusterManager_DeleteNodePool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster, node pool id) of the node pool to + * delete. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callDeleteNodePool() { + // Construct request + const request = { + projectId, + zone, + clusterId, + nodePoolId, + }; + + // Run request + const response = await containerClient.deleteNodePool(request); + console.log(response); + } + + callDeleteNodePool(); + // [END container_v1beta1_generated_ClusterManager_DeleteNodePool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_cluster.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_cluster.js new file mode 100644 index 00000000000..0e388e69226 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_cluster.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(projectId, zone, clusterId) { + // [START container_v1beta1_generated_ClusterManager_GetCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster) of the cluster to retrieve. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callGetCluster() { + // Construct request + const request = { + projectId, + zone, + clusterId, + }; + + // Run request + const response = await containerClient.getCluster(request); + console.log(response); + } + + callGetCluster(); + // [END container_v1beta1_generated_ClusterManager_GetCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_j_s_o_n_web_keys.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_j_s_o_n_web_keys.js new file mode 100644 index 00000000000..f48cfa5316d --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_j_s_o_n_web_keys.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 container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 cluster (project, location, cluster name) to get keys for. Specified in + * the format `projects/* /locations/* /clusters/*`. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callGetJSONWebKeys() { + // Construct request + const request = { + }; + + // Run request + const response = await containerClient.getJSONWebKeys(request); + console.log(response); + } + + callGetJSONWebKeys(); + // [END container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_node_pool.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_node_pool.js new file mode 100644 index 00000000000..21f384189f6 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_node_pool.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(projectId, zone, clusterId, nodePoolId) { + // [START container_v1beta1_generated_ClusterManager_GetNodePool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster, node pool id) of the node pool to + * get. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callGetNodePool() { + // Construct request + const request = { + projectId, + zone, + clusterId, + nodePoolId, + }; + + // Run request + const response = await containerClient.getNodePool(request); + console.log(response); + } + + callGetNodePool(); + // [END container_v1beta1_generated_ClusterManager_GetNodePool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_operation.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_operation.js new file mode 100644 index 00000000000..f693d6982e6 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_operation.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(projectId, zone, operationId) { + // [START container_v1beta1_generated_ClusterManager_GetOperation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, operation id) of the operation to get. + * Specified in the format `projects/* /locations/* /operations/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callGetOperation() { + // Construct request + const request = { + projectId, + zone, + operationId, + }; + + // Run request + const response = await containerClient.getOperation(request); + console.log(response); + } + + callGetOperation(); + // [END container_v1beta1_generated_ClusterManager_GetOperation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_server_config.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_server_config.js new file mode 100644 index 00000000000..147c03feb39 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_server_config.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(projectId, zone) { + // [START container_v1beta1_generated_ClusterManager_GetServerConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project and location) of the server config to get, + * specified in the format `projects/* /locations/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callGetServerConfig() { + // Construct request + const request = { + projectId, + zone, + }; + + // Run request + const response = await containerClient.getServerConfig(request); + console.log(response); + } + + callGetServerConfig(); + // [END container_v1beta1_generated_ClusterManager_GetServerConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_clusters.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_clusters.js new file mode 100644 index 00000000000..3a468a6e586 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_clusters.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(projectId, zone) { + // [START container_v1beta1_generated_ClusterManager_ListClusters_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 clusters will be listed. + * Specified in the format `projects/* /locations/*`. + * Location "-" matches all zones and all regions. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callListClusters() { + // Construct request + const request = { + projectId, + zone, + }; + + // Run request + const response = await containerClient.listClusters(request); + console.log(response); + } + + callListClusters(); + // [END container_v1beta1_generated_ClusterManager_ListClusters_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_locations.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_locations.js new file mode 100644 index 00000000000..62e86afb204 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_locations.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 container_v1beta1_generated_ClusterManager_ListLocations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Contains the name of the resource requested. + * Specified in the format `projects/*`. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callListLocations() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await containerClient.listLocations(request); + console.log(response); + } + + callListLocations(); + // [END container_v1beta1_generated_ClusterManager_ListLocations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_node_pools.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_node_pools.js new file mode 100644 index 00000000000..6c5aaa855e4 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_node_pools.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(projectId, zone, clusterId) { + // [START container_v1beta1_generated_ClusterManager_ListNodePools_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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, location, cluster name) where the node pools will be + * listed. Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callListNodePools() { + // Construct request + const request = { + projectId, + zone, + clusterId, + }; + + // Run request + const response = await containerClient.listNodePools(request); + console.log(response); + } + + callListNodePools(); + // [END container_v1beta1_generated_ClusterManager_ListNodePools_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_operations.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_operations.js new file mode 100644 index 00000000000..adaf08f3129 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_operations.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(projectId, zone) { + // [START container_v1beta1_generated_ClusterManager_ListOperations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 operations will be listed. + * Specified in the format `projects/* /locations/*`. + * Location "-" matches all zones and all regions. + */ + // const parent = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callListOperations() { + // Construct request + const request = { + projectId, + zone, + }; + + // Run request + const response = await containerClient.listOperations(request); + console.log(response); + } + + callListOperations(); + // [END container_v1beta1_generated_ClusterManager_ListOperations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_usable_subnetworks.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_usable_subnetworks.js new file mode 100644 index 00000000000..400d21f447c --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_usable_subnetworks.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 container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 where subnetworks are usable. + * Specified in the format `projects/*`. + */ + // const parent = 'abc123' + /** + * Filtering currently only supports equality on the networkProjectId and must + * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` + * is the project which owns the listed subnetworks. This defaults to the + * parent project ID. + */ + // const filter = 'abc123' + /** + * The max number of results per page that should be returned. If the number + * of available results is larger than `page_size`, a `next_page_token` is + * returned which can be used to get the next page of results in subsequent + * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + */ + // const pageSize = 1234 + /** + * Specifies a page token to use. Set this to the nextPageToken returned by + * previous list requests to get the next page of results. + */ + // const pageToken = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callListUsableSubnetworks() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await containerClient.listUsableSubnetworksAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListUsableSubnetworks(); + // [END container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.rollback_node_pool_upgrade.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.rollback_node_pool_upgrade.js new file mode 100644 index 00000000000..fd127925ad0 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.rollback_node_pool_upgrade.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(projectId, zone, clusterId, nodePoolId) { + // [START container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster, node pool id) of the node poll to + * rollback upgrade. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + /** + * Option for rollback to ignore the PodDisruptionBudget. + * Default value is false. + */ + // const respectPdb = true + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callRollbackNodePoolUpgrade() { + // Construct request + const request = { + projectId, + zone, + clusterId, + nodePoolId, + }; + + // Run request + const response = await containerClient.rollbackNodePoolUpgrade(request); + console.log(response); + } + + callRollbackNodePoolUpgrade(); + // [END container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_addons_config.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_addons_config.js new file mode 100644 index 00000000000..575a4bf0e5f --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_addons_config.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(projectId, zone, clusterId, addonsConfig) { + // [START container_v1beta1_generated_ClusterManager_SetAddonsConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The desired configurations for the various addons available to + * run in the cluster. + */ + // const addonsConfig = {} + /** + * The name (project, location, cluster) of the cluster to set addons. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetAddonsConfig() { + // Construct request + const request = { + projectId, + zone, + clusterId, + addonsConfig, + }; + + // Run request + const response = await containerClient.setAddonsConfig(request); + console.log(response); + } + + callSetAddonsConfig(); + // [END container_v1beta1_generated_ClusterManager_SetAddonsConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_labels.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_labels.js new file mode 100644 index 00000000000..25237d1b2e1 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_labels.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(projectId, zone, clusterId, resourceLabels, labelFingerprint) { + // [START container_v1beta1_generated_ClusterManager_SetLabels_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The labels to set for that cluster. + */ + // const resourceLabels = [1,2,3,4] + /** + * Required. The fingerprint of the previous set of labels for this resource, + * used to detect conflicts. The fingerprint is initially generated by + * Kubernetes Engine and changes after every request to modify or update + * labels. You must always provide an up-to-date fingerprint hash when + * updating or changing labels. Make a `get()` request to the + * resource to get the latest fingerprint. + */ + // const labelFingerprint = 'abc123' + /** + * The name (project, location, cluster name) of the cluster to set labels. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetLabels() { + // Construct request + const request = { + projectId, + zone, + clusterId, + resourceLabels, + labelFingerprint, + }; + + // Run request + const response = await containerClient.setLabels(request); + console.log(response); + } + + callSetLabels(); + // [END container_v1beta1_generated_ClusterManager_SetLabels_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_legacy_abac.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_legacy_abac.js new file mode 100644 index 00000000000..c59d4c74879 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_legacy_abac.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(projectId, zone, clusterId, enabled) { + // [START container_v1beta1_generated_ClusterManager_SetLegacyAbac_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Whether ABAC authorization will be enabled in the cluster. + */ + // const enabled = true + /** + * The name (project, location, cluster name) of the cluster to set legacy + * abac. Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetLegacyAbac() { + // Construct request + const request = { + projectId, + zone, + clusterId, + enabled, + }; + + // Run request + const response = await containerClient.setLegacyAbac(request); + console.log(response); + } + + callSetLegacyAbac(); + // [END container_v1beta1_generated_ClusterManager_SetLegacyAbac_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_locations.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_locations.js new file mode 100644 index 00000000000..48de1254575 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_locations.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(projectId, zone, clusterId, locations) { + // [START container_v1beta1_generated_ClusterManager_SetLocations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The desired list of Google Compute Engine + * zones (https://cloud.google.com/compute/docs/zones#available) in which the + * cluster's nodes should be located. Changing the locations a cluster is in + * will result in nodes being either created or removed from the cluster, + * depending on whether locations are being added or removed. + * This list must always include the cluster's primary zone. + */ + // const locations = ['abc','def'] + /** + * The name (project, location, cluster) of the cluster to set locations. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetLocations() { + // Construct request + const request = { + projectId, + zone, + clusterId, + locations, + }; + + // Run request + const response = await containerClient.setLocations(request); + console.log(response); + } + + callSetLocations(); + // [END container_v1beta1_generated_ClusterManager_SetLocations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_logging_service.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_logging_service.js new file mode 100644 index 00000000000..e6cd4a0d7f1 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_logging_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(projectId, zone, clusterId, loggingService) { + // [START container_v1beta1_generated_ClusterManager_SetLoggingService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The logging service the cluster should use to write logs. + * Currently available options: + * * `logging.googleapis.com/kubernetes` - The Cloud Logging + * service with a Kubernetes-native resource model + * * `logging.googleapis.com` - The legacy Cloud Logging service (no longer + * available as of GKE 1.15). + * * `none` - no logs will be exported from the cluster. + * If left as an empty string,`logging.googleapis.com/kubernetes` will be + * used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. + */ + // const loggingService = 'abc123' + /** + * The name (project, location, cluster) of the cluster to set logging. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetLoggingService() { + // Construct request + const request = { + projectId, + zone, + clusterId, + loggingService, + }; + + // Run request + const response = await containerClient.setLoggingService(request); + console.log(response); + } + + callSetLoggingService(); + // [END container_v1beta1_generated_ClusterManager_SetLoggingService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_maintenance_policy.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_maintenance_policy.js new file mode 100644 index 00000000000..fa688eb7520 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_maintenance_policy.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(projectId, zone, clusterId, maintenancePolicy) { + // [START container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Developers Console project ID or project + * number (https://cloud.google.com/resource-manager/docs/creating-managing-projects). + */ + // const projectId = 'abc123' + /** + * Required. The name of the Google Compute Engine + * zone (https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. + */ + // const zone = 'abc123' + /** + * Required. The name of the cluster to update. + */ + // const clusterId = 'abc123' + /** + * Required. The maintenance policy to be set for the cluster. An empty field + * clears the existing maintenance policy. + */ + // const maintenancePolicy = {} + /** + * The name (project, location, cluster name) of the cluster to set + * maintenance policy. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetMaintenancePolicy() { + // Construct request + const request = { + projectId, + zone, + clusterId, + maintenancePolicy, + }; + + // Run request + const response = await containerClient.setMaintenancePolicy(request); + console.log(response); + } + + callSetMaintenancePolicy(); + // [END container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_master_auth.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_master_auth.js new file mode 100644 index 00000000000..f39467e7cab --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_master_auth.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(projectId, zone, clusterId, action, update) { + // [START container_v1beta1_generated_ClusterManager_SetMasterAuth_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The exact form of action to be taken on the master auth. + */ + // const action = {} + /** + * Required. A description of the update. + */ + // const update = {} + /** + * The name (project, location, cluster) of the cluster to set auth. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetMasterAuth() { + // Construct request + const request = { + projectId, + zone, + clusterId, + action, + update, + }; + + // Run request + const response = await containerClient.setMasterAuth(request); + console.log(response); + } + + callSetMasterAuth(); + // [END container_v1beta1_generated_ClusterManager_SetMasterAuth_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_monitoring_service.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_monitoring_service.js new file mode 100644 index 00000000000..a7fe3208d49 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_monitoring_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(projectId, zone, clusterId, monitoringService) { + // [START container_v1beta1_generated_ClusterManager_SetMonitoringService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The monitoring service the cluster should use to write metrics. + * Currently available options: + * * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring + * service with a Kubernetes-native resource model + * * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no + * longer available as of GKE 1.15). + * * `none` - No metrics will be exported from the cluster. + * If left as an empty string,`monitoring.googleapis.com/kubernetes` will be + * used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. + */ + // const monitoringService = 'abc123' + /** + * The name (project, location, cluster) of the cluster to set monitoring. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetMonitoringService() { + // Construct request + const request = { + projectId, + zone, + clusterId, + monitoringService, + }; + + // Run request + const response = await containerClient.setMonitoringService(request); + console.log(response); + } + + callSetMonitoringService(); + // [END container_v1beta1_generated_ClusterManager_SetMonitoringService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_network_policy.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_network_policy.js new file mode 100644 index 00000000000..08f2bd01e43 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_network_policy.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(projectId, zone, clusterId, networkPolicy) { + // [START container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Configuration options for the NetworkPolicy feature. + */ + // const networkPolicy = {} + /** + * The name (project, location, cluster name) of the cluster to set networking + * policy. Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetNetworkPolicy() { + // Construct request + const request = { + projectId, + zone, + clusterId, + networkPolicy, + }; + + // Run request + const response = await containerClient.setNetworkPolicy(request); + console.log(response); + } + + callSetNetworkPolicy(); + // [END container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_autoscaling.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_autoscaling.js new file mode 100644 index 00000000000..48045be1f16 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_autoscaling.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(projectId, zone, clusterId, nodePoolId, autoscaling) { + // [START container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Autoscaling configuration for the node pool. + */ + // const autoscaling = {} + /** + * The name (project, location, cluster, node pool) of the node pool to set + * autoscaler settings. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetNodePoolAutoscaling() { + // Construct request + const request = { + projectId, + zone, + clusterId, + nodePoolId, + autoscaling, + }; + + // Run request + const response = await containerClient.setNodePoolAutoscaling(request); + console.log(response); + } + + callSetNodePoolAutoscaling(); + // [END container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_management.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_management.js new file mode 100644 index 00000000000..904e07be6c2 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_management.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(projectId, zone, clusterId, nodePoolId, management) { + // [START container_v1beta1_generated_ClusterManager_SetNodePoolManagement_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. NodeManagement configuration for the node pool. + */ + // const management = {} + /** + * The name (project, location, cluster, node pool id) of the node pool to set + * management properties. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetNodePoolManagement() { + // Construct request + const request = { + projectId, + zone, + clusterId, + nodePoolId, + management, + }; + + // Run request + const response = await containerClient.setNodePoolManagement(request); + console.log(response); + } + + callSetNodePoolManagement(); + // [END container_v1beta1_generated_ClusterManager_SetNodePoolManagement_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_size.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_size.js new file mode 100644 index 00000000000..3903f3ff656 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_size.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(projectId, zone, clusterId, nodePoolId, nodeCount) { + // [START container_v1beta1_generated_ClusterManager_SetNodePoolSize_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The desired node count for the pool. + */ + // const nodeCount = 1234 + /** + * The name (project, location, cluster, node pool id) of the node pool to set + * size. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callSetNodePoolSize() { + // Construct request + const request = { + projectId, + zone, + clusterId, + nodePoolId, + nodeCount, + }; + + // Run request + const response = await containerClient.setNodePoolSize(request); + console.log(response); + } + + callSetNodePoolSize(); + // [END container_v1beta1_generated_ClusterManager_SetNodePoolSize_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.start_i_p_rotation.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.start_i_p_rotation.js new file mode 100644 index 00000000000..181752cb53f --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.start_i_p_rotation.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(projectId, zone, clusterId) { + // [START container_v1beta1_generated_ClusterManager_StartIPRotation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 (project, location, cluster name) of the cluster to start IP + * rotation. Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + /** + * Whether to rotate credentials during IP rotation. + */ + // const rotateCredentials = true + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callStartIPRotation() { + // Construct request + const request = { + projectId, + zone, + clusterId, + }; + + // Run request + const response = await containerClient.startIPRotation(request); + console.log(response); + } + + callStartIPRotation(); + // [END container_v1beta1_generated_ClusterManager_StartIPRotation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_cluster.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_cluster.js new file mode 100644 index 00000000000..23c5ff8b0c8 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_cluster.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(projectId, zone, clusterId, update) { + // [START container_v1beta1_generated_ClusterManager_UpdateCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 description of the update. + */ + // const update = {} + /** + * The name (project, location, cluster) of the cluster to update. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callUpdateCluster() { + // Construct request + const request = { + projectId, + zone, + clusterId, + update, + }; + + // Run request + const response = await containerClient.updateCluster(request); + console.log(response); + } + + callUpdateCluster(); + // [END container_v1beta1_generated_ClusterManager_UpdateCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_master.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_master.js new file mode 100644 index 00000000000..d76efa7a362 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_master.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(projectId, zone, clusterId, masterVersion) { + // [START container_v1beta1_generated_ClusterManager_UpdateMaster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Kubernetes version to change the master to. + * Users may specify either explicit versions offered by + * Kubernetes Engine or version aliases, which have the following behavior: + * - "latest": picks the highest valid Kubernetes version + * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + * - "1.X.Y-gke.N": picks an explicit Kubernetes version + * - "-": picks the default Kubernetes version + */ + // const masterVersion = 'abc123' + /** + * The name (project, location, cluster) of the cluster to update. + * Specified in the format `projects/* /locations/* /clusters/*`. + */ + // const name = 'abc123' + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callUpdateMaster() { + // Construct request + const request = { + projectId, + zone, + clusterId, + masterVersion, + }; + + // Run request + const response = await containerClient.updateMaster(request); + console.log(response); + } + + callUpdateMaster(); + // [END container_v1beta1_generated_ClusterManager_UpdateMaster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_node_pool.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_node_pool.js new file mode 100644 index 00000000000..3ce346d4a1b --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_node_pool.js @@ -0,0 +1,168 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, zone, clusterId, nodePoolId, nodeVersion, imageType) { + // [START container_v1beta1_generated_ClusterManager_UpdateNodePool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Kubernetes version to change the nodes to (typically an + * upgrade). + * Users may specify either explicit versions offered by Kubernetes Engine or + * version aliases, which have the following behavior: + * - "latest": picks the highest valid Kubernetes version + * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + * - "1.X.Y-gke.N": picks an explicit Kubernetes version + * - "-": picks the Kubernetes master version + */ + // const nodeVersion = 'abc123' + /** + * Required. The desired image type for the node pool. Please see + * https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for + * available image types. + */ + // const imageType = 'abc123' + /** + * The desired list of Google Compute Engine + * zones (https://cloud.google.com/compute/docs/zones#available) in which the + * node pool's nodes should be located. Changing the locations for a node pool + * will result in nodes being either created or removed from the node pool, + * depending on whether locations are being added or removed. + */ + // const locations = ['abc','def'] + /** + * The desired workload metadata config for the node pool. + */ + // const workloadMetadataConfig = {} + /** + * The name (project, location, cluster, node pool) of the node pool to + * update. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + */ + // const name = 'abc123' + /** + * Upgrade settings control disruption and speed of the upgrade. + */ + // const upgradeSettings = {} + /** + * The desired network tags to be applied to all nodes in the node pool. + * If this field is not present, the tags will not be changed. Otherwise, + * the existing network tags will be *replaced* with the provided tags. + */ + // const tags = {} + /** + * The desired node taints to be applied to all nodes in the node pool. + * If this field is not present, the taints will not be changed. Otherwise, + * the existing node taints will be *replaced* with the provided taints. + */ + // const taints = {} + /** + * The desired node labels to be applied to all nodes in the node pool. + * If this field is not present, the labels will not be changed. Otherwise, + * the existing node labels will be *replaced* with the provided labels. + */ + // const labels = {} + /** + * Parameters that can be configured on Linux nodes. + */ + // const linuxNodeConfig = {} + /** + * Node kubelet configs. + */ + // const kubeletConfig = {} + /** + * Node network config. + */ + // const nodeNetworkConfig = {} + /** + * GCFS config. + */ + // const gcfsConfig = {} + /** + * Confidential nodes config. + * All the nodes in the node pool will be Confidential VM once enabled. + */ + // const confidentialNodes = {} + /** + * Enable or disable gvnic on the node pool. + */ + // const gvnic = {} + /** + * The current etag of the node pool. + * If an etag is provided and does not match the current etag of the node + * pool, update will be blocked and an ABORTED error will be returned. + */ + // const etag = 'abc123' + /** + * Enable or disable NCCL fast socket for the node pool. + */ + // const fastSocket = {} + /** + * Logging configuration. + */ + // const loggingConfig = {} + /** + * The resource labels for the node pool to use to annotate any related + * Google Compute Engine resources. + */ + // const resourceLabels = {} + /** + * Parameters that can be configured on Windows nodes. + */ + // const windowsNodeConfig = {} + + // Imports the Container library + const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; + + // Instantiates a client + const containerClient = new ClusterManagerClient(); + + async function callUpdateNodePool() { + // Construct request + const request = { + projectId, + zone, + clusterId, + nodePoolId, + nodeVersion, + imageType, + }; + + // Run request + const response = await containerClient.updateNodePool(request); + console.log(response); + } + + callUpdateNodePool(); + // [END container_v1beta1_generated_ClusterManager_UpdateNodePool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/snippet_metadata_google.container.v1beta1.json b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/snippet_metadata_google.container.v1beta1.json new file mode 100644 index 00000000000..5e5c05ee1ca --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/snippet_metadata_google.container.v1beta1.json @@ -0,0 +1,1955 @@ +{ + "clientLibrary": { + "name": "nodejs-container", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.container.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "container_v1beta1_generated_ClusterManager_ListClusters_async", + "title": "ClusterManager listClusters Sample", + "origin": "API_DEFINITION", + "description": " Lists all clusters owned by a project in either the specified zone or all zones.", + "canonical": true, + "file": "cluster_manager.list_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListClusters", + "fullName": "google.container.v1beta1.ClusterManager.ListClusters", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.ListClustersResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "ListClusters", + "fullName": "google.container.v1beta1.ClusterManager.ListClusters", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_GetCluster_async", + "title": "ClusterManager getCluster Sample", + "origin": "API_DEFINITION", + "description": " Gets the details for a specific cluster.", + "canonical": true, + "file": "cluster_manager.get_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCluster", + "fullName": "google.container.v1beta1.ClusterManager.GetCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Cluster", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "GetCluster", + "fullName": "google.container.v1beta1.ClusterManager.GetCluster", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_CreateCluster_async", + "title": "ClusterManager createCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's [default network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.", + "canonical": true, + "file": "cluster_manager.create_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCluster", + "fullName": "google.container.v1beta1.ClusterManager.CreateCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster", + "type": ".google.container.v1beta1.Cluster" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "CreateCluster", + "fullName": "google.container.v1beta1.ClusterManager.CreateCluster", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_UpdateCluster_async", + "title": "ClusterManager updateCluster Sample", + "origin": "API_DEFINITION", + "description": " Updates the settings for a specific cluster.", + "canonical": true, + "file": "cluster_manager.update_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCluster", + "fullName": "google.container.v1beta1.ClusterManager.UpdateCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "update", + "type": ".google.container.v1beta1.ClusterUpdate" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "UpdateCluster", + "fullName": "google.container.v1beta1.ClusterManager.UpdateCluster", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_UpdateNodePool_async", + "title": "ClusterManager updateNodePool Sample", + "origin": "API_DEFINITION", + "description": " Updates the version and/or image type of a specific node pool.", + "canonical": true, + "file": "cluster_manager.update_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 160, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNodePool", + "fullName": "google.container.v1beta1.ClusterManager.UpdateNodePool", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "node_version", + "type": "TYPE_STRING" + }, + { + "name": "image_type", + "type": "TYPE_STRING" + }, + { + "name": "locations", + "type": "TYPE_STRING[]" + }, + { + "name": "workload_metadata_config", + "type": ".google.container.v1beta1.WorkloadMetadataConfig" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "upgrade_settings", + "type": ".google.container.v1beta1.NodePool.UpgradeSettings" + }, + { + "name": "tags", + "type": ".google.container.v1beta1.NetworkTags" + }, + { + "name": "taints", + "type": ".google.container.v1beta1.NodeTaints" + }, + { + "name": "labels", + "type": ".google.container.v1beta1.NodeLabels" + }, + { + "name": "linux_node_config", + "type": ".google.container.v1beta1.LinuxNodeConfig" + }, + { + "name": "kubelet_config", + "type": ".google.container.v1beta1.NodeKubeletConfig" + }, + { + "name": "node_network_config", + "type": ".google.container.v1beta1.NodeNetworkConfig" + }, + { + "name": "gcfs_config", + "type": ".google.container.v1beta1.GcfsConfig" + }, + { + "name": "confidential_nodes", + "type": ".google.container.v1beta1.ConfidentialNodes" + }, + { + "name": "gvnic", + "type": ".google.container.v1beta1.VirtualNIC" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "fast_socket", + "type": ".google.container.v1beta1.FastSocket" + }, + { + "name": "logging_config", + "type": ".google.container.v1beta1.NodePoolLoggingConfig" + }, + { + "name": "resource_labels", + "type": ".google.container.v1beta1.ResourceLabels" + }, + { + "name": "windows_node_config", + "type": ".google.container.v1beta1.WindowsNodeConfig" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "UpdateNodePool", + "fullName": "google.container.v1beta1.ClusterManager.UpdateNodePool", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_async", + "title": "ClusterManager setNodePoolAutoscaling Sample", + "origin": "API_DEFINITION", + "description": " Sets the autoscaling settings of a specific node pool.", + "canonical": true, + "file": "cluster_manager.set_node_pool_autoscaling.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetNodePoolAutoscaling", + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolAutoscaling", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "autoscaling", + "type": ".google.container.v1beta1.NodePoolAutoscaling" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetNodePoolAutoscaling", + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolAutoscaling", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetLoggingService_async", + "title": "ClusterManager setLoggingService Sample", + "origin": "API_DEFINITION", + "description": " Sets the logging service for a specific cluster.", + "canonical": true, + "file": "cluster_manager.set_logging_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetLoggingService", + "fullName": "google.container.v1beta1.ClusterManager.SetLoggingService", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "logging_service", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetLoggingService", + "fullName": "google.container.v1beta1.ClusterManager.SetLoggingService", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetMonitoringService_async", + "title": "ClusterManager setMonitoringService Sample", + "origin": "API_DEFINITION", + "description": " Sets the monitoring service for a specific cluster.", + "canonical": true, + "file": "cluster_manager.set_monitoring_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetMonitoringService", + "fullName": "google.container.v1beta1.ClusterManager.SetMonitoringService", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "monitoring_service", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetMonitoringService", + "fullName": "google.container.v1beta1.ClusterManager.SetMonitoringService", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetAddonsConfig_async", + "title": "ClusterManager setAddonsConfig Sample", + "origin": "API_DEFINITION", + "description": " Sets the addons for a specific cluster.", + "canonical": true, + "file": "cluster_manager.set_addons_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetAddonsConfig", + "fullName": "google.container.v1beta1.ClusterManager.SetAddonsConfig", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "addons_config", + "type": ".google.container.v1beta1.AddonsConfig" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetAddonsConfig", + "fullName": "google.container.v1beta1.ClusterManager.SetAddonsConfig", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetLocations_async", + "title": "ClusterManager setLocations Sample", + "origin": "API_DEFINITION", + "description": " Sets the locations for a specific cluster. Deprecated. Use [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters/update) instead.", + "canonical": true, + "file": "cluster_manager.set_locations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetLocations", + "fullName": "google.container.v1beta1.ClusterManager.SetLocations", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "locations", + "type": "TYPE_STRING[]" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetLocations", + "fullName": "google.container.v1beta1.ClusterManager.SetLocations", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_UpdateMaster_async", + "title": "ClusterManager updateMaster Sample", + "origin": "API_DEFINITION", + "description": " Updates the master for a specific cluster.", + "canonical": true, + "file": "cluster_manager.update_master.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMaster", + "fullName": "google.container.v1beta1.ClusterManager.UpdateMaster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "master_version", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "UpdateMaster", + "fullName": "google.container.v1beta1.ClusterManager.UpdateMaster", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetMasterAuth_async", + "title": "ClusterManager setMasterAuth Sample", + "origin": "API_DEFINITION", + "description": " Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.", + "canonical": true, + "file": "cluster_manager.set_master_auth.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetMasterAuth", + "fullName": "google.container.v1beta1.ClusterManager.SetMasterAuth", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "action", + "type": ".google.container.v1beta1.SetMasterAuthRequest.Action" + }, + { + "name": "update", + "type": ".google.container.v1beta1.MasterAuth" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetMasterAuth", + "fullName": "google.container.v1beta1.ClusterManager.SetMasterAuth", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_DeleteCluster_async", + "title": "ClusterManager deleteCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.", + "canonical": true, + "file": "cluster_manager.delete_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteCluster", + "fullName": "google.container.v1beta1.ClusterManager.DeleteCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "DeleteCluster", + "fullName": "google.container.v1beta1.ClusterManager.DeleteCluster", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_ListOperations_async", + "title": "ClusterManager listOperations Sample", + "origin": "API_DEFINITION", + "description": " Lists all operations in a project in the specified zone or all zones.", + "canonical": true, + "file": "cluster_manager.list_operations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListOperations", + "fullName": "google.container.v1beta1.ClusterManager.ListOperations", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.ListOperationsResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "ListOperations", + "fullName": "google.container.v1beta1.ClusterManager.ListOperations", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_GetOperation_async", + "title": "ClusterManager getOperation Sample", + "origin": "API_DEFINITION", + "description": " Gets the specified operation.", + "canonical": true, + "file": "cluster_manager.get_operation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOperation", + "fullName": "google.container.v1beta1.ClusterManager.GetOperation", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "operation_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "GetOperation", + "fullName": "google.container.v1beta1.ClusterManager.GetOperation", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_CancelOperation_async", + "title": "ClusterManager cancelOperation Sample", + "origin": "API_DEFINITION", + "description": " Cancels the specified operation.", + "canonical": true, + "file": "cluster_manager.cancel_operation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CancelOperation", + "fullName": "google.container.v1beta1.ClusterManager.CancelOperation", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "operation_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "CancelOperation", + "fullName": "google.container.v1beta1.ClusterManager.CancelOperation", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_GetServerConfig_async", + "title": "ClusterManager getServerConfig Sample", + "origin": "API_DEFINITION", + "description": " Returns configuration info about the Google Kubernetes Engine service.", + "canonical": true, + "file": "cluster_manager.get_server_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetServerConfig", + "fullName": "google.container.v1beta1.ClusterManager.GetServerConfig", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.ServerConfig", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "GetServerConfig", + "fullName": "google.container.v1beta1.ClusterManager.GetServerConfig", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async", + "title": "ClusterManager getJSONWebKeys Sample", + "origin": "API_DEFINITION", + "description": " Gets the public component of the cluster signing keys in JSON Web Key format. This API is not yet intended for general use, and is not available for all clusters.", + "canonical": true, + "file": "cluster_manager.get_j_s_o_n_web_keys.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetJSONWebKeys", + "fullName": "google.container.v1beta1.ClusterManager.GetJSONWebKeys", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.GetJSONWebKeysResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "GetJSONWebKeys", + "fullName": "google.container.v1beta1.ClusterManager.GetJSONWebKeys", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_ListNodePools_async", + "title": "ClusterManager listNodePools Sample", + "origin": "API_DEFINITION", + "description": " Lists the node pools for a cluster.", + "canonical": true, + "file": "cluster_manager.list_node_pools.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNodePools", + "fullName": "google.container.v1beta1.ClusterManager.ListNodePools", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.ListNodePoolsResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "ListNodePools", + "fullName": "google.container.v1beta1.ClusterManager.ListNodePools", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_GetNodePool_async", + "title": "ClusterManager getNodePool Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the requested node pool.", + "canonical": true, + "file": "cluster_manager.get_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNodePool", + "fullName": "google.container.v1beta1.ClusterManager.GetNodePool", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.NodePool", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "GetNodePool", + "fullName": "google.container.v1beta1.ClusterManager.GetNodePool", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_CreateNodePool_async", + "title": "ClusterManager createNodePool Sample", + "origin": "API_DEFINITION", + "description": " Creates a node pool for a cluster.", + "canonical": true, + "file": "cluster_manager.create_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNodePool", + "fullName": "google.container.v1beta1.ClusterManager.CreateNodePool", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool", + "type": ".google.container.v1beta1.NodePool" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "CreateNodePool", + "fullName": "google.container.v1beta1.ClusterManager.CreateNodePool", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_DeleteNodePool_async", + "title": "ClusterManager deleteNodePool Sample", + "origin": "API_DEFINITION", + "description": " Deletes a node pool from a cluster.", + "canonical": true, + "file": "cluster_manager.delete_node_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNodePool", + "fullName": "google.container.v1beta1.ClusterManager.DeleteNodePool", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "DeleteNodePool", + "fullName": "google.container.v1beta1.ClusterManager.DeleteNodePool", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async", + "title": "ClusterManager completeNodePoolUpgrade Sample", + "origin": "API_DEFINITION", + "description": " CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.", + "canonical": true, + "file": "cluster_manager.complete_node_pool_upgrade.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteNodePoolUpgrade", + "fullName": "google.container.v1beta1.ClusterManager.CompleteNodePoolUpgrade", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "CompleteNodePoolUpgrade", + "fullName": "google.container.v1beta1.ClusterManager.CompleteNodePoolUpgrade", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_async", + "title": "ClusterManager rollbackNodePoolUpgrade Sample", + "origin": "API_DEFINITION", + "description": " Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.", + "canonical": true, + "file": "cluster_manager.rollback_node_pool_upgrade.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RollbackNodePoolUpgrade", + "fullName": "google.container.v1beta1.ClusterManager.RollbackNodePoolUpgrade", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "respect_pdb", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "RollbackNodePoolUpgrade", + "fullName": "google.container.v1beta1.ClusterManager.RollbackNodePoolUpgrade", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolManagement_async", + "title": "ClusterManager setNodePoolManagement Sample", + "origin": "API_DEFINITION", + "description": " Sets the NodeManagement options for a node pool.", + "canonical": true, + "file": "cluster_manager.set_node_pool_management.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetNodePoolManagement", + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolManagement", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "management", + "type": ".google.container.v1beta1.NodeManagement" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetNodePoolManagement", + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolManagement", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetLabels_async", + "title": "ClusterManager setLabels Sample", + "origin": "API_DEFINITION", + "description": " Sets labels on a cluster.", + "canonical": true, + "file": "cluster_manager.set_labels.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetLabels", + "fullName": "google.container.v1beta1.ClusterManager.SetLabels", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "resource_labels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "label_fingerprint", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetLabels", + "fullName": "google.container.v1beta1.ClusterManager.SetLabels", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetLegacyAbac_async", + "title": "ClusterManager setLegacyAbac Sample", + "origin": "API_DEFINITION", + "description": " Enables or disables the ABAC authorization mechanism on a cluster.", + "canonical": true, + "file": "cluster_manager.set_legacy_abac.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetLegacyAbac", + "fullName": "google.container.v1beta1.ClusterManager.SetLegacyAbac", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "enabled", + "type": "TYPE_BOOL" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetLegacyAbac", + "fullName": "google.container.v1beta1.ClusterManager.SetLegacyAbac", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_StartIPRotation_async", + "title": "ClusterManager startIPRotation Sample", + "origin": "API_DEFINITION", + "description": " Starts master IP rotation.", + "canonical": true, + "file": "cluster_manager.start_i_p_rotation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartIPRotation", + "fullName": "google.container.v1beta1.ClusterManager.StartIPRotation", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "rotate_credentials", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "StartIPRotation", + "fullName": "google.container.v1beta1.ClusterManager.StartIPRotation", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_CompleteIPRotation_async", + "title": "ClusterManager completeIPRotation Sample", + "origin": "API_DEFINITION", + "description": " Completes master IP rotation.", + "canonical": true, + "file": "cluster_manager.complete_i_p_rotation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteIPRotation", + "fullName": "google.container.v1beta1.ClusterManager.CompleteIPRotation", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "CompleteIPRotation", + "fullName": "google.container.v1beta1.ClusterManager.CompleteIPRotation", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolSize_async", + "title": "ClusterManager setNodePoolSize Sample", + "origin": "API_DEFINITION", + "description": " SetNodePoolSizeRequest sets the size of a node pool. The new size will be used for all replicas, including future replicas created by modifying [NodePool.locations][google.container.v1beta1.NodePool.locations].", + "canonical": true, + "file": "cluster_manager.set_node_pool_size.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetNodePoolSize", + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolSize", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "node_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "node_count", + "type": "TYPE_INT32" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetNodePoolSize", + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolSize", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async", + "title": "ClusterManager setNetworkPolicy Sample", + "origin": "API_DEFINITION", + "description": " Enables or disables Network Policy for a cluster.", + "canonical": true, + "file": "cluster_manager.set_network_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetNetworkPolicy", + "fullName": "google.container.v1beta1.ClusterManager.SetNetworkPolicy", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "network_policy", + "type": ".google.container.v1beta1.NetworkPolicy" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetNetworkPolicy", + "fullName": "google.container.v1beta1.ClusterManager.SetNetworkPolicy", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async", + "title": "ClusterManager setMaintenancePolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the maintenance policy for a cluster.", + "canonical": true, + "file": "cluster_manager.set_maintenance_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetMaintenancePolicy", + "fullName": "google.container.v1beta1.ClusterManager.SetMaintenancePolicy", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "zone", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "maintenance_policy", + "type": ".google.container.v1beta1.MaintenancePolicy" + }, + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.Operation", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "SetMaintenancePolicy", + "fullName": "google.container.v1beta1.ClusterManager.SetMaintenancePolicy", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_async", + "title": "ClusterManager listUsableSubnetworks Sample", + "origin": "API_DEFINITION", + "description": " Lists subnetworks that can be used for creating clusters in a project.", + "canonical": true, + "file": "cluster_manager.list_usable_subnetworks.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListUsableSubnetworks", + "fullName": "google.container.v1beta1.ClusterManager.ListUsableSubnetworks", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.ListUsableSubnetworksResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "ListUsableSubnetworks", + "fullName": "google.container.v1beta1.ClusterManager.ListUsableSubnetworks", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async", + "title": "ClusterManager checkAutopilotCompatibility Sample", + "origin": "API_DEFINITION", + "description": " Checks the cluster compatibility with Autopilot mode, and returns a list of compatibility issues.", + "canonical": true, + "file": "cluster_manager.check_autopilot_compatibility.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CheckAutopilotCompatibility", + "fullName": "google.container.v1beta1.ClusterManager.CheckAutopilotCompatibility", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.CheckAutopilotCompatibilityResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "CheckAutopilotCompatibility", + "fullName": "google.container.v1beta1.ClusterManager.CheckAutopilotCompatibility", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + }, + { + "regionTag": "container_v1beta1_generated_ClusterManager_ListLocations_async", + "title": "ClusterManager listLocations Sample", + "origin": "API_DEFINITION", + "description": " Fetches locations that offer Google Kubernetes Engine.", + "canonical": true, + "file": "cluster_manager.list_locations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListLocations", + "fullName": "google.container.v1beta1.ClusterManager.ListLocations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.container.v1beta1.ListLocationsResponse", + "client": { + "shortName": "ClusterManagerClient", + "fullName": "google.container.v1beta1.ClusterManagerClient" + }, + "method": { + "shortName": "ListLocations", + "fullName": "google.container.v1beta1.ClusterManager.ListLocations", + "service": { + "shortName": "ClusterManager", + "fullName": "google.container.v1beta1.ClusterManager" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-container/v1beta1/src/index.ts b/owl-bot-staging/google-container/v1beta1/src/index.ts new file mode 100644 index 00000000000..44cbef9d2d2 --- /dev/null +++ b/owl-bot-staging/google-container/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 ClusterManagerClient = v1beta1.ClusterManagerClient; +type ClusterManagerClient = v1beta1.ClusterManagerClient; +export {v1beta1, ClusterManagerClient}; +export default {v1beta1, ClusterManagerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client.ts b/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client.ts new file mode 100644 index 00000000000..f8d0392d180 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client.ts @@ -0,0 +1,3585 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1beta1/cluster_manager_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cluster_manager_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Google Kubernetes Engine Cluster Manager v1beta1 + * @class + * @memberof v1beta1 + */ +export class ClusterManagerClient { + 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}; + clusterManagerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ClusterManagerClient. + * + * @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 ClusterManagerClient({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 ClusterManagerClient; + 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 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 = { + listUsableSubnetworks: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'subnetworks') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.container.v1beta1.ClusterManager', 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.clusterManagerStub) { + return this.clusterManagerStub; + } + + // Put together the "service stub" for + // google.container.v1beta1.ClusterManager. + this.clusterManagerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.container.v1beta1.ClusterManager') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.container.v1beta1.ClusterManager, + 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 clusterManagerStubMethods = + ['listClusters', 'getCluster', 'createCluster', 'updateCluster', 'updateNodePool', 'setNodePoolAutoscaling', 'setLoggingService', 'setMonitoringService', 'setAddonsConfig', 'setLocations', 'updateMaster', 'setMasterAuth', 'deleteCluster', 'listOperations', 'getOperation', 'cancelOperation', 'getServerConfig', 'getJsonWebKeys', 'listNodePools', 'getNodePool', 'createNodePool', 'deleteNodePool', 'completeNodePoolUpgrade', 'rollbackNodePoolUpgrade', 'setNodePoolManagement', 'setLabels', 'setLegacyAbac', 'startIpRotation', 'completeIpRotation', 'setNodePoolSize', 'setNetworkPolicy', 'setMaintenancePolicy', 'listUsableSubnetworks', 'checkAutopilotCompatibility', 'listLocations']; + for (const methodName of clusterManagerStubMethods) { + const callPromise = this.clusterManagerStub.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.clusterManagerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'container.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 'container.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 all clusters owned by a project in either the specified zone or all + * zones. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the parent field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides, or "-" for all zones. This field has been deprecated and + * replaced by the parent field. + * @param {string} request.parent + * The parent (project and location) where the clusters will be listed. + * Specified in the format `projects/* /locations/*`. + * Location "-" matches all zones and all regions. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.ListClustersResponse|ListClustersResponse}. + * Please see the {@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/cluster_manager.list_clusters.js + * region_tag:container_v1beta1_generated_ClusterManager_ListClusters_async + */ + listClusters( + request?: protos.google.container.v1beta1.IListClustersRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IListClustersResponse, + protos.google.container.v1beta1.IListClustersRequest|undefined, {}|undefined + ]>; + listClusters( + request: protos.google.container.v1beta1.IListClustersRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IListClustersResponse, + protos.google.container.v1beta1.IListClustersRequest|null|undefined, + {}|null|undefined>): void; + listClusters( + request: protos.google.container.v1beta1.IListClustersRequest, + callback: Callback< + protos.google.container.v1beta1.IListClustersResponse, + protos.google.container.v1beta1.IListClustersRequest|null|undefined, + {}|null|undefined>): void; + listClusters( + request?: protos.google.container.v1beta1.IListClustersRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IListClustersResponse, + protos.google.container.v1beta1.IListClustersRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IListClustersResponse, + protos.google.container.v1beta1.IListClustersRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IListClustersResponse, + protos.google.container.v1beta1.IListClustersRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + }); + this.initialize(); + return this.innerApiCalls.listClusters(request, options, callback); + } +/** + * Gets the details for a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to retrieve. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to retrieve. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Cluster|Cluster}. + * Please see the {@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/cluster_manager.get_cluster.js + * region_tag:container_v1beta1_generated_ClusterManager_GetCluster_async + */ + getCluster( + request?: protos.google.container.v1beta1.IGetClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.ICluster, + protos.google.container.v1beta1.IGetClusterRequest|undefined, {}|undefined + ]>; + getCluster( + request: protos.google.container.v1beta1.IGetClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.ICluster, + protos.google.container.v1beta1.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; + getCluster( + request: protos.google.container.v1beta1.IGetClusterRequest, + callback: Callback< + protos.google.container.v1beta1.ICluster, + protos.google.container.v1beta1.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; + getCluster( + request?: protos.google.container.v1beta1.IGetClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.ICluster, + protos.google.container.v1beta1.IGetClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.ICluster, + protos.google.container.v1beta1.IGetClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.ICluster, + protos.google.container.v1beta1.IGetClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getCluster(request, options, callback); + } +/** + * Creates a cluster, consisting of the specified number and type of Google + * Compute Engine instances. + * + * By default, the cluster is created in the project's + * [default + * network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). + * + * One firewall is added for the cluster. After cluster creation, + * the Kubelet creates routes for each node to allow the containers + * on that node to communicate with all other instances in the + * cluster. + * + * Finally, an entry is added to the project's global metadata indicating + * which CIDR range the cluster is using. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the parent field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the parent + * field. + * @param {google.container.v1beta1.Cluster} request.cluster + * Required. A [cluster + * resource](https://cloud.google.com/container-engine/reference/rest/v1beta1/projects.locations.clusters) + * @param {string} request.parent + * The parent (project and location) where the cluster will be created. + * Specified in the format `projects/* /locations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.create_cluster.js + * region_tag:container_v1beta1_generated_ClusterManager_CreateCluster_async + */ + createCluster( + request?: protos.google.container.v1beta1.ICreateClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateClusterRequest|undefined, {}|undefined + ]>; + createCluster( + request: protos.google.container.v1beta1.ICreateClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateClusterRequest|null|undefined, + {}|null|undefined>): void; + createCluster( + request: protos.google.container.v1beta1.ICreateClusterRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateClusterRequest|null|undefined, + {}|null|undefined>): void; + createCluster( + request?: protos.google.container.v1beta1.ICreateClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + }); + this.initialize(); + return this.innerApiCalls.createCluster(request, options, callback); + } +/** + * Updates the settings for a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1beta1.ClusterUpdate} request.update + * Required. A description of the update. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to update. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.update_cluster.js + * region_tag:container_v1beta1_generated_ClusterManager_UpdateCluster_async + */ + updateCluster( + request?: protos.google.container.v1beta1.IUpdateClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateClusterRequest|undefined, {}|undefined + ]>; + updateCluster( + request: protos.google.container.v1beta1.IUpdateClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateClusterRequest|null|undefined, + {}|null|undefined>): void; + updateCluster( + request: protos.google.container.v1beta1.IUpdateClusterRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateClusterRequest|null|undefined, + {}|null|undefined>): void; + updateCluster( + request?: protos.google.container.v1beta1.IUpdateClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCluster(request, options, callback); + } +/** + * Updates the version and/or image type of a specific node pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Required. Deprecated. The name of the node pool to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodeVersion + * Required. The Kubernetes version to change the nodes to (typically an + * upgrade). + * + * Users may specify either explicit versions offered by Kubernetes Engine or + * version aliases, which have the following behavior: + * + * - "latest": picks the highest valid Kubernetes version + * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + * - "1.X.Y-gke.N": picks an explicit Kubernetes version + * - "-": picks the Kubernetes master version + * @param {string} request.imageType + * Required. The desired image type for the node pool. Please see + * https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for + * available image types. + * @param {string[]} request.locations + * The desired list of Google Compute Engine + * [zones](https://cloud.google.com/compute/docs/zones#available) in which the + * node pool's nodes should be located. Changing the locations for a node pool + * will result in nodes being either created or removed from the node pool, + * depending on whether locations are being added or removed. + * @param {google.container.v1beta1.WorkloadMetadataConfig} request.workloadMetadataConfig + * The desired workload metadata config for the node pool. + * @param {string} request.name + * The name (project, location, cluster, node pool) of the node pool to + * update. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {google.container.v1beta1.NodePool.UpgradeSettings} request.upgradeSettings + * Upgrade settings control disruption and speed of the upgrade. + * @param {google.container.v1beta1.NetworkTags} request.tags + * The desired network tags to be applied to all nodes in the node pool. + * If this field is not present, the tags will not be changed. Otherwise, + * the existing network tags will be *replaced* with the provided tags. + * @param {google.container.v1beta1.NodeTaints} request.taints + * The desired node taints to be applied to all nodes in the node pool. + * If this field is not present, the taints will not be changed. Otherwise, + * the existing node taints will be *replaced* with the provided taints. + * @param {google.container.v1beta1.NodeLabels} request.labels + * The desired node labels to be applied to all nodes in the node pool. + * If this field is not present, the labels will not be changed. Otherwise, + * the existing node labels will be *replaced* with the provided labels. + * @param {google.container.v1beta1.LinuxNodeConfig} request.linuxNodeConfig + * Parameters that can be configured on Linux nodes. + * @param {google.container.v1beta1.NodeKubeletConfig} request.kubeletConfig + * Node kubelet configs. + * @param {google.container.v1beta1.NodeNetworkConfig} request.nodeNetworkConfig + * Node network config. + * @param {google.container.v1beta1.GcfsConfig} request.gcfsConfig + * GCFS config. + * @param {google.container.v1beta1.ConfidentialNodes} request.confidentialNodes + * Confidential nodes config. + * All the nodes in the node pool will be Confidential VM once enabled. + * @param {google.container.v1beta1.VirtualNIC} request.gvnic + * Enable or disable gvnic on the node pool. + * @param {string} request.etag + * The current etag of the node pool. + * If an etag is provided and does not match the current etag of the node + * pool, update will be blocked and an ABORTED error will be returned. + * @param {google.container.v1beta1.FastSocket} request.fastSocket + * Enable or disable NCCL fast socket for the node pool. + * @param {google.container.v1beta1.NodePoolLoggingConfig} request.loggingConfig + * Logging configuration. + * @param {google.container.v1beta1.ResourceLabels} request.resourceLabels + * The resource labels for the node pool to use to annotate any related + * Google Compute Engine resources. + * @param {google.container.v1beta1.WindowsNodeConfig} request.windowsNodeConfig + * Parameters that can be configured on Windows nodes. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.update_node_pool.js + * region_tag:container_v1beta1_generated_ClusterManager_UpdateNodePool_async + */ + updateNodePool( + request?: protos.google.container.v1beta1.IUpdateNodePoolRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateNodePoolRequest|undefined, {}|undefined + ]>; + updateNodePool( + request: protos.google.container.v1beta1.IUpdateNodePoolRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateNodePoolRequest|null|undefined, + {}|null|undefined>): void; + updateNodePool( + request: protos.google.container.v1beta1.IUpdateNodePoolRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateNodePoolRequest|null|undefined, + {}|null|undefined>): void; + updateNodePool( + request?: protos.google.container.v1beta1.IUpdateNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateNodePoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateNodePoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateNodePoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateNodePool(request, options, callback); + } +/** + * Sets the autoscaling settings of a specific node pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Required. Deprecated. The name of the node pool to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1beta1.NodePoolAutoscaling} request.autoscaling + * Required. Autoscaling configuration for the node pool. + * @param {string} request.name + * The name (project, location, cluster, node pool) of the node pool to set + * autoscaler settings. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_node_pool_autoscaling.js + * region_tag:container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_async + */ + setNodePoolAutoscaling( + request?: protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|undefined, {}|undefined + ]>; + setNodePoolAutoscaling( + request: protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolAutoscaling( + request: protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolAutoscaling( + request?: protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setNodePoolAutoscaling(request, options, callback); + } +/** + * Sets the logging service for a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.loggingService + * Required. The logging service the cluster should use to write logs. + * Currently available options: + * + * * `logging.googleapis.com/kubernetes` - The Cloud Logging + * service with a Kubernetes-native resource model + * * `logging.googleapis.com` - The legacy Cloud Logging service (no longer + * available as of GKE 1.15). + * * `none` - no logs will be exported from the cluster. + * + * If left as an empty string,`logging.googleapis.com/kubernetes` will be + * used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to set logging. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_logging_service.js + * region_tag:container_v1beta1_generated_ClusterManager_SetLoggingService_async + */ + setLoggingService( + request?: protos.google.container.v1beta1.ISetLoggingServiceRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLoggingServiceRequest|undefined, {}|undefined + ]>; + setLoggingService( + request: protos.google.container.v1beta1.ISetLoggingServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLoggingServiceRequest|null|undefined, + {}|null|undefined>): void; + setLoggingService( + request: protos.google.container.v1beta1.ISetLoggingServiceRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLoggingServiceRequest|null|undefined, + {}|null|undefined>): void; + setLoggingService( + request?: protos.google.container.v1beta1.ISetLoggingServiceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLoggingServiceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLoggingServiceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLoggingServiceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setLoggingService(request, options, callback); + } +/** + * Sets the monitoring service for a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.monitoringService + * Required. The monitoring service the cluster should use to write metrics. + * Currently available options: + * + * * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring + * service with a Kubernetes-native resource model + * * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no + * longer available as of GKE 1.15). + * * `none` - No metrics will be exported from the cluster. + * + * If left as an empty string,`monitoring.googleapis.com/kubernetes` will be + * used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to set monitoring. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_monitoring_service.js + * region_tag:container_v1beta1_generated_ClusterManager_SetMonitoringService_async + */ + setMonitoringService( + request?: protos.google.container.v1beta1.ISetMonitoringServiceRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMonitoringServiceRequest|undefined, {}|undefined + ]>; + setMonitoringService( + request: protos.google.container.v1beta1.ISetMonitoringServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMonitoringServiceRequest|null|undefined, + {}|null|undefined>): void; + setMonitoringService( + request: protos.google.container.v1beta1.ISetMonitoringServiceRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMonitoringServiceRequest|null|undefined, + {}|null|undefined>): void; + setMonitoringService( + request?: protos.google.container.v1beta1.ISetMonitoringServiceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMonitoringServiceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMonitoringServiceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMonitoringServiceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setMonitoringService(request, options, callback); + } +/** + * Sets the addons for a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1beta1.AddonsConfig} request.addonsConfig + * Required. The desired configurations for the various addons available to + * run in the cluster. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to set addons. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_addons_config.js + * region_tag:container_v1beta1_generated_ClusterManager_SetAddonsConfig_async + */ + setAddonsConfig( + request?: protos.google.container.v1beta1.ISetAddonsConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetAddonsConfigRequest|undefined, {}|undefined + ]>; + setAddonsConfig( + request: protos.google.container.v1beta1.ISetAddonsConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetAddonsConfigRequest|null|undefined, + {}|null|undefined>): void; + setAddonsConfig( + request: protos.google.container.v1beta1.ISetAddonsConfigRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetAddonsConfigRequest|null|undefined, + {}|null|undefined>): void; + setAddonsConfig( + request?: protos.google.container.v1beta1.ISetAddonsConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetAddonsConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetAddonsConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetAddonsConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setAddonsConfig(request, options, callback); + } +/** + * Sets the locations for a specific cluster. + * Deprecated. Use + * [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters/update) + * instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string[]} request.locations + * Required. The desired list of Google Compute Engine + * [zones](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster's nodes should be located. Changing the locations a cluster is in + * will result in nodes being either created or removed from the cluster, + * depending on whether locations are being added or removed. + * + * This list must always include the cluster's primary zone. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to set locations. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_locations.js + * region_tag:container_v1beta1_generated_ClusterManager_SetLocations_async + * @deprecated SetLocations is deprecated and may be removed in a future version. + */ + setLocations( + request?: protos.google.container.v1beta1.ISetLocationsRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLocationsRequest|undefined, {}|undefined + ]>; + setLocations( + request: protos.google.container.v1beta1.ISetLocationsRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLocationsRequest|null|undefined, + {}|null|undefined>): void; + setLocations( + request: protos.google.container.v1beta1.ISetLocationsRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLocationsRequest|null|undefined, + {}|null|undefined>): void; + setLocations( + request?: protos.google.container.v1beta1.ISetLocationsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLocationsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLocationsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLocationsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + this.warn('DEP$ClusterManager-$SetLocations','SetLocations is deprecated and may be removed in a future version.', 'DeprecationWarning'); + return this.innerApiCalls.setLocations(request, options, callback); + } +/** + * Updates the master for a specific cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {string} request.masterVersion + * Required. The Kubernetes version to change the master to. + * + * Users may specify either explicit versions offered by + * Kubernetes Engine or version aliases, which have the following behavior: + * + * - "latest": picks the highest valid Kubernetes version + * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + * - "1.X.Y-gke.N": picks an explicit Kubernetes version + * - "-": picks the default Kubernetes version + * @param {string} request.name + * The name (project, location, cluster) of the cluster to update. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.update_master.js + * region_tag:container_v1beta1_generated_ClusterManager_UpdateMaster_async + */ + updateMaster( + request?: protos.google.container.v1beta1.IUpdateMasterRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateMasterRequest|undefined, {}|undefined + ]>; + updateMaster( + request: protos.google.container.v1beta1.IUpdateMasterRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateMasterRequest|null|undefined, + {}|null|undefined>): void; + updateMaster( + request: protos.google.container.v1beta1.IUpdateMasterRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateMasterRequest|null|undefined, + {}|null|undefined>): void; + updateMaster( + request?: protos.google.container.v1beta1.IUpdateMasterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateMasterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateMasterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IUpdateMasterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMaster(request, options, callback); + } +/** + * Sets master auth materials. Currently supports changing the admin password + * or a specific cluster, either via password generation or explicitly setting + * the password. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to upgrade. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1beta1.SetMasterAuthRequest.Action} request.action + * Required. The exact form of action to be taken on the master auth. + * @param {google.container.v1beta1.MasterAuth} request.update + * Required. A description of the update. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to set auth. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_master_auth.js + * region_tag:container_v1beta1_generated_ClusterManager_SetMasterAuth_async + */ + setMasterAuth( + request?: protos.google.container.v1beta1.ISetMasterAuthRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMasterAuthRequest|undefined, {}|undefined + ]>; + setMasterAuth( + request: protos.google.container.v1beta1.ISetMasterAuthRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMasterAuthRequest|null|undefined, + {}|null|undefined>): void; + setMasterAuth( + request: protos.google.container.v1beta1.ISetMasterAuthRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMasterAuthRequest|null|undefined, + {}|null|undefined>): void; + setMasterAuth( + request?: protos.google.container.v1beta1.ISetMasterAuthRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMasterAuthRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMasterAuthRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMasterAuthRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setMasterAuth(request, options, callback); + } +/** + * Deletes the cluster, including the Kubernetes endpoint and all worker + * nodes. + * + * Firewalls and routes that were configured during cluster creation + * are also deleted. + * + * Other Google Compute Engine resources that might be in use by the cluster, + * such as load balancer resources, are not deleted if they weren't present + * when the cluster was initially created. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to delete. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to delete. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.delete_cluster.js + * region_tag:container_v1beta1_generated_ClusterManager_DeleteCluster_async + */ + deleteCluster( + request?: protos.google.container.v1beta1.IDeleteClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteClusterRequest|undefined, {}|undefined + ]>; + deleteCluster( + request: protos.google.container.v1beta1.IDeleteClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): void; + deleteCluster( + request: protos.google.container.v1beta1.IDeleteClusterRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): void; + deleteCluster( + request?: protos.google.container.v1beta1.IDeleteClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteCluster(request, options, callback); + } +/** + * Lists all operations in a project in the specified zone or all zones. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the parent field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) to return + * operations for, or `-` for all zones. This field has been deprecated and + * replaced by the parent field. + * @param {string} request.parent + * The parent (project and location) where the operations will be listed. + * Specified in the format `projects/* /locations/*`. + * Location "-" matches all zones and all regions. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.ListOperationsResponse|ListOperationsResponse}. + * Please see the {@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/cluster_manager.list_operations.js + * region_tag:container_v1beta1_generated_ClusterManager_ListOperations_async + */ + listOperations( + request?: protos.google.container.v1beta1.IListOperationsRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IListOperationsResponse, + protos.google.container.v1beta1.IListOperationsRequest|undefined, {}|undefined + ]>; + listOperations( + request: protos.google.container.v1beta1.IListOperationsRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IListOperationsResponse, + protos.google.container.v1beta1.IListOperationsRequest|null|undefined, + {}|null|undefined>): void; + listOperations( + request: protos.google.container.v1beta1.IListOperationsRequest, + callback: Callback< + protos.google.container.v1beta1.IListOperationsResponse, + protos.google.container.v1beta1.IListOperationsRequest|null|undefined, + {}|null|undefined>): void; + listOperations( + request?: protos.google.container.v1beta1.IListOperationsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IListOperationsResponse, + protos.google.container.v1beta1.IListOperationsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IListOperationsResponse, + protos.google.container.v1beta1.IListOperationsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IListOperationsResponse, + protos.google.container.v1beta1.IListOperationsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + }); + this.initialize(); + return this.innerApiCalls.listOperations(request, options, callback); + } +/** + * Gets the specified operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.operationId + * Required. Deprecated. The server-assigned `name` of the operation. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, operation id) of the operation to get. + * Specified in the format `projects/* /locations/* /operations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.get_operation.js + * region_tag:container_v1beta1_generated_ClusterManager_GetOperation_async + */ + getOperation( + request?: protos.google.container.v1beta1.IGetOperationRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IGetOperationRequest|undefined, {}|undefined + ]>; + getOperation( + request: protos.google.container.v1beta1.IGetOperationRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IGetOperationRequest|null|undefined, + {}|null|undefined>): void; + getOperation( + request: protos.google.container.v1beta1.IGetOperationRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IGetOperationRequest|null|undefined, + {}|null|undefined>): void; + getOperation( + request?: protos.google.container.v1beta1.IGetOperationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IGetOperationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IGetOperationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IGetOperationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'operation_id': request.operationId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getOperation(request, options, callback); + } +/** + * Cancels the specified operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * operation resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.operationId + * Required. Deprecated. The server-assigned `name` of the operation. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, operation id) of the operation to cancel. + * Specified in the format `projects/* /locations/* /operations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1beta1/cluster_manager.cancel_operation.js + * region_tag:container_v1beta1_generated_ClusterManager_CancelOperation_async + */ + cancelOperation( + request?: protos.google.container.v1beta1.ICancelOperationRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICancelOperationRequest|undefined, {}|undefined + ]>; + cancelOperation( + request: protos.google.container.v1beta1.ICancelOperationRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICancelOperationRequest|null|undefined, + {}|null|undefined>): void; + cancelOperation( + request: protos.google.container.v1beta1.ICancelOperationRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICancelOperationRequest|null|undefined, + {}|null|undefined>): void; + cancelOperation( + request?: protos.google.container.v1beta1.ICancelOperationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICancelOperationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICancelOperationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICancelOperationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'operation_id': request.operationId ?? '', + }); + this.initialize(); + return this.innerApiCalls.cancelOperation(request, options, callback); + } +/** + * Returns configuration info about the Google Kubernetes Engine service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) to return + * operations for. This field has been deprecated and replaced by the name + * field. + * @param {string} request.name + * The name (project and location) of the server config to get, + * specified in the format `projects/* /locations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.ServerConfig|ServerConfig}. + * Please see the {@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/cluster_manager.get_server_config.js + * region_tag:container_v1beta1_generated_ClusterManager_GetServerConfig_async + */ + getServerConfig( + request?: protos.google.container.v1beta1.IGetServerConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IServerConfig, + protos.google.container.v1beta1.IGetServerConfigRequest|undefined, {}|undefined + ]>; + getServerConfig( + request: protos.google.container.v1beta1.IGetServerConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IServerConfig, + protos.google.container.v1beta1.IGetServerConfigRequest|null|undefined, + {}|null|undefined>): void; + getServerConfig( + request: protos.google.container.v1beta1.IGetServerConfigRequest, + callback: Callback< + protos.google.container.v1beta1.IServerConfig, + protos.google.container.v1beta1.IGetServerConfigRequest|null|undefined, + {}|null|undefined>): void; + getServerConfig( + request?: protos.google.container.v1beta1.IGetServerConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IServerConfig, + protos.google.container.v1beta1.IGetServerConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IServerConfig, + protos.google.container.v1beta1.IGetServerConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IServerConfig, + protos.google.container.v1beta1.IGetServerConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + }); + this.initialize(); + return this.innerApiCalls.getServerConfig(request, options, callback); + } +/** + * Gets the public component of the cluster signing keys in + * JSON Web Key format. + * This API is not yet intended for general use, and is not available for all + * clusters. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The cluster (project, location, cluster name) to get keys for. Specified in + * the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.GetJSONWebKeysResponse|GetJSONWebKeysResponse}. + * Please see the {@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/cluster_manager.get_j_s_o_n_web_keys.js + * region_tag:container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async + */ + getJSONWebKeys( + request?: protos.google.container.v1beta1.IGetJSONWebKeysRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IGetJSONWebKeysResponse, + protos.google.container.v1beta1.IGetJSONWebKeysRequest|undefined, {}|undefined + ]>; + getJSONWebKeys( + request: protos.google.container.v1beta1.IGetJSONWebKeysRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IGetJSONWebKeysResponse, + protos.google.container.v1beta1.IGetJSONWebKeysRequest|null|undefined, + {}|null|undefined>): void; + getJSONWebKeys( + request: protos.google.container.v1beta1.IGetJSONWebKeysRequest, + callback: Callback< + protos.google.container.v1beta1.IGetJSONWebKeysResponse, + protos.google.container.v1beta1.IGetJSONWebKeysRequest|null|undefined, + {}|null|undefined>): void; + getJSONWebKeys( + request?: protos.google.container.v1beta1.IGetJSONWebKeysRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IGetJSONWebKeysResponse, + protos.google.container.v1beta1.IGetJSONWebKeysRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IGetJSONWebKeysResponse, + protos.google.container.v1beta1.IGetJSONWebKeysRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IGetJSONWebKeysResponse, + protos.google.container.v1beta1.IGetJSONWebKeysRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.getJsonWebKeys(request, options, callback); + } +/** + * Lists the node pools for a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the parent field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the parent + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the parent field. + * @param {string} request.parent + * The parent (project, location, cluster name) where the node pools will be + * listed. Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.ListNodePoolsResponse|ListNodePoolsResponse}. + * Please see the {@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/cluster_manager.list_node_pools.js + * region_tag:container_v1beta1_generated_ClusterManager_ListNodePools_async + */ + listNodePools( + request?: protos.google.container.v1beta1.IListNodePoolsRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IListNodePoolsResponse, + protos.google.container.v1beta1.IListNodePoolsRequest|undefined, {}|undefined + ]>; + listNodePools( + request: protos.google.container.v1beta1.IListNodePoolsRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IListNodePoolsResponse, + protos.google.container.v1beta1.IListNodePoolsRequest|null|undefined, + {}|null|undefined>): void; + listNodePools( + request: protos.google.container.v1beta1.IListNodePoolsRequest, + callback: Callback< + protos.google.container.v1beta1.IListNodePoolsResponse, + protos.google.container.v1beta1.IListNodePoolsRequest|null|undefined, + {}|null|undefined>): void; + listNodePools( + request?: protos.google.container.v1beta1.IListNodePoolsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IListNodePoolsResponse, + protos.google.container.v1beta1.IListNodePoolsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IListNodePoolsResponse, + protos.google.container.v1beta1.IListNodePoolsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IListNodePoolsResponse, + protos.google.container.v1beta1.IListNodePoolsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.listNodePools(request, options, callback); + } +/** + * Retrieves the requested node pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Required. Deprecated. The name of the node pool. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node pool to + * get. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.NodePool|NodePool}. + * Please see the {@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/cluster_manager.get_node_pool.js + * region_tag:container_v1beta1_generated_ClusterManager_GetNodePool_async + */ + getNodePool( + request?: protos.google.container.v1beta1.IGetNodePoolRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.INodePool, + protos.google.container.v1beta1.IGetNodePoolRequest|undefined, {}|undefined + ]>; + getNodePool( + request: protos.google.container.v1beta1.IGetNodePoolRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.INodePool, + protos.google.container.v1beta1.IGetNodePoolRequest|null|undefined, + {}|null|undefined>): void; + getNodePool( + request: protos.google.container.v1beta1.IGetNodePoolRequest, + callback: Callback< + protos.google.container.v1beta1.INodePool, + protos.google.container.v1beta1.IGetNodePoolRequest|null|undefined, + {}|null|undefined>): void; + getNodePool( + request?: protos.google.container.v1beta1.IGetNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.INodePool, + protos.google.container.v1beta1.IGetNodePoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.INodePool, + protos.google.container.v1beta1.IGetNodePoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.INodePool, + protos.google.container.v1beta1.IGetNodePoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getNodePool(request, options, callback); + } +/** + * Creates a node pool for a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the parent field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the parent + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the parent field. + * @param {google.container.v1beta1.NodePool} request.nodePool + * Required. The node pool to create. + * @param {string} request.parent + * The parent (project, location, cluster name) where the node pool will be + * created. Specified in the format + * `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.create_node_pool.js + * region_tag:container_v1beta1_generated_ClusterManager_CreateNodePool_async + */ + createNodePool( + request?: protos.google.container.v1beta1.ICreateNodePoolRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateNodePoolRequest|undefined, {}|undefined + ]>; + createNodePool( + request: protos.google.container.v1beta1.ICreateNodePoolRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateNodePoolRequest|null|undefined, + {}|null|undefined>): void; + createNodePool( + request: protos.google.container.v1beta1.ICreateNodePoolRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateNodePoolRequest|null|undefined, + {}|null|undefined>): void; + createNodePool( + request?: protos.google.container.v1beta1.ICreateNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateNodePoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateNodePoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICreateNodePoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.createNodePool(request, options, callback); + } +/** + * Deletes a node pool from a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Required. Deprecated. The name of the node pool to delete. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node pool to + * delete. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.delete_node_pool.js + * region_tag:container_v1beta1_generated_ClusterManager_DeleteNodePool_async + */ + deleteNodePool( + request?: protos.google.container.v1beta1.IDeleteNodePoolRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteNodePoolRequest|undefined, {}|undefined + ]>; + deleteNodePool( + request: protos.google.container.v1beta1.IDeleteNodePoolRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteNodePoolRequest|null|undefined, + {}|null|undefined>): void; + deleteNodePool( + request: protos.google.container.v1beta1.IDeleteNodePoolRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteNodePoolRequest|null|undefined, + {}|null|undefined>): void; + deleteNodePool( + request?: protos.google.container.v1beta1.IDeleteNodePoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteNodePoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteNodePoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IDeleteNodePoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteNodePool(request, options, callback); + } +/** + * CompleteNodePoolUpgrade will signal an on-going node pool upgrade to + * complete. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node pool to + * complete upgrade. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1beta1/cluster_manager.complete_node_pool_upgrade.js + * region_tag:container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async + */ + completeNodePoolUpgrade( + request?: protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|undefined, {}|undefined + ]>; + completeNodePoolUpgrade( + request: protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): void; + completeNodePoolUpgrade( + request: protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): void; + completeNodePoolUpgrade( + request?: protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.completeNodePoolUpgrade(request, options, callback); + } +/** + * Rolls back a previously Aborted or Failed NodePool upgrade. + * This makes no changes if the last upgrade successfully completed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to rollback. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Required. Deprecated. The name of the node pool to rollback. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node poll to + * rollback upgrade. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {boolean} request.respectPdb + * Option for rollback to ignore the PodDisruptionBudget. + * 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.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.rollback_node_pool_upgrade.js + * region_tag:container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_async + */ + rollbackNodePoolUpgrade( + request?: protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|undefined, {}|undefined + ]>; + rollbackNodePoolUpgrade( + request: protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): void; + rollbackNodePoolUpgrade( + request: protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): void; + rollbackNodePoolUpgrade( + request?: protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.rollbackNodePoolUpgrade(request, options, callback); + } +/** + * Sets the NodeManagement options for a node pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to update. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Required. Deprecated. The name of the node pool to update. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1beta1.NodeManagement} request.management + * Required. NodeManagement configuration for the node pool. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node pool to set + * management properties. Specified in the format + * `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_node_pool_management.js + * region_tag:container_v1beta1_generated_ClusterManager_SetNodePoolManagement_async + */ + setNodePoolManagement( + request?: protos.google.container.v1beta1.ISetNodePoolManagementRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolManagementRequest|undefined, {}|undefined + ]>; + setNodePoolManagement( + request: protos.google.container.v1beta1.ISetNodePoolManagementRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolManagementRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolManagement( + request: protos.google.container.v1beta1.ISetNodePoolManagementRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolManagementRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolManagement( + request?: protos.google.container.v1beta1.ISetNodePoolManagementRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolManagementRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolManagementRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolManagementRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setNodePoolManagement(request, options, callback); + } +/** + * Sets labels on a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {number[]} request.resourceLabels + * Required. The labels to set for that cluster. + * @param {string} request.labelFingerprint + * Required. The fingerprint of the previous set of labels for this resource, + * used to detect conflicts. The fingerprint is initially generated by + * Kubernetes Engine and changes after every request to modify or update + * labels. You must always provide an up-to-date fingerprint hash when + * updating or changing labels. Make a `get()` request to the + * resource to get the latest fingerprint. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to set labels. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_labels.js + * region_tag:container_v1beta1_generated_ClusterManager_SetLabels_async + */ + setLabels( + request?: protos.google.container.v1beta1.ISetLabelsRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLabelsRequest|undefined, {}|undefined + ]>; + setLabels( + request: protos.google.container.v1beta1.ISetLabelsRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLabelsRequest|null|undefined, + {}|null|undefined>): void; + setLabels( + request: protos.google.container.v1beta1.ISetLabelsRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLabelsRequest|null|undefined, + {}|null|undefined>): void; + setLabels( + request?: protos.google.container.v1beta1.ISetLabelsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLabelsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLabelsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLabelsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setLabels(request, options, callback); + } +/** + * Enables or disables the ABAC authorization mechanism on a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to update. + * This field has been deprecated and replaced by the name field. + * @param {boolean} request.enabled + * Required. Whether ABAC authorization will be enabled in the cluster. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to set legacy + * abac. Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_legacy_abac.js + * region_tag:container_v1beta1_generated_ClusterManager_SetLegacyAbac_async + */ + setLegacyAbac( + request?: protos.google.container.v1beta1.ISetLegacyAbacRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLegacyAbacRequest|undefined, {}|undefined + ]>; + setLegacyAbac( + request: protos.google.container.v1beta1.ISetLegacyAbacRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLegacyAbacRequest|null|undefined, + {}|null|undefined>): void; + setLegacyAbac( + request: protos.google.container.v1beta1.ISetLegacyAbacRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLegacyAbacRequest|null|undefined, + {}|null|undefined>): void; + setLegacyAbac( + request?: protos.google.container.v1beta1.ISetLegacyAbacRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLegacyAbacRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLegacyAbacRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetLegacyAbacRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setLegacyAbac(request, options, callback); + } +/** + * Starts master IP rotation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to start IP + * rotation. Specified in the format `projects/* /locations/* /clusters/*`. + * @param {boolean} request.rotateCredentials + * Whether to rotate credentials during IP rotation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.start_i_p_rotation.js + * region_tag:container_v1beta1_generated_ClusterManager_StartIPRotation_async + */ + startIPRotation( + request?: protos.google.container.v1beta1.IStartIPRotationRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IStartIPRotationRequest|undefined, {}|undefined + ]>; + startIPRotation( + request: protos.google.container.v1beta1.IStartIPRotationRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IStartIPRotationRequest|null|undefined, + {}|null|undefined>): void; + startIPRotation( + request: protos.google.container.v1beta1.IStartIPRotationRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IStartIPRotationRequest|null|undefined, + {}|null|undefined>): void; + startIPRotation( + request?: protos.google.container.v1beta1.IStartIPRotationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IStartIPRotationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IStartIPRotationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.IStartIPRotationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.startIpRotation(request, options, callback); + } +/** + * Completes master IP rotation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to complete IP + * rotation. Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.complete_i_p_rotation.js + * region_tag:container_v1beta1_generated_ClusterManager_CompleteIPRotation_async + */ + completeIPRotation( + request?: protos.google.container.v1beta1.ICompleteIPRotationRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICompleteIPRotationRequest|undefined, {}|undefined + ]>; + completeIPRotation( + request: protos.google.container.v1beta1.ICompleteIPRotationRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICompleteIPRotationRequest|null|undefined, + {}|null|undefined>): void; + completeIPRotation( + request: protos.google.container.v1beta1.ICompleteIPRotationRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICompleteIPRotationRequest|null|undefined, + {}|null|undefined>): void; + completeIPRotation( + request?: protos.google.container.v1beta1.ICompleteIPRotationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICompleteIPRotationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICompleteIPRotationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ICompleteIPRotationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.completeIpRotation(request, options, callback); + } +/** + * SetNodePoolSizeRequest sets the size of a node pool. The new size will be + * used for all replicas, including future replicas created by modifying + * {@link protos.google.container.v1beta1.NodePool.locations|NodePool.locations}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster to update. + * This field has been deprecated and replaced by the name field. + * @param {string} request.nodePoolId + * Required. Deprecated. The name of the node pool to update. + * This field has been deprecated and replaced by the name field. + * @param {number} request.nodeCount + * Required. The desired node count for the pool. + * @param {string} request.name + * The name (project, location, cluster, node pool id) of the node pool to set + * size. + * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_node_pool_size.js + * region_tag:container_v1beta1_generated_ClusterManager_SetNodePoolSize_async + */ + setNodePoolSize( + request?: protos.google.container.v1beta1.ISetNodePoolSizeRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolSizeRequest|undefined, {}|undefined + ]>; + setNodePoolSize( + request: protos.google.container.v1beta1.ISetNodePoolSizeRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolSizeRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolSize( + request: protos.google.container.v1beta1.ISetNodePoolSizeRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolSizeRequest|null|undefined, + {}|null|undefined>): void; + setNodePoolSize( + request?: protos.google.container.v1beta1.ISetNodePoolSizeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolSizeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolSizeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNodePoolSizeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + 'node_pool_id': request.nodePoolId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setNodePoolSize(request, options, callback); + } +/** + * Enables or disables Network Policy for a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. Deprecated. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * This field has been deprecated and replaced by the name field. + * @param {string} request.zone + * Required. Deprecated. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. This field has been deprecated and replaced by the name + * field. + * @param {string} request.clusterId + * Required. Deprecated. The name of the cluster. + * This field has been deprecated and replaced by the name field. + * @param {google.container.v1beta1.NetworkPolicy} request.networkPolicy + * Required. Configuration options for the NetworkPolicy feature. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to set networking + * policy. Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_network_policy.js + * region_tag:container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async + */ + setNetworkPolicy( + request?: protos.google.container.v1beta1.ISetNetworkPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNetworkPolicyRequest|undefined, {}|undefined + ]>; + setNetworkPolicy( + request: protos.google.container.v1beta1.ISetNetworkPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNetworkPolicyRequest|null|undefined, + {}|null|undefined>): void; + setNetworkPolicy( + request: protos.google.container.v1beta1.ISetNetworkPolicyRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNetworkPolicyRequest|null|undefined, + {}|null|undefined>): void; + setNetworkPolicy( + request?: protos.google.container.v1beta1.ISetNetworkPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNetworkPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNetworkPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetNetworkPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setNetworkPolicy(request, options, callback); + } +/** + * Sets the maintenance policy for a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The Google Developers Console [project ID or project + * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + * @param {string} request.zone + * Required. The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the + * cluster resides. + * @param {string} request.clusterId + * Required. The name of the cluster to update. + * @param {google.container.v1beta1.MaintenancePolicy} request.maintenancePolicy + * Required. The maintenance policy to be set for the cluster. An empty field + * clears the existing maintenance policy. + * @param {string} request.name + * The name (project, location, cluster name) of the cluster to set + * maintenance policy. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. + * Please see the {@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/cluster_manager.set_maintenance_policy.js + * region_tag:container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async + */ + setMaintenancePolicy( + request?: protos.google.container.v1beta1.ISetMaintenancePolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMaintenancePolicyRequest|undefined, {}|undefined + ]>; + setMaintenancePolicy( + request: protos.google.container.v1beta1.ISetMaintenancePolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMaintenancePolicyRequest|null|undefined, + {}|null|undefined>): void; + setMaintenancePolicy( + request: protos.google.container.v1beta1.ISetMaintenancePolicyRequest, + callback: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMaintenancePolicyRequest|null|undefined, + {}|null|undefined>): void; + setMaintenancePolicy( + request?: protos.google.container.v1beta1.ISetMaintenancePolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMaintenancePolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMaintenancePolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IOperation, + protos.google.container.v1beta1.ISetMaintenancePolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + 'project_id': request.projectId ?? '', + 'zone': request.zone ?? '', + 'cluster_id': request.clusterId ?? '', + }); + this.initialize(); + return this.innerApiCalls.setMaintenancePolicy(request, options, callback); + } +/** + * Checks the cluster compatibility with Autopilot mode, and returns a list of + * compatibility issues. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name (project, location, cluster) of the cluster to retrieve. + * Specified in the format `projects/* /locations/* /clusters/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.CheckAutopilotCompatibilityResponse|CheckAutopilotCompatibilityResponse}. + * Please see the {@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/cluster_manager.check_autopilot_compatibility.js + * region_tag:container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async + */ + checkAutopilotCompatibility( + request?: protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|undefined, {}|undefined + ]>; + checkAutopilotCompatibility( + request: protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|null|undefined, + {}|null|undefined>): void; + checkAutopilotCompatibility( + request: protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest, + callback: Callback< + protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|null|undefined, + {}|null|undefined>): void; + checkAutopilotCompatibility( + request?: protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, + protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.checkAutopilotCompatibility(request, options, callback); + } +/** + * Fetches locations that offer Google Kubernetes Engine. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Contains the name of the resource requested. + * Specified in the format `projects/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.container.v1beta1.ListLocationsResponse|ListLocationsResponse}. + * Please see the {@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/cluster_manager.list_locations.js + * region_tag:container_v1beta1_generated_ClusterManager_ListLocations_async + */ + listLocations( + request?: protos.google.container.v1beta1.IListLocationsRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IListLocationsResponse, + protos.google.container.v1beta1.IListLocationsRequest|undefined, {}|undefined + ]>; + listLocations( + request: protos.google.container.v1beta1.IListLocationsRequest, + options: CallOptions, + callback: Callback< + protos.google.container.v1beta1.IListLocationsResponse, + protos.google.container.v1beta1.IListLocationsRequest|null|undefined, + {}|null|undefined>): void; + listLocations( + request: protos.google.container.v1beta1.IListLocationsRequest, + callback: Callback< + protos.google.container.v1beta1.IListLocationsResponse, + protos.google.container.v1beta1.IListLocationsRequest|null|undefined, + {}|null|undefined>): void; + listLocations( + request?: protos.google.container.v1beta1.IListLocationsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.container.v1beta1.IListLocationsResponse, + protos.google.container.v1beta1.IListLocationsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.container.v1beta1.IListLocationsResponse, + protos.google.container.v1beta1.IListLocationsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.container.v1beta1.IListLocationsResponse, + protos.google.container.v1beta1.IListLocationsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listLocations(request, options, callback); + } + + /** + * Lists subnetworks that can be used for creating clusters in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent project where subnetworks are usable. + * Specified in the format `projects/*`. + * @param {string} request.filter + * Filtering currently only supports equality on the networkProjectId and must + * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` + * is the project which owns the listed subnetworks. This defaults to the + * parent project ID. + * @param {number} request.pageSize + * The max number of results per page that should be returned. If the number + * of available results is larger than `page_size`, a `next_page_token` is + * returned which can be used to get the next page of results in subsequent + * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + * @param {string} request.pageToken + * Specifies a page token to use. Set this to the nextPageToken returned by + * previous list requests to get 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.container.v1beta1.UsableSubnetwork|UsableSubnetwork}. + * 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 `listUsableSubnetworksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableSubnetworks( + request?: protos.google.container.v1beta1.IListUsableSubnetworksRequest, + options?: CallOptions): + Promise<[ + protos.google.container.v1beta1.IUsableSubnetwork[], + protos.google.container.v1beta1.IListUsableSubnetworksRequest|null, + protos.google.container.v1beta1.IListUsableSubnetworksResponse + ]>; + listUsableSubnetworks( + request: protos.google.container.v1beta1.IListUsableSubnetworksRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.container.v1beta1.IListUsableSubnetworksRequest, + protos.google.container.v1beta1.IListUsableSubnetworksResponse|null|undefined, + protos.google.container.v1beta1.IUsableSubnetwork>): void; + listUsableSubnetworks( + request: protos.google.container.v1beta1.IListUsableSubnetworksRequest, + callback: PaginationCallback< + protos.google.container.v1beta1.IListUsableSubnetworksRequest, + protos.google.container.v1beta1.IListUsableSubnetworksResponse|null|undefined, + protos.google.container.v1beta1.IUsableSubnetwork>): void; + listUsableSubnetworks( + request?: protos.google.container.v1beta1.IListUsableSubnetworksRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.container.v1beta1.IListUsableSubnetworksRequest, + protos.google.container.v1beta1.IListUsableSubnetworksResponse|null|undefined, + protos.google.container.v1beta1.IUsableSubnetwork>, + callback?: PaginationCallback< + protos.google.container.v1beta1.IListUsableSubnetworksRequest, + protos.google.container.v1beta1.IListUsableSubnetworksResponse|null|undefined, + protos.google.container.v1beta1.IUsableSubnetwork>): + Promise<[ + protos.google.container.v1beta1.IUsableSubnetwork[], + protos.google.container.v1beta1.IListUsableSubnetworksRequest|null, + protos.google.container.v1beta1.IListUsableSubnetworksResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listUsableSubnetworks(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 where subnetworks are usable. + * Specified in the format `projects/*`. + * @param {string} request.filter + * Filtering currently only supports equality on the networkProjectId and must + * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` + * is the project which owns the listed subnetworks. This defaults to the + * parent project ID. + * @param {number} request.pageSize + * The max number of results per page that should be returned. If the number + * of available results is larger than `page_size`, a `next_page_token` is + * returned which can be used to get the next page of results in subsequent + * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + * @param {string} request.pageToken + * Specifies a page token to use. Set this to the nextPageToken returned by + * previous list requests to get 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.container.v1beta1.UsableSubnetwork|UsableSubnetwork} 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 `listUsableSubnetworksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listUsableSubnetworksStream( + request?: protos.google.container.v1beta1.IListUsableSubnetworksRequest, + 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['listUsableSubnetworks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableSubnetworks.createStream( + this.innerApiCalls.listUsableSubnetworks as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listUsableSubnetworks`, 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 where subnetworks are usable. + * Specified in the format `projects/*`. + * @param {string} request.filter + * Filtering currently only supports equality on the networkProjectId and must + * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` + * is the project which owns the listed subnetworks. This defaults to the + * parent project ID. + * @param {number} request.pageSize + * The max number of results per page that should be returned. If the number + * of available results is larger than `page_size`, a `next_page_token` is + * returned which can be used to get the next page of results in subsequent + * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + * @param {string} request.pageToken + * Specifies a page token to use. Set this to the nextPageToken returned by + * previous list requests to get 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.container.v1beta1.UsableSubnetwork|UsableSubnetwork}. 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/cluster_manager.list_usable_subnetworks.js + * region_tag:container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_async + */ + listUsableSubnetworksAsync( + request?: protos.google.container.v1beta1.IListUsableSubnetworksRequest, + 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['listUsableSubnetworks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listUsableSubnetworks.asyncIterate( + this.innerApiCalls['listUsableSubnetworks'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + + /** + * 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.clusterManagerStub && !this._terminated) { + return this.clusterManagerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client_config.json b/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client_config.json new file mode 100644 index 00000000000..911352f9362 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client_config.json @@ -0,0 +1,198 @@ +{ + "interfaces": { + "google.container.v1beta1.ClusterManager": { + "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": { + "ListClusters": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetCluster": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateCluster": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateCluster": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNodePool": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNodePoolAutoscaling": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLoggingService": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetMonitoringService": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetAddonsConfig": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLocations": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateMaster": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetMasterAuth": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteCluster": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListOperations": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetOperation": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CancelOperation": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetServerConfig": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetJSONWebKeys": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListNodePools": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetNodePool": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateNodePool": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNodePool": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CompleteNodePoolUpgrade": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RollbackNodePoolUpgrade": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNodePoolManagement": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLabels": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLegacyAbac": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartIPRotation": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CompleteIPRotation": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNodePoolSize": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNetworkPolicy": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetMaintenancePolicy": { + "timeout_millis": 45000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListUsableSubnetworks": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CheckAutopilotCompatibility": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListLocations": { + "timeout_millis": 20000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_proto_list.json b/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_proto_list.json new file mode 100644 index 00000000000..7a594ccf698 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/container/v1beta1/cluster_service.proto" +] diff --git a/owl-bot-staging/google-container/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-container/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..0278af900c2 --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,377 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.container.v1beta1", + "libraryPackage": "@google-cloud/container", + "services": { + "ClusterManager": { + "clients": { + "grpc": { + "libraryClient": "ClusterManagerClient", + "rpcs": { + "ListClusters": { + "methods": [ + "listClusters" + ] + }, + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "UpdateNodePool": { + "methods": [ + "updateNodePool" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "setNodePoolAutoscaling" + ] + }, + "SetLoggingService": { + "methods": [ + "setLoggingService" + ] + }, + "SetMonitoringService": { + "methods": [ + "setMonitoringService" + ] + }, + "SetAddonsConfig": { + "methods": [ + "setAddonsConfig" + ] + }, + "SetLocations": { + "methods": [ + "setLocations" + ] + }, + "UpdateMaster": { + "methods": [ + "updateMaster" + ] + }, + "SetMasterAuth": { + "methods": [ + "setMasterAuth" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "ListOperations": { + "methods": [ + "listOperations" + ] + }, + "GetOperation": { + "methods": [ + "getOperation" + ] + }, + "CancelOperation": { + "methods": [ + "cancelOperation" + ] + }, + "GetServerConfig": { + "methods": [ + "getServerConfig" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "getJSONWebKeys" + ] + }, + "ListNodePools": { + "methods": [ + "listNodePools" + ] + }, + "GetNodePool": { + "methods": [ + "getNodePool" + ] + }, + "CreateNodePool": { + "methods": [ + "createNodePool" + ] + }, + "DeleteNodePool": { + "methods": [ + "deleteNodePool" + ] + }, + "CompleteNodePoolUpgrade": { + "methods": [ + "completeNodePoolUpgrade" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollbackNodePoolUpgrade" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "setNodePoolManagement" + ] + }, + "SetLabels": { + "methods": [ + "setLabels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "setLegacyAbac" + ] + }, + "StartIPRotation": { + "methods": [ + "startIPRotation" + ] + }, + "CompleteIPRotation": { + "methods": [ + "completeIPRotation" + ] + }, + "SetNodePoolSize": { + "methods": [ + "setNodePoolSize" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "setNetworkPolicy" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "setMaintenancePolicy" + ] + }, + "CheckAutopilotCompatibility": { + "methods": [ + "checkAutopilotCompatibility" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "listUsableSubnetworks", + "listUsableSubnetworksStream", + "listUsableSubnetworksAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ClusterManagerClient", + "rpcs": { + "ListClusters": { + "methods": [ + "listClusters" + ] + }, + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "UpdateNodePool": { + "methods": [ + "updateNodePool" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "setNodePoolAutoscaling" + ] + }, + "SetLoggingService": { + "methods": [ + "setLoggingService" + ] + }, + "SetMonitoringService": { + "methods": [ + "setMonitoringService" + ] + }, + "SetAddonsConfig": { + "methods": [ + "setAddonsConfig" + ] + }, + "SetLocations": { + "methods": [ + "setLocations" + ] + }, + "UpdateMaster": { + "methods": [ + "updateMaster" + ] + }, + "SetMasterAuth": { + "methods": [ + "setMasterAuth" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "ListOperations": { + "methods": [ + "listOperations" + ] + }, + "GetOperation": { + "methods": [ + "getOperation" + ] + }, + "CancelOperation": { + "methods": [ + "cancelOperation" + ] + }, + "GetServerConfig": { + "methods": [ + "getServerConfig" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "getJSONWebKeys" + ] + }, + "ListNodePools": { + "methods": [ + "listNodePools" + ] + }, + "GetNodePool": { + "methods": [ + "getNodePool" + ] + }, + "CreateNodePool": { + "methods": [ + "createNodePool" + ] + }, + "DeleteNodePool": { + "methods": [ + "deleteNodePool" + ] + }, + "CompleteNodePoolUpgrade": { + "methods": [ + "completeNodePoolUpgrade" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollbackNodePoolUpgrade" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "setNodePoolManagement" + ] + }, + "SetLabels": { + "methods": [ + "setLabels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "setLegacyAbac" + ] + }, + "StartIPRotation": { + "methods": [ + "startIPRotation" + ] + }, + "CompleteIPRotation": { + "methods": [ + "completeIPRotation" + ] + }, + "SetNodePoolSize": { + "methods": [ + "setNodePoolSize" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "setNetworkPolicy" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "setMaintenancePolicy" + ] + }, + "CheckAutopilotCompatibility": { + "methods": [ + "checkAutopilotCompatibility" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "listUsableSubnetworks", + "listUsableSubnetworksStream", + "listUsableSubnetworksAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-container/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-container/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000000..b1b39233034 --- /dev/null +++ b/owl-bot-staging/google-container/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 {ClusterManagerClient} from './cluster_manager_client'; diff --git a/owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..1101d781caa --- /dev/null +++ b/owl-bot-staging/google-container/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 container = require('@google-cloud/container'); + +function main() { + const clusterManagerClient = new container.ClusterManagerClient(); +} + +main(); diff --git a/owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..6685b8649e6 --- /dev/null +++ b/owl-bot-staging/google-container/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 {ClusterManagerClient} from '@google-cloud/container'; + +// check that the client class type name can be used +function doStuffWithClusterManagerClient(client: ClusterManagerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const clusterManagerClient = new ClusterManagerClient(); + doStuffWithClusterManagerClient(clusterManagerClient); +} + +main(); diff --git a/owl-bot-staging/google-container/v1beta1/system-test/install.ts b/owl-bot-staging/google-container/v1beta1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-container/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-container/v1beta1/test/gapic_cluster_manager_v1beta1.ts b/owl-bot-staging/google-container/v1beta1/test/gapic_cluster_manager_v1beta1.ts new file mode 100644 index 00000000000..7f93f752f2c --- /dev/null +++ b/owl-bot-staging/google-container/v1beta1/test/gapic_cluster_manager_v1beta1.ts @@ -0,0 +1,5238 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 clustermanagerModule 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('v1beta1.ClusterManagerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = clustermanagerModule.v1beta1.ClusterManagerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = clustermanagerModule.v1beta1.ClusterManagerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = clustermanagerModule.v1beta1.ClusterManagerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.clusterManagerStub, undefined); + await client.initialize(); + assert(client.clusterManagerStub); + }); + + it('has close method for the initialized client', done => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.clusterManagerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.clusterManagerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + 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 clustermanagerModule.v1beta1.ClusterManagerClient({ + 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('listClusters', () => { + it('invokes listClusters without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.ListClustersResponse() + ); + client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listClusters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClusters without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.ListClustersResponse() + ); + client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listClusters( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IListClustersResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClusters with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listClusters(request), expectedError); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClusters with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['zone']); + request.zone = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listClusters(request), expectedError); + }); + }); + + describe('getCluster', () => { + it('invokes getCluster without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Cluster() + ); + client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Cluster() + ); + client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCluster( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.ICluster|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCluster(request), expectedError); + }); + }); + + describe('createCluster', () => { + it('invokes createCluster without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.createCluster = stubSimpleCall(expectedResponse); + const [response] = await client.createCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.createCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCluster( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['zone']); + request.zone = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createCluster(request), expectedError); + }); + }); + + describe('updateCluster', () => { + it('invokes updateCluster without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.updateCluster = stubSimpleCall(expectedResponse); + const [response] = await client.updateCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.updateCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCluster( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCluster(request), expectedError); + }); + }); + + describe('updateNodePool', () => { + it('invokes updateNodePool without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.updateNodePool = stubSimpleCall(expectedResponse); + const [response] = await client.updateNodePool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNodePool without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.updateNodePool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNodePool( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNodePool with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNodePool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNodePool with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateNodePool(request), expectedError); + }); + }); + + describe('setNodePoolAutoscaling', () => { + it('invokes setNodePoolAutoscaling without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolAutoscalingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCall(expectedResponse); + const [response] = await client.setNodePoolAutoscaling(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolAutoscaling without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolAutoscalingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setNodePoolAutoscaling( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolAutoscaling with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolAutoscalingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setNodePoolAutoscaling(request), expectedError); + const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolAutoscaling with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolAutoscalingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setNodePoolAutoscaling(request), expectedError); + }); + }); + + describe('setLoggingService', () => { + it('invokes setLoggingService without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLoggingServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setLoggingService = stubSimpleCall(expectedResponse); + const [response] = await client.setLoggingService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLoggingService without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLoggingServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setLoggingService = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setLoggingService( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLoggingService with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLoggingServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setLoggingService = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setLoggingService(request), expectedError); + const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLoggingService with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLoggingServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setLoggingService(request), expectedError); + }); + }); + + describe('setMonitoringService', () => { + it('invokes setMonitoringService without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMonitoringServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setMonitoringService = stubSimpleCall(expectedResponse); + const [response] = await client.setMonitoringService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMonitoringService without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMonitoringServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setMonitoringService = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setMonitoringService( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMonitoringService with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMonitoringServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setMonitoringService = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setMonitoringService(request), expectedError); + const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMonitoringService with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMonitoringServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setMonitoringService(request), expectedError); + }); + }); + + describe('setAddonsConfig', () => { + it('invokes setAddonsConfig without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetAddonsConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setAddonsConfig = stubSimpleCall(expectedResponse); + const [response] = await client.setAddonsConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAddonsConfig without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetAddonsConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setAddonsConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setAddonsConfig( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAddonsConfig with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetAddonsConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setAddonsConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setAddonsConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAddonsConfig with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetAddonsConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setAddonsConfig(request), expectedError); + }); + }); + + describe('setLocations', () => { + it('invokes setLocations without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setLocations = stubSimpleCall(expectedResponse); + const [response] = await client.setLocations(request); + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLocations without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setLocations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setLocations( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLocations with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setLocations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setLocations(request), expectedError); + assert(stub.calledOnce); + const actualRequest = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLocations with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setLocations(request), expectedError); + assert(stub.calledOnce); + }); + }); + + describe('updateMaster', () => { + it('invokes updateMaster without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateMasterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.updateMaster = stubSimpleCall(expectedResponse); + const [response] = await client.updateMaster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMaster without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateMasterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.updateMaster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMaster( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMaster with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateMasterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMaster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateMaster(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMaster with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.UpdateMasterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateMaster(request), expectedError); + }); + }); + + describe('setMasterAuth', () => { + it('invokes setMasterAuth without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMasterAuthRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setMasterAuth = stubSimpleCall(expectedResponse); + const [response] = await client.setMasterAuth(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMasterAuth without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMasterAuthRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setMasterAuth = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setMasterAuth( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMasterAuth with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMasterAuthRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setMasterAuth = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setMasterAuth(request), expectedError); + const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMasterAuth with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMasterAuthRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setMasterAuth(request), expectedError); + }); + }); + + describe('deleteCluster', () => { + it('invokes deleteCluster without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.deleteCluster = stubSimpleCall(expectedResponse); + const [response] = await client.deleteCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.deleteCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCluster( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteCluster(request), expectedError); + }); + }); + + describe('listOperations', () => { + it('invokes listOperations without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListOperationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.ListOperationsResponse() + ); + client.innerApiCalls.listOperations = stubSimpleCall(expectedResponse); + const [response] = await client.listOperations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOperations without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListOperationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.ListOperationsResponse() + ); + client.innerApiCalls.listOperations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listOperations( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IListOperationsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOperations with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListOperationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listOperations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listOperations(request), expectedError); + const actualRequest = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOperations with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListOperationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['zone']); + request.zone = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listOperations(request), expectedError); + }); + }); + + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.getOperation = stubSimpleCall(expectedResponse); + const [response] = await client.getOperation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOperation without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.getOperation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOperation( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOperation with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOperation(request), expectedError); + const actualRequest = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOperation with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOperation(request), expectedError); + }); + }); + + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CancelOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.cancelOperation = stubSimpleCall(expectedResponse); + const [response] = await client.cancelOperation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelOperation without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CancelOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.cancelOperation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelOperation( + 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.cancelOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelOperation with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CancelOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelOperation(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelOperation with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CancelOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['operationId']); + request.operationId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelOperation(request), expectedError); + }); + }); + + describe('getServerConfig', () => { + it('invokes getServerConfig without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.ServerConfig() + ); + client.innerApiCalls.getServerConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getServerConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServerConfig without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.ServerConfig() + ); + client.innerApiCalls.getServerConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getServerConfig( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IServerConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServerConfig with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['zone']); + request.zone = defaultValue3; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getServerConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getServerConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServerConfig with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetServerConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['zone']); + request.zone = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getServerConfig(request), expectedError); + }); + }); + + describe('getJSONWebKeys', () => { + it('invokes getJSONWebKeys without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetJSONWebKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetJSONWebKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.GetJSONWebKeysResponse() + ); + client.innerApiCalls.getJsonWebKeys = stubSimpleCall(expectedResponse); + const [response] = await client.getJSONWebKeys(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJSONWebKeys without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetJSONWebKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetJSONWebKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.GetJSONWebKeysResponse() + ); + client.innerApiCalls.getJsonWebKeys = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJSONWebKeys( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IGetJSONWebKeysResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJSONWebKeys with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetJSONWebKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetJSONWebKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getJsonWebKeys = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJSONWebKeys(request), expectedError); + const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJSONWebKeys with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetJSONWebKeysRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetJSONWebKeysRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getJSONWebKeys(request), expectedError); + }); + }); + + describe('listNodePools', () => { + it('invokes listNodePools without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.ListNodePoolsResponse() + ); + client.innerApiCalls.listNodePools = stubSimpleCall(expectedResponse); + const [response] = await client.listNodePools(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodePools without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.ListNodePoolsResponse() + ); + client.innerApiCalls.listNodePools = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodePools( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IListNodePoolsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodePools with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNodePools = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNodePools(request), expectedError); + const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodePools with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListNodePoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listNodePools(request), expectedError); + }); + }); + + describe('getNodePool', () => { + it('invokes getNodePool without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.NodePool() + ); + client.innerApiCalls.getNodePool = stubSimpleCall(expectedResponse); + const [response] = await client.getNodePool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodePool without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.NodePool() + ); + client.innerApiCalls.getNodePool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNodePool( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.INodePool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodePool with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNodePool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodePool with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.GetNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNodePool(request), expectedError); + }); + }); + + describe('createNodePool', () => { + it('invokes createNodePool without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CreateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.createNodePool = stubSimpleCall(expectedResponse); + const [response] = await client.createNodePool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNodePool without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CreateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.createNodePool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNodePool( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNodePool with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CreateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNodePool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNodePool with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CreateNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['parent']); + request.parent = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createNodePool(request), expectedError); + }); + }); + + describe('deleteNodePool', () => { + it('invokes deleteNodePool without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.DeleteNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.deleteNodePool = stubSimpleCall(expectedResponse); + const [response] = await client.deleteNodePool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNodePool without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.DeleteNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.deleteNodePool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNodePool( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNodePool with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.DeleteNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNodePool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteNodePool(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNodePool with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.DeleteNodePoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteNodePool(request), expectedError); + }); + }); + + describe('completeNodePoolUpgrade', () => { + it('invokes completeNodePoolUpgrade without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CompleteNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CompleteNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCall(expectedResponse); + const [response] = await client.completeNodePoolUpgrade(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeNodePoolUpgrade without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CompleteNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CompleteNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeNodePoolUpgrade( + 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.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeNodePoolUpgrade with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CompleteNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CompleteNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.completeNodePoolUpgrade(request), expectedError); + const actualRequest = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeNodePoolUpgrade with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CompleteNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CompleteNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.completeNodePoolUpgrade(request), expectedError); + }); + }); + + describe('rollbackNodePoolUpgrade', () => { + it('invokes rollbackNodePoolUpgrade without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.RollbackNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCall(expectedResponse); + const [response] = await client.rollbackNodePoolUpgrade(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackNodePoolUpgrade without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.RollbackNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rollbackNodePoolUpgrade( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackNodePoolUpgrade with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.RollbackNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.rollbackNodePoolUpgrade(request), expectedError); + const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackNodePoolUpgrade with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.RollbackNodePoolUpgradeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.rollbackNodePoolUpgrade(request), expectedError); + }); + }); + + describe('setNodePoolManagement', () => { + it('invokes setNodePoolManagement without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolManagementRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setNodePoolManagement = stubSimpleCall(expectedResponse); + const [response] = await client.setNodePoolManagement(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolManagement without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolManagementRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setNodePoolManagement = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setNodePoolManagement( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolManagement with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolManagementRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setNodePoolManagement = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setNodePoolManagement(request), expectedError); + const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolManagement with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolManagementRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setNodePoolManagement(request), expectedError); + }); + }); + + describe('setLabels', () => { + it('invokes setLabels without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLabelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setLabels = stubSimpleCall(expectedResponse); + const [response] = await client.setLabels(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLabels without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLabelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setLabels = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setLabels( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLabels with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLabelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setLabels = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setLabels(request), expectedError); + const actualRequest = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLabels with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLabelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setLabels(request), expectedError); + }); + }); + + describe('setLegacyAbac', () => { + it('invokes setLegacyAbac without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLegacyAbacRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setLegacyAbac = stubSimpleCall(expectedResponse); + const [response] = await client.setLegacyAbac(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLegacyAbac without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLegacyAbacRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setLegacyAbac = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setLegacyAbac( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLegacyAbac with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLegacyAbacRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setLegacyAbac = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setLegacyAbac(request), expectedError); + const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setLegacyAbac with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetLegacyAbacRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setLegacyAbac(request), expectedError); + }); + }); + + describe('startIPRotation', () => { + it('invokes startIPRotation without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.StartIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.startIpRotation = stubSimpleCall(expectedResponse); + const [response] = await client.startIPRotation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startIPRotation without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.StartIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.startIpRotation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startIPRotation( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startIPRotation with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.StartIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startIpRotation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.startIPRotation(request), expectedError); + const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startIPRotation with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.StartIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.startIPRotation(request), expectedError); + }); + }); + + describe('completeIPRotation', () => { + it('invokes completeIPRotation without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CompleteIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.completeIpRotation = stubSimpleCall(expectedResponse); + const [response] = await client.completeIPRotation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeIPRotation without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CompleteIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.completeIpRotation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeIPRotation( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeIPRotation with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CompleteIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.completeIpRotation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.completeIPRotation(request), expectedError); + const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeIPRotation with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CompleteIPRotationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.completeIPRotation(request), expectedError); + }); + }); + + describe('setNodePoolSize', () => { + it('invokes setNodePoolSize without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolSizeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setNodePoolSize = stubSimpleCall(expectedResponse); + const [response] = await client.setNodePoolSize(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolSize without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolSizeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setNodePoolSize = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setNodePoolSize( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolSize with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolSizeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setNodePoolSize = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setNodePoolSize(request), expectedError); + const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNodePoolSize with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNodePoolSizeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['clusterId']); + request.clusterId = defaultValue4; + const defaultValue5 = + getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['nodePoolId']); + request.nodePoolId = defaultValue5; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setNodePoolSize(request), expectedError); + }); + }); + + describe('setNetworkPolicy', () => { + it('invokes setNetworkPolicy without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setNetworkPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setNetworkPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNetworkPolicy without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setNetworkPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setNetworkPolicy( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNetworkPolicy with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setNetworkPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setNetworkPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setNetworkPolicy with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetNetworkPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setNetworkPolicy(request), expectedError); + }); + }); + + describe('setMaintenancePolicy', () => { + it('invokes setMaintenancePolicy without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMaintenancePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setMaintenancePolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setMaintenancePolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMaintenancePolicy without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMaintenancePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.Operation() + ); + client.innerApiCalls.setMaintenancePolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setMaintenancePolicy( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMaintenancePolicy with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMaintenancePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setMaintenancePolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setMaintenancePolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMaintenancePolicy with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.SetMaintenancePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['name']); + request.name = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['projectId']); + request.projectId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['zone']); + request.zone = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['clusterId']); + request.clusterId = defaultValue4; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setMaintenancePolicy(request), expectedError); + }); + }); + + describe('checkAutopilotCompatibility', () => { + it('invokes checkAutopilotCompatibility without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CheckAutopilotCompatibilityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CheckAutopilotCompatibilityRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.CheckAutopilotCompatibilityResponse() + ); + client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCall(expectedResponse); + const [response] = await client.checkAutopilotCompatibility(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAutopilotCompatibility without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CheckAutopilotCompatibilityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CheckAutopilotCompatibilityRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.CheckAutopilotCompatibilityResponse() + ); + client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.checkAutopilotCompatibility( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAutopilotCompatibility with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CheckAutopilotCompatibilityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CheckAutopilotCompatibilityRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkAutopilotCompatibility(request), expectedError); + const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAutopilotCompatibility with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.CheckAutopilotCompatibilityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.CheckAutopilotCompatibilityRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.checkAutopilotCompatibility(request), expectedError); + }); + }); + + describe('listLocations', () => { + it('invokes listLocations without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListLocationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.ListLocationsResponse() + ); + client.innerApiCalls.listLocations = stubSimpleCall(expectedResponse); + const [response] = await client.listLocations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLocations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLocations without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListLocationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.container.v1beta1.ListLocationsResponse() + ); + client.innerApiCalls.listLocations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listLocations( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IListLocationsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listLocations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLocations with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListLocationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listLocations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listLocations(request), expectedError); + const actualRequest = (client.innerApiCalls.listLocations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listLocations with closed client', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListLocationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListLocationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listLocations(request), expectedError); + }); + }); + + describe('listUsableSubnetworks', () => { + it('invokes listUsableSubnetworks without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + ]; + client.innerApiCalls.listUsableSubnetworks = stubSimpleCall(expectedResponse); + const [response] = await client.listUsableSubnetworks(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableSubnetworks without error using callback', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + ]; + client.innerApiCalls.listUsableSubnetworks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUsableSubnetworks( + request, + (err?: Error|null, result?: protos.google.container.v1beta1.IUsableSubnetwork[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableSubnetworks with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listUsableSubnetworks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listUsableSubnetworks(request), expectedError); + const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUsableSubnetworksStream without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + ]; + client.descriptors.page.listUsableSubnetworks.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listUsableSubnetworksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.container.v1beta1.UsableSubnetwork[] = []; + stream.on('data', (response: protos.google.container.v1beta1.UsableSubnetwork) => { + 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.listUsableSubnetworks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableSubnetworks, request)); + assert( + (client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listUsableSubnetworksStream with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableSubnetworks.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listUsableSubnetworksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.container.v1beta1.UsableSubnetwork[] = []; + stream.on('data', (response: protos.google.container.v1beta1.UsableSubnetwork) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUsableSubnetworks, request)); + assert( + (client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableSubnetworks without error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), + ]; + client.descriptors.page.listUsableSubnetworks.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.container.v1beta1.IUsableSubnetwork[] = []; + const iterable = client.listUsableSubnetworksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listUsableSubnetworks with error', async () => { + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.container.v1beta1.ListUsableSubnetworksRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUsableSubnetworks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUsableSubnetworksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.container.v1beta1.IUsableSubnetwork[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); +}); diff --git a/owl-bot-staging/google-container/v1beta1/tsconfig.json b/owl-bot-staging/google-container/v1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-container/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-container/v1beta1/webpack.config.js b/owl-bot-staging/google-container/v1beta1/webpack.config.js new file mode 100644 index 00000000000..9032271af9d --- /dev/null +++ b/owl-bot-staging/google-container/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: 'ClusterManager', + filename: './cluster-manager.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-dataflow/v1beta3/.eslintignore b/owl-bot-staging/google-dataflow/v1beta3/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-dataflow/v1beta3/.eslintrc.json b/owl-bot-staging/google-dataflow/v1beta3/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/.gitignore b/owl-bot-staging/google-dataflow/v1beta3/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/.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-dataflow/v1beta3/.jsdoc.js b/owl-bot-staging/google-dataflow/v1beta3/.jsdoc.js new file mode 100644 index 00000000000..efcec47573f --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/.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/dataflow', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-dataflow/v1beta3/.mocharc.js b/owl-bot-staging/google-dataflow/v1beta3/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/.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-dataflow/v1beta3/.prettierrc.js b/owl-bot-staging/google-dataflow/v1beta3/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/.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-dataflow/v1beta3/README.md b/owl-bot-staging/google-dataflow/v1beta3/README.md new file mode 100644 index 00000000000..13c331ccf54 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/README.md @@ -0,0 +1 @@ +Dataflow: Nodejs Client diff --git a/owl-bot-staging/google-dataflow/v1beta3/package.json b/owl-bot-staging/google-dataflow/v1beta3/package.json new file mode 100644 index 00000000000..7db4b3cac0b --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/package.json @@ -0,0 +1,63 @@ +{ + "name": "@google-cloud/dataflow", + "version": "0.1.0", + "description": "Dataflow client for Node.js", + "repository": "googleapis/nodejs-dataflow", + "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 dataflow", + "dataflow", + "flex templates service", + "jobs v1 beta3", + "messages v1 beta3", + "metrics v1 beta3", + "snapshots v1 beta3", + "templates 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-dataflow/v1beta3/protos/google/dataflow/v1beta3/environment.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/environment.proto new file mode 100644 index 00000000000..e243c5e7934 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/environment.proto @@ -0,0 +1,554 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.dataflow.v1beta3; + +import "google/api/field_behavior.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; + +option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; +option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; +option java_multiple_files = true; +option java_outer_classname = "EnvironmentProto"; +option java_package = "com.google.dataflow.v1beta3"; +option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; +option ruby_package = "Google::Cloud::Dataflow::V1beta3"; + +// Describes the environment in which a Dataflow Job runs. +message Environment { + // The prefix of the resources the system should use for temporary + // storage. The system will append the suffix "/temp-{JOBNAME} to + // this resource prefix, where {JOBNAME} is the value of the + // job_name field. The resulting bucket and object prefix is used + // as the prefix of the resources used to store temporary data + // needed during the job execution. NOTE: This will override the + // value in taskrunner_settings. + // The supported resource type is: + // + // Google Cloud Storage: + // + // storage.googleapis.com/{bucket}/{object} + // bucket.storage.googleapis.com/{object} + string temp_storage_prefix = 1; + + // The type of cluster manager API to use. If unknown or + // unspecified, the service will attempt to choose a reasonable + // default. This should be in the form of the API service name, + // e.g. "compute.googleapis.com". + string cluster_manager_api_service = 2; + + // The list of experiments to enable. This field should be used for SDK + // related experiments and not for service related experiments. The proper + // field for service related experiments is service_options. + repeated string experiments = 3; + + // The list of service options to enable. This field should be used for + // service related experiments only. These experiments, when graduating to GA, + // should be replaced by dedicated fields or become default (i.e. always on). + repeated string service_options = 16; + + // If set, contains the Cloud KMS key identifier used to encrypt data + // at rest, AKA a Customer Managed Encryption Key (CMEK). + // + // Format: + // projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY + string service_kms_key_name = 12; + + // The worker pools. At least one "harness" worker pool must be + // specified in order for the job to have workers. + repeated WorkerPool worker_pools = 4; + + // A description of the process that generated the request. + google.protobuf.Struct user_agent = 5; + + // A structure describing which components and their versions of the service + // are required in order to run the job. + google.protobuf.Struct version = 6; + + // The dataset for the current project where various workflow + // related tables are stored. + // + // The supported resource type is: + // + // Google BigQuery: + // bigquery.googleapis.com/{dataset} + string dataset = 7; + + // The Cloud Dataflow SDK pipeline options specified by the user. These + // options are passed through the service and are used to recreate the + // SDK pipeline options on the worker in a language agnostic and platform + // independent way. + google.protobuf.Struct sdk_pipeline_options = 8; + + // Experimental settings. + google.protobuf.Any internal_experiments = 9; + + // Identity to run virtual machines as. Defaults to the default account. + string service_account_email = 10; + + // Which Flexible Resource Scheduling mode to run in. + FlexResourceSchedulingGoal flex_resource_scheduling_goal = 11; + + // The Compute Engine region + // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in + // which worker processing should occur, e.g. "us-west1". Mutually exclusive + // with worker_zone. If neither worker_region nor worker_zone is specified, + // default to the control plane's region. + string worker_region = 13; + + // The Compute Engine zone + // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in + // which worker processing should occur, e.g. "us-west1-a". Mutually exclusive + // with worker_region. If neither worker_region nor worker_zone is specified, + // a zone in the control plane's region is chosen based on available capacity. + string worker_zone = 14; + + // Output only. The shuffle mode used for the job. + ShuffleMode shuffle_mode = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Any debugging options to be supplied to the job. + DebugOptions debug_options = 17; +} + +// The packages that must be installed in order for a worker to run the +// steps of the Cloud Dataflow job that will be assigned to its worker +// pool. +// +// This is the mechanism by which the Cloud Dataflow SDK causes code to +// be loaded onto the workers. For example, the Cloud Dataflow Java SDK +// might use this to install jars containing the user's code and all of the +// various dependencies (libraries, data files, etc.) required in order +// for that code to run. +message Package { + // The name of the package. + string name = 1; + + // The resource to read the package from. The supported resource type is: + // + // Google Cloud Storage: + // + // storage.googleapis.com/{bucket} + // bucket.storage.googleapis.com/ + string location = 2; +} + +// Specifies the processing model used by a +// [google.dataflow.v1beta3.Job], which determines the way the Job is +// managed by the Cloud Dataflow service (how workers are scheduled, how +// inputs are sharded, etc). +enum JobType { + // The type of the job is unspecified, or unknown. + JOB_TYPE_UNKNOWN = 0; + + // A batch job with a well-defined end point: data is read, data is + // processed, data is written, and the job is done. + JOB_TYPE_BATCH = 1; + + // A continuously streaming job with no end: data is read, + // processed, and written continuously. + JOB_TYPE_STREAMING = 2; +} + +// Specifies the resource to optimize for in Flexible Resource Scheduling. +enum FlexResourceSchedulingGoal { + // Run in the default mode. + FLEXRS_UNSPECIFIED = 0; + + // Optimize for lower execution time. + FLEXRS_SPEED_OPTIMIZED = 1; + + // Optimize for lower cost. + FLEXRS_COST_OPTIMIZED = 2; +} + +// Describes the data disk used by a workflow job. +message Disk { + // Size of disk in GB. If zero or unspecified, the service will + // attempt to choose a reasonable default. + int32 size_gb = 1; + + // Disk storage type, as defined by Google Compute Engine. This + // must be a disk type appropriate to the project and zone in which + // the workers will run. If unknown or unspecified, the service + // will attempt to choose a reasonable default. + // + // For example, the standard persistent disk type is a resource name + // typically ending in "pd-standard". If SSD persistent disks are + // available, the resource name typically ends with "pd-ssd". The + // actual valid values are defined the Google Compute Engine API, + // not by the Cloud Dataflow API; consult the Google Compute Engine + // documentation for more information about determining the set of + // available disk types for a particular project and zone. + // + // Google Compute Engine Disk types are local to a particular + // project in a particular zone, and so the resource name will + // typically look something like this: + // + // compute.googleapis.com/projects/project-id/zones/zone/diskTypes/pd-standard + string disk_type = 2; + + // Directory in a VM where disk is mounted. + string mount_point = 3; +} + +// Provides data to pass through to the worker harness. +message WorkerSettings { + // The base URL for accessing Google Cloud APIs. + // + // When workers access Google Cloud APIs, they logically do so via + // relative URLs. If this field is specified, it supplies the base + // URL to use for resolving these relative URLs. The normative + // algorithm used is defined by RFC 1808, "Relative Uniform Resource + // Locators". + // + // If not specified, the default value is "http://www.googleapis.com/" + string base_url = 1; + + // Whether to send work progress updates to the service. + bool reporting_enabled = 2; + + // The Cloud Dataflow service path relative to the root URL, for example, + // "dataflow/v1b3/projects". + string service_path = 3; + + // The Shuffle service path relative to the root URL, for example, + // "shuffle/v1beta1". + string shuffle_service_path = 4; + + // The ID of the worker running this pipeline. + string worker_id = 5; + + // The prefix of the resources the system should use for temporary + // storage. + // + // The supported resource type is: + // + // Google Cloud Storage: + // + // storage.googleapis.com/{bucket}/{object} + // bucket.storage.googleapis.com/{object} + string temp_storage_prefix = 6; +} + +// Taskrunner configuration settings. +message TaskRunnerSettings { + // The UNIX user ID on the worker VM to use for tasks launched by + // taskrunner; e.g. "root". + string task_user = 1; + + // The UNIX group ID on the worker VM to use for tasks launched by + // taskrunner; e.g. "wheel". + string task_group = 2; + + // The OAuth2 scopes to be requested by the taskrunner in order to + // access the Cloud Dataflow API. + repeated string oauth_scopes = 3; + + // The base URL for the taskrunner to use when accessing Google Cloud APIs. + // + // When workers access Google Cloud APIs, they logically do so via + // relative URLs. If this field is specified, it supplies the base + // URL to use for resolving these relative URLs. The normative + // algorithm used is defined by RFC 1808, "Relative Uniform Resource + // Locators". + // + // If not specified, the default value is "http://www.googleapis.com/" + string base_url = 4; + + // The API version of endpoint, e.g. "v1b3" + string dataflow_api_version = 5; + + // The settings to pass to the parallel worker harness. + WorkerSettings parallel_worker_settings = 6; + + // The location on the worker for task-specific subdirectories. + string base_task_dir = 7; + + // Whether to continue taskrunner if an exception is hit. + bool continue_on_exception = 8; + + // Whether to send taskrunner log info to Google Compute Engine VM serial + // console. + bool log_to_serialconsole = 9; + + // Whether to also send taskrunner log info to stderr. + bool alsologtostderr = 10; + + // Indicates where to put logs. If this is not specified, the logs + // will not be uploaded. + // + // The supported resource type is: + // + // Google Cloud Storage: + // storage.googleapis.com/{bucket}/{object} + // bucket.storage.googleapis.com/{object} + string log_upload_location = 11; + + // The directory on the VM to store logs. + string log_dir = 12; + + // The prefix of the resources the taskrunner should use for + // temporary storage. + // + // The supported resource type is: + // + // Google Cloud Storage: + // storage.googleapis.com/{bucket}/{object} + // bucket.storage.googleapis.com/{object} + string temp_storage_prefix = 13; + + // The command to launch the worker harness. + string harness_command = 14; + + // The file to store the workflow in. + string workflow_file_name = 15; + + // The file to store preprocessing commands in. + string commandlines_file_name = 16; + + // The ID string of the VM. + string vm_id = 17; + + // The suggested backend language. + string language_hint = 18; + + // The streaming worker main class name. + string streaming_worker_main_class = 19; +} + +// Specifies what happens to a resource when a Cloud Dataflow +// [google.dataflow.v1beta3.Job][google.dataflow.v1beta3.Job] has completed. +enum TeardownPolicy { + // The teardown policy isn't specified, or is unknown. + TEARDOWN_POLICY_UNKNOWN = 0; + + // Always teardown the resource. + TEARDOWN_ALWAYS = 1; + + // Teardown the resource on success. This is useful for debugging + // failures. + TEARDOWN_ON_SUCCESS = 2; + + // Never teardown the resource. This is useful for debugging and + // development. + TEARDOWN_NEVER = 3; +} + +// The default set of packages to be staged on a pool of workers. +enum DefaultPackageSet { + // The default set of packages to stage is unknown, or unspecified. + DEFAULT_PACKAGE_SET_UNKNOWN = 0; + + // Indicates that no packages should be staged at the worker unless + // explicitly specified by the job. + DEFAULT_PACKAGE_SET_NONE = 1; + + // Stage packages typically useful to workers written in Java. + DEFAULT_PACKAGE_SET_JAVA = 2; + + // Stage packages typically useful to workers written in Python. + DEFAULT_PACKAGE_SET_PYTHON = 3; +} + +// Specifies the algorithm used to determine the number of worker +// processes to run at any given point in time, based on the amount of +// data left to process, the number of workers, and how quickly +// existing workers are processing data. +enum AutoscalingAlgorithm { + // The algorithm is unknown, or unspecified. + AUTOSCALING_ALGORITHM_UNKNOWN = 0; + + // Disable autoscaling. + AUTOSCALING_ALGORITHM_NONE = 1; + + // Increase worker count over time to reduce job execution time. + AUTOSCALING_ALGORITHM_BASIC = 2; +} + +// Settings for WorkerPool autoscaling. +message AutoscalingSettings { + // The algorithm to use for autoscaling. + AutoscalingAlgorithm algorithm = 1; + + // The maximum number of workers to cap scaling at. + int32 max_num_workers = 2; +} + +// Specifies how IP addresses should be allocated to the worker machines. +enum WorkerIPAddressConfiguration { + // The configuration is unknown, or unspecified. + WORKER_IP_UNSPECIFIED = 0; + + // Workers should have public IP addresses. + WORKER_IP_PUBLIC = 1; + + // Workers should have private IP addresses. + WORKER_IP_PRIVATE = 2; +} + +// Defines a SDK harness container for executing Dataflow pipelines. +message SdkHarnessContainerImage { + // A docker container image that resides in Google Container Registry. + string container_image = 1; + + // If true, recommends the Dataflow service to use only one core per SDK + // container instance with this image. If false (or unset) recommends using + // more than one core per SDK container instance with this image for + // efficiency. Note that Dataflow service may choose to override this property + // if needed. + bool use_single_core_per_container = 2; + + // Environment ID for the Beam runner API proto Environment that corresponds + // to the current SDK Harness. + string environment_id = 3; + + // The set of capabilities enumerated in the above Environment proto. See also + // https://github.com/apache/beam/blob/master/model/pipeline/src/main/proto/beam_runner_api.proto + repeated string capabilities = 4; +} + +// Describes one particular pool of Cloud Dataflow workers to be +// instantiated by the Cloud Dataflow service in order to perform the +// computations required by a job. Note that a workflow job may use +// multiple pools, in order to match the various computational +// requirements of the various stages of the job. +message WorkerPool { + // The kind of the worker pool; currently only `harness` and `shuffle` + // are supported. + string kind = 1; + + // Number of Google Compute Engine workers in this pool needed to + // execute the job. If zero or unspecified, the service will + // attempt to choose a reasonable default. + int32 num_workers = 2; + + // Packages to be installed on workers. + repeated Package packages = 3; + + // The default package set to install. This allows the service to + // select a default set of packages which are useful to worker + // harnesses written in a particular language. + DefaultPackageSet default_package_set = 4; + + // Machine type (e.g. "n1-standard-1"). If empty or unspecified, the + // service will attempt to choose a reasonable default. + string machine_type = 5; + + // Sets the policy for determining when to turndown worker pool. + // Allowed values are: `TEARDOWN_ALWAYS`, `TEARDOWN_ON_SUCCESS`, and + // `TEARDOWN_NEVER`. + // `TEARDOWN_ALWAYS` means workers are always torn down regardless of whether + // the job succeeds. `TEARDOWN_ON_SUCCESS` means workers are torn down + // if the job succeeds. `TEARDOWN_NEVER` means the workers are never torn + // down. + // + // If the workers are not torn down by the service, they will + // continue to run and use Google Compute Engine VM resources in the + // user's project until they are explicitly terminated by the user. + // Because of this, Google recommends using the `TEARDOWN_ALWAYS` + // policy except for small, manually supervised test jobs. + // + // If unknown or unspecified, the service will attempt to choose a reasonable + // default. + TeardownPolicy teardown_policy = 6; + + // Size of root disk for VMs, in GB. If zero or unspecified, the service will + // attempt to choose a reasonable default. + int32 disk_size_gb = 7; + + // Type of root disk for VMs. If empty or unspecified, the service will + // attempt to choose a reasonable default. + string disk_type = 16; + + // Fully qualified source image for disks. + string disk_source_image = 8; + + // Zone to run the worker pools in. If empty or unspecified, the service + // will attempt to choose a reasonable default. + string zone = 9; + + // Settings passed through to Google Compute Engine workers when + // using the standard Dataflow task runner. Users should ignore + // this field. + TaskRunnerSettings taskrunner_settings = 10; + + // The action to take on host maintenance, as defined by the Google + // Compute Engine API. + string on_host_maintenance = 11; + + // Data disks that are used by a VM in this workflow. + repeated Disk data_disks = 12; + + // Metadata to set on the Google Compute Engine VMs. + map metadata = 13; + + // Settings for autoscaling of this WorkerPool. + AutoscalingSettings autoscaling_settings = 14; + + // Extra arguments for this worker pool. + google.protobuf.Any pool_args = 15; + + // Network to which VMs will be assigned. If empty or unspecified, + // the service will use the network "default". + string network = 17; + + // Subnetwork to which VMs will be assigned, if desired. Expected to be of + // the form "regions/REGION/subnetworks/SUBNETWORK". + string subnetwork = 19; + + // Required. Docker container image that executes the Cloud Dataflow worker + // harness, residing in Google Container Registry. + // + // Deprecated for the Fn API path. Use sdk_harness_container_images instead. + string worker_harness_container_image = 18; + + // The number of threads per worker harness. If empty or unspecified, the + // service will choose a number of threads (according to the number of cores + // on the selected machine type for batch, or 1 by convention for streaming). + int32 num_threads_per_worker = 20; + + // Configuration for VM IPs. + WorkerIPAddressConfiguration ip_configuration = 21; + + // Set of SDK harness containers needed to execute this pipeline. This will + // only be set in the Fn API path. For non-cross-language pipelines this + // should have only one entry. Cross-language pipelines will have two or more + // entries. + repeated SdkHarnessContainerImage sdk_harness_container_images = 22; +} + +// Specifies the shuffle mode used by a +// [google.dataflow.v1beta3.Job], which determines the approach data is shuffled +// during processing. More details in: +// https://cloud.google.com/dataflow/docs/guides/deploying-a-pipeline#dataflow-shuffle +enum ShuffleMode { + // Shuffle mode information is not available. + SHUFFLE_MODE_UNSPECIFIED = 0; + + // Shuffle is done on the worker VMs. + VM_BASED = 1; + + // Shuffle is done on the service side. + SERVICE_BASED = 2; +} + +// Describes any options that have an effect on the debugging of pipelines. +message DebugOptions { + // When true, enables the logging of the literal hot key to the user's Cloud + // Logging. + bool enable_hot_key_logging = 1; +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/jobs.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/jobs.proto new file mode 100644 index 00000000000..f961e1c3c2f --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/jobs.proto @@ -0,0 +1,926 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.dataflow.v1beta3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/dataflow/v1beta3/environment.proto"; +import "google/dataflow/v1beta3/snapshots.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; +option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; +option java_multiple_files = true; +option java_outer_classname = "JobsProto"; +option java_package = "com.google.dataflow.v1beta3"; +option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; +option ruby_package = "Google::Cloud::Dataflow::V1beta3"; + +// Provides a method to create and modify Google Cloud Dataflow jobs. +// A Job is a multi-stage computation graph run by the Cloud Dataflow service. +service JobsV1Beta3 { + option (google.api.default_host) = "dataflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/compute," + "https://www.googleapis.com/auth/compute.readonly," + "https://www.googleapis.com/auth/userinfo.email"; + + // Creates a Cloud Dataflow job. + // + // To create a job, we recommend using `projects.locations.jobs.create` with a + // [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using + // `projects.jobs.create` is not recommended, as your job will always start + // in `us-central1`. + rpc CreateJob(CreateJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1b3/projects/{project_id}/locations/{location}/jobs" + body: "job" + additional_bindings { + post: "/v1b3/projects/{project_id}/jobs" + body: "job" + } + }; + } + + // Gets the state of the specified Cloud Dataflow job. + // + // To get the state of a job, we recommend using `projects.locations.jobs.get` + // with a [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using + // `projects.jobs.get` is not recommended, as you can only get the state of + // jobs that are running in `us-central1`. + rpc GetJob(GetJobRequest) returns (Job) { + option (google.api.http) = { + get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}" + additional_bindings { + get: "/v1b3/projects/{project_id}/jobs/{job_id}" + } + }; + } + + // Updates the state of an existing Cloud Dataflow job. + // + // To update the state of an existing job, we recommend using + // `projects.locations.jobs.update` with a [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using + // `projects.jobs.update` is not recommended, as you can only update the state + // of jobs that are running in `us-central1`. + rpc UpdateJob(UpdateJobRequest) returns (Job) { + option (google.api.http) = { + put: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}" + body: "job" + additional_bindings { + put: "/v1b3/projects/{project_id}/jobs/{job_id}" + body: "job" + } + }; + } + + // List the jobs of a project. + // + // To list the jobs of a project in a region, we recommend using + // `projects.locations.jobs.list` with a [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). To + // list the all jobs across all regions, use `projects.jobs.aggregated`. Using + // `projects.jobs.list` is not recommended, as you can only get the list of + // jobs that are running in `us-central1`. + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { + get: "/v1b3/projects/{project_id}/locations/{location}/jobs" + additional_bindings { + get: "/v1b3/projects/{project_id}/jobs" + } + }; + } + + // List the jobs of a project across all regions. + rpc AggregatedListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { + get: "/v1b3/projects/{project_id}/jobs:aggregated" + }; + } + + // Check for existence of active jobs in the given project across all regions. + rpc CheckActiveJobs(CheckActiveJobsRequest) returns (CheckActiveJobsResponse) { + } + + // Snapshot the state of a streaming job. + rpc SnapshotJob(SnapshotJobRequest) returns (Snapshot) { + option (google.api.http) = { + post: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}:snapshot" + body: "*" + additional_bindings { + post: "/v1b3/projects/{project_id}/jobs/{job_id}:snapshot" + body: "*" + } + }; + } +} + +// Defines a job to be run by the Cloud Dataflow service. +message Job { + // The unique ID of this job. + // + // This field is set by the Cloud Dataflow service when the Job is + // created, and is immutable for the life of the job. + string id = 1; + + // The ID of the Cloud Platform project that the job belongs to. + string project_id = 2; + + // The user-specified Cloud Dataflow job name. + // + // Only one Job with a given name may exist in a project at any + // given time. If a caller attempts to create a Job with the same + // name as an already-existing Job, the attempt returns the + // existing Job. + // + // The name must match the regular expression + // `[a-z]([-a-z0-9]{0,1022}[a-z0-9])?` + string name = 3; + + // The type of Cloud Dataflow job. + JobType type = 4; + + // The environment for the job. + Environment environment = 5; + + // Exactly one of step or steps_location should be specified. + // + // The top-level steps that constitute the entire job. Only retrieved with + // JOB_VIEW_ALL. + repeated Step steps = 6; + + // The Cloud Storage location where the steps are stored. + string steps_location = 24; + + // The current state of the job. + // + // Jobs are created in the `JOB_STATE_STOPPED` state unless otherwise + // specified. + // + // A job in the `JOB_STATE_RUNNING` state may asynchronously enter a + // terminal state. After a job has reached a terminal state, no + // further state updates may be made. + // + // This field may be mutated by the Cloud Dataflow service; + // callers cannot mutate it. + JobState current_state = 7; + + // The timestamp associated with the current state. + google.protobuf.Timestamp current_state_time = 8; + + // The job's requested state. + // + // `UpdateJob` may be used to switch between the `JOB_STATE_STOPPED` and + // `JOB_STATE_RUNNING` states, by setting requested_state. `UpdateJob` may + // also be used to directly set a job's requested state to + // `JOB_STATE_CANCELLED` or `JOB_STATE_DONE`, irrevocably terminating the + // job if it has not already reached a terminal state. + JobState requested_state = 9; + + // Deprecated. + JobExecutionInfo execution_info = 10; + + // The timestamp when the job was initially created. Immutable and set by the + // Cloud Dataflow service. + google.protobuf.Timestamp create_time = 11; + + // If this job is an update of an existing job, this field is the job ID + // of the job it replaced. + // + // When sending a `CreateJobRequest`, you can update a job by specifying it + // here. The job named here is stopped, and its intermediate state is + // transferred to this job. + string replace_job_id = 12; + + // The map of transform name prefixes of the job to be replaced to the + // corresponding name prefixes of the new job. + map transform_name_mapping = 13; + + // The client's unique identifier of the job, re-used across retried attempts. + // If this field is set, the service will ensure its uniqueness. + // The request to create a job will fail if the service has knowledge of a + // previously submitted job with the same client's ID and job name. + // The caller may use this field to ensure idempotence of job + // creation across retried attempts to create a job. + // By default, the field is empty and, in that case, the service ignores it. + string client_request_id = 14; + + // If another job is an update of this job (and thus, this job is in + // `JOB_STATE_UPDATED`), this field contains the ID of that job. + string replaced_by_job_id = 15; + + // A set of files the system should be aware of that are used + // for temporary storage. These temporary files will be + // removed on job completion. + // No duplicates are allowed. + // No file patterns are supported. + // + // The supported files are: + // + // Google Cloud Storage: + // + // storage.googleapis.com/{bucket}/{object} + // bucket.storage.googleapis.com/{object} + repeated string temp_files = 16; + + // User-defined labels for this job. + // + // The labels map can contain no more than 64 entries. Entries of the labels + // map are UTF8 strings that comply with the following restrictions: + // + // * Keys must conform to regexp: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62} + // * Values must conform to regexp: [\p{Ll}\p{Lo}\p{N}_-]{0,63} + // * Both keys and values are additionally constrained to be <= 128 bytes in + // size. + map labels = 17; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + // contains this job. + string location = 18; + + // Preliminary field: The format of this data may change at any time. + // A description of the user pipeline and stages through which it is executed. + // Created by Cloud Dataflow service. Only retrieved with + // JOB_VIEW_DESCRIPTION or JOB_VIEW_ALL. + PipelineDescription pipeline_description = 19; + + // This field may be mutated by the Cloud Dataflow service; + // callers cannot mutate it. + repeated ExecutionStageState stage_states = 20; + + // This field is populated by the Dataflow service to support filtering jobs + // by the metadata values provided here. Populated for ListJobs and all GetJob + // views SUMMARY and higher. + JobMetadata job_metadata = 21; + + // The timestamp when the job was started (transitioned to JOB_STATE_PENDING). + // Flexible resource scheduling jobs are started with some delay after job + // creation, so start_time is unset before start and is updated when the + // job is started by the Cloud Dataflow service. For other jobs, start_time + // always equals to create_time and is immutable and set by the Cloud Dataflow + // service. + google.protobuf.Timestamp start_time = 22; + + // If this is specified, the job's initial state is populated from the given + // snapshot. + string created_from_snapshot_id = 23; + + // Reserved for future use. This field is set only in responses from the + // server; it is ignored if it is set in any requests. + bool satisfies_pzs = 25; +} + +// Metadata for a Datastore connector used by the job. +message DatastoreIODetails { + // Namespace used in the connection. + string namespace = 1; + + // ProjectId accessed in the connection. + string project_id = 2; +} + +// Metadata for a Pub/Sub connector used by the job. +message PubSubIODetails { + // Topic accessed in the connection. + string topic = 1; + + // Subscription used in the connection. + string subscription = 2; +} + +// Metadata for a File connector used by the job. +message FileIODetails { + // File Pattern used to access files by the connector. + string file_pattern = 1; +} + +// Metadata for a Cloud Bigtable connector used by the job. +message BigTableIODetails { + // ProjectId accessed in the connection. + string project_id = 1; + + // InstanceId accessed in the connection. + string instance_id = 2; + + // TableId accessed in the connection. + string table_id = 3; +} + +// Metadata for a BigQuery connector used by the job. +message BigQueryIODetails { + // Table accessed in the connection. + string table = 1; + + // Dataset accessed in the connection. + string dataset = 2; + + // Project accessed in the connection. + string project_id = 3; + + // Query used to access data in the connection. + string query = 4; +} + +// Metadata for a Spanner connector used by the job. +message SpannerIODetails { + // ProjectId accessed in the connection. + string project_id = 1; + + // InstanceId accessed in the connection. + string instance_id = 2; + + // DatabaseId accessed in the connection. + string database_id = 3; +} + +// The version of the SDK used to run the job. +message SdkVersion { + // The support status of the SDK used to run the job. + enum SdkSupportStatus { + // Cloud Dataflow is unaware of this version. + UNKNOWN = 0; + + // This is a known version of an SDK, and is supported. + SUPPORTED = 1; + + // A newer version of the SDK family exists, and an update is recommended. + STALE = 2; + + // This version of the SDK is deprecated and will eventually be + // unsupported. + DEPRECATED = 3; + + // Support for this SDK version has ended and it should no longer be used. + UNSUPPORTED = 4; + } + + // The version of the SDK used to run the job. + string version = 1; + + // A readable string describing the version of the SDK. + string version_display_name = 2; + + // The support status for this SDK version. + SdkSupportStatus sdk_support_status = 3; +} + +// Metadata available primarily for filtering jobs. Will be included in the +// ListJob response and Job SUMMARY view. +message JobMetadata { + // The SDK version used to run the job. + SdkVersion sdk_version = 1; + + // Identification of a Spanner source used in the Dataflow job. + repeated SpannerIODetails spanner_details = 2; + + // Identification of a BigQuery source used in the Dataflow job. + repeated BigQueryIODetails bigquery_details = 3; + + // Identification of a Cloud Bigtable source used in the Dataflow job. + repeated BigTableIODetails big_table_details = 4; + + // Identification of a Pub/Sub source used in the Dataflow job. + repeated PubSubIODetails pubsub_details = 5; + + // Identification of a File source used in the Dataflow job. + repeated FileIODetails file_details = 6; + + // Identification of a Datastore source used in the Dataflow job. + repeated DatastoreIODetails datastore_details = 7; +} + +// A message describing the state of a particular execution stage. +message ExecutionStageState { + // The name of the execution stage. + string execution_stage_name = 1; + + // Executions stage states allow the same set of values as JobState. + JobState execution_stage_state = 2; + + // The time at which the stage transitioned to this state. + google.protobuf.Timestamp current_state_time = 3; +} + +// A descriptive representation of submitted pipeline as well as the executed +// form. This data is provided by the Dataflow service for ease of visualizing +// the pipeline and interpreting Dataflow provided metrics. +message PipelineDescription { + // Description of each transform in the pipeline and collections between them. + repeated TransformSummary original_pipeline_transform = 1; + + // Description of each stage of execution of the pipeline. + repeated ExecutionStageSummary execution_pipeline_stage = 2; + + // Pipeline level display data. + repeated DisplayData display_data = 3; +} + +// Type of transform or stage operation. +enum KindType { + // Unrecognized transform type. + UNKNOWN_KIND = 0; + + // ParDo transform. + PAR_DO_KIND = 1; + + // Group By Key transform. + GROUP_BY_KEY_KIND = 2; + + // Flatten transform. + FLATTEN_KIND = 3; + + // Read transform. + READ_KIND = 4; + + // Write transform. + WRITE_KIND = 5; + + // Constructs from a constant value, such as with Create.of. + CONSTANT_KIND = 6; + + // Creates a Singleton view of a collection. + SINGLETON_KIND = 7; + + // Opening or closing a shuffle session, often as part of a GroupByKey. + SHUFFLE_KIND = 8; +} + +// Description of the type, names/ids, and input/outputs for a transform. +message TransformSummary { + // Type of transform. + KindType kind = 1; + + // SDK generated id of this transform instance. + string id = 2; + + // User provided name for this transform instance. + string name = 3; + + // Transform-specific display data. + repeated DisplayData display_data = 4; + + // User names for all collection outputs to this transform. + repeated string output_collection_name = 5; + + // User names for all collection inputs to this transform. + repeated string input_collection_name = 6; +} + +// Description of the composing transforms, names/ids, and input/outputs of a +// stage of execution. Some composing transforms and sources may have been +// generated by the Dataflow service during execution planning. +message ExecutionStageSummary { + // Description of an input or output of an execution stage. + message StageSource { + // Human-readable name for this source; may be user or system generated. + string user_name = 1; + + // Dataflow service generated name for this source. + string name = 2; + + // User name for the original user transform or collection with which this + // source is most closely associated. + string original_transform_or_collection = 3; + + // Size of the source, if measurable. + int64 size_bytes = 4; + } + + // Description of a transform executed as part of an execution stage. + message ComponentTransform { + // Human-readable name for this transform; may be user or system generated. + string user_name = 1; + + // Dataflow service generated name for this source. + string name = 2; + + // User name for the original user transform with which this transform is + // most closely associated. + string original_transform = 3; + } + + // Description of an interstitial value between transforms in an execution + // stage. + message ComponentSource { + // Human-readable name for this transform; may be user or system generated. + string user_name = 1; + + // Dataflow service generated name for this source. + string name = 2; + + // User name for the original user transform or collection with which this + // source is most closely associated. + string original_transform_or_collection = 3; + } + + // Dataflow service generated name for this stage. + string name = 1; + + // Dataflow service generated id for this stage. + string id = 2; + + // Type of transform this stage is executing. + KindType kind = 3; + + // Input sources for this stage. + repeated StageSource input_source = 4; + + // Output sources for this stage. + repeated StageSource output_source = 5; + + // Other stages that must complete before this stage can run. + repeated string prerequisite_stage = 8; + + // Transforms that comprise this execution stage. + repeated ComponentTransform component_transform = 6; + + // Collections produced and consumed by component transforms of this stage. + repeated ComponentSource component_source = 7; +} + +// Data provided with a pipeline or transform to provide descriptive info. +message DisplayData { + // The key identifying the display data. + // This is intended to be used as a label for the display data + // when viewed in a dax monitoring system. + string key = 1; + + // The namespace for the key. This is usually a class name or programming + // language namespace (i.e. python module) which defines the display data. + // This allows a dax monitoring system to specially handle the data + // and perform custom rendering. + string namespace = 2; + + // Various value types which can be used for display data. Only one will be + // set. + oneof Value { + // Contains value if the data is of string type. + string str_value = 4; + + // Contains value if the data is of int64 type. + int64 int64_value = 5; + + // Contains value if the data is of float type. + float float_value = 6; + + // Contains value if the data is of java class type. + string java_class_value = 7; + + // Contains value if the data is of timestamp type. + google.protobuf.Timestamp timestamp_value = 8; + + // Contains value if the data is of duration type. + google.protobuf.Duration duration_value = 9; + + // Contains value if the data is of a boolean type. + bool bool_value = 10; + } + + // A possible additional shorter value to display. + // For example a java_class_name_value of com.mypackage.MyDoFn + // will be stored with MyDoFn as the short_str_value and + // com.mypackage.MyDoFn as the java_class_name value. + // short_str_value can be displayed and java_class_name_value + // will be displayed as a tooltip. + string short_str_value = 11; + + // An optional full URL. + string url = 12; + + // An optional label to display in a dax UI for the element. + string label = 13; +} + +// Defines a particular step within a Cloud Dataflow job. +// +// A job consists of multiple steps, each of which performs some +// specific operation as part of the overall job. Data is typically +// passed from one step to another as part of the job. +// +// Here's an example of a sequence of steps which together implement a +// Map-Reduce job: +// +// * Read a collection of data from some source, parsing the +// collection's elements. +// +// * Validate the elements. +// +// * Apply a user-defined function to map each element to some value +// and extract an element-specific key value. +// +// * Group elements with the same key into a single element with +// that key, transforming a multiply-keyed collection into a +// uniquely-keyed collection. +// +// * Write the elements out to some data sink. +// +// Note that the Cloud Dataflow service may be used to run many different +// types of jobs, not just Map-Reduce. +message Step { + // The kind of step in the Cloud Dataflow job. + string kind = 1; + + // The name that identifies the step. This must be unique for each + // step with respect to all other steps in the Cloud Dataflow job. + string name = 2; + + // Named properties associated with the step. Each kind of + // predefined step has its own required set of properties. + // Must be provided on Create. Only retrieved with JOB_VIEW_ALL. + google.protobuf.Struct properties = 3; +} + +// Describes the overall state of a [google.dataflow.v1beta3.Job][google.dataflow.v1beta3.Job]. +enum JobState { + // The job's run state isn't specified. + JOB_STATE_UNKNOWN = 0; + + // `JOB_STATE_STOPPED` indicates that the job has not + // yet started to run. + JOB_STATE_STOPPED = 1; + + // `JOB_STATE_RUNNING` indicates that the job is currently running. + JOB_STATE_RUNNING = 2; + + // `JOB_STATE_DONE` indicates that the job has successfully completed. + // This is a terminal job state. This state may be set by the Cloud Dataflow + // service, as a transition from `JOB_STATE_RUNNING`. It may also be set via a + // Cloud Dataflow `UpdateJob` call, if the job has not yet reached a terminal + // state. + JOB_STATE_DONE = 3; + + // `JOB_STATE_FAILED` indicates that the job has failed. This is a + // terminal job state. This state may only be set by the Cloud Dataflow + // service, and only as a transition from `JOB_STATE_RUNNING`. + JOB_STATE_FAILED = 4; + + // `JOB_STATE_CANCELLED` indicates that the job has been explicitly + // cancelled. This is a terminal job state. This state may only be + // set via a Cloud Dataflow `UpdateJob` call, and only if the job has not + // yet reached another terminal state. + JOB_STATE_CANCELLED = 5; + + // `JOB_STATE_UPDATED` indicates that the job was successfully updated, + // meaning that this job was stopped and another job was started, inheriting + // state from this one. This is a terminal job state. This state may only be + // set by the Cloud Dataflow service, and only as a transition from + // `JOB_STATE_RUNNING`. + JOB_STATE_UPDATED = 6; + + // `JOB_STATE_DRAINING` indicates that the job is in the process of draining. + // A draining job has stopped pulling from its input sources and is processing + // any data that remains in-flight. This state may be set via a Cloud Dataflow + // `UpdateJob` call, but only as a transition from `JOB_STATE_RUNNING`. Jobs + // that are draining may only transition to `JOB_STATE_DRAINED`, + // `JOB_STATE_CANCELLED`, or `JOB_STATE_FAILED`. + JOB_STATE_DRAINING = 7; + + // `JOB_STATE_DRAINED` indicates that the job has been drained. + // A drained job terminated by stopping pulling from its input sources and + // processing any data that remained in-flight when draining was requested. + // This state is a terminal state, may only be set by the Cloud Dataflow + // service, and only as a transition from `JOB_STATE_DRAINING`. + JOB_STATE_DRAINED = 8; + + // `JOB_STATE_PENDING` indicates that the job has been created but is not yet + // running. Jobs that are pending may only transition to `JOB_STATE_RUNNING`, + // or `JOB_STATE_FAILED`. + JOB_STATE_PENDING = 9; + + // `JOB_STATE_CANCELLING` indicates that the job has been explicitly cancelled + // and is in the process of stopping. Jobs that are cancelling may only + // transition to `JOB_STATE_CANCELLED` or `JOB_STATE_FAILED`. + JOB_STATE_CANCELLING = 10; + + // `JOB_STATE_QUEUED` indicates that the job has been created but is being + // delayed until launch. Jobs that are queued may only transition to + // `JOB_STATE_PENDING` or `JOB_STATE_CANCELLED`. + JOB_STATE_QUEUED = 11; + + // `JOB_STATE_RESOURCE_CLEANING_UP` indicates that the batch job's associated + // resources are currently being cleaned up after a successful run. + // Currently, this is an opt-in feature, please reach out to Cloud support + // team if you are interested. + JOB_STATE_RESOURCE_CLEANING_UP = 12; +} + +// Additional information about how a Cloud Dataflow job will be executed that +// isn't contained in the submitted job. +message JobExecutionInfo { + // A mapping from each stage to the information about that stage. + map stages = 1; +} + +// Contains information about how a particular +// [google.dataflow.v1beta3.Step][google.dataflow.v1beta3.Step] will be executed. +message JobExecutionStageInfo { + // The steps associated with the execution stage. + // Note that stages may have several steps, and that a given step + // might be run by more than one stage. + repeated string step_name = 1; +} + +// Selector for how much information is returned in Job responses. +enum JobView { + // The job view to return isn't specified, or is unknown. + // Responses will contain at least the `JOB_VIEW_SUMMARY` information, + // and may contain additional information. + JOB_VIEW_UNKNOWN = 0; + + // Request summary information only: + // Project ID, Job ID, job name, job type, job status, start/end time, + // and Cloud SDK version details. + JOB_VIEW_SUMMARY = 1; + + // Request all information available for this job. + JOB_VIEW_ALL = 2; + + // Request summary info and limited job description data for steps, labels and + // environment. + JOB_VIEW_DESCRIPTION = 3; +} + +// Request to create a Cloud Dataflow job. +message CreateJobRequest { + // The ID of the Cloud Platform project that the job belongs to. + string project_id = 1; + + // The job to create. + Job job = 2; + + // The level of information requested in response. + JobView view = 3; + + // Deprecated. This field is now in the Job message. + string replace_job_id = 4; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + // contains this job. + string location = 5; +} + +// Request to get the state of a Cloud Dataflow job. +message GetJobRequest { + // The ID of the Cloud Platform project that the job belongs to. + string project_id = 1; + + // The job ID. + string job_id = 2; + + // The level of information requested in response. + JobView view = 3; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + // contains this job. + string location = 4; +} + +// Request to update a Cloud Dataflow job. +message UpdateJobRequest { + // The ID of the Cloud Platform project that the job belongs to. + string project_id = 1; + + // The job ID. + string job_id = 2; + + // The updated job. + // Only the job state is updatable; other fields will be ignored. + Job job = 3; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + // contains this job. + string location = 4; +} + +// Request to list Cloud Dataflow jobs. +message ListJobsRequest { + // This field filters out and returns jobs in the specified job state. The + // order of data returned is determined by the filter used, and is subject to + // change. + enum Filter { + // The filter isn't specified, or is unknown. This returns all jobs ordered + // on descending `JobUuid`. + UNKNOWN = 0; + + // Returns all running jobs first ordered on creation timestamp, then + // returns all terminated jobs ordered on the termination timestamp. + ALL = 1; + + // Filters the jobs that have a terminated state, ordered on the + // termination timestamp. Example terminated states: `JOB_STATE_STOPPED`, + // `JOB_STATE_UPDATED`, `JOB_STATE_DRAINED`, etc. + TERMINATED = 2; + + // Filters the jobs that are running ordered on the creation timestamp. + ACTIVE = 3; + } + + // The kind of filter to use. + Filter filter = 5; + + // The project which owns the jobs. + string project_id = 1; + + // Deprecated. ListJobs always returns summaries now. + // Use GetJob for other JobViews. + JobView view = 2 [deprecated = true]; + + // If there are many jobs, limit response to at most this many. + // The actual number of jobs returned will be the lesser of max_responses + // and an unspecified server-defined limit. + int32 page_size = 3; + + // Set this to the 'next_page_token' field of a previous response + // to request additional results in a long list. + string page_token = 4; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + // contains this job. + string location = 17; +} + +// Indicates which [regional endpoint] +// (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) failed +// to respond to a request for data. +message FailedLocation { + // The name of the [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + // failed to respond. + string name = 1; +} + +// Response to a request to list Cloud Dataflow jobs in a project. This might +// be a partial response, depending on the page size in the ListJobsRequest. +// However, if the project does not have any jobs, an instance of +// ListJobsResponse is not returned and the requests's response +// body is empty {}. +message ListJobsResponse { + // A subset of the requested job information. + repeated Job jobs = 1; + + // Set if there may be more results than fit in this response. + string next_page_token = 2; + + // Zero or more messages describing the [regional endpoints] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + // failed to respond. + repeated FailedLocation failed_location = 3; +} + +// Request to create a snapshot of a job. +message SnapshotJobRequest { + // The project which owns the job to be snapshotted. + string project_id = 1; + + // The job to be snapshotted. + string job_id = 2; + + // TTL for the snapshot. + google.protobuf.Duration ttl = 3; + + // The location that contains this job. + string location = 4; + + // If true, perform snapshots for sources which support this. + bool snapshot_sources = 5; + + // User specified description of the snapshot. Maybe empty. + string description = 6; +} + +// Request to check is active jobs exists for a project +message CheckActiveJobsRequest { + // The project which owns the jobs. + string project_id = 1; +} + +// Response for CheckActiveJobsRequest. +message CheckActiveJobsResponse { + // If True, active jobs exists for project. False otherwise. + bool active_jobs_exist = 1; +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/messages.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/messages.proto new file mode 100644 index 00000000000..9fe098887f5 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/messages.proto @@ -0,0 +1,238 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.dataflow.v1beta3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; +option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; +option java_multiple_files = true; +option java_outer_classname = "MessagesProto"; +option java_package = "com.google.dataflow.v1beta3"; +option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; +option ruby_package = "Google::Cloud::Dataflow::V1beta3"; + +// The Dataflow Messages API is used for monitoring the progress of +// Dataflow jobs. +service MessagesV1Beta3 { + option (google.api.default_host) = "dataflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/compute," + "https://www.googleapis.com/auth/compute.readonly," + "https://www.googleapis.com/auth/userinfo.email"; + + // Request the job status. + // + // To request the status of a job, we recommend using + // `projects.locations.jobs.messages.list` with a [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using + // `projects.jobs.messages.list` is not recommended, as you can only request + // the status of jobs that are running in `us-central1`. + rpc ListJobMessages(ListJobMessagesRequest) returns (ListJobMessagesResponse) { + option (google.api.http) = { + get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/messages" + additional_bindings { + get: "/v1b3/projects/{project_id}/jobs/{job_id}/messages" + } + }; + } +} + +// A particular message pertaining to a Dataflow job. +message JobMessage { + // Deprecated. + string id = 1; + + // The timestamp of the message. + google.protobuf.Timestamp time = 2; + + // The text of the message. + string message_text = 3; + + // Importance level of the message. + JobMessageImportance message_importance = 4; +} + +// Indicates the importance of the message. +enum JobMessageImportance { + // The message importance isn't specified, or is unknown. + JOB_MESSAGE_IMPORTANCE_UNKNOWN = 0; + + // The message is at the 'debug' level: typically only useful for + // software engineers working on the code the job is running. + // Typically, Dataflow pipeline runners do not display log messages + // at this level by default. + JOB_MESSAGE_DEBUG = 1; + + // The message is at the 'detailed' level: somewhat verbose, but + // potentially useful to users. Typically, Dataflow pipeline + // runners do not display log messages at this level by default. + // These messages are displayed by default in the Dataflow + // monitoring UI. + JOB_MESSAGE_DETAILED = 2; + + // The message is at the 'basic' level: useful for keeping + // track of the execution of a Dataflow pipeline. Typically, + // Dataflow pipeline runners display log messages at this level by + // default, and these messages are displayed by default in the + // Dataflow monitoring UI. + JOB_MESSAGE_BASIC = 5; + + // The message is at the 'warning' level: indicating a condition + // pertaining to a job which may require human intervention. + // Typically, Dataflow pipeline runners display log messages at this + // level by default, and these messages are displayed by default in + // the Dataflow monitoring UI. + JOB_MESSAGE_WARNING = 3; + + // The message is at the 'error' level: indicating a condition + // preventing a job from succeeding. Typically, Dataflow pipeline + // runners display log messages at this level by default, and these + // messages are displayed by default in the Dataflow monitoring UI. + JOB_MESSAGE_ERROR = 4; +} + +// A rich message format, including a human readable string, a key for +// identifying the message, and structured data associated with the message for +// programmatic consumption. +message StructuredMessage { + // Structured data associated with this message. + message Parameter { + // Key or name for this parameter. + string key = 1; + + // Value for this parameter. + google.protobuf.Value value = 2; + } + + // Human-readable version of message. + string message_text = 1; + + // Identifier for this message type. Used by external systems to + // internationalize or personalize message. + string message_key = 2; + + // The structured data associated with this message. + repeated Parameter parameters = 3; +} + +// A structured message reporting an autoscaling decision made by the Dataflow +// service. +message AutoscalingEvent { + // Indicates the type of autoscaling event. + enum AutoscalingEventType { + // Default type for the enum. Value should never be returned. + TYPE_UNKNOWN = 0; + + // The TARGET_NUM_WORKERS_CHANGED type should be used when the target + // worker pool size has changed at the start of an actuation. An event + // should always be specified as TARGET_NUM_WORKERS_CHANGED if it reflects + // a change in the target_num_workers. + TARGET_NUM_WORKERS_CHANGED = 1; + + // The CURRENT_NUM_WORKERS_CHANGED type should be used when actual worker + // pool size has been changed, but the target_num_workers has not changed. + CURRENT_NUM_WORKERS_CHANGED = 2; + + // The ACTUATION_FAILURE type should be used when we want to report + // an error to the user indicating why the current number of workers + // in the pool could not be changed. + // Displayed in the current status and history widgets. + ACTUATION_FAILURE = 3; + + // Used when we want to report to the user a reason why we are + // not currently adjusting the number of workers. + // Should specify both target_num_workers, current_num_workers and a + // decision_message. + NO_CHANGE = 4; + } + + // The current number of workers the job has. + int64 current_num_workers = 1; + + // The target number of workers the worker pool wants to resize to use. + int64 target_num_workers = 2; + + // The type of autoscaling event to report. + AutoscalingEventType event_type = 3; + + // A message describing why the system decided to adjust the current + // number of workers, why it failed, or why the system decided to + // not make any changes to the number of workers. + StructuredMessage description = 4; + + // The time this event was emitted to indicate a new target or current + // num_workers value. + google.protobuf.Timestamp time = 5; + + // A short and friendly name for the worker pool this event refers to. + string worker_pool = 7; +} + +// Request to list job messages. +// Up to max_results messages will be returned in the time range specified +// starting with the oldest messages first. If no time range is specified +// the results with start with the oldest message. +message ListJobMessagesRequest { + // A project id. + string project_id = 1; + + // The job to get messages about. + string job_id = 2; + + // Filter to only get messages with importance >= level + JobMessageImportance minimum_importance = 3; + + // If specified, determines the maximum number of messages to + // return. If unspecified, the service may choose an appropriate + // default, or may return an arbitrarily large number of results. + int32 page_size = 4; + + // If supplied, this should be the value of next_page_token returned + // by an earlier call. This will cause the next page of results to + // be returned. + string page_token = 5; + + // If specified, return only messages with timestamps >= start_time. + // The default is the job creation time (i.e. beginning of messages). + google.protobuf.Timestamp start_time = 6; + + // Return only messages with timestamps < end_time. The default is now + // (i.e. return up to the latest messages available). + google.protobuf.Timestamp end_time = 7; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + // contains the job specified by job_id. + string location = 8; +} + +// Response to a request to list job messages. +message ListJobMessagesResponse { + // Messages in ascending timestamp order. + repeated JobMessage job_messages = 1; + + // The token to obtain the next page of results if there are more. + string next_page_token = 2; + + // Autoscaling events in ascending timestamp order. + repeated AutoscalingEvent autoscaling_events = 3; +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/metrics.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/metrics.proto new file mode 100644 index 00000000000..554af43fe3f --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/metrics.proto @@ -0,0 +1,369 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.dataflow.v1beta3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; +option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; +option java_multiple_files = true; +option java_outer_classname = "MetricsProto"; +option java_package = "com.google.dataflow.v1beta3"; +option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; +option ruby_package = "Google::Cloud::Dataflow::V1beta3"; + +// The Dataflow Metrics API lets you monitor the progress of Dataflow +// jobs. +service MetricsV1Beta3 { + option (google.api.default_host) = "dataflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/compute," + "https://www.googleapis.com/auth/compute.readonly," + "https://www.googleapis.com/auth/userinfo.email"; + + // Request the job status. + // + // To request the status of a job, we recommend using + // `projects.locations.jobs.getMetrics` with a [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using + // `projects.jobs.getMetrics` is not recommended, as you can only request the + // status of jobs that are running in `us-central1`. + rpc GetJobMetrics(GetJobMetricsRequest) returns (JobMetrics) { + option (google.api.http) = { + get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/metrics" + additional_bindings { + get: "/v1b3/projects/{project_id}/jobs/{job_id}/metrics" + } + }; + } + + // Request detailed information about the execution status of the job. + // + // EXPERIMENTAL. This API is subject to change or removal without notice. + rpc GetJobExecutionDetails(GetJobExecutionDetailsRequest) returns (JobExecutionDetails) { + option (google.api.http) = { + get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/executionDetails" + }; + } + + // Request detailed information about the execution status of a stage of the + // job. + // + // EXPERIMENTAL. This API is subject to change or removal without notice. + rpc GetStageExecutionDetails(GetStageExecutionDetailsRequest) returns (StageExecutionDetails) { + option (google.api.http) = { + get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/stages/{stage_id}/executionDetails" + }; + } +} + +// Identifies a metric, by describing the source which generated the +// metric. +message MetricStructuredName { + // Origin (namespace) of metric name. May be blank for user-define metrics; + // will be "dataflow" for metrics defined by the Dataflow service or SDK. + string origin = 1; + + // Worker-defined metric name. + string name = 2; + + // Zero or more labeled fields which identify the part of the job this + // metric is associated with, such as the name of a step or collection. + // + // For example, built-in counters associated with steps will have + // context['step'] = . Counters associated with PCollections + // in the SDK will have context['pcollection'] = . + map context = 3; +} + +// Describes the state of a metric. +message MetricUpdate { + // Name of the metric. + MetricStructuredName name = 1; + + // Metric aggregation kind. The possible metric aggregation kinds are + // "Sum", "Max", "Min", "Mean", "Set", "And", "Or", and "Distribution". + // The specified aggregation kind is case-insensitive. + // + // If omitted, this is not an aggregated value but instead + // a single metric sample value. + string kind = 2; + + // True if this metric is reported as the total cumulative aggregate + // value accumulated since the worker started working on this WorkItem. + // By default this is false, indicating that this metric is reported + // as a delta that is not associated with any WorkItem. + bool cumulative = 3; + + // Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min", + // "And", and "Or". The possible value types are Long, Double, and Boolean. + google.protobuf.Value scalar = 4; + + // Worker-computed aggregate value for the "Mean" aggregation kind. + // This holds the sum of the aggregated values and is used in combination + // with mean_count below to obtain the actual mean aggregate value. + // The only possible value types are Long and Double. + google.protobuf.Value mean_sum = 5; + + // Worker-computed aggregate value for the "Mean" aggregation kind. + // This holds the count of the aggregated values and is used in combination + // with mean_sum above to obtain the actual mean aggregate value. + // The only possible value type is Long. + google.protobuf.Value mean_count = 6; + + // Worker-computed aggregate value for the "Set" aggregation kind. The only + // possible value type is a list of Values whose type can be Long, Double, + // or String, according to the metric's type. All Values in the list must + // be of the same type. + google.protobuf.Value set = 7; + + // A struct value describing properties of a distribution of numeric values. + google.protobuf.Value distribution = 11; + + // A struct value describing properties of a Gauge. + // Metrics of gauge type show the value of a metric across time, and is + // aggregated based on the newest value. + google.protobuf.Value gauge = 12; + + // Worker-computed aggregate value for internal use by the Dataflow + // service. + google.protobuf.Value internal = 8; + + // Timestamp associated with the metric value. Optional when workers are + // reporting work progress; it will be filled in responses from the + // metrics API. + google.protobuf.Timestamp update_time = 9; +} + +// Request to get job metrics. +message GetJobMetricsRequest { + // A project id. + string project_id = 1; + + // The job to get metrics for. + string job_id = 2; + + // Return only metric data that has changed since this time. + // Default is to return all information about all metrics for the job. + google.protobuf.Timestamp start_time = 3; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + // contains the job specified by job_id. + string location = 4; +} + +// JobMetrics contains a collection of metrics describing the detailed progress +// of a Dataflow job. Metrics correspond to user-defined and system-defined +// metrics in the job. +// +// This resource captures only the most recent values of each metric; +// time-series data can be queried for them (under the same metric names) +// from Cloud Monitoring. +message JobMetrics { + // Timestamp as of which metric values are current. + google.protobuf.Timestamp metric_time = 1; + + // All metrics for this job. + repeated MetricUpdate metrics = 2; +} + +// Request to get job execution details. +message GetJobExecutionDetailsRequest { + // A project id. + string project_id = 1; + + // The job to get execution details for. + string job_id = 2; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + // contains the job specified by job_id. + string location = 3; + + // If specified, determines the maximum number of stages to + // return. If unspecified, the service may choose an appropriate + // default, or may return an arbitrarily large number of results. + int32 page_size = 4; + + // If supplied, this should be the value of next_page_token returned + // by an earlier call. This will cause the next page of results to + // be returned. + string page_token = 5; +} + +// Information about the progress of some component of job execution. +message ProgressTimeseries { + // A point in the timeseries. + message Point { + // The timestamp of the point. + google.protobuf.Timestamp time = 1; + + // The value of the point. + double value = 2; + } + + // The current progress of the component, in the range [0,1]. + double current_progress = 1; + + // History of progress for the component. + // + // Points are sorted by time. + repeated Point data_points = 2; +} + +// The state of some component of job execution. +enum ExecutionState { + // The component state is unknown or unspecified. + EXECUTION_STATE_UNKNOWN = 0; + + // The component is not yet running. + EXECUTION_STATE_NOT_STARTED = 1; + + // The component is currently running. + EXECUTION_STATE_RUNNING = 2; + + // The component succeeded. + EXECUTION_STATE_SUCCEEDED = 3; + + // The component failed. + EXECUTION_STATE_FAILED = 4; + + // Execution of the component was cancelled. + EXECUTION_STATE_CANCELLED = 5; +} + +// Information about a particular execution stage of a job. +message StageSummary { + // ID of this stage + string stage_id = 1; + + // State of this stage. + ExecutionState state = 2; + + // Start time of this stage. + google.protobuf.Timestamp start_time = 3; + + // End time of this stage. + // + // If the work item is completed, this is the actual end time of the stage. + // Otherwise, it is the predicted end time. + google.protobuf.Timestamp end_time = 4; + + // Progress for this stage. + // Only applicable to Batch jobs. + ProgressTimeseries progress = 5; + + // Metrics for this stage. + repeated MetricUpdate metrics = 6; +} + +// Information about the execution of a job. +message JobExecutionDetails { + // The stages of the job execution. + repeated StageSummary stages = 1; + + // If present, this response does not contain all requested tasks. To obtain + // the next page of results, repeat the request with page_token set to this + // value. + string next_page_token = 2; +} + +// Request to get information about a particular execution stage of a job. +// Currently only tracked for Batch jobs. +message GetStageExecutionDetailsRequest { + // A project id. + string project_id = 1; + + // The job to get execution details for. + string job_id = 2; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + // contains the job specified by job_id. + string location = 3; + + // The stage for which to fetch information. + string stage_id = 4; + + // If specified, determines the maximum number of work items to + // return. If unspecified, the service may choose an appropriate + // default, or may return an arbitrarily large number of results. + int32 page_size = 5; + + // If supplied, this should be the value of next_page_token returned + // by an earlier call. This will cause the next page of results to + // be returned. + string page_token = 6; + + // Lower time bound of work items to include, by start time. + google.protobuf.Timestamp start_time = 7; + + // Upper time bound of work items to include, by start time. + google.protobuf.Timestamp end_time = 8; +} + +// Information about an individual work item execution. +message WorkItemDetails { + // Name of this work item. + string task_id = 1; + + // Attempt ID of this work item + string attempt_id = 2; + + // Start time of this work item attempt. + google.protobuf.Timestamp start_time = 3; + + // End time of this work item attempt. + // + // If the work item is completed, this is the actual end time of the work + // item. Otherwise, it is the predicted end time. + google.protobuf.Timestamp end_time = 4; + + // State of this work item. + ExecutionState state = 5; + + // Progress of this work item. + ProgressTimeseries progress = 6; + + // Metrics for this work item. + repeated MetricUpdate metrics = 7; +} + +// Information about a worker +message WorkerDetails { + // Name of this worker + string worker_name = 1; + + // Work items processed by this worker, sorted by time. + repeated WorkItemDetails work_items = 2; +} + +// Information about the workers and work items within a stage. +message StageExecutionDetails { + // Workers that have done work on the stage. + repeated WorkerDetails workers = 1; + + // If present, this response does not contain all requested tasks. To obtain + // the next page of results, repeat the request with page_token set to this + // value. + string next_page_token = 2; +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/snapshots.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/snapshots.proto new file mode 100644 index 00000000000..5335fec664d --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/snapshots.proto @@ -0,0 +1,188 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.dataflow.v1beta3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; +option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; +option java_multiple_files = true; +option java_outer_classname = "SnapshotsProto"; +option java_package = "com.google.dataflow.v1beta3"; +option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; +option ruby_package = "Google::Cloud::Dataflow::V1beta3"; + +// Provides methods to manage snapshots of Google Cloud Dataflow jobs. +service SnapshotsV1Beta3 { + option (google.api.default_host) = "dataflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/compute," + "https://www.googleapis.com/auth/compute.readonly," + "https://www.googleapis.com/auth/userinfo.email"; + + // Gets information about a snapshot. + rpc GetSnapshot(GetSnapshotRequest) returns (Snapshot) { + option (google.api.http) = { + get: "/v1b3/projects/{project_id}/locations/{location}/snapshots/{snapshot_id}" + additional_bindings { + get: "/v1b3/projects/{project_id}/snapshots/{snapshot_id}" + } + }; + } + + // Deletes a snapshot. + rpc DeleteSnapshot(DeleteSnapshotRequest) returns (DeleteSnapshotResponse) { + option (google.api.http) = { + delete: "/v1b3/projects/{project_id}/locations/{location}/snapshots/{snapshot_id}" + additional_bindings { + delete: "/v1b3/projects/{project_id}/snapshots" + } + }; + } + + // Lists snapshots. + rpc ListSnapshots(ListSnapshotsRequest) returns (ListSnapshotsResponse) { + option (google.api.http) = { + get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/snapshots" + additional_bindings { + get: "/v1b3/projects/{project_id}/locations/{location}/snapshots" + } + additional_bindings { + get: "/v1b3/projects/{project_id}/snapshots" + } + }; + } +} + +// Snapshot state. +enum SnapshotState { + // Unknown state. + UNKNOWN_SNAPSHOT_STATE = 0; + + // Snapshot intent to create has been persisted, snapshotting of state has not + // yet started. + PENDING = 1; + + // Snapshotting is being performed. + RUNNING = 2; + + // Snapshot has been created and is ready to be used. + READY = 3; + + // Snapshot failed to be created. + FAILED = 4; + + // Snapshot has been deleted. + DELETED = 5; +} + +// Represents a Pubsub snapshot. +message PubsubSnapshotMetadata { + // The name of the Pubsub topic. + string topic_name = 1; + + // The name of the Pubsub snapshot. + string snapshot_name = 2; + + // The expire time of the Pubsub snapshot. + google.protobuf.Timestamp expire_time = 3; +} + +// Represents a snapshot of a job. +message Snapshot { + // The unique ID of this snapshot. + string id = 1; + + // The project this snapshot belongs to. + string project_id = 2; + + // The job this snapshot was created from. + string source_job_id = 3; + + // The time this snapshot was created. + google.protobuf.Timestamp creation_time = 4; + + // The time after which this snapshot will be automatically deleted. + google.protobuf.Duration ttl = 5; + + // State of the snapshot. + SnapshotState state = 6; + + // Pub/Sub snapshot metadata. + repeated PubsubSnapshotMetadata pubsub_metadata = 7; + + // User specified description of the snapshot. Maybe empty. + string description = 8; + + // The disk byte size of the snapshot. Only available for snapshots in READY + // state. + int64 disk_size_bytes = 9; + + // Cloud region where this snapshot lives in, e.g., "us-central1". + string region = 10; +} + +// Request to get information about a snapshot +message GetSnapshotRequest { + // The ID of the Cloud Platform project that the snapshot belongs to. + string project_id = 1; + + // The ID of the snapshot. + string snapshot_id = 2; + + // The location that contains this snapshot. + string location = 3; +} + +// Request to delete a snapshot. +message DeleteSnapshotRequest { + // The ID of the Cloud Platform project that the snapshot belongs to. + string project_id = 1; + + // The ID of the snapshot. + string snapshot_id = 2; + + // The location that contains this snapshot. + string location = 3; +} + +// Response from deleting a snapshot. +message DeleteSnapshotResponse { + +} + +// Request to list snapshots. +message ListSnapshotsRequest { + // The project ID to list snapshots for. + string project_id = 1; + + // If specified, list snapshots created from this job. + string job_id = 3; + + // The location to list snapshots in. + string location = 2; +} + +// List of snapshots. +message ListSnapshotsResponse { + // Returned snapshots. + repeated Snapshot snapshots = 1; +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/streaming.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/streaming.proto new file mode 100644 index 00000000000..17fb84a112f --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/streaming.proto @@ -0,0 +1,231 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.dataflow.v1beta3; + +option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; +option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; +option java_multiple_files = true; +option java_outer_classname = "StreamingProto"; +option java_package = "com.google.dataflow.v1beta3"; +option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; +option ruby_package = "Google::Cloud::Dataflow::V1beta3"; + +// Global topology of the streaming Dataflow job, including all +// computations and their sharded locations. +message TopologyConfig { + // The computations associated with a streaming Dataflow job. + repeated ComputationTopology computations = 1; + + // The disks assigned to a streaming Dataflow job. + repeated DataDiskAssignment data_disk_assignments = 2; + + // Maps user stage names to stable computation names. + map user_stage_to_computation_name_map = 3; + + // The size (in bits) of keys that will be assigned to source messages. + int32 forwarding_key_bits = 4; + + // Version number for persistent state. + int32 persistent_state_version = 5; +} + +// Identifies a pubsub location to use for transferring data into or +// out of a streaming Dataflow job. +message PubsubLocation { + // A pubsub topic, in the form of + // "pubsub.googleapis.com/topics//" + string topic = 1; + + // A pubsub subscription, in the form of + // "pubsub.googleapis.com/subscriptions//" + string subscription = 2; + + // If set, contains a pubsub label from which to extract record timestamps. + // If left empty, record timestamps will be generated upon arrival. + string timestamp_label = 3; + + // If set, contains a pubsub label from which to extract record ids. + // If left empty, record deduplication will be strictly best effort. + string id_label = 4; + + // Indicates whether the pipeline allows late-arriving data. + bool drop_late_data = 5; + + // If set, specifies the pubsub subscription that will be used for tracking + // custom time timestamps for watermark estimation. + string tracking_subscription = 6; + + // If true, then the client has requested to get pubsub attributes. + bool with_attributes = 7; +} + +// Identifies the location of a streaming computation stage, for +// stage-to-stage communication. +message StreamingStageLocation { + // Identifies the particular stream within the streaming Dataflow + // job. + string stream_id = 1; +} + +// Identifies the location of a streaming side input. +message StreamingSideInputLocation { + // Identifies the particular side input within the streaming Dataflow job. + string tag = 1; + + // Identifies the state family where this side input is stored. + string state_family = 2; +} + +// Identifies the location of a custom souce. +message CustomSourceLocation { + // Whether this source is stateful. + bool stateful = 1; +} + +// Describes a stream of data, either as input to be processed or as +// output of a streaming Dataflow job. +message StreamLocation { + // A specification of a stream's location. + oneof location { + // The stream is part of another computation within the current + // streaming Dataflow job. + StreamingStageLocation streaming_stage_location = 1; + + // The stream is a pubsub stream. + PubsubLocation pubsub_location = 2; + + // The stream is a streaming side input. + StreamingSideInputLocation side_input_location = 3; + + // The stream is a custom source. + CustomSourceLocation custom_source_location = 4; + } +} + +// State family configuration. +message StateFamilyConfig { + // The state family value. + string state_family = 1; + + // If true, this family corresponds to a read operation. + bool is_read = 2; +} + +// All configuration data for a particular Computation. +message ComputationTopology { + // The system stage name. + string system_stage_name = 1; + + // The ID of the computation. + string computation_id = 5; + + // The key ranges processed by the computation. + repeated KeyRangeLocation key_ranges = 2; + + // The inputs to the computation. + repeated StreamLocation inputs = 3; + + // The outputs from the computation. + repeated StreamLocation outputs = 4; + + // The state family values. + repeated StateFamilyConfig state_families = 7; +} + +// Location information for a specific key-range of a sharded computation. +// Currently we only support UTF-8 character splits to simplify encoding into +// JSON. +message KeyRangeLocation { + // The start (inclusive) of the key range. + string start = 1; + + // The end (exclusive) of the key range. + string end = 2; + + // The physical location of this range assignment to be used for + // streaming computation cross-worker message delivery. + string delivery_endpoint = 3; + + // The name of the data disk where data for this range is stored. + // This name is local to the Google Cloud Platform project and uniquely + // identifies the disk within that project, for example + // "myproject-1014-104817-4c2-harness-0-disk-1". + string data_disk = 5; + + // DEPRECATED. The location of the persistent state for this range, as a + // persistent directory in the worker local filesystem. + string deprecated_persistent_directory = 4 [deprecated = true]; +} + +// Describes mounted data disk. +message MountedDataDisk { + // The name of the data disk. + // This name is local to the Google Cloud Platform project and uniquely + // identifies the disk within that project, for example + // "myproject-1014-104817-4c2-harness-0-disk-1". + string data_disk = 1; +} + +// Data disk assignment for a given VM instance. +message DataDiskAssignment { + // VM instance name the data disks mounted to, for example + // "myproject-1014-104817-4c2-harness-0". + string vm_instance = 1; + + // Mounted data disks. The order is important a data disk's 0-based index in + // this list defines which persistent directory the disk is mounted to, for + // example the list of { "myproject-1014-104817-4c2-harness-0-disk-0" }, + // { "myproject-1014-104817-4c2-harness-0-disk-1" }. + repeated string data_disks = 2; +} + +// Data disk assignment information for a specific key-range of a sharded +// computation. +// Currently we only support UTF-8 character splits to simplify encoding into +// JSON. +message KeyRangeDataDiskAssignment { + // The start (inclusive) of the key range. + string start = 1; + + // The end (exclusive) of the key range. + string end = 2; + + // The name of the data disk where data for this range is stored. + // This name is local to the Google Cloud Platform project and uniquely + // identifies the disk within that project, for example + // "myproject-1014-104817-4c2-harness-0-disk-1". + string data_disk = 3; +} + +// Describes full or partial data disk assignment information of the computation +// ranges. +message StreamingComputationRanges { + // The ID of the computation. + string computation_id = 1; + + // Data disk assignments for ranges from this computation. + repeated KeyRangeDataDiskAssignment range_assignments = 2; +} + +// Streaming appliance snapshot configuration. +message StreamingApplianceSnapshotConfig { + // If set, indicates the snapshot id for the snapshot being performed. + string snapshot_id = 1; + + // Indicates which endpoint is used to import appliance state. + string import_state_endpoint = 2; +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/templates.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/templates.proto new file mode 100644 index 00000000000..7de72626a5f --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/templates.proto @@ -0,0 +1,632 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.dataflow.v1beta3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/dataflow/v1beta3/environment.proto"; +import "google/dataflow/v1beta3/jobs.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; +option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; +option java_multiple_files = true; +option java_outer_classname = "TemplatesProto"; +option java_package = "com.google.dataflow.v1beta3"; +option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; +option ruby_package = "Google::Cloud::Dataflow::V1beta3"; + +// Provides a method to create Cloud Dataflow jobs from templates. +service TemplatesService { + option (google.api.default_host) = "dataflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/compute," + "https://www.googleapis.com/auth/compute.readonly," + "https://www.googleapis.com/auth/userinfo.email"; + + // Creates a Cloud Dataflow job from a template. + rpc CreateJobFromTemplate(CreateJobFromTemplateRequest) returns (Job) { + option (google.api.http) = { + post: "/v1b3/projects/{project_id}/locations/{location}/templates" + body: "*" + additional_bindings { + post: "/v1b3/projects/{project_id}/templates" + body: "*" + } + }; + } + + // Launch a template. + rpc LaunchTemplate(LaunchTemplateRequest) returns (LaunchTemplateResponse) { + option (google.api.http) = { + post: "/v1b3/projects/{project_id}/locations/{location}/templates:launch" + body: "launch_parameters" + additional_bindings { + post: "/v1b3/projects/{project_id}/templates:launch" + body: "launch_parameters" + } + }; + } + + // Get the template associated with a template. + rpc GetTemplate(GetTemplateRequest) returns (GetTemplateResponse) { + option (google.api.http) = { + get: "/v1b3/projects/{project_id}/locations/{location}/templates:get" + additional_bindings { + get: "/v1b3/projects/{project_id}/templates:get" + } + }; + } +} + +// Provides a service for Flex templates. This feature is not ready yet. +service FlexTemplatesService { + option (google.api.default_host) = "dataflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/compute," + "https://www.googleapis.com/auth/compute.readonly," + "https://www.googleapis.com/auth/userinfo.email"; + + // Launch a job with a FlexTemplate. + rpc LaunchFlexTemplate(LaunchFlexTemplateRequest) returns (LaunchFlexTemplateResponse) { + option (google.api.http) = { + post: "/v1b3/projects/{project_id}/locations/{location}/flexTemplates:launch" + body: "*" + }; + } +} + +// Response to the request to launch a job from Flex Template. +message LaunchFlexTemplateResponse { + // The job that was launched, if the request was not a dry run and + // the job was successfully launched. + Job job = 1; +} + +// Container Spec. +message ContainerSpec { + // Name of the docker container image. E.g., gcr.io/project/some-image + string image = 1; + + // Metadata describing a template including description and validation rules. + TemplateMetadata metadata = 2; + + // Required. SDK info of the Flex Template. + SDKInfo sdk_info = 3; + + // Default runtime environment for the job. + FlexTemplateRuntimeEnvironment default_environment = 4; +} + +// Launch FlexTemplate Parameter. +message LaunchFlexTemplateParameter { + // Required. The job name to use for the created job. For update job request, + // job name should be same as the existing running job. + string job_name = 1; + + // Launch Mechanism. + oneof template { + // Spec about the container image to launch. + ContainerSpec container_spec = 4; + + // Cloud Storage path to a file with json serialized ContainerSpec as + // content. + string container_spec_gcs_path = 5; + } + + // The parameters for FlexTemplate. + // Ex. {"num_workers":"5"} + map parameters = 2; + + // Launch options for this flex template job. This is a common set of options + // across languages and templates. This should not be used to pass job + // parameters. + map launch_options = 6; + + // The runtime environment for the FlexTemplate job + FlexTemplateRuntimeEnvironment environment = 7; + + // Set this to true if you are sending a request to update a running + // streaming job. When set, the job name should be the same as the + // running job. + bool update = 8; + + // Use this to pass transform_name_mappings for streaming update jobs. + // Ex:{"oldTransformName":"newTransformName",...}' + map transform_name_mappings = 9; +} + +// The environment values to be set at runtime for flex template. +message FlexTemplateRuntimeEnvironment { + // The initial number of Google Compute Engine instances for the job. + int32 num_workers = 1; + + // The maximum number of Google Compute Engine instances to be made + // available to your pipeline during execution, from 1 to 1000. + int32 max_workers = 2; + + // The Compute Engine [availability + // zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones) + // for launching worker instances to run your pipeline. + // In the future, worker_zone will take precedence. + string zone = 3; + + // The email address of the service account to run the job as. + string service_account_email = 4; + + // The Cloud Storage path to use for temporary files. + // Must be a valid Cloud Storage URL, beginning with `gs://`. + string temp_location = 5; + + // The machine type to use for the job. Defaults to the value from the + // template if not specified. + string machine_type = 6; + + // Additional experiment flags for the job. + repeated string additional_experiments = 7; + + // Network to which VMs will be assigned. If empty or unspecified, + // the service will use the network "default". + string network = 8; + + // Subnetwork to which VMs will be assigned, if desired. You can specify a + // subnetwork using either a complete URL or an abbreviated path. Expected to + // be of the form + // "https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/regions/REGION/subnetworks/SUBNETWORK" + // or "regions/REGION/subnetworks/SUBNETWORK". If the subnetwork is located in + // a Shared VPC network, you must use the complete URL. + string subnetwork = 9; + + // Additional user labels to be specified for the job. + // Keys and values must follow the restrictions specified in the [labeling + // restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions) + // page. + // An object containing a list of "key": value pairs. + // Example: { "name": "wrench", "mass": "1kg", "count": "3" }. + map additional_user_labels = 10; + + // Name for the Cloud KMS key for the job. + // Key format is: + // projects//locations//keyRings//cryptoKeys/ + string kms_key_name = 11; + + // Configuration for VM IPs. + WorkerIPAddressConfiguration ip_configuration = 12; + + // The Compute Engine region + // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in + // which worker processing should occur, e.g. "us-west1". Mutually exclusive + // with worker_zone. If neither worker_region nor worker_zone is specified, + // default to the control plane's region. + string worker_region = 13; + + // The Compute Engine zone + // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in + // which worker processing should occur, e.g. "us-west1-a". Mutually exclusive + // with worker_region. If neither worker_region nor worker_zone is specified, + // a zone in the control plane's region is chosen based on available capacity. + // If both `worker_zone` and `zone` are set, `worker_zone` takes precedence. + string worker_zone = 14; + + // Whether to enable Streaming Engine for the job. + bool enable_streaming_engine = 15; + + // Set FlexRS goal for the job. + // https://cloud.google.com/dataflow/docs/guides/flexrs + FlexResourceSchedulingGoal flexrs_goal = 16; + + // The Cloud Storage path for staging local files. + // Must be a valid Cloud Storage URL, beginning with `gs://`. + string staging_location = 17; + + // Docker registry location of container image to use for the 'worker harness. + // Default is the container for the version of the SDK. Note this field is + // only valid for portable pipelines. + string sdk_container_image = 18; + + // Worker disk size, in gigabytes. + int32 disk_size_gb = 20; + + // The algorithm to use for autoscaling + AutoscalingAlgorithm autoscaling_algorithm = 21; + + // If true, save a heap dump before killing a thread or process which is GC + // thrashing or out of memory. The location of the heap file will either be + // echoed back to the user, or the user will be given the opportunity to + // download the heap file. + bool dump_heap_on_oom = 22; + + // Cloud Storage bucket (directory) to upload heap dumps to the given + // location. Enabling this implies that heap dumps should be generated on OOM + // (dump_heap_on_oom is set to true). + string save_heap_dumps_to_gcs_path = 23; + + // The machine type to use for launching the job. The default is + // n1-standard-1. + string launcher_machine_type = 24; +} + +// A request to launch a Cloud Dataflow job from a FlexTemplate. +message LaunchFlexTemplateRequest { + // Required. The ID of the Cloud Platform project that the job belongs to. + string project_id = 1; + + // Required. Parameter to launch a job form Flex Template. + LaunchFlexTemplateParameter launch_parameter = 2; + + // Required. The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + // which to direct the request. E.g., us-central1, us-west1. + string location = 3; + + // If true, the request is validated but not actually executed. + // Defaults to false. + bool validate_only = 4; +} + +// The environment values to set at runtime. +message RuntimeEnvironment { + // The initial number of Google Compute Engine instnaces for the job. + int32 num_workers = 11; + + // The maximum number of Google Compute Engine instances to be made + // available to your pipeline during execution, from 1 to 1000. + int32 max_workers = 1; + + // The Compute Engine [availability + // zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones) + // for launching worker instances to run your pipeline. + // In the future, worker_zone will take precedence. + string zone = 2; + + // The email address of the service account to run the job as. + string service_account_email = 3; + + // The Cloud Storage path to use for temporary files. + // Must be a valid Cloud Storage URL, beginning with `gs://`. + string temp_location = 4; + + // Whether to bypass the safety checks for the job's temporary directory. + // Use with caution. + bool bypass_temp_dir_validation = 5; + + // The machine type to use for the job. Defaults to the value from the + // template if not specified. + string machine_type = 6; + + // Additional experiment flags for the job, specified with the + // `--experiments` option. + repeated string additional_experiments = 7; + + // Network to which VMs will be assigned. If empty or unspecified, + // the service will use the network "default". + string network = 8; + + // Subnetwork to which VMs will be assigned, if desired. You can specify a + // subnetwork using either a complete URL or an abbreviated path. Expected to + // be of the form + // "https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/regions/REGION/subnetworks/SUBNETWORK" + // or "regions/REGION/subnetworks/SUBNETWORK". If the subnetwork is located in + // a Shared VPC network, you must use the complete URL. + string subnetwork = 9; + + // Additional user labels to be specified for the job. + // Keys and values should follow the restrictions specified in the [labeling + // restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions) + // page. + // An object containing a list of "key": value pairs. + // Example: { "name": "wrench", "mass": "1kg", "count": "3" }. + map additional_user_labels = 10; + + // Name for the Cloud KMS key for the job. + // Key format is: + // projects//locations//keyRings//cryptoKeys/ + string kms_key_name = 12; + + // Configuration for VM IPs. + WorkerIPAddressConfiguration ip_configuration = 14; + + // The Compute Engine region + // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in + // which worker processing should occur, e.g. "us-west1". Mutually exclusive + // with worker_zone. If neither worker_region nor worker_zone is specified, + // default to the control plane's region. + string worker_region = 15; + + // The Compute Engine zone + // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in + // which worker processing should occur, e.g. "us-west1-a". Mutually exclusive + // with worker_region. If neither worker_region nor worker_zone is specified, + // a zone in the control plane's region is chosen based on available capacity. + // If both `worker_zone` and `zone` are set, `worker_zone` takes precedence. + string worker_zone = 16; + + // Whether to enable Streaming Engine for the job. + bool enable_streaming_engine = 17; +} + +// Metadata for a specific parameter. +message ParameterMetadata { + // Required. The name of the parameter. + string name = 1; + + // Required. The label to display for the parameter. + string label = 2; + + // Required. The help text to display for the parameter. + string help_text = 3; + + // Optional. Whether the parameter is optional. Defaults to false. + bool is_optional = 4; + + // Optional. Regexes that the parameter must match. + repeated string regexes = 5; + + // Optional. The type of the parameter. + // Used for selecting input picker. + ParameterType param_type = 6; + + // Optional. Additional metadata for describing this parameter. + map custom_metadata = 7; +} + +// ParameterType specifies what kind of input we need for this parameter. +enum ParameterType { + // Default input type. + DEFAULT = 0; + + // The parameter specifies generic text input. + TEXT = 1; + + // The parameter specifies a Cloud Storage Bucket to read from. + GCS_READ_BUCKET = 2; + + // The parameter specifies a Cloud Storage Bucket to write to. + GCS_WRITE_BUCKET = 3; + + // The parameter specifies a Cloud Storage file path to read from. + GCS_READ_FILE = 4; + + // The parameter specifies a Cloud Storage file path to write to. + GCS_WRITE_FILE = 5; + + // The parameter specifies a Cloud Storage folder path to read from. + GCS_READ_FOLDER = 6; + + // The parameter specifies a Cloud Storage folder to write to. + GCS_WRITE_FOLDER = 7; + + // The parameter specifies a Pub/Sub Topic. + PUBSUB_TOPIC = 8; + + // The parameter specifies a Pub/Sub Subscription. + PUBSUB_SUBSCRIPTION = 9; +} + +// Metadata describing a template. +message TemplateMetadata { + // Required. The name of the template. + string name = 1; + + // Optional. A description of the template. + string description = 2; + + // The parameters for the template. + repeated ParameterMetadata parameters = 3; +} + +// SDK Information. +message SDKInfo { + // SDK Language. + enum Language { + // UNKNOWN Language. + UNKNOWN = 0; + + // Java. + JAVA = 1; + + // Python. + PYTHON = 2; + } + + // Required. The SDK Language. + Language language = 1; + + // Optional. The SDK version. + string version = 2; +} + +// RuntimeMetadata describing a runtime environment. +message RuntimeMetadata { + // SDK Info for the template. + SDKInfo sdk_info = 1; + + // The parameters for the template. + repeated ParameterMetadata parameters = 2; +} + +// A request to create a Cloud Dataflow job from a template. +message CreateJobFromTemplateRequest { + // Required. The ID of the Cloud Platform project that the job belongs to. + string project_id = 1; + + // Required. The job name to use for the created job. + string job_name = 4; + + // The template from which to create the job. + oneof template { + // Required. A Cloud Storage path to the template from which to + // create the job. + // Must be a valid Cloud Storage URL, beginning with `gs://`. + string gcs_path = 2; + } + + // The runtime parameters to pass to the job. + map parameters = 3; + + // The runtime environment for the job. + RuntimeEnvironment environment = 5; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + // which to direct the request. + string location = 6; +} + +// A request to retrieve a Cloud Dataflow job template. +message GetTemplateRequest { + // The various views of a template that may be retrieved. + enum TemplateView { + // Template view that retrieves only the metadata associated with the + // template. + METADATA_ONLY = 0; + } + + // Required. The ID of the Cloud Platform project that the job belongs to. + string project_id = 1; + + // The template from which to create the job. + oneof template { + // Required. A Cloud Storage path to the template from which to + // create the job. + // Must be valid Cloud Storage URL, beginning with 'gs://'. + string gcs_path = 2; + } + + // The view to retrieve. Defaults to METADATA_ONLY. + TemplateView view = 3; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + // which to direct the request. + string location = 4; +} + +// The response to a GetTemplate request. +message GetTemplateResponse { + // Template Type. + enum TemplateType { + // Unknown Template Type. + UNKNOWN = 0; + + // Legacy Template. + LEGACY = 1; + + // Flex Template. + FLEX = 2; + } + + // The status of the get template request. Any problems with the + // request will be indicated in the error_details. + google.rpc.Status status = 1; + + // The template metadata describing the template name, available + // parameters, etc. + TemplateMetadata metadata = 2; + + // Template Type. + TemplateType template_type = 3; + + // Describes the runtime metadata with SDKInfo and available parameters. + RuntimeMetadata runtime_metadata = 4; +} + +// Parameters to provide to the template being launched. +message LaunchTemplateParameters { + // Required. The job name to use for the created job. + string job_name = 1; + + // The runtime parameters to pass to the job. + map parameters = 2; + + // The runtime environment for the job. + RuntimeEnvironment environment = 3; + + // If set, replace the existing pipeline with the name specified by jobName + // with this pipeline, preserving state. + bool update = 4; + + // Only applicable when updating a pipeline. Map of transform name prefixes of + // the job to be replaced to the corresponding name prefixes of the new job. + map transform_name_mapping = 5; +} + +// A request to launch a template. +message LaunchTemplateRequest { + // Required. The ID of the Cloud Platform project that the job belongs to. + string project_id = 1; + + // If true, the request is validated but not actually executed. + // Defaults to false. + bool validate_only = 2; + + // The template from which to create the job. + oneof template { + // A Cloud Storage path to the template from which to create + // the job. + // Must be valid Cloud Storage URL, beginning with 'gs://'. + string gcs_path = 3; + + // Params for launching a dynamic template. + DynamicTemplateLaunchParams dynamic_template = 6; + } + + // The parameters of the template to launch. This should be part of the + // body of the POST request. + LaunchTemplateParameters launch_parameters = 4; + + // The [regional endpoint] + // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + // which to direct the request. + string location = 5; +} + +// Response to the request to launch a template. +message LaunchTemplateResponse { + // The job that was launched, if the request was not a dry run and + // the job was successfully launched. + Job job = 1; +} + +// Used in the error_details field of a google.rpc.Status message, this +// indicates problems with the template parameter. +message InvalidTemplateParameters { + // A specific template-parameter violation. + message ParameterViolation { + // The parameter that failed to validate. + string parameter = 1; + + // A description of why the parameter failed to validate. + string description = 2; + } + + // Describes all parameter violations in a template request. + repeated ParameterViolation parameter_violations = 1; +} + +// Params which should be passed when launching a dynamic template. +message DynamicTemplateLaunchParams { + // Path to dynamic template spec file on Cloud Storage. + // The file must be a Json serialized DynamicTemplateFieSpec object. + string gcs_path = 1; + + // Cloud Storage path for staging dependencies. + // Must be a valid Cloud Storage URL, beginning with `gs://`. + string staging_location = 2; +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/flex_templates_service.launch_flex_template.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/flex_templates_service.launch_flex_template.js new file mode 100644 index 00000000000..fed91d36bfa --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/flex_templates_service.launch_flex_template.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() { + // [START dataflow_v1beta3_generated_FlexTemplatesService_LaunchFlexTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ID of the Cloud Platform project that the job belongs to. + */ + // const projectId = 'abc123' + /** + * Required. Parameter to launch a job form Flex Template. + */ + // const launchParameter = {} + /** + * Required. The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + * which to direct the request. E.g., us-central1, us-west1. + */ + // const location = 'abc123' + /** + * If true, the request is validated but not actually executed. + * Defaults to false. + */ + // const validateOnly = true + + // Imports the Dataflow library + const {FlexTemplatesServiceClient} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new FlexTemplatesServiceClient(); + + async function callLaunchFlexTemplate() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.launchFlexTemplate(request); + console.log(response); + } + + callLaunchFlexTemplate(); + // [END dataflow_v1beta3_generated_FlexTemplatesService_LaunchFlexTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.aggregated_list_jobs.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.aggregated_list_jobs.js new file mode 100644 index 00000000000..65103553702 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.aggregated_list_jobs.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() { + // [START dataflow_v1beta3_generated_JobsV1Beta3_AggregatedListJobs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 kind of filter to use. + */ + // const filter = {} + /** + * The project which owns the jobs. + */ + // const projectId = 'abc123' + /** + * If there are many jobs, limit response to at most this many. + * The actual number of jobs returned will be the lesser of max_responses + * and an unspecified server-defined limit. + */ + // const pageSize = 1234 + /** + * Set this to the 'next_page_token' field of a previous response + * to request additional results in a long list. + */ + // const pageToken = 'abc123' + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new JobsV1Beta3Client(); + + async function callAggregatedListJobs() { + // Construct request + const request = { + }; + + // Run request + const iterable = await dataflowClient.aggregatedListJobsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callAggregatedListJobs(); + // [END dataflow_v1beta3_generated_JobsV1Beta3_AggregatedListJobs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.check_active_jobs.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.check_active_jobs.js new file mode 100644 index 00000000000..70951894af7 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.check_active_jobs.js @@ -0,0 +1,60 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 dataflow_v1beta3_generated_JobsV1Beta3_CheckActiveJobs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 which owns the jobs. + */ + // const projectId = 'abc123' + + // Imports the Dataflow library + const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new JobsV1Beta3Client(); + + async function callCheckActiveJobs() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.checkActiveJobs(request); + console.log(response); + } + + callCheckActiveJobs(); + // [END dataflow_v1beta3_generated_JobsV1Beta3_CheckActiveJobs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.create_job.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.create_job.js new file mode 100644 index 00000000000..2387d386057 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.create_job.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() { + // [START dataflow_v1beta3_generated_JobsV1Beta3_CreateJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 ID of the Cloud Platform project that the job belongs to. + */ + // const projectId = 'abc123' + /** + * The job to create. + */ + // const job = {} + /** + * The level of information requested in response. + */ + // const view = {} + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new JobsV1Beta3Client(); + + async function callCreateJob() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.createJob(request); + console.log(response); + } + + callCreateJob(); + // [END dataflow_v1beta3_generated_JobsV1Beta3_CreateJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.get_job.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.get_job.js new file mode 100644 index 00000000000..83346f10465 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.get_job.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() { + // [START dataflow_v1beta3_generated_JobsV1Beta3_GetJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 ID of the Cloud Platform project that the job belongs to. + */ + // const projectId = 'abc123' + /** + * The job ID. + */ + // const jobId = 'abc123' + /** + * The level of information requested in response. + */ + // const view = {} + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new JobsV1Beta3Client(); + + async function callGetJob() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.getJob(request); + console.log(response); + } + + callGetJob(); + // [END dataflow_v1beta3_generated_JobsV1Beta3_GetJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.list_jobs.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.list_jobs.js new file mode 100644 index 00000000000..aba7dec81c5 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.list_jobs.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() { + // [START dataflow_v1beta3_generated_JobsV1Beta3_ListJobs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 kind of filter to use. + */ + // const filter = {} + /** + * The project which owns the jobs. + */ + // const projectId = 'abc123' + /** + * If there are many jobs, limit response to at most this many. + * The actual number of jobs returned will be the lesser of max_responses + * and an unspecified server-defined limit. + */ + // const pageSize = 1234 + /** + * Set this to the 'next_page_token' field of a previous response + * to request additional results in a long list. + */ + // const pageToken = 'abc123' + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new JobsV1Beta3Client(); + + async function callListJobs() { + // Construct request + const request = { + }; + + // Run request + const iterable = await dataflowClient.listJobsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListJobs(); + // [END dataflow_v1beta3_generated_JobsV1Beta3_ListJobs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.snapshot_job.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.snapshot_job.js new file mode 100644 index 00000000000..04cd91e603f --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.snapshot_job.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() { + // [START dataflow_v1beta3_generated_JobsV1Beta3_SnapshotJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 which owns the job to be snapshotted. + */ + // const projectId = 'abc123' + /** + * The job to be snapshotted. + */ + // const jobId = 'abc123' + /** + * TTL for the snapshot. + */ + // const ttl = {} + /** + * The location that contains this job. + */ + // const location = 'abc123' + /** + * If true, perform snapshots for sources which support this. + */ + // const snapshotSources = true + /** + * User specified description of the snapshot. Maybe empty. + */ + // const description = 'abc123' + + // Imports the Dataflow library + const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new JobsV1Beta3Client(); + + async function callSnapshotJob() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.snapshotJob(request); + console.log(response); + } + + callSnapshotJob(); + // [END dataflow_v1beta3_generated_JobsV1Beta3_SnapshotJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.update_job.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.update_job.js new file mode 100644 index 00000000000..4c643f787bf --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.update_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() { + // [START dataflow_v1beta3_generated_JobsV1Beta3_UpdateJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 ID of the Cloud Platform project that the job belongs to. + */ + // const projectId = 'abc123' + /** + * The job ID. + */ + // const jobId = 'abc123' + /** + * The updated job. + * Only the job state is updatable; other fields will be ignored. + */ + // const job = {} + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new JobsV1Beta3Client(); + + async function callUpdateJob() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.updateJob(request); + console.log(response); + } + + callUpdateJob(); + // [END dataflow_v1beta3_generated_JobsV1Beta3_UpdateJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/messages_v1_beta3.list_job_messages.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/messages_v1_beta3.list_job_messages.js new file mode 100644 index 00000000000..9b5a0b1a456 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/messages_v1_beta3.list_job_messages.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() { + // [START dataflow_v1beta3_generated_MessagesV1Beta3_ListJobMessages_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 project id. + */ + // const projectId = 'abc123' + /** + * The job to get messages about. + */ + // const jobId = 'abc123' + /** + * Filter to only get messages with importance >= level + */ + // const minimumImportance = {} + /** + * If specified, determines the maximum number of messages to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + */ + // const pageSize = 1234 + /** + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * be returned. + */ + // const pageToken = 'abc123' + /** + * If specified, return only messages with timestamps >= start_time. + * The default is the job creation time (i.e. beginning of messages). + */ + // const startTime = {} + /** + * Return only messages with timestamps < end_time. The default is now + * (i.e. return up to the latest messages available). + */ + // const endTime = {} + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {MessagesV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new MessagesV1Beta3Client(); + + async function callListJobMessages() { + // Construct request + const request = { + }; + + // Run request + const iterable = await dataflowClient.listJobMessagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListJobMessages(); + // [END dataflow_v1beta3_generated_MessagesV1Beta3_ListJobMessages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_execution_details.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_execution_details.js new file mode 100644 index 00000000000..526f09466a8 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_execution_details.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 dataflow_v1beta3_generated_MetricsV1Beta3_GetJobExecutionDetails_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 project id. + */ + // const projectId = 'abc123' + /** + * The job to get execution details for. + */ + // const jobId = 'abc123' + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + */ + // const location = 'abc123' + /** + * If specified, determines the maximum number of stages to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + */ + // const pageSize = 1234 + /** + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * be returned. + */ + // const pageToken = 'abc123' + + // Imports the Dataflow library + const {MetricsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new MetricsV1Beta3Client(); + + async function callGetJobExecutionDetails() { + // Construct request + const request = { + }; + + // Run request + const iterable = await dataflowClient.getJobExecutionDetailsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGetJobExecutionDetails(); + // [END dataflow_v1beta3_generated_MetricsV1Beta3_GetJobExecutionDetails_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_metrics.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_metrics.js new file mode 100644 index 00000000000..f4537de7451 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_metrics.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() { + // [START dataflow_v1beta3_generated_MetricsV1Beta3_GetJobMetrics_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 project id. + */ + // const projectId = 'abc123' + /** + * The job to get metrics for. + */ + // const jobId = 'abc123' + /** + * Return only metric data that has changed since this time. + * Default is to return all information about all metrics for the job. + */ + // const startTime = {} + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {MetricsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new MetricsV1Beta3Client(); + + async function callGetJobMetrics() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.getJobMetrics(request); + console.log(response); + } + + callGetJobMetrics(); + // [END dataflow_v1beta3_generated_MetricsV1Beta3_GetJobMetrics_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_stage_execution_details.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_stage_execution_details.js new file mode 100644 index 00000000000..3a9c51b444e --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_stage_execution_details.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() { + // [START dataflow_v1beta3_generated_MetricsV1Beta3_GetStageExecutionDetails_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 project id. + */ + // const projectId = 'abc123' + /** + * The job to get execution details for. + */ + // const jobId = 'abc123' + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + */ + // const location = 'abc123' + /** + * The stage for which to fetch information. + */ + // const stageId = 'abc123' + /** + * If specified, determines the maximum number of work items to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + */ + // const pageSize = 1234 + /** + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * be returned. + */ + // const pageToken = 'abc123' + /** + * Lower time bound of work items to include, by start time. + */ + // const startTime = {} + /** + * Upper time bound of work items to include, by start time. + */ + // const endTime = {} + + // Imports the Dataflow library + const {MetricsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new MetricsV1Beta3Client(); + + async function callGetStageExecutionDetails() { + // Construct request + const request = { + }; + + // Run request + const iterable = await dataflowClient.getStageExecutionDetailsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGetStageExecutionDetails(); + // [END dataflow_v1beta3_generated_MetricsV1Beta3_GetStageExecutionDetails_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.delete_snapshot.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.delete_snapshot.js new file mode 100644 index 00000000000..49a878f35cf --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.delete_snapshot.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() { + // [START dataflow_v1beta3_generated_SnapshotsV1Beta3_DeleteSnapshot_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 ID of the Cloud Platform project that the snapshot belongs to. + */ + // const projectId = 'abc123' + /** + * The ID of the snapshot. + */ + // const snapshotId = 'abc123' + /** + * The location that contains this snapshot. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {SnapshotsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new SnapshotsV1Beta3Client(); + + async function callDeleteSnapshot() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.deleteSnapshot(request); + console.log(response); + } + + callDeleteSnapshot(); + // [END dataflow_v1beta3_generated_SnapshotsV1Beta3_DeleteSnapshot_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.get_snapshot.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.get_snapshot.js new file mode 100644 index 00000000000..e03ed233c72 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.get_snapshot.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() { + // [START dataflow_v1beta3_generated_SnapshotsV1Beta3_GetSnapshot_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 ID of the Cloud Platform project that the snapshot belongs to. + */ + // const projectId = 'abc123' + /** + * The ID of the snapshot. + */ + // const snapshotId = 'abc123' + /** + * The location that contains this snapshot. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {SnapshotsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new SnapshotsV1Beta3Client(); + + async function callGetSnapshot() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.getSnapshot(request); + console.log(response); + } + + callGetSnapshot(); + // [END dataflow_v1beta3_generated_SnapshotsV1Beta3_GetSnapshot_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.list_snapshots.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.list_snapshots.js new file mode 100644 index 00000000000..dfb5c7e713c --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.list_snapshots.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() { + // [START dataflow_v1beta3_generated_SnapshotsV1Beta3_ListSnapshots_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 ID to list snapshots for. + */ + // const projectId = 'abc123' + /** + * If specified, list snapshots created from this job. + */ + // const jobId = 'abc123' + /** + * The location to list snapshots in. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {SnapshotsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new SnapshotsV1Beta3Client(); + + async function callListSnapshots() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.listSnapshots(request); + console.log(response); + } + + callListSnapshots(); + // [END dataflow_v1beta3_generated_SnapshotsV1Beta3_ListSnapshots_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snippet_metadata_google.dataflow.v1beta3.json b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snippet_metadata_google.dataflow.v1beta3.json new file mode 100644 index 00000000000..d6e58f58bcb --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snippet_metadata_google.dataflow.v1beta3.json @@ -0,0 +1,1007 @@ +{ + "clientLibrary": { + "name": "nodejs-dataflow", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.dataflow.v1beta3", + "version": "v1beta3" + } + ] + }, + "snippets": [ + { + "regionTag": "dataflow_v1beta3_generated_FlexTemplatesService_LaunchFlexTemplate_async", + "title": "FlexTemplatesService launchFlexTemplate Sample", + "origin": "API_DEFINITION", + "description": " Launch a job with a FlexTemplate.", + "canonical": true, + "file": "flex_templates_service.launch_flex_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "LaunchFlexTemplate", + "fullName": "google.dataflow.v1beta3.FlexTemplatesService.LaunchFlexTemplate", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "launch_parameter", + "type": ".google.dataflow.v1beta3.LaunchFlexTemplateParameter" + }, + { + "name": "location", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.dataflow.v1beta3.LaunchFlexTemplateResponse", + "client": { + "shortName": "FlexTemplatesServiceClient", + "fullName": "google.dataflow.v1beta3.FlexTemplatesServiceClient" + }, + "method": { + "shortName": "LaunchFlexTemplate", + "fullName": "google.dataflow.v1beta3.FlexTemplatesService.LaunchFlexTemplate", + "service": { + "shortName": "FlexTemplatesService", + "fullName": "google.dataflow.v1beta3.FlexTemplatesService" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_CreateJob_async", + "title": "FlexTemplatesService createJob Sample", + "origin": "API_DEFINITION", + "description": " Creates a Cloud Dataflow job. To create a job, we recommend using `projects.locations.jobs.create` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.create` is not recommended, as your job will always start in `us-central1`.", + "canonical": true, + "file": "jobs_v1_beta3.create_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateJob", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.CreateJob", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "job", + "type": ".google.dataflow.v1beta3.Job" + }, + { + "name": "view", + "type": ".google.dataflow.v1beta3.JobView" + }, + { + "name": "replace_job_id", + "type": "TYPE_STRING" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.Job", + "client": { + "shortName": "JobsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" + }, + "method": { + "shortName": "CreateJob", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.CreateJob", + "service": { + "shortName": "JobsV1Beta3", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_GetJob_async", + "title": "FlexTemplatesService getJob Sample", + "origin": "API_DEFINITION", + "description": " Gets the state of the specified Cloud Dataflow job. To get the state of a job, we recommend using `projects.locations.jobs.get` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.get` is not recommended, as you can only get the state of jobs that are running in `us-central1`.", + "canonical": true, + "file": "jobs_v1_beta3.get_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetJob", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.GetJob", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.dataflow.v1beta3.JobView" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.Job", + "client": { + "shortName": "JobsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" + }, + "method": { + "shortName": "GetJob", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.GetJob", + "service": { + "shortName": "JobsV1Beta3", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_UpdateJob_async", + "title": "FlexTemplatesService updateJob Sample", + "origin": "API_DEFINITION", + "description": " Updates the state of an existing Cloud Dataflow job. To update the state of an existing job, we recommend using `projects.locations.jobs.update` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.update` is not recommended, as you can only update the state of jobs that are running in `us-central1`.", + "canonical": true, + "file": "jobs_v1_beta3.update_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateJob", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.UpdateJob", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + }, + { + "name": "job", + "type": ".google.dataflow.v1beta3.Job" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.Job", + "client": { + "shortName": "JobsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" + }, + "method": { + "shortName": "UpdateJob", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.UpdateJob", + "service": { + "shortName": "JobsV1Beta3", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_ListJobs_async", + "title": "FlexTemplatesService listJobs Sample", + "origin": "API_DEFINITION", + "description": " List the jobs of a project. To list the jobs of a project in a region, we recommend using `projects.locations.jobs.list` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). To list the all jobs across all regions, use `projects.jobs.aggregated`. Using `projects.jobs.list` is not recommended, as you can only get the list of jobs that are running in `us-central1`.", + "canonical": true, + "file": "jobs_v1_beta3.list_jobs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListJobs", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.ListJobs", + "async": true, + "parameters": [ + { + "name": "filter", + "type": ".google.dataflow.v1beta3.ListJobsRequest.Filter" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.dataflow.v1beta3.JobView" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.ListJobsResponse", + "client": { + "shortName": "JobsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" + }, + "method": { + "shortName": "ListJobs", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.ListJobs", + "service": { + "shortName": "JobsV1Beta3", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_AggregatedListJobs_async", + "title": "FlexTemplatesService aggregatedListJobs Sample", + "origin": "API_DEFINITION", + "description": " List the jobs of a project across all regions.", + "canonical": true, + "file": "jobs_v1_beta3.aggregated_list_jobs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AggregatedListJobs", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.AggregatedListJobs", + "async": true, + "parameters": [ + { + "name": "filter", + "type": ".google.dataflow.v1beta3.ListJobsRequest.Filter" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.dataflow.v1beta3.JobView" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.ListJobsResponse", + "client": { + "shortName": "JobsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" + }, + "method": { + "shortName": "AggregatedListJobs", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.AggregatedListJobs", + "service": { + "shortName": "JobsV1Beta3", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_CheckActiveJobs_async", + "title": "FlexTemplatesService checkActiveJobs Sample", + "origin": "API_DEFINITION", + "description": " Check for existence of active jobs in the given project across all regions.", + "canonical": true, + "file": "jobs_v1_beta3.check_active_jobs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CheckActiveJobs", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.CheckActiveJobs", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.CheckActiveJobsResponse", + "client": { + "shortName": "JobsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" + }, + "method": { + "shortName": "CheckActiveJobs", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.CheckActiveJobs", + "service": { + "shortName": "JobsV1Beta3", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_SnapshotJob_async", + "title": "FlexTemplatesService snapshotJob Sample", + "origin": "API_DEFINITION", + "description": " Snapshot the state of a streaming job.", + "canonical": true, + "file": "jobs_v1_beta3.snapshot_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SnapshotJob", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.SnapshotJob", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + }, + { + "name": "ttl", + "type": ".google.protobuf.Duration" + }, + { + "name": "location", + "type": "TYPE_STRING" + }, + { + "name": "snapshot_sources", + "type": "TYPE_BOOL" + }, + { + "name": "description", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.Snapshot", + "client": { + "shortName": "JobsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" + }, + "method": { + "shortName": "SnapshotJob", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3.SnapshotJob", + "service": { + "shortName": "JobsV1Beta3", + "fullName": "google.dataflow.v1beta3.JobsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_MessagesV1Beta3_ListJobMessages_async", + "title": "FlexTemplatesService listJobMessages Sample", + "origin": "API_DEFINITION", + "description": " Request the job status. To request the status of a job, we recommend using `projects.locations.jobs.messages.list` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.messages.list` is not recommended, as you can only request the status of jobs that are running in `us-central1`.", + "canonical": true, + "file": "messages_v1_beta3.list_job_messages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 90, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListJobMessages", + "fullName": "google.dataflow.v1beta3.MessagesV1Beta3.ListJobMessages", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + }, + { + "name": "minimum_importance", + "type": ".google.dataflow.v1beta3.JobMessageImportance" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "end_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.ListJobMessagesResponse", + "client": { + "shortName": "MessagesV1Beta3Client", + "fullName": "google.dataflow.v1beta3.MessagesV1Beta3Client" + }, + "method": { + "shortName": "ListJobMessages", + "fullName": "google.dataflow.v1beta3.MessagesV1Beta3.ListJobMessages", + "service": { + "shortName": "MessagesV1Beta3", + "fullName": "google.dataflow.v1beta3.MessagesV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_MetricsV1Beta3_GetJobMetrics_async", + "title": "FlexTemplatesService getJobMetrics Sample", + "origin": "API_DEFINITION", + "description": " Request the job status. To request the status of a job, we recommend using `projects.locations.jobs.getMetrics` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.getMetrics` is not recommended, as you can only request the status of jobs that are running in `us-central1`.", + "canonical": true, + "file": "metrics_v1_beta3.get_job_metrics.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetJobMetrics", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetJobMetrics", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.JobMetrics", + "client": { + "shortName": "MetricsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3Client" + }, + "method": { + "shortName": "GetJobMetrics", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetJobMetrics", + "service": { + "shortName": "MetricsV1Beta3", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_MetricsV1Beta3_GetJobExecutionDetails_async", + "title": "FlexTemplatesService getJobExecutionDetails Sample", + "origin": "API_DEFINITION", + "description": " Request detailed information about the execution status of the job. EXPERIMENTAL. This API is subject to change or removal without notice.", + "canonical": true, + "file": "metrics_v1_beta3.get_job_execution_details.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetJobExecutionDetails", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetJobExecutionDetails", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + }, + { + "name": "location", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.JobExecutionDetails", + "client": { + "shortName": "MetricsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3Client" + }, + "method": { + "shortName": "GetJobExecutionDetails", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetJobExecutionDetails", + "service": { + "shortName": "MetricsV1Beta3", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_MetricsV1Beta3_GetStageExecutionDetails_async", + "title": "FlexTemplatesService getStageExecutionDetails Sample", + "origin": "API_DEFINITION", + "description": " Request detailed information about the execution status of a stage of the job. EXPERIMENTAL. This API is subject to change or removal without notice.", + "canonical": true, + "file": "metrics_v1_beta3.get_stage_execution_details.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 88, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetStageExecutionDetails", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetStageExecutionDetails", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + }, + { + "name": "location", + "type": "TYPE_STRING" + }, + { + "name": "stage_id", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "end_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.dataflow.v1beta3.StageExecutionDetails", + "client": { + "shortName": "MetricsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3Client" + }, + "method": { + "shortName": "GetStageExecutionDetails", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetStageExecutionDetails", + "service": { + "shortName": "MetricsV1Beta3", + "fullName": "google.dataflow.v1beta3.MetricsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_SnapshotsV1Beta3_GetSnapshot_async", + "title": "FlexTemplatesService getSnapshot Sample", + "origin": "API_DEFINITION", + "description": " Gets information about a snapshot.", + "canonical": true, + "file": "snapshots_v1_beta3.get_snapshot.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSnapshot", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.GetSnapshot", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "snapshot_id", + "type": "TYPE_STRING" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.Snapshot", + "client": { + "shortName": "SnapshotsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3Client" + }, + "method": { + "shortName": "GetSnapshot", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.GetSnapshot", + "service": { + "shortName": "SnapshotsV1Beta3", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_SnapshotsV1Beta3_DeleteSnapshot_async", + "title": "FlexTemplatesService deleteSnapshot Sample", + "origin": "API_DEFINITION", + "description": " Deletes a snapshot.", + "canonical": true, + "file": "snapshots_v1_beta3.delete_snapshot.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSnapshot", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.DeleteSnapshot", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "snapshot_id", + "type": "TYPE_STRING" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.DeleteSnapshotResponse", + "client": { + "shortName": "SnapshotsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3Client" + }, + "method": { + "shortName": "DeleteSnapshot", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.DeleteSnapshot", + "service": { + "shortName": "SnapshotsV1Beta3", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_SnapshotsV1Beta3_ListSnapshots_async", + "title": "FlexTemplatesService listSnapshots Sample", + "origin": "API_DEFINITION", + "description": " Lists snapshots.", + "canonical": true, + "file": "snapshots_v1_beta3.list_snapshots.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSnapshots", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.ListSnapshots", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.ListSnapshotsResponse", + "client": { + "shortName": "SnapshotsV1Beta3Client", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3Client" + }, + "method": { + "shortName": "ListSnapshots", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.ListSnapshots", + "service": { + "shortName": "SnapshotsV1Beta3", + "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_TemplatesService_CreateJobFromTemplate_async", + "title": "FlexTemplatesService createJobFromTemplate Sample", + "origin": "API_DEFINITION", + "description": " Creates a Cloud Dataflow job from a template.", + "canonical": true, + "file": "templates_service.create_job_from_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateJobFromTemplate", + "fullName": "google.dataflow.v1beta3.TemplatesService.CreateJobFromTemplate", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "job_name", + "type": "TYPE_STRING" + }, + { + "name": "gcs_path", + "type": "TYPE_STRING" + }, + { + "name": "parameters", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "environment", + "type": ".google.dataflow.v1beta3.RuntimeEnvironment" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.Job", + "client": { + "shortName": "TemplatesServiceClient", + "fullName": "google.dataflow.v1beta3.TemplatesServiceClient" + }, + "method": { + "shortName": "CreateJobFromTemplate", + "fullName": "google.dataflow.v1beta3.TemplatesService.CreateJobFromTemplate", + "service": { + "shortName": "TemplatesService", + "fullName": "google.dataflow.v1beta3.TemplatesService" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_TemplatesService_LaunchTemplate_async", + "title": "FlexTemplatesService launchTemplate Sample", + "origin": "API_DEFINITION", + "description": " Launch a template.", + "canonical": true, + "file": "templates_service.launch_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "LaunchTemplate", + "fullName": "google.dataflow.v1beta3.TemplatesService.LaunchTemplate", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "gcs_path", + "type": "TYPE_STRING" + }, + { + "name": "dynamic_template", + "type": ".google.dataflow.v1beta3.DynamicTemplateLaunchParams" + }, + { + "name": "launch_parameters", + "type": ".google.dataflow.v1beta3.LaunchTemplateParameters" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.LaunchTemplateResponse", + "client": { + "shortName": "TemplatesServiceClient", + "fullName": "google.dataflow.v1beta3.TemplatesServiceClient" + }, + "method": { + "shortName": "LaunchTemplate", + "fullName": "google.dataflow.v1beta3.TemplatesService.LaunchTemplate", + "service": { + "shortName": "TemplatesService", + "fullName": "google.dataflow.v1beta3.TemplatesService" + } + } + } + }, + { + "regionTag": "dataflow_v1beta3_generated_TemplatesService_GetTemplate_async", + "title": "FlexTemplatesService getTemplate Sample", + "origin": "API_DEFINITION", + "description": " Get the template associated with a template.", + "canonical": true, + "file": "templates_service.get_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetTemplate", + "fullName": "google.dataflow.v1beta3.TemplatesService.GetTemplate", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "gcs_path", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.dataflow.v1beta3.GetTemplateRequest.TemplateView" + }, + { + "name": "location", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.dataflow.v1beta3.GetTemplateResponse", + "client": { + "shortName": "TemplatesServiceClient", + "fullName": "google.dataflow.v1beta3.TemplatesServiceClient" + }, + "method": { + "shortName": "GetTemplate", + "fullName": "google.dataflow.v1beta3.TemplatesService.GetTemplate", + "service": { + "shortName": "TemplatesService", + "fullName": "google.dataflow.v1beta3.TemplatesService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.create_job_from_template.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.create_job_from_template.js new file mode 100644 index 00000000000..293db4e752f --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.create_job_from_template.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 dataflow_v1beta3_generated_TemplatesService_CreateJobFromTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ID of the Cloud Platform project that the job belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The job name to use for the created job. + */ + // const jobName = 'abc123' + /** + * Required. A Cloud Storage path to the template from which to + * create the job. + * Must be a valid Cloud Storage URL, beginning with `gs://`. + */ + // const gcsPath = 'abc123' + /** + * The runtime parameters to pass to the job. + */ + // const parameters = [1,2,3,4] + /** + * The runtime environment for the job. + */ + // const environment = {} + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + * which to direct the request. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {TemplatesServiceClient} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new TemplatesServiceClient(); + + async function callCreateJobFromTemplate() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.createJobFromTemplate(request); + console.log(response); + } + + callCreateJobFromTemplate(); + // [END dataflow_v1beta3_generated_TemplatesService_CreateJobFromTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.get_template.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.get_template.js new file mode 100644 index 00000000000..f282ccd18cb --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.get_template.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() { + // [START dataflow_v1beta3_generated_TemplatesService_GetTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ID of the Cloud Platform project that the job belongs to. + */ + // const projectId = 'abc123' + /** + * Required. A Cloud Storage path to the template from which to + * create the job. + * Must be valid Cloud Storage URL, beginning with 'gs://'. + */ + // const gcsPath = 'abc123' + /** + * The view to retrieve. Defaults to METADATA_ONLY. + */ + // const view = {} + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + * which to direct the request. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {TemplatesServiceClient} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new TemplatesServiceClient(); + + async function callGetTemplate() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.getTemplate(request); + console.log(response); + } + + callGetTemplate(); + // [END dataflow_v1beta3_generated_TemplatesService_GetTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.launch_template.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.launch_template.js new file mode 100644 index 00000000000..5b246afee5a --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.launch_template.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() { + // [START dataflow_v1beta3_generated_TemplatesService_LaunchTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ID of the Cloud Platform project that the job belongs to. + */ + // const projectId = 'abc123' + /** + * If true, the request is validated but not actually executed. + * Defaults to false. + */ + // const validateOnly = true + /** + * A Cloud Storage path to the template from which to create + * the job. + * Must be valid Cloud Storage URL, beginning with 'gs://'. + */ + // const gcsPath = 'abc123' + /** + * Params for launching a dynamic template. + */ + // const dynamicTemplate = {} + /** + * The parameters of the template to launch. This should be part of the + * body of the POST request. + */ + // const launchParameters = {} + /** + * The regional endpoint + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + * which to direct the request. + */ + // const location = 'abc123' + + // Imports the Dataflow library + const {TemplatesServiceClient} = require('@google-cloud/dataflow').v1beta3; + + // Instantiates a client + const dataflowClient = new TemplatesServiceClient(); + + async function callLaunchTemplate() { + // Construct request + const request = { + }; + + // Run request + const response = await dataflowClient.launchTemplate(request); + console.log(response); + } + + callLaunchTemplate(); + // [END dataflow_v1beta3_generated_TemplatesService_LaunchTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/index.ts b/owl-bot-staging/google-dataflow/v1beta3/src/index.ts new file mode 100644 index 00000000000..1c1ba5827e3 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/index.ts @@ -0,0 +1,35 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 v1beta3 from './v1beta3'; +const FlexTemplatesServiceClient = v1beta3.FlexTemplatesServiceClient; +type FlexTemplatesServiceClient = v1beta3.FlexTemplatesServiceClient; +const JobsV1Beta3Client = v1beta3.JobsV1Beta3Client; +type JobsV1Beta3Client = v1beta3.JobsV1Beta3Client; +const MessagesV1Beta3Client = v1beta3.MessagesV1Beta3Client; +type MessagesV1Beta3Client = v1beta3.MessagesV1Beta3Client; +const MetricsV1Beta3Client = v1beta3.MetricsV1Beta3Client; +type MetricsV1Beta3Client = v1beta3.MetricsV1Beta3Client; +const SnapshotsV1Beta3Client = v1beta3.SnapshotsV1Beta3Client; +type SnapshotsV1Beta3Client = v1beta3.SnapshotsV1Beta3Client; +const TemplatesServiceClient = v1beta3.TemplatesServiceClient; +type TemplatesServiceClient = v1beta3.TemplatesServiceClient; +export {v1beta3, FlexTemplatesServiceClient, JobsV1Beta3Client, MessagesV1Beta3Client, MetricsV1Beta3Client, SnapshotsV1Beta3Client, TemplatesServiceClient}; +export default {v1beta3, FlexTemplatesServiceClient, JobsV1Beta3Client, MessagesV1Beta3Client, MetricsV1Beta3Client, SnapshotsV1Beta3Client, TemplatesServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client.ts new file mode 100644 index 00000000000..bf89f3844fa --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client.ts @@ -0,0 +1,389 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1beta3/flex_templates_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './flex_templates_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Provides a service for Flex templates. This feature is not ready yet. + * @class + * @memberof v1beta3 + */ +export class FlexTemplatesServiceClient { + 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}; + flexTemplatesServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FlexTemplatesServiceClient. + * + * @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 FlexTemplatesServiceClient({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 FlexTemplatesServiceClient; + 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.dataflow.v1beta3.FlexTemplatesService', 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.flexTemplatesServiceStub) { + return this.flexTemplatesServiceStub; + } + + // Put together the "service stub" for + // google.dataflow.v1beta3.FlexTemplatesService. + this.flexTemplatesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.FlexTemplatesService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.dataflow.v1beta3.FlexTemplatesService, + 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 flexTemplatesServiceStubMethods = + ['launchFlexTemplate']; + for (const methodName of flexTemplatesServiceStubMethods) { + const callPromise = this.flexTemplatesServiceStub.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.flexTemplatesServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataflow.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 'dataflow.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/compute', + 'https://www.googleapis.com/auth/compute.readonly', + 'https://www.googleapis.com/auth/userinfo.email' + ]; + } + + 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 -- + // ------------------- +/** + * Launch a job with a FlexTemplate. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Cloud Platform project that the job belongs to. + * @param {google.dataflow.v1beta3.LaunchFlexTemplateParameter} request.launchParameter + * Required. Parameter to launch a job form Flex Template. + * @param {string} request.location + * Required. The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + * which to direct the request. E.g., us-central1, us-west1. + * @param {boolean} request.validateOnly + * If true, the request is validated but not actually executed. + * Defaults to 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.dataflow.v1beta3.LaunchFlexTemplateResponse|LaunchFlexTemplateResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/flex_templates_service.launch_flex_template.js + * region_tag:dataflow_v1beta3_generated_FlexTemplatesService_LaunchFlexTemplate_async + */ + launchFlexTemplate( + request?: protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|undefined, {}|undefined + ]>; + launchFlexTemplate( + request: protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|null|undefined, + {}|null|undefined>): void; + launchFlexTemplate( + request: protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest, + callback: Callback< + protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|null|undefined, + {}|null|undefined>): void; + launchFlexTemplate( + request?: protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + }); + this.initialize(); + return this.innerApiCalls.launchFlexTemplate(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.flexTemplatesServiceStub && !this._terminated) { + return this.flexTemplatesServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client_config.json new file mode 100644 index 00000000000..030c5540a61 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client_config.json @@ -0,0 +1,30 @@ +{ + "interfaces": { + "google.dataflow.v1beta3.FlexTemplatesService": { + "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": { + "LaunchFlexTemplate": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_proto_list.json new file mode 100644 index 00000000000..cd5511e4fd8 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/dataflow/v1beta3/environment.proto", + "../../protos/google/dataflow/v1beta3/jobs.proto", + "../../protos/google/dataflow/v1beta3/messages.proto", + "../../protos/google/dataflow/v1beta3/metrics.proto", + "../../protos/google/dataflow/v1beta3/snapshots.proto", + "../../protos/google/dataflow/v1beta3/streaming.proto", + "../../protos/google/dataflow/v1beta3/templates.proto" +] diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/gapic_metadata.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/gapic_metadata.json new file mode 100644 index 00000000000..44fe73585b4 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/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.dataflow.v1beta3", + "libraryPackage": "@google-cloud/dataflow", + "services": { + "FlexTemplatesService": { + "clients": { + "grpc": { + "libraryClient": "FlexTemplatesServiceClient", + "rpcs": { + "LaunchFlexTemplate": { + "methods": [ + "launchFlexTemplate" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FlexTemplatesServiceClient", + "rpcs": { + "LaunchFlexTemplate": { + "methods": [ + "launchFlexTemplate" + ] + } + } + } + } + }, + "JobsV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "JobsV1Beta3Client", + "rpcs": { + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "GetJob": { + "methods": [ + "getJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "CheckActiveJobs": { + "methods": [ + "checkActiveJobs" + ] + }, + "SnapshotJob": { + "methods": [ + "snapshotJob" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + }, + "AggregatedListJobs": { + "methods": [ + "aggregatedListJobs", + "aggregatedListJobsStream", + "aggregatedListJobsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "JobsV1Beta3Client", + "rpcs": { + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "GetJob": { + "methods": [ + "getJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "CheckActiveJobs": { + "methods": [ + "checkActiveJobs" + ] + }, + "SnapshotJob": { + "methods": [ + "snapshotJob" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + }, + "AggregatedListJobs": { + "methods": [ + "aggregatedListJobs", + "aggregatedListJobsStream", + "aggregatedListJobsAsync" + ] + } + } + } + } + }, + "MessagesV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "MessagesV1Beta3Client", + "rpcs": { + "ListJobMessages": { + "methods": [ + "listJobMessages", + "listJobMessagesStream", + "listJobMessagesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "MessagesV1Beta3Client", + "rpcs": { + "ListJobMessages": { + "methods": [ + "listJobMessages", + "listJobMessagesStream", + "listJobMessagesAsync" + ] + } + } + } + } + }, + "MetricsV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "MetricsV1Beta3Client", + "rpcs": { + "GetJobMetrics": { + "methods": [ + "getJobMetrics" + ] + }, + "GetJobExecutionDetails": { + "methods": [ + "getJobExecutionDetails", + "getJobExecutionDetailsStream", + "getJobExecutionDetailsAsync" + ] + }, + "GetStageExecutionDetails": { + "methods": [ + "getStageExecutionDetails", + "getStageExecutionDetailsStream", + "getStageExecutionDetailsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "MetricsV1Beta3Client", + "rpcs": { + "GetJobMetrics": { + "methods": [ + "getJobMetrics" + ] + }, + "GetJobExecutionDetails": { + "methods": [ + "getJobExecutionDetails", + "getJobExecutionDetailsStream", + "getJobExecutionDetailsAsync" + ] + }, + "GetStageExecutionDetails": { + "methods": [ + "getStageExecutionDetails", + "getStageExecutionDetailsStream", + "getStageExecutionDetailsAsync" + ] + } + } + } + } + }, + "SnapshotsV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "SnapshotsV1Beta3Client", + "rpcs": { + "GetSnapshot": { + "methods": [ + "getSnapshot" + ] + }, + "DeleteSnapshot": { + "methods": [ + "deleteSnapshot" + ] + }, + "ListSnapshots": { + "methods": [ + "listSnapshots" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SnapshotsV1Beta3Client", + "rpcs": { + "GetSnapshot": { + "methods": [ + "getSnapshot" + ] + }, + "DeleteSnapshot": { + "methods": [ + "deleteSnapshot" + ] + }, + "ListSnapshots": { + "methods": [ + "listSnapshots" + ] + } + } + } + } + }, + "TemplatesService": { + "clients": { + "grpc": { + "libraryClient": "TemplatesServiceClient", + "rpcs": { + "CreateJobFromTemplate": { + "methods": [ + "createJobFromTemplate" + ] + }, + "LaunchTemplate": { + "methods": [ + "launchTemplate" + ] + }, + "GetTemplate": { + "methods": [ + "getTemplate" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "TemplatesServiceClient", + "rpcs": { + "CreateJobFromTemplate": { + "methods": [ + "createJobFromTemplate" + ] + }, + "LaunchTemplate": { + "methods": [ + "launchTemplate" + ] + }, + "GetTemplate": { + "methods": [ + "getTemplate" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/index.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/index.ts new file mode 100644 index 00000000000..a91617a0bc5 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/index.ts @@ -0,0 +1,24 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {FlexTemplatesServiceClient} from './flex_templates_service_client'; +export {JobsV1Beta3Client} from './jobs_v1_beta3_client'; +export {MessagesV1Beta3Client} from './messages_v1_beta3_client'; +export {MetricsV1Beta3Client} from './metrics_v1_beta3_client'; +export {SnapshotsV1Beta3Client} from './snapshots_v1_beta3_client'; +export {TemplatesServiceClient} from './templates_service_client'; diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client.ts new file mode 100644 index 00000000000..3ff5a4216f6 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client.ts @@ -0,0 +1,1150 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1beta3/jobs_v1_beta3_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './jobs_v1_beta3_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Provides a method to create and modify Google Cloud Dataflow jobs. + * A Job is a multi-stage computation graph run by the Cloud Dataflow service. + * @class + * @memberof v1beta3 + */ +export class JobsV1Beta3Client { + 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}; + jobsV1Beta3Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of JobsV1Beta3Client. + * + * @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 JobsV1Beta3Client({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 JobsV1Beta3Client; + 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 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 = { + listJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs'), + aggregatedListJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.dataflow.v1beta3.JobsV1Beta3', 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.jobsV1Beta3Stub) { + return this.jobsV1Beta3Stub; + } + + // Put together the "service stub" for + // google.dataflow.v1beta3.JobsV1Beta3. + this.jobsV1Beta3Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.JobsV1Beta3') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.dataflow.v1beta3.JobsV1Beta3, + 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 jobsV1Beta3StubMethods = + ['createJob', 'getJob', 'updateJob', 'listJobs', 'aggregatedListJobs', 'checkActiveJobs', 'snapshotJob']; + for (const methodName of jobsV1Beta3StubMethods) { + const callPromise = this.jobsV1Beta3Stub.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.jobsV1Beta3Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataflow.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 'dataflow.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/compute', + 'https://www.googleapis.com/auth/compute.readonly', + 'https://www.googleapis.com/auth/userinfo.email' + ]; + } + + 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 Cloud Dataflow job. + * + * To create a job, we recommend using `projects.locations.jobs.create` with a + * [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using + * `projects.jobs.create` is not recommended, as your job will always start + * in `us-central1`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * The ID of the Cloud Platform project that the job belongs to. + * @param {google.dataflow.v1beta3.Job} request.job + * The job to create. + * @param {google.dataflow.v1beta3.JobView} request.view + * The level of information requested in response. + * @param {string} request.replaceJobId + * Deprecated. This field is now in the Job message. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.Job|Job}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/jobs_v1_beta3.create_job.js + * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_CreateJob_async + */ + createJob( + request?: protos.google.dataflow.v1beta3.ICreateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobRequest|undefined, {}|undefined + ]>; + createJob( + request: protos.google.dataflow.v1beta3.ICreateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; + createJob( + request: protos.google.dataflow.v1beta3.ICreateJobRequest, + callback: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; + createJob( + request?: protos.google.dataflow.v1beta3.ICreateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + }); + this.initialize(); + return this.innerApiCalls.createJob(request, options, callback); + } +/** + * Gets the state of the specified Cloud Dataflow job. + * + * To get the state of a job, we recommend using `projects.locations.jobs.get` + * with a [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using + * `projects.jobs.get` is not recommended, as you can only get the state of + * jobs that are running in `us-central1`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * The ID of the Cloud Platform project that the job belongs to. + * @param {string} request.jobId + * The job ID. + * @param {google.dataflow.v1beta3.JobView} request.view + * The level of information requested in response. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.Job|Job}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/jobs_v1_beta3.get_job.js + * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_GetJob_async + */ + getJob( + request?: protos.google.dataflow.v1beta3.IGetJobRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IGetJobRequest|undefined, {}|undefined + ]>; + getJob( + request: protos.google.dataflow.v1beta3.IGetJobRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IGetJobRequest|null|undefined, + {}|null|undefined>): void; + getJob( + request: protos.google.dataflow.v1beta3.IGetJobRequest, + callback: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IGetJobRequest|null|undefined, + {}|null|undefined>): void; + getJob( + request?: protos.google.dataflow.v1beta3.IGetJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IGetJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IGetJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IGetJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getJob(request, options, callback); + } +/** + * Updates the state of an existing Cloud Dataflow job. + * + * To update the state of an existing job, we recommend using + * `projects.locations.jobs.update` with a [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using + * `projects.jobs.update` is not recommended, as you can only update the state + * of jobs that are running in `us-central1`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * The ID of the Cloud Platform project that the job belongs to. + * @param {string} request.jobId + * The job ID. + * @param {google.dataflow.v1beta3.Job} request.job + * The updated job. + * Only the job state is updatable; other fields will be ignored. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.Job|Job}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/jobs_v1_beta3.update_job.js + * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_UpdateJob_async + */ + updateJob( + request?: protos.google.dataflow.v1beta3.IUpdateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IUpdateJobRequest|undefined, {}|undefined + ]>; + updateJob( + request: protos.google.dataflow.v1beta3.IUpdateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; + updateJob( + request: protos.google.dataflow.v1beta3.IUpdateJobRequest, + callback: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; + updateJob( + request?: protos.google.dataflow.v1beta3.IUpdateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IUpdateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IUpdateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.IUpdateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateJob(request, options, callback); + } +/** + * Check for existence of active jobs in the given project across all regions. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * The project which owns the jobs. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.CheckActiveJobsResponse|CheckActiveJobsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/jobs_v1_beta3.check_active_jobs.js + * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_CheckActiveJobs_async + */ + checkActiveJobs( + request?: protos.google.dataflow.v1beta3.ICheckActiveJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, + protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|undefined, {}|undefined + ]>; + checkActiveJobs( + request: protos.google.dataflow.v1beta3.ICheckActiveJobsRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, + protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|null|undefined, + {}|null|undefined>): void; + checkActiveJobs( + request: protos.google.dataflow.v1beta3.ICheckActiveJobsRequest, + callback: Callback< + protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, + protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|null|undefined, + {}|null|undefined>): void; + checkActiveJobs( + request?: protos.google.dataflow.v1beta3.ICheckActiveJobsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, + protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, + protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, + protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.checkActiveJobs(request, options, callback); + } +/** + * Snapshot the state of a streaming job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * The project which owns the job to be snapshotted. + * @param {string} request.jobId + * The job to be snapshotted. + * @param {google.protobuf.Duration} request.ttl + * TTL for the snapshot. + * @param {string} request.location + * The location that contains this job. + * @param {boolean} request.snapshotSources + * If true, perform snapshots for sources which support this. + * @param {string} request.description + * User specified description of the snapshot. Maybe empty. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.Snapshot|Snapshot}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/jobs_v1_beta3.snapshot_job.js + * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_SnapshotJob_async + */ + snapshotJob( + request?: protos.google.dataflow.v1beta3.ISnapshotJobRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.ISnapshotJobRequest|undefined, {}|undefined + ]>; + snapshotJob( + request: protos.google.dataflow.v1beta3.ISnapshotJobRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.ISnapshotJobRequest|null|undefined, + {}|null|undefined>): void; + snapshotJob( + request: protos.google.dataflow.v1beta3.ISnapshotJobRequest, + callback: Callback< + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.ISnapshotJobRequest|null|undefined, + {}|null|undefined>): void; + snapshotJob( + request?: protos.google.dataflow.v1beta3.ISnapshotJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.ISnapshotJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.ISnapshotJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.ISnapshotJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + }); + this.initialize(); + return this.innerApiCalls.snapshotJob(request, options, callback); + } + + /** + * List the jobs of a project. + * + * To list the jobs of a project in a region, we recommend using + * `projects.locations.jobs.list` with a [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). To + * list the all jobs across all regions, use `projects.jobs.aggregated`. Using + * `projects.jobs.list` is not recommended, as you can only get the list of + * jobs that are running in `us-central1`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter + * The kind of filter to use. + * @param {string} request.projectId + * The project which owns the jobs. + * @param {google.dataflow.v1beta3.JobView} request.view + * Deprecated. ListJobs always returns summaries now. + * Use GetJob for other JobViews. + * @param {number} request.pageSize + * If there are many jobs, limit response to at most this many. + * The actual number of jobs returned will be the lesser of max_responses + * and an unspecified server-defined limit. + * @param {string} request.pageToken + * Set this to the 'next_page_token' field of a previous response + * to request additional results in a long list. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.dataflow.v1beta3.Job|Job}. + * 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 `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listJobs( + request?: protos.google.dataflow.v1beta3.IListJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IJob[], + protos.google.dataflow.v1beta3.IListJobsRequest|null, + protos.google.dataflow.v1beta3.IListJobsResponse + ]>; + listJobs( + request: protos.google.dataflow.v1beta3.IListJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.dataflow.v1beta3.IListJobsRequest, + protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, + protos.google.dataflow.v1beta3.IJob>): void; + listJobs( + request: protos.google.dataflow.v1beta3.IListJobsRequest, + callback: PaginationCallback< + protos.google.dataflow.v1beta3.IListJobsRequest, + protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, + protos.google.dataflow.v1beta3.IJob>): void; + listJobs( + request?: protos.google.dataflow.v1beta3.IListJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.dataflow.v1beta3.IListJobsRequest, + protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, + protos.google.dataflow.v1beta3.IJob>, + callback?: PaginationCallback< + protos.google.dataflow.v1beta3.IListJobsRequest, + protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, + protos.google.dataflow.v1beta3.IJob>): + Promise<[ + protos.google.dataflow.v1beta3.IJob[], + protos.google.dataflow.v1beta3.IListJobsRequest|null, + protos.google.dataflow.v1beta3.IListJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + }); + this.initialize(); + return this.innerApiCalls.listJobs(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 {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter + * The kind of filter to use. + * @param {string} request.projectId + * The project which owns the jobs. + * @param {google.dataflow.v1beta3.JobView} request.view + * Deprecated. ListJobs always returns summaries now. + * Use GetJob for other JobViews. + * @param {number} request.pageSize + * If there are many jobs, limit response to at most this many. + * The actual number of jobs returned will be the lesser of max_responses + * and an unspecified server-defined limit. + * @param {string} request.pageToken + * Set this to the 'next_page_token' field of a previous response + * to request additional results in a long list. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + * @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.dataflow.v1beta3.Job|Job} 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 `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listJobsStream( + request?: protos.google.dataflow.v1beta3.IListJobsRequest, + 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({ + 'project_id': request.projectId ?? '', + 'location': request.location ?? '', + }); + const defaultCallSettings = this._defaults['listJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobs.createStream( + this.innerApiCalls.listJobs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listJobs`, 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 {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter + * The kind of filter to use. + * @param {string} request.projectId + * The project which owns the jobs. + * @param {google.dataflow.v1beta3.JobView} request.view + * Deprecated. ListJobs always returns summaries now. + * Use GetJob for other JobViews. + * @param {number} request.pageSize + * If there are many jobs, limit response to at most this many. + * The actual number of jobs returned will be the lesser of max_responses + * and an unspecified server-defined limit. + * @param {string} request.pageToken + * Set this to the 'next_page_token' field of a previous response + * to request additional results in a long list. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + * @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.dataflow.v1beta3.Job|Job}. 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/v1beta3/jobs_v1_beta3.list_jobs.js + * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_ListJobs_async + */ + listJobsAsync( + request?: protos.google.dataflow.v1beta3.IListJobsRequest, + 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({ + 'project_id': request.projectId ?? '', + 'location': request.location ?? '', + }); + const defaultCallSettings = this._defaults['listJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobs.asyncIterate( + this.innerApiCalls['listJobs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List the jobs of a project across all regions. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter + * The kind of filter to use. + * @param {string} request.projectId + * The project which owns the jobs. + * @param {google.dataflow.v1beta3.JobView} request.view + * Deprecated. ListJobs always returns summaries now. + * Use GetJob for other JobViews. + * @param {number} request.pageSize + * If there are many jobs, limit response to at most this many. + * The actual number of jobs returned will be the lesser of max_responses + * and an unspecified server-defined limit. + * @param {string} request.pageToken + * Set this to the 'next_page_token' field of a previous response + * to request additional results in a long list. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.dataflow.v1beta3.Job|Job}. + * 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 `aggregatedListJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + aggregatedListJobs( + request?: protos.google.dataflow.v1beta3.IListJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IJob[], + protos.google.dataflow.v1beta3.IListJobsRequest|null, + protos.google.dataflow.v1beta3.IListJobsResponse + ]>; + aggregatedListJobs( + request: protos.google.dataflow.v1beta3.IListJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.dataflow.v1beta3.IListJobsRequest, + protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, + protos.google.dataflow.v1beta3.IJob>): void; + aggregatedListJobs( + request: protos.google.dataflow.v1beta3.IListJobsRequest, + callback: PaginationCallback< + protos.google.dataflow.v1beta3.IListJobsRequest, + protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, + protos.google.dataflow.v1beta3.IJob>): void; + aggregatedListJobs( + request?: protos.google.dataflow.v1beta3.IListJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.dataflow.v1beta3.IListJobsRequest, + protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, + protos.google.dataflow.v1beta3.IJob>, + callback?: PaginationCallback< + protos.google.dataflow.v1beta3.IListJobsRequest, + protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, + protos.google.dataflow.v1beta3.IJob>): + Promise<[ + protos.google.dataflow.v1beta3.IJob[], + protos.google.dataflow.v1beta3.IListJobsRequest|null, + protos.google.dataflow.v1beta3.IListJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + }); + this.initialize(); + return this.innerApiCalls.aggregatedListJobs(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 {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter + * The kind of filter to use. + * @param {string} request.projectId + * The project which owns the jobs. + * @param {google.dataflow.v1beta3.JobView} request.view + * Deprecated. ListJobs always returns summaries now. + * Use GetJob for other JobViews. + * @param {number} request.pageSize + * If there are many jobs, limit response to at most this many. + * The actual number of jobs returned will be the lesser of max_responses + * and an unspecified server-defined limit. + * @param {string} request.pageToken + * Set this to the 'next_page_token' field of a previous response + * to request additional results in a long list. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + * @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.dataflow.v1beta3.Job|Job} 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 `aggregatedListJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + aggregatedListJobsStream( + request?: protos.google.dataflow.v1beta3.IListJobsRequest, + 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({ + 'project_id': request.projectId ?? '', + }); + const defaultCallSettings = this._defaults['aggregatedListJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.aggregatedListJobs.createStream( + this.innerApiCalls.aggregatedListJobs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `aggregatedListJobs`, 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 {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter + * The kind of filter to use. + * @param {string} request.projectId + * The project which owns the jobs. + * @param {google.dataflow.v1beta3.JobView} request.view + * Deprecated. ListJobs always returns summaries now. + * Use GetJob for other JobViews. + * @param {number} request.pageSize + * If there are many jobs, limit response to at most this many. + * The actual number of jobs returned will be the lesser of max_responses + * and an unspecified server-defined limit. + * @param {string} request.pageToken + * Set this to the 'next_page_token' field of a previous response + * to request additional results in a long list. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains this job. + * @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.dataflow.v1beta3.Job|Job}. 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/v1beta3/jobs_v1_beta3.aggregated_list_jobs.js + * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_AggregatedListJobs_async + */ + aggregatedListJobsAsync( + request?: protos.google.dataflow.v1beta3.IListJobsRequest, + 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({ + 'project_id': request.projectId ?? '', + }); + const defaultCallSettings = this._defaults['aggregatedListJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.aggregatedListJobs.asyncIterate( + this.innerApiCalls['aggregatedListJobs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + + /** + * 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.jobsV1Beta3Stub && !this._terminated) { + return this.jobsV1Beta3Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client_config.json new file mode 100644 index 00000000000..1365d3fd6ed --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client_config.json @@ -0,0 +1,61 @@ +{ + "interfaces": { + "google.dataflow.v1beta3.JobsV1Beta3": { + "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": { + "CreateJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListJobs": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AggregatedListJobs": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CheckActiveJobs": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SnapshotJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_proto_list.json new file mode 100644 index 00000000000..cd5511e4fd8 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/dataflow/v1beta3/environment.proto", + "../../protos/google/dataflow/v1beta3/jobs.proto", + "../../protos/google/dataflow/v1beta3/messages.proto", + "../../protos/google/dataflow/v1beta3/metrics.proto", + "../../protos/google/dataflow/v1beta3/snapshots.proto", + "../../protos/google/dataflow/v1beta3/streaming.proto", + "../../protos/google/dataflow/v1beta3/templates.proto" +] diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client.ts new file mode 100644 index 00000000000..94f1100e817 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client.ts @@ -0,0 +1,555 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1beta3/messages_v1_beta3_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './messages_v1_beta3_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Dataflow Messages API is used for monitoring the progress of + * Dataflow jobs. + * @class + * @memberof v1beta3 + */ +export class MessagesV1Beta3Client { + 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}; + messagesV1Beta3Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of MessagesV1Beta3Client. + * + * @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 MessagesV1Beta3Client({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 MessagesV1Beta3Client; + 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 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 = { + listJobMessages: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobMessages') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.dataflow.v1beta3.MessagesV1Beta3', 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.messagesV1Beta3Stub) { + return this.messagesV1Beta3Stub; + } + + // Put together the "service stub" for + // google.dataflow.v1beta3.MessagesV1Beta3. + this.messagesV1Beta3Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.MessagesV1Beta3') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.dataflow.v1beta3.MessagesV1Beta3, + 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 messagesV1Beta3StubMethods = + ['listJobMessages']; + for (const methodName of messagesV1Beta3StubMethods) { + const callPromise = this.messagesV1Beta3Stub.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.messagesV1Beta3Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataflow.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 'dataflow.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/compute', + 'https://www.googleapis.com/auth/compute.readonly', + 'https://www.googleapis.com/auth/userinfo.email' + ]; + } + + 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 -- + // ------------------- + + /** + * Request the job status. + * + * To request the status of a job, we recommend using + * `projects.locations.jobs.messages.list` with a [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using + * `projects.jobs.messages.list` is not recommended, as you can only request + * the status of jobs that are running in `us-central1`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * A project id. + * @param {string} request.jobId + * The job to get messages about. + * @param {google.dataflow.v1beta3.JobMessageImportance} request.minimumImportance + * Filter to only get messages with importance >= level + * @param {number} request.pageSize + * If specified, determines the maximum number of messages to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + * @param {string} request.pageToken + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * be returned. + * @param {google.protobuf.Timestamp} request.startTime + * If specified, return only messages with timestamps >= start_time. + * The default is the job creation time (i.e. beginning of messages). + * @param {google.protobuf.Timestamp} request.endTime + * Return only messages with timestamps < end_time. The default is now + * (i.e. return up to the latest messages available). + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_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 Array of {@link protos.google.dataflow.v1beta3.JobMessage|JobMessage}. + * 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 `listJobMessagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listJobMessages( + request?: protos.google.dataflow.v1beta3.IListJobMessagesRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IJobMessage[], + protos.google.dataflow.v1beta3.IListJobMessagesRequest|null, + protos.google.dataflow.v1beta3.IListJobMessagesResponse + ]>; + listJobMessages( + request: protos.google.dataflow.v1beta3.IListJobMessagesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.dataflow.v1beta3.IListJobMessagesRequest, + protos.google.dataflow.v1beta3.IListJobMessagesResponse|null|undefined, + protos.google.dataflow.v1beta3.IJobMessage>): void; + listJobMessages( + request: protos.google.dataflow.v1beta3.IListJobMessagesRequest, + callback: PaginationCallback< + protos.google.dataflow.v1beta3.IListJobMessagesRequest, + protos.google.dataflow.v1beta3.IListJobMessagesResponse|null|undefined, + protos.google.dataflow.v1beta3.IJobMessage>): void; + listJobMessages( + request?: protos.google.dataflow.v1beta3.IListJobMessagesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.dataflow.v1beta3.IListJobMessagesRequest, + protos.google.dataflow.v1beta3.IListJobMessagesResponse|null|undefined, + protos.google.dataflow.v1beta3.IJobMessage>, + callback?: PaginationCallback< + protos.google.dataflow.v1beta3.IListJobMessagesRequest, + protos.google.dataflow.v1beta3.IListJobMessagesResponse|null|undefined, + protos.google.dataflow.v1beta3.IJobMessage>): + Promise<[ + protos.google.dataflow.v1beta3.IJobMessage[], + protos.google.dataflow.v1beta3.IListJobMessagesRequest|null, + protos.google.dataflow.v1beta3.IListJobMessagesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + }); + this.initialize(); + return this.innerApiCalls.listJobMessages(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.projectId + * A project id. + * @param {string} request.jobId + * The job to get messages about. + * @param {google.dataflow.v1beta3.JobMessageImportance} request.minimumImportance + * Filter to only get messages with importance >= level + * @param {number} request.pageSize + * If specified, determines the maximum number of messages to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + * @param {string} request.pageToken + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * be returned. + * @param {google.protobuf.Timestamp} request.startTime + * If specified, return only messages with timestamps >= start_time. + * The default is the job creation time (i.e. beginning of messages). + * @param {google.protobuf.Timestamp} request.endTime + * Return only messages with timestamps < end_time. The default is now + * (i.e. return up to the latest messages available). + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + * @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.dataflow.v1beta3.JobMessage|JobMessage} 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 `listJobMessagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listJobMessagesStream( + request?: protos.google.dataflow.v1beta3.IListJobMessagesRequest, + 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({ + 'project_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + }); + const defaultCallSettings = this._defaults['listJobMessages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobMessages.createStream( + this.innerApiCalls.listJobMessages as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listJobMessages`, 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.projectId + * A project id. + * @param {string} request.jobId + * The job to get messages about. + * @param {google.dataflow.v1beta3.JobMessageImportance} request.minimumImportance + * Filter to only get messages with importance >= level + * @param {number} request.pageSize + * If specified, determines the maximum number of messages to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + * @param {string} request.pageToken + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * be returned. + * @param {google.protobuf.Timestamp} request.startTime + * If specified, return only messages with timestamps >= start_time. + * The default is the job creation time (i.e. beginning of messages). + * @param {google.protobuf.Timestamp} request.endTime + * Return only messages with timestamps < end_time. The default is now + * (i.e. return up to the latest messages available). + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + * @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.dataflow.v1beta3.JobMessage|JobMessage}. 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/v1beta3/messages_v1_beta3.list_job_messages.js + * region_tag:dataflow_v1beta3_generated_MessagesV1Beta3_ListJobMessages_async + */ + listJobMessagesAsync( + request?: protos.google.dataflow.v1beta3.IListJobMessagesRequest, + 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({ + 'project_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + }); + const defaultCallSettings = this._defaults['listJobMessages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobMessages.asyncIterate( + this.innerApiCalls['listJobMessages'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + + /** + * 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.messagesV1Beta3Stub && !this._terminated) { + return this.messagesV1Beta3Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client_config.json new file mode 100644 index 00000000000..bed4b6c3449 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.dataflow.v1beta3.MessagesV1Beta3": { + "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": { + "ListJobMessages": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_proto_list.json new file mode 100644 index 00000000000..cd5511e4fd8 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/dataflow/v1beta3/environment.proto", + "../../protos/google/dataflow/v1beta3/jobs.proto", + "../../protos/google/dataflow/v1beta3/messages.proto", + "../../protos/google/dataflow/v1beta3/metrics.proto", + "../../protos/google/dataflow/v1beta3/snapshots.proto", + "../../protos/google/dataflow/v1beta3/streaming.proto", + "../../protos/google/dataflow/v1beta3/templates.proto" +] diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client.ts new file mode 100644 index 00000000000..090d6b93800 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client.ts @@ -0,0 +1,846 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1beta3/metrics_v1_beta3_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './metrics_v1_beta3_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Dataflow Metrics API lets you monitor the progress of Dataflow + * jobs. + * @class + * @memberof v1beta3 + */ +export class MetricsV1Beta3Client { + 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}; + metricsV1Beta3Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of MetricsV1Beta3Client. + * + * @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 MetricsV1Beta3Client({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 MetricsV1Beta3Client; + 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 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 = { + getJobExecutionDetails: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'stages'), + getStageExecutionDetails: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workers') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.dataflow.v1beta3.MetricsV1Beta3', 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.metricsV1Beta3Stub) { + return this.metricsV1Beta3Stub; + } + + // Put together the "service stub" for + // google.dataflow.v1beta3.MetricsV1Beta3. + this.metricsV1Beta3Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.MetricsV1Beta3') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.dataflow.v1beta3.MetricsV1Beta3, + 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 metricsV1Beta3StubMethods = + ['getJobMetrics', 'getJobExecutionDetails', 'getStageExecutionDetails']; + for (const methodName of metricsV1Beta3StubMethods) { + const callPromise = this.metricsV1Beta3Stub.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.metricsV1Beta3Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataflow.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 'dataflow.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/compute', + 'https://www.googleapis.com/auth/compute.readonly', + 'https://www.googleapis.com/auth/userinfo.email' + ]; + } + + 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 -- + // ------------------- +/** + * Request the job status. + * + * To request the status of a job, we recommend using + * `projects.locations.jobs.getMetrics` with a [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using + * `projects.jobs.getMetrics` is not recommended, as you can only request the + * status of jobs that are running in `us-central1`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * A project id. + * @param {string} request.jobId + * The job to get metrics for. + * @param {google.protobuf.Timestamp} request.startTime + * Return only metric data that has changed since this time. + * Default is to return all information about all metrics for the job. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_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.dataflow.v1beta3.JobMetrics|JobMetrics}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/metrics_v1_beta3.get_job_metrics.js + * region_tag:dataflow_v1beta3_generated_MetricsV1Beta3_GetJobMetrics_async + */ + getJobMetrics( + request?: protos.google.dataflow.v1beta3.IGetJobMetricsRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IJobMetrics, + protos.google.dataflow.v1beta3.IGetJobMetricsRequest|undefined, {}|undefined + ]>; + getJobMetrics( + request: protos.google.dataflow.v1beta3.IGetJobMetricsRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.IJobMetrics, + protos.google.dataflow.v1beta3.IGetJobMetricsRequest|null|undefined, + {}|null|undefined>): void; + getJobMetrics( + request: protos.google.dataflow.v1beta3.IGetJobMetricsRequest, + callback: Callback< + protos.google.dataflow.v1beta3.IJobMetrics, + protos.google.dataflow.v1beta3.IGetJobMetricsRequest|null|undefined, + {}|null|undefined>): void; + getJobMetrics( + request?: protos.google.dataflow.v1beta3.IGetJobMetricsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.IJobMetrics, + protos.google.dataflow.v1beta3.IGetJobMetricsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.IJobMetrics, + protos.google.dataflow.v1beta3.IGetJobMetricsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.IJobMetrics, + protos.google.dataflow.v1beta3.IGetJobMetricsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getJobMetrics(request, options, callback); + } + + /** + * Request detailed information about the execution status of the job. + * + * EXPERIMENTAL. This API is subject to change or removal without notice. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * A project id. + * @param {string} request.jobId + * The job to get execution details for. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + * @param {number} request.pageSize + * If specified, determines the maximum number of stages to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + * @param {string} request.pageToken + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * 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.dataflow.v1beta3.StageSummary|StageSummary}. + * 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 `getJobExecutionDetailsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + getJobExecutionDetails( + request?: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IStageSummary[], + protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest|null, + protos.google.dataflow.v1beta3.IJobExecutionDetails + ]>; + getJobExecutionDetails( + request: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, + protos.google.dataflow.v1beta3.IJobExecutionDetails|null|undefined, + protos.google.dataflow.v1beta3.IStageSummary>): void; + getJobExecutionDetails( + request: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, + callback: PaginationCallback< + protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, + protos.google.dataflow.v1beta3.IJobExecutionDetails|null|undefined, + protos.google.dataflow.v1beta3.IStageSummary>): void; + getJobExecutionDetails( + request?: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, + protos.google.dataflow.v1beta3.IJobExecutionDetails|null|undefined, + protos.google.dataflow.v1beta3.IStageSummary>, + callback?: PaginationCallback< + protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, + protos.google.dataflow.v1beta3.IJobExecutionDetails|null|undefined, + protos.google.dataflow.v1beta3.IStageSummary>): + Promise<[ + protos.google.dataflow.v1beta3.IStageSummary[], + protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest|null, + protos.google.dataflow.v1beta3.IJobExecutionDetails + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getJobExecutionDetails(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.projectId + * A project id. + * @param {string} request.jobId + * The job to get execution details for. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + * @param {number} request.pageSize + * If specified, determines the maximum number of stages to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + * @param {string} request.pageToken + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * 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.dataflow.v1beta3.StageSummary|StageSummary} 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 `getJobExecutionDetailsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + getJobExecutionDetailsStream( + request?: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, + 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({ + 'project_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + }); + const defaultCallSettings = this._defaults['getJobExecutionDetails']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getJobExecutionDetails.createStream( + this.innerApiCalls.getJobExecutionDetails as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `getJobExecutionDetails`, 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.projectId + * A project id. + * @param {string} request.jobId + * The job to get execution details for. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + * @param {number} request.pageSize + * If specified, determines the maximum number of stages to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + * @param {string} request.pageToken + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * 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.dataflow.v1beta3.StageSummary|StageSummary}. 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/v1beta3/metrics_v1_beta3.get_job_execution_details.js + * region_tag:dataflow_v1beta3_generated_MetricsV1Beta3_GetJobExecutionDetails_async + */ + getJobExecutionDetailsAsync( + request?: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, + 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({ + 'project_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + }); + const defaultCallSettings = this._defaults['getJobExecutionDetails']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getJobExecutionDetails.asyncIterate( + this.innerApiCalls['getJobExecutionDetails'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Request detailed information about the execution status of a stage of the + * job. + * + * EXPERIMENTAL. This API is subject to change or removal without notice. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * A project id. + * @param {string} request.jobId + * The job to get execution details for. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + * @param {string} request.stageId + * The stage for which to fetch information. + * @param {number} request.pageSize + * If specified, determines the maximum number of work items to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + * @param {string} request.pageToken + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * be returned. + * @param {google.protobuf.Timestamp} request.startTime + * Lower time bound of work items to include, by start time. + * @param {google.protobuf.Timestamp} request.endTime + * Upper time bound of work items to include, by start 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 Array of {@link protos.google.dataflow.v1beta3.WorkerDetails|WorkerDetails}. + * 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 `getStageExecutionDetailsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + getStageExecutionDetails( + request?: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IWorkerDetails[], + protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest|null, + protos.google.dataflow.v1beta3.IStageExecutionDetails + ]>; + getStageExecutionDetails( + request: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, + protos.google.dataflow.v1beta3.IStageExecutionDetails|null|undefined, + protos.google.dataflow.v1beta3.IWorkerDetails>): void; + getStageExecutionDetails( + request: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, + callback: PaginationCallback< + protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, + protos.google.dataflow.v1beta3.IStageExecutionDetails|null|undefined, + protos.google.dataflow.v1beta3.IWorkerDetails>): void; + getStageExecutionDetails( + request?: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, + protos.google.dataflow.v1beta3.IStageExecutionDetails|null|undefined, + protos.google.dataflow.v1beta3.IWorkerDetails>, + callback?: PaginationCallback< + protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, + protos.google.dataflow.v1beta3.IStageExecutionDetails|null|undefined, + protos.google.dataflow.v1beta3.IWorkerDetails>): + Promise<[ + protos.google.dataflow.v1beta3.IWorkerDetails[], + protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest|null, + protos.google.dataflow.v1beta3.IStageExecutionDetails + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + 'stage_id': request.stageId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getStageExecutionDetails(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.projectId + * A project id. + * @param {string} request.jobId + * The job to get execution details for. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + * @param {string} request.stageId + * The stage for which to fetch information. + * @param {number} request.pageSize + * If specified, determines the maximum number of work items to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + * @param {string} request.pageToken + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * be returned. + * @param {google.protobuf.Timestamp} request.startTime + * Lower time bound of work items to include, by start time. + * @param {google.protobuf.Timestamp} request.endTime + * Upper time bound of work items to include, by start time. + * @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.dataflow.v1beta3.WorkerDetails|WorkerDetails} 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 `getStageExecutionDetailsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + getStageExecutionDetailsStream( + request?: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, + 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({ + 'project_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + 'stage_id': request.stageId ?? '', + }); + const defaultCallSettings = this._defaults['getStageExecutionDetails']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getStageExecutionDetails.createStream( + this.innerApiCalls.getStageExecutionDetails as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `getStageExecutionDetails`, 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.projectId + * A project id. + * @param {string} request.jobId + * The job to get execution details for. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that + * contains the job specified by job_id. + * @param {string} request.stageId + * The stage for which to fetch information. + * @param {number} request.pageSize + * If specified, determines the maximum number of work items to + * return. If unspecified, the service may choose an appropriate + * default, or may return an arbitrarily large number of results. + * @param {string} request.pageToken + * If supplied, this should be the value of next_page_token returned + * by an earlier call. This will cause the next page of results to + * be returned. + * @param {google.protobuf.Timestamp} request.startTime + * Lower time bound of work items to include, by start time. + * @param {google.protobuf.Timestamp} request.endTime + * Upper time bound of work items to include, by start time. + * @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.dataflow.v1beta3.WorkerDetails|WorkerDetails}. 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/v1beta3/metrics_v1_beta3.get_stage_execution_details.js + * region_tag:dataflow_v1beta3_generated_MetricsV1Beta3_GetStageExecutionDetails_async + */ + getStageExecutionDetailsAsync( + request?: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, + 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({ + 'project_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + 'stage_id': request.stageId ?? '', + }); + const defaultCallSettings = this._defaults['getStageExecutionDetails']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getStageExecutionDetails.asyncIterate( + this.innerApiCalls['getStageExecutionDetails'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + + /** + * 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.metricsV1Beta3Stub && !this._terminated) { + return this.metricsV1Beta3Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client_config.json new file mode 100644 index 00000000000..3495334a569 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client_config.json @@ -0,0 +1,41 @@ +{ + "interfaces": { + "google.dataflow.v1beta3.MetricsV1Beta3": { + "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": { + "GetJobMetrics": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetJobExecutionDetails": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetStageExecutionDetails": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_proto_list.json new file mode 100644 index 00000000000..cd5511e4fd8 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/dataflow/v1beta3/environment.proto", + "../../protos/google/dataflow/v1beta3/jobs.proto", + "../../protos/google/dataflow/v1beta3/messages.proto", + "../../protos/google/dataflow/v1beta3/metrics.proto", + "../../protos/google/dataflow/v1beta3/snapshots.proto", + "../../protos/google/dataflow/v1beta3/streaming.proto", + "../../protos/google/dataflow/v1beta3/templates.proto" +] diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client.ts new file mode 100644 index 00000000000..cbc6cfb9df4 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client.ts @@ -0,0 +1,537 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1beta3/snapshots_v1_beta3_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './snapshots_v1_beta3_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Provides methods to manage snapshots of Google Cloud Dataflow jobs. + * @class + * @memberof v1beta3 + */ +export class SnapshotsV1Beta3Client { + 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}; + snapshotsV1Beta3Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SnapshotsV1Beta3Client. + * + * @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 SnapshotsV1Beta3Client({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 SnapshotsV1Beta3Client; + 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.dataflow.v1beta3.SnapshotsV1Beta3', 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.snapshotsV1Beta3Stub) { + return this.snapshotsV1Beta3Stub; + } + + // Put together the "service stub" for + // google.dataflow.v1beta3.SnapshotsV1Beta3. + this.snapshotsV1Beta3Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.SnapshotsV1Beta3') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.dataflow.v1beta3.SnapshotsV1Beta3, + 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 snapshotsV1Beta3StubMethods = + ['getSnapshot', 'deleteSnapshot', 'listSnapshots']; + for (const methodName of snapshotsV1Beta3StubMethods) { + const callPromise = this.snapshotsV1Beta3Stub.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.snapshotsV1Beta3Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataflow.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 'dataflow.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/compute', + 'https://www.googleapis.com/auth/compute.readonly', + 'https://www.googleapis.com/auth/userinfo.email' + ]; + } + + 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 information about a snapshot. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * The ID of the Cloud Platform project that the snapshot belongs to. + * @param {string} request.snapshotId + * The ID of the snapshot. + * @param {string} request.location + * The location that contains this snapshot. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.Snapshot|Snapshot}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/snapshots_v1_beta3.get_snapshot.js + * region_tag:dataflow_v1beta3_generated_SnapshotsV1Beta3_GetSnapshot_async + */ + getSnapshot( + request?: protos.google.dataflow.v1beta3.IGetSnapshotRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.IGetSnapshotRequest|undefined, {}|undefined + ]>; + getSnapshot( + request: protos.google.dataflow.v1beta3.IGetSnapshotRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.IGetSnapshotRequest|null|undefined, + {}|null|undefined>): void; + getSnapshot( + request: protos.google.dataflow.v1beta3.IGetSnapshotRequest, + callback: Callback< + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.IGetSnapshotRequest|null|undefined, + {}|null|undefined>): void; + getSnapshot( + request?: protos.google.dataflow.v1beta3.IGetSnapshotRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.IGetSnapshotRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.IGetSnapshotRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.ISnapshot, + protos.google.dataflow.v1beta3.IGetSnapshotRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + 'snapshot_id': request.snapshotId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSnapshot(request, options, callback); + } +/** + * Deletes a snapshot. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * The ID of the Cloud Platform project that the snapshot belongs to. + * @param {string} request.snapshotId + * The ID of the snapshot. + * @param {string} request.location + * The location that contains this snapshot. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.DeleteSnapshotResponse|DeleteSnapshotResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/snapshots_v1_beta3.delete_snapshot.js + * region_tag:dataflow_v1beta3_generated_SnapshotsV1Beta3_DeleteSnapshot_async + */ + deleteSnapshot( + request?: protos.google.dataflow.v1beta3.IDeleteSnapshotRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, + protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|undefined, {}|undefined + ]>; + deleteSnapshot( + request: protos.google.dataflow.v1beta3.IDeleteSnapshotRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, + protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>): void; + deleteSnapshot( + request: protos.google.dataflow.v1beta3.IDeleteSnapshotRequest, + callback: Callback< + protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, + protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>): void; + deleteSnapshot( + request?: protos.google.dataflow.v1beta3.IDeleteSnapshotRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, + protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, + protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, + protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + 'snapshot_id': request.snapshotId ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSnapshot(request, options, callback); + } +/** + * Lists snapshots. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * The project ID to list snapshots for. + * @param {string} request.jobId + * If specified, list snapshots created from this job. + * @param {string} request.location + * The location to list snapshots in. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.ListSnapshotsResponse|ListSnapshotsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/snapshots_v1_beta3.list_snapshots.js + * region_tag:dataflow_v1beta3_generated_SnapshotsV1Beta3_ListSnapshots_async + */ + listSnapshots( + request?: protos.google.dataflow.v1beta3.IListSnapshotsRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IListSnapshotsResponse, + protos.google.dataflow.v1beta3.IListSnapshotsRequest|undefined, {}|undefined + ]>; + listSnapshots( + request: protos.google.dataflow.v1beta3.IListSnapshotsRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.IListSnapshotsResponse, + protos.google.dataflow.v1beta3.IListSnapshotsRequest|null|undefined, + {}|null|undefined>): void; + listSnapshots( + request: protos.google.dataflow.v1beta3.IListSnapshotsRequest, + callback: Callback< + protos.google.dataflow.v1beta3.IListSnapshotsResponse, + protos.google.dataflow.v1beta3.IListSnapshotsRequest|null|undefined, + {}|null|undefined>): void; + listSnapshots( + request?: protos.google.dataflow.v1beta3.IListSnapshotsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.IListSnapshotsResponse, + protos.google.dataflow.v1beta3.IListSnapshotsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.IListSnapshotsResponse, + protos.google.dataflow.v1beta3.IListSnapshotsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.IListSnapshotsResponse, + protos.google.dataflow.v1beta3.IListSnapshotsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + 'job_id': request.jobId ?? '', + }); + this.initialize(); + return this.innerApiCalls.listSnapshots(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.snapshotsV1Beta3Stub && !this._terminated) { + return this.snapshotsV1Beta3Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client_config.json new file mode 100644 index 00000000000..8ef03a6abc4 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client_config.json @@ -0,0 +1,41 @@ +{ + "interfaces": { + "google.dataflow.v1beta3.SnapshotsV1Beta3": { + "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": { + "GetSnapshot": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSnapshot": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSnapshots": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_proto_list.json new file mode 100644 index 00000000000..cd5511e4fd8 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/dataflow/v1beta3/environment.proto", + "../../protos/google/dataflow/v1beta3/jobs.proto", + "../../protos/google/dataflow/v1beta3/messages.proto", + "../../protos/google/dataflow/v1beta3/metrics.proto", + "../../protos/google/dataflow/v1beta3/snapshots.proto", + "../../protos/google/dataflow/v1beta3/streaming.proto", + "../../protos/google/dataflow/v1beta3/templates.proto" +] diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client.ts new file mode 100644 index 00000000000..f367f4ec913 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client.ts @@ -0,0 +1,562 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1beta3/templates_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './templates_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Provides a method to create Cloud Dataflow jobs from templates. + * @class + * @memberof v1beta3 + */ +export class TemplatesServiceClient { + 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}; + templatesServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TemplatesServiceClient. + * + * @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 TemplatesServiceClient({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 TemplatesServiceClient; + 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.dataflow.v1beta3.TemplatesService', 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.templatesServiceStub) { + return this.templatesServiceStub; + } + + // Put together the "service stub" for + // google.dataflow.v1beta3.TemplatesService. + this.templatesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.TemplatesService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.dataflow.v1beta3.TemplatesService, + 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 templatesServiceStubMethods = + ['createJobFromTemplate', 'launchTemplate', 'getTemplate']; + for (const methodName of templatesServiceStubMethods) { + const callPromise = this.templatesServiceStub.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.templatesServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataflow.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 'dataflow.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/compute', + 'https://www.googleapis.com/auth/compute.readonly', + 'https://www.googleapis.com/auth/userinfo.email' + ]; + } + + 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 Cloud Dataflow job from a template. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Cloud Platform project that the job belongs to. + * @param {string} request.jobName + * Required. The job name to use for the created job. + * @param {string} request.gcsPath + * Required. A Cloud Storage path to the template from which to + * create the job. + * Must be a valid Cloud Storage URL, beginning with `gs://`. + * @param {number[]} request.parameters + * The runtime parameters to pass to the job. + * @param {google.dataflow.v1beta3.RuntimeEnvironment} request.environment + * The runtime environment for the job. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + * which to direct the 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.dataflow.v1beta3.Job|Job}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/templates_service.create_job_from_template.js + * region_tag:dataflow_v1beta3_generated_TemplatesService_CreateJobFromTemplate_async + */ + createJobFromTemplate( + request?: protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|undefined, {}|undefined + ]>; + createJobFromTemplate( + request: protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|null|undefined, + {}|null|undefined>): void; + createJobFromTemplate( + request: protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest, + callback: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|null|undefined, + {}|null|undefined>): void; + createJobFromTemplate( + request?: protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.IJob, + protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + }); + this.initialize(); + return this.innerApiCalls.createJobFromTemplate(request, options, callback); + } +/** + * Launch a template. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Cloud Platform project that the job belongs to. + * @param {boolean} request.validateOnly + * If true, the request is validated but not actually executed. + * Defaults to false. + * @param {string} request.gcsPath + * A Cloud Storage path to the template from which to create + * the job. + * Must be valid Cloud Storage URL, beginning with 'gs://'. + * @param {google.dataflow.v1beta3.DynamicTemplateLaunchParams} request.dynamicTemplate + * Params for launching a dynamic template. + * @param {google.dataflow.v1beta3.LaunchTemplateParameters} request.launchParameters + * The parameters of the template to launch. This should be part of the + * body of the POST request. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + * which to direct the 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.dataflow.v1beta3.LaunchTemplateResponse|LaunchTemplateResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/templates_service.launch_template.js + * region_tag:dataflow_v1beta3_generated_TemplatesService_LaunchTemplate_async + */ + launchTemplate( + request?: protos.google.dataflow.v1beta3.ILaunchTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.ILaunchTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchTemplateRequest|undefined, {}|undefined + ]>; + launchTemplate( + request: protos.google.dataflow.v1beta3.ILaunchTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.ILaunchTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchTemplateRequest|null|undefined, + {}|null|undefined>): void; + launchTemplate( + request: protos.google.dataflow.v1beta3.ILaunchTemplateRequest, + callback: Callback< + protos.google.dataflow.v1beta3.ILaunchTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchTemplateRequest|null|undefined, + {}|null|undefined>): void; + launchTemplate( + request?: protos.google.dataflow.v1beta3.ILaunchTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.ILaunchTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.ILaunchTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.ILaunchTemplateResponse, + protos.google.dataflow.v1beta3.ILaunchTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + }); + this.initialize(); + return this.innerApiCalls.launchTemplate(request, options, callback); + } +/** + * Get the template associated with a template. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Cloud Platform project that the job belongs to. + * @param {string} request.gcsPath + * Required. A Cloud Storage path to the template from which to + * create the job. + * Must be valid Cloud Storage URL, beginning with 'gs://'. + * @param {google.dataflow.v1beta3.GetTemplateRequest.TemplateView} request.view + * The view to retrieve. Defaults to METADATA_ONLY. + * @param {string} request.location + * The [regional endpoint] + * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to + * which to direct the 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.dataflow.v1beta3.GetTemplateResponse|GetTemplateResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta3/templates_service.get_template.js + * region_tag:dataflow_v1beta3_generated_TemplatesService_GetTemplate_async + */ + getTemplate( + request?: protos.google.dataflow.v1beta3.IGetTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.dataflow.v1beta3.IGetTemplateResponse, + protos.google.dataflow.v1beta3.IGetTemplateRequest|undefined, {}|undefined + ]>; + getTemplate( + request: protos.google.dataflow.v1beta3.IGetTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.dataflow.v1beta3.IGetTemplateResponse, + protos.google.dataflow.v1beta3.IGetTemplateRequest|null|undefined, + {}|null|undefined>): void; + getTemplate( + request: protos.google.dataflow.v1beta3.IGetTemplateRequest, + callback: Callback< + protos.google.dataflow.v1beta3.IGetTemplateResponse, + protos.google.dataflow.v1beta3.IGetTemplateRequest|null|undefined, + {}|null|undefined>): void; + getTemplate( + request?: protos.google.dataflow.v1beta3.IGetTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.dataflow.v1beta3.IGetTemplateResponse, + protos.google.dataflow.v1beta3.IGetTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.dataflow.v1beta3.IGetTemplateResponse, + protos.google.dataflow.v1beta3.IGetTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.dataflow.v1beta3.IGetTemplateResponse, + protos.google.dataflow.v1beta3.IGetTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'location': request.location ?? '', + }); + this.initialize(); + return this.innerApiCalls.getTemplate(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.templatesServiceStub && !this._terminated) { + return this.templatesServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client_config.json new file mode 100644 index 00000000000..eb6364e00fd --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client_config.json @@ -0,0 +1,41 @@ +{ + "interfaces": { + "google.dataflow.v1beta3.TemplatesService": { + "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": { + "CreateJobFromTemplate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "LaunchTemplate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetTemplate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_proto_list.json new file mode 100644 index 00000000000..cd5511e4fd8 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/dataflow/v1beta3/environment.proto", + "../../protos/google/dataflow/v1beta3/jobs.proto", + "../../protos/google/dataflow/v1beta3/messages.proto", + "../../protos/google/dataflow/v1beta3/metrics.proto", + "../../protos/google/dataflow/v1beta3/snapshots.proto", + "../../protos/google/dataflow/v1beta3/streaming.proto", + "../../protos/google/dataflow/v1beta3/templates.proto" +] diff --git a/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..dbccacefab2 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.js @@ -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. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const dataflow = require('@google-cloud/dataflow'); + +function main() { + const flexTemplatesServiceClient = new dataflow.FlexTemplatesServiceClient(); + const jobsV1Beta3Client = new dataflow.JobsV1Beta3Client(); + const messagesV1Beta3Client = new dataflow.MessagesV1Beta3Client(); + const metricsV1Beta3Client = new dataflow.MetricsV1Beta3Client(); + const snapshotsV1Beta3Client = new dataflow.SnapshotsV1Beta3Client(); + const templatesServiceClient = new dataflow.TemplatesServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..c6b4898e028 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.ts @@ -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. ** + +import {FlexTemplatesServiceClient, JobsV1Beta3Client, MessagesV1Beta3Client, MetricsV1Beta3Client, SnapshotsV1Beta3Client, TemplatesServiceClient} from '@google-cloud/dataflow'; + +// check that the client class type name can be used +function doStuffWithFlexTemplatesServiceClient(client: FlexTemplatesServiceClient) { + client.close(); +} +function doStuffWithJobsV1Beta3Client(client: JobsV1Beta3Client) { + client.close(); +} +function doStuffWithMessagesV1Beta3Client(client: MessagesV1Beta3Client) { + client.close(); +} +function doStuffWithMetricsV1Beta3Client(client: MetricsV1Beta3Client) { + client.close(); +} +function doStuffWithSnapshotsV1Beta3Client(client: SnapshotsV1Beta3Client) { + client.close(); +} +function doStuffWithTemplatesServiceClient(client: TemplatesServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const flexTemplatesServiceClient = new FlexTemplatesServiceClient(); + doStuffWithFlexTemplatesServiceClient(flexTemplatesServiceClient); + // check that the client instance can be created + const jobsV1Beta3Client = new JobsV1Beta3Client(); + doStuffWithJobsV1Beta3Client(jobsV1Beta3Client); + // check that the client instance can be created + const messagesV1Beta3Client = new MessagesV1Beta3Client(); + doStuffWithMessagesV1Beta3Client(messagesV1Beta3Client); + // check that the client instance can be created + const metricsV1Beta3Client = new MetricsV1Beta3Client(); + doStuffWithMetricsV1Beta3Client(metricsV1Beta3Client); + // check that the client instance can be created + const snapshotsV1Beta3Client = new SnapshotsV1Beta3Client(); + doStuffWithSnapshotsV1Beta3Client(snapshotsV1Beta3Client); + // check that the client instance can be created + const templatesServiceClient = new TemplatesServiceClient(); + doStuffWithTemplatesServiceClient(templatesServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-dataflow/v1beta3/system-test/install.ts b/owl-bot-staging/google-dataflow/v1beta3/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/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-dataflow/v1beta3/test/gapic_flex_templates_service_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_flex_templates_service_v1beta3.ts new file mode 100644 index 00000000000..0a9d1a7e75a --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_flex_templates_service_v1beta3.ts @@ -0,0 +1,270 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 flextemplatesserviceModule 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('v1beta3.FlexTemplatesServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.flexTemplatesServiceStub, undefined); + await client.initialize(); + assert(client.flexTemplatesServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.flexTemplatesServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.flexTemplatesServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ + 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 flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ + 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('launchFlexTemplate', () => { + it('invokes launchFlexTemplate without error', async () => { + const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchFlexTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchFlexTemplateResponse() + ); + client.innerApiCalls.launchFlexTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.launchFlexTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.launchFlexTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.launchFlexTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes launchFlexTemplate without error using callback', async () => { + const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchFlexTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchFlexTemplateResponse() + ); + client.innerApiCalls.launchFlexTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.launchFlexTemplate( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.launchFlexTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.launchFlexTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes launchFlexTemplate with error', async () => { + const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchFlexTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.launchFlexTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.launchFlexTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.launchFlexTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.launchFlexTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes launchFlexTemplate with closed client', async () => { + const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchFlexTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.launchFlexTemplate(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_jobs_v1_beta3_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_jobs_v1_beta3_v1beta3.ts new file mode 100644 index 00000000000..a10d5f193aa --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_jobs_v1_beta3_v1beta3.ts @@ -0,0 +1,1299 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 jobsv1beta3Module 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('v1beta3.JobsV1Beta3Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = jobsv1beta3Module.v1beta3.JobsV1Beta3Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = jobsv1beta3Module.v1beta3.JobsV1Beta3Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = jobsv1beta3Module.v1beta3.JobsV1Beta3Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.jobsV1Beta3Stub, undefined); + await client.initialize(); + assert(client.jobsV1Beta3Stub); + }); + + it('has close method for the initialized client', done => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.jobsV1Beta3Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.jobsV1Beta3Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + 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 jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + 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('createJob', () => { + it('invokes createJob without error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CreateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Job() + ); + client.innerApiCalls.createJob = stubSimpleCall(expectedResponse); + const [response] = await client.createJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createJob without error using callback', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CreateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Job() + ); + client.innerApiCalls.createJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createJob( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createJob with error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CreateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createJob(request), expectedError); + const actualRequest = (client.innerApiCalls.createJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createJob with closed client', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CreateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['location']); + request.location = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createJob(request), expectedError); + }); + }); + + describe('getJob', () => { + it('invokes getJob without error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Job() + ); + client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); + const [response] = await client.getJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJob without error using callback', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Job() + ); + client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJob( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJob with error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJob(request), expectedError); + const actualRequest = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJob with closed client', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getJob(request), expectedError); + }); + }); + + describe('updateJob', () => { + it('invokes updateJob without error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.UpdateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Job() + ); + client.innerApiCalls.updateJob = stubSimpleCall(expectedResponse); + const [response] = await client.updateJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateJob without error using callback', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.UpdateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Job() + ); + client.innerApiCalls.updateJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateJob( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateJob with error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.UpdateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateJob(request), expectedError); + const actualRequest = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateJob with closed client', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.UpdateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateJob(request), expectedError); + }); + }); + + describe('checkActiveJobs', () => { + it('invokes checkActiveJobs without error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CheckActiveJobsRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.CheckActiveJobsResponse() + ); + client.innerApiCalls.checkActiveJobs = stubSimpleCall(expectedResponse); + const [response] = await client.checkActiveJobs(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes checkActiveJobs without error using callback', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CheckActiveJobsRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.CheckActiveJobsResponse() + ); + client.innerApiCalls.checkActiveJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.checkActiveJobs( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.ICheckActiveJobsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes checkActiveJobs with error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CheckActiveJobsRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.checkActiveJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkActiveJobs(request), expectedError); + }); + + it('invokes checkActiveJobs with closed client', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CheckActiveJobsRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.checkActiveJobs(request), expectedError); + }); + }); + + describe('snapshotJob', () => { + it('invokes snapshotJob without error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.SnapshotJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Snapshot() + ); + client.innerApiCalls.snapshotJob = stubSimpleCall(expectedResponse); + const [response] = await client.snapshotJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.snapshotJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.snapshotJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes snapshotJob without error using callback', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.SnapshotJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Snapshot() + ); + client.innerApiCalls.snapshotJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.snapshotJob( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.ISnapshot|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.snapshotJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.snapshotJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes snapshotJob with error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.SnapshotJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.snapshotJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.snapshotJob(request), expectedError); + const actualRequest = (client.innerApiCalls.snapshotJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.snapshotJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes snapshotJob with closed client', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.SnapshotJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.snapshotJob(request), expectedError); + }); + }); + + describe('listJobs', () => { + it('invokes listJobs without error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`;const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listJobs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobs without error using callback', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`;const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listJobs( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobs with error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listJobs(request), expectedError); + const actualRequest = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobsStream without error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + ]; + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.dataflow.v1beta3.Job[] = []; + stream.on('data', (response: protos.google.dataflow.v1beta3.Job) => { + 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.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listJobsStream with error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedError = new Error('expected'); + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.dataflow.v1beta3.Job[] = []; + stream.on('data', (response: protos.google.dataflow.v1beta3.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listJobs without error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + ]; + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.dataflow.v1beta3.IJob[] = []; + const iterable = client.listJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listJobs with error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedError = new Error('expected'); + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.dataflow.v1beta3.IJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('aggregatedListJobs', () => { + it('invokes aggregatedListJobs without error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + ]; + client.innerApiCalls.aggregatedListJobs = stubSimpleCall(expectedResponse); + const [response] = await client.aggregatedListJobs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.aggregatedListJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.aggregatedListJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes aggregatedListJobs without error using callback', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + ]; + client.innerApiCalls.aggregatedListJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.aggregatedListJobs( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.aggregatedListJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.aggregatedListJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes aggregatedListJobs with error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.aggregatedListJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.aggregatedListJobs(request), expectedError); + const actualRequest = (client.innerApiCalls.aggregatedListJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.aggregatedListJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes aggregatedListJobsStream without error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + ]; + client.descriptors.page.aggregatedListJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.aggregatedListJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.dataflow.v1beta3.Job[] = []; + stream.on('data', (response: protos.google.dataflow.v1beta3.Job) => { + 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.aggregatedListJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.aggregatedListJobs, request)); + assert( + (client.descriptors.page.aggregatedListJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes aggregatedListJobsStream with error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.aggregatedListJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.aggregatedListJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.dataflow.v1beta3.Job[] = []; + stream.on('data', (response: protos.google.dataflow.v1beta3.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.aggregatedListJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.aggregatedListJobs, request)); + assert( + (client.descriptors.page.aggregatedListJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with aggregatedListJobs without error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), + ]; + client.descriptors.page.aggregatedListJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.dataflow.v1beta3.IJob[] = []; + const iterable = client.aggregatedListJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.aggregatedListJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.aggregatedListJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with aggregatedListJobs with error', async () => { + const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.aggregatedListJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.aggregatedListJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.dataflow.v1beta3.IJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.aggregatedListJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.aggregatedListJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); +}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_messages_v1_beta3_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_messages_v1_beta3_v1beta3.ts new file mode 100644 index 00000000000..00c84afae99 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_messages_v1_beta3_v1beta3.ts @@ -0,0 +1,484 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 messagesv1beta3Module 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('v1beta3.MessagesV1Beta3Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = messagesv1beta3Module.v1beta3.MessagesV1Beta3Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = messagesv1beta3Module.v1beta3.MessagesV1Beta3Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = messagesv1beta3Module.v1beta3.MessagesV1Beta3Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.messagesV1Beta3Stub, undefined); + await client.initialize(); + assert(client.messagesV1Beta3Stub); + }); + + it('has close method for the initialized client', done => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.messagesV1Beta3Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.messagesV1Beta3Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + 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 messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + 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('listJobMessages', () => { + it('invokes listJobMessages without error', async () => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`;const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + ]; + client.innerApiCalls.listJobMessages = stubSimpleCall(expectedResponse); + const [response] = await client.listJobMessages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listJobMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobMessages without error using callback', async () => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`;const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + ]; + client.innerApiCalls.listJobMessages = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listJobMessages( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJobMessage[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listJobMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobMessages with error', async () => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listJobMessages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listJobMessages(request), expectedError); + const actualRequest = (client.innerApiCalls.listJobMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobMessagesStream without error', async () => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + ]; + client.descriptors.page.listJobMessages.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listJobMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.dataflow.v1beta3.JobMessage[] = []; + stream.on('data', (response: protos.google.dataflow.v1beta3.JobMessage) => { + 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.listJobMessages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobMessages, request)); + assert( + (client.descriptors.page.listJobMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listJobMessagesStream with error', async () => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.descriptors.page.listJobMessages.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listJobMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.dataflow.v1beta3.JobMessage[] = []; + stream.on('data', (response: protos.google.dataflow.v1beta3.JobMessage) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listJobMessages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobMessages, request)); + assert( + (client.descriptors.page.listJobMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listJobMessages without error', async () => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), + ]; + client.descriptors.page.listJobMessages.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.dataflow.v1beta3.IJobMessage[] = []; + const iterable = client.listJobMessagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listJobMessages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listJobMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listJobMessages with error', async () => { + const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListJobMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.descriptors.page.listJobMessages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listJobMessagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.dataflow.v1beta3.IJobMessage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listJobMessages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listJobMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); +}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_metrics_v1_beta3_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_metrics_v1_beta3_v1beta3.ts new file mode 100644 index 00000000000..32c776f40b6 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_metrics_v1_beta3_v1beta3.ts @@ -0,0 +1,924 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 metricsv1beta3Module 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('v1beta3.MetricsV1Beta3Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = metricsv1beta3Module.v1beta3.MetricsV1Beta3Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = metricsv1beta3Module.v1beta3.MetricsV1Beta3Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = metricsv1beta3Module.v1beta3.MetricsV1Beta3Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.metricsV1Beta3Stub, undefined); + await client.initialize(); + assert(client.metricsV1Beta3Stub); + }); + + it('has close method for the initialized client', done => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.metricsV1Beta3Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.metricsV1Beta3Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + 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 metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + 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('getJobMetrics', () => { + it('invokes getJobMetrics without error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.JobMetrics() + ); + client.innerApiCalls.getJobMetrics = stubSimpleCall(expectedResponse); + const [response] = await client.getJobMetrics(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJobMetrics as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJobMetrics as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJobMetrics without error using callback', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.JobMetrics() + ); + client.innerApiCalls.getJobMetrics = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJobMetrics( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJobMetrics|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJobMetrics as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJobMetrics as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJobMetrics with error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getJobMetrics = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJobMetrics(request), expectedError); + const actualRequest = (client.innerApiCalls.getJobMetrics as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJobMetrics as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJobMetrics with closed client', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobMetricsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getJobMetrics(request), expectedError); + }); + }); + + describe('getJobExecutionDetails', () => { + it('invokes getJobExecutionDetails without error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`;const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + ]; + client.innerApiCalls.getJobExecutionDetails = stubSimpleCall(expectedResponse); + const [response] = await client.getJobExecutionDetails(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJobExecutionDetails as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJobExecutionDetails as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJobExecutionDetails without error using callback', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`;const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + ]; + client.innerApiCalls.getJobExecutionDetails = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJobExecutionDetails( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IStageSummary[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJobExecutionDetails as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJobExecutionDetails as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJobExecutionDetails with error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getJobExecutionDetails = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJobExecutionDetails(request), expectedError); + const actualRequest = (client.innerApiCalls.getJobExecutionDetails as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJobExecutionDetails as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJobExecutionDetailsStream without error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + ]; + client.descriptors.page.getJobExecutionDetails.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.getJobExecutionDetailsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.dataflow.v1beta3.StageSummary[] = []; + stream.on('data', (response: protos.google.dataflow.v1beta3.StageSummary) => { + 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.getJobExecutionDetails.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.getJobExecutionDetails, request)); + assert( + (client.descriptors.page.getJobExecutionDetails.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes getJobExecutionDetailsStream with error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.descriptors.page.getJobExecutionDetails.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.getJobExecutionDetailsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.dataflow.v1beta3.StageSummary[] = []; + stream.on('data', (response: protos.google.dataflow.v1beta3.StageSummary) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.getJobExecutionDetails.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.getJobExecutionDetails, request)); + assert( + (client.descriptors.page.getJobExecutionDetails.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with getJobExecutionDetails without error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), + ]; + client.descriptors.page.getJobExecutionDetails.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.dataflow.v1beta3.IStageSummary[] = []; + const iterable = client.getJobExecutionDetailsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.getJobExecutionDetails.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.getJobExecutionDetails.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with getJobExecutionDetails with error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.descriptors.page.getJobExecutionDetails.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.getJobExecutionDetailsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.dataflow.v1beta3.IStageSummary[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.getJobExecutionDetails.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.getJobExecutionDetails.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('getStageExecutionDetails', () => { + it('invokes getStageExecutionDetails without error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); + request.stageId = defaultValue4; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`;const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + ]; + client.innerApiCalls.getStageExecutionDetails = stubSimpleCall(expectedResponse); + const [response] = await client.getStageExecutionDetails(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getStageExecutionDetails as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStageExecutionDetails as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStageExecutionDetails without error using callback', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); + request.stageId = defaultValue4; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`;const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + ]; + client.innerApiCalls.getStageExecutionDetails = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getStageExecutionDetails( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IWorkerDetails[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getStageExecutionDetails as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStageExecutionDetails as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStageExecutionDetails with error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); + request.stageId = defaultValue4; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getStageExecutionDetails = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getStageExecutionDetails(request), expectedError); + const actualRequest = (client.innerApiCalls.getStageExecutionDetails as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStageExecutionDetails as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStageExecutionDetailsStream without error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); + request.stageId = defaultValue4; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + ]; + client.descriptors.page.getStageExecutionDetails.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.getStageExecutionDetailsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.dataflow.v1beta3.WorkerDetails[] = []; + stream.on('data', (response: protos.google.dataflow.v1beta3.WorkerDetails) => { + 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.getStageExecutionDetails.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.getStageExecutionDetails, request)); + assert( + (client.descriptors.page.getStageExecutionDetails.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes getStageExecutionDetailsStream with error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); + request.stageId = defaultValue4; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.descriptors.page.getStageExecutionDetails.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.getStageExecutionDetailsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.dataflow.v1beta3.WorkerDetails[] = []; + stream.on('data', (response: protos.google.dataflow.v1beta3.WorkerDetails) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.getStageExecutionDetails.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.getStageExecutionDetails, request)); + assert( + (client.descriptors.page.getStageExecutionDetails.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with getStageExecutionDetails without error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); + request.stageId = defaultValue4; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), + ]; + client.descriptors.page.getStageExecutionDetails.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.dataflow.v1beta3.IWorkerDetails[] = []; + const iterable = client.getStageExecutionDetailsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.getStageExecutionDetails.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.getStageExecutionDetails.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with getStageExecutionDetails with error', async () => { + const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); + request.jobId = defaultValue3; + const defaultValue4 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); + request.stageId = defaultValue4; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`; + const expectedError = new Error('expected'); + client.descriptors.page.getStageExecutionDetails.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.getStageExecutionDetailsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.dataflow.v1beta3.IWorkerDetails[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.getStageExecutionDetails.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.getStageExecutionDetails.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); +}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_snapshots_v1_beta3_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_snapshots_v1_beta3_v1beta3.ts new file mode 100644 index 00000000000..30d116f9eaf --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_snapshots_v1_beta3_v1beta3.ts @@ -0,0 +1,546 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 snapshotsv1beta3Module 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('v1beta3.SnapshotsV1Beta3Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.snapshotsV1Beta3Stub, undefined); + await client.initialize(); + assert(client.snapshotsV1Beta3Stub); + }); + + it('has close method for the initialized client', done => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.snapshotsV1Beta3Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.snapshotsV1Beta3Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + 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 snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + 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('getSnapshot', () => { + it('invokes getSnapshot without error', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetSnapshotRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['snapshotId']); + request.snapshotId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Snapshot() + ); + client.innerApiCalls.getSnapshot = stubSimpleCall(expectedResponse); + const [response] = await client.getSnapshot(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSnapshot without error using callback', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetSnapshotRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['snapshotId']); + request.snapshotId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Snapshot() + ); + client.innerApiCalls.getSnapshot = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSnapshot( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.ISnapshot|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSnapshot with error', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetSnapshotRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['snapshotId']); + request.snapshotId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSnapshot = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSnapshot(request), expectedError); + const actualRequest = (client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSnapshot with closed client', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetSnapshotRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['snapshotId']); + request.snapshotId = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSnapshot(request), expectedError); + }); + }); + + describe('deleteSnapshot', () => { + it('invokes deleteSnapshot without error', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.DeleteSnapshotRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['snapshotId']); + request.snapshotId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.DeleteSnapshotResponse() + ); + client.innerApiCalls.deleteSnapshot = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSnapshot(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSnapshot without error using callback', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.DeleteSnapshotRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['snapshotId']); + request.snapshotId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.DeleteSnapshotResponse() + ); + client.innerApiCalls.deleteSnapshot = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSnapshot( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IDeleteSnapshotResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSnapshot with error', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.DeleteSnapshotRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['snapshotId']); + request.snapshotId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSnapshot = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSnapshot(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSnapshot with closed client', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.DeleteSnapshotRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['snapshotId']); + request.snapshotId = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSnapshot(request), expectedError); + }); + }); + + describe('listSnapshots', () => { + it('invokes listSnapshots without error', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListSnapshotsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListSnapshotsResponse() + ); + client.innerApiCalls.listSnapshots = stubSimpleCall(expectedResponse); + const [response] = await client.listSnapshots(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSnapshots without error using callback', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListSnapshotsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListSnapshotsResponse() + ); + client.innerApiCalls.listSnapshots = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSnapshots( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IListSnapshotsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSnapshots with error', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListSnapshotsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSnapshots = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSnapshots(request), expectedError); + const actualRequest = (client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSnapshots with closed client', async () => { + const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.ListSnapshotsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['location']); + request.location = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listSnapshots(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_templates_service_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_templates_service_v1beta3.ts new file mode 100644 index 00000000000..bac60f334d6 --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_templates_service_v1beta3.ts @@ -0,0 +1,510 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 templatesserviceModule 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('v1beta3.TemplatesServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = templatesserviceModule.v1beta3.TemplatesServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = templatesserviceModule.v1beta3.TemplatesServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = templatesserviceModule.v1beta3.TemplatesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.templatesServiceStub, undefined); + await client.initialize(); + assert(client.templatesServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.templatesServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.templatesServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + 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 templatesserviceModule.v1beta3.TemplatesServiceClient({ + 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('createJobFromTemplate', () => { + it('invokes createJobFromTemplate without error', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CreateJobFromTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Job() + ); + client.innerApiCalls.createJobFromTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.createJobFromTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createJobFromTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createJobFromTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createJobFromTemplate without error using callback', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CreateJobFromTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.Job() + ); + client.innerApiCalls.createJobFromTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createJobFromTemplate( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createJobFromTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createJobFromTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createJobFromTemplate with error', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CreateJobFromTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createJobFromTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createJobFromTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.createJobFromTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createJobFromTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createJobFromTemplate with closed client', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.CreateJobFromTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createJobFromTemplate(request), expectedError); + }); + }); + + describe('launchTemplate', () => { + it('invokes launchTemplate without error', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchTemplateResponse() + ); + client.innerApiCalls.launchTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.launchTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.launchTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.launchTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes launchTemplate without error using callback', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchTemplateResponse() + ); + client.innerApiCalls.launchTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.launchTemplate( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.ILaunchTemplateResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.launchTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.launchTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes launchTemplate with error', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.launchTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.launchTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.launchTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.launchTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes launchTemplate with closed client', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.LaunchTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.launchTemplate(request), expectedError); + }); + }); + + describe('getTemplate', () => { + it('invokes getTemplate without error', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetTemplateResponse() + ); + client.innerApiCalls.getTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.getTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTemplate without error using callback', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetTemplateResponse() + ); + client.innerApiCalls.getTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTemplate( + request, + (err?: Error|null, result?: protos.google.dataflow.v1beta3.IGetTemplateResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTemplate with error', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.getTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTemplate with closed client', async () => { + const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.dataflow.v1beta3.GetTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['location']); + request.location = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getTemplate(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/tsconfig.json b/owl-bot-staging/google-dataflow/v1beta3/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/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-dataflow/v1beta3/webpack.config.js b/owl-bot-staging/google-dataflow/v1beta3/webpack.config.js new file mode 100644 index 00000000000..4b976b9a2bb --- /dev/null +++ b/owl-bot-staging/google-dataflow/v1beta3/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: 'FlexTemplatesService', + filename: './flex-templates-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-devtools-artifactregistry/v1/.eslintignore b/owl-bot-staging/google-devtools-artifactregistry/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/.eslintrc.json b/owl-bot-staging/google-devtools-artifactregistry/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/.gitignore b/owl-bot-staging/google-devtools-artifactregistry/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1/.jsdoc.js b/owl-bot-staging/google-devtools-artifactregistry/v1/.jsdoc.js new file mode 100644 index 00000000000..532a80143b5 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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/artifact-registry', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/.mocharc.js b/owl-bot-staging/google-devtools-artifactregistry/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1/.prettierrc.js b/owl-bot-staging/google-devtools-artifactregistry/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1/README.md b/owl-bot-staging/google-devtools-artifactregistry/v1/README.md new file mode 100644 index 00000000000..123ed7c7a23 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/README.md @@ -0,0 +1 @@ +Artifactregistry: Nodejs Client diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/package.json b/owl-bot-staging/google-devtools-artifactregistry/v1/package.json new file mode 100644 index 00000000000..6810984ffda --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/artifact-registry", + "version": "0.1.0", + "description": "Artifactregistry client for Node.js", + "repository": "googleapis/nodejs-artifactregistry", + "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 artifactregistry", + "artifactregistry", + "artifact registry" + ], + "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-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/apt_artifact.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/apt_artifact.proto new file mode 100644 index 00000000000..68e63ff42e2 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/apt_artifact.proto @@ -0,0 +1,114 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.artifactregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "AptArtifactProto"; +option java_package = "com.google.devtools.artifactregistry.v1"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; + +// A detailed representation of an Apt artifact. Information in the record +// is derived from the archive's control file. +// See https://www.debian.org/doc/debian-policy/ch-controlfields.html +message AptArtifact { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/AptArtifact" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}" + }; + + // Package type is either binary or source. + enum PackageType { + // Package type is not specified. + PACKAGE_TYPE_UNSPECIFIED = 0; + + // Binary package. + BINARY = 1; + + // Source package. + SOURCE = 2; + } + + // Output only. The Artifact Registry resource name of the artifact. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Apt package name of the artifact. + string package_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. An artifact is a binary or source package. + PackageType package_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Operating system architecture of the artifact. + string architecture = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Repository component of the artifact. + string component = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Contents of the artifact's control metadata file. + bytes control_file = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Google Cloud Storage location where the artifacts currently reside. +message ImportAptArtifactsGcsSource { + // Cloud Storage paths URI (e.g., gs://my_bucket//my_object). + repeated string uris = 1; + + // Supports URI wildcards for matching multiple objects from a single URI. + bool use_wildcards = 2; +} + +// The request to import new apt artifacts. +message ImportAptArtifactsRequest { + // The source location of the package binaries. + oneof source { + // Google Cloud Storage location where input content is located. + ImportAptArtifactsGcsSource gcs_source = 2; + } + + // The name of the parent resource where the artifacts will be imported. + string parent = 1; +} + +// Error information explaining why a package was not imported. +message ImportAptArtifactsErrorInfo { + // The source that was not imported. + oneof source { + // Google Cloud Storage location requested. + ImportAptArtifactsGcsSource gcs_source = 1; + } + + // The detailed error status. + google.rpc.Status error = 2; +} + +// The response message from importing APT artifacts. +message ImportAptArtifactsResponse { + // The Apt artifacts imported. + repeated AptArtifact apt_artifacts = 1; + + // Detailed error info for packages that were not imported. + repeated ImportAptArtifactsErrorInfo errors = 2; +} + +// The operation metadata for importing artifacts. +message ImportAptArtifactsMetadata {} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/artifact.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/artifact.proto new file mode 100644 index 00000000000..58b3a480384 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/artifact.proto @@ -0,0 +1,355 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.artifactregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "ArtifactProto"; +option java_package = "com.google.devtools.artifactregistry.v1"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; + +// DockerImage represents a docker artifact. +// The following fields are returned as untyped metadata in the Version +// resource, using camelcase keys (i.e. metadata.imageSizeBytes): +// * imageSizeBytes +// * mediaType +// * buildTime +message DockerImage { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/DockerImage" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/dockerImages/{docker_image}" + }; + + // Required. registry_location, project_id, repository_name and image id forms + // a unique image + // name:`projects//locations//repository//dockerImages/`. + // For example, + // "projects/test-project/locations/us-west4/repositories/test-repo/dockerImages/ + // nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf", + // where "us-west4" is the registry_location, "test-project" is the + // project_id, "test-repo" is the repository_name and + // "nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf" + // is the image's digest. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. URL to access the image. + // Example: + // us-west4-docker.pkg.dev/test-project/test-repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf + string uri = 2 [(google.api.field_behavior) = REQUIRED]; + + // Tags attached to this image. + repeated string tags = 3; + + // Calculated size of the image. + // This field is returned as the 'metadata.imageSizeBytes' field in the + // Version resource. + int64 image_size_bytes = 4; + + // Time the image was uploaded. + google.protobuf.Timestamp upload_time = 5; + + // Media type of this image, e.g. + // "application/vnd.docker.distribution.manifest.v2+json". + // This field is returned as the 'metadata.mediaType' field in the + // Version resource. + string media_type = 6; + + // The time this image was built. + // This field is returned as the 'metadata.buildTime' field in the + // Version resource. + // The build time is returned to the client as an RFC 3339 string, which can + // be easily used with the JavaScript Date constructor. + google.protobuf.Timestamp build_time = 7; + + // Output only. The time when the docker image was last updated. + google.protobuf.Timestamp update_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request to list docker images. +message ListDockerImagesRequest { + // Required. The name of the parent resource whose docker images will be + // listed. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The maximum number of artifacts to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; + + // The field to order the results by. + string order_by = 4; +} + +// The response from listing docker images. +message ListDockerImagesResponse { + // The docker images returned. + repeated DockerImage docker_images = 1; + + // The token to retrieve the next page of artifacts, or empty if there are no + // more artifacts to return. + string next_page_token = 2; +} + +// The request to get docker images. +message GetDockerImageRequest { + // Required. The name of the docker images. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/DockerImage" + } + ]; +} + +// MavenArtifact represents a maven artifact. +message MavenArtifact { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/MavenArtifact" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/mavenArtifacts/{maven_artifact}" + }; + + // Required. registry_location, project_id, repository_name and maven_artifact + // forms a unique artifact For example, + // "projects/test-project/locations/us-west4/repositories/test-repo/mavenArtifacts/ + // com.google.guava:guava:31.0-jre", + // where "us-west4" is the registry_location, "test-project" is the + // project_id, "test-repo" is the repository_name and + // "com.google.guava:guava:31.0-jre" + // is the maven artifact. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. URL to access the pom file of the artifact. + // Example: + // us-west4-maven.pkg.dev/test-project/test-repo/com/google/guava/guava/31.0/guava-31.0.pom + string pom_uri = 2 [(google.api.field_behavior) = REQUIRED]; + + // Group ID for the artifact. + // Example: + // com.google.guava + string group_id = 3; + + // Artifact ID for the artifact. + string artifact_id = 4; + + // Version of this artifact. + string version = 5; + + // Output only. Time the artifact was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time the artifact was updated. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request to list maven artifacts. +message ListMavenArtifactsRequest { + // Required. The name of the parent resource whose maven artifacts will be + // listed. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "artifactregistry.googleapis.com/MavenArtifact" + } + ]; + + // The maximum number of artifacts to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; +} + +// The response from listing maven artifacts. +message ListMavenArtifactsResponse { + // The maven artifacts returned. + repeated MavenArtifact maven_artifacts = 1; + + // The token to retrieve the next page of artifacts, or empty if there are no + // more artifacts to return. + string next_page_token = 2; +} + +// The request to get maven artifacts. +message GetMavenArtifactRequest { + // Required. The name of the maven artifact. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/MavenArtifact" + } + ]; +} + +// NpmPackage represents an npm artifact. +message NpmPackage { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/NpmPackage" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/npmPackages/{npm_package}" + }; + + // Required. registry_location, project_id, repository_name and npm_package + // forms a unique package For example, + // "projects/test-project/locations/us-west4/repositories/test-repo/npmPackages/ + // npm_test:1.0.0", + // where "us-west4" is the registry_location, "test-project" is the + // project_id, "test-repo" is the repository_name and + // npm_test:1.0.0" is the npm package. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Package for the artifact. + string package_name = 3; + + // Version of this package. + string version = 4; + + // Tags attached to this package. + repeated string tags = 5; + + // Output only. Time the package was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time the package was updated. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request to list npm packages. +message ListNpmPackagesRequest { + // Required. The name of the parent resource whose npm packages will be + // listed. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "artifactregistry.googleapis.com/NpmPackage" + } + ]; + + // The maximum number of artifacts to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; +} + +// The response from listing npm packages. +message ListNpmPackagesResponse { + // The npm packages returned. + repeated NpmPackage npm_packages = 1; + + // The token to retrieve the next page of artifacts, or empty if there are no + // more artifacts to return. + string next_page_token = 2; +} + +// The request to get npm packages. +message GetNpmPackageRequest { + // Required. The name of the npm package. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/NpmPackage" + } + ]; +} + +// PythonPackage represents a python artifact. +message PythonPackage { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/PythonPackage" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/pythonPackages/{python_package}" + }; + + // Required. registry_location, project_id, repository_name and python_package + // forms a unique package + // name:`projects//locations//repository//pythonPackages/`. + // For example, + // "projects/test-project/locations/us-west4/repositories/test-repo/pythonPackages/ + // python_package:1.0.0", + // where "us-west4" is the registry_location, "test-project" is the + // project_id, "test-repo" is the repository_name and + // python_package:1.0.0" is the python package. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. URL to access the package. + // Example: + // us-west4-python.pkg.dev/test-project/test-repo/python_package/file-name-1.0.0.tar.gz + string uri = 2 [(google.api.field_behavior) = REQUIRED]; + + // Package for the artifact. + string package_name = 3; + + // Version of this package. + string version = 4; + + // Output only. Time the package was created. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time the package was updated. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request to list python packages. +message ListPythonPackagesRequest { + // Required. The name of the parent resource whose python packages will be + // listed. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "artifactregistry.googleapis.com/PythonPackage" + } + ]; + + // The maximum number of artifacts to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; +} + +// The response from listing python packages. +message ListPythonPackagesResponse { + // The python packages returned. + repeated PythonPackage python_packages = 1; + + // The token to retrieve the next page of artifacts, or empty if there are no + // more artifacts to return. + string next_page_token = 2; +} + +// The request to get python packages. +message GetPythonPackageRequest { + // Required. The name of the python package. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/PythonPackage" + } + ]; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/file.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/file.proto new file mode 100644 index 00000000000..69b27297fb8 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/file.proto @@ -0,0 +1,141 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.artifactregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "FileProto"; +option java_package = "com.google.devtools.artifactregistry.v1"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; + +// A hash of file content. +message Hash { + // The algorithm used to compute the hash. + enum HashType { + // Unspecified. + HASH_TYPE_UNSPECIFIED = 0; + + // SHA256 hash. + SHA256 = 1; + + // MD5 hash. + MD5 = 2; + } + + // The algorithm used to compute the hash value. + HashType type = 1; + + // The hash value. + bytes value = 2; +} + +// Files store content that is potentially associated with Packages or Versions. +message File { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/File" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/files/{file}" + }; + + // The name of the file, for example: + // "projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt". + // If the file ID part contains slashes, they are escaped. + string name = 1; + + // The size of the File in bytes. + int64 size_bytes = 3; + + // The hashes of the file content. + repeated Hash hashes = 4; + + // Output only. The time when the File was created. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the File was last updated. + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The name of the Package or Version that owns this file, if any. + string owner = 7; + + // Output only. The time when the last attempt to refresh the file's data was + // made. Only set when the repository is remote. + google.protobuf.Timestamp fetch_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request to list files. +message ListFilesRequest { + // Required. The name of the repository whose files will be listed. For + // example: "projects/p1/locations/us-central1/repositories/repo1 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "artifactregistry.googleapis.com/File" + } + ]; + + // An expression for filtering the results of the request. Filter rules are + // case insensitive. The fields eligible for filtering are: + // + // * `name` + // * `owner` + // + // An example of using a filter: + // + // * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an + // ID starting with "a/b/". + // * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> + // Files owned by the version `1.0` in package `pkg1`. + string filter = 4; + + // The maximum number of files to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; + + // The field to order the results by. + string order_by = 5; +} + +// The response from listing files. +message ListFilesResponse { + // The files returned. + repeated File files = 1; + + // The token to retrieve the next page of files, or empty if there are no + // more files to return. + string next_page_token = 2; +} + +// The request to retrieve a file. +message GetFileRequest { + // Required. The name of the file to retrieve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/File" + } + ]; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/package.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/package.proto new file mode 100644 index 00000000000..0dfdf675264 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/package.proto @@ -0,0 +1,101 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.artifactregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "PackageProto"; +option java_package = "com.google.devtools.artifactregistry.v1"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; + +// Packages are named collections of versions. +message Package { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/Package" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}" + }; + + // The name of the package, for example: + // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1". + // If the package ID part contains slashes, the slashes are escaped. + string name = 1; + + // The display name of the package. + string display_name = 2; + + // The time when the package was created. + google.protobuf.Timestamp create_time = 5; + + // The time when the package was last updated. This includes publishing a new + // version of the package. + google.protobuf.Timestamp update_time = 6; +} + +// The request to list packages. +message ListPackagesRequest { + // Required. The name of the parent resource whose packages will be listed. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "artifactregistry.googleapis.com/Package" + } + ]; + + // The maximum number of packages to return. Maximum page size is 1,000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; +} + +// The response from listing packages. +message ListPackagesResponse { + // The packages returned. + repeated Package packages = 1; + + // The token to retrieve the next page of packages, or empty if there are no + // more packages to return. + string next_page_token = 2; +} + +// The request to retrieve a package. +message GetPackageRequest { + // Required. The name of the package to retrieve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Package" + } + ]; +} + +// The request to delete a package. +message DeletePackageRequest { + // Required. The name of the package to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Package" + } + ]; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/repository.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/repository.proto new file mode 100644 index 00000000000..c355852d3dd --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/repository.proto @@ -0,0 +1,201 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.artifactregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "RepositoryProto"; +option java_package = "com.google.devtools.artifactregistry.v1"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; + +// A Repository for storing artifacts with a specific format. +message Repository { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/repositories/{repository}" + }; + + // MavenRepositoryConfig is maven related repository details. + // Provides additional configuration details for repositories of the maven + // format type. + message MavenRepositoryConfig { + // VersionPolicy is the version policy for the repository. + enum VersionPolicy { + // VERSION_POLICY_UNSPECIFIED - the version policy is not defined. + // When the version policy is not defined, no validation is performed + // for the versions. + VERSION_POLICY_UNSPECIFIED = 0; + + // RELEASE - repository will accept only Release versions. + RELEASE = 1; + + // SNAPSHOT - repository will accept only Snapshot versions. + SNAPSHOT = 2; + } + + // The repository with this flag will allow publishing + // the same snapshot versions. + bool allow_snapshot_overwrites = 1; + + // Version policy defines the versions that the registry will accept. + VersionPolicy version_policy = 2; + } + + // A package format. + enum Format { + // Unspecified package format. + FORMAT_UNSPECIFIED = 0; + + // Docker package format. + DOCKER = 1; + + // Maven package format. + MAVEN = 2; + + // NPM package format. + NPM = 3; + + // APT package format. + APT = 5; + + // YUM package format. + YUM = 6; + + // Python package format. + PYTHON = 8; + } + + // Repository-specific configurations. + oneof format_config { + // Maven repository config contains repository level configuration + // for the repositories of maven type. + MavenRepositoryConfig maven_config = 9; + } + + // The name of the repository, for example: + // "projects/p1/locations/us-central1/repositories/repo1". + string name = 1; + + // The format of packages that are stored in the repository. + Format format = 2; + + // The user-provided description of the repository. + string description = 3; + + // Labels with user-defined metadata. + // This field may contain up to 64 entries. Label keys and values may be no + // longer than 63 characters. Label keys must begin with a lowercase letter + // and may only contain lowercase letters, numeric characters, underscores, + // and dashes. + map labels = 4; + + // The time when the repository was created. + google.protobuf.Timestamp create_time = 5; + + // The time when the repository was last updated. + google.protobuf.Timestamp update_time = 6; + + // The Cloud KMS resource name of the customer managed encryption key that's + // used to encrypt the contents of the Repository. Has the form: + // `projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key`. + // This value may not be changed after the Repository has been created. + string kms_key_name = 8; +} + +// The request to list repositories. +message ListRepositoriesRequest { + // Required. The name of the parent resource whose repositories will be listed. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "artifactregistry.googleapis.com/Repository" + } + ]; + + // The maximum number of repositories to return. Maximum page size is 1,000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; +} + +// The response from listing repositories. +message ListRepositoriesResponse { + // The repositories returned. + repeated Repository repositories = 1; + + // The token to retrieve the next page of repositories, or empty if there are + // no more repositories to return. + string next_page_token = 2; +} + +// The request to retrieve a repository. +message GetRepositoryRequest { + // Required. The name of the repository to retrieve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + } + ]; +} + +// The request to create a new repository. +message CreateRepositoryRequest { + // Required. The name of the parent resource where the repository will be created. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "artifactregistry.googleapis.com/Repository" + } + ]; + + // The repository id to use for this repository. + string repository_id = 2; + + // The repository to be created. + Repository repository = 3; +} + +// The request to update a repository. +message UpdateRepositoryRequest { + // The repository that replaces the resource on the server. + Repository repository = 1; + + // The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 2; +} + +// The request to delete a repository. +message DeleteRepositoryRequest { + // Required. The name of the repository to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + } + ]; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/service.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/service.proto new file mode 100644 index 00000000000..5edda67a5dc --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/service.proto @@ -0,0 +1,400 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.artifactregistry.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/devtools/artifactregistry/v1/apt_artifact.proto"; +import "google/devtools/artifactregistry/v1/artifact.proto"; +import "google/devtools/artifactregistry/v1/file.proto"; +import "google/devtools/artifactregistry/v1/package.proto"; +import "google/devtools/artifactregistry/v1/repository.proto"; +import "google/devtools/artifactregistry/v1/settings.proto"; +import "google/devtools/artifactregistry/v1/tag.proto"; +import "google/devtools/artifactregistry/v1/version.proto"; +import "google/devtools/artifactregistry/v1/vpcsc_config.proto"; +import "google/devtools/artifactregistry/v1/yum_artifact.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.devtools.artifactregistry.v1"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; + +// The Artifact Registry API service. +// +// Artifact Registry is an artifact management system for storing artifacts +// from different package management systems. +// +// The resources managed by this API are: +// +// * Repositories, which group packages and their data. +// * Packages, which group versions and their tags. +// * Versions, which are specific forms of a package. +// * Tags, which represent alternative names for versions. +// * Files, which contain content and are optionally associated with a Package +// or Version. +service ArtifactRegistry { + option (google.api.default_host) = "artifactregistry.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only"; + + // Lists docker images. + rpc ListDockerImages(ListDockerImagesRequest) + returns (ListDockerImagesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/repositories/*}/dockerImages" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a docker image. + rpc GetDockerImage(GetDockerImageRequest) returns (DockerImage) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/repositories/*/dockerImages/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists maven artifacts. + rpc ListMavenArtifacts(ListMavenArtifactsRequest) + returns (ListMavenArtifactsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/repositories/*}/mavenArtifacts" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a maven artifact. + rpc GetMavenArtifact(GetMavenArtifactRequest) returns (MavenArtifact) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/repositories/*/mavenArtifacts/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists npm packages. + rpc ListNpmPackages(ListNpmPackagesRequest) + returns (ListNpmPackagesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/repositories/*}/npmPackages" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a npm package. + rpc GetNpmPackage(GetNpmPackageRequest) returns (NpmPackage) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/repositories/*/npmPackages/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists python packages. + rpc ListPythonPackages(ListPythonPackagesRequest) + returns (ListPythonPackagesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/repositories/*}/pythonPackages" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a python package. + rpc GetPythonPackage(GetPythonPackageRequest) returns (PythonPackage) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/repositories/*/pythonPackages/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Imports Apt artifacts. The returned Operation will complete once the + // resources are imported. Package, Version, and File resources are created + // based on the imported artifacts. Imported artifacts that conflict with + // existing resources are ignored. + rpc ImportAptArtifacts(ImportAptArtifactsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/repositories/*}/aptArtifacts:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.devtools.artifactregistry.v1.ImportAptArtifactsResponse" + metadata_type: "google.devtools.artifactregistry.v1.ImportAptArtifactsMetadata" + }; + } + + // Imports Yum (RPM) artifacts. The returned Operation will complete once the + // resources are imported. Package, Version, and File resources are created + // based on the imported artifacts. Imported artifacts that conflict with + // existing resources are ignored. + rpc ImportYumArtifacts(ImportYumArtifactsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/repositories/*}/yumArtifacts:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.devtools.artifactregistry.v1.ImportYumArtifactsResponse" + metadata_type: "google.devtools.artifactregistry.v1.ImportYumArtifactsMetadata" + }; + } + + // Lists repositories. + rpc ListRepositories(ListRepositoriesRequest) + returns (ListRepositoriesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/repositories" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a repository. + rpc GetRepository(GetRepositoryRequest) returns (Repository) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/repositories/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a repository. The returned Operation will finish once the + // repository has been created. Its response will be the created Repository. + rpc CreateRepository(CreateRepositoryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/repositories" + body: "repository" + }; + option (google.api.method_signature) = "parent,repository,repository_id"; + option (google.longrunning.operation_info) = { + response_type: "google.devtools.artifactregistry.v1.Repository" + metadata_type: "google.devtools.artifactregistry.v1.OperationMetadata" + }; + } + + // Updates a repository. + rpc UpdateRepository(UpdateRepositoryRequest) returns (Repository) { + option (google.api.http) = { + patch: "/v1/{repository.name=projects/*/locations/*/repositories/*}" + body: "repository" + }; + option (google.api.method_signature) = "repository,update_mask"; + } + + // Deletes a repository and all of its contents. The returned Operation will + // finish once the repository has been deleted. It will not have any Operation + // metadata and will return a google.protobuf.Empty response. + rpc DeleteRepository(DeleteRepositoryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/repositories/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.devtools.artifactregistry.v1.OperationMetadata" + }; + } + + // Lists packages. + rpc ListPackages(ListPackagesRequest) returns (ListPackagesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/repositories/*}/packages" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a package. + rpc GetPackage(GetPackageRequest) returns (Package) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/repositories/*/packages/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a package and all of its versions and tags. The returned operation + // will complete once the package has been deleted. + rpc DeletePackage(DeletePackageRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/repositories/*/packages/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.devtools.artifactregistry.v1.OperationMetadata" + }; + } + + // Lists versions. + rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/repositories/*/packages/*}/versions" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a version + rpc GetVersion(GetVersionRequest) returns (Version) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/repositories/*/packages/*/versions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a version and all of its content. The returned operation will + // complete once the version has been deleted. + rpc DeleteVersion(DeleteVersionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/repositories/*/packages/*/versions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.devtools.artifactregistry.v1.OperationMetadata" + }; + } + + // Lists files. + rpc ListFiles(ListFilesRequest) returns (ListFilesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/repositories/*}/files" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a file. + rpc GetFile(GetFileRequest) returns (File) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/repositories/*/files/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists tags. + rpc ListTags(ListTagsRequest) returns (ListTagsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/repositories/*/packages/*}/tags" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a tag. + rpc GetTag(GetTagRequest) returns (Tag) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/repositories/*/packages/*/tags/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a tag. + rpc CreateTag(CreateTagRequest) returns (Tag) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/repositories/*/packages/*}/tags" + body: "tag" + }; + option (google.api.method_signature) = "parent,tag,tag_id"; + } + + // Updates a tag. + rpc UpdateTag(UpdateTagRequest) returns (Tag) { + option (google.api.http) = { + patch: "/v1/{tag.name=projects/*/locations/*/repositories/*/packages/*/tags/*}" + body: "tag" + }; + option (google.api.method_signature) = "tag,update_mask"; + } + + // Deletes a tag. + rpc DeleteTag(DeleteTagRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/repositories/*/packages/*/tags/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the IAM policy for a given resource. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/repositories/*}:setIamPolicy" + body: "*" + }; + } + + // Gets the IAM policy for a given resource. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + get: "/v1/{resource=projects/*/locations/*/repositories/*}:getIamPolicy" + }; + } + + // Tests if the caller has a list of permissions on a resource. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/repositories/*}:testIamPermissions" + body: "*" + }; + } + + // Retrieves the Settings for the Project. + rpc GetProjectSettings(GetProjectSettingsRequest) returns (ProjectSettings) { + option (google.api.http) = { + get: "/v1/{name=projects/*/projectSettings}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the Settings for the Project. + rpc UpdateProjectSettings(UpdateProjectSettingsRequest) + returns (ProjectSettings) { + option (google.api.http) = { + patch: "/v1/{project_settings.name=projects/*/projectSettings}" + body: "project_settings" + }; + option (google.api.method_signature) = "project_settings,update_mask"; + } + + // Retrieves the VPCSC Config for the Project. + rpc GetVPCSCConfig(GetVPCSCConfigRequest) returns (VPCSCConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/vpcscConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the VPCSC Config for the Project. + rpc UpdateVPCSCConfig(UpdateVPCSCConfigRequest) returns (VPCSCConfig) { + option (google.api.http) = { + patch: "/v1/{vpcsc_config.name=projects/*/locations/*/vpcscConfig}" + body: "vpcsc_config" + }; + option (google.api.method_signature) = "vpcsc_config,update_mask"; + } +} + +// Metadata type for longrunning-operations, currently empty. +message OperationMetadata {} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/settings.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/settings.proto new file mode 100644 index 00000000000..b1f0111e112 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/settings.proto @@ -0,0 +1,84 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.devtools.artifactregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "SettingsProto"; +option java_package = "com.google.devtools.artifactregistry.v1"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; + +// The Artifact Registry settings that apply to a Project. +message ProjectSettings { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/ProjectSettings" + pattern: "projects/{project}/projectSettings" + }; + + // The possible redirection states for legacy repositories. + enum RedirectionState { + // No redirection status has been set. + REDIRECTION_STATE_UNSPECIFIED = 0; + + // Redirection is disabled. + REDIRECTION_FROM_GCR_IO_DISABLED = 1; + + // Redirection is enabled. + REDIRECTION_FROM_GCR_IO_ENABLED = 2; + + // Redirection is enabled, and has been finalized so cannot be reverted. + REDIRECTION_FROM_GCR_IO_FINALIZED = 3 [deprecated = true]; + } + + // The name of the project's settings. + // + // Always of the form: + // projects/{project-id}/projectSettings + // + // In update request: never set + // In response: always set + string name = 1; + + // The redirection state of the legacy repositories in this project. + RedirectionState legacy_redirection_state = 2; +} + +// Gets the redirection status for a project. +message GetProjectSettingsRequest { + // Required. The name of the projectSettings resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/ProjectSettings" + } + ]; +} + +// Sets the settings of the project. +message UpdateProjectSettingsRequest { + // The project settings. + ProjectSettings project_settings = 2; + + // Field mask to support partial updates. + google.protobuf.FieldMask update_mask = 3; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/tag.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/tag.proto new file mode 100644 index 00000000000..818373baf1d --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/tag.proto @@ -0,0 +1,118 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.devtools.artifactregistry.v1; + +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "TagProto"; +option java_package = "com.google.devtools.artifactregistry.v1"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; + +// Tags point to a version and represent an alternative name that can be used +// to access the version. +message Tag { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/Tag" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}" + }; + + // The name of the tag, for example: + // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". + // If the package part contains slashes, the slashes are escaped. + // The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else + // must be URL encoded. + string name = 1; + + // The name of the version the tag refers to, for example: + // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811" + // If the package or version ID parts contain slashes, the slashes are + // escaped. + string version = 2; +} + +// The request to list tags. +message ListTagsRequest { + // The name of the parent resource whose tags will be listed. + string parent = 1; + + // An expression for filtering the results of the request. Filter rules are + // case insensitive. The fields eligible for filtering are: + // + // * `version` + // + // An example of using a filter: + // + // * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` + // --> Tags that are applied to the version `1.0` in package `pkg1`. + string filter = 4; + + // The maximum number of tags to return. Maximum page size is 10,000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; +} + +// The response from listing tags. +message ListTagsResponse { + // The tags returned. + repeated Tag tags = 1; + + // The token to retrieve the next page of tags, or empty if there are no + // more tags to return. + string next_page_token = 2; +} + +// The request to retrieve a tag. +message GetTagRequest { + // The name of the tag to retrieve. + string name = 1; +} + +// The request to create a new tag. +message CreateTagRequest { + // The name of the parent resource where the tag will be created. + string parent = 1; + + // The tag id to use for this repository. + string tag_id = 2; + + // The tag to be created. + Tag tag = 3; +} + +// The request to create or update a tag. +message UpdateTagRequest { + // The tag that replaces the resource on the server. + Tag tag = 1; + + // The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 2; +} + +// The request to delete a tag. +message DeleteTagRequest { + // The name of the tag to delete. + string name = 1; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/version.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/version.proto new file mode 100644 index 00000000000..b84d7f276be --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/version.proto @@ -0,0 +1,135 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.devtools.artifactregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/devtools/artifactregistry/v1/tag.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "VersionProto"; +option java_package = "com.google.devtools.artifactregistry.v1"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; + +// The view, which determines what version information is returned in a +// response. +enum VersionView { + // The default / unset value. + // The API will default to the BASIC view. + VERSION_VIEW_UNSPECIFIED = 0; + + // Includes basic information about the version, but not any related tags. + BASIC = 1; + + // Include everything. + FULL = 2; +} + +// The body of a version resource. A version resource represents a +// collection of components, such as files and other data. This may correspond +// to a version in many package management schemes. +message Version { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/Version" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}" + }; + + // The name of the version, for example: + // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/art1". + // If the package or version ID parts contain slashes, the slashes are + // escaped. + string name = 1; + + // Optional. Description of the version, as specified in its metadata. + string description = 3; + + // The time when the version was created. + google.protobuf.Timestamp create_time = 5; + + // The time when the version was last updated. + google.protobuf.Timestamp update_time = 6; + + // Output only. A list of related tags. Will contain up to 100 tags that + // reference this version. + repeated Tag related_tags = 7; + + // Output only. Repository-specific Metadata stored against this version. + // The fields returned are defined by the underlying repository-specific + // resource. Currently, the resources could be: + // [DockerImage][google.devtools.artifactregistry.v1.DockerImage] + // [MavenArtifact][google.devtools.artifactregistry.v1.MavenArtifact] + google.protobuf.Struct metadata = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request to list versions. +message ListVersionsRequest { + // The name of the parent resource whose versions will be listed. + string parent = 1; + + // The maximum number of versions to return. Maximum page size is 1,000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; + + // The view that should be returned in the response. + VersionView view = 4; + + // Optional. The field to order the results by. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response from listing versions. +message ListVersionsResponse { + // The versions returned. + repeated Version versions = 1; + + // The token to retrieve the next page of versions, or empty if there are no + // more versions to return. + string next_page_token = 2; +} + +// The request to retrieve a version. +message GetVersionRequest { + // The name of the version to retrieve. + string name = 1; + + // The view that should be returned in the response. + VersionView view = 2; +} + +// The request to delete a version. +message DeleteVersionRequest { + // The name of the version to delete. + string name = 1; + + // By default, a version that is tagged may not be deleted. If force=true, the + // version and any tags pointing to the version are deleted. + bool force = 2; +} + +// The metadata of an LRO from deleting multiple versions. +message BatchDeleteVersionsMetadata { + // The versions the operation failed to delete. + repeated string failed_versions = 2; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/vpcsc_config.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/vpcsc_config.proto new file mode 100644 index 00000000000..575e03a76f6 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/vpcsc_config.proto @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.devtools.artifactregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "VPCSCConfigProto"; +option java_package = "com.google.devtools.artifactregistry.v1"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; + +// The Artifact Registry VPC SC config that apply to a Project. +message VPCSCConfig { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/VpcscConfig" + pattern: "projects/{project}/locations/{location}/vpcscConfig" + }; + + // VPCSCPolicy is the VPC SC policy for project and location. + enum VPCSCPolicy { + // VPCSC_POLICY_UNSPECIFIED - the VPS SC policy is not defined. + // When VPS SC policy is not defined - the Service will use the default + // behavior (VPCSC_DENY). + VPCSC_POLICY_UNSPECIFIED = 0; + + // VPCSC_DENY - repository will block the requests to the Upstreams for the + // Remote Repositories if the resource is in the perimeter. + DENY = 1; + + // VPCSC_ALLOW - repository will allow the requests to the Upstreams for the + // Remote Repositories if the resource is in the perimeter. + ALLOW = 2; + } + + // The name of the project's VPC SC Config. + // + // Always of the form: + // projects/{projectID}/locations/{location}/vpcscConfig + // + // In update request: never set + // In response: always set + string name = 1; + + // The project per location VPC SC policy that defines the VPC SC behavior for + // the Remote Repository (Allow/Deny). + VPCSCPolicy vpcsc_policy = 2; +} + +// Gets the VPC SC config for a project. +message GetVPCSCConfigRequest { + // Required. The name of the VPCSCConfig resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/VpcscConfig" + } + ]; +} + +// Sets the VPCSC config of the project. +message UpdateVPCSCConfigRequest { + // The project config. + VPCSCConfig vpcsc_config = 1; + + // Field mask to support partial updates. + google.protobuf.FieldMask update_mask = 2; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/yum_artifact.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/yum_artifact.proto new file mode 100644 index 00000000000..f55332ae4bb --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/yum_artifact.proto @@ -0,0 +1,106 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.artifactregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "YumArtifactProto"; +option java_package = "com.google.devtools.artifactregistry.v1"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; + +// A detailed representation of a Yum artifact. +message YumArtifact { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/YumArtifact" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/yumArtifacts/{yum_artifact}" + }; + + // Package type is either binary or source. + enum PackageType { + // Package type is not specified. + PACKAGE_TYPE_UNSPECIFIED = 0; + + // Binary package (.rpm). + BINARY = 1; + + // Source package (.srpm). + SOURCE = 2; + } + + // Output only. The Artifact Registry resource name of the artifact. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The yum package name of the artifact. + string package_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. An artifact is a binary or source package. + PackageType package_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Operating system architecture of the artifact. + string architecture = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Google Cloud Storage location where the artifacts currently reside. +message ImportYumArtifactsGcsSource { + // Cloud Storage paths URI (e.g., gs://my_bucket//my_object). + repeated string uris = 1; + + // Supports URI wildcards for matching multiple objects from a single URI. + bool use_wildcards = 2; +} + +// The request to import new yum artifacts. +message ImportYumArtifactsRequest { + // The source location of the package binaries. + oneof source { + // Google Cloud Storage location where input content is located. + ImportYumArtifactsGcsSource gcs_source = 2; + } + + // The name of the parent resource where the artifacts will be imported. + string parent = 1; +} + +// Error information explaining why a package was not imported. +message ImportYumArtifactsErrorInfo { + // The source that was not imported. + oneof source { + // Google Cloud Storage location requested. + ImportYumArtifactsGcsSource gcs_source = 1; + } + + // The detailed error status. + google.rpc.Status error = 2; +} + +// The response message from importing YUM artifacts. +message ImportYumArtifactsResponse { + // The yum artifacts imported. + repeated YumArtifact yum_artifacts = 1; + + // Detailed error info for packages that were not imported. + repeated ImportYumArtifactsErrorInfo errors = 2; +} + +// The operation metadata for importing artifacts. +message ImportYumArtifactsMetadata {} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_repository.js new file mode 100644 index 00000000000..31e4eee5c99 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_repository.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 artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 parent resource where the repository will be created. + */ + // const parent = 'abc123' + /** + * The repository id to use for this repository. + */ + // const repositoryId = 'abc123' + /** + * The repository to be created. + */ + // const repository = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callCreateRepository() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await artifactregistryClient.createRepository(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateRepository(); + // [END artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_tag.js new file mode 100644 index 00000000000..65e179892da --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_tag.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() { + // [START artifactregistry_v1_generated_ArtifactRegistry_CreateTag_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the parent resource where the tag will be created. + */ + // const parent = 'abc123' + /** + * The tag id to use for this repository. + */ + // const tagId = 'abc123' + /** + * The tag to be created. + */ + // const tag = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callCreateTag() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.createTag(request); + console.log(response); + } + + callCreateTag(); + // [END artifactregistry_v1_generated_ArtifactRegistry_CreateTag_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_package.js new file mode 100644 index 00000000000..3182dfcaafc --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_package.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 artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 package to delete. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callDeletePackage() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await artifactregistryClient.deletePackage(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeletePackage(); + // [END artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_repository.js new file mode 100644 index 00000000000..417477c2e77 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_repository.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 artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 repository to delete. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callDeleteRepository() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await artifactregistryClient.deleteRepository(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteRepository(); + // [END artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_tag.js new file mode 100644 index 00000000000..848398d4313 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_tag.js @@ -0,0 +1,60 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the tag to delete. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callDeleteTag() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.deleteTag(request); + console.log(response); + } + + callDeleteTag(); + // [END artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_version.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_version.js new file mode 100644 index 00000000000..89e0fe6f0bb --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_version.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 artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the version to delete. + */ + // const name = 'abc123' + /** + * By default, a version that is tagged may not be deleted. If force=true, the + * version and any tags pointing to the version are deleted. + */ + // const force = true + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callDeleteVersion() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await artifactregistryClient.deleteVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteVersion(); + // [END artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_docker_image.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_docker_image.js new file mode 100644 index 00000000000..c5ec14d2069 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_docker_image.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 artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 docker images. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetDockerImage() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await artifactregistryClient.getDockerImage(request); + console.log(response); + } + + callGetDockerImage(); + // [END artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_file.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_file.js new file mode 100644 index 00000000000..3b743520431 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_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 artifactregistry_v1_generated_ArtifactRegistry_GetFile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 file to retrieve. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetFile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await artifactregistryClient.getFile(request); + console.log(response); + } + + callGetFile(); + // [END artifactregistry_v1_generated_ArtifactRegistry_GetFile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_iam_policy.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_iam_policy.js new file mode 100644 index 00000000000..94c86686012 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.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 artifactregistry_v1_generated_ArtifactRegistry_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 Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await artifactregistryClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END artifactregistry_v1_generated_ArtifactRegistry_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-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_maven_artifact.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_maven_artifact.js new file mode 100644 index 00000000000..235629b118f --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_maven_artifact.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 artifactregistry_v1_generated_ArtifactRegistry_GetMavenArtifact_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 maven artifact. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetMavenArtifact() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await artifactregistryClient.getMavenArtifact(request); + console.log(response); + } + + callGetMavenArtifact(); + // [END artifactregistry_v1_generated_ArtifactRegistry_GetMavenArtifact_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_npm_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_npm_package.js new file mode 100644 index 00000000000..8bc36d342c8 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_npm_package.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 artifactregistry_v1_generated_ArtifactRegistry_GetNpmPackage_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 npm package. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetNpmPackage() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await artifactregistryClient.getNpmPackage(request); + console.log(response); + } + + callGetNpmPackage(); + // [END artifactregistry_v1_generated_ArtifactRegistry_GetNpmPackage_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_package.js new file mode 100644 index 00000000000..904ad1c01fb --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_package.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 artifactregistry_v1_generated_ArtifactRegistry_GetPackage_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 package to retrieve. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetPackage() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await artifactregistryClient.getPackage(request); + console.log(response); + } + + callGetPackage(); + // [END artifactregistry_v1_generated_ArtifactRegistry_GetPackage_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_project_settings.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_project_settings.js new file mode 100644 index 00000000000..f35139db26e --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_project_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 artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 projectSettings resource. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetProjectSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await artifactregistryClient.getProjectSettings(request); + console.log(response); + } + + callGetProjectSettings(); + // [END artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_python_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_python_package.js new file mode 100644 index 00000000000..6faa0e3bb4b --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_python_package.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 artifactregistry_v1_generated_ArtifactRegistry_GetPythonPackage_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 python package. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetPythonPackage() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await artifactregistryClient.getPythonPackage(request); + console.log(response); + } + + callGetPythonPackage(); + // [END artifactregistry_v1_generated_ArtifactRegistry_GetPythonPackage_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_repository.js new file mode 100644 index 00000000000..19e29582166 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_repository.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 artifactregistry_v1_generated_ArtifactRegistry_GetRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 repository to retrieve. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetRepository() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await artifactregistryClient.getRepository(request); + console.log(response); + } + + callGetRepository(); + // [END artifactregistry_v1_generated_ArtifactRegistry_GetRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_tag.js new file mode 100644 index 00000000000..7075a8d6c4c --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_tag.js @@ -0,0 +1,60 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 artifactregistry_v1_generated_ArtifactRegistry_GetTag_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the tag to retrieve. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetTag() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.getTag(request); + console.log(response); + } + + callGetTag(); + // [END artifactregistry_v1_generated_ArtifactRegistry_GetTag_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_v_p_c_s_c_config.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_v_p_c_s_c_config.js new file mode 100644 index 00000000000..04bc879360b --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_v_p_c_s_c_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 artifactregistry_v1_generated_ArtifactRegistry_GetVPCSCConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 VPCSCConfig resource. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetVPCSCConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await artifactregistryClient.getVPCSCConfig(request); + console.log(response); + } + + callGetVPCSCConfig(); + // [END artifactregistry_v1_generated_ArtifactRegistry_GetVPCSCConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_version.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_version.js new file mode 100644 index 00000000000..8197ba8371a --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_version.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() { + // [START artifactregistry_v1_generated_ArtifactRegistry_GetVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the version to retrieve. + */ + // const name = 'abc123' + /** + * The view that should be returned in the response. + */ + // const view = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetVersion() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.getVersion(request); + console.log(response); + } + + callGetVersion(); + // [END artifactregistry_v1_generated_ArtifactRegistry_GetVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_apt_artifacts.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_apt_artifacts.js new file mode 100644 index 00000000000..7777baeabe5 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_apt_artifacts.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() { + // [START artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Google Cloud Storage location where input content is located. + */ + // const gcsSource = {} + /** + * The name of the parent resource where the artifacts will be imported. + */ + // const parent = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callImportAptArtifacts() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await artifactregistryClient.importAptArtifacts(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportAptArtifacts(); + // [END artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_yum_artifacts.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_yum_artifacts.js new file mode 100644 index 00000000000..4d8d43fbeab --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_yum_artifacts.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() { + // [START artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Google Cloud Storage location where input content is located. + */ + // const gcsSource = {} + /** + * The name of the parent resource where the artifacts will be imported. + */ + // const parent = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callImportYumArtifacts() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await artifactregistryClient.importYumArtifacts(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportYumArtifacts(); + // [END artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_docker_images.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_docker_images.js new file mode 100644 index 00000000000..2ac1b250990 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_docker_images.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) { + // [START artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 parent resource whose docker images will be + * listed. + */ + // const parent = 'abc123' + /** + * The maximum number of artifacts to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + /** + * The field to order the results by. + */ + // const orderBy = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListDockerImages() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await artifactregistryClient.listDockerImagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDockerImages(); + // [END artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_files.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_files.js new file mode 100644 index 00000000000..2cb4afca10f --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_files.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) { + // [START artifactregistry_v1_generated_ArtifactRegistry_ListFiles_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 repository whose files will be listed. For + * example: "projects/p1/locations/us-central1/repositories/repo1 + */ + // const parent = 'abc123' + /** + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `name` + * * `owner` + * An example of using a filter: + * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an + * ID starting with "a/b/". + * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> + * Files owned by the version `1.0` in package `pkg1`. + */ + // const filter = 'abc123' + /** + * The maximum number of files to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + /** + * The field to order the results by. + */ + // const orderBy = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListFiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await artifactregistryClient.listFilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFiles(); + // [END artifactregistry_v1_generated_ArtifactRegistry_ListFiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_maven_artifacts.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_maven_artifacts.js new file mode 100644 index 00000000000..6255484ab26 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_maven_artifacts.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(parent) { + // [START artifactregistry_v1_generated_ArtifactRegistry_ListMavenArtifacts_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 parent resource whose maven artifacts will be + * listed. + */ + // const parent = 'abc123' + /** + * The maximum number of artifacts to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListMavenArtifacts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await artifactregistryClient.listMavenArtifactsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMavenArtifacts(); + // [END artifactregistry_v1_generated_ArtifactRegistry_ListMavenArtifacts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_npm_packages.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_npm_packages.js new file mode 100644 index 00000000000..64046e6bf3f --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_npm_packages.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(parent) { + // [START artifactregistry_v1_generated_ArtifactRegistry_ListNpmPackages_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 parent resource whose npm packages will be + * listed. + */ + // const parent = 'abc123' + /** + * The maximum number of artifacts to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListNpmPackages() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await artifactregistryClient.listNpmPackagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNpmPackages(); + // [END artifactregistry_v1_generated_ArtifactRegistry_ListNpmPackages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_packages.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_packages.js new file mode 100644 index 00000000000..dea1563b637 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_packages.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(parent) { + // [START artifactregistry_v1_generated_ArtifactRegistry_ListPackages_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 parent resource whose packages will be listed. + */ + // const parent = 'abc123' + /** + * The maximum number of packages to return. Maximum page size is 1,000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListPackages() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await artifactregistryClient.listPackagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListPackages(); + // [END artifactregistry_v1_generated_ArtifactRegistry_ListPackages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_python_packages.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_python_packages.js new file mode 100644 index 00000000000..704b4e59d6d --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_python_packages.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(parent) { + // [START artifactregistry_v1_generated_ArtifactRegistry_ListPythonPackages_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 parent resource whose python packages will be + * listed. + */ + // const parent = 'abc123' + /** + * The maximum number of artifacts to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListPythonPackages() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await artifactregistryClient.listPythonPackagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListPythonPackages(); + // [END artifactregistry_v1_generated_ArtifactRegistry_ListPythonPackages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_repositories.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_repositories.js new file mode 100644 index 00000000000..a9ae7e7d5af --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_repositories.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(parent) { + // [START artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 parent resource whose repositories will be listed. + */ + // const parent = 'abc123' + /** + * The maximum number of repositories to return. Maximum page size is 1,000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListRepositories() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await artifactregistryClient.listRepositoriesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRepositories(); + // [END artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_tags.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_tags.js new file mode 100644 index 00000000000..aaae98758ba --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_tags.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 artifactregistry_v1_generated_ArtifactRegistry_ListTags_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the parent resource whose tags will be listed. + */ + // const parent = 'abc123' + /** + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `version` + * An example of using a filter: + * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` + * --> Tags that are applied to the version `1.0` in package `pkg1`. + */ + // const filter = 'abc123' + /** + * The maximum number of tags to return. Maximum page size is 10,000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListTags() { + // Construct request + const request = { + }; + + // Run request + const iterable = await artifactregistryClient.listTagsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListTags(); + // [END artifactregistry_v1_generated_ArtifactRegistry_ListTags_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_versions.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_versions.js new file mode 100644 index 00000000000..42cfc63bca5 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_versions.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 artifactregistry_v1_generated_ArtifactRegistry_ListVersions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the parent resource whose versions will be listed. + */ + // const parent = 'abc123' + /** + * The maximum number of versions to return. Maximum page size is 1,000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + /** + * The view that should be returned in the response. + */ + // const view = {} + /** + * Optional. The field to order the results by. + */ + // const orderBy = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListVersions() { + // Construct request + const request = { + }; + + // Run request + const iterable = await artifactregistryClient.listVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListVersions(); + // [END artifactregistry_v1_generated_ArtifactRegistry_ListVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.set_iam_policy.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.set_iam_policy.js new file mode 100644 index 00000000000..224d684e33c --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.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 artifactregistry_v1_generated_ArtifactRegistry_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 Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await artifactregistryClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END artifactregistry_v1_generated_ArtifactRegistry_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-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.test_iam_permissions.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.test_iam_permissions.js new file mode 100644 index 00000000000..56096a196b1 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.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 artifactregistry_v1_generated_ArtifactRegistry_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 Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await artifactregistryClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END artifactregistry_v1_generated_ArtifactRegistry_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-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_project_settings.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_project_settings.js new file mode 100644 index 00000000000..3129244d36f --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_project_settings.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() { + // [START artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 settings. + */ + // const projectSettings = {} + /** + * Field mask to support partial updates. + */ + // const updateMask = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callUpdateProjectSettings() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.updateProjectSettings(request); + console.log(response); + } + + callUpdateProjectSettings(); + // [END artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_repository.js new file mode 100644 index 00000000000..5183bf67ae5 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_repository.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 artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 repository that replaces the resource on the server. + */ + // const repository = {} + /** + * The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callUpdateRepository() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.updateRepository(request); + console.log(response); + } + + callUpdateRepository(); + // [END artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_tag.js new file mode 100644 index 00000000000..9e3b8ae13c1 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_tag.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 artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 tag that replaces the resource on the server. + */ + // const tag = {} + /** + * The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callUpdateTag() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.updateTag(request); + console.log(response); + } + + callUpdateTag(); + // [END artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_v_p_c_s_c_config.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_v_p_c_s_c_config.js new file mode 100644 index 00000000000..c8118387998 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_v_p_c_s_c_config.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() { + // [START artifactregistry_v1_generated_ArtifactRegistry_UpdateVPCSCConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 config. + */ + // const vpcscConfig = {} + /** + * Field mask to support partial updates. + */ + // const updateMask = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callUpdateVPCSCConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.updateVPCSCConfig(request); + console.log(response); + } + + callUpdateVPCSCConfig(); + // [END artifactregistry_v1_generated_ArtifactRegistry_UpdateVPCSCConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/snippet_metadata_google.devtools.artifactregistry.v1.json b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/snippet_metadata_google.devtools.artifactregistry.v1.json new file mode 100644 index 00000000000..9ebb95b1173 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/snippet_metadata_google.devtools.artifactregistry.v1.json @@ -0,0 +1,1575 @@ +{ + "clientLibrary": { + "name": "nodejs-artifactregistry", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.devtools.artifactregistry.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_async", + "title": "ArtifactRegistry listDockerImages Sample", + "origin": "API_DEFINITION", + "description": " Lists docker images.", + "canonical": true, + "file": "artifact_registry.list_docker_images.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDockerImages", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListDockerImages", + "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.devtools.artifactregistry.v1.ListDockerImagesResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListDockerImages", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListDockerImages", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_async", + "title": "ArtifactRegistry getDockerImage Sample", + "origin": "API_DEFINITION", + "description": " Gets a docker image.", + "canonical": true, + "file": "artifact_registry.get_docker_image.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDockerImage", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetDockerImage", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.DockerImage", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetDockerImage", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetDockerImage", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListMavenArtifacts_async", + "title": "ArtifactRegistry listMavenArtifacts Sample", + "origin": "API_DEFINITION", + "description": " Lists maven artifacts.", + "canonical": true, + "file": "artifact_registry.list_maven_artifacts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMavenArtifacts", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListMavenArtifacts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.ListMavenArtifactsResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListMavenArtifacts", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListMavenArtifacts", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetMavenArtifact_async", + "title": "ArtifactRegistry getMavenArtifact Sample", + "origin": "API_DEFINITION", + "description": " Gets a maven artifact.", + "canonical": true, + "file": "artifact_registry.get_maven_artifact.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMavenArtifact", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetMavenArtifact", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.MavenArtifact", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetMavenArtifact", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetMavenArtifact", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListNpmPackages_async", + "title": "ArtifactRegistry listNpmPackages Sample", + "origin": "API_DEFINITION", + "description": " Lists npm packages.", + "canonical": true, + "file": "artifact_registry.list_npm_packages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNpmPackages", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListNpmPackages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.ListNpmPackagesResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListNpmPackages", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListNpmPackages", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetNpmPackage_async", + "title": "ArtifactRegistry getNpmPackage Sample", + "origin": "API_DEFINITION", + "description": " Gets a npm package.", + "canonical": true, + "file": "artifact_registry.get_npm_package.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNpmPackage", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetNpmPackage", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.NpmPackage", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetNpmPackage", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetNpmPackage", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListPythonPackages_async", + "title": "ArtifactRegistry listPythonPackages Sample", + "origin": "API_DEFINITION", + "description": " Lists python packages.", + "canonical": true, + "file": "artifact_registry.list_python_packages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListPythonPackages", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListPythonPackages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.ListPythonPackagesResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListPythonPackages", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListPythonPackages", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetPythonPackage_async", + "title": "ArtifactRegistry getPythonPackage Sample", + "origin": "API_DEFINITION", + "description": " Gets a python package.", + "canonical": true, + "file": "artifact_registry.get_python_package.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetPythonPackage", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetPythonPackage", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.PythonPackage", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetPythonPackage", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetPythonPackage", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async", + "title": "ArtifactRegistry importAptArtifacts Sample", + "origin": "API_DEFINITION", + "description": " Imports Apt artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.", + "canonical": true, + "file": "artifact_registry.import_apt_artifacts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportAptArtifacts", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportAptArtifacts", + "async": true, + "parameters": [ + { + "name": "gcs_source", + "type": ".google.devtools.artifactregistry.v1.ImportAptArtifactsGcsSource" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "ImportAptArtifacts", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportAptArtifacts", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async", + "title": "ArtifactRegistry importYumArtifacts Sample", + "origin": "API_DEFINITION", + "description": " Imports Yum (RPM) artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.", + "canonical": true, + "file": "artifact_registry.import_yum_artifacts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportYumArtifacts", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportYumArtifacts", + "async": true, + "parameters": [ + { + "name": "gcs_source", + "type": ".google.devtools.artifactregistry.v1.ImportYumArtifactsGcsSource" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "ImportYumArtifacts", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportYumArtifacts", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_async", + "title": "ArtifactRegistry listRepositories Sample", + "origin": "API_DEFINITION", + "description": " Lists repositories.", + "canonical": true, + "file": "artifact_registry.list_repositories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRepositories", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListRepositories", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.ListRepositoriesResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListRepositories", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListRepositories", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetRepository_async", + "title": "ArtifactRegistry getRepository Sample", + "origin": "API_DEFINITION", + "description": " Gets a repository.", + "canonical": true, + "file": "artifact_registry.get_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRepository", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetRepository", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.Repository", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetRepository", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetRepository", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async", + "title": "ArtifactRegistry createRepository Sample", + "origin": "API_DEFINITION", + "description": " Creates a repository. The returned Operation will finish once the repository has been created. Its response will be the created Repository.", + "canonical": true, + "file": "artifact_registry.create_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateRepository", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateRepository", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "repository_id", + "type": "TYPE_STRING" + }, + { + "name": "repository", + "type": ".google.devtools.artifactregistry.v1.Repository" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "CreateRepository", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateRepository", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_async", + "title": "ArtifactRegistry updateRepository Sample", + "origin": "API_DEFINITION", + "description": " Updates a repository.", + "canonical": true, + "file": "artifact_registry.update_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateRepository", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateRepository", + "async": true, + "parameters": [ + { + "name": "repository", + "type": ".google.devtools.artifactregistry.v1.Repository" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.Repository", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "UpdateRepository", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateRepository", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async", + "title": "ArtifactRegistry deleteRepository Sample", + "origin": "API_DEFINITION", + "description": " Deletes a repository and all of its contents. The returned Operation will finish once the repository has been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response.", + "canonical": true, + "file": "artifact_registry.delete_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteRepository", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteRepository", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "DeleteRepository", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteRepository", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListPackages_async", + "title": "ArtifactRegistry listPackages Sample", + "origin": "API_DEFINITION", + "description": " Lists packages.", + "canonical": true, + "file": "artifact_registry.list_packages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListPackages", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListPackages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.ListPackagesResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListPackages", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListPackages", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetPackage_async", + "title": "ArtifactRegistry getPackage Sample", + "origin": "API_DEFINITION", + "description": " Gets a package.", + "canonical": true, + "file": "artifact_registry.get_package.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetPackage", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetPackage", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.Package", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetPackage", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetPackage", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async", + "title": "ArtifactRegistry deletePackage Sample", + "origin": "API_DEFINITION", + "description": " Deletes a package and all of its versions and tags. The returned operation will complete once the package has been deleted.", + "canonical": true, + "file": "artifact_registry.delete_package.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePackage", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeletePackage", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "DeletePackage", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeletePackage", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListVersions_async", + "title": "ArtifactRegistry listVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists versions.", + "canonical": true, + "file": "artifact_registry.list_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListVersions", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListVersions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.devtools.artifactregistry.v1.VersionView" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.ListVersionsResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListVersions", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListVersions", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetVersion_async", + "title": "ArtifactRegistry getVersion Sample", + "origin": "API_DEFINITION", + "description": " Gets a version", + "canonical": true, + "file": "artifact_registry.get_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVersion", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.devtools.artifactregistry.v1.VersionView" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.Version", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetVersion", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetVersion", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async", + "title": "ArtifactRegistry deleteVersion Sample", + "origin": "API_DEFINITION", + "description": " Deletes a version and all of its content. The returned operation will complete once the version has been deleted.", + "canonical": true, + "file": "artifact_registry.delete_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteVersion", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "DeleteVersion", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteVersion", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListFiles_async", + "title": "ArtifactRegistry listFiles Sample", + "origin": "API_DEFINITION", + "description": " Lists files.", + "canonical": true, + "file": "artifact_registry.list_files.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFiles", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListFiles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.ListFilesResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListFiles", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListFiles", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetFile_async", + "title": "ArtifactRegistry getFile Sample", + "origin": "API_DEFINITION", + "description": " Gets a file.", + "canonical": true, + "file": "artifact_registry.get_file.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFile", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetFile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.File", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetFile", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetFile", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListTags_async", + "title": "ArtifactRegistry listTags Sample", + "origin": "API_DEFINITION", + "description": " Lists tags.", + "canonical": true, + "file": "artifact_registry.list_tags.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListTags", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListTags", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.ListTagsResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListTags", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListTags", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetTag_async", + "title": "ArtifactRegistry getTag Sample", + "origin": "API_DEFINITION", + "description": " Gets a tag.", + "canonical": true, + "file": "artifact_registry.get_tag.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetTag", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetTag", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.Tag", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetTag", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetTag", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_CreateTag_async", + "title": "ArtifactRegistry createTag Sample", + "origin": "API_DEFINITION", + "description": " Creates a tag.", + "canonical": true, + "file": "artifact_registry.create_tag.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateTag", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateTag", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "tag_id", + "type": "TYPE_STRING" + }, + { + "name": "tag", + "type": ".google.devtools.artifactregistry.v1.Tag" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.Tag", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "CreateTag", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateTag", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_async", + "title": "ArtifactRegistry updateTag Sample", + "origin": "API_DEFINITION", + "description": " Updates a tag.", + "canonical": true, + "file": "artifact_registry.update_tag.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateTag", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateTag", + "async": true, + "parameters": [ + { + "name": "tag", + "type": ".google.devtools.artifactregistry.v1.Tag" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.Tag", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "UpdateTag", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateTag", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_async", + "title": "ArtifactRegistry deleteTag Sample", + "origin": "API_DEFINITION", + "description": " Deletes a tag.", + "canonical": true, + "file": "artifact_registry.delete_tag.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteTag", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteTag", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "DeleteTag", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteTag", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_SetIamPolicy_async", + "title": "ArtifactRegistry setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Updates the IAM policy for a given resource.", + "canonical": true, + "file": "artifact_registry.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.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": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.SetIamPolicy", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetIamPolicy_async", + "title": "ArtifactRegistry getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the IAM policy for a given resource.", + "canonical": true, + "file": "artifact_registry.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetIamPolicy", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_TestIamPermissions_async", + "title": "ArtifactRegistry testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Tests if the caller has a list of permissions on a resource.", + "canonical": true, + "file": "artifact_registry.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.TestIamPermissions", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_async", + "title": "ArtifactRegistry getProjectSettings Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the Settings for the Project.", + "canonical": true, + "file": "artifact_registry.get_project_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProjectSettings", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetProjectSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.ProjectSettings", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetProjectSettings", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetProjectSettings", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_async", + "title": "ArtifactRegistry updateProjectSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates the Settings for the Project.", + "canonical": true, + "file": "artifact_registry.update_project_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProjectSettings", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateProjectSettings", + "async": true, + "parameters": [ + { + "name": "project_settings", + "type": ".google.devtools.artifactregistry.v1.ProjectSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.ProjectSettings", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "UpdateProjectSettings", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateProjectSettings", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetVPCSCConfig_async", + "title": "ArtifactRegistry getVPCSCConfig Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the VPCSC Config for the Project.", + "canonical": true, + "file": "artifact_registry.get_v_p_c_s_c_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVPCSCConfig", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetVPCSCConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.VPCSCConfig", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetVPCSCConfig", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetVPCSCConfig", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateVPCSCConfig_async", + "title": "ArtifactRegistry updateVPCSCConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates the VPCSC Config for the Project.", + "canonical": true, + "file": "artifact_registry.update_v_p_c_s_c_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateVPCSCConfig", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateVPCSCConfig", + "async": true, + "parameters": [ + { + "name": "vpcsc_config", + "type": ".google.devtools.artifactregistry.v1.VPCSCConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.devtools.artifactregistry.v1.VPCSCConfig", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" + }, + "method": { + "shortName": "UpdateVPCSCConfig", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateVPCSCConfig", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/src/index.ts new file mode 100644 index 00000000000..932c99cbf24 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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 ArtifactRegistryClient = v1.ArtifactRegistryClient; +type ArtifactRegistryClient = v1.ArtifactRegistryClient; +export {v1, ArtifactRegistryClient}; +export default {v1, ArtifactRegistryClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client.ts new file mode 100644 index 00000000000..8e570781f1b --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client.ts @@ -0,0 +1,5109 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/artifact_registry_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './artifact_registry_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Artifact Registry API service. + * + * Artifact Registry is an artifact management system for storing artifacts + * from different package management systems. + * + * The resources managed by this API are: + * + * * Repositories, which group packages and their data. + * * Packages, which group versions and their tags. + * * Versions, which are specific forms of a package. + * * Tags, which represent alternative names for versions. + * * Files, which contain content and are optionally associated with a Package + * or Version. + * @class + * @memberof v1 + */ +export class ArtifactRegistryClient { + 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; + artifactRegistryStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ArtifactRegistryClient. + * + * @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 ArtifactRegistryClient({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 ArtifactRegistryClient; + 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 = { + aptArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}' + ), + dockerImagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/dockerImages/{docker_image}' + ), + filePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/files/{file}' + ), + mavenArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/mavenArtifacts/{maven_artifact}' + ), + npmPackagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/npmPackages/{npm_package}' + ), + packagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/packages/{package}' + ), + projectSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/projectSettings' + ), + pythonPackagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/pythonPackages/{python_package}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}' + ), + tagPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}' + ), + vpcscConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/vpcscConfig' + ), + yumArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/yumArtifacts/{yum_artifact}' + ), + }; + + // 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 = { + listDockerImages: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'dockerImages'), + listMavenArtifacts: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mavenArtifacts'), + listNpmPackages: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'npmPackages'), + listPythonPackages: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'pythonPackages'), + listRepositories: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories'), + listPackages: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'packages'), + listVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'versions'), + listFiles: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'files'), + listTags: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tags') + }; + + 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.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const importAptArtifactsResponse = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1.ImportAptArtifactsResponse') as gax.protobuf.Type; + const importAptArtifactsMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1.ImportAptArtifactsMetadata') as gax.protobuf.Type; + const importYumArtifactsResponse = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1.ImportYumArtifactsResponse') as gax.protobuf.Type; + const importYumArtifactsMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1.ImportYumArtifactsMetadata') as gax.protobuf.Type; + const createRepositoryResponse = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1.Repository') as gax.protobuf.Type; + const createRepositoryMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1.OperationMetadata') as gax.protobuf.Type; + const deleteRepositoryResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteRepositoryMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1.OperationMetadata') as gax.protobuf.Type; + const deletePackageResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deletePackageMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1.OperationMetadata') as gax.protobuf.Type; + const deleteVersionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteVersionMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + importAptArtifacts: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importAptArtifactsResponse.decode.bind(importAptArtifactsResponse), + importAptArtifactsMetadata.decode.bind(importAptArtifactsMetadata)), + importYumArtifacts: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importYumArtifactsResponse.decode.bind(importYumArtifactsResponse), + importYumArtifactsMetadata.decode.bind(importYumArtifactsMetadata)), + createRepository: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createRepositoryResponse.decode.bind(createRepositoryResponse), + createRepositoryMetadata.decode.bind(createRepositoryMetadata)), + deleteRepository: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteRepositoryResponse.decode.bind(deleteRepositoryResponse), + deleteRepositoryMetadata.decode.bind(deleteRepositoryMetadata)), + deletePackage: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deletePackageResponse.decode.bind(deletePackageResponse), + deletePackageMetadata.decode.bind(deletePackageMetadata)), + deleteVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteVersionResponse.decode.bind(deleteVersionResponse), + deleteVersionMetadata.decode.bind(deleteVersionMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.devtools.artifactregistry.v1.ArtifactRegistry', 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.artifactRegistryStub) { + return this.artifactRegistryStub; + } + + // Put together the "service stub" for + // google.devtools.artifactregistry.v1.ArtifactRegistry. + this.artifactRegistryStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.devtools.artifactregistry.v1.ArtifactRegistry') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devtools.artifactregistry.v1.ArtifactRegistry, + 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 artifactRegistryStubMethods = + ['listDockerImages', 'getDockerImage', 'listMavenArtifacts', 'getMavenArtifact', 'listNpmPackages', 'getNpmPackage', 'listPythonPackages', 'getPythonPackage', 'importAptArtifacts', 'importYumArtifacts', 'listRepositories', 'getRepository', 'createRepository', 'updateRepository', 'deleteRepository', 'listPackages', 'getPackage', 'deletePackage', 'listVersions', 'getVersion', 'deleteVersion', 'listFiles', 'getFile', 'listTags', 'getTag', 'createTag', 'updateTag', 'deleteTag', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'getProjectSettings', 'updateProjectSettings', 'getVpcscConfig', 'updateVpcscConfig']; + for (const methodName of artifactRegistryStubMethods) { + const callPromise = this.artifactRegistryStub.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.artifactRegistryStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'artifactregistry.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 'artifactregistry.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/cloud-platform.read-only' + ]; + } + + 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 a docker image. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the docker images. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.DockerImage|DockerImage}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.get_docker_image.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_async + */ + getDockerImage( + request?: protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IDockerImage, + protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|undefined, {}|undefined + ]>; + getDockerImage( + request: protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IDockerImage, + protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|null|undefined, + {}|null|undefined>): void; + getDockerImage( + request: protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IDockerImage, + protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|null|undefined, + {}|null|undefined>): void; + getDockerImage( + request?: protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IDockerImage, + protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IDockerImage, + protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IDockerImage, + protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getDockerImage(request, options, callback); + } +/** + * Gets a maven artifact. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the maven artifact. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.MavenArtifact|MavenArtifact}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.get_maven_artifact.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetMavenArtifact_async + */ + getMavenArtifact( + request?: protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IMavenArtifact, + protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|undefined, {}|undefined + ]>; + getMavenArtifact( + request: protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IMavenArtifact, + protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|null|undefined, + {}|null|undefined>): void; + getMavenArtifact( + request: protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IMavenArtifact, + protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|null|undefined, + {}|null|undefined>): void; + getMavenArtifact( + request?: protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IMavenArtifact, + protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IMavenArtifact, + protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IMavenArtifact, + protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getMavenArtifact(request, options, callback); + } +/** + * Gets a npm package. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the npm package. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.NpmPackage|NpmPackage}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.get_npm_package.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetNpmPackage_async + */ + getNpmPackage( + request?: protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.INpmPackage, + protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|undefined, {}|undefined + ]>; + getNpmPackage( + request: protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.INpmPackage, + protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|null|undefined, + {}|null|undefined>): void; + getNpmPackage( + request: protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.INpmPackage, + protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|null|undefined, + {}|null|undefined>): void; + getNpmPackage( + request?: protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.INpmPackage, + protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.INpmPackage, + protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.INpmPackage, + protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getNpmPackage(request, options, callback); + } +/** + * Gets a python package. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the python package. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.PythonPackage|PythonPackage}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.get_python_package.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetPythonPackage_async + */ + getPythonPackage( + request?: protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IPythonPackage, + protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|undefined, {}|undefined + ]>; + getPythonPackage( + request: protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IPythonPackage, + protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|null|undefined, + {}|null|undefined>): void; + getPythonPackage( + request: protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IPythonPackage, + protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|null|undefined, + {}|null|undefined>): void; + getPythonPackage( + request?: protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IPythonPackage, + protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IPythonPackage, + protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IPythonPackage, + protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getPythonPackage(request, options, callback); + } +/** + * Gets a repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the repository to retrieve. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.Repository|Repository}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.get_repository.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetRepository_async + */ + getRepository( + request?: protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|undefined, {}|undefined + ]>; + getRepository( + request: protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): void; + getRepository( + request: protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): void; + getRepository( + request?: protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getRepository(request, options, callback); + } +/** + * Updates a repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.artifactregistry.v1.Repository} request.repository + * The repository that replaces the resource on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The update mask applies to the resource. For the `FieldMask` definition, + * 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.devtools.artifactregistry.v1.Repository|Repository}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.update_repository.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_async + */ + updateRepository( + request?: protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|undefined, {}|undefined + ]>; + updateRepository( + request: protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|null|undefined, + {}|null|undefined>): void; + updateRepository( + request: protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|null|undefined, + {}|null|undefined>): void; + updateRepository( + request?: protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IRepository, + protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'repository.name': request.repository!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateRepository(request, options, callback); + } +/** + * Gets a package. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the package to retrieve. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.Package|Package}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.get_package.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetPackage_async + */ + getPackage( + request?: protos.google.devtools.artifactregistry.v1.IGetPackageRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IPackage, + protos.google.devtools.artifactregistry.v1.IGetPackageRequest|undefined, {}|undefined + ]>; + getPackage( + request: protos.google.devtools.artifactregistry.v1.IGetPackageRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IPackage, + protos.google.devtools.artifactregistry.v1.IGetPackageRequest|null|undefined, + {}|null|undefined>): void; + getPackage( + request: protos.google.devtools.artifactregistry.v1.IGetPackageRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IPackage, + protos.google.devtools.artifactregistry.v1.IGetPackageRequest|null|undefined, + {}|null|undefined>): void; + getPackage( + request?: protos.google.devtools.artifactregistry.v1.IGetPackageRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IPackage, + protos.google.devtools.artifactregistry.v1.IGetPackageRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IPackage, + protos.google.devtools.artifactregistry.v1.IGetPackageRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IPackage, + protos.google.devtools.artifactregistry.v1.IGetPackageRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getPackage(request, options, callback); + } +/** + * Gets a version + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the version to retrieve. + * @param {google.devtools.artifactregistry.v1.VersionView} request.view + * The view that should be returned in the response. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.Version|Version}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.get_version.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetVersion_async + */ + getVersion( + request?: protos.google.devtools.artifactregistry.v1.IGetVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IVersion, + protos.google.devtools.artifactregistry.v1.IGetVersionRequest|undefined, {}|undefined + ]>; + getVersion( + request: protos.google.devtools.artifactregistry.v1.IGetVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IVersion, + protos.google.devtools.artifactregistry.v1.IGetVersionRequest|null|undefined, + {}|null|undefined>): void; + getVersion( + request: protos.google.devtools.artifactregistry.v1.IGetVersionRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IVersion, + protos.google.devtools.artifactregistry.v1.IGetVersionRequest|null|undefined, + {}|null|undefined>): void; + getVersion( + request?: protos.google.devtools.artifactregistry.v1.IGetVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IVersion, + protos.google.devtools.artifactregistry.v1.IGetVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IVersion, + protos.google.devtools.artifactregistry.v1.IGetVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IVersion, + protos.google.devtools.artifactregistry.v1.IGetVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getVersion(request, options, callback); + } +/** + * Gets a file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the file to retrieve. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.File|File}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.get_file.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetFile_async + */ + getFile( + request?: protos.google.devtools.artifactregistry.v1.IGetFileRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IFile, + protos.google.devtools.artifactregistry.v1.IGetFileRequest|undefined, {}|undefined + ]>; + getFile( + request: protos.google.devtools.artifactregistry.v1.IGetFileRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IFile, + protos.google.devtools.artifactregistry.v1.IGetFileRequest|null|undefined, + {}|null|undefined>): void; + getFile( + request: protos.google.devtools.artifactregistry.v1.IGetFileRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IFile, + protos.google.devtools.artifactregistry.v1.IGetFileRequest|null|undefined, + {}|null|undefined>): void; + getFile( + request?: protos.google.devtools.artifactregistry.v1.IGetFileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IFile, + protos.google.devtools.artifactregistry.v1.IGetFileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IFile, + protos.google.devtools.artifactregistry.v1.IGetFileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IFile, + protos.google.devtools.artifactregistry.v1.IGetFileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFile(request, options, callback); + } +/** + * Gets a tag. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the tag to retrieve. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.Tag|Tag}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.get_tag.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetTag_async + */ + getTag( + request?: protos.google.devtools.artifactregistry.v1.IGetTagRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IGetTagRequest|undefined, {}|undefined + ]>; + getTag( + request: protos.google.devtools.artifactregistry.v1.IGetTagRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IGetTagRequest|null|undefined, + {}|null|undefined>): void; + getTag( + request: protos.google.devtools.artifactregistry.v1.IGetTagRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IGetTagRequest|null|undefined, + {}|null|undefined>): void; + getTag( + request?: protos.google.devtools.artifactregistry.v1.IGetTagRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IGetTagRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IGetTagRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IGetTagRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getTag(request, options, callback); + } +/** + * Creates a tag. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the parent resource where the tag will be created. + * @param {string} request.tagId + * The tag id to use for this repository. + * @param {google.devtools.artifactregistry.v1.Tag} request.tag + * The tag 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.devtools.artifactregistry.v1.Tag|Tag}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.create_tag.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_CreateTag_async + */ + createTag( + request?: protos.google.devtools.artifactregistry.v1.ICreateTagRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.ICreateTagRequest|undefined, {}|undefined + ]>; + createTag( + request: protos.google.devtools.artifactregistry.v1.ICreateTagRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.ICreateTagRequest|null|undefined, + {}|null|undefined>): void; + createTag( + request: protos.google.devtools.artifactregistry.v1.ICreateTagRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.ICreateTagRequest|null|undefined, + {}|null|undefined>): void; + createTag( + request?: protos.google.devtools.artifactregistry.v1.ICreateTagRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.ICreateTagRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.ICreateTagRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.ICreateTagRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createTag(request, options, callback); + } +/** + * Updates a tag. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.artifactregistry.v1.Tag} request.tag + * The tag that replaces the resource on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The update mask applies to the resource. For the `FieldMask` definition, + * 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.devtools.artifactregistry.v1.Tag|Tag}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.update_tag.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_async + */ + updateTag( + request?: protos.google.devtools.artifactregistry.v1.IUpdateTagRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|undefined, {}|undefined + ]>; + updateTag( + request: protos.google.devtools.artifactregistry.v1.IUpdateTagRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|null|undefined, + {}|null|undefined>): void; + updateTag( + request: protos.google.devtools.artifactregistry.v1.IUpdateTagRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|null|undefined, + {}|null|undefined>): void; + updateTag( + request?: protos.google.devtools.artifactregistry.v1.IUpdateTagRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.ITag, + protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'tag.name': request.tag!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateTag(request, options, callback); + } +/** + * Deletes a tag. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the tag to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/artifact_registry.delete_tag.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_async + */ + deleteTag( + request?: protos.google.devtools.artifactregistry.v1.IDeleteTagRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|undefined, {}|undefined + ]>; + deleteTag( + request: protos.google.devtools.artifactregistry.v1.IDeleteTagRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|null|undefined, + {}|null|undefined>): void; + deleteTag( + request: protos.google.devtools.artifactregistry.v1.IDeleteTagRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|null|undefined, + {}|null|undefined>): void; + deleteTag( + request?: protos.google.devtools.artifactregistry.v1.IDeleteTagRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteTag(request, options, callback); + } +/** + * Updates the IAM policy for a given resource. + * + * @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/artifact_registry.set_iam_policy.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_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 policy for a given resource. + * + * @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/artifact_registry.get_iam_policy.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_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 if the caller has a list of permissions on a resource. + * + * @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/artifact_registry.test_iam_permissions.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_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); + } +/** + * Retrieves the Settings for the Project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the projectSettings 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.devtools.artifactregistry.v1.ProjectSettings|ProjectSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.get_project_settings.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_async + */ + getProjectSettings( + request?: protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|undefined, {}|undefined + ]>; + getProjectSettings( + request: protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|null|undefined, + {}|null|undefined>): void; + getProjectSettings( + request: protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|null|undefined, + {}|null|undefined>): void; + getProjectSettings( + request?: protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getProjectSettings(request, options, callback); + } +/** + * Updates the Settings for the Project. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.artifactregistry.v1.ProjectSettings} request.projectSettings + * The project settings. + * @param {google.protobuf.FieldMask} request.updateMask + * Field mask to support partial updates. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.ProjectSettings|ProjectSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.update_project_settings.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_async + */ + updateProjectSettings( + request?: protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|undefined, {}|undefined + ]>; + updateProjectSettings( + request: protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateProjectSettings( + request: protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateProjectSettings( + request?: protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IProjectSettings, + protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_settings.name': request.projectSettings!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateProjectSettings(request, options, callback); + } +/** + * Retrieves the VPCSC Config for the Project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the VPCSCConfig 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.devtools.artifactregistry.v1.VPCSCConfig|VPCSCConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.get_v_p_c_s_c_config.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetVPCSCConfig_async + */ + getVPCSCConfig( + request?: protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|undefined, {}|undefined + ]>; + getVPCSCConfig( + request: protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|null|undefined, + {}|null|undefined>): void; + getVPCSCConfig( + request: protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|null|undefined, + {}|null|undefined>): void; + getVPCSCConfig( + request?: protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getVpcscConfig(request, options, callback); + } +/** + * Updates the VPCSC Config for the Project. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.artifactregistry.v1.VPCSCConfig} request.vpcscConfig + * The project config. + * @param {google.protobuf.FieldMask} request.updateMask + * Field mask to support partial updates. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.VPCSCConfig|VPCSCConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.update_v_p_c_s_c_config.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_UpdateVPCSCConfig_async + */ + updateVPCSCConfig( + request?: protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|undefined, {}|undefined + ]>; + updateVPCSCConfig( + request: protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|null|undefined, + {}|null|undefined>): void; + updateVPCSCConfig( + request: protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|null|undefined, + {}|null|undefined>): void; + updateVPCSCConfig( + request?: protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IVPCSCConfig, + protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'vpcsc_config.name': request.vpcscConfig!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateVpcscConfig(request, options, callback); + } + +/** + * Imports Apt artifacts. The returned Operation will complete once the + * resources are imported. Package, Version, and File resources are created + * based on the imported artifacts. Imported artifacts that conflict with + * existing resources are ignored. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.artifactregistry.v1.ImportAptArtifactsGcsSource} request.gcsSource + * Google Cloud Storage location where input content is located. + * @param {string} request.parent + * The name of the parent resource where the artifacts will be imported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.import_apt_artifacts.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async + */ + importAptArtifacts( + request?: protos.google.devtools.artifactregistry.v1.IImportAptArtifactsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + importAptArtifacts( + request: protos.google.devtools.artifactregistry.v1.IImportAptArtifactsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importAptArtifacts( + request: protos.google.devtools.artifactregistry.v1.IImportAptArtifactsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importAptArtifacts( + request?: protos.google.devtools.artifactregistry.v1.IImportAptArtifactsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.importAptArtifacts(request, options, callback); + } +/** + * Check the status of the long running operation returned by `importAptArtifacts()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.import_apt_artifacts.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async + */ + async checkImportAptArtifactsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importAptArtifacts, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Imports Yum (RPM) artifacts. The returned Operation will complete once the + * resources are imported. Package, Version, and File resources are created + * based on the imported artifacts. Imported artifacts that conflict with + * existing resources are ignored. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.artifactregistry.v1.ImportYumArtifactsGcsSource} request.gcsSource + * Google Cloud Storage location where input content is located. + * @param {string} request.parent + * The name of the parent resource where the artifacts will be imported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.import_yum_artifacts.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async + */ + importYumArtifacts( + request?: protos.google.devtools.artifactregistry.v1.IImportYumArtifactsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + importYumArtifacts( + request: protos.google.devtools.artifactregistry.v1.IImportYumArtifactsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importYumArtifacts( + request: protos.google.devtools.artifactregistry.v1.IImportYumArtifactsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importYumArtifacts( + request?: protos.google.devtools.artifactregistry.v1.IImportYumArtifactsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.importYumArtifacts(request, options, callback); + } +/** + * Check the status of the long running operation returned by `importYumArtifacts()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.import_yum_artifacts.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async + */ + async checkImportYumArtifactsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importYumArtifacts, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a repository. The returned Operation will finish once the + * repository has been created. Its response will be the created Repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource where the repository will be created. + * @param {string} request.repositoryId + * The repository id to use for this repository. + * @param {google.devtools.artifactregistry.v1.Repository} request.repository + * The repository 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/artifact_registry.create_repository.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async + */ + createRepository( + request?: protos.google.devtools.artifactregistry.v1.ICreateRepositoryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createRepository( + request: protos.google.devtools.artifactregistry.v1.ICreateRepositoryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRepository( + request: protos.google.devtools.artifactregistry.v1.ICreateRepositoryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRepository( + request?: protos.google.devtools.artifactregistry.v1.ICreateRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createRepository(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createRepository()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.create_repository.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async + */ + async checkCreateRepositoryProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRepository, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a repository and all of its contents. The returned Operation will + * finish once the repository has been deleted. It will not have any Operation + * metadata and will return a google.protobuf.Empty response. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the repository to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.delete_repository.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async + */ + deleteRepository( + request?: protos.google.devtools.artifactregistry.v1.IDeleteRepositoryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteRepository( + request: protos.google.devtools.artifactregistry.v1.IDeleteRepositoryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRepository( + request: protos.google.devtools.artifactregistry.v1.IDeleteRepositoryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRepository( + request?: protos.google.devtools.artifactregistry.v1.IDeleteRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteRepository(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteRepository()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.delete_repository.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async + */ + async checkDeleteRepositoryProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRepository, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a package and all of its versions and tags. The returned operation + * will complete once the package has been deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the package to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.delete_package.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async + */ + deletePackage( + request?: protos.google.devtools.artifactregistry.v1.IDeletePackageRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deletePackage( + request: protos.google.devtools.artifactregistry.v1.IDeletePackageRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePackage( + request: protos.google.devtools.artifactregistry.v1.IDeletePackageRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePackage( + request?: protos.google.devtools.artifactregistry.v1.IDeletePackageRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deletePackage(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deletePackage()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.delete_package.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async + */ + async checkDeletePackageProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePackage, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a version and all of its content. The returned operation will + * complete once the version has been deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the version to delete. + * @param {boolean} request.force + * By default, a version that is tagged may not be deleted. If force=true, the + * version and any tags pointing to the version are 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/artifact_registry.delete_version.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async + */ + deleteVersion( + request?: protos.google.devtools.artifactregistry.v1.IDeleteVersionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteVersion( + request: protos.google.devtools.artifactregistry.v1.IDeleteVersionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteVersion( + request: protos.google.devtools.artifactregistry.v1.IDeleteVersionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteVersion( + request?: protos.google.devtools.artifactregistry.v1.IDeleteVersionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteVersion(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteVersion()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/artifact_registry.delete_version.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async + */ + async checkDeleteVersionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteVersion, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists docker images. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource whose docker images will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {string} request.orderBy + * The field to order the results by. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.artifactregistry.v1.DockerImage|DockerImage}. + * 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 `listDockerImagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDockerImages( + request?: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IDockerImage[], + protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest|null, + protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse + ]>; + listDockerImages( + request: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, + protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IDockerImage>): void; + listDockerImages( + request: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, + protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IDockerImage>): void; + listDockerImages( + request?: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, + protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IDockerImage>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, + protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IDockerImage>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IDockerImage[], + protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest|null, + protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listDockerImages(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 name of the parent resource whose docker images will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {string} request.orderBy + * The field to order the results by. + * @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.devtools.artifactregistry.v1.DockerImage|DockerImage} 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 `listDockerImagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDockerImagesStream( + request?: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, + 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['listDockerImages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDockerImages.createStream( + this.innerApiCalls.listDockerImages as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDockerImages`, 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 name of the parent resource whose docker images will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {string} request.orderBy + * The field to order the results by. + * @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.devtools.artifactregistry.v1.DockerImage|DockerImage}. 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/artifact_registry.list_docker_images.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_async + */ + listDockerImagesAsync( + request?: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, + 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['listDockerImages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDockerImages.asyncIterate( + this.innerApiCalls['listDockerImages'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists maven artifacts. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource whose maven artifacts will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.MavenArtifact|MavenArtifact}. + * 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 `listMavenArtifactsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMavenArtifacts( + request?: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IMavenArtifact[], + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest|null, + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse + ]>; + listMavenArtifacts( + request: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IMavenArtifact>): void; + listMavenArtifacts( + request: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IMavenArtifact>): void; + listMavenArtifacts( + request?: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IMavenArtifact>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IMavenArtifact>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IMavenArtifact[], + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest|null, + protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listMavenArtifacts(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 name of the parent resource whose maven artifacts will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.MavenArtifact|MavenArtifact} 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 `listMavenArtifactsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMavenArtifactsStream( + request?: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, + 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['listMavenArtifacts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMavenArtifacts.createStream( + this.innerApiCalls.listMavenArtifacts as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMavenArtifacts`, 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 name of the parent resource whose maven artifacts will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.MavenArtifact|MavenArtifact}. 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/artifact_registry.list_maven_artifacts.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListMavenArtifacts_async + */ + listMavenArtifactsAsync( + request?: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, + 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['listMavenArtifacts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMavenArtifacts.asyncIterate( + this.innerApiCalls['listMavenArtifacts'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists npm packages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource whose npm packages will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.NpmPackage|NpmPackage}. + * 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 `listNpmPackagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNpmPackages( + request?: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.INpmPackage[], + protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest|null, + protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse + ]>; + listNpmPackages( + request: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.INpmPackage>): void; + listNpmPackages( + request: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.INpmPackage>): void; + listNpmPackages( + request?: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.INpmPackage>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.INpmPackage>): + Promise<[ + protos.google.devtools.artifactregistry.v1.INpmPackage[], + protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest|null, + protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listNpmPackages(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 name of the parent resource whose npm packages will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.NpmPackage|NpmPackage} 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 `listNpmPackagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNpmPackagesStream( + request?: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, + 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['listNpmPackages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNpmPackages.createStream( + this.innerApiCalls.listNpmPackages as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNpmPackages`, 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 name of the parent resource whose npm packages will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.NpmPackage|NpmPackage}. 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/artifact_registry.list_npm_packages.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListNpmPackages_async + */ + listNpmPackagesAsync( + request?: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, + 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['listNpmPackages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNpmPackages.asyncIterate( + this.innerApiCalls['listNpmPackages'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists python packages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource whose python packages will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.PythonPackage|PythonPackage}. + * 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 `listPythonPackagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPythonPackages( + request?: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IPythonPackage[], + protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest|null, + protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse + ]>; + listPythonPackages( + request: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IPythonPackage>): void; + listPythonPackages( + request: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IPythonPackage>): void; + listPythonPackages( + request?: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IPythonPackage>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IPythonPackage>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IPythonPackage[], + protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest|null, + protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listPythonPackages(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 name of the parent resource whose python packages will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.PythonPackage|PythonPackage} 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 `listPythonPackagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPythonPackagesStream( + request?: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, + 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['listPythonPackages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPythonPackages.createStream( + this.innerApiCalls.listPythonPackages as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listPythonPackages`, 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 name of the parent resource whose python packages will be + * listed. + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.PythonPackage|PythonPackage}. 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/artifact_registry.list_python_packages.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListPythonPackages_async + */ + listPythonPackagesAsync( + request?: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, + 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['listPythonPackages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPythonPackages.asyncIterate( + this.innerApiCalls['listPythonPackages'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists repositories. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource whose repositories will be listed. + * @param {number} request.pageSize + * The maximum number of repositories to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Repository|Repository}. + * 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 `listRepositoriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRepositories( + request?: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IRepository[], + protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest|null, + protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse + ]>; + listRepositories( + request: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, + protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IRepository>): void; + listRepositories( + request: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, + protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IRepository>): void; + listRepositories( + request?: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, + protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IRepository>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, + protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IRepository>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IRepository[], + protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest|null, + protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listRepositories(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 name of the parent resource whose repositories will be listed. + * @param {number} request.pageSize + * The maximum number of repositories to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Repository|Repository} 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 `listRepositoriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRepositoriesStream( + request?: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, + 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['listRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRepositories.createStream( + this.innerApiCalls.listRepositories as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listRepositories`, 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 name of the parent resource whose repositories will be listed. + * @param {number} request.pageSize + * The maximum number of repositories to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Repository|Repository}. 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/artifact_registry.list_repositories.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_async + */ + listRepositoriesAsync( + request?: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, + 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['listRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRepositories.asyncIterate( + this.innerApiCalls['listRepositories'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists packages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource whose packages will be listed. + * @param {number} request.pageSize + * The maximum number of packages to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Package|Package}. + * 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 `listPackagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPackages( + request?: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IPackage[], + protos.google.devtools.artifactregistry.v1.IListPackagesRequest|null, + protos.google.devtools.artifactregistry.v1.IListPackagesResponse + ]>; + listPackages( + request: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IPackage>): void; + listPackages( + request: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IPackage>): void; + listPackages( + request?: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IPackage>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListPackagesRequest, + protos.google.devtools.artifactregistry.v1.IListPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IPackage>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IPackage[], + protos.google.devtools.artifactregistry.v1.IListPackagesRequest|null, + protos.google.devtools.artifactregistry.v1.IListPackagesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listPackages(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 name of the parent resource whose packages will be listed. + * @param {number} request.pageSize + * The maximum number of packages to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Package|Package} 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 `listPackagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPackagesStream( + request?: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, + 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['listPackages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPackages.createStream( + this.innerApiCalls.listPackages as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listPackages`, 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 name of the parent resource whose packages will be listed. + * @param {number} request.pageSize + * The maximum number of packages to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Package|Package}. 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/artifact_registry.list_packages.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListPackages_async + */ + listPackagesAsync( + request?: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, + 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['listPackages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPackages.asyncIterate( + this.innerApiCalls['listPackages'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists versions. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the parent resource whose versions will be listed. + * @param {number} request.pageSize + * The maximum number of versions to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {google.devtools.artifactregistry.v1.VersionView} request.view + * The view that should be returned in the response. + * @param {string} [request.orderBy] + * Optional. The field to order the results by. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.artifactregistry.v1.Version|Version}. + * 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 `listVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVersions( + request?: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IVersion[], + protos.google.devtools.artifactregistry.v1.IListVersionsRequest|null, + protos.google.devtools.artifactregistry.v1.IListVersionsResponse + ]>; + listVersions( + request: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListVersionsRequest, + protos.google.devtools.artifactregistry.v1.IListVersionsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IVersion>): void; + listVersions( + request: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListVersionsRequest, + protos.google.devtools.artifactregistry.v1.IListVersionsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IVersion>): void; + listVersions( + request?: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListVersionsRequest, + protos.google.devtools.artifactregistry.v1.IListVersionsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IVersion>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListVersionsRequest, + protos.google.devtools.artifactregistry.v1.IListVersionsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IVersion>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IVersion[], + protos.google.devtools.artifactregistry.v1.IListVersionsRequest|null, + protos.google.devtools.artifactregistry.v1.IListVersionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listVersions(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 name of the parent resource whose versions will be listed. + * @param {number} request.pageSize + * The maximum number of versions to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {google.devtools.artifactregistry.v1.VersionView} request.view + * The view that should be returned in the response. + * @param {string} [request.orderBy] + * Optional. The field to order the results by. + * @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.devtools.artifactregistry.v1.Version|Version} 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 `listVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVersionsStream( + request?: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, + 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['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.createStream( + this.innerApiCalls.listVersions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listVersions`, 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 name of the parent resource whose versions will be listed. + * @param {number} request.pageSize + * The maximum number of versions to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {google.devtools.artifactregistry.v1.VersionView} request.view + * The view that should be returned in the response. + * @param {string} [request.orderBy] + * Optional. The field to order the results by. + * @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.devtools.artifactregistry.v1.Version|Version}. 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/artifact_registry.list_versions.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListVersions_async + */ + listVersionsAsync( + request?: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, + 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['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.asyncIterate( + this.innerApiCalls['listVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists files. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the repository whose files will be listed. For + * example: "projects/p1/locations/us-central1/repositories/repo1 + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `name` + * * `owner` + * + * An example of using a filter: + * + * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an + * ID starting with "a/b/". + * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> + * Files owned by the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of files to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {string} request.orderBy + * The field to order the results by. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.artifactregistry.v1.File|File}. + * 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 `listFilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFiles( + request?: protos.google.devtools.artifactregistry.v1.IListFilesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.IFile[], + protos.google.devtools.artifactregistry.v1.IListFilesRequest|null, + protos.google.devtools.artifactregistry.v1.IListFilesResponse + ]>; + listFiles( + request: protos.google.devtools.artifactregistry.v1.IListFilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListFilesRequest, + protos.google.devtools.artifactregistry.v1.IListFilesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IFile>): void; + listFiles( + request: protos.google.devtools.artifactregistry.v1.IListFilesRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListFilesRequest, + protos.google.devtools.artifactregistry.v1.IListFilesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IFile>): void; + listFiles( + request?: protos.google.devtools.artifactregistry.v1.IListFilesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListFilesRequest, + protos.google.devtools.artifactregistry.v1.IListFilesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IFile>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListFilesRequest, + protos.google.devtools.artifactregistry.v1.IListFilesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.IFile>): + Promise<[ + protos.google.devtools.artifactregistry.v1.IFile[], + protos.google.devtools.artifactregistry.v1.IListFilesRequest|null, + protos.google.devtools.artifactregistry.v1.IListFilesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFiles(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 name of the repository whose files will be listed. For + * example: "projects/p1/locations/us-central1/repositories/repo1 + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `name` + * * `owner` + * + * An example of using a filter: + * + * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an + * ID starting with "a/b/". + * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> + * Files owned by the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of files to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {string} request.orderBy + * The field to order the results by. + * @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.devtools.artifactregistry.v1.File|File} 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 `listFilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFilesStream( + request?: protos.google.devtools.artifactregistry.v1.IListFilesRequest, + 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['listFiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFiles.createStream( + this.innerApiCalls.listFiles as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFiles`, 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 name of the repository whose files will be listed. For + * example: "projects/p1/locations/us-central1/repositories/repo1 + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `name` + * * `owner` + * + * An example of using a filter: + * + * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an + * ID starting with "a/b/". + * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> + * Files owned by the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of files to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {string} request.orderBy + * The field to order the results by. + * @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.devtools.artifactregistry.v1.File|File}. 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/artifact_registry.list_files.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListFiles_async + */ + listFilesAsync( + request?: protos.google.devtools.artifactregistry.v1.IListFilesRequest, + 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['listFiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFiles.asyncIterate( + this.innerApiCalls['listFiles'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists tags. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the parent resource whose tags will be listed. + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `version` + * + * An example of using a filter: + * + * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` + * --> Tags that are applied to the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of tags to return. Maximum page size is 10,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Tag|Tag}. + * 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 `listTagsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listTags( + request?: protos.google.devtools.artifactregistry.v1.IListTagsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1.ITag[], + protos.google.devtools.artifactregistry.v1.IListTagsRequest|null, + protos.google.devtools.artifactregistry.v1.IListTagsResponse + ]>; + listTags( + request: protos.google.devtools.artifactregistry.v1.IListTagsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListTagsRequest, + protos.google.devtools.artifactregistry.v1.IListTagsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.ITag>): void; + listTags( + request: protos.google.devtools.artifactregistry.v1.IListTagsRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListTagsRequest, + protos.google.devtools.artifactregistry.v1.IListTagsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.ITag>): void; + listTags( + request?: protos.google.devtools.artifactregistry.v1.IListTagsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListTagsRequest, + protos.google.devtools.artifactregistry.v1.IListTagsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.ITag>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1.IListTagsRequest, + protos.google.devtools.artifactregistry.v1.IListTagsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1.ITag>): + Promise<[ + protos.google.devtools.artifactregistry.v1.ITag[], + protos.google.devtools.artifactregistry.v1.IListTagsRequest|null, + protos.google.devtools.artifactregistry.v1.IListTagsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listTags(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 name of the parent resource whose tags will be listed. + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `version` + * + * An example of using a filter: + * + * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` + * --> Tags that are applied to the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of tags to return. Maximum page size is 10,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Tag|Tag} 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 `listTagsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listTagsStream( + request?: protos.google.devtools.artifactregistry.v1.IListTagsRequest, + 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['listTags']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTags.createStream( + this.innerApiCalls.listTags as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listTags`, 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 name of the parent resource whose tags will be listed. + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `version` + * + * An example of using a filter: + * + * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` + * --> Tags that are applied to the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of tags to return. Maximum page size is 10,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Tag|Tag}. 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/artifact_registry.list_tags.js + * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListTags_async + */ + listTagsAsync( + request?: protos.google.devtools.artifactregistry.v1.IListTagsRequest, + 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['listTags']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTags.asyncIterate( + this.innerApiCalls['listTags'] 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 aptArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} apt_artifact + * @returns {string} Resource name string. + */ + aptArtifactPath(project:string,location:string,repository:string,aptArtifact:string) { + return this.pathTemplates.aptArtifactPathTemplate.render({ + project: project, + location: location, + repository: repository, + apt_artifact: aptArtifact, + }); + } + + /** + * Parse the project from AptArtifact resource. + * + * @param {string} aptArtifactName + * A fully-qualified path representing AptArtifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAptArtifactName(aptArtifactName: string) { + return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).project; + } + + /** + * Parse the location from AptArtifact resource. + * + * @param {string} aptArtifactName + * A fully-qualified path representing AptArtifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAptArtifactName(aptArtifactName: string) { + return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).location; + } + + /** + * Parse the repository from AptArtifact resource. + * + * @param {string} aptArtifactName + * A fully-qualified path representing AptArtifact resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromAptArtifactName(aptArtifactName: string) { + return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).repository; + } + + /** + * Parse the apt_artifact from AptArtifact resource. + * + * @param {string} aptArtifactName + * A fully-qualified path representing AptArtifact resource. + * @returns {string} A string representing the apt_artifact. + */ + matchAptArtifactFromAptArtifactName(aptArtifactName: string) { + return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).apt_artifact; + } + + /** + * Return a fully-qualified dockerImage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} docker_image + * @returns {string} Resource name string. + */ + dockerImagePath(project:string,location:string,repository:string,dockerImage:string) { + return this.pathTemplates.dockerImagePathTemplate.render({ + project: project, + location: location, + repository: repository, + docker_image: dockerImage, + }); + } + + /** + * Parse the project from DockerImage resource. + * + * @param {string} dockerImageName + * A fully-qualified path representing DockerImage resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDockerImageName(dockerImageName: string) { + return this.pathTemplates.dockerImagePathTemplate.match(dockerImageName).project; + } + + /** + * Parse the location from DockerImage resource. + * + * @param {string} dockerImageName + * A fully-qualified path representing DockerImage resource. + * @returns {string} A string representing the location. + */ + matchLocationFromDockerImageName(dockerImageName: string) { + return this.pathTemplates.dockerImagePathTemplate.match(dockerImageName).location; + } + + /** + * Parse the repository from DockerImage resource. + * + * @param {string} dockerImageName + * A fully-qualified path representing DockerImage resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromDockerImageName(dockerImageName: string) { + return this.pathTemplates.dockerImagePathTemplate.match(dockerImageName).repository; + } + + /** + * Parse the docker_image from DockerImage resource. + * + * @param {string} dockerImageName + * A fully-qualified path representing DockerImage resource. + * @returns {string} A string representing the docker_image. + */ + matchDockerImageFromDockerImageName(dockerImageName: string) { + return this.pathTemplates.dockerImagePathTemplate.match(dockerImageName).docker_image; + } + + /** + * Return a fully-qualified file resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} file + * @returns {string} Resource name string. + */ + filePath(project:string,location:string,repository:string,file:string) { + return this.pathTemplates.filePathTemplate.render({ + project: project, + location: location, + repository: repository, + file: file, + }); + } + + /** + * Parse the project from File resource. + * + * @param {string} fileName + * A fully-qualified path representing File resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFileName(fileName: string) { + return this.pathTemplates.filePathTemplate.match(fileName).project; + } + + /** + * Parse the location from File resource. + * + * @param {string} fileName + * A fully-qualified path representing File resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFileName(fileName: string) { + return this.pathTemplates.filePathTemplate.match(fileName).location; + } + + /** + * Parse the repository from File resource. + * + * @param {string} fileName + * A fully-qualified path representing File resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromFileName(fileName: string) { + return this.pathTemplates.filePathTemplate.match(fileName).repository; + } + + /** + * Parse the file from File resource. + * + * @param {string} fileName + * A fully-qualified path representing File resource. + * @returns {string} A string representing the file. + */ + matchFileFromFileName(fileName: string) { + return this.pathTemplates.filePathTemplate.match(fileName).file; + } + + /** + * Return a fully-qualified mavenArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} maven_artifact + * @returns {string} Resource name string. + */ + mavenArtifactPath(project:string,location:string,repository:string,mavenArtifact:string) { + return this.pathTemplates.mavenArtifactPathTemplate.render({ + project: project, + location: location, + repository: repository, + maven_artifact: mavenArtifact, + }); + } + + /** + * Parse the project from MavenArtifact resource. + * + * @param {string} mavenArtifactName + * A fully-qualified path representing MavenArtifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMavenArtifactName(mavenArtifactName: string) { + return this.pathTemplates.mavenArtifactPathTemplate.match(mavenArtifactName).project; + } + + /** + * Parse the location from MavenArtifact resource. + * + * @param {string} mavenArtifactName + * A fully-qualified path representing MavenArtifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMavenArtifactName(mavenArtifactName: string) { + return this.pathTemplates.mavenArtifactPathTemplate.match(mavenArtifactName).location; + } + + /** + * Parse the repository from MavenArtifact resource. + * + * @param {string} mavenArtifactName + * A fully-qualified path representing MavenArtifact resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromMavenArtifactName(mavenArtifactName: string) { + return this.pathTemplates.mavenArtifactPathTemplate.match(mavenArtifactName).repository; + } + + /** + * Parse the maven_artifact from MavenArtifact resource. + * + * @param {string} mavenArtifactName + * A fully-qualified path representing MavenArtifact resource. + * @returns {string} A string representing the maven_artifact. + */ + matchMavenArtifactFromMavenArtifactName(mavenArtifactName: string) { + return this.pathTemplates.mavenArtifactPathTemplate.match(mavenArtifactName).maven_artifact; + } + + /** + * Return a fully-qualified npmPackage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} npm_package + * @returns {string} Resource name string. + */ + npmPackagePath(project:string,location:string,repository:string,npmPackage:string) { + return this.pathTemplates.npmPackagePathTemplate.render({ + project: project, + location: location, + repository: repository, + npm_package: npmPackage, + }); + } + + /** + * Parse the project from NpmPackage resource. + * + * @param {string} npmPackageName + * A fully-qualified path representing NpmPackage resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNpmPackageName(npmPackageName: string) { + return this.pathTemplates.npmPackagePathTemplate.match(npmPackageName).project; + } + + /** + * Parse the location from NpmPackage resource. + * + * @param {string} npmPackageName + * A fully-qualified path representing NpmPackage resource. + * @returns {string} A string representing the location. + */ + matchLocationFromNpmPackageName(npmPackageName: string) { + return this.pathTemplates.npmPackagePathTemplate.match(npmPackageName).location; + } + + /** + * Parse the repository from NpmPackage resource. + * + * @param {string} npmPackageName + * A fully-qualified path representing NpmPackage resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromNpmPackageName(npmPackageName: string) { + return this.pathTemplates.npmPackagePathTemplate.match(npmPackageName).repository; + } + + /** + * Parse the npm_package from NpmPackage resource. + * + * @param {string} npmPackageName + * A fully-qualified path representing NpmPackage resource. + * @returns {string} A string representing the npm_package. + */ + matchNpmPackageFromNpmPackageName(npmPackageName: string) { + return this.pathTemplates.npmPackagePathTemplate.match(npmPackageName).npm_package; + } + + /** + * Return a fully-qualified package resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} packageParam + * @returns {string} Resource name string. + */ + packagePath(project:string,location:string,repository:string,packageParam:string) { + return this.pathTemplates.packagePathTemplate.render({ + project: project, + location: location, + repository: repository, + package: packageParam, + }); + } + + /** + * Parse the project from Package resource. + * + * @param {string} packageName + * A fully-qualified path representing Package resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPackageName(packageName: string) { + return this.pathTemplates.packagePathTemplate.match(packageName).project; + } + + /** + * Parse the location from Package resource. + * + * @param {string} packageName + * A fully-qualified path representing Package resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPackageName(packageName: string) { + return this.pathTemplates.packagePathTemplate.match(packageName).location; + } + + /** + * Parse the repository from Package resource. + * + * @param {string} packageName + * A fully-qualified path representing Package resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromPackageName(packageName: string) { + return this.pathTemplates.packagePathTemplate.match(packageName).repository; + } + + /** + * Parse the package from Package resource. + * + * @param {string} packageName + * A fully-qualified path representing Package resource. + * @returns {string} A string representing the package. + */ + matchPackageFromPackageName(packageName: string) { + return this.pathTemplates.packagePathTemplate.match(packageName).package; + } + + /** + * Return a fully-qualified projectSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectSettingsPath(project:string) { + return this.pathTemplates.projectSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectSettings resource. + * + * @param {string} projectSettingsName + * A fully-qualified path representing ProjectSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSettingsName(projectSettingsName: string) { + return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; + } + + /** + * Return a fully-qualified pythonPackage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} python_package + * @returns {string} Resource name string. + */ + pythonPackagePath(project:string,location:string,repository:string,pythonPackage:string) { + return this.pathTemplates.pythonPackagePathTemplate.render({ + project: project, + location: location, + repository: repository, + python_package: pythonPackage, + }); + } + + /** + * Parse the project from PythonPackage resource. + * + * @param {string} pythonPackageName + * A fully-qualified path representing PythonPackage resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPythonPackageName(pythonPackageName: string) { + return this.pathTemplates.pythonPackagePathTemplate.match(pythonPackageName).project; + } + + /** + * Parse the location from PythonPackage resource. + * + * @param {string} pythonPackageName + * A fully-qualified path representing PythonPackage resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPythonPackageName(pythonPackageName: string) { + return this.pathTemplates.pythonPackagePathTemplate.match(pythonPackageName).location; + } + + /** + * Parse the repository from PythonPackage resource. + * + * @param {string} pythonPackageName + * A fully-qualified path representing PythonPackage resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromPythonPackageName(pythonPackageName: string) { + return this.pathTemplates.pythonPackagePathTemplate.match(pythonPackageName).repository; + } + + /** + * Parse the python_package from PythonPackage resource. + * + * @param {string} pythonPackageName + * A fully-qualified path representing PythonPackage resource. + * @returns {string} A string representing the python_package. + */ + matchPythonPackageFromPythonPackageName(pythonPackageName: string) { + return this.pathTemplates.pythonPackagePathTemplate.match(pythonPackageName).python_package; + } + + /** + * 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 tag resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} packageParam + * @param {string} tag + * @returns {string} Resource name string. + */ + tagPath(project:string,location:string,repository:string,packageParam:string,tag:string) { + return this.pathTemplates.tagPathTemplate.render({ + project: project, + location: location, + repository: repository, + package: packageParam, + tag: tag, + }); + } + + /** + * Parse the project from Tag resource. + * + * @param {string} tagName + * A fully-qualified path representing Tag resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTagName(tagName: string) { + return this.pathTemplates.tagPathTemplate.match(tagName).project; + } + + /** + * Parse the location from Tag resource. + * + * @param {string} tagName + * A fully-qualified path representing Tag resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTagName(tagName: string) { + return this.pathTemplates.tagPathTemplate.match(tagName).location; + } + + /** + * Parse the repository from Tag resource. + * + * @param {string} tagName + * A fully-qualified path representing Tag resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromTagName(tagName: string) { + return this.pathTemplates.tagPathTemplate.match(tagName).repository; + } + + /** + * Parse the package from Tag resource. + * + * @param {string} tagName + * A fully-qualified path representing Tag resource. + * @returns {string} A string representing the package. + */ + matchPackageFromTagName(tagName: string) { + return this.pathTemplates.tagPathTemplate.match(tagName).package; + } + + /** + * Parse the tag from Tag resource. + * + * @param {string} tagName + * A fully-qualified path representing Tag resource. + * @returns {string} A string representing the tag. + */ + matchTagFromTagName(tagName: string) { + return this.pathTemplates.tagPathTemplate.match(tagName).tag; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} packageParam + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath(project:string,location:string,repository:string,packageParam:string,version:string) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + repository: repository, + package: packageParam, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the repository from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).repository; + } + + /** + * Parse the package from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the package. + */ + matchPackageFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).package; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified vpcscConfig resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + vpcscConfigPath(project:string,location:string) { + return this.pathTemplates.vpcscConfigPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from VpcscConfig resource. + * + * @param {string} vpcscConfigName + * A fully-qualified path representing VpcscConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVpcscConfigName(vpcscConfigName: string) { + return this.pathTemplates.vpcscConfigPathTemplate.match(vpcscConfigName).project; + } + + /** + * Parse the location from VpcscConfig resource. + * + * @param {string} vpcscConfigName + * A fully-qualified path representing VpcscConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVpcscConfigName(vpcscConfigName: string) { + return this.pathTemplates.vpcscConfigPathTemplate.match(vpcscConfigName).location; + } + + /** + * Return a fully-qualified yumArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} yum_artifact + * @returns {string} Resource name string. + */ + yumArtifactPath(project:string,location:string,repository:string,yumArtifact:string) { + return this.pathTemplates.yumArtifactPathTemplate.render({ + project: project, + location: location, + repository: repository, + yum_artifact: yumArtifact, + }); + } + + /** + * Parse the project from YumArtifact resource. + * + * @param {string} yumArtifactName + * A fully-qualified path representing YumArtifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromYumArtifactName(yumArtifactName: string) { + return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).project; + } + + /** + * Parse the location from YumArtifact resource. + * + * @param {string} yumArtifactName + * A fully-qualified path representing YumArtifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromYumArtifactName(yumArtifactName: string) { + return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).location; + } + + /** + * Parse the repository from YumArtifact resource. + * + * @param {string} yumArtifactName + * A fully-qualified path representing YumArtifact resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromYumArtifactName(yumArtifactName: string) { + return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).repository; + } + + /** + * Parse the yum_artifact from YumArtifact resource. + * + * @param {string} yumArtifactName + * A fully-qualified path representing YumArtifact resource. + * @returns {string} A string representing the yum_artifact. + */ + matchYumArtifactFromYumArtifactName(yumArtifactName: string) { + return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).yum_artifact; + } + + /** + * 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.artifactRegistryStub && !this._terminated) { + return this.artifactRegistryStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client_config.json b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client_config.json new file mode 100644 index 00000000000..c37497cdfbe --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client_config.json @@ -0,0 +1,201 @@ +{ + "interfaces": { + "google.devtools.artifactregistry.v1.ArtifactRegistry": { + "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": { + "ListDockerImages": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDockerImage": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListMavenArtifacts": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetMavenArtifact": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListNpmPackages": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetNpmPackage": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListPythonPackages": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetPythonPackage": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ImportAptArtifacts": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ImportYumArtifacts": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRepositories": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetRepository": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateRepository": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateRepository": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteRepository": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListPackages": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetPackage": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeletePackage": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListVersions": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListFiles": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetFile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListTags": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetTag": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateTag": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateTag": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteTag": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "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" + }, + "GetProjectSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateProjectSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetVPCSCConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateVPCSCConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_proto_list.json b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_proto_list.json new file mode 100644 index 00000000000..9d786848a4a --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_proto_list.json @@ -0,0 +1,13 @@ +[ + "../../protos/google/devtools/artifactregistry/v1/apt_artifact.proto", + "../../protos/google/devtools/artifactregistry/v1/artifact.proto", + "../../protos/google/devtools/artifactregistry/v1/file.proto", + "../../protos/google/devtools/artifactregistry/v1/package.proto", + "../../protos/google/devtools/artifactregistry/v1/repository.proto", + "../../protos/google/devtools/artifactregistry/v1/service.proto", + "../../protos/google/devtools/artifactregistry/v1/settings.proto", + "../../protos/google/devtools/artifactregistry/v1/tag.proto", + "../../protos/google/devtools/artifactregistry/v1/version.proto", + "../../protos/google/devtools/artifactregistry/v1/vpcsc_config.proto", + "../../protos/google/devtools/artifactregistry/v1/yum_artifact.proto" +] diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..e4b40dec5c2 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/gapic_metadata.json @@ -0,0 +1,409 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.devtools.artifactregistry.v1", + "libraryPackage": "@google-cloud/artifact-registry", + "services": { + "ArtifactRegistry": { + "clients": { + "grpc": { + "libraryClient": "ArtifactRegistryClient", + "rpcs": { + "GetDockerImage": { + "methods": [ + "getDockerImage" + ] + }, + "GetMavenArtifact": { + "methods": [ + "getMavenArtifact" + ] + }, + "GetNpmPackage": { + "methods": [ + "getNpmPackage" + ] + }, + "GetPythonPackage": { + "methods": [ + "getPythonPackage" + ] + }, + "GetRepository": { + "methods": [ + "getRepository" + ] + }, + "UpdateRepository": { + "methods": [ + "updateRepository" + ] + }, + "GetPackage": { + "methods": [ + "getPackage" + ] + }, + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "GetFile": { + "methods": [ + "getFile" + ] + }, + "GetTag": { + "methods": [ + "getTag" + ] + }, + "CreateTag": { + "methods": [ + "createTag" + ] + }, + "UpdateTag": { + "methods": [ + "updateTag" + ] + }, + "DeleteTag": { + "methods": [ + "deleteTag" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "GetProjectSettings": { + "methods": [ + "getProjectSettings" + ] + }, + "UpdateProjectSettings": { + "methods": [ + "updateProjectSettings" + ] + }, + "GetVPCSCConfig": { + "methods": [ + "getVPCSCConfig" + ] + }, + "UpdateVPCSCConfig": { + "methods": [ + "updateVPCSCConfig" + ] + }, + "ImportAptArtifacts": { + "methods": [ + "importAptArtifacts" + ] + }, + "ImportYumArtifacts": { + "methods": [ + "importYumArtifacts" + ] + }, + "CreateRepository": { + "methods": [ + "createRepository" + ] + }, + "DeleteRepository": { + "methods": [ + "deleteRepository" + ] + }, + "DeletePackage": { + "methods": [ + "deletePackage" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListDockerImages": { + "methods": [ + "listDockerImages", + "listDockerImagesStream", + "listDockerImagesAsync" + ] + }, + "ListMavenArtifacts": { + "methods": [ + "listMavenArtifacts", + "listMavenArtifactsStream", + "listMavenArtifactsAsync" + ] + }, + "ListNpmPackages": { + "methods": [ + "listNpmPackages", + "listNpmPackagesStream", + "listNpmPackagesAsync" + ] + }, + "ListPythonPackages": { + "methods": [ + "listPythonPackages", + "listPythonPackagesStream", + "listPythonPackagesAsync" + ] + }, + "ListRepositories": { + "methods": [ + "listRepositories", + "listRepositoriesStream", + "listRepositoriesAsync" + ] + }, + "ListPackages": { + "methods": [ + "listPackages", + "listPackagesStream", + "listPackagesAsync" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + }, + "ListFiles": { + "methods": [ + "listFiles", + "listFilesStream", + "listFilesAsync" + ] + }, + "ListTags": { + "methods": [ + "listTags", + "listTagsStream", + "listTagsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ArtifactRegistryClient", + "rpcs": { + "GetDockerImage": { + "methods": [ + "getDockerImage" + ] + }, + "GetMavenArtifact": { + "methods": [ + "getMavenArtifact" + ] + }, + "GetNpmPackage": { + "methods": [ + "getNpmPackage" + ] + }, + "GetPythonPackage": { + "methods": [ + "getPythonPackage" + ] + }, + "GetRepository": { + "methods": [ + "getRepository" + ] + }, + "UpdateRepository": { + "methods": [ + "updateRepository" + ] + }, + "GetPackage": { + "methods": [ + "getPackage" + ] + }, + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "GetFile": { + "methods": [ + "getFile" + ] + }, + "GetTag": { + "methods": [ + "getTag" + ] + }, + "CreateTag": { + "methods": [ + "createTag" + ] + }, + "UpdateTag": { + "methods": [ + "updateTag" + ] + }, + "DeleteTag": { + "methods": [ + "deleteTag" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "GetProjectSettings": { + "methods": [ + "getProjectSettings" + ] + }, + "UpdateProjectSettings": { + "methods": [ + "updateProjectSettings" + ] + }, + "GetVPCSCConfig": { + "methods": [ + "getVPCSCConfig" + ] + }, + "UpdateVPCSCConfig": { + "methods": [ + "updateVPCSCConfig" + ] + }, + "ImportAptArtifacts": { + "methods": [ + "importAptArtifacts" + ] + }, + "ImportYumArtifacts": { + "methods": [ + "importYumArtifacts" + ] + }, + "CreateRepository": { + "methods": [ + "createRepository" + ] + }, + "DeleteRepository": { + "methods": [ + "deleteRepository" + ] + }, + "DeletePackage": { + "methods": [ + "deletePackage" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListDockerImages": { + "methods": [ + "listDockerImages", + "listDockerImagesStream", + "listDockerImagesAsync" + ] + }, + "ListMavenArtifacts": { + "methods": [ + "listMavenArtifacts", + "listMavenArtifactsStream", + "listMavenArtifactsAsync" + ] + }, + "ListNpmPackages": { + "methods": [ + "listNpmPackages", + "listNpmPackagesStream", + "listNpmPackagesAsync" + ] + }, + "ListPythonPackages": { + "methods": [ + "listPythonPackages", + "listPythonPackagesStream", + "listPythonPackagesAsync" + ] + }, + "ListRepositories": { + "methods": [ + "listRepositories", + "listRepositoriesStream", + "listRepositoriesAsync" + ] + }, + "ListPackages": { + "methods": [ + "listPackages", + "listPackagesStream", + "listPackagesAsync" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + }, + "ListFiles": { + "methods": [ + "listFiles", + "listFilesStream", + "listFilesAsync" + ] + }, + "ListTags": { + "methods": [ + "listTags", + "listTagsStream", + "listTagsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/index.ts new file mode 100644 index 00000000000..2491b7166cd --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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 {ArtifactRegistryClient} from './artifact_registry_client'; diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..d87aa817a75 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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 artifactregistry = require('@google-cloud/artifact-registry'); + +function main() { + const artifactRegistryClient = new artifactregistry.ArtifactRegistryClient(); +} + +main(); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..e830f64db5a --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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 {ArtifactRegistryClient} from '@google-cloud/artifact-registry'; + +// check that the client class type name can be used +function doStuffWithArtifactRegistryClient(client: ArtifactRegistryClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const artifactRegistryClient = new ArtifactRegistryClient(); + doStuffWithArtifactRegistryClient(artifactRegistryClient); +} + +main(); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/install.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1/test/gapic_artifact_registry_v1.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/test/gapic_artifact_registry_v1.ts new file mode 100644 index 00000000000..b248668eeb1 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1/test/gapic_artifact_registry_v1.ts @@ -0,0 +1,6612 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 artifactregistryModule 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.ArtifactRegistryClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = artifactregistryModule.v1.ArtifactRegistryClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = artifactregistryModule.v1.ArtifactRegistryClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = artifactregistryModule.v1.ArtifactRegistryClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.artifactRegistryStub, undefined); + await client.initialize(); + assert(client.artifactRegistryStub); + }); + + it('has close method for the initialized client', done => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.artifactRegistryStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.artifactRegistryStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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('getDockerImage', () => { + it('invokes getDockerImage without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetDockerImageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetDockerImageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DockerImage() + ); + client.innerApiCalls.getDockerImage = stubSimpleCall(expectedResponse); + const [response] = await client.getDockerImage(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDockerImage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDockerImage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDockerImage without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetDockerImageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetDockerImageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DockerImage() + ); + client.innerApiCalls.getDockerImage = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDockerImage( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IDockerImage|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDockerImage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDockerImage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDockerImage with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetDockerImageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetDockerImageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDockerImage = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDockerImage(request), expectedError); + const actualRequest = (client.innerApiCalls.getDockerImage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDockerImage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDockerImage with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetDockerImageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetDockerImageRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDockerImage(request), expectedError); + }); + }); + + describe('getMavenArtifact', () => { + it('invokes getMavenArtifact without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetMavenArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetMavenArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.MavenArtifact() + ); + client.innerApiCalls.getMavenArtifact = stubSimpleCall(expectedResponse); + const [response] = await client.getMavenArtifact(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMavenArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMavenArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMavenArtifact without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetMavenArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetMavenArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.MavenArtifact() + ); + client.innerApiCalls.getMavenArtifact = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMavenArtifact( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IMavenArtifact|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMavenArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMavenArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMavenArtifact with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetMavenArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetMavenArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMavenArtifact = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMavenArtifact(request), expectedError); + const actualRequest = (client.innerApiCalls.getMavenArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMavenArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMavenArtifact with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetMavenArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetMavenArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMavenArtifact(request), expectedError); + }); + }); + + describe('getNpmPackage', () => { + it('invokes getNpmPackage without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetNpmPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetNpmPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.NpmPackage() + ); + client.innerApiCalls.getNpmPackage = stubSimpleCall(expectedResponse); + const [response] = await client.getNpmPackage(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNpmPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNpmPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNpmPackage without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetNpmPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetNpmPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.NpmPackage() + ); + client.innerApiCalls.getNpmPackage = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNpmPackage( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.INpmPackage|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNpmPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNpmPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNpmPackage with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetNpmPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetNpmPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNpmPackage = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNpmPackage(request), expectedError); + const actualRequest = (client.innerApiCalls.getNpmPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNpmPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNpmPackage with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetNpmPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetNpmPackageRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNpmPackage(request), expectedError); + }); + }); + + describe('getPythonPackage', () => { + it('invokes getPythonPackage without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetPythonPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPythonPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.PythonPackage() + ); + client.innerApiCalls.getPythonPackage = stubSimpleCall(expectedResponse); + const [response] = await client.getPythonPackage(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPythonPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPythonPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPythonPackage without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetPythonPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPythonPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.PythonPackage() + ); + client.innerApiCalls.getPythonPackage = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPythonPackage( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IPythonPackage|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPythonPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPythonPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPythonPackage with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetPythonPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPythonPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPythonPackage = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPythonPackage(request), expectedError); + const actualRequest = (client.innerApiCalls.getPythonPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPythonPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPythonPackage with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetPythonPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPythonPackageRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getPythonPackage(request), expectedError); + }); + }); + + describe('getRepository', () => { + it('invokes getRepository without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Repository() + ); + client.innerApiCalls.getRepository = stubSimpleCall(expectedResponse); + const [response] = await client.getRepository(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Repository() + ); + client.innerApiCalls.getRepository = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRepository( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IRepository|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRepository = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getRepository(request), expectedError); + }); + }); + + describe('updateRepository', () => { + it('invokes updateRepository without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateRepositoryRequest() + ); + request.repository ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateRepositoryRequest', ['repository', 'name']); + request.repository.name = defaultValue1; + const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Repository() + ); + client.innerApiCalls.updateRepository = stubSimpleCall(expectedResponse); + const [response] = await client.updateRepository(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRepository without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateRepositoryRequest() + ); + request.repository ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateRepositoryRequest', ['repository', 'name']); + request.repository.name = defaultValue1; + const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Repository() + ); + client.innerApiCalls.updateRepository = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateRepository( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IRepository|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRepository with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateRepositoryRequest() + ); + request.repository ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateRepositoryRequest', ['repository', 'name']); + request.repository.name = defaultValue1; + const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateRepository = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRepository with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateRepositoryRequest() + ); + request.repository ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateRepositoryRequest', ['repository', 'name']); + request.repository.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateRepository(request), expectedError); + }); + }); + + describe('getPackage', () => { + it('invokes getPackage without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Package() + ); + client.innerApiCalls.getPackage = stubSimpleCall(expectedResponse); + const [response] = await client.getPackage(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPackage without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Package() + ); + client.innerApiCalls.getPackage = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPackage( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IPackage|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPackage with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPackage = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPackage(request), expectedError); + const actualRequest = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPackage with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPackageRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getPackage(request), expectedError); + }); + }); + + describe('getVersion', () => { + it('invokes getVersion without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Version() + ); + client.innerApiCalls.getVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Version() + ); + client.innerApiCalls.getVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVersion( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVersion(request), expectedError); + }); + }); + + describe('getFile', () => { + it('invokes getFile without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.File() + ); + client.innerApiCalls.getFile = stubSimpleCall(expectedResponse); + const [response] = await client.getFile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFile without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.File() + ); + client.innerApiCalls.getFile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFile( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IFile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFile with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFile(request), expectedError); + const actualRequest = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFile with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetFileRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFile(request), expectedError); + }); + }); + + describe('getTag', () => { + it('invokes getTag without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Tag() + ); + client.innerApiCalls.getTag = stubSimpleCall(expectedResponse); + const [response] = await client.getTag(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTag without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Tag() + ); + client.innerApiCalls.getTag = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTag( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.ITag|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTag with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getTag = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTag(request), expectedError); + const actualRequest = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTag with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetTagRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getTag(request), expectedError); + }); + }); + + describe('createTag', () => { + it('invokes createTag without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.CreateTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateTagRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Tag() + ); + client.innerApiCalls.createTag = stubSimpleCall(expectedResponse); + const [response] = await client.createTag(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTag without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.CreateTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateTagRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Tag() + ); + client.innerApiCalls.createTag = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTag( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.ITag|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTag with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.CreateTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateTagRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTag = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createTag(request), expectedError); + const actualRequest = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTag with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.CreateTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateTagRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createTag(request), expectedError); + }); + }); + + describe('updateTag', () => { + it('invokes updateTag without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateTagRequest() + ); + request.tag ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateTagRequest', ['tag', 'name']); + request.tag.name = defaultValue1; + const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Tag() + ); + client.innerApiCalls.updateTag = stubSimpleCall(expectedResponse); + const [response] = await client.updateTag(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTag without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateTagRequest() + ); + request.tag ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateTagRequest', ['tag', 'name']); + request.tag.name = defaultValue1; + const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.Tag() + ); + client.innerApiCalls.updateTag = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateTag( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.ITag|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTag with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateTagRequest() + ); + request.tag ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateTagRequest', ['tag', 'name']); + request.tag.name = defaultValue1; + const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTag = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateTag(request), expectedError); + const actualRequest = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTag with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateTagRequest() + ); + request.tag ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateTagRequest', ['tag', 'name']); + request.tag.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateTag(request), expectedError); + }); + }); + + describe('deleteTag', () => { + it('invokes deleteTag without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTag = stubSimpleCall(expectedResponse); + const [response] = await client.deleteTag(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTag without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTag = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTag( + 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.deleteTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTag with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTag = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteTag(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTag with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteTagRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteTag(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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('getProjectSettings', () => { + it('invokes getProjectSettings without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetProjectSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetProjectSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ProjectSettings() + ); + client.innerApiCalls.getProjectSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getProjectSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getProjectSettings without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetProjectSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetProjectSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ProjectSettings() + ); + client.innerApiCalls.getProjectSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProjectSettings( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IProjectSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getProjectSettings with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetProjectSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetProjectSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getProjectSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getProjectSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getProjectSettings with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetProjectSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetProjectSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProjectSettings(request), expectedError); + }); + }); + + describe('updateProjectSettings', () => { + it('invokes updateProjectSettings without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest() + ); + request.projectSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest', ['projectSettings', 'name']); + request.projectSettings.name = defaultValue1; + const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ProjectSettings() + ); + client.innerApiCalls.updateProjectSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateProjectSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateProjectSettings without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest() + ); + request.projectSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest', ['projectSettings', 'name']); + request.projectSettings.name = defaultValue1; + const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ProjectSettings() + ); + client.innerApiCalls.updateProjectSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateProjectSettings( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IProjectSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateProjectSettings with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest() + ); + request.projectSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest', ['projectSettings', 'name']); + request.projectSettings.name = defaultValue1; + const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProjectSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateProjectSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateProjectSettings with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest() + ); + request.projectSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest', ['projectSettings', 'name']); + request.projectSettings.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateProjectSettings(request), expectedError); + }); + }); + + describe('getVPCSCConfig', () => { + it('invokes getVPCSCConfig without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.VPCSCConfig() + ); + client.innerApiCalls.getVpcscConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getVPCSCConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVpcscConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVpcscConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVPCSCConfig without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.VPCSCConfig() + ); + client.innerApiCalls.getVpcscConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVPCSCConfig( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IVPCSCConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVpcscConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVpcscConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVPCSCConfig with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVpcscConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVPCSCConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getVpcscConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVpcscConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVPCSCConfig with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVPCSCConfig(request), expectedError); + }); + }); + + describe('updateVPCSCConfig', () => { + it('invokes updateVPCSCConfig without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest() + ); + request.vpcscConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest', ['vpcscConfig', 'name']); + request.vpcscConfig.name = defaultValue1; + const expectedHeaderRequestParams = `vpcsc_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.VPCSCConfig() + ); + client.innerApiCalls.updateVpcscConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateVPCSCConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateVpcscConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVpcscConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVPCSCConfig without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest() + ); + request.vpcscConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest', ['vpcscConfig', 'name']); + request.vpcscConfig.name = defaultValue1; + const expectedHeaderRequestParams = `vpcsc_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.VPCSCConfig() + ); + client.innerApiCalls.updateVpcscConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateVPCSCConfig( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IVPCSCConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateVpcscConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVpcscConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVPCSCConfig with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest() + ); + request.vpcscConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest', ['vpcscConfig', 'name']); + request.vpcscConfig.name = defaultValue1; + const expectedHeaderRequestParams = `vpcsc_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVpcscConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateVPCSCConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.updateVpcscConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVpcscConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVPCSCConfig with closed client', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest() + ); + request.vpcscConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest', ['vpcscConfig', 'name']); + request.vpcscConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateVPCSCConfig(request), expectedError); + }); + }); + + describe('importAptArtifacts', () => { + it('invokes importAptArtifacts without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importAptArtifacts = stubLongRunningCall(expectedResponse); + const [operation] = await client.importAptArtifacts(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAptArtifacts without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importAptArtifacts = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importAptArtifacts( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAptArtifacts with call error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAptArtifacts = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importAptArtifacts(request), expectedError); + const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAptArtifacts with LRO error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAptArtifacts = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importAptArtifacts(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportAptArtifactsProgress without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportAptArtifactsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportAptArtifactsProgress with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkImportAptArtifactsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('importYumArtifacts', () => { + it('invokes importYumArtifacts without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importYumArtifacts = stubLongRunningCall(expectedResponse); + const [operation] = await client.importYumArtifacts(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importYumArtifacts without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importYumArtifacts = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importYumArtifacts( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importYumArtifacts with call error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importYumArtifacts = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importYumArtifacts(request), expectedError); + const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importYumArtifacts with LRO error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importYumArtifacts = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importYumArtifacts(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportYumArtifactsProgress without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportYumArtifactsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportYumArtifactsProgress with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkImportYumArtifactsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createRepository', () => { + it('invokes createRepository without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRepository = stubLongRunningCall(expectedResponse); + const [operation] = await client.createRepository(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRepository = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createRepository( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository with call error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRepository = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository with LRO error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRepository = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createRepository(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateRepositoryProgress without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateRepositoryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateRepositoryProgress with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateRepositoryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteRepository', () => { + it('invokes deleteRepository without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRepository = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteRepository(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRepository = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteRepository( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository with call error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository with LRO error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteRepository(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteRepositoryProgress without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteRepositoryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteRepositoryProgress with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteRepositoryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deletePackage', () => { + it('invokes deletePackage without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeletePackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeletePackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePackage = stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePackage(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePackage without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeletePackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeletePackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePackage = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePackage( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePackage with call error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeletePackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeletePackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePackage = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deletePackage(request), expectedError); + const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePackage with LRO error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeletePackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeletePackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePackage = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deletePackage(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeletePackageProgress without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeletePackageProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeletePackageProgress with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeletePackageProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteVersion', () => { + it('invokes deleteVersion without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteVersion = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteVersion = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteVersion( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion with call error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVersion = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion with LRO error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.DeleteVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVersion = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteVersion(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteVersionProgress without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteVersionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteVersionProgress with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteVersionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listDockerImages', () => { + it('invokes listDockerImages without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + ]; + client.innerApiCalls.listDockerImages = stubSimpleCall(expectedResponse); + const [response] = await client.listDockerImages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDockerImages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDockerImages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDockerImages without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + ]; + client.innerApiCalls.listDockerImages = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDockerImages( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IDockerImage[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDockerImages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDockerImages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDockerImages with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDockerImages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDockerImages(request), expectedError); + const actualRequest = (client.innerApiCalls.listDockerImages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDockerImages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDockerImagesStream without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + ]; + client.descriptors.page.listDockerImages.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDockerImagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.DockerImage[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.DockerImage) => { + 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.listDockerImages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDockerImages, request)); + assert( + (client.descriptors.page.listDockerImages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDockerImagesStream with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDockerImages.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDockerImagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.DockerImage[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.DockerImage) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDockerImages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDockerImages, request)); + assert( + (client.descriptors.page.listDockerImages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDockerImages without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), + ]; + client.descriptors.page.listDockerImages.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1.IDockerImage[] = []; + const iterable = client.listDockerImagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDockerImages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDockerImages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDockerImages with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDockerImages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDockerImagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1.IDockerImage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDockerImages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDockerImages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMavenArtifacts', () => { + it('invokes listMavenArtifacts without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + ]; + client.innerApiCalls.listMavenArtifacts = stubSimpleCall(expectedResponse); + const [response] = await client.listMavenArtifacts(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMavenArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMavenArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMavenArtifacts without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + ]; + client.innerApiCalls.listMavenArtifacts = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMavenArtifacts( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IMavenArtifact[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMavenArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMavenArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMavenArtifacts with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMavenArtifacts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMavenArtifacts(request), expectedError); + const actualRequest = (client.innerApiCalls.listMavenArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMavenArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMavenArtifactsStream without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + ]; + client.descriptors.page.listMavenArtifacts.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMavenArtifactsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.MavenArtifact[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.MavenArtifact) => { + 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.listMavenArtifacts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMavenArtifacts, request)); + assert( + (client.descriptors.page.listMavenArtifacts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMavenArtifactsStream with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMavenArtifacts.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMavenArtifactsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.MavenArtifact[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.MavenArtifact) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMavenArtifacts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMavenArtifacts, request)); + assert( + (client.descriptors.page.listMavenArtifacts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMavenArtifacts without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), + ]; + client.descriptors.page.listMavenArtifacts.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1.IMavenArtifact[] = []; + const iterable = client.listMavenArtifactsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMavenArtifacts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMavenArtifacts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMavenArtifacts with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMavenArtifacts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMavenArtifactsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1.IMavenArtifact[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMavenArtifacts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMavenArtifacts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listNpmPackages', () => { + it('invokes listNpmPackages without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + ]; + client.innerApiCalls.listNpmPackages = stubSimpleCall(expectedResponse); + const [response] = await client.listNpmPackages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNpmPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNpmPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNpmPackages without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + ]; + client.innerApiCalls.listNpmPackages = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNpmPackages( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.INpmPackage[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNpmPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNpmPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNpmPackages with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNpmPackages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNpmPackages(request), expectedError); + const actualRequest = (client.innerApiCalls.listNpmPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNpmPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNpmPackagesStream without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + ]; + client.descriptors.page.listNpmPackages.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNpmPackagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.NpmPackage[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.NpmPackage) => { + 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.listNpmPackages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNpmPackages, request)); + assert( + (client.descriptors.page.listNpmPackages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNpmPackagesStream with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNpmPackages.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNpmPackagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.NpmPackage[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.NpmPackage) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNpmPackages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNpmPackages, request)); + assert( + (client.descriptors.page.listNpmPackages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNpmPackages without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), + ]; + client.descriptors.page.listNpmPackages.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1.INpmPackage[] = []; + const iterable = client.listNpmPackagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNpmPackages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNpmPackages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNpmPackages with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNpmPackages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNpmPackagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1.INpmPackage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNpmPackages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNpmPackages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listPythonPackages', () => { + it('invokes listPythonPackages without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + ]; + client.innerApiCalls.listPythonPackages = stubSimpleCall(expectedResponse); + const [response] = await client.listPythonPackages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPythonPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPythonPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPythonPackages without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + ]; + client.innerApiCalls.listPythonPackages = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPythonPackages( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IPythonPackage[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPythonPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPythonPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPythonPackages with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPythonPackages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPythonPackages(request), expectedError); + const actualRequest = (client.innerApiCalls.listPythonPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPythonPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPythonPackagesStream without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + ]; + client.descriptors.page.listPythonPackages.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPythonPackagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.PythonPackage[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.PythonPackage) => { + 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.listPythonPackages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPythonPackages, request)); + assert( + (client.descriptors.page.listPythonPackages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listPythonPackagesStream with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPythonPackages.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPythonPackagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.PythonPackage[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.PythonPackage) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listPythonPackages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPythonPackages, request)); + assert( + (client.descriptors.page.listPythonPackages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPythonPackages without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), + ]; + client.descriptors.page.listPythonPackages.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1.IPythonPackage[] = []; + const iterable = client.listPythonPackagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPythonPackages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPythonPackages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPythonPackages with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPythonPackages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPythonPackagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1.IPythonPackage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPythonPackages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPythonPackages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRepositories', () => { + it('invokes listRepositories without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + ]; + client.innerApiCalls.listRepositories = stubSimpleCall(expectedResponse); + const [response] = await client.listRepositories(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositories without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + ]; + client.innerApiCalls.listRepositories = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRepositories( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IRepository[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositories with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRepositories = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRepositories(request), expectedError); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositoriesStream without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + ]; + client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.Repository[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Repository) => { + 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.listRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); + assert( + (client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRepositoriesStream with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.Repository[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Repository) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); + assert( + (client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRepositories without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), + ]; + client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1.IRepository[] = []; + const iterable = client.listRepositoriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRepositories with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRepositoriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1.IRepository[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listPackages', () => { + it('invokes listPackages without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + ]; + client.innerApiCalls.listPackages = stubSimpleCall(expectedResponse); + const [response] = await client.listPackages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPackages without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + ]; + client.innerApiCalls.listPackages = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPackages( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IPackage[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPackages with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPackages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPackages(request), expectedError); + const actualRequest = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPackagesStream without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + ]; + client.descriptors.page.listPackages.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPackagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.Package[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Package) => { + 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.listPackages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPackages, request)); + assert( + (client.descriptors.page.listPackages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listPackagesStream with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPackages.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPackagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.Package[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Package) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listPackages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPackages, request)); + assert( + (client.descriptors.page.listPackages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPackages without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), + ]; + client.descriptors.page.listPackages.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1.IPackage[] = []; + const iterable = client.listPackagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPackages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPackages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPackages with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPackages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPackagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1.IPackage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPackages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPackages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listVersions', () => { + it('invokes listVersions without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + ]; + client.innerApiCalls.listVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersions without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + ]; + client.innerApiCalls.listVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listVersions( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IVersion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersions with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersionsStream without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + ]; + client.descriptors.page.listVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.Version[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Version) => { + 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.listVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listVersionsStream with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.Version[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Version) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVersions without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), + ]; + client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1.IVersion[] = []; + const iterable = client.listVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVersions with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1.IVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listFiles', () => { + it('invokes listFiles without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + ]; + client.innerApiCalls.listFiles = stubSimpleCall(expectedResponse); + const [response] = await client.listFiles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFiles without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + ]; + client.innerApiCalls.listFiles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFiles( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IFile[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFiles with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFiles(request), expectedError); + const actualRequest = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFilesStream without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + ]; + client.descriptors.page.listFiles.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.File[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.File) => { + 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.listFiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFiles, request)); + assert( + (client.descriptors.page.listFiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFilesStream with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFiles.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.File[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.File) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFiles, request)); + assert( + (client.descriptors.page.listFiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFiles without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), + ]; + client.descriptors.page.listFiles.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1.IFile[] = []; + const iterable = client.listFilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFiles with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1.IFile[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listTags', () => { + it('invokes listTags without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + ]; + client.innerApiCalls.listTags = stubSimpleCall(expectedResponse); + const [response] = await client.listTags(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTags without error using callback', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + ]; + client.innerApiCalls.listTags = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTags( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.ITag[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTags with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listTags = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listTags(request), expectedError); + const actualRequest = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTagsStream without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + ]; + client.descriptors.page.listTags.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listTagsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.Tag[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Tag) => { + 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.listTags.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTags, request)); + assert( + (client.descriptors.page.listTags.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listTagsStream with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTags.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listTagsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1.Tag[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Tag) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listTags.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTags, request)); + assert( + (client.descriptors.page.listTags.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listTags without error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), + ]; + client.descriptors.page.listTags.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1.ITag[] = []; + const iterable = client.listTagsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTags.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listTags.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listTags with error', async () => { + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTags.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTagsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1.ITag[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTags.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listTags.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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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('aptArtifact', () => { + const fakePath = "/rendered/path/aptArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + apt_artifact: "aptArtifactValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.aptArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.aptArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('aptArtifactPath', () => { + const result = client.aptArtifactPath("projectValue", "locationValue", "repositoryValue", "aptArtifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.aptArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAptArtifactName', () => { + const result = client.matchProjectFromAptArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAptArtifactName', () => { + const result = client.matchLocationFromAptArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromAptArtifactName', () => { + const result = client.matchRepositoryFromAptArtifactName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAptArtifactFromAptArtifactName', () => { + const result = client.matchAptArtifactFromAptArtifactName(fakePath); + assert.strictEqual(result, "aptArtifactValue"); + assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('dockerImage', () => { + const fakePath = "/rendered/path/dockerImage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + docker_image: "dockerImageValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.dockerImagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.dockerImagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('dockerImagePath', () => { + const result = client.dockerImagePath("projectValue", "locationValue", "repositoryValue", "dockerImageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.dockerImagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDockerImageName', () => { + const result = client.matchProjectFromDockerImageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.dockerImagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromDockerImageName', () => { + const result = client.matchLocationFromDockerImageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.dockerImagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromDockerImageName', () => { + const result = client.matchRepositoryFromDockerImageName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.dockerImagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDockerImageFromDockerImageName', () => { + const result = client.matchDockerImageFromDockerImageName(fakePath); + assert.strictEqual(result, "dockerImageValue"); + assert((client.pathTemplates.dockerImagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('file', () => { + const fakePath = "/rendered/path/file"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + file: "fileValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.filePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.filePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('filePath', () => { + const result = client.filePath("projectValue", "locationValue", "repositoryValue", "fileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.filePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFileName', () => { + const result = client.matchProjectFromFileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.filePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFileName', () => { + const result = client.matchLocationFromFileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.filePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromFileName', () => { + const result = client.matchRepositoryFromFileName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.filePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFileFromFileName', () => { + const result = client.matchFileFromFileName(fakePath); + assert.strictEqual(result, "fileValue"); + assert((client.pathTemplates.filePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('mavenArtifact', () => { + const fakePath = "/rendered/path/mavenArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + maven_artifact: "mavenArtifactValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.mavenArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mavenArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mavenArtifactPath', () => { + const result = client.mavenArtifactPath("projectValue", "locationValue", "repositoryValue", "mavenArtifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.mavenArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMavenArtifactName', () => { + const result = client.matchProjectFromMavenArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.mavenArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMavenArtifactName', () => { + const result = client.matchLocationFromMavenArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.mavenArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromMavenArtifactName', () => { + const result = client.matchRepositoryFromMavenArtifactName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.mavenArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMavenArtifactFromMavenArtifactName', () => { + const result = client.matchMavenArtifactFromMavenArtifactName(fakePath); + assert.strictEqual(result, "mavenArtifactValue"); + assert((client.pathTemplates.mavenArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('npmPackage', () => { + const fakePath = "/rendered/path/npmPackage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + npm_package: "npmPackageValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.npmPackagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.npmPackagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('npmPackagePath', () => { + const result = client.npmPackagePath("projectValue", "locationValue", "repositoryValue", "npmPackageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.npmPackagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNpmPackageName', () => { + const result = client.matchProjectFromNpmPackageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.npmPackagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromNpmPackageName', () => { + const result = client.matchLocationFromNpmPackageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.npmPackagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromNpmPackageName', () => { + const result = client.matchRepositoryFromNpmPackageName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.npmPackagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNpmPackageFromNpmPackageName', () => { + const result = client.matchNpmPackageFromNpmPackageName(fakePath); + assert.strictEqual(result, "npmPackageValue"); + assert((client.pathTemplates.npmPackagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('package', () => { + const fakePath = "/rendered/path/package"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + package: "packageValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.packagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.packagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('packagePath', () => { + const result = client.packagePath("projectValue", "locationValue", "repositoryValue", "packageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.packagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPackageName', () => { + const result = client.matchProjectFromPackageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.packagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPackageName', () => { + const result = client.matchLocationFromPackageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.packagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromPackageName', () => { + const result = client.matchRepositoryFromPackageName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.packagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPackageFromPackageName', () => { + const result = client.matchPackageFromPackageName(fakePath); + assert.strictEqual(result, "packageValue"); + assert((client.pathTemplates.packagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSettings', () => { + const fakePath = "/rendered/path/projectSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSettingsPath', () => { + const result = client.projectSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSettingsName', () => { + const result = client.matchProjectFromProjectSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('pythonPackage', () => { + const fakePath = "/rendered/path/pythonPackage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + python_package: "pythonPackageValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.pythonPackagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.pythonPackagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('pythonPackagePath', () => { + const result = client.pythonPackagePath("projectValue", "locationValue", "repositoryValue", "pythonPackageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.pythonPackagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPythonPackageName', () => { + const result = client.matchProjectFromPythonPackageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.pythonPackagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPythonPackageName', () => { + const result = client.matchLocationFromPythonPackageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.pythonPackagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromPythonPackageName', () => { + const result = client.matchRepositoryFromPythonPackageName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.pythonPackagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPythonPackageFromPythonPackageName', () => { + const result = client.matchPythonPackageFromPythonPackageName(fakePath); + assert.strictEqual(result, "pythonPackageValue"); + assert((client.pathTemplates.pythonPackagePathTemplate.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 artifactregistryModule.v1.ArtifactRegistryClient({ + 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('tag', () => { + const fakePath = "/rendered/path/tag"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + package: "packageValue", + tag: "tagValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tagPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tagPath', () => { + const result = client.tagPath("projectValue", "locationValue", "repositoryValue", "packageValue", "tagValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tagPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTagName', () => { + const result = client.matchProjectFromTagName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tagPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromTagName', () => { + const result = client.matchLocationFromTagName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.tagPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromTagName', () => { + const result = client.matchRepositoryFromTagName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.tagPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPackageFromTagName', () => { + const result = client.matchPackageFromTagName(fakePath); + assert.strictEqual(result, "packageValue"); + assert((client.pathTemplates.tagPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTagFromTagName', () => { + const result = client.matchTagFromTagName(fakePath); + assert.strictEqual(result, "tagValue"); + assert((client.pathTemplates.tagPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('version', () => { + const fakePath = "/rendered/path/version"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + package: "packageValue", + version: "versionValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.versionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath("projectValue", "locationValue", "repositoryValue", "packageValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromVersionName', () => { + const result = client.matchRepositoryFromVersionName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPackageFromVersionName', () => { + const result = client.matchPackageFromVersionName(fakePath); + assert.strictEqual(result, "packageValue"); + assert((client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('vpcscConfig', () => { + const fakePath = "/rendered/path/vpcscConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.vpcscConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.vpcscConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('vpcscConfigPath', () => { + const result = client.vpcscConfigPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.vpcscConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromVpcscConfigName', () => { + const result = client.matchProjectFromVpcscConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.vpcscConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromVpcscConfigName', () => { + const result = client.matchLocationFromVpcscConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.vpcscConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('yumArtifact', () => { + const fakePath = "/rendered/path/yumArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + yum_artifact: "yumArtifactValue", + }; + const client = new artifactregistryModule.v1.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.yumArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.yumArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('yumArtifactPath', () => { + const result = client.yumArtifactPath("projectValue", "locationValue", "repositoryValue", "yumArtifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.yumArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromYumArtifactName', () => { + const result = client.matchProjectFromYumArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromYumArtifactName', () => { + const result = client.matchLocationFromYumArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromYumArtifactName', () => { + const result = client.matchRepositoryFromYumArtifactName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchYumArtifactFromYumArtifactName', () => { + const result = client.matchYumArtifactFromYumArtifactName(fakePath); + assert.strictEqual(result, "yumArtifactValue"); + assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/tsconfig.json b/owl-bot-staging/google-devtools-artifactregistry/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1/webpack.config.js b/owl-bot-staging/google-devtools-artifactregistry/v1/webpack.config.js new file mode 100644 index 00000000000..d7daabc3ee8 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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: 'ArtifactRegistry', + filename: './artifact-registry.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-devtools-artifactregistry/v1beta2/.eslintignore b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintrc.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.gitignore b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1beta2/.jsdoc.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.jsdoc.js new file mode 100644 index 00000000000..532a80143b5 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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/artifact-registry', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.mocharc.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1beta2/.prettierrc.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1beta2/README.md b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/README.md new file mode 100644 index 00000000000..123ed7c7a23 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/README.md @@ -0,0 +1 @@ +Artifactregistry: Nodejs Client diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/package.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/package.json new file mode 100644 index 00000000000..6810984ffda --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/artifact-registry", + "version": "0.1.0", + "description": "Artifactregistry client for Node.js", + "repository": "googleapis/nodejs-artifactregistry", + "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 artifactregistry", + "artifactregistry", + "artifact registry" + ], + "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-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/apt_artifact.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/apt_artifact.proto new file mode 100644 index 00000000000..4ac8f8f439a --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/apt_artifact.proto @@ -0,0 +1,115 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.devtools.artifactregistry.v1beta2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "AptArtifactProto"; +option java_package = "com.google.devtools.artifactregistry.v1beta2"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; + +// A detailed representation of an Apt artifact. Information in the record +// is derived from the archive's control file. +// See https://www.debian.org/doc/debian-policy/ch-controlfields.html +message AptArtifact { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/AptArtifact" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}" + }; + + // Package type is either binary or source. + enum PackageType { + // Package type is not specified. + PACKAGE_TYPE_UNSPECIFIED = 0; + + // Binary package. + BINARY = 1; + + // Source package. + SOURCE = 2; + } + + // Output only. The Artifact Registry resource name of the artifact. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Apt package name of the artifact. + string package_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. An artifact is a binary or source package. + PackageType package_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Operating system architecture of the artifact. + string architecture = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Repository component of the artifact. + string component = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Contents of the artifact's control metadata file. + bytes control_file = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Google Cloud Storage location where the artifacts currently reside. +message ImportAptArtifactsGcsSource { + // Cloud Storage paths URI (e.g., gs://my_bucket//my_object). + repeated string uris = 1; + + // Supports URI wildcards for matching multiple objects from a single URI. + bool use_wildcards = 2; +} + +// The request to import new apt artifacts. +message ImportAptArtifactsRequest { + // The source location of the package binaries. + oneof source { + // Google Cloud Storage location where input content is located. + ImportAptArtifactsGcsSource gcs_source = 2; + } + + // The name of the parent resource where the artifacts will be imported. + string parent = 1; +} + +// Error information explaining why a package was not imported. +message ImportAptArtifactsErrorInfo { + // The source that was not imported. + oneof source { + // Google Cloud Storage location requested. + ImportAptArtifactsGcsSource gcs_source = 1; + } + + // The detailed error status. + google.rpc.Status error = 2; +} + +// The response message from importing APT artifacts. +message ImportAptArtifactsResponse { + // The Apt artifacts imported. + repeated AptArtifact apt_artifacts = 1; + + // Detailed error info for artifacts that were not imported. + repeated ImportAptArtifactsErrorInfo errors = 2; +} + +// The operation metadata for importing artifacts. +message ImportAptArtifactsMetadata { +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/file.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/file.proto new file mode 100644 index 00000000000..645ee7ebb13 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/file.proto @@ -0,0 +1,120 @@ +// 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.devtools.artifactregistry.v1beta2; + +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "FileProto"; +option java_package = "com.google.devtools.artifactregistry.v1beta2"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; + +// A hash of file content. +message Hash { + // The algorithm used to compute the hash. + enum HashType { + // Unspecified. + HASH_TYPE_UNSPECIFIED = 0; + + // SHA256 hash. + SHA256 = 1; + + // MD5 hash. + MD5 = 2; + } + + // The algorithm used to compute the hash value. + HashType type = 1; + + // The hash value. + bytes value = 2; +} + +// Files store content that is potentially associated with Packages or Versions. +message File { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/File" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/files/{file}" + }; + + // The name of the file, for example: + // "projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt". + // If the file ID part contains slashes, they are escaped. + string name = 1; + + // The size of the File in bytes. + int64 size_bytes = 3; + + // The hashes of the file content. + repeated Hash hashes = 4; + + // The time when the File was created. + google.protobuf.Timestamp create_time = 5; + + // The time when the File was last updated. + google.protobuf.Timestamp update_time = 6; + + // The name of the Package or Version that owns this file, if any. + string owner = 7; +} + +// The request to list files. +message ListFilesRequest { + // The name of the repository whose files will be listed. For example: + // "projects/p1/locations/us-central1/repositories/repo1 + string parent = 1; + + // An expression for filtering the results of the request. Filter rules are + // case insensitive. The fields eligible for filtering are: + // + // * `name` + // * `owner` + // + // An example of using a filter: + // + // * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an + // ID starting with "a/b/". + // * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> + // Files owned by the version `1.0` in package `pkg1`. + string filter = 4; + + // The maximum number of files to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; +} + +// The response from listing files. +message ListFilesResponse { + // The files returned. + repeated File files = 1; + + // The token to retrieve the next page of files, or empty if there are no + // more files to return. + string next_page_token = 2; +} + +// The request to retrieve a file. +message GetFileRequest { + // The name of the file to retrieve. + string name = 1; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/package.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/package.proto new file mode 100644 index 00000000000..0209490ff99 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/package.proto @@ -0,0 +1,79 @@ +// 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.devtools.artifactregistry.v1beta2; + +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "PackageProto"; +option java_package = "com.google.devtools.artifactregistry.v1beta2"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; + +// Packages are named collections of versions. +message Package { + // The name of the package, for example: + // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1". + string name = 1; + + // The display name of the package. + string display_name = 2; + + // The time when the package was created. + google.protobuf.Timestamp create_time = 5; + + // The time when the package was last updated. This includes publishing a new + // version of the package. + google.protobuf.Timestamp update_time = 6; +} + +// The request to list packages. +message ListPackagesRequest { + // The name of the parent resource whose packages will be listed. + string parent = 1; + + // The maximum number of packages to return. + // Maximum page size is 10,000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; +} + +// The response from listing packages. +message ListPackagesResponse { + // The packages returned. + repeated Package packages = 1; + + // The token to retrieve the next page of packages, or empty if there are no + // more packages to return. + string next_page_token = 2; +} + +// The request to retrieve a package. +message GetPackageRequest { + // The name of the package to retrieve. + string name = 1; +} + +// The request to delete a package. +message DeletePackageRequest { + // The name of the package to delete. + string name = 1; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/repository.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/repository.proto new file mode 100644 index 00000000000..903ef0290db --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/repository.proto @@ -0,0 +1,201 @@ +// 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.devtools.artifactregistry.v1beta2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "RepositoryProto"; +option java_package = "com.google.devtools.artifactregistry.v1beta2"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; + +// A Repository for storing artifacts with a specific format. +message Repository { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/repositories/{repository}" + }; + + // MavenRepositoryConfig is maven related repository details. + // Provides additional configuration details for repositories of the maven + // format type. + message MavenRepositoryConfig { + // VersionPolicy is the version policy for the repository. + enum VersionPolicy { + // VERSION_POLICY_UNSPECIFIED - the version policy is not defined. + // When the version policy is not defined, no validation is performed + // for the versions. + VERSION_POLICY_UNSPECIFIED = 0; + + // RELEASE - repository will accept only Release versions. + RELEASE = 1; + + // SNAPSHOT - repository will accept only Snapshot versions. + SNAPSHOT = 2; + } + + // The repository with this flag will allow publishing + // the same snapshot versions. + bool allow_snapshot_overwrites = 1; + + // Version policy defines the versions that the registry will accept. + VersionPolicy version_policy = 2; + } + + // A package format. + enum Format { + // Unspecified package format. + FORMAT_UNSPECIFIED = 0; + + // Docker package format. + DOCKER = 1; + + // Maven package format. + MAVEN = 2; + + // NPM package format. + NPM = 3; + + // APT package format. + APT = 5; + + // YUM package format. + YUM = 6; + + // Python package format. + PYTHON = 8; + } + + // Repository-specific configurations. + oneof format_config { + // Maven repository config contains repository level configuration + // for the repositories of maven type. + MavenRepositoryConfig maven_config = 9; + } + + // The name of the repository, for example: + // "projects/p1/locations/us-central1/repositories/repo1". + string name = 1; + + // The format of packages that are stored in the repository. + Format format = 2; + + // The user-provided description of the repository. + string description = 3; + + // Labels with user-defined metadata. + // This field may contain up to 64 entries. Label keys and values may be no + // longer than 63 characters. Label keys must begin with a lowercase letter + // and may only contain lowercase letters, numeric characters, underscores, + // and dashes. + map labels = 4; + + // The time when the repository was created. + google.protobuf.Timestamp create_time = 5; + + // The time when the repository was last updated. + google.protobuf.Timestamp update_time = 6; + + // The Cloud KMS resource name of the customer managed encryption key that’s + // used to encrypt the contents of the Repository. Has the form: + // `projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key`. + // This value may not be changed after the Repository has been created. + string kms_key_name = 8; +} + +// The request to list repositories. +message ListRepositoriesRequest { + // Required. The name of the parent resource whose repositories will be listed. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "artifactregistry.googleapis.com/Repository" + } + ]; + + // The maximum number of repositories to return. Maximum page size is 1,000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; +} + +// The response from listing repositories. +message ListRepositoriesResponse { + // The repositories returned. + repeated Repository repositories = 1; + + // The token to retrieve the next page of repositories, or empty if there are + // no more repositories to return. + string next_page_token = 2; +} + +// The request to retrieve a repository. +message GetRepositoryRequest { + // Required. The name of the repository to retrieve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + } + ]; +} + +// The request to create a new repository. +message CreateRepositoryRequest { + // Required. The name of the parent resource where the repository will be created. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "artifactregistry.googleapis.com/Repository" + } + ]; + + // The repository id to use for this repository. + string repository_id = 2; + + // The repository to be created. + Repository repository = 3; +} + +// The request to update a repository. +message UpdateRepositoryRequest { + // The repository that replaces the resource on the server. + Repository repository = 1; + + // The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 2; +} + +// The request to delete a repository. +message DeleteRepositoryRequest { + // Required. The name of the repository to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + } + ]; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/service.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/service.proto new file mode 100644 index 00000000000..976bd6700ad --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/service.proto @@ -0,0 +1,304 @@ +// 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.devtools.artifactregistry.v1beta2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/devtools/artifactregistry/v1beta2/apt_artifact.proto"; +import "google/devtools/artifactregistry/v1beta2/file.proto"; +import "google/devtools/artifactregistry/v1beta2/package.proto"; +import "google/devtools/artifactregistry/v1beta2/repository.proto"; +import "google/devtools/artifactregistry/v1beta2/settings.proto"; +import "google/devtools/artifactregistry/v1beta2/tag.proto"; +import "google/devtools/artifactregistry/v1beta2/version.proto"; +import "google/devtools/artifactregistry/v1beta2/yum_artifact.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.devtools.artifactregistry.v1beta2"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; + +// The Artifact Registry API service. +// +// Artifact Registry is an artifact management system for storing artifacts +// from different package management systems. +// +// The resources managed by this API are: +// +// * Repositories, which group packages and their data. +// * Packages, which group versions and their tags. +// * Versions, which are specific forms of a package. +// * Tags, which represent alternative names for versions. +// * Files, which contain content and are optionally associated with a Package +// or Version. +service ArtifactRegistry { + option (google.api.default_host) = "artifactregistry.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only"; + + // Imports Apt artifacts. The returned Operation will complete once the + // resources are imported. Package, Version, and File resources are created + // based on the imported artifacts. Imported artifacts that conflict with + // existing resources are ignored. + rpc ImportAptArtifacts(ImportAptArtifactsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta2/{parent=projects/*/locations/*/repositories/*}/aptArtifacts:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.devtools.artifactregistry.v1beta2.ImportAptArtifactsResponse" + metadata_type: "google.devtools.artifactregistry.v1beta2.ImportAptArtifactsMetadata" + }; + } + + // Imports Yum (RPM) artifacts. The returned Operation will complete once the + // resources are imported. Package, Version, and File resources are created + // based on the imported artifacts. Imported artifacts that conflict with + // existing resources are ignored. + rpc ImportYumArtifacts(ImportYumArtifactsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta2/{parent=projects/*/locations/*/repositories/*}/yumArtifacts:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.devtools.artifactregistry.v1beta2.ImportYumArtifactsResponse" + metadata_type: "google.devtools.artifactregistry.v1beta2.ImportYumArtifactsMetadata" + }; + } + + // Lists repositories. + rpc ListRepositories(ListRepositoriesRequest) returns (ListRepositoriesResponse) { + option (google.api.http) = { + get: "/v1beta2/{parent=projects/*/locations/*}/repositories" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a repository. + rpc GetRepository(GetRepositoryRequest) returns (Repository) { + option (google.api.http) = { + get: "/v1beta2/{name=projects/*/locations/*/repositories/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a repository. The returned Operation will finish once the + // repository has been created. Its response will be the created Repository. + rpc CreateRepository(CreateRepositoryRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta2/{parent=projects/*/locations/*}/repositories" + body: "repository" + }; + option (google.api.method_signature) = "parent,repository,repository_id"; + option (google.longrunning.operation_info) = { + response_type: "google.devtools.artifactregistry.v1beta2.Repository" + metadata_type: "google.devtools.artifactregistry.v1beta2.OperationMetadata" + }; + } + + // Updates a repository. + rpc UpdateRepository(UpdateRepositoryRequest) returns (Repository) { + option (google.api.http) = { + patch: "/v1beta2/{repository.name=projects/*/locations/*/repositories/*}" + body: "repository" + }; + option (google.api.method_signature) = "repository,update_mask"; + } + + // Deletes a repository and all of its contents. The returned Operation will + // finish once the repository has been deleted. It will not have any Operation + // metadata and will return a google.protobuf.Empty response. + rpc DeleteRepository(DeleteRepositoryRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta2/{name=projects/*/locations/*/repositories/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.devtools.artifactregistry.v1beta2.OperationMetadata" + }; + } + + // Lists packages. + rpc ListPackages(ListPackagesRequest) returns (ListPackagesResponse) { + option (google.api.http) = { + get: "/v1beta2/{parent=projects/*/locations/*/repositories/*}/packages" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a package. + rpc GetPackage(GetPackageRequest) returns (Package) { + option (google.api.http) = { + get: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a package and all of its versions and tags. The returned operation + // will complete once the package has been deleted. + rpc DeletePackage(DeletePackageRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.devtools.artifactregistry.v1beta2.OperationMetadata" + }; + } + + // Lists versions. + rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { + option (google.api.http) = { + get: "/v1beta2/{parent=projects/*/locations/*/repositories/*/packages/*}/versions" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a version + rpc GetVersion(GetVersionRequest) returns (Version) { + option (google.api.http) = { + get: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*/versions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a version and all of its content. The returned operation will + // complete once the version has been deleted. + rpc DeleteVersion(DeleteVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*/versions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.devtools.artifactregistry.v1beta2.OperationMetadata" + }; + } + + // Lists files. + rpc ListFiles(ListFilesRequest) returns (ListFilesResponse) { + option (google.api.http) = { + get: "/v1beta2/{parent=projects/*/locations/*/repositories/*}/files" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a file. + rpc GetFile(GetFileRequest) returns (File) { + option (google.api.http) = { + get: "/v1beta2/{name=projects/*/locations/*/repositories/*/files/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists tags. + rpc ListTags(ListTagsRequest) returns (ListTagsResponse) { + option (google.api.http) = { + get: "/v1beta2/{parent=projects/*/locations/*/repositories/*/packages/*}/tags" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a tag. + rpc GetTag(GetTagRequest) returns (Tag) { + option (google.api.http) = { + get: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*/tags/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a tag. + rpc CreateTag(CreateTagRequest) returns (Tag) { + option (google.api.http) = { + post: "/v1beta2/{parent=projects/*/locations/*/repositories/*/packages/*}/tags" + body: "tag" + }; + option (google.api.method_signature) = "parent,tag,tag_id"; + } + + // Updates a tag. + rpc UpdateTag(UpdateTagRequest) returns (Tag) { + option (google.api.http) = { + patch: "/v1beta2/{tag.name=projects/*/locations/*/repositories/*/packages/*/tags/*}" + body: "tag" + }; + option (google.api.method_signature) = "tag,update_mask"; + } + + // Deletes a tag. + rpc DeleteTag(DeleteTagRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*/tags/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the IAM policy for a given resource. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1beta2/{resource=projects/*/locations/*/repositories/*}:setIamPolicy" + body: "*" + }; + } + + // Gets the IAM policy for a given resource. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + get: "/v1beta2/{resource=projects/*/locations/*/repositories/*}:getIamPolicy" + }; + } + + // Tests if the caller has a list of permissions on a resource. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1beta2/{resource=projects/*/locations/*/repositories/*}:testIamPermissions" + body: "*" + }; + } + + // Retrieves the Settings for the Project. + rpc GetProjectSettings(GetProjectSettingsRequest) returns (ProjectSettings) { + option (google.api.http) = { + get: "/v1beta2/{name=projects/*/projectSettings}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the Settings for the Project. + rpc UpdateProjectSettings(UpdateProjectSettingsRequest) returns (ProjectSettings) { + option (google.api.http) = { + patch: "/v1beta2/{project_settings.name=projects/*/projectSettings}" + body: "project_settings" + }; + option (google.api.method_signature) = "project_settings,update_mask"; + } +} + +// Metadata type for longrunning-operations, currently empty. +message OperationMetadata { + +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/settings.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/settings.proto new file mode 100644 index 00000000000..111556f1174 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/settings.proto @@ -0,0 +1,84 @@ +// 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.devtools.artifactregistry.v1beta2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "SettingsProto"; +option java_package = "com.google.devtools.artifactregistry.v1beta2"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; + +// The Artifact Registry settings that apply to a Project. +message ProjectSettings { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/ProjectSettings" + pattern: "projects/{project}/projectSettings" + }; + + // The possible redirection states for legacy repositories. + enum RedirectionState { + // No redirection status has been set. + REDIRECTION_STATE_UNSPECIFIED = 0; + + // Redirection is disabled. + REDIRECTION_FROM_GCR_IO_DISABLED = 1; + + // Redirection is enabled. + REDIRECTION_FROM_GCR_IO_ENABLED = 2; + + // Redirection is enabled, and has been finalized so cannot be reverted. + REDIRECTION_FROM_GCR_IO_FINALIZED = 3; + } + + // The name of the project's settings. + // + // Always of the form: + // projects/{project-id}/projectSettings + // + // In update request: never set + // In response: always set + string name = 1; + + // The redirection state of the legacy repositories in this project. + RedirectionState legacy_redirection_state = 2; +} + +// Gets the redirection status for a project. +message GetProjectSettingsRequest { + // Required. The name of the projectSettings resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/ProjectSettings" + } + ]; +} + +// Sets the settings of the project. +message UpdateProjectSettingsRequest { + // The project settings. + ProjectSettings project_settings = 2; + + // Field mask to support partial updates. + google.protobuf.FieldMask update_mask = 3; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/tag.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/tag.proto new file mode 100644 index 00000000000..c969fee4403 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/tag.proto @@ -0,0 +1,118 @@ +// 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.devtools.artifactregistry.v1beta2; + +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "TagProto"; +option java_package = "com.google.devtools.artifactregistry.v1beta2"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; + +// Tags point to a version and represent an alternative name that can be used +// to access the version. +message Tag { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/Tag" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}" + }; + + // The name of the tag, for example: + // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". + // If the package part contains slashes, the slashes are escaped. + // The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else + // must be URL encoded. + string name = 1; + + // The name of the version the tag refers to, for example: + // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811" + // If the package or version ID parts contain slashes, the slashes are + // escaped. + string version = 2; +} + +// The request to list tags. +message ListTagsRequest { + // The name of the parent resource whose tags will be listed. + string parent = 1; + + // An expression for filtering the results of the request. Filter rules are + // case insensitive. The fields eligible for filtering are: + // + // * `version` + // + // An example of using a filter: + // + // * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` + // --> Tags that are applied to the version `1.0` in package `pkg1`. + string filter = 4; + + // The maximum number of tags to return. Maximum page size is 10,000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; +} + +// The response from listing tags. +message ListTagsResponse { + // The tags returned. + repeated Tag tags = 1; + + // The token to retrieve the next page of tags, or empty if there are no + // more tags to return. + string next_page_token = 2; +} + +// The request to retrieve a tag. +message GetTagRequest { + // The name of the tag to retrieve. + string name = 1; +} + +// The request to create a new tag. +message CreateTagRequest { + // The name of the parent resource where the tag will be created. + string parent = 1; + + // The tag id to use for this repository. + string tag_id = 2; + + // The tag to be created. + Tag tag = 3; +} + +// The request to create or update a tag. +message UpdateTagRequest { + // The tag that replaces the resource on the server. + Tag tag = 1; + + // The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 2; +} + +// The request to delete a tag. +message DeleteTagRequest { + // The name of the tag to delete. + string name = 1; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/version.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/version.proto new file mode 100644 index 00000000000..a9635c7f4a9 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/version.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.devtools.artifactregistry.v1beta2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/devtools/artifactregistry/v1beta2/tag.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "VersionProto"; +option java_package = "com.google.devtools.artifactregistry.v1beta2"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; + +// The view, which determines what version information is returned in a +// response. +enum VersionView { + // The default / unset value. + // The API will default to the BASIC view. + VERSION_VIEW_UNSPECIFIED = 0; + + // Includes basic information about the version, but not any related tags. + BASIC = 1; + + // Include everything. + FULL = 2; +} + +// The body of a version resource. A version resource represents a +// collection of components, such as files and other data. This may correspond +// to a version in many package management schemes. +message Version { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/Version" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}" + }; + + // The name of the version, for example: + // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/art1". + // If the package or version ID parts contain slashes, the slashes are + // escaped. + string name = 1; + + // Optional. Description of the version, as specified in its metadata. + string description = 3; + + // The time when the version was created. + google.protobuf.Timestamp create_time = 5; + + // The time when the version was last updated. + google.protobuf.Timestamp update_time = 6; + + // Output only. A list of related tags. Will contain up to 100 tags that + // reference this version. + repeated Tag related_tags = 7; + + // Output only. Repository-specific Metadata stored against this version. + // The fields returned are defined by the underlying repository-specific + // resource. Currently, the only resource in use is + // [DockerImage][google.devtools.artifactregistry.v1.DockerImage] + google.protobuf.Struct metadata = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request to list versions. +message ListVersionsRequest { + // The name of the parent resource whose versions will be listed. + string parent = 1; + + // The maximum number of versions to return. Maximum page size is 1,000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request, if any. + string page_token = 3; + + // The view that should be returned in the response. + VersionView view = 4; + + // Optional. The field to order the results by. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response from listing versions. +message ListVersionsResponse { + // The versions returned. + repeated Version versions = 1; + + // The token to retrieve the next page of versions, or empty if there are no + // more versions to return. + string next_page_token = 2; +} + +// The request to retrieve a version. +message GetVersionRequest { + // The name of the version to retrieve. + string name = 1; + + // The view that should be returned in the response. + VersionView view = 2; +} + +// The request to delete a version. +message DeleteVersionRequest { + // The name of the version to delete. + string name = 1; + + // By default, a version that is tagged may not be deleted. If force=true, the + // version and any tags pointing to the version are deleted. + bool force = 2; +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/yum_artifact.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/yum_artifact.proto new file mode 100644 index 00000000000..a4467411db2 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/yum_artifact.proto @@ -0,0 +1,107 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.artifactregistry.v1beta2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; +option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "YumArtifactProto"; +option java_package = "com.google.devtools.artifactregistry.v1beta2"; +option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; +option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; + +// A detailed representation of a Yum artifact. +message YumArtifact { + option (google.api.resource) = { + type: "artifactregistry.googleapis.com/YumArtifact" + pattern: "projects/{project}/locations/{location}/repositories/{repository}/yumArtifacts/{yum_artifact}" + }; + + // Package type is either binary or source. + enum PackageType { + // Package type is not specified. + PACKAGE_TYPE_UNSPECIFIED = 0; + + // Binary package (.rpm). + BINARY = 1; + + // Source package (.srpm). + SOURCE = 2; + } + + // Output only. The Artifact Registry resource name of the artifact. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The yum package name of the artifact. + string package_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. An artifact is a binary or source package. + PackageType package_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Operating system architecture of the artifact. + string architecture = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Google Cloud Storage location where the artifacts currently reside. +message ImportYumArtifactsGcsSource { + // Cloud Storage paths URI (e.g., gs://my_bucket//my_object). + repeated string uris = 1; + + // Supports URI wildcards for matching multiple objects from a single URI. + bool use_wildcards = 2; +} + +// The request to import new yum artifacts. +message ImportYumArtifactsRequest { + // The source location of the package binaries. + oneof source { + // Google Cloud Storage location where input content is located. + ImportYumArtifactsGcsSource gcs_source = 2; + } + + // The name of the parent resource where the artifacts will be imported. + string parent = 1; +} + +// Error information explaining why a package was not imported. +message ImportYumArtifactsErrorInfo { + // The source that was not imported. + oneof source { + // Google Cloud Storage location requested. + ImportYumArtifactsGcsSource gcs_source = 1; + } + + // The detailed error status. + google.rpc.Status error = 2; +} + +// The response message from importing YUM artifacts. +message ImportYumArtifactsResponse { + // The yum artifacts imported. + repeated YumArtifact yum_artifacts = 1; + + // Detailed error info for artifacts that were not imported. + repeated ImportYumArtifactsErrorInfo errors = 2; +} + +// The operation metadata for importing artifacts. +message ImportYumArtifactsMetadata { +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_repository.js new file mode 100644 index 00000000000..9341f250462 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_repository.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 artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 parent resource where the repository will be created. + */ + // const parent = 'abc123' + /** + * The repository id to use for this repository. + */ + // const repositoryId = 'abc123' + /** + * The repository to be created. + */ + // const repository = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callCreateRepository() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await artifactregistryClient.createRepository(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateRepository(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_tag.js new file mode 100644 index 00000000000..8e2e6007230 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_tag.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() { + // [START artifactregistry_v1beta2_generated_ArtifactRegistry_CreateTag_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the parent resource where the tag will be created. + */ + // const parent = 'abc123' + /** + * The tag id to use for this repository. + */ + // const tagId = 'abc123' + /** + * The tag to be created. + */ + // const tag = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callCreateTag() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.createTag(request); + console.log(response); + } + + callCreateTag(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_CreateTag_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_package.js new file mode 100644 index 00000000000..cdd58e430bf --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_package.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 artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the package to delete. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callDeletePackage() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await artifactregistryClient.deletePackage(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeletePackage(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_repository.js new file mode 100644 index 00000000000..9348b99dcf4 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_repository.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 artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 repository to delete. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callDeleteRepository() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await artifactregistryClient.deleteRepository(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteRepository(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_tag.js new file mode 100644 index 00000000000..925cc99351c --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_tag.js @@ -0,0 +1,60 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteTag_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the tag to delete. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callDeleteTag() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.deleteTag(request); + console.log(response); + } + + callDeleteTag(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteTag_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_version.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_version.js new file mode 100644 index 00000000000..c7200680120 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_version.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 artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the version to delete. + */ + // const name = 'abc123' + /** + * By default, a version that is tagged may not be deleted. If force=true, the + * version and any tags pointing to the version are deleted. + */ + // const force = true + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callDeleteVersion() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await artifactregistryClient.deleteVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteVersion(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_file.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_file.js new file mode 100644 index 00000000000..b799deb6d63 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_file.js @@ -0,0 +1,60 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 artifactregistry_v1beta2_generated_ArtifactRegistry_GetFile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the file to retrieve. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetFile() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.getFile(request); + console.log(response); + } + + callGetFile(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetFile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_iam_policy.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_iam_policy.js new file mode 100644 index 00000000000..e59a3b8fd5d --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.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 artifactregistry_v1beta2_generated_ArtifactRegistry_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 Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await artifactregistryClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_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-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_package.js new file mode 100644 index 00000000000..9c19f11c032 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_package.js @@ -0,0 +1,60 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 artifactregistry_v1beta2_generated_ArtifactRegistry_GetPackage_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the package to retrieve. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetPackage() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.getPackage(request); + console.log(response); + } + + callGetPackage(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetPackage_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_project_settings.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_project_settings.js new file mode 100644 index 00000000000..d10d842e05e --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_project_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 artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 projectSettings resource. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetProjectSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await artifactregistryClient.getProjectSettings(request); + console.log(response); + } + + callGetProjectSettings(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_repository.js new file mode 100644 index 00000000000..0ddb274a142 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_repository.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 artifactregistry_v1beta2_generated_ArtifactRegistry_GetRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 repository to retrieve. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetRepository() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await artifactregistryClient.getRepository(request); + console.log(response); + } + + callGetRepository(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_tag.js new file mode 100644 index 00000000000..509bc806a28 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_tag.js @@ -0,0 +1,60 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 artifactregistry_v1beta2_generated_ArtifactRegistry_GetTag_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the tag to retrieve. + */ + // const name = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetTag() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.getTag(request); + console.log(response); + } + + callGetTag(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetTag_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_version.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_version.js new file mode 100644 index 00000000000..9f76a47b6ad --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_version.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() { + // [START artifactregistry_v1beta2_generated_ArtifactRegistry_GetVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the version to retrieve. + */ + // const name = 'abc123' + /** + * The view that should be returned in the response. + */ + // const view = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callGetVersion() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.getVersion(request); + console.log(response); + } + + callGetVersion(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_apt_artifacts.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_apt_artifacts.js new file mode 100644 index 00000000000..b68e743cf10 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_apt_artifacts.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() { + // [START artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Google Cloud Storage location where input content is located. + */ + // const gcsSource = {} + /** + * The name of the parent resource where the artifacts will be imported. + */ + // const parent = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callImportAptArtifacts() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await artifactregistryClient.importAptArtifacts(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportAptArtifacts(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_yum_artifacts.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_yum_artifacts.js new file mode 100644 index 00000000000..ac6f7be7cab --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_yum_artifacts.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() { + // [START artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Google Cloud Storage location where input content is located. + */ + // const gcsSource = {} + /** + * The name of the parent resource where the artifacts will be imported. + */ + // const parent = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callImportYumArtifacts() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await artifactregistryClient.importYumArtifacts(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportYumArtifacts(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_files.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_files.js new file mode 100644 index 00000000000..d67e9249ac0 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_files.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() { + // [START artifactregistry_v1beta2_generated_ArtifactRegistry_ListFiles_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the repository whose files will be listed. For example: + * "projects/p1/locations/us-central1/repositories/repo1 + */ + // const parent = 'abc123' + /** + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `name` + * * `owner` + * An example of using a filter: + * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an + * ID starting with "a/b/". + * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> + * Files owned by the version `1.0` in package `pkg1`. + */ + // const filter = 'abc123' + /** + * The maximum number of files to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListFiles() { + // Construct request + const request = { + }; + + // Run request + const iterable = await artifactregistryClient.listFilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFiles(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ListFiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_packages.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_packages.js new file mode 100644 index 00000000000..44043b4989b --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_packages.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() { + // [START artifactregistry_v1beta2_generated_ArtifactRegistry_ListPackages_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the parent resource whose packages will be listed. + */ + // const parent = 'abc123' + /** + * The maximum number of packages to return. + * Maximum page size is 10,000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListPackages() { + // Construct request + const request = { + }; + + // Run request + const iterable = await artifactregistryClient.listPackagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListPackages(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ListPackages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_repositories.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_repositories.js new file mode 100644 index 00000000000..e6bca968d90 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_repositories.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(parent) { + // [START artifactregistry_v1beta2_generated_ArtifactRegistry_ListRepositories_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 parent resource whose repositories will be listed. + */ + // const parent = 'abc123' + /** + * The maximum number of repositories to return. Maximum page size is 1,000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListRepositories() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await artifactregistryClient.listRepositoriesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRepositories(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ListRepositories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_tags.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_tags.js new file mode 100644 index 00000000000..1a948f679d2 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_tags.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 artifactregistry_v1beta2_generated_ArtifactRegistry_ListTags_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the parent resource whose tags will be listed. + */ + // const parent = 'abc123' + /** + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `version` + * An example of using a filter: + * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` + * --> Tags that are applied to the version `1.0` in package `pkg1`. + */ + // const filter = 'abc123' + /** + * The maximum number of tags to return. Maximum page size is 10,000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListTags() { + // Construct request + const request = { + }; + + // Run request + const iterable = await artifactregistryClient.listTagsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListTags(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ListTags_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_versions.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_versions.js new file mode 100644 index 00000000000..8172e26ca8c --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_versions.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 artifactregistry_v1beta2_generated_ArtifactRegistry_ListVersions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the parent resource whose versions will be listed. + */ + // const parent = 'abc123' + /** + * The maximum number of versions to return. Maximum page size is 1,000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + /** + * The view that should be returned in the response. + */ + // const view = {} + /** + * Optional. The field to order the results by. + */ + // const orderBy = 'abc123' + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callListVersions() { + // Construct request + const request = { + }; + + // Run request + const iterable = await artifactregistryClient.listVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListVersions(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ListVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.set_iam_policy.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.set_iam_policy.js new file mode 100644 index 00000000000..98e1c63e556 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.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 artifactregistry_v1beta2_generated_ArtifactRegistry_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 Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await artifactregistryClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_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-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.test_iam_permissions.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.test_iam_permissions.js new file mode 100644 index 00000000000..56088e2484a --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.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 artifactregistry_v1beta2_generated_ArtifactRegistry_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 Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await artifactregistryClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_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-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_project_settings.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_project_settings.js new file mode 100644 index 00000000000..1d5093e9948 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_project_settings.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() { + // [START artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateProjectSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 settings. + */ + // const projectSettings = {} + /** + * Field mask to support partial updates. + */ + // const updateMask = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callUpdateProjectSettings() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.updateProjectSettings(request); + console.log(response); + } + + callUpdateProjectSettings(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateProjectSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_repository.js new file mode 100644 index 00000000000..d4aa1d3a222 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_repository.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 artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 repository that replaces the resource on the server. + */ + // const repository = {} + /** + * The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callUpdateRepository() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.updateRepository(request); + console.log(response); + } + + callUpdateRepository(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_tag.js new file mode 100644 index 00000000000..587b8ffe2f6 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_tag.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 artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateTag_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 tag that replaces the resource on the server. + */ + // const tag = {} + /** + * The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Artifactregistry library + const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; + + // Instantiates a client + const artifactregistryClient = new ArtifactRegistryClient(); + + async function callUpdateTag() { + // Construct request + const request = { + }; + + // Run request + const response = await artifactregistryClient.updateTag(request); + console.log(response); + } + + callUpdateTag(); + // [END artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateTag_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/snippet_metadata_google.devtools.artifactregistry.v1beta2.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/snippet_metadata_google.devtools.artifactregistry.v1beta2.json new file mode 100644 index 00000000000..e51d58b7b1b --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/snippet_metadata_google.devtools.artifactregistry.v1beta2.json @@ -0,0 +1,1131 @@ +{ + "clientLibrary": { + "name": "nodejs-artifactregistry", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.devtools.artifactregistry.v1beta2", + "version": "v1beta2" + } + ] + }, + "snippets": [ + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_async", + "title": "ArtifactRegistry importAptArtifacts Sample", + "origin": "API_DEFINITION", + "description": " Imports Apt artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.", + "canonical": true, + "file": "artifact_registry.import_apt_artifacts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportAptArtifacts", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportAptArtifacts", + "async": true, + "parameters": [ + { + "name": "gcs_source", + "type": ".google.devtools.artifactregistry.v1beta2.ImportAptArtifactsGcsSource" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "ImportAptArtifacts", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportAptArtifacts", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_async", + "title": "ArtifactRegistry importYumArtifacts Sample", + "origin": "API_DEFINITION", + "description": " Imports Yum (RPM) artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.", + "canonical": true, + "file": "artifact_registry.import_yum_artifacts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportYumArtifacts", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportYumArtifacts", + "async": true, + "parameters": [ + { + "name": "gcs_source", + "type": ".google.devtools.artifactregistry.v1beta2.ImportYumArtifactsGcsSource" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "ImportYumArtifacts", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportYumArtifacts", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListRepositories_async", + "title": "ArtifactRegistry listRepositories Sample", + "origin": "API_DEFINITION", + "description": " Lists repositories.", + "canonical": true, + "file": "artifact_registry.list_repositories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRepositories", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListRepositories", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.ListRepositoriesResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListRepositories", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListRepositories", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetRepository_async", + "title": "ArtifactRegistry getRepository Sample", + "origin": "API_DEFINITION", + "description": " Gets a repository.", + "canonical": true, + "file": "artifact_registry.get_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRepository", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetRepository", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.Repository", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetRepository", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetRepository", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_async", + "title": "ArtifactRegistry createRepository Sample", + "origin": "API_DEFINITION", + "description": " Creates a repository. The returned Operation will finish once the repository has been created. Its response will be the created Repository.", + "canonical": true, + "file": "artifact_registry.create_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateRepository", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateRepository", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "repository_id", + "type": "TYPE_STRING" + }, + { + "name": "repository", + "type": ".google.devtools.artifactregistry.v1beta2.Repository" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "CreateRepository", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateRepository", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateRepository_async", + "title": "ArtifactRegistry updateRepository Sample", + "origin": "API_DEFINITION", + "description": " Updates a repository.", + "canonical": true, + "file": "artifact_registry.update_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateRepository", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateRepository", + "async": true, + "parameters": [ + { + "name": "repository", + "type": ".google.devtools.artifactregistry.v1beta2.Repository" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.Repository", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "UpdateRepository", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateRepository", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_async", + "title": "ArtifactRegistry deleteRepository Sample", + "origin": "API_DEFINITION", + "description": " Deletes a repository and all of its contents. The returned Operation will finish once the repository has been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response.", + "canonical": true, + "file": "artifact_registry.delete_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteRepository", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteRepository", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "DeleteRepository", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteRepository", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListPackages_async", + "title": "ArtifactRegistry listPackages Sample", + "origin": "API_DEFINITION", + "description": " Lists packages.", + "canonical": true, + "file": "artifact_registry.list_packages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListPackages", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListPackages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.ListPackagesResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListPackages", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListPackages", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetPackage_async", + "title": "ArtifactRegistry getPackage Sample", + "origin": "API_DEFINITION", + "description": " Gets a package.", + "canonical": true, + "file": "artifact_registry.get_package.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetPackage", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetPackage", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.Package", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetPackage", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetPackage", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_async", + "title": "ArtifactRegistry deletePackage Sample", + "origin": "API_DEFINITION", + "description": " Deletes a package and all of its versions and tags. The returned operation will complete once the package has been deleted.", + "canonical": true, + "file": "artifact_registry.delete_package.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePackage", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeletePackage", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "DeletePackage", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeletePackage", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListVersions_async", + "title": "ArtifactRegistry listVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists versions.", + "canonical": true, + "file": "artifact_registry.list_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListVersions", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListVersions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.devtools.artifactregistry.v1beta2.VersionView" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.ListVersionsResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListVersions", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListVersions", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetVersion_async", + "title": "ArtifactRegistry getVersion Sample", + "origin": "API_DEFINITION", + "description": " Gets a version", + "canonical": true, + "file": "artifact_registry.get_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVersion", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.devtools.artifactregistry.v1beta2.VersionView" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.Version", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetVersion", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetVersion", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_async", + "title": "ArtifactRegistry deleteVersion Sample", + "origin": "API_DEFINITION", + "description": " Deletes a version and all of its content. The returned operation will complete once the version has been deleted.", + "canonical": true, + "file": "artifact_registry.delete_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteVersion", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "DeleteVersion", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteVersion", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListFiles_async", + "title": "ArtifactRegistry listFiles Sample", + "origin": "API_DEFINITION", + "description": " Lists files.", + "canonical": true, + "file": "artifact_registry.list_files.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFiles", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListFiles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.ListFilesResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListFiles", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListFiles", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetFile_async", + "title": "ArtifactRegistry getFile Sample", + "origin": "API_DEFINITION", + "description": " Gets a file.", + "canonical": true, + "file": "artifact_registry.get_file.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFile", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetFile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.File", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetFile", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetFile", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListTags_async", + "title": "ArtifactRegistry listTags Sample", + "origin": "API_DEFINITION", + "description": " Lists tags.", + "canonical": true, + "file": "artifact_registry.list_tags.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListTags", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListTags", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.ListTagsResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "ListTags", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListTags", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetTag_async", + "title": "ArtifactRegistry getTag Sample", + "origin": "API_DEFINITION", + "description": " Gets a tag.", + "canonical": true, + "file": "artifact_registry.get_tag.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetTag", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetTag", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.Tag", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetTag", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetTag", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_CreateTag_async", + "title": "ArtifactRegistry createTag Sample", + "origin": "API_DEFINITION", + "description": " Creates a tag.", + "canonical": true, + "file": "artifact_registry.create_tag.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateTag", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateTag", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "tag_id", + "type": "TYPE_STRING" + }, + { + "name": "tag", + "type": ".google.devtools.artifactregistry.v1beta2.Tag" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.Tag", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "CreateTag", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateTag", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateTag_async", + "title": "ArtifactRegistry updateTag Sample", + "origin": "API_DEFINITION", + "description": " Updates a tag.", + "canonical": true, + "file": "artifact_registry.update_tag.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateTag", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateTag", + "async": true, + "parameters": [ + { + "name": "tag", + "type": ".google.devtools.artifactregistry.v1beta2.Tag" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.Tag", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "UpdateTag", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateTag", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteTag_async", + "title": "ArtifactRegistry deleteTag Sample", + "origin": "API_DEFINITION", + "description": " Deletes a tag.", + "canonical": true, + "file": "artifact_registry.delete_tag.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteTag", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteTag", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "DeleteTag", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteTag", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_SetIamPolicy_async", + "title": "ArtifactRegistry setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Updates the IAM policy for a given resource.", + "canonical": true, + "file": "artifact_registry.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.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": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.SetIamPolicy", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetIamPolicy_async", + "title": "ArtifactRegistry getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the IAM policy for a given resource.", + "canonical": true, + "file": "artifact_registry.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetIamPolicy", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_TestIamPermissions_async", + "title": "ArtifactRegistry testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Tests if the caller has a list of permissions on a resource.", + "canonical": true, + "file": "artifact_registry.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.TestIamPermissions", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_async", + "title": "ArtifactRegistry getProjectSettings Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the Settings for the Project.", + "canonical": true, + "file": "artifact_registry.get_project_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProjectSettings", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetProjectSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.ProjectSettings", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "GetProjectSettings", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetProjectSettings", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + }, + { + "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateProjectSettings_async", + "title": "ArtifactRegistry updateProjectSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates the Settings for the Project.", + "canonical": true, + "file": "artifact_registry.update_project_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProjectSettings", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateProjectSettings", + "async": true, + "parameters": [ + { + "name": "project_settings", + "type": ".google.devtools.artifactregistry.v1beta2.ProjectSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.devtools.artifactregistry.v1beta2.ProjectSettings", + "client": { + "shortName": "ArtifactRegistryClient", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" + }, + "method": { + "shortName": "UpdateProjectSettings", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateProjectSettings", + "service": { + "shortName": "ArtifactRegistry", + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/index.ts new file mode 100644 index 00000000000..099762b291a --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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 ArtifactRegistryClient = v1beta2.ArtifactRegistryClient; +type ArtifactRegistryClient = v1beta2.ArtifactRegistryClient; +export {v1beta2, ArtifactRegistryClient}; +export default {v1beta2, ArtifactRegistryClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client.ts new file mode 100644 index 00000000000..bc4a31eee27 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client.ts @@ -0,0 +1,3439 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/artifact_registry_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './artifact_registry_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Artifact Registry API service. + * + * Artifact Registry is an artifact management system for storing artifacts + * from different package management systems. + * + * The resources managed by this API are: + * + * * Repositories, which group packages and their data. + * * Packages, which group versions and their tags. + * * Versions, which are specific forms of a package. + * * Tags, which represent alternative names for versions. + * * Files, which contain content and are optionally associated with a Package + * or Version. + * @class + * @memberof v1beta2 + */ +export class ArtifactRegistryClient { + 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; + artifactRegistryStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ArtifactRegistryClient. + * + * @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 ArtifactRegistryClient({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 ArtifactRegistryClient; + 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 = { + aptArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}' + ), + filePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/files/{file}' + ), + projectSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/projectSettings' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}' + ), + tagPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}' + ), + yumArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}/yumArtifacts/{yum_artifact}' + ), + }; + + // 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 = { + listRepositories: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories'), + listPackages: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'packages'), + listVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'versions'), + listFiles: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'files'), + listTags: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tags') + }; + + 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.GetOperation',get: '/v1beta2/{name=projects/*/locations/*/operations/*}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const importAptArtifactsResponse = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsResponse') as gax.protobuf.Type; + const importAptArtifactsMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsMetadata') as gax.protobuf.Type; + const importYumArtifactsResponse = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsResponse') as gax.protobuf.Type; + const importYumArtifactsMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsMetadata') as gax.protobuf.Type; + const createRepositoryResponse = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1beta2.Repository') as gax.protobuf.Type; + const createRepositoryMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1beta2.OperationMetadata') as gax.protobuf.Type; + const deleteRepositoryResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteRepositoryMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1beta2.OperationMetadata') as gax.protobuf.Type; + const deletePackageResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deletePackageMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1beta2.OperationMetadata') as gax.protobuf.Type; + const deleteVersionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteVersionMetadata = protoFilesRoot.lookup( + '.google.devtools.artifactregistry.v1beta2.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + importAptArtifacts: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importAptArtifactsResponse.decode.bind(importAptArtifactsResponse), + importAptArtifactsMetadata.decode.bind(importAptArtifactsMetadata)), + importYumArtifacts: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importYumArtifactsResponse.decode.bind(importYumArtifactsResponse), + importYumArtifactsMetadata.decode.bind(importYumArtifactsMetadata)), + createRepository: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createRepositoryResponse.decode.bind(createRepositoryResponse), + createRepositoryMetadata.decode.bind(createRepositoryMetadata)), + deleteRepository: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteRepositoryResponse.decode.bind(deleteRepositoryResponse), + deleteRepositoryMetadata.decode.bind(deleteRepositoryMetadata)), + deletePackage: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deletePackageResponse.decode.bind(deletePackageResponse), + deletePackageMetadata.decode.bind(deletePackageMetadata)), + deleteVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteVersionResponse.decode.bind(deleteVersionResponse), + deleteVersionMetadata.decode.bind(deleteVersionMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.devtools.artifactregistry.v1beta2.ArtifactRegistry', 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.artifactRegistryStub) { + return this.artifactRegistryStub; + } + + // Put together the "service stub" for + // google.devtools.artifactregistry.v1beta2.ArtifactRegistry. + this.artifactRegistryStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.devtools.artifactregistry.v1beta2.ArtifactRegistry') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devtools.artifactregistry.v1beta2.ArtifactRegistry, + 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 artifactRegistryStubMethods = + ['importAptArtifacts', 'importYumArtifacts', 'listRepositories', 'getRepository', 'createRepository', 'updateRepository', 'deleteRepository', 'listPackages', 'getPackage', 'deletePackage', 'listVersions', 'getVersion', 'deleteVersion', 'listFiles', 'getFile', 'listTags', 'getTag', 'createTag', 'updateTag', 'deleteTag', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'getProjectSettings', 'updateProjectSettings']; + for (const methodName of artifactRegistryStubMethods) { + const callPromise = this.artifactRegistryStub.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.artifactRegistryStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'artifactregistry.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 'artifactregistry.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/cloud-platform.read-only' + ]; + } + + 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 a repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the repository to retrieve. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.Repository|Repository}. + * Please see the {@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/artifact_registry.get_repository.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetRepository_async + */ + getRepository( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|undefined, {}|undefined + ]>; + getRepository( + request: protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): void; + getRepository( + request: protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): void; + getRepository( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getRepository(request, options, callback); + } +/** + * Updates a repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.artifactregistry.v1beta2.Repository} request.repository + * The repository that replaces the resource on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The update mask applies to the resource. For the `FieldMask` definition, + * 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.devtools.artifactregistry.v1beta2.Repository|Repository}. + * Please see the {@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/artifact_registry.update_repository.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateRepository_async + */ + updateRepository( + request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|undefined, {}|undefined + ]>; + updateRepository( + request: protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|null|undefined, + {}|null|undefined>): void; + updateRepository( + request: protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|null|undefined, + {}|null|undefined>): void; + updateRepository( + request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IRepository, + protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'repository.name': request.repository!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateRepository(request, options, callback); + } +/** + * Gets a package. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the package to retrieve. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.Package|Package}. + * Please see the {@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/artifact_registry.get_package.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetPackage_async + */ + getPackage( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IPackage, + protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|undefined, {}|undefined + ]>; + getPackage( + request: protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IPackage, + protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|null|undefined, + {}|null|undefined>): void; + getPackage( + request: protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IPackage, + protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|null|undefined, + {}|null|undefined>): void; + getPackage( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1beta2.IPackage, + protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1beta2.IPackage, + protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IPackage, + protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getPackage(request, options, callback); + } +/** + * Gets a version + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the version to retrieve. + * @param {google.devtools.artifactregistry.v1beta2.VersionView} request.view + * The view that should be returned in the response. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.Version|Version}. + * Please see the {@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/artifact_registry.get_version.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetVersion_async + */ + getVersion( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IVersion, + protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|undefined, {}|undefined + ]>; + getVersion( + request: protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IVersion, + protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|null|undefined, + {}|null|undefined>): void; + getVersion( + request: protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IVersion, + protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|null|undefined, + {}|null|undefined>): void; + getVersion( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1beta2.IVersion, + protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1beta2.IVersion, + protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IVersion, + protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getVersion(request, options, callback); + } +/** + * Gets a file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the file to retrieve. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.File|File}. + * Please see the {@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/artifact_registry.get_file.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetFile_async + */ + getFile( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IFile, + protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|undefined, {}|undefined + ]>; + getFile( + request: protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IFile, + protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|null|undefined, + {}|null|undefined>): void; + getFile( + request: protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IFile, + protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|null|undefined, + {}|null|undefined>): void; + getFile( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1beta2.IFile, + protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1beta2.IFile, + protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IFile, + protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFile(request, options, callback); + } +/** + * Gets a tag. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the tag to retrieve. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.Tag|Tag}. + * Please see the {@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/artifact_registry.get_tag.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetTag_async + */ + getTag( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|undefined, {}|undefined + ]>; + getTag( + request: protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|null|undefined, + {}|null|undefined>): void; + getTag( + request: protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|null|undefined, + {}|null|undefined>): void; + getTag( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getTag(request, options, callback); + } +/** + * Creates a tag. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the parent resource where the tag will be created. + * @param {string} request.tagId + * The tag id to use for this repository. + * @param {google.devtools.artifactregistry.v1beta2.Tag} request.tag + * The tag 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.devtools.artifactregistry.v1beta2.Tag|Tag}. + * Please see the {@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/artifact_registry.create_tag.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_CreateTag_async + */ + createTag( + request?: protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|undefined, {}|undefined + ]>; + createTag( + request: protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|null|undefined, + {}|null|undefined>): void; + createTag( + request: protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|null|undefined, + {}|null|undefined>): void; + createTag( + request?: protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createTag(request, options, callback); + } +/** + * Updates a tag. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.artifactregistry.v1beta2.Tag} request.tag + * The tag that replaces the resource on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The update mask applies to the resource. For the `FieldMask` definition, + * 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.devtools.artifactregistry.v1beta2.Tag|Tag}. + * Please see the {@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/artifact_registry.update_tag.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateTag_async + */ + updateTag( + request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|undefined, {}|undefined + ]>; + updateTag( + request: protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|null|undefined, + {}|null|undefined>): void; + updateTag( + request: protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|null|undefined, + {}|null|undefined>): void; + updateTag( + request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.ITag, + protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'tag.name': request.tag!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateTag(request, options, callback); + } +/** + * Deletes a tag. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the tag to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1beta2/artifact_registry.delete_tag.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteTag_async + */ + deleteTag( + request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|undefined, {}|undefined + ]>; + deleteTag( + request: protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|null|undefined, + {}|null|undefined>): void; + deleteTag( + request: protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|null|undefined, + {}|null|undefined>): void; + deleteTag( + request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteTag(request, options, callback); + } +/** + * Updates the IAM policy for a given resource. + * + * @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/v1beta2/artifact_registry.set_iam_policy.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_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 policy for a given resource. + * + * @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/v1beta2/artifact_registry.get_iam_policy.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_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 if the caller has a list of permissions on a resource. + * + * @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/v1beta2/artifact_registry.test_iam_permissions.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_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); + } +/** + * Retrieves the Settings for the Project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the projectSettings 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.devtools.artifactregistry.v1beta2.ProjectSettings|ProjectSettings}. + * Please see the {@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/artifact_registry.get_project_settings.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_async + */ + getProjectSettings( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|undefined, {}|undefined + ]>; + getProjectSettings( + request: protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|null|undefined, + {}|null|undefined>): void; + getProjectSettings( + request: protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|null|undefined, + {}|null|undefined>): void; + getProjectSettings( + request?: protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getProjectSettings(request, options, callback); + } +/** + * Updates the Settings for the Project. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.artifactregistry.v1beta2.ProjectSettings} request.projectSettings + * The project settings. + * @param {google.protobuf.FieldMask} request.updateMask + * Field mask to support partial updates. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.ProjectSettings|ProjectSettings}. + * Please see the {@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/artifact_registry.update_project_settings.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateProjectSettings_async + */ + updateProjectSettings( + request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|undefined, {}|undefined + ]>; + updateProjectSettings( + request: protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateProjectSettings( + request: protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest, + callback: Callback< + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateProjectSettings( + request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, + protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_settings.name': request.projectSettings!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateProjectSettings(request, options, callback); + } + +/** + * Imports Apt artifacts. The returned Operation will complete once the + * resources are imported. Package, Version, and File resources are created + * based on the imported artifacts. Imported artifacts that conflict with + * existing resources are ignored. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.artifactregistry.v1beta2.ImportAptArtifactsGcsSource} request.gcsSource + * Google Cloud Storage location where input content is located. + * @param {string} request.parent + * The name of the parent resource where the artifacts will be imported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/artifact_registry.import_apt_artifacts.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_async + */ + importAptArtifacts( + request?: protos.google.devtools.artifactregistry.v1beta2.IImportAptArtifactsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + importAptArtifacts( + request: protos.google.devtools.artifactregistry.v1beta2.IImportAptArtifactsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importAptArtifacts( + request: protos.google.devtools.artifactregistry.v1beta2.IImportAptArtifactsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importAptArtifacts( + request?: protos.google.devtools.artifactregistry.v1beta2.IImportAptArtifactsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.importAptArtifacts(request, options, callback); + } +/** + * Check the status of the long running operation returned by `importAptArtifacts()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/artifact_registry.import_apt_artifacts.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_async + */ + async checkImportAptArtifactsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importAptArtifacts, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Imports Yum (RPM) artifacts. The returned Operation will complete once the + * resources are imported. Package, Version, and File resources are created + * based on the imported artifacts. Imported artifacts that conflict with + * existing resources are ignored. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.artifactregistry.v1beta2.ImportYumArtifactsGcsSource} request.gcsSource + * Google Cloud Storage location where input content is located. + * @param {string} request.parent + * The name of the parent resource where the artifacts will be imported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/artifact_registry.import_yum_artifacts.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_async + */ + importYumArtifacts( + request?: protos.google.devtools.artifactregistry.v1beta2.IImportYumArtifactsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + importYumArtifacts( + request: protos.google.devtools.artifactregistry.v1beta2.IImportYumArtifactsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importYumArtifacts( + request: protos.google.devtools.artifactregistry.v1beta2.IImportYumArtifactsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importYumArtifacts( + request?: protos.google.devtools.artifactregistry.v1beta2.IImportYumArtifactsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.importYumArtifacts(request, options, callback); + } +/** + * Check the status of the long running operation returned by `importYumArtifacts()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/artifact_registry.import_yum_artifacts.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_async + */ + async checkImportYumArtifactsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importYumArtifacts, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a repository. The returned Operation will finish once the + * repository has been created. Its response will be the created Repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource where the repository will be created. + * @param {string} request.repositoryId + * The repository id to use for this repository. + * @param {google.devtools.artifactregistry.v1beta2.Repository} request.repository + * The repository 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/v1beta2/artifact_registry.create_repository.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_async + */ + createRepository( + request?: protos.google.devtools.artifactregistry.v1beta2.ICreateRepositoryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createRepository( + request: protos.google.devtools.artifactregistry.v1beta2.ICreateRepositoryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRepository( + request: protos.google.devtools.artifactregistry.v1beta2.ICreateRepositoryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRepository( + request?: protos.google.devtools.artifactregistry.v1beta2.ICreateRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createRepository(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createRepository()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/artifact_registry.create_repository.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_async + */ + async checkCreateRepositoryProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRepository, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a repository and all of its contents. The returned Operation will + * finish once the repository has been deleted. It will not have any Operation + * metadata and will return a google.protobuf.Empty response. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the repository to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/artifact_registry.delete_repository.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_async + */ + deleteRepository( + request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteRepositoryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteRepository( + request: protos.google.devtools.artifactregistry.v1beta2.IDeleteRepositoryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRepository( + request: protos.google.devtools.artifactregistry.v1beta2.IDeleteRepositoryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRepository( + request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteRepository(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteRepository()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/artifact_registry.delete_repository.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_async + */ + async checkDeleteRepositoryProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRepository, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a package and all of its versions and tags. The returned operation + * will complete once the package has been deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the package to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/artifact_registry.delete_package.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_async + */ + deletePackage( + request?: protos.google.devtools.artifactregistry.v1beta2.IDeletePackageRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deletePackage( + request: protos.google.devtools.artifactregistry.v1beta2.IDeletePackageRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePackage( + request: protos.google.devtools.artifactregistry.v1beta2.IDeletePackageRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePackage( + request?: protos.google.devtools.artifactregistry.v1beta2.IDeletePackageRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deletePackage(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deletePackage()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/artifact_registry.delete_package.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_async + */ + async checkDeletePackageProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePackage, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a version and all of its content. The returned operation will + * complete once the version has been deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the version to delete. + * @param {boolean} request.force + * By default, a version that is tagged may not be deleted. If force=true, the + * version and any tags pointing to the version are 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/v1beta2/artifact_registry.delete_version.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_async + */ + deleteVersion( + request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteVersionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteVersion( + request: protos.google.devtools.artifactregistry.v1beta2.IDeleteVersionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteVersion( + request: protos.google.devtools.artifactregistry.v1beta2.IDeleteVersionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteVersion( + request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteVersionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteVersion(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteVersion()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/artifact_registry.delete_version.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_async + */ + async checkDeleteVersionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteVersion, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists repositories. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource whose repositories will be listed. + * @param {number} request.pageSize + * The maximum number of repositories to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Repository|Repository}. + * 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 `listRepositoriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRepositories( + request?: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IRepository[], + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest|null, + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse + ]>; + listRepositories( + request: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IRepository>): void; + listRepositories( + request: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IRepository>): void; + listRepositories( + request?: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IRepository>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IRepository>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IRepository[], + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest|null, + protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listRepositories(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 name of the parent resource whose repositories will be listed. + * @param {number} request.pageSize + * The maximum number of repositories to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Repository|Repository} 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 `listRepositoriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRepositoriesStream( + request?: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, + 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['listRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRepositories.createStream( + this.innerApiCalls.listRepositories as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listRepositories`, 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 name of the parent resource whose repositories will be listed. + * @param {number} request.pageSize + * The maximum number of repositories to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Repository|Repository}. 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/artifact_registry.list_repositories.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ListRepositories_async + */ + listRepositoriesAsync( + request?: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, + 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['listRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRepositories.asyncIterate( + this.innerApiCalls['listRepositories'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists packages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the parent resource whose packages will be listed. + * @param {number} request.pageSize + * The maximum number of packages to return. + * Maximum page size is 10,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Package|Package}. + * 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 `listPackagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPackages( + request?: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IPackage[], + protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest|null, + protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse + ]>; + listPackages( + request: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IPackage>): void; + listPackages( + request: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IPackage>): void; + listPackages( + request?: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IPackage>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IPackage>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IPackage[], + protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest|null, + protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listPackages(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 name of the parent resource whose packages will be listed. + * @param {number} request.pageSize + * The maximum number of packages to return. + * Maximum page size is 10,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Package|Package} 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 `listPackagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPackagesStream( + request?: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, + 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['listPackages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPackages.createStream( + this.innerApiCalls.listPackages as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listPackages`, 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 name of the parent resource whose packages will be listed. + * @param {number} request.pageSize + * The maximum number of packages to return. + * Maximum page size is 10,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Package|Package}. 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/artifact_registry.list_packages.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ListPackages_async + */ + listPackagesAsync( + request?: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, + 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['listPackages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPackages.asyncIterate( + this.innerApiCalls['listPackages'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists versions. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the parent resource whose versions will be listed. + * @param {number} request.pageSize + * The maximum number of versions to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {google.devtools.artifactregistry.v1beta2.VersionView} request.view + * The view that should be returned in the response. + * @param {string} [request.orderBy] + * Optional. The field to order the results by. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.artifactregistry.v1beta2.Version|Version}. + * 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 `listVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVersions( + request?: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IVersion[], + protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest|null, + protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse + ]>; + listVersions( + request: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, + protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IVersion>): void; + listVersions( + request: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, + protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IVersion>): void; + listVersions( + request?: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, + protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IVersion>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, + protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IVersion>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IVersion[], + protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest|null, + protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listVersions(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 name of the parent resource whose versions will be listed. + * @param {number} request.pageSize + * The maximum number of versions to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {google.devtools.artifactregistry.v1beta2.VersionView} request.view + * The view that should be returned in the response. + * @param {string} [request.orderBy] + * Optional. The field to order the results by. + * @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.devtools.artifactregistry.v1beta2.Version|Version} 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 `listVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVersionsStream( + request?: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, + 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['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.createStream( + this.innerApiCalls.listVersions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listVersions`, 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 name of the parent resource whose versions will be listed. + * @param {number} request.pageSize + * The maximum number of versions to return. Maximum page size is 1,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request, if any. + * @param {google.devtools.artifactregistry.v1beta2.VersionView} request.view + * The view that should be returned in the response. + * @param {string} [request.orderBy] + * Optional. The field to order the results by. + * @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.devtools.artifactregistry.v1beta2.Version|Version}. 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/artifact_registry.list_versions.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ListVersions_async + */ + listVersionsAsync( + request?: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, + 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['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.asyncIterate( + this.innerApiCalls['listVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists files. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the repository whose files will be listed. For example: + * "projects/p1/locations/us-central1/repositories/repo1 + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `name` + * * `owner` + * + * An example of using a filter: + * + * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an + * ID starting with "a/b/". + * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> + * Files owned by the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of files to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.File|File}. + * 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 `listFilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFiles( + request?: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IFile[], + protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest|null, + protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse + ]>; + listFiles( + request: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IFile>): void; + listFiles( + request: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IFile>): void; + listFiles( + request?: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IFile>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, + protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.IFile>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.IFile[], + protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest|null, + protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFiles(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 name of the repository whose files will be listed. For example: + * "projects/p1/locations/us-central1/repositories/repo1 + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `name` + * * `owner` + * + * An example of using a filter: + * + * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an + * ID starting with "a/b/". + * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> + * Files owned by the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of files to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.File|File} 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 `listFilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFilesStream( + request?: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, + 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['listFiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFiles.createStream( + this.innerApiCalls.listFiles as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFiles`, 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 name of the repository whose files will be listed. For example: + * "projects/p1/locations/us-central1/repositories/repo1 + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `name` + * * `owner` + * + * An example of using a filter: + * + * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an + * ID starting with "a/b/". + * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> + * Files owned by the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of files to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.File|File}. 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/artifact_registry.list_files.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ListFiles_async + */ + listFilesAsync( + request?: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, + 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['listFiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFiles.asyncIterate( + this.innerApiCalls['listFiles'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists tags. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the parent resource whose tags will be listed. + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `version` + * + * An example of using a filter: + * + * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` + * --> Tags that are applied to the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of tags to return. Maximum page size is 10,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Tag|Tag}. + * 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 `listTagsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listTags( + request?: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.ITag[], + protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest|null, + protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse + ]>; + listTags( + request: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, + protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.ITag>): void; + listTags( + request: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, + callback: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, + protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.ITag>): void; + listTags( + request?: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, + protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.ITag>, + callback?: PaginationCallback< + protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, + protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse|null|undefined, + protos.google.devtools.artifactregistry.v1beta2.ITag>): + Promise<[ + protos.google.devtools.artifactregistry.v1beta2.ITag[], + protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest|null, + protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listTags(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 name of the parent resource whose tags will be listed. + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `version` + * + * An example of using a filter: + * + * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` + * --> Tags that are applied to the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of tags to return. Maximum page size is 10,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Tag|Tag} 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 `listTagsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listTagsStream( + request?: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, + 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['listTags']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTags.createStream( + this.innerApiCalls.listTags as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listTags`, 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 name of the parent resource whose tags will be listed. + * @param {string} request.filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `version` + * + * An example of using a filter: + * + * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` + * --> Tags that are applied to the version `1.0` in package `pkg1`. + * @param {number} request.pageSize + * The maximum number of tags to return. Maximum page size is 10,000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Tag|Tag}. 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/artifact_registry.list_tags.js + * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ListTags_async + */ + listTagsAsync( + request?: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, + 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['listTags']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTags.asyncIterate( + this.innerApiCalls['listTags'] 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); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified aptArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} apt_artifact + * @returns {string} Resource name string. + */ + aptArtifactPath(project:string,location:string,repository:string,aptArtifact:string) { + return this.pathTemplates.aptArtifactPathTemplate.render({ + project: project, + location: location, + repository: repository, + apt_artifact: aptArtifact, + }); + } + + /** + * Parse the project from AptArtifact resource. + * + * @param {string} aptArtifactName + * A fully-qualified path representing AptArtifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAptArtifactName(aptArtifactName: string) { + return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).project; + } + + /** + * Parse the location from AptArtifact resource. + * + * @param {string} aptArtifactName + * A fully-qualified path representing AptArtifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAptArtifactName(aptArtifactName: string) { + return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).location; + } + + /** + * Parse the repository from AptArtifact resource. + * + * @param {string} aptArtifactName + * A fully-qualified path representing AptArtifact resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromAptArtifactName(aptArtifactName: string) { + return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).repository; + } + + /** + * Parse the apt_artifact from AptArtifact resource. + * + * @param {string} aptArtifactName + * A fully-qualified path representing AptArtifact resource. + * @returns {string} A string representing the apt_artifact. + */ + matchAptArtifactFromAptArtifactName(aptArtifactName: string) { + return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).apt_artifact; + } + + /** + * Return a fully-qualified file resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} file + * @returns {string} Resource name string. + */ + filePath(project:string,location:string,repository:string,file:string) { + return this.pathTemplates.filePathTemplate.render({ + project: project, + location: location, + repository: repository, + file: file, + }); + } + + /** + * Parse the project from File resource. + * + * @param {string} fileName + * A fully-qualified path representing File resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFileName(fileName: string) { + return this.pathTemplates.filePathTemplate.match(fileName).project; + } + + /** + * Parse the location from File resource. + * + * @param {string} fileName + * A fully-qualified path representing File resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFileName(fileName: string) { + return this.pathTemplates.filePathTemplate.match(fileName).location; + } + + /** + * Parse the repository from File resource. + * + * @param {string} fileName + * A fully-qualified path representing File resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromFileName(fileName: string) { + return this.pathTemplates.filePathTemplate.match(fileName).repository; + } + + /** + * Parse the file from File resource. + * + * @param {string} fileName + * A fully-qualified path representing File resource. + * @returns {string} A string representing the file. + */ + matchFileFromFileName(fileName: string) { + return this.pathTemplates.filePathTemplate.match(fileName).file; + } + + /** + * Return a fully-qualified projectSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectSettingsPath(project:string) { + return this.pathTemplates.projectSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectSettings resource. + * + * @param {string} projectSettingsName + * A fully-qualified path representing ProjectSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSettingsName(projectSettingsName: string) { + return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).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 tag resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} packageParam + * @param {string} tag + * @returns {string} Resource name string. + */ + tagPath(project:string,location:string,repository:string,packageParam:string,tag:string) { + return this.pathTemplates.tagPathTemplate.render({ + project: project, + location: location, + repository: repository, + package: packageParam, + tag: tag, + }); + } + + /** + * Parse the project from Tag resource. + * + * @param {string} tagName + * A fully-qualified path representing Tag resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTagName(tagName: string) { + return this.pathTemplates.tagPathTemplate.match(tagName).project; + } + + /** + * Parse the location from Tag resource. + * + * @param {string} tagName + * A fully-qualified path representing Tag resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTagName(tagName: string) { + return this.pathTemplates.tagPathTemplate.match(tagName).location; + } + + /** + * Parse the repository from Tag resource. + * + * @param {string} tagName + * A fully-qualified path representing Tag resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromTagName(tagName: string) { + return this.pathTemplates.tagPathTemplate.match(tagName).repository; + } + + /** + * Parse the package from Tag resource. + * + * @param {string} tagName + * A fully-qualified path representing Tag resource. + * @returns {string} A string representing the package. + */ + matchPackageFromTagName(tagName: string) { + return this.pathTemplates.tagPathTemplate.match(tagName).package; + } + + /** + * Parse the tag from Tag resource. + * + * @param {string} tagName + * A fully-qualified path representing Tag resource. + * @returns {string} A string representing the tag. + */ + matchTagFromTagName(tagName: string) { + return this.pathTemplates.tagPathTemplate.match(tagName).tag; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} packageParam + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath(project:string,location:string,repository:string,packageParam:string,version:string) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + repository: repository, + package: packageParam, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the repository from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).repository; + } + + /** + * Parse the package from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the package. + */ + matchPackageFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).package; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified yumArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @param {string} yum_artifact + * @returns {string} Resource name string. + */ + yumArtifactPath(project:string,location:string,repository:string,yumArtifact:string) { + return this.pathTemplates.yumArtifactPathTemplate.render({ + project: project, + location: location, + repository: repository, + yum_artifact: yumArtifact, + }); + } + + /** + * Parse the project from YumArtifact resource. + * + * @param {string} yumArtifactName + * A fully-qualified path representing YumArtifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromYumArtifactName(yumArtifactName: string) { + return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).project; + } + + /** + * Parse the location from YumArtifact resource. + * + * @param {string} yumArtifactName + * A fully-qualified path representing YumArtifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromYumArtifactName(yumArtifactName: string) { + return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).location; + } + + /** + * Parse the repository from YumArtifact resource. + * + * @param {string} yumArtifactName + * A fully-qualified path representing YumArtifact resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromYumArtifactName(yumArtifactName: string) { + return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).repository; + } + + /** + * Parse the yum_artifact from YumArtifact resource. + * + * @param {string} yumArtifactName + * A fully-qualified path representing YumArtifact resource. + * @returns {string} A string representing the yum_artifact. + */ + matchYumArtifactFromYumArtifactName(yumArtifactName: string) { + return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).yum_artifact; + } + + /** + * 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.artifactRegistryStub && !this._terminated) { + return this.artifactRegistryStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client_config.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client_config.json new file mode 100644 index 00000000000..6d2c27103c7 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client_config.json @@ -0,0 +1,149 @@ +{ + "interfaces": { + "google.devtools.artifactregistry.v1beta2.ArtifactRegistry": { + "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 + } + }, + "methods": { + "ImportAptArtifacts": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ImportYumArtifacts": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRepositories": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetRepository": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateRepository": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateRepository": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteRepository": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListPackages": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetPackage": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeletePackage": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListVersions": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetVersion": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteVersion": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListFiles": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetFile": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListTags": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetTag": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateTag": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateTag": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteTag": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetProjectSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateProjectSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_proto_list.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_proto_list.json new file mode 100644 index 00000000000..f32513655ac --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_proto_list.json @@ -0,0 +1,11 @@ +[ + "../../protos/google/devtools/artifactregistry/v1beta2/apt_artifact.proto", + "../../protos/google/devtools/artifactregistry/v1beta2/file.proto", + "../../protos/google/devtools/artifactregistry/v1beta2/package.proto", + "../../protos/google/devtools/artifactregistry/v1beta2/repository.proto", + "../../protos/google/devtools/artifactregistry/v1beta2/service.proto", + "../../protos/google/devtools/artifactregistry/v1beta2/settings.proto", + "../../protos/google/devtools/artifactregistry/v1beta2/tag.proto", + "../../protos/google/devtools/artifactregistry/v1beta2/version.proto", + "../../protos/google/devtools/artifactregistry/v1beta2/yum_artifact.proto" +] diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/gapic_metadata.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/gapic_metadata.json new file mode 100644 index 00000000000..a4830e36e2c --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/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.devtools.artifactregistry.v1beta2", + "libraryPackage": "@google-cloud/artifact-registry", + "services": { + "ArtifactRegistry": { + "clients": { + "grpc": { + "libraryClient": "ArtifactRegistryClient", + "rpcs": { + "GetRepository": { + "methods": [ + "getRepository" + ] + }, + "UpdateRepository": { + "methods": [ + "updateRepository" + ] + }, + "GetPackage": { + "methods": [ + "getPackage" + ] + }, + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "GetFile": { + "methods": [ + "getFile" + ] + }, + "GetTag": { + "methods": [ + "getTag" + ] + }, + "CreateTag": { + "methods": [ + "createTag" + ] + }, + "UpdateTag": { + "methods": [ + "updateTag" + ] + }, + "DeleteTag": { + "methods": [ + "deleteTag" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "GetProjectSettings": { + "methods": [ + "getProjectSettings" + ] + }, + "UpdateProjectSettings": { + "methods": [ + "updateProjectSettings" + ] + }, + "ImportAptArtifacts": { + "methods": [ + "importAptArtifacts" + ] + }, + "ImportYumArtifacts": { + "methods": [ + "importYumArtifacts" + ] + }, + "CreateRepository": { + "methods": [ + "createRepository" + ] + }, + "DeleteRepository": { + "methods": [ + "deleteRepository" + ] + }, + "DeletePackage": { + "methods": [ + "deletePackage" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListRepositories": { + "methods": [ + "listRepositories", + "listRepositoriesStream", + "listRepositoriesAsync" + ] + }, + "ListPackages": { + "methods": [ + "listPackages", + "listPackagesStream", + "listPackagesAsync" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + }, + "ListFiles": { + "methods": [ + "listFiles", + "listFilesStream", + "listFilesAsync" + ] + }, + "ListTags": { + "methods": [ + "listTags", + "listTagsStream", + "listTagsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ArtifactRegistryClient", + "rpcs": { + "GetRepository": { + "methods": [ + "getRepository" + ] + }, + "UpdateRepository": { + "methods": [ + "updateRepository" + ] + }, + "GetPackage": { + "methods": [ + "getPackage" + ] + }, + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "GetFile": { + "methods": [ + "getFile" + ] + }, + "GetTag": { + "methods": [ + "getTag" + ] + }, + "CreateTag": { + "methods": [ + "createTag" + ] + }, + "UpdateTag": { + "methods": [ + "updateTag" + ] + }, + "DeleteTag": { + "methods": [ + "deleteTag" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "GetProjectSettings": { + "methods": [ + "getProjectSettings" + ] + }, + "UpdateProjectSettings": { + "methods": [ + "updateProjectSettings" + ] + }, + "ImportAptArtifacts": { + "methods": [ + "importAptArtifacts" + ] + }, + "ImportYumArtifacts": { + "methods": [ + "importYumArtifacts" + ] + }, + "CreateRepository": { + "methods": [ + "createRepository" + ] + }, + "DeleteRepository": { + "methods": [ + "deleteRepository" + ] + }, + "DeletePackage": { + "methods": [ + "deletePackage" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListRepositories": { + "methods": [ + "listRepositories", + "listRepositoriesStream", + "listRepositoriesAsync" + ] + }, + "ListPackages": { + "methods": [ + "listPackages", + "listPackagesStream", + "listPackagesAsync" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + }, + "ListFiles": { + "methods": [ + "listFiles", + "listFilesStream", + "listFilesAsync" + ] + }, + "ListTags": { + "methods": [ + "listTags", + "listTagsStream", + "listTagsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/index.ts new file mode 100644 index 00000000000..2491b7166cd --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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 {ArtifactRegistryClient} from './artifact_registry_client'; diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..d87aa817a75 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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 artifactregistry = require('@google-cloud/artifact-registry'); + +function main() { + const artifactRegistryClient = new artifactregistry.ArtifactRegistryClient(); +} + +main(); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..e830f64db5a --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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 {ArtifactRegistryClient} from '@google-cloud/artifact-registry'; + +// check that the client class type name can be used +function doStuffWithArtifactRegistryClient(client: ArtifactRegistryClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const artifactRegistryClient = new ArtifactRegistryClient(); + doStuffWithArtifactRegistryClient(artifactRegistryClient); +} + +main(); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/install.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1beta2/test/gapic_artifact_registry_v1beta2.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/test/gapic_artifact_registry_v1beta2.ts new file mode 100644 index 00000000000..c4b9d6c28bf --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/test/gapic_artifact_registry_v1beta2.ts @@ -0,0 +1,4417 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 artifactregistryModule 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.ArtifactRegistryClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = artifactregistryModule.v1beta2.ArtifactRegistryClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = artifactregistryModule.v1beta2.ArtifactRegistryClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = artifactregistryModule.v1beta2.ArtifactRegistryClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.artifactRegistryStub, undefined); + await client.initialize(); + assert(client.artifactRegistryStub); + }); + + it('has close method for the initialized client', done => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.artifactRegistryStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.artifactRegistryStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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('getRepository', () => { + it('invokes getRepository without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Repository() + ); + client.innerApiCalls.getRepository = stubSimpleCall(expectedResponse); + const [response] = await client.getRepository(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Repository() + ); + client.innerApiCalls.getRepository = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRepository( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IRepository|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRepository = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository with closed client', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getRepository(request), expectedError); + }); + }); + + describe('updateRepository', () => { + it('invokes updateRepository without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest() + ); + request.repository ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest', ['repository', 'name']); + request.repository.name = defaultValue1; + const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Repository() + ); + client.innerApiCalls.updateRepository = stubSimpleCall(expectedResponse); + const [response] = await client.updateRepository(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRepository without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest() + ); + request.repository ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest', ['repository', 'name']); + request.repository.name = defaultValue1; + const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Repository() + ); + client.innerApiCalls.updateRepository = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateRepository( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IRepository|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRepository with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest() + ); + request.repository ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest', ['repository', 'name']); + request.repository.name = defaultValue1; + const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateRepository = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateRepository with closed client', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest() + ); + request.repository ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest', ['repository', 'name']); + request.repository.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateRepository(request), expectedError); + }); + }); + + describe('getPackage', () => { + it('invokes getPackage without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Package() + ); + client.innerApiCalls.getPackage = stubSimpleCall(expectedResponse); + const [response] = await client.getPackage(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPackage without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Package() + ); + client.innerApiCalls.getPackage = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPackage( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IPackage|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPackage with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetPackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPackage = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPackage(request), expectedError); + const actualRequest = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPackage with closed client', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetPackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetPackageRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getPackage(request), expectedError); + }); + }); + + describe('getVersion', () => { + it('invokes getVersion without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Version() + ); + client.innerApiCalls.getVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Version() + ); + client.innerApiCalls.getVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVersion( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion with closed client', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVersion(request), expectedError); + }); + }); + + describe('getFile', () => { + it('invokes getFile without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.File() + ); + client.innerApiCalls.getFile = stubSimpleCall(expectedResponse); + const [response] = await client.getFile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFile without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.File() + ); + client.innerApiCalls.getFile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFile( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IFile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFile with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetFileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFile(request), expectedError); + const actualRequest = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFile with closed client', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetFileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetFileRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFile(request), expectedError); + }); + }); + + describe('getTag', () => { + it('invokes getTag without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Tag() + ); + client.innerApiCalls.getTag = stubSimpleCall(expectedResponse); + const [response] = await client.getTag(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTag without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Tag() + ); + client.innerApiCalls.getTag = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTag( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.ITag|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTag with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getTag = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTag(request), expectedError); + const actualRequest = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTag with closed client', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetTagRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getTag(request), expectedError); + }); + }); + + describe('createTag', () => { + it('invokes createTag without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.CreateTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateTagRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Tag() + ); + client.innerApiCalls.createTag = stubSimpleCall(expectedResponse); + const [response] = await client.createTag(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTag without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.CreateTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateTagRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Tag() + ); + client.innerApiCalls.createTag = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTag( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.ITag|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTag with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.CreateTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateTagRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTag = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createTag(request), expectedError); + const actualRequest = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTag with closed client', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.CreateTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateTagRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createTag(request), expectedError); + }); + }); + + describe('updateTag', () => { + it('invokes updateTag without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateTagRequest() + ); + request.tag ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateTagRequest', ['tag', 'name']); + request.tag.name = defaultValue1; + const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Tag() + ); + client.innerApiCalls.updateTag = stubSimpleCall(expectedResponse); + const [response] = await client.updateTag(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTag without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateTagRequest() + ); + request.tag ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateTagRequest', ['tag', 'name']); + request.tag.name = defaultValue1; + const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.Tag() + ); + client.innerApiCalls.updateTag = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateTag( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.ITag|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTag with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateTagRequest() + ); + request.tag ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateTagRequest', ['tag', 'name']); + request.tag.name = defaultValue1; + const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTag = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateTag(request), expectedError); + const actualRequest = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTag with closed client', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateTagRequest() + ); + request.tag ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateTagRequest', ['tag', 'name']); + request.tag.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateTag(request), expectedError); + }); + }); + + describe('deleteTag', () => { + it('invokes deleteTag without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTag = stubSimpleCall(expectedResponse); + const [response] = await client.deleteTag(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTag without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTag = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTag( + 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.deleteTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTag with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteTagRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTag = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteTag(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteTag as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTag with closed client', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteTagRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteTagRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteTag(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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('getProjectSettings', () => { + it('invokes getProjectSettings without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ProjectSettings() + ); + client.innerApiCalls.getProjectSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getProjectSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getProjectSettings without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ProjectSettings() + ); + client.innerApiCalls.getProjectSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProjectSettings( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IProjectSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getProjectSettings with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getProjectSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getProjectSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getProjectSettings with closed client', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProjectSettings(request), expectedError); + }); + }); + + describe('updateProjectSettings', () => { + it('invokes updateProjectSettings without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest() + ); + request.projectSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest', ['projectSettings', 'name']); + request.projectSettings.name = defaultValue1; + const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ProjectSettings() + ); + client.innerApiCalls.updateProjectSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateProjectSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateProjectSettings without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest() + ); + request.projectSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest', ['projectSettings', 'name']); + request.projectSettings.name = defaultValue1; + const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ProjectSettings() + ); + client.innerApiCalls.updateProjectSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateProjectSettings( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IProjectSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateProjectSettings with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest() + ); + request.projectSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest', ['projectSettings', 'name']); + request.projectSettings.name = defaultValue1; + const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProjectSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateProjectSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateProjectSettings with closed client', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest() + ); + request.projectSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest', ['projectSettings', 'name']); + request.projectSettings.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateProjectSettings(request), expectedError); + }); + }); + + describe('importAptArtifacts', () => { + it('invokes importAptArtifacts without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importAptArtifacts = stubLongRunningCall(expectedResponse); + const [operation] = await client.importAptArtifacts(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAptArtifacts without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importAptArtifacts = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importAptArtifacts( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAptArtifacts with call error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAptArtifacts = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importAptArtifacts(request), expectedError); + const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAptArtifacts with LRO error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAptArtifacts = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importAptArtifacts(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportAptArtifactsProgress without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportAptArtifactsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportAptArtifactsProgress with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkImportAptArtifactsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('importYumArtifacts', () => { + it('invokes importYumArtifacts without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importYumArtifacts = stubLongRunningCall(expectedResponse); + const [operation] = await client.importYumArtifacts(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importYumArtifacts without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importYumArtifacts = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importYumArtifacts( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importYumArtifacts with call error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importYumArtifacts = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importYumArtifacts(request), expectedError); + const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importYumArtifacts with LRO error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importYumArtifacts = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importYumArtifacts(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportYumArtifactsProgress without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportYumArtifactsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportYumArtifactsProgress with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkImportYumArtifactsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createRepository', () => { + it('invokes createRepository without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRepository = stubLongRunningCall(expectedResponse); + const [operation] = await client.createRepository(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRepository = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createRepository( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository with call error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRepository = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository with LRO error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRepository = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createRepository(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateRepositoryProgress without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateRepositoryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateRepositoryProgress with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateRepositoryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteRepository', () => { + it('invokes deleteRepository without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRepository = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteRepository(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRepository = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteRepository( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository with call error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository with LRO error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteRepository(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteRepositoryProgress without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteRepositoryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteRepositoryProgress with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteRepositoryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deletePackage', () => { + it('invokes deletePackage without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeletePackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeletePackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePackage = stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePackage(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePackage without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeletePackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeletePackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePackage = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePackage( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePackage with call error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeletePackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeletePackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePackage = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deletePackage(request), expectedError); + const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePackage with LRO error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeletePackageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeletePackageRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePackage = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deletePackage(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeletePackageProgress without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeletePackageProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeletePackageProgress with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeletePackageProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteVersion', () => { + it('invokes deleteVersion without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteVersion = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteVersion = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteVersion( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion with call error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVersion = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion with LRO error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVersion = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteVersion(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteVersionProgress without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteVersionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteVersionProgress with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteVersionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listRepositories', () => { + it('invokes listRepositories without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + ]; + client.innerApiCalls.listRepositories = stubSimpleCall(expectedResponse); + const [response] = await client.listRepositories(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositories without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + ]; + client.innerApiCalls.listRepositories = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRepositories( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IRepository[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositories with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRepositories = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRepositories(request), expectedError); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositoriesStream without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + ]; + client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1beta2.Repository[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Repository) => { + 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.listRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); + assert( + (client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRepositoriesStream with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1beta2.Repository[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Repository) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); + assert( + (client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRepositories without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), + ]; + client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1beta2.IRepository[] = []; + const iterable = client.listRepositoriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRepositories with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRepositoriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1beta2.IRepository[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listPackages', () => { + it('invokes listPackages without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + ]; + client.innerApiCalls.listPackages = stubSimpleCall(expectedResponse); + const [response] = await client.listPackages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPackages without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + ]; + client.innerApiCalls.listPackages = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPackages( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IPackage[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPackages with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPackages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPackages(request), expectedError); + const actualRequest = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPackagesStream without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + ]; + client.descriptors.page.listPackages.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPackagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1beta2.Package[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Package) => { + 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.listPackages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPackages, request)); + assert( + (client.descriptors.page.listPackages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listPackagesStream with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPackages.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPackagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1beta2.Package[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Package) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listPackages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPackages, request)); + assert( + (client.descriptors.page.listPackages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPackages without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), + ]; + client.descriptors.page.listPackages.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1beta2.IPackage[] = []; + const iterable = client.listPackagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPackages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPackages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPackages with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPackages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPackagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1beta2.IPackage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPackages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPackages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listVersions', () => { + it('invokes listVersions without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + ]; + client.innerApiCalls.listVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersions without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + ]; + client.innerApiCalls.listVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listVersions( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IVersion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersions with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersionsStream without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + ]; + client.descriptors.page.listVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1beta2.Version[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Version) => { + 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.listVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listVersionsStream with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1beta2.Version[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Version) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVersions without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), + ]; + client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1beta2.IVersion[] = []; + const iterable = client.listVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVersions with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1beta2.IVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listFiles', () => { + it('invokes listFiles without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + ]; + client.innerApiCalls.listFiles = stubSimpleCall(expectedResponse); + const [response] = await client.listFiles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFiles without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + ]; + client.innerApiCalls.listFiles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFiles( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IFile[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFiles with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFiles(request), expectedError); + const actualRequest = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFilesStream without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + ]; + client.descriptors.page.listFiles.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1beta2.File[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.File) => { + 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.listFiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFiles, request)); + assert( + (client.descriptors.page.listFiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFilesStream with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFiles.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1beta2.File[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.File) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFiles, request)); + assert( + (client.descriptors.page.listFiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFiles without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), + ]; + client.descriptors.page.listFiles.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1beta2.IFile[] = []; + const iterable = client.listFilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFiles with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1beta2.IFile[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listTags', () => { + it('invokes listTags without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + ]; + client.innerApiCalls.listTags = stubSimpleCall(expectedResponse); + const [response] = await client.listTags(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTags without error using callback', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + ]; + client.innerApiCalls.listTags = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTags( + request, + (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.ITag[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTags with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listTags = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listTags(request), expectedError); + const actualRequest = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTagsStream without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + ]; + client.descriptors.page.listTags.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listTagsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1beta2.Tag[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Tag) => { + 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.listTags.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTags, request)); + assert( + (client.descriptors.page.listTags.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listTagsStream with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTags.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listTagsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.artifactregistry.v1beta2.Tag[] = []; + stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Tag) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listTags.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTags, request)); + assert( + (client.descriptors.page.listTags.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listTags without error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), + ]; + client.descriptors.page.listTags.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.artifactregistry.v1beta2.ITag[] = []; + const iterable = client.listTagsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTags.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listTags.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listTags with error', async () => { + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTags.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTagsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.artifactregistry.v1beta2.ITag[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTags.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listTags.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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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('aptArtifact', () => { + const fakePath = "/rendered/path/aptArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + apt_artifact: "aptArtifactValue", + }; + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.aptArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.aptArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('aptArtifactPath', () => { + const result = client.aptArtifactPath("projectValue", "locationValue", "repositoryValue", "aptArtifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.aptArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAptArtifactName', () => { + const result = client.matchProjectFromAptArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAptArtifactName', () => { + const result = client.matchLocationFromAptArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromAptArtifactName', () => { + const result = client.matchRepositoryFromAptArtifactName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAptArtifactFromAptArtifactName', () => { + const result = client.matchAptArtifactFromAptArtifactName(fakePath); + assert.strictEqual(result, "aptArtifactValue"); + assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('file', () => { + const fakePath = "/rendered/path/file"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + file: "fileValue", + }; + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.filePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.filePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('filePath', () => { + const result = client.filePath("projectValue", "locationValue", "repositoryValue", "fileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.filePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFileName', () => { + const result = client.matchProjectFromFileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.filePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFileName', () => { + const result = client.matchLocationFromFileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.filePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromFileName', () => { + const result = client.matchRepositoryFromFileName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.filePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFileFromFileName', () => { + const result = client.matchFileFromFileName(fakePath); + assert.strictEqual(result, "fileValue"); + assert((client.pathTemplates.filePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSettings', () => { + const fakePath = "/rendered/path/projectSettings"; + const expectedParameters = { + project: "projectValue", + }; + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSettingsPath', () => { + const result = client.projectSettingsPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSettingsName', () => { + const result = client.matchProjectFromProjectSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSettingsPathTemplate.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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ + 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('tag', () => { + const fakePath = "/rendered/path/tag"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + package: "packageValue", + tag: "tagValue", + }; + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tagPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tagPath', () => { + const result = client.tagPath("projectValue", "locationValue", "repositoryValue", "packageValue", "tagValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tagPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTagName', () => { + const result = client.matchProjectFromTagName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tagPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromTagName', () => { + const result = client.matchLocationFromTagName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.tagPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromTagName', () => { + const result = client.matchRepositoryFromTagName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.tagPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPackageFromTagName', () => { + const result = client.matchPackageFromTagName(fakePath); + assert.strictEqual(result, "packageValue"); + assert((client.pathTemplates.tagPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTagFromTagName', () => { + const result = client.matchTagFromTagName(fakePath); + assert.strictEqual(result, "tagValue"); + assert((client.pathTemplates.tagPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('version', () => { + const fakePath = "/rendered/path/version"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + package: "packageValue", + version: "versionValue", + }; + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.versionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath("projectValue", "locationValue", "repositoryValue", "packageValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromVersionName', () => { + const result = client.matchRepositoryFromVersionName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPackageFromVersionName', () => { + const result = client.matchPackageFromVersionName(fakePath); + assert.strictEqual(result, "packageValue"); + assert((client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('yumArtifact', () => { + const fakePath = "/rendered/path/yumArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + repository: "repositoryValue", + yum_artifact: "yumArtifactValue", + }; + const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.yumArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.yumArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('yumArtifactPath', () => { + const result = client.yumArtifactPath("projectValue", "locationValue", "repositoryValue", "yumArtifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.yumArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromYumArtifactName', () => { + const result = client.matchProjectFromYumArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromYumArtifactName', () => { + const result = client.matchLocationFromYumArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromYumArtifactName', () => { + const result = client.matchRepositoryFromYumArtifactName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchYumArtifactFromYumArtifactName', () => { + const result = client.matchYumArtifactFromYumArtifactName(fakePath); + assert.strictEqual(result, "yumArtifactValue"); + assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/tsconfig.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1beta2/webpack.config.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/webpack.config.js new file mode 100644 index 00000000000..d7daabc3ee8 --- /dev/null +++ b/owl-bot-staging/google-devtools-artifactregistry/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: 'ArtifactRegistry', + filename: './artifact-registry.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-devtools-cloudbuild/v1/.eslintignore b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore b/owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v1/.jsdoc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.jsdoc.js new file mode 100644 index 00000000000..09c8e7ac916 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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/cloudbuild', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v1/.prettierrc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v1/README.md b/owl-bot-staging/google-devtools-cloudbuild/v1/README.md new file mode 100644 index 00000000000..1e997bef7bc --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/README.md @@ -0,0 +1 @@ +Cloudbuild: Nodejs Client diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/package.json b/owl-bot-staging/google-devtools-cloudbuild/v1/package.json new file mode 100644 index 00000000000..7f35e6fcaa7 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/cloudbuild", + "version": "0.1.0", + "description": "Cloudbuild client for Node.js", + "repository": "googleapis/nodejs-cloudbuild", + "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 cloudbuild", + "cloudbuild", + "cloud build" + ], + "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-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto b/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto new file mode 100644 index 00000000000..20f7f3191fa --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto @@ -0,0 +1,2734 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.cloudbuild.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/httpbody.proto"; +import "google/api/resource.proto"; +import "google/api/routing.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 csharp_namespace = "Google.Cloud.CloudBuild.V1"; +option go_package = "cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb;cloudbuildpb"; +option java_multiple_files = true; +option java_package = "com.google.cloudbuild.v1"; +option objc_class_prefix = "GCB"; +option php_namespace = "Google\\Cloud\\Build\\V1"; +option ruby_package = "Google::Cloud::Build::V1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; +option (google.api.resource_definition) = { + type: "iam.googleapis.com/ServiceAccount" + pattern: "projects/{project}/serviceAccounts/{service_account}" +}; +option (google.api.resource_definition) = { + type: "secretmanager.googleapis.com/Secret" + pattern: "projects/{project}/secrets/{secret}" +}; +option (google.api.resource_definition) = { + type: "secretmanager.googleapis.com/SecretVersion" + pattern: "projects/{project}/secrets/{secret}/versions/{version}" +}; +option (google.api.resource_definition) = { + type: "gkehub.googleapis.com/Membership" + pattern: "projects/{project}/locations/{location}/memberships/{cluster_name}" +}; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}" +}; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Subscription" + pattern: "projects/{project}/subscriptions/{subscription}" +}; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}" +}; + +// Creates and manages builds on Google Cloud Platform. +// +// The main concept used by this API is a `Build`, which describes the location +// of the source to build, how to build the source, and where to store the +// built artifacts, if any. +// +// A user can list previously-requested builds or get builds by their ID to +// determine the status of the build. +service CloudBuild { + option (google.api.default_host) = "cloudbuild.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Starts a build with the specified configuration. + // + // This method returns a long-running `Operation`, which includes the build + // ID. Pass the build ID to `GetBuild` to determine the build status (such as + // `SUCCESS` or `FAILURE`). + rpc CreateBuild(CreateBuildRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/builds" + body: "build" + additional_bindings { + post: "/v1/{parent=projects/*/locations/*}/builds" + body: "build" + } + }; + option (google.api.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + option (google.api.method_signature) = "project_id,build"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // Returns information about a previously requested build. + // + // The `Build` that is returned includes its status (such as `SUCCESS`, + // `FAILURE`, or `WORKING`), and timing information. + rpc GetBuild(GetBuildRequest) returns (Build) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/builds/{id}" + additional_bindings { get: "/v1/{name=projects/*/locations/*/builds/*}" } + }; + option (google.api.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/builds/*" + } + }; + option (google.api.method_signature) = "project_id,id"; + } + + // Lists previously requested builds. + // + // Previously requested builds may still be in-progress, or may have finished + // successfully or unsuccessfully. + rpc ListBuilds(ListBuildsRequest) returns (ListBuildsResponse) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/builds" + additional_bindings { get: "/v1/{parent=projects/*/locations/*}/builds" } + }; + option (google.api.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + option (google.api.method_signature) = "project_id,filter"; + } + + // Cancels a build in progress. + rpc CancelBuild(CancelBuildRequest) returns (Build) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/builds/{id}:cancel" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/builds/*}:cancel" + body: "*" + } + }; + option (google.api.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/builds/*" + } + }; + option (google.api.method_signature) = "project_id,id"; + } + + // Creates a new build based on the specified build. + // + // This method creates a new build using the original build request, which may + // or may not result in an identical build. + // + // For triggered builds: + // + // * Triggered builds resolve to a precise revision; therefore a retry of a + // triggered build will result in a build that uses the same revision. + // + // For non-triggered builds that specify `RepoSource`: + // + // * If the original build built from the tip of a branch, the retried build + // will build from the tip of that branch, which may not be the same revision + // as the original build. + // * If the original build specified a commit sha or revision ID, the retried + // build will use the identical source. + // + // For builds that specify `StorageSource`: + // + // * If the original build pulled source from Cloud Storage without + // specifying the generation of the object, the new build will use the current + // object, which may be different from the original build source. + // * If the original build pulled source from Cloud Storage and specified the + // generation of the object, the new build will attempt to use the same + // object, which may or may not be available depending on the bucket's + // lifecycle management settings. + rpc RetryBuild(RetryBuildRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/builds/{id}:retry" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/builds/*}:retry" + body: "*" + } + }; + option (google.api.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/builds/*" + } + }; + option (google.api.method_signature) = "project_id,id"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // Approves or rejects a pending build. + // + // If approved, the returned LRO will be analogous to the LRO returned from + // a CreateBuild call. + // + // If rejected, the returned LRO will be immediately done. + rpc ApproveBuild(ApproveBuildRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/builds/*}:approve" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/builds/*}:approve" + body: "*" + } + }; + option (google.api.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/builds/*" + } + }; + option (google.api.method_signature) = "name,approval_result"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // Creates a new `BuildTrigger`. + // + // This API is experimental. + rpc CreateBuildTrigger(CreateBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/triggers" + body: "trigger" + additional_bindings { + post: "/v1/{parent=projects/*/locations/*}/triggers" + body: "trigger" + } + }; + option (google.api.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + option (google.api.method_signature) = "project_id,trigger"; + } + + // Returns information about a `BuildTrigger`. + // + // This API is experimental. + rpc GetBuildTrigger(GetBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/triggers/{trigger_id}" + additional_bindings { + get: "/v1/{name=projects/*/locations/*/triggers/*}" + } + }; + option (google.api.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/triggers/*" + } + }; + option (google.api.method_signature) = "project_id,trigger_id"; + } + + // Lists existing `BuildTrigger`s. + // + // This API is experimental. + rpc ListBuildTriggers(ListBuildTriggersRequest) + returns (ListBuildTriggersResponse) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/triggers" + additional_bindings { + get: "/v1/{parent=projects/*/locations/*}/triggers" + } + }; + option (google.api.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + option (google.api.method_signature) = "project_id"; + } + + // Deletes a `BuildTrigger` by its project ID and trigger ID. + // + // This API is experimental. + rpc DeleteBuildTrigger(DeleteBuildTriggerRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/projects/{project_id}/triggers/{trigger_id}" + additional_bindings { + delete: "/v1/{name=projects/*/locations/*/triggers/*}" + } + }; + option (google.api.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/triggers/*" + } + }; + option (google.api.method_signature) = "project_id,trigger_id"; + } + + // Updates a `BuildTrigger` by its project ID and trigger ID. + // + // This API is experimental. + rpc UpdateBuildTrigger(UpdateBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { + patch: "/v1/projects/{project_id}/triggers/{trigger_id}" + body: "trigger" + additional_bindings { + patch: "/v1/{trigger.resource_name=projects/*/locations/*/triggers/*}" + body: "trigger" + } + }; + option (google.api.routing) = { + routing_parameters { + field: "trigger.resource_name" + path_template: "projects/*/locations/{location=*}/triggers/*" + } + }; + option (google.api.method_signature) = "project_id,trigger_id,trigger"; + } + + // Runs a `BuildTrigger` at a particular source revision. + // + // To run a regional or global trigger, use the POST request + // that includes the location endpoint in the path (ex. + // v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The + // POST request that does not include the location endpoint in the path can + // only be used when running global triggers. + rpc RunBuildTrigger(RunBuildTriggerRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/triggers/{trigger_id}:run" + body: "source" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/triggers/*}:run" + body: "*" + } + }; + option (google.api.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/triggers/*" + } + }; + option (google.api.method_signature) = "project_id,trigger_id,source"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // ReceiveTriggerWebhook [Experimental] is called when the API receives a + // webhook request targeted at a specific trigger. + rpc ReceiveTriggerWebhook(ReceiveTriggerWebhookRequest) + returns (ReceiveTriggerWebhookResponse) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/triggers/{trigger}:webhook" + body: "body" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/triggers/*}:webhook" + body: "body" + } + }; + } + + // Creates a `WorkerPool`. + rpc CreateWorkerPool(CreateWorkerPoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/workerPools" + body: "worker_pool" + }; + option (google.api.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + option (google.api.method_signature) = "parent,worker_pool,worker_pool_id"; + option (google.longrunning.operation_info) = { + response_type: "WorkerPool" + metadata_type: "CreateWorkerPoolOperationMetadata" + }; + } + + // Returns details of a `WorkerPool`. + rpc GetWorkerPool(GetWorkerPoolRequest) returns (WorkerPool) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/workerPools/*}" + }; + option (google.api.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/workerPools/*" + } + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a `WorkerPool`. + rpc DeleteWorkerPool(DeleteWorkerPoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/workerPools/*}" + }; + option (google.api.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/workerPools/*" + } + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteWorkerPoolOperationMetadata" + }; + } + + // Updates a `WorkerPool`. + rpc UpdateWorkerPool(UpdateWorkerPoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{worker_pool.name=projects/*/locations/*/workerPools/*}" + body: "worker_pool" + }; + option (google.api.routing) = { + routing_parameters { + field: "worker_pool.name" + path_template: "projects/*/locations/{location=*}/workerPools/*" + } + }; + option (google.api.method_signature) = "worker_pool,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "WorkerPool" + metadata_type: "UpdateWorkerPoolOperationMetadata" + }; + } + + // Lists `WorkerPool`s. + rpc ListWorkerPools(ListWorkerPoolsRequest) + returns (ListWorkerPoolsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/workerPools" + }; + option (google.api.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Specifies a build to retry. +message RetryBuildRequest { + // The name of the `Build` to retry. + // Format: `projects/{project}/locations/{location}/builds/{build}` + string name = 3 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Build ID of the original build. + string id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies a build trigger to run and the source to use. +message RunBuildTriggerRequest { + // The name of the `Trigger` to run. + // Format: `projects/{project}/locations/{location}/triggers/{trigger}` + string name = 4 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the trigger. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Source to build against this trigger. + // Branch and tag names cannot consist of regular expressions. + RepoSource source = 3; +} + +// Location of the source in an archive file in Cloud Storage. +message StorageSource { + // Cloud Storage bucket containing the source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Cloud Storage object containing the source. + // + // This object must be a zipped (`.zip`) or gzipped archive file (`.tar.gz`) + // containing source to build. + string object = 2; + + // 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 any accessible Git repository. +message GitSource { + // Location of the Git repo to build. + // + // This will be used as a `git remote`, see + // https://git-scm.com/docs/git-remote. + string url = 1; + + // 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. + string dir = 5; + + // The revision to fetch from the Git repository such as a branch, a tag, a + // commit SHA, or any Git ref. + // + // Cloud Build uses `git fetch` to fetch the revision from the Git + // repository; therefore make sure that the string you provide for `revision` + // is parsable by the command. For information on string values accepted by + // `git fetch`, see + // https://git-scm.com/docs/gitrevisions#_specifying_revisions. For + // information on `git fetch`, see https://git-scm.com/docs/git-fetch. + string revision = 6; +} + +// Location of the source in a Google Cloud Source Repository. +message RepoSource { + // 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; + + // 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; + } + + // 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. + string dir = 7; + + // Only trigger a build if the revision regex does NOT match the revision + // regex. + bool invert_regex = 8; + + // Substitutions to use in a triggered build. + // Should only be used with RunBuildTrigger + map substitutions = 9; +} + +// Location of the source manifest in Cloud Storage. +// This feature is in Preview; see description +// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). +message StorageSourceManifest { + // Cloud Storage bucket containing the source manifest (see [Bucket + // Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Cloud Storage object containing the source manifest. + // + // This object must be a JSON file. + string object = 2; + + // 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 supported storage service. +message Source { + // Location of source. + oneof source { + // If provided, get the source from this location in Cloud Storage. + StorageSource storage_source = 2; + + // If provided, get the source from this location in a Cloud Source + // Repository. + RepoSource repo_source = 3; + + // If provided, get the source from this Git repository. + GitSource git_source = 5; + + // If provided, get the source from this manifest in Cloud Storage. + // This feature is in Preview; see description + // [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). + StorageSourceManifest storage_source_manifest = 8; + } +} + +// An image built by the pipeline. +message BuiltImage { + // Name used to push the container image to Google Container Registry, as + // presented to `docker push`. + string name = 1; + + // Docker Registry 2.0 digest. + string digest = 3; + + // Output only. Stores timing information for pushing the specified image. + TimeSpan push_timing = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Artifact uploaded using the PythonPackage directive. +message UploadedPythonPackage { + // URI of the uploaded artifact. + string uri = 1; + + // Hash types and values of the Python Artifact. + FileHashes file_hashes = 2; + + // Output only. Stores timing information for pushing the specified artifact. + TimeSpan push_timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A Maven artifact uploaded using the MavenArtifact directive. +message UploadedMavenArtifact { + // URI of the uploaded artifact. + string uri = 1; + + // Hash types and values of the Maven Artifact. + FileHashes file_hashes = 2; + + // Output only. Stores timing information for pushing the specified artifact. + TimeSpan push_timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// An npm package uploaded to Artifact Registry using the NpmPackage +// directive. +message UploadedNpmPackage { + // URI of the uploaded npm package. + string uri = 1; + + // Hash types and values of the npm package. + FileHashes file_hashes = 2; + + // Output only. Stores timing information for pushing the specified artifact. + TimeSpan push_timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A step in the build pipeline. +message BuildStep { + // Required. The name of the container image that will run this particular + // build step. + // + // If the image is available in the host's Docker daemon's cache, it + // will be run directly. If not, the host will attempt to pull the image + // first, using the builder service account's credentials if necessary. + // + // The Docker daemon's cache will already have the latest versions of all of + // the officially supported build steps + // ([https://github.com/GoogleCloudPlatform/cloud-builders](https://github.com/GoogleCloudPlatform/cloud-builders)). + // The Docker daemon will also have cached many of the layers for some popular + // images, like "ubuntu", "debian", but they will be refreshed at the time you + // attempt to use them. + // + // If you built an image in a previous build step, it will be stored in the + // host's Docker daemon's cache and is available to use as the name for a + // later build step. + string name = 1; + + // A list of environment variable definitions to be used when running a step. + // + // The elements are of the form "KEY=VALUE" for the environment variable "KEY" + // being given the value "VALUE". + repeated string env = 2; + + // A list of arguments that will be presented to the step when it is started. + // + // If the image used to run the step's container has an entrypoint, the `args` + // are used as arguments to that entrypoint. If the image does not define + // an entrypoint, the first element in args is used as the entrypoint, + // and the remainder will be used as arguments. + repeated string args = 3; + + // Working directory to use when running this step's container. + // + // If this value is a relative path, it is relative to the build's working + // directory. If this value is absolute, it may be outside the build's working + // directory, in which case the contents of the path may not be persisted + // across build step executions, unless a `volume` for that path is specified. + // + // If the build specifies a `RepoSource` with `dir` and a step with a `dir`, + // which specifies an absolute path, the `RepoSource` `dir` is ignored for + // the step's execution. + string dir = 4; + + // Unique identifier for this build step, used in `wait_for` to + // reference this build step as a dependency. + string id = 5; + + // The ID(s) of the step(s) that this build step depends on. + // This build step will not start until all the build steps in `wait_for` + // have completed successfully. If `wait_for` is empty, this build step will + // start when all previous build steps in the `Build.Steps` list have + // completed successfully. + repeated string wait_for = 6; + + // Entrypoint to be used instead of the build step image's default entrypoint. + // If unset, the image's default entrypoint is used. + string entrypoint = 7; + + // A list of environment variables which are encrypted using a Cloud Key + // Management Service crypto key. These values must be specified in the + // build's `Secret`. + repeated string secret_env = 8; + + // List of volumes to mount into the build step. + // + // Each volume is created as an empty volume prior to execution of the + // build step. Upon completion of the build, volumes and their contents are + // discarded. + // + // Using a named volume in only one step is not valid as it is indicative + // of a build request with an incorrect configuration. + repeated Volume volumes = 9; + + // Output only. Stores timing information for executing this build step. + TimeSpan timing = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Stores timing information for pulling this build step's + // builder image only. + TimeSpan pull_timing = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Time limit for executing this build step. If not defined, the step has no + // time limit and will be allowed to continue to run until either it completes + // or the build itself times out. + google.protobuf.Duration timeout = 11; + + // Output only. Status of the build step. At this time, build step status is + // only updated on build completion; step status is not updated in real-time + // as the build progresses. + Build.Status status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allow this build step to fail without failing the entire build. + // + // If false, the entire build will fail if this step fails. Otherwise, the + // build will succeed, but this step will still have a failure status. + // Error information will be reported in the failure_detail field. + bool allow_failure = 14; + + // Output only. Return code from running the step. + int32 exit_code = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allow this build step to fail without failing the entire build if and + // only if the exit code is one of the specified codes. If allow_failure + // is also specified, this field will take precedence. + repeated int32 allow_exit_codes = 18; + + // A shell script to be executed in the step. + // + // When script is provided, the user cannot specify the entrypoint or args. + string script = 19; + + // Option to include built-in and custom substitutions as env variables + // for this build step. This option will override the global option + // in BuildOption. + optional bool automap_substitutions = 20; +} + +// Volume describes a Docker container volume which is mounted into build steps +// in order to persist files across build step execution. +message Volume { + // Name of the volume to mount. + // + // Volume names must be unique per build step and must be valid names for + // Docker volumes. Each named volume must be used by at least two build steps. + string name = 1; + + // Path at which to mount the volume. + // + // Paths must be absolute and cannot conflict with other volume paths on the + // same build step or with certain reserved volume paths. + string path = 2; +} + +// Artifacts created by the build pipeline. +message Results { + // Container images that were built as a part of the build. + repeated BuiltImage images = 2; + + // List of build step digests, in the order corresponding to build step + // indices. + repeated string build_step_images = 3; + + // Path to the artifact manifest for non-container artifacts uploaded to Cloud + // Storage. Only populated when artifacts are uploaded to Cloud Storage. + string artifact_manifest = 4; + + // Number of non-container artifacts uploaded to Cloud Storage. Only populated + // when artifacts are uploaded to Cloud Storage. + int64 num_artifacts = 5; + + // List of build step outputs, produced by builder images, in the order + // corresponding to build step indices. + // + // [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders) + // can produce this output by writing to `$BUILDER_OUTPUT/output`. + // Only the first 4KB of data is stored. + repeated bytes build_step_outputs = 6; + + // Time to push all non-container artifacts to Cloud Storage. + TimeSpan artifact_timing = 7; + + // Python artifacts uploaded to Artifact Registry at the end of the build. + repeated UploadedPythonPackage python_packages = 8; + + // Maven artifacts uploaded to Artifact Registry at the end of the build. + repeated UploadedMavenArtifact maven_artifacts = 9; + + // Npm packages uploaded to Artifact Registry at the end of the build. + repeated UploadedNpmPackage npm_packages = 12; +} + +// An artifact that was uploaded during a build. This +// is a single record in the artifact manifest JSON file. +message ArtifactResult { + // The path of an artifact in a Cloud Storage bucket, with the + // generation number. For example, + // `gs://mybucket/path/to/output.jar#generation`. + string location = 1; + + // The file hash of the artifact. + repeated FileHashes file_hash = 2; +} + +// A build resource in the Cloud Build API. +// +// At a high level, a `Build` describes where to find source code, how to build +// it (for example, the builder image to run on the source), and where to store +// the built artifacts. +// +// Fields can include the following variables, which will be expanded when the +// build is created: +// +// - $PROJECT_ID: the project ID of the build. +// - $PROJECT_NUMBER: the project number of the build. +// - $LOCATION: the location/region of the build. +// - $BUILD_ID: the autogenerated ID of the build. +// - $REPO_NAME: the source repository name specified by RepoSource. +// - $BRANCH_NAME: the branch name specified by RepoSource. +// - $TAG_NAME: the tag name specified by RepoSource. +// - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or +// resolved from the specified branch or tag. +// - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA. +message Build { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/Build" + pattern: "projects/{project}/builds/{build}" + pattern: "projects/{project}/locations/{location}/builds/{build}" + }; + + // Possible status of a build or build step. + enum Status { + // Status of the build is unknown. + STATUS_UNKNOWN = 0; + + // Build has been created and is pending execution and queuing. It has not + // been queued. + PENDING = 10; + + // Build or step is queued; work has not yet begun. + QUEUED = 1; + + // Build or step is being executed. + WORKING = 2; + + // Build or step finished successfully. + SUCCESS = 3; + + // Build or step failed to complete successfully. + FAILURE = 4; + + // Build or step failed due to an internal cause. + INTERNAL_ERROR = 5; + + // Build or step took longer than was allowed. + TIMEOUT = 6; + + // Build or step was canceled by a user. + CANCELLED = 7; + + // Build was enqueued for longer than the value of `queue_ttl`. + EXPIRED = 9; + } + + // A non-fatal problem encountered during the execution of the build. + message Warning { + // The relative importance of this warning. + enum Priority { + // Should not be used. + PRIORITY_UNSPECIFIED = 0; + + // e.g. deprecation warnings and alternative feature highlights. + INFO = 1; + + // e.g. automated detection of possible issues with the build. + WARNING = 2; + + // e.g. alerts that a feature used in the build is pending removal + ALERT = 3; + } + + // Explanation of the warning generated. + string text = 1; + + // The priority for this warning. + Priority priority = 2; + } + + // A fatal problem encountered during the execution of the build. + message FailureInfo { + // The name of a fatal problem encountered during the execution of the + // build. + enum FailureType { + // Type unspecified + FAILURE_TYPE_UNSPECIFIED = 0; + + // Unable to push the image to the repository. + PUSH_FAILED = 1; + + // Final image not found. + PUSH_IMAGE_NOT_FOUND = 2; + + // Unauthorized push of the final image. + PUSH_NOT_AUTHORIZED = 3; + + // Backend logging failures. Should retry. + LOGGING_FAILURE = 4; + + // A build step has failed. + USER_BUILD_STEP = 5; + + // The source fetching has failed. + FETCH_SOURCE_FAILED = 6; + } + + // The name of the failure. + FailureType type = 1; + + // Explains the failure issue in more detail using hard-coded text. + string detail = 2; + } + + // Output only. The 'Build' name with format: + // `projects/{project}/locations/{location}/builds/{build}`, where {build} + // is a unique identifier generated by the service. + string name = 45 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Unique identifier of the build. + string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. ID of the project. + string project_id = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Status of the build. + Status status = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Customer-readable message about the current status. + string status_detail = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The location of the source files to build. + Source source = 3; + + // Required. The operations to be performed on the workspace. + repeated BuildStep steps = 11; + + // Output only. Results of the build. + Results results = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which the request to create the build was received. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which execution of the build was started. + google.protobuf.Timestamp start_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which execution of the build was finished. + // + // The difference between finish_time and start_time is the duration of the + // build's execution. + google.protobuf.Timestamp finish_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Amount of time that this build should be allowed to run, to second + // granularity. If this amount of time elapses, work on the build will cease + // and the build status will be `TIMEOUT`. + // + // `timeout` starts ticking from `startTime`. + // + // Default time is 60 minutes. + google.protobuf.Duration timeout = 12; + + // A list of images to be pushed upon the successful completion of all build + // steps. + // + // The images are pushed using the builder service account's credentials. + // + // The digests of the pushed images will be stored in the `Build` resource's + // results field. + // + // If any of the images fail to be pushed, the build status is marked + // `FAILURE`. + repeated string images = 13; + + // TTL in queue for this build. If provided and the build is enqueued longer + // than this value, the build will expire and the build status will be + // `EXPIRED`. + // + // The TTL starts ticking from create_time. + google.protobuf.Duration queue_ttl = 40; + + // Artifacts produced by the build that should be uploaded upon + // successful completion of all build steps. + Artifacts artifacts = 37; + + // Cloud Storage bucket where logs should be written (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + // Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`. + string logs_bucket = 19; + + // Output only. A permanent fixed identifier for source. + SourceProvenance source_provenance = 21 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The ID of the `BuildTrigger` that triggered this build, if it + // was triggered automatically. + string build_trigger_id = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Special options for this build. + BuildOptions options = 23; + + // Output only. URL to logs for this build in Google Cloud Console. + string log_url = 25 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Substitutions data for `Build` resource. + map substitutions = 29; + + // Tags for annotation of a `Build`. These are not docker tags. + repeated string tags = 31; + + // Secrets to decrypt using Cloud Key Management Service. + // Note: Secret Manager is the recommended technique + // for managing sensitive data with Cloud Build. Use `available_secrets` to + // configure builds to access secrets from Secret Manager. For instructions, + // see: https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets + repeated Secret secrets = 32; + + // Output only. Stores timing information for phases of the build. Valid keys + // are: + // + // * BUILD: time to execute all build steps. + // * PUSH: time to push all artifacts including docker images and non docker + // artifacts. + // * FETCHSOURCE: time to fetch source. + // * SETUPBUILD: time to set up build. + // + // If the build does not specify source or images, + // these keys will not be included. + map timing = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Describes this build's approval configuration, status, + // and result. + BuildApproval approval = 44 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // IAM service account whose credentials will be used at build runtime. + // Must be of the format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. + // ACCOUNT can be email address or uniqueId of the service account. + // + string service_account = 42 [(google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + }]; + + // Secrets and secret environment variables. + Secrets available_secrets = 47; + + // Output only. Non-fatal problems encountered during the execution of the + // build. + repeated Warning warnings = 49 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Contains information about the build when status=FAILURE. + FailureInfo failure_info = 51 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Artifacts produced by a build that should be uploaded upon +// successful completion of all build steps. +message Artifacts { + // Files in the workspace to upload to Cloud Storage upon successful + // completion of all build steps. + message ArtifactObjects { + // Cloud Storage bucket and optional object path, in the form + // "gs://bucket/path/to/somewhere/". (see [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + // + // Files in the workspace matching any path pattern will be uploaded to + // Cloud Storage with this location as a prefix. + string location = 1; + + // Path globs used to match files in the build's workspace. + repeated string paths = 2; + + // Output only. Stores timing information for pushing all artifact objects. + TimeSpan timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // A Maven artifact to upload to Artifact Registry upon successful completion + // of all build steps. + message MavenArtifact { + // Artifact Registry repository, in the form + // "https://$REGION-maven.pkg.dev/$PROJECT/$REPOSITORY" + // + // Artifact in the workspace specified by path will be uploaded to + // Artifact Registry with this location as a prefix. + string repository = 1; + + // Path to an artifact in the build's workspace to be uploaded to + // Artifact Registry. + // This can be either an absolute path, + // e.g. /workspace/my-app/target/my-app-1.0.SNAPSHOT.jar + // or a relative path from /workspace, + // e.g. my-app/target/my-app-1.0.SNAPSHOT.jar. + string path = 2; + + // Maven `artifactId` value used when uploading the artifact to Artifact + // Registry. + string artifact_id = 3; + + // Maven `groupId` value used when uploading the artifact to Artifact + // Registry. + string group_id = 4; + + // Maven `version` value used when uploading the artifact to Artifact + // Registry. + string version = 5; + } + + // Python package to upload to Artifact Registry upon successful completion + // of all build steps. A package can encapsulate multiple objects to be + // uploaded to a single repository. + message PythonPackage { + // Artifact Registry repository, in the form + // "https://$REGION-python.pkg.dev/$PROJECT/$REPOSITORY" + // + // Files in the workspace matching any path pattern will be uploaded to + // Artifact Registry with this location as a prefix. + string repository = 1; + + // Path globs used to match files in the build's workspace. For Python/ + // Twine, this is usually `dist/*`, and sometimes additionally an `.asc` + // file. + repeated string paths = 2; + } + + // Npm package to upload to Artifact Registry upon successful completion + // of all build steps. + message NpmPackage { + // Artifact Registry repository, in the form + // "https://$REGION-npm.pkg.dev/$PROJECT/$REPOSITORY" + // + // Npm package in the workspace specified by path will be zipped and + // uploaded to Artifact Registry with this location as a prefix. + string repository = 1; + + // Path to the package.json. + // e.g. workspace/path/to/package + string package_path = 2; + } + + // A list of images to be pushed upon the successful completion of all build + // steps. + // + // The images will be pushed using the builder service account's credentials. + // + // The digests of the pushed images will be stored in the Build resource's + // results field. + // + // If any of the images fail to be pushed, the build is marked FAILURE. + repeated string images = 1; + + // A list of objects to be uploaded to Cloud Storage upon successful + // completion of all build steps. + // + // Files in the workspace matching specified paths globs will be uploaded to + // the specified Cloud Storage location using the builder service account's + // credentials. + // + // The location and generation of the uploaded objects will be stored in the + // Build resource's results field. + // + // If any objects fail to be pushed, the build is marked FAILURE. + ArtifactObjects objects = 2; + + // A list of Maven artifacts to be uploaded to Artifact Registry upon + // successful completion of all build steps. + // + // Artifacts in the workspace matching specified paths globs will be uploaded + // to the specified Artifact Registry repository using the builder service + // account's credentials. + // + // If any artifacts fail to be pushed, the build is marked FAILURE. + repeated MavenArtifact maven_artifacts = 3; + + // A list of Python packages to be uploaded to Artifact Registry upon + // successful completion of all build steps. + // + // The build service account credentials will be used to perform the upload. + // + // If any objects fail to be pushed, the build is marked FAILURE. + repeated PythonPackage python_packages = 5; + + // A list of npm packages to be uploaded to Artifact Registry upon + // successful completion of all build steps. + // + // Npm packages in the specified paths will be uploaded + // to the specified Artifact Registry repository using the builder service + // account's credentials. + // + // If any packages fail to be pushed, the build is marked FAILURE. + repeated NpmPackage npm_packages = 6; +} + +// Start and end times for a build execution phase. +message TimeSpan { + // Start of time span. + google.protobuf.Timestamp start_time = 1; + + // End of time span. + google.protobuf.Timestamp end_time = 2; +} + +// Metadata for build operations. +message BuildOperationMetadata { + // The build that the operation is tracking. + Build build = 1; +} + +// 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 = 3; + + // A copy of the build's `source.repo_source`, if exists, with any + // revisions resolved. + RepoSource resolved_repo_source = 6; + + // A copy of the build's `source.storage_source_manifest`, if exists, with any + // revisions resolved. + // This feature is in Preview. + StorageSourceManifest resolved_storage_source_manifest = 9; + + // Output only. Hash(es) of the build source, which can be used to verify that + // the original source integrity was maintained in the build. Note that + // `FileHashes` will only be populated if `BuildOptions` has requested a + // `SourceProvenanceHash`. + // + // The keys to this map are file paths used as build source and the values + // contain the hash values for those files. + // + // If the build source came in a single package such as a gzipped tarfile + // (`.tar.gz`), the `FileHash` will be for the single path to that file. + map file_hashes = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Container message for hashes of byte content of files, used in +// SourceProvenance messages to verify integrity of source input to the build. +message FileHashes { + // Collection of file hashes. + repeated Hash file_hash = 1; +} + +// Container message for hash values. +message Hash { + // Specifies the hash algorithm, if any. + enum HashType { + // No hash requested. + NONE = 0; + + // Use a sha256 hash. + SHA256 = 1; + + // Use a md5 hash. + MD5 = 2; + + // Use a sha512 hash. + SHA512 = 4; + } + + // The type of hash that was performed. + HashType type = 1; + + // The hash value. + bytes value = 2; +} + +// Secrets and secret environment variables. +message Secrets { + // Secrets in Secret Manager and associated secret environment variable. + repeated SecretManagerSecret secret_manager = 1; + + // Secrets encrypted with KMS key and the associated secret environment + // variable. + repeated InlineSecret inline = 2; +} + +// Pairs a set of secret environment variables mapped to encrypted +// values with the Cloud KMS key to use to decrypt the value. +message InlineSecret { + // Resource name of Cloud KMS crypto key to decrypt the encrypted value. + // In format: projects/*/locations/*/keyRings/*/cryptoKeys/* + string kms_key_name = 1 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; + + // Map of environment variable name to its encrypted value. + // + // Secret environment variables must be unique across all of a build's + // secrets, and must be used by at least one build step. Values can be at most + // 64 KB in size. There can be at most 100 secret values across all of a + // build's secrets. + map env_map = 2; +} + +// Pairs a secret environment variable with a SecretVersion in Secret Manager. +message SecretManagerSecret { + // Resource name of the SecretVersion. In format: + // projects/*/secrets/*/versions/* + string version_name = 1 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // Environment variable name to associate with the secret. + // Secret environment variables must be unique across all of a build's + // secrets, and must be used by at least one build step. + string env = 2; +} + +// Pairs a set of secret environment variables containing encrypted +// values with the Cloud KMS key to use to decrypt the value. +// Note: Use `kmsKeyName` with `available_secrets` instead of using +// `kmsKeyName` with `secret`. For instructions see: +// https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-credentials. +message Secret { + // Cloud KMS key name to use to decrypt these envs. + string kms_key_name = 1; + + // Map of environment variable name to its encrypted value. + // + // Secret environment variables must be unique across all of a build's + // secrets, and must be used by at least one build step. Values can be at most + // 64 KB in size. There can be at most 100 secret values across all of a + // build's secrets. + map secret_env = 3; +} + +// Request to create a new build. +message CreateBuildRequest { + // The parent resource where this build will be created. + // Format: `projects/{project}/locations/{location}` + string parent = 4 [(google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Build" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Build resource to create. + Build build = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to get a build. +message GetBuildRequest { + // The name of the `Build` to retrieve. + // Format: `projects/{project}/locations/{location}/builds/{build}` + string name = 4 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the build. + string id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to list builds. +message ListBuildsRequest { + // The parent of the collection of `Builds`. + // Format: `projects/{project}/locations/{location}` + string parent = 9 [(google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Build" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Number of results to return in the list. + int32 page_size = 2; + + // The page token for the next page of Builds. + // + // If unspecified, the first page of results is returned. + // + // If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. + // In this case, the token should be discarded, and pagination should be + // restarted from the first page of results. + // + // See https://google.aip.dev/158 for more. + string page_token = 3; + + // The raw filter text to constrain the results. + string filter = 8; +} + +// Response including listed builds. +message ListBuildsResponse { + // Builds will be sorted by `create_time`, descending. + repeated Build builds = 1; + + // Token to receive the next page of results. + // This will be absent if the end of the response list has been reached. + string next_page_token = 2; +} + +// Request to cancel an ongoing build. +message CancelBuildRequest { + // The name of the `Build` to cancel. + // Format: `projects/{project}/locations/{location}/builds/{build}` + string name = 4 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the build. + string id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to approve or reject a pending build. +message ApproveBuildRequest { + // Required. Name of the target build. + // For example: "projects/{$project_id}/builds/{$build_id}" + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Approval decision and metadata. + ApprovalResult approval_result = 2; +} + +// BuildApproval describes a build's approval configuration, state, and +// result. +message BuildApproval { + // Specifies the current state of a build's approval. + enum State { + // Default enum type. This should not be used. + STATE_UNSPECIFIED = 0; + + // Build approval is pending. + PENDING = 1; + + // Build approval has been approved. + APPROVED = 2; + + // Build approval has been rejected. + REJECTED = 3; + + // Build was cancelled while it was still pending approval. + CANCELLED = 5; + } + + // Output only. The state of this build's approval. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Configuration for manual approval of this build. + ApprovalConfig config = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Result of manual approval for this Build. + ApprovalResult result = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// ApprovalConfig describes configuration for manual approval of a build. +message ApprovalConfig { + // Whether or not approval is needed. If this is set on a build, it will + // become pending when created, and will need to be explicitly approved + // to start. + bool approval_required = 1; +} + +// ApprovalResult describes the decision and associated metadata of a manual +// approval of a build. +message ApprovalResult { + // Specifies whether or not this manual approval result is to approve + // or reject a build. + enum Decision { + // Default enum type. This should not be used. + DECISION_UNSPECIFIED = 0; + + // Build is approved. + APPROVED = 1; + + // Build is rejected. + REJECTED = 2; + } + + // Output only. Email of the user that called the ApproveBuild API to + // approve or reject a build at the time that the API was called. + string approver_account = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the approval decision was made. + google.protobuf.Timestamp approval_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The decision of this manual approval. + Decision decision = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional comment for this manual approval result. + string comment = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional URL tied to this manual approval result. This field + // is essentially the same as comment, except that it will be rendered by the + // UI differently. An example use case is a link to an external job that + // approved this Build. + string url = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// GitRepoSource describes a repo and ref of a code repository. +message GitRepoSource { + // The URI of the repo (e.g. https://github.com/user/repo.git). + // Either `uri` or `repository` can be specified and is required. + string uri = 1; + + // The source of the SCM repo. + oneof source { + // The connected repository resource name, in the format + // `projects/*/locations/*/connections/*/repositories/*`. Either `uri` or + // `repository` can be specified and is required. + string repository = 6 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + }]; + } + + // The branch or tag to use. Must start with "refs/" (required). + string ref = 2; + + // See RepoType below. + GitFileSource.RepoType repo_type = 3; + + // The resource name of the enterprise config that should be applied + // to this source. + oneof enterprise_config { + // The full resource name of the github enterprise config. + // Format: + // `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`. + // `projects/{project}/githubEnterpriseConfigs/{id}`. + string github_enterprise_config = 4 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" + }]; + } +} + +// GitFileSource describes a file within a (possibly remote) code repository. +message GitFileSource { + // The type of the repo, since it may not be explicit from the `repo` field + // (e.g from a URL). + enum RepoType { + // The default, unknown repo type. Don't use it, instead use one of + // the other repo types. + UNKNOWN = 0; + + // A Google Cloud Source Repositories-hosted repo. + CLOUD_SOURCE_REPOSITORIES = 1; + + // A GitHub-hosted repo not necessarily on "github.com" (i.e. GitHub + // Enterprise). + GITHUB = 2; + + // A Bitbucket Server-hosted repo. + BITBUCKET_SERVER = 3; + + // A GitLab-hosted repo. + GITLAB = 4; + } + + // The path of the file, with the repo root as the root of the path. + string path = 1; + + // The URI of the repo. + // Either uri or repository can be specified. + // If unspecified, the repo from which the trigger invocation originated is + // assumed to be the repo from which to read the specified path. + string uri = 2; + + // The source of the SCM repo. + oneof source { + // The fully qualified resource name of the Repos API repository. + // Either URI or repository can be specified. + // If unspecified, the repo from which the trigger invocation originated is + // assumed to be the repo from which to read the specified path. + string repository = 7 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + }]; + } + + // See RepoType above. + RepoType repo_type = 3; + + // The branch, tag, arbitrary ref, or SHA version of the repo to use when + // resolving the filename (optional). + // This field respects the same syntax/resolution as described here: + // https://git-scm.com/docs/gitrevisions + // If unspecified, the revision from which the trigger invocation originated + // is assumed to be the revision from which to read the specified path. + string revision = 4; + + // The resource name of the enterprise config that should be applied + // to this source. + oneof enterprise_config { + // The full resource name of the github enterprise config. + // Format: + // `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`. + // `projects/{project}/githubEnterpriseConfigs/{id}`. + string github_enterprise_config = 5 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" + }]; + } +} + +// Configuration for an automated build in response to source repository +// changes. +message BuildTrigger { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + pattern: "projects/{project}/triggers/{trigger}" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" + plural: "triggers" + singular: "trigger" + }; + + // The `Trigger` name with format: + // `projects/{project}/locations/{location}/triggers/{trigger}`, where + // {trigger} is a unique identifier generated by the service. + string resource_name = 34; + + // Output only. Unique identifier of the trigger. + string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Human-readable description of this trigger. + string description = 10; + + // User-assigned name of the trigger. Must be unique within the project. + // Trigger names must meet the following requirements: + // + // + They must contain only alphanumeric characters and dashes. + // + They can be 1-64 characters long. + // + They must begin and end with an alphanumeric character. + string name = 21; + + // Tags for annotation of a `BuildTrigger` + repeated string tags = 19; + + // Template describing the types of source changes to trigger a build. + // + // Branch and tag names in trigger templates are interpreted as regular + // expressions. Any branch or tag change that matches that regular expression + // will trigger a build. + // + // Mutually exclusive with `github`. + RepoSource trigger_template = 7; + + // GitHubEventsConfig describes the configuration of a trigger that creates + // a build whenever a GitHub event is received. + // + // Mutually exclusive with `trigger_template`. + GitHubEventsConfig github = 13; + + // PubsubConfig describes the configuration of a trigger that + // creates a build whenever a Pub/Sub message is published. + PubsubConfig pubsub_config = 29; + + // WebhookConfig describes the configuration of a trigger that + // creates a build whenever a webhook is sent to a trigger's webhook URL. + WebhookConfig webhook_config = 31; + + // Template describing the Build request to make when the trigger is matched. + // At least one of the template fields must be provided. + oneof build_template { + // Autodetect build configuration. The following precedence is used (case + // insensitive): + // + // 1. cloudbuild.yaml + // 2. cloudbuild.yml + // 3. cloudbuild.json + // 4. Dockerfile + // + // Currently only available for GitHub App Triggers. + bool autodetect = 18; + + // Contents of the build template. + Build build = 4; + + // Path, from the source root, to the build configuration file + // (i.e. cloudbuild.yaml). + string filename = 8; + + // The file source describing the local or remote Build template. + GitFileSource git_file_source = 24; + } + + // Output only. Time when the trigger was created. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // If true, the trigger will never automatically execute a build. + bool disabled = 9; + + // Substitutions for Build resource. The keys must match the following + // regular expression: `^_[A-Z0-9_]+$`. + map substitutions = 11; + + // ignored_files and included_files are file glob matches using + // https://golang.org/pkg/path/filepath/#Match extended with support for "**". + // + // If ignored_files and changed files are both empty, then they are + // not used to determine whether or not to trigger a build. + // + // If ignored_files is not empty, then we ignore any files that match + // any of the ignored_file globs. If the change has no files that are + // outside of the ignored_files globs, then we do not trigger a build. + repeated string ignored_files = 15; + + // If any of the files altered in the commit pass the ignored_files + // filter and included_files is empty, then as far as this filter is + // concerned, we should trigger the build. + // + // If any of the files altered in the commit pass the ignored_files + // filter and included_files is not empty, then we make sure that at + // least one of those files matches a included_files glob. If not, + // then we do not trigger a build. + repeated string included_files = 16; + + // Optional. A Common Expression Language string. + string filter = 30 [(google.api.field_behavior) = OPTIONAL]; + + // The repo and ref of the repository from which to build. This field + // is used only for those triggers that do not respond to SCM events. + // Triggers that respond to such events build source at whatever commit + // caused the event. + // This field is currently only used by Webhook, Pub/Sub, Manual, and Cron + // triggers. + GitRepoSource source_to_build = 26; + + // The service account used for all user-controlled operations including + // UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild. + // If no service account is set, then the standard Cloud Build service account + // ([PROJECT_NUM]@system.gserviceaccount.com) will be used instead. + // Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}` + string service_account = 33 [(google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + }]; + + // The configuration of a trigger that creates a build whenever an event from + // Repo API is received. + RepositoryEventConfig repository_event_config = 39; +} + +// The configuration of a trigger that creates a build whenever an event from +// Repo API is received. +message RepositoryEventConfig { + // All possible SCM repo types from Repo API. + enum RepositoryType { + // If unspecified, RepositoryType defaults to GITHUB. + REPOSITORY_TYPE_UNSPECIFIED = 0; + + // The SCM repo is GITHUB. + GITHUB = 1; + + // The SCM repo is GITHUB Enterprise. + GITHUB_ENTERPRISE = 2; + + // The SCM repo is GITLAB Enterprise. + GITLAB_ENTERPRISE = 3; + } + + // The resource name of the Repo API resource. + string repository = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + }]; + + // Output only. The type of the SCM vendor the repository points to. + RepositoryType repository_type = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The types of filter to trigger a build. + oneof filter { + // Filter to match changes in pull requests. + PullRequestFilter pull_request = 3; + + // Filter to match changes in refs like branches, tags. + PushFilter push = 4; + } +} + +// GitHubEventsConfig describes the configuration of a trigger that creates a +// build whenever a GitHub event is received. +message GitHubEventsConfig { + // The installationID that emits the GitHub event. + int64 installation_id = 1 [deprecated = true]; + + // Owner of the repository. For example: The owner for + // https://github.com/googlecloudplatform/cloud-builders is + // "googlecloudplatform". + string owner = 6; + + // Name of the repository. For example: The name for + // https://github.com/googlecloudplatform/cloud-builders is "cloud-builders". + string name = 7; + + // Filter describing the types of events to trigger a build. + // Currently supported event types: push, pull_request. + oneof event { + // filter to match changes in pull requests. + PullRequestFilter pull_request = 4; + + // filter to match changes in refs like branches, tags. + PushFilter push = 5; + } +} + +// PubsubConfig describes the configuration of a trigger that +// creates a build whenever a Pub/Sub message is published. +message PubsubConfig { + // Enumerates potential issues with the underlying Pub/Sub subscription + // configuration. + enum State { + // The subscription configuration has not been checked. + STATE_UNSPECIFIED = 0; + + // The Pub/Sub subscription is properly configured. + OK = 1; + + // The subscription has been deleted. + SUBSCRIPTION_DELETED = 2; + + // The topic has been deleted. + TOPIC_DELETED = 3; + + // Some of the subscription's field are misconfigured. + SUBSCRIPTION_MISCONFIGURED = 4; + } + + // Output only. Name of the subscription. Format is + // `projects/{project}/subscriptions/{subscription}`. + string subscription = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "pubsub.googleapis.com/Subscription" + } + ]; + + // The name of the topic from which this subscription is receiving messages. + // Format is `projects/{project}/topics/{topic}`. + string topic = 2 [ + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; + + // Service account that will make the push request. + string service_account_email = 3 [(google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + }]; + + // Potential issues with the underlying Pub/Sub subscription configuration. + // Only populated on get requests. + State state = 4; +} + +// WebhookConfig describes the configuration of a trigger that +// creates a build whenever a webhook is sent to a trigger's webhook URL. +message WebhookConfig { + // Enumerates potential issues with the Secret Manager secret provided by the + // user. + enum State { + // The webhook auth configuration not been checked. + STATE_UNSPECIFIED = 0; + + // The auth configuration is properly setup. + OK = 1; + + // The secret provided in auth_method has been deleted. + SECRET_DELETED = 2; + } + + // Auth method specifies how the webhook authenticates with GCP. + oneof auth_method { + // Required. Resource name for the secret required as a URL parameter. + string secret = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; + } + + // Potential issues with the underlying Pub/Sub subscription configuration. + // Only populated on get requests. + State state = 4; +} + +// PullRequestFilter contains filter properties for matching GitHub Pull +// Requests. +message PullRequestFilter { + // Controls behavior of Pull Request comments. + enum CommentControl { + // Do not require comments on Pull Requests before builds are triggered. + COMMENTS_DISABLED = 0; + + // Enforce that repository owners or collaborators must comment on Pull + // Requests before builds are triggered. + COMMENTS_ENABLED = 1; + + // Enforce that repository owners or collaborators must comment on external + // contributors' Pull Requests before builds are triggered. + COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY = 2; + } + + // Target refs to match. + // A target ref is the git reference where the pull request will be applied. + oneof git_ref { + // Regex of branches to match. + // + // 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 = 2; + } + + // Configure builds to run whether a repository owner or collaborator need to + // comment `/gcbrun`. + CommentControl comment_control = 5; + + // If true, branches that do NOT match the git_ref will trigger a build. + bool invert_regex = 6; +} + +// Push contains filter properties for matching GitHub git pushes. +message PushFilter { + // Modified refs to match. + // A modified refs are the refs modified by a git push operation. + oneof git_ref { + // Regexes 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 = 2; + + // Regexes 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 = 3; + } + + // When true, only trigger a build if the revision regex does NOT match the + // git_ref regex. + bool invert_regex = 4; +} + +// Request to create a new `BuildTrigger`. +message CreateBuildTriggerRequest { + // The parent resource where this trigger will be created. + // Format: `projects/{project}/locations/{location}` + string parent = 3 [(google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project for which to configure automatic builds. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. `BuildTrigger` to create. + BuildTrigger trigger = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Returns the `BuildTrigger` with the specified ID. +message GetBuildTriggerRequest { + // The name of the `Trigger` to retrieve. + // Format: `projects/{project}/locations/{location}/triggers/{trigger}` + string name = 3 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project that owns the trigger. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to list existing `BuildTriggers`. +message ListBuildTriggersRequest { + // The parent of the collection of `Triggers`. + // Format: `projects/{project}/locations/{location}` + string parent = 4 [(google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project for which to list BuildTriggers. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Number of results to return in the list. + int32 page_size = 2; + + // Token to provide to skip to a particular spot in the list. + string page_token = 3; +} + +// Response containing existing `BuildTriggers`. +message ListBuildTriggersResponse { + // `BuildTriggers` for the project, sorted by `create_time` descending. + repeated BuildTrigger triggers = 1; + + // Token to receive the next page of results. + string next_page_token = 2; +} + +// Request to delete a `BuildTrigger`. +message DeleteBuildTriggerRequest { + // The name of the `Trigger` to delete. + // Format: `projects/{project}/locations/{location}/triggers/{trigger}` + string name = 3 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project that owns the trigger. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the `BuildTrigger` to delete. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to update an existing `BuildTrigger`. +message UpdateBuildTriggerRequest { + // Required. ID of the project that owns the trigger. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the `BuildTrigger` to update. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. `BuildTrigger` to update. + BuildTrigger trigger = 3 [(google.api.field_behavior) = REQUIRED]; + + // Update mask for the resource. If this is set, + // the server will only update the fields specified in the field mask. + // Otherwise, a full update of the mutable resource fields will be performed. + google.protobuf.FieldMask update_mask = 5; +} + +// Optional arguments to enable specific features of builds. +message BuildOptions { + // Specifies the manner in which the build should be verified, if at all. + // + // If a verified build is requested, and any part of the process to generate + // and upload provenance fails, the build will also fail. + // + // If the build does not request verification then that process may occur, but + // is not guaranteed to. If it does occur and fails, the build will not fail. + // + // For more information, see [Viewing Build + // Provenance](https://cloud.google.com/build/docs/securing-builds/view-build-provenance). + enum VerifyOption { + // Not a verifiable build (the default). + NOT_VERIFIED = 0; + + // Build must be verified. + VERIFIED = 1; + } + + // Supported Compute Engine machine types. + // For more information, see [Machine + // types](https://cloud.google.com/compute/docs/machine-types). + enum MachineType { + // Standard machine type. + UNSPECIFIED = 0; + + // Highcpu machine with 8 CPUs. + N1_HIGHCPU_8 = 1; + + // Highcpu machine with 32 CPUs. + N1_HIGHCPU_32 = 2; + + // Highcpu e2 machine with 8 CPUs. + E2_HIGHCPU_8 = 5; + + // Highcpu e2 machine with 32 CPUs. + E2_HIGHCPU_32 = 6; + + // E2 machine with 1 CPU. + E2_MEDIUM = 7; + } + + // Specifies the behavior when there is an error in the substitution checks. + enum SubstitutionOption { + // Fails the build if error in substitutions checks, like missing + // a substitution in the template or in the map. + MUST_MATCH = 0; + + // Do not fail the build if error in substitutions checks. + ALLOW_LOOSE = 1; + } + + // Specifies the behavior when writing build logs to Cloud Storage. + enum LogStreamingOption { + // Service may automatically determine build log streaming behavior. + STREAM_DEFAULT = 0; + + // Build logs should be streamed to Cloud Storage. + STREAM_ON = 1; + + // Build logs should not be streamed to Cloud Storage; they will be + // written when the build is completed. + STREAM_OFF = 2; + } + + // Details about how a build should be executed on a `WorkerPool`. + // + // See [running builds in a private + // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) + // for more information. + message PoolOption { + // The `WorkerPool` resource to execute the build on. + // You must have `cloudbuild.workerpools.use` on the project hosting the + // WorkerPool. + // + // Format projects/{project}/locations/{location}/workerPools/{workerPoolId} + string name = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + } + + // Specifies the logging mode. + enum LoggingMode { + // The service determines the logging mode. The default is `LEGACY`. Do not + // rely on the default logging behavior as it may change in the future. + LOGGING_UNSPECIFIED = 0; + + // Build logs are stored in Cloud Logging and Cloud Storage. + LEGACY = 1; + + // Build logs are stored in Cloud Storage. + GCS_ONLY = 2; + + // This option is the same as CLOUD_LOGGING_ONLY. + STACKDRIVER_ONLY = 3 [deprecated = true]; + + // Build logs are stored in Cloud Logging. Selecting this option will not + // allow [logs + // streaming](https://cloud.google.com/sdk/gcloud/reference/builds/log). + CLOUD_LOGGING_ONLY = 5; + + // Turn off all logging. No build logs will be captured. + NONE = 4; + } + + // Default GCS log bucket behavior options. + enum DefaultLogsBucketBehavior { + // Unspecified. + DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED = 0; + + // Bucket is located in user-owned project in the same region as the + // build. The builder service account must have access to create and write + // to GCS buckets in the build project. + REGIONAL_USER_OWNED_BUCKET = 1; + } + + // Requested hash for SourceProvenance. + repeated Hash.HashType source_provenance_hash = 1; + + // Requested verifiability options. + VerifyOption requested_verify_option = 2; + + // Compute Engine machine type on which to run the build. + MachineType machine_type = 3; + + // Requested disk size for the VM that runs the build. Note that this is *NOT* + // "disk free"; some of the space will be used by the operating system and + // build utilities. Also note that this is the minimum disk size that will be + // allocated for the build -- the build may run with a larger disk than + // requested. At present, the maximum disk size is 2000GB; builds that request + // more than the maximum are rejected with an error. + int64 disk_size_gb = 6; + + // Option to specify behavior when there is an error in the substitution + // checks. + // + // NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot + // be overridden in the build configuration file. + SubstitutionOption substitution_option = 4; + + // Option to specify whether or not to apply bash style string + // operations to the substitutions. + // + // NOTE: this is always enabled for triggered builds and cannot be + // overridden in the build configuration file. + bool dynamic_substitutions = 17; + + // Option to include built-in and custom substitutions as env variables + // for all build steps. + bool automap_substitutions = 22; + + // Option to define build log streaming behavior to Cloud + // Storage. + LogStreamingOption log_streaming_option = 5; + + // This field deprecated; please use `pool.name` instead. + string worker_pool = 7 [deprecated = true]; + + // Optional. Specification for execution on a `WorkerPool`. + // + // See [running builds in a private + // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) + // for more information. + PoolOption pool = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Option to specify the logging mode, which determines if and where build + // logs are stored. + LoggingMode logging = 11; + + // A list of global environment variable definitions that will exist for all + // build steps in this build. If a variable is defined in both globally and in + // a build step, the variable will use the build step value. + // + // The elements are of the form "KEY=VALUE" for the environment variable "KEY" + // being given the value "VALUE". + repeated string env = 12; + + // A list of global environment variables, which are encrypted using a Cloud + // Key Management Service crypto key. These values must be specified in the + // build's `Secret`. These variables will be available to all build steps + // in this build. + repeated string secret_env = 13; + + // Global list of volumes to mount for ALL build steps + // + // Each volume is created as an empty volume prior to starting the build + // process. Upon completion of the build, volumes and their contents are + // discarded. Global volume names and paths cannot conflict with the volumes + // defined a build step. + // + // Using a global volume in a build with only one step is not valid as + // it is indicative of a build request with an incorrect configuration. + repeated Volume volumes = 14; + + // Optional. Option to specify how default logs buckets are setup. + DefaultLogsBucketBehavior default_logs_bucket_behavior = 21 + [(google.api.field_behavior) = OPTIONAL]; +} + +// ReceiveTriggerWebhookRequest [Experimental] is the request object accepted by +// the ReceiveTriggerWebhook method. +message ReceiveTriggerWebhookRequest { + // The name of the `ReceiveTriggerWebhook` to retrieve. + // Format: `projects/{project}/locations/{location}/triggers/{trigger}` + string name = 5; + + // HTTP request body. + google.api.HttpBody body = 1; + + // Project in which the specified trigger lives + string project_id = 2; + + // Name of the trigger to run the payload against + string trigger = 3; + + // Secret token used for authorization if an OAuth token isn't provided. + string secret = 4; +} + +// ReceiveTriggerWebhookResponse [Experimental] is the response object for the +// ReceiveTriggerWebhook method. +message ReceiveTriggerWebhookResponse {} + +message GitHubEnterpriseConfig { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" + pattern: "projects/{project}/githubEnterpriseConfigs/{config}" + pattern: "projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}" + }; + + // Optional. The full resource name for the GitHubEnterpriseConfig + // For example: + // "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}" + string name = 7 [(google.api.field_behavior) = OPTIONAL]; + + // The URL of the github enterprise host the configuration is for. + string host_url = 3; + + // Required. The GitHub app id of the Cloud Build app on the GitHub Enterprise + // server. + int64 app_id = 4 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Time when the installation was associated with the project. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The key that should be attached to webhook calls to the ReceiveWebhook + // endpoint. + string webhook_key = 8; + + // Optional. The network to be used when reaching out to the GitHub + // Enterprise server. The VPC network must be enabled for private + // service connection. This should be set if the GitHub Enterprise server is + // hosted on-premises and not reachable by public internet. + // If this field is left empty, no network peering will occur and calls to + // the GitHub Enterprise server will be made over the public internet. + // Must be in the format + // `projects/{project}/global/networks/{network}`, where {project} + // is a project number or id and {network} is the name of a + // VPC network in the project. + string peered_network = 9 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; + + // Names of secrets in Secret Manager. + GitHubEnterpriseSecrets secrets = 10; + + // Name to display for this config. + string display_name = 11; + + // Optional. SSL certificate to use for requests to GitHub Enterprise. + string ssl_ca = 12 [(google.api.field_behavior) = OPTIONAL]; +} + +// GitHubEnterpriseSecrets represents the names of all necessary secrets in +// Secret Manager for a GitHub Enterprise server. +// Format is: projects//secrets/. +message GitHubEnterpriseSecrets { + // The resource name for the private key secret version. + string private_key_version_name = 5 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // The resource name for the webhook secret secret version in Secret Manager. + string webhook_secret_version_name = 6 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // The resource name for the OAuth secret secret version in Secret Manager. + string oauth_secret_version_name = 7 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // The resource name for the OAuth client ID secret version in Secret Manager. + string oauth_client_id_version_name = 8 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; +} + +// Configuration for a `WorkerPool`. +// +// Cloud Build owns and maintains a pool of workers for general use and have no +// access to a project's private network. By default, builds submitted to +// Cloud Build will use a worker from this pool. +// +// If your build needs access to resources on a private network, +// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give +// your builds access to any single VPC network that you +// administer, including any on-prem resources connected to that VPC +// network. For an overview of private pools, see +// [Private pools +// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview). +message WorkerPool { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/WorkerPool" + pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" + plural: "workerPools" + singular: "workerPool" + style: DECLARATIVE_FRIENDLY + }; + + // State of the `WorkerPool`. + enum State { + // State of the `WorkerPool` is unknown. + STATE_UNSPECIFIED = 0; + + // `WorkerPool` is being created. + CREATING = 1; + + // `WorkerPool` is running. + RUNNING = 2; + + // `WorkerPool` is being deleted: cancelling builds and draining workers. + DELETING = 3; + + // `WorkerPool` is deleted. + DELETED = 4; + + // `WorkerPool` is being updated; new builds cannot be run. + UPDATING = 5; + } + + // Output only. The resource name of the `WorkerPool`, with format + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + // The value of `{worker_pool}` is provided by `worker_pool_id` in + // `CreateWorkerPool` request and the value of `{location}` is determined by + // the endpoint accessed. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A user-specified, human-readable name for the `WorkerPool`. If provided, + // this value must be 1-63 characters. + string display_name = 2; + + // Output only. A unique identifier for the `WorkerPool`. + string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User specified annotations. See https://google.aip.dev/128#annotations + // for more details such as format and size limitations. + map annotations = 4; + + // Output only. Time at which the request to create the `WorkerPool` was + // received. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which the request to update the `WorkerPool` was + // received. + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which the request to delete the `WorkerPool` was + // received. + google.protobuf.Timestamp delete_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. `WorkerPool` state. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Configuration for the `WorkerPool`. + oneof config { + // Legacy Private Pool configuration. + PrivatePoolV1Config private_pool_v1_config = 12; + } + + // Output only. Checksum computed by the server. May be sent on update and + // delete requests to ensure that the client has an up-to-date value before + // proceeding. + string etag = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration for a V1 `PrivatePool`. +message PrivatePoolV1Config { + // Defines the configuration to be used for creating workers in + // the pool. + message WorkerConfig { + // Machine type of a worker, such as `e2-medium`. + // See [Worker pool config + // file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema). + // If left blank, Cloud Build will use a sensible default. + string machine_type = 1; + + // Size of the disk attached to the worker, in GB. + // See [Worker pool config + // file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema). + // Specify a value of up to 2000. If `0` is specified, Cloud Build will use + // a standard disk size. + int64 disk_size_gb = 2; + } + + // Defines the network configuration for the pool. + message NetworkConfig { + // Defines the egress option for the pool. + enum EgressOption { + // If set, defaults to PUBLIC_EGRESS. + EGRESS_OPTION_UNSPECIFIED = 0; + + // If set, workers are created without any public address, which prevents + // network egress to public IPs unless a network proxy is configured. + NO_PUBLIC_EGRESS = 1; + + // If set, workers are created with a public address which allows for + // public internet egress. + PUBLIC_EGRESS = 2; + } + + // Required. Immutable. The network definition that the workers are peered + // to. If this section is left empty, the workers will be peered to + // `WorkerPool.project_id` on the service producer network. Must be in the + // format `projects/{project}/global/networks/{network}`, where `{project}` + // is a project number, such as `12345`, and `{network}` is the name of a + // VPC network in the project. See + // [Understanding network configuration + // options](https://cloud.google.com/build/docs/private-pools/set-up-private-pool-environment) + string peered_network = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Network" + } + ]; + + // Option to configure network egress for the workers. + EgressOption egress_option = 2; + + // Immutable. Subnet IP range within the peered network. This is specified + // in CIDR notation with a slash and the subnet prefix size. You can + // optionally specify an IP address before the subnet prefix value. e.g. + // `192.168.0.0/29` would specify an IP range starting at 192.168.0.0 with a + // prefix size of 29 bits. + // `/16` would specify a prefix size of 16 bits, with an automatically + // determined IP within the peered VPC. + // If unspecified, a value of `/24` will be used. + string peered_network_ip_range = 3 + [(google.api.field_behavior) = IMMUTABLE]; + } + + // Machine configuration for the workers in the pool. + WorkerConfig worker_config = 1; + + // Network configuration for the pool. + NetworkConfig network_config = 2; +} + +// Request to create a new `WorkerPool`. +message CreateWorkerPoolRequest { + // Required. The parent resource where this worker pool will be created. + // Format: `projects/{project}/locations/{location}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. `WorkerPool` resource to create. + WorkerPool worker_pool = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Immutable. The ID to use for the `WorkerPool`, which will become + // the final component of the resource name. + // + // This value should be 1-63 characters, and valid characters + // are /[a-z][0-9]-/. + string worker_pool_id = 3 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = REQUIRED + ]; + + // If set, validate the request and preview the response, but do not actually + // post it. + bool validate_only = 4; +} + +// Request to get a `WorkerPool` with the specified name. +message GetWorkerPoolRequest { + // Required. The name of the `WorkerPool` to retrieve. + // Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + } + ]; +} + +// Request to delete a `WorkerPool`. +message DeleteWorkerPoolRequest { + // Required. The name of the `WorkerPool` to delete. + // Format: + // `projects/{project}/locations/{location}/workerPools/{workerPool}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + } + ]; + + // Optional. If provided, it must match the server's etag on the workerpool + // for the request to be processed. + string etag = 2 [(google.api.field_behavior) = OPTIONAL]; + + // If set to true, and the `WorkerPool` is not found, the request will succeed + // but no action will be taken on the server. + bool allow_missing = 3; + + // If set, validate the request and preview the response, but do not actually + // post it. + bool validate_only = 4; +} + +// Request to update a `WorkerPool`. +message UpdateWorkerPoolRequest { + // Required. The `WorkerPool` to update. + // + // The `name` field is used to identify the `WorkerPool` to update. + // Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + WorkerPool worker_pool = 1 [(google.api.field_behavior) = REQUIRED]; + + // A mask specifying which fields in `worker_pool` to update. + google.protobuf.FieldMask update_mask = 2; + + // If set, validate the request and preview the response, but do not actually + // post it. + bool validate_only = 4; +} + +// Request to list `WorkerPool`s. +message ListWorkerPoolsRequest { + // Required. The parent of the collection of `WorkerPools`. + // Format: `projects/{project}/locations/{location}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of `WorkerPool`s to return. The service may return + // fewer than this value. If omitted, the server will use a sensible default. + int32 page_size = 2; + + // A page token, received from a previous `ListWorkerPools` call. Provide this + // to retrieve the subsequent page. + string page_token = 3; +} + +// Response containing existing `WorkerPools`. +message ListWorkerPoolsResponse { + // `WorkerPools` for the specified project. + repeated WorkerPool worker_pools = 1; + + // Continuation token used to page through large result sets. Provide this + // value in a subsequent ListWorkerPoolsRequest to return the next page of + // results. + string next_page_token = 2; +} + +// Metadata for the `CreateWorkerPool` operation. +message CreateWorkerPoolOperationMetadata { + // The resource name of the `WorkerPool` to create. + // Format: + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + string worker_pool = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // Time the operation was created. + google.protobuf.Timestamp create_time = 2; + + // Time the operation was completed. + google.protobuf.Timestamp complete_time = 3; +} + +// Metadata for the `UpdateWorkerPool` operation. +message UpdateWorkerPoolOperationMetadata { + // The resource name of the `WorkerPool` being updated. + // Format: + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + string worker_pool = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // Time the operation was created. + google.protobuf.Timestamp create_time = 2; + + // Time the operation was completed. + google.protobuf.Timestamp complete_time = 3; +} + +// Metadata for the `DeleteWorkerPool` operation. +message DeleteWorkerPoolOperationMetadata { + // The resource name of the `WorkerPool` being deleted. + // Format: + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + string worker_pool = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // Time the operation was created. + google.protobuf.Timestamp create_time = 2; + + // Time the operation was completed. + google.protobuf.Timestamp complete_time = 3; +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js new file mode 100644 index 00000000000..8b0d3fb6a27 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.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 cloudbuild_v1_generated_CloudBuild_ApproveBuild_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 target build. + * For example: "projects/{$project_id}/builds/{$build_id}" + */ + // const name = 'abc123' + /** + * Approval decision and metadata. + */ + // const approvalResult = {} + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callApproveBuild() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await cloudbuildClient.approveBuild(request); + const [response] = await operation.promise(); + console.log(response); + } + + callApproveBuild(); + // [END cloudbuild_v1_generated_CloudBuild_ApproveBuild_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js new file mode 100644 index 00000000000..db4b5cc4a2b --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.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(projectId, id) { + // [START cloudbuild_v1_generated_CloudBuild_CancelBuild_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the `Build` to cancel. + * Format: `projects/{project}/locations/{location}/builds/{build}` + */ + // const name = 'abc123' + /** + * Required. ID of the project. + */ + // const projectId = 'abc123' + /** + * Required. ID of the build. + */ + // const id = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callCancelBuild() { + // Construct request + const request = { + projectId, + id, + }; + + // Run request + const response = await cloudbuildClient.cancelBuild(request); + console.log(response); + } + + callCancelBuild(); + // [END cloudbuild_v1_generated_CloudBuild_CancelBuild_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js new file mode 100644 index 00000000000..4b5eaf08a32 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.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(projectId, build) { + // [START cloudbuild_v1_generated_CloudBuild_CreateBuild_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 resource where this build will be created. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. ID of the project. + */ + // const projectId = 'abc123' + /** + * Required. Build resource to create. + */ + // const build = {} + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callCreateBuild() { + // Construct request + const request = { + projectId, + build, + }; + + // Run request + const [operation] = await cloudbuildClient.createBuild(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBuild(); + // [END cloudbuild_v1_generated_CloudBuild_CreateBuild_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js new file mode 100644 index 00000000000..4ecc084fa67 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.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(projectId, trigger) { + // [START cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 resource where this trigger will be created. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. ID of the project for which to configure automatic builds. + */ + // const projectId = 'abc123' + /** + * Required. `BuildTrigger` to create. + */ + // const trigger = {} + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callCreateBuildTrigger() { + // Construct request + const request = { + projectId, + trigger, + }; + + // Run request + const response = await cloudbuildClient.createBuildTrigger(request); + console.log(response); + } + + callCreateBuildTrigger(); + // [END cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js new file mode 100644 index 00000000000..d06ff8cb64c --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.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, workerPool, workerPoolId) { + // [START cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 where this worker pool will be created. + * Format: `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Required. `WorkerPool` resource to create. + */ + // const workerPool = {} + /** + * Required. Immutable. The ID to use for the `WorkerPool`, which will become + * the final component of the resource name. + * This value should be 1-63 characters, and valid characters + * are /[a-z][0-9]-/. + */ + // const workerPoolId = 'abc123' + /** + * If set, validate the request and preview the response, but do not actually + * post it. + */ + // const validateOnly = true + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callCreateWorkerPool() { + // Construct request + const request = { + parent, + workerPool, + workerPoolId, + }; + + // Run request + const [operation] = await cloudbuildClient.createWorkerPool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateWorkerPool(); + // [END cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js new file mode 100644 index 00000000000..716af8a093d --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.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(projectId, triggerId) { + // [START cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the `Trigger` to delete. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + */ + // const name = 'abc123' + /** + * Required. ID of the project that owns the trigger. + */ + // const projectId = 'abc123' + /** + * Required. ID of the `BuildTrigger` to delete. + */ + // const triggerId = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callDeleteBuildTrigger() { + // Construct request + const request = { + projectId, + triggerId, + }; + + // Run request + const response = await cloudbuildClient.deleteBuildTrigger(request); + console.log(response); + } + + callDeleteBuildTrigger(); + // [END cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js new file mode 100644 index 00000000000..9475c1af929 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_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(name) { + // [START cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 `WorkerPool` to delete. + * Format: + * `projects/{project}/locations/{location}/workerPools/{workerPool}`. + */ + // const name = 'abc123' + /** + * Optional. If provided, it must match the server's etag on the workerpool + * for the request to be processed. + */ + // const etag = 'abc123' + /** + * If set to true, and the `WorkerPool` is not found, the request will succeed + * but no action will be taken on the server. + */ + // const allowMissing = true + /** + * If set, validate the request and preview the response, but do not actually + * post it. + */ + // const validateOnly = true + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callDeleteWorkerPool() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await cloudbuildClient.deleteWorkerPool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteWorkerPool(); + // [END cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js new file mode 100644 index 00000000000..4a51363d4b5 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.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(projectId, id) { + // [START cloudbuild_v1_generated_CloudBuild_GetBuild_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the `Build` to retrieve. + * Format: `projects/{project}/locations/{location}/builds/{build}` + */ + // const name = 'abc123' + /** + * Required. ID of the project. + */ + // const projectId = 'abc123' + /** + * Required. ID of the build. + */ + // const id = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callGetBuild() { + // Construct request + const request = { + projectId, + id, + }; + + // Run request + const response = await cloudbuildClient.getBuild(request); + console.log(response); + } + + callGetBuild(); + // [END cloudbuild_v1_generated_CloudBuild_GetBuild_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js new file mode 100644 index 00000000000..6a2d62f21b6 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.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(projectId, triggerId) { + // [START cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the `Trigger` to retrieve. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + */ + // const name = 'abc123' + /** + * Required. ID of the project that owns the trigger. + */ + // const projectId = 'abc123' + /** + * Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. + */ + // const triggerId = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callGetBuildTrigger() { + // Construct request + const request = { + projectId, + triggerId, + }; + + // Run request + const response = await cloudbuildClient.getBuildTrigger(request); + console.log(response); + } + + callGetBuildTrigger(); + // [END cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js new file mode 100644 index 00000000000..03a02cb42b7 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.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 cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 `WorkerPool` to retrieve. + * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + */ + // const name = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callGetWorkerPool() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await cloudbuildClient.getWorkerPool(request); + console.log(response); + } + + callGetWorkerPool(); + // [END cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js new file mode 100644 index 00000000000..973a4f720fd --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.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(projectId) { + // [START cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 of the collection of `Triggers`. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. ID of the project for which to list BuildTriggers. + */ + // const projectId = 'abc123' + /** + * Number of results to return in the list. + */ + // const pageSize = 1234 + /** + * Token to provide to skip to a particular spot in the list. + */ + // const pageToken = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callListBuildTriggers() { + // Construct request + const request = { + projectId, + }; + + // Run request + const iterable = await cloudbuildClient.listBuildTriggersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBuildTriggers(); + // [END cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js new file mode 100644 index 00000000000..a19245f4d07 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.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(projectId) { + // [START cloudbuild_v1_generated_CloudBuild_ListBuilds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 of the collection of `Builds`. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. ID of the project. + */ + // const projectId = 'abc123' + /** + * Number of results to return in the list. + */ + // const pageSize = 1234 + /** + * The page token for the next page of Builds. + * If unspecified, the first page of results is returned. + * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. + * In this case, the token should be discarded, and pagination should be + * restarted from the first page of results. + * See https://google.aip.dev/158 for more. + */ + // const pageToken = 'abc123' + /** + * The raw filter text to constrain the results. + */ + // const filter = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callListBuilds() { + // Construct request + const request = { + projectId, + }; + + // Run request + const iterable = await cloudbuildClient.listBuildsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBuilds(); + // [END cloudbuild_v1_generated_CloudBuild_ListBuilds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js new file mode 100644 index 00000000000..51cbd24e9fb --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.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) { + // [START cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 of the collection of `WorkerPools`. + * Format: `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * The maximum number of `WorkerPool`s to return. The service may return + * fewer than this value. If omitted, the server will use a sensible default. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListWorkerPools` call. Provide this + * to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callListWorkerPools() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await cloudbuildClient.listWorkerPoolsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListWorkerPools(); + // [END cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js new file mode 100644 index 00000000000..11ca471ed4e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.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 cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the `ReceiveTriggerWebhook` to retrieve. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + */ + // const name = 'abc123' + /** + * HTTP request body. + */ + // const body = {} + /** + * Project in which the specified trigger lives + */ + // const projectId = 'abc123' + /** + * Name of the trigger to run the payload against + */ + // const trigger = 'abc123' + /** + * Secret token used for authorization if an OAuth token isn't provided. + */ + // const secret = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callReceiveTriggerWebhook() { + // Construct request + const request = { + }; + + // Run request + const response = await cloudbuildClient.receiveTriggerWebhook(request); + console.log(response); + } + + callReceiveTriggerWebhook(); + // [END cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js new file mode 100644 index 00000000000..7a3341c3944 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.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(projectId, id) { + // [START cloudbuild_v1_generated_CloudBuild_RetryBuild_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the `Build` to retry. + * Format: `projects/{project}/locations/{location}/builds/{build}` + */ + // const name = 'abc123' + /** + * Required. ID of the project. + */ + // const projectId = 'abc123' + /** + * Required. Build ID of the original build. + */ + // const id = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callRetryBuild() { + // Construct request + const request = { + projectId, + id, + }; + + // Run request + const [operation] = await cloudbuildClient.retryBuild(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRetryBuild(); + // [END cloudbuild_v1_generated_CloudBuild_RetryBuild_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js new file mode 100644 index 00000000000..5ea555bab67 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.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(projectId, triggerId) { + // [START cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the `Trigger` to run. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + */ + // const name = 'abc123' + /** + * Required. ID of the project. + */ + // const projectId = 'abc123' + /** + * Required. ID of the trigger. + */ + // const triggerId = 'abc123' + /** + * Source to build against this trigger. + * Branch and tag names cannot consist of regular expressions. + */ + // const source = {} + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callRunBuildTrigger() { + // Construct request + const request = { + projectId, + triggerId, + }; + + // Run request + const [operation] = await cloudbuildClient.runBuildTrigger(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunBuildTrigger(); + // [END cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js new file mode 100644 index 00000000000..b770dfe60e3 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.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(projectId, triggerId, trigger) { + // [START cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. ID of the project that owns the trigger. + */ + // const projectId = 'abc123' + /** + * Required. ID of the `BuildTrigger` to update. + */ + // const triggerId = 'abc123' + /** + * Required. `BuildTrigger` to update. + */ + // const trigger = {} + /** + * Update mask for the resource. If this is set, + * the server will only update the fields specified in the field mask. + * Otherwise, a full update of the mutable resource fields will be performed. + */ + // const updateMask = {} + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callUpdateBuildTrigger() { + // Construct request + const request = { + projectId, + triggerId, + trigger, + }; + + // Run request + const response = await cloudbuildClient.updateBuildTrigger(request); + console.log(response); + } + + callUpdateBuildTrigger(); + // [END cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js new file mode 100644 index 00000000000..5a07273017c --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.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(workerPool) { + // [START cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The `WorkerPool` to update. + * The `name` field is used to identify the `WorkerPool` to update. + * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + */ + // const workerPool = {} + /** + * A mask specifying which fields in `worker_pool` to update. + */ + // const updateMask = {} + /** + * If set, validate the request and preview the response, but do not actually + * post it. + */ + // const validateOnly = true + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callUpdateWorkerPool() { + // Construct request + const request = { + workerPool, + }; + + // Run request + const [operation] = await cloudbuildClient.updateWorkerPool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateWorkerPool(); + // [END cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata_google.devtools.cloudbuild.v1.json b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata_google.devtools.cloudbuild.v1.json new file mode 100644 index 00000000000..294630fc3f9 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata_google.devtools.cloudbuild.v1.json @@ -0,0 +1,903 @@ +{ + "clientLibrary": { + "name": "nodejs-cloudbuild", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.devtools.cloudbuild.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateBuild_async", + "title": "CloudBuild createBuild Sample", + "origin": "API_DEFINITION", + "description": " Starts a build with the specified configuration. This method returns a long-running `Operation`, which includes the build ID. Pass the build ID to `GetBuild` to determine the build status (such as `SUCCESS` or `FAILURE`).", + "canonical": true, + "file": "cloud_build.create_build.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuild", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "build", + "type": ".google.devtools.cloudbuild.v1.Build" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "CreateBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuild", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_GetBuild_async", + "title": "CloudBuild getBuild Sample", + "origin": "API_DEFINITION", + "description": " Returns information about a previously requested build. The `Build` that is returned includes its status (such as `SUCCESS`, `FAILURE`, or `WORKING`), and timing information.", + "canonical": true, + "file": "cloud_build.get_build.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuild", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.Build", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "GetBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuild", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_ListBuilds_async", + "title": "CloudBuild listBuilds Sample", + "origin": "API_DEFINITION", + "description": " Lists previously requested builds. Previously requested builds may still be in-progress, or may have finished successfully or unsuccessfully.", + "canonical": true, + "file": "cloud_build.list_builds.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBuilds", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuilds", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.ListBuildsResponse", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "ListBuilds", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuilds", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_CancelBuild_async", + "title": "CloudBuild cancelBuild Sample", + "origin": "API_DEFINITION", + "description": " Cancels a build in progress.", + "canonical": true, + "file": "cloud_build.cancel_build.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CancelBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CancelBuild", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.Build", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "CancelBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CancelBuild", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_RetryBuild_async", + "title": "CloudBuild retryBuild Sample", + "origin": "API_DEFINITION", + "description": " Creates a new build based on the specified build. This method creates a new build using the original build request, which may or may not result in an identical build. For triggered builds: * Triggered builds resolve to a precise revision; therefore a retry of a triggered build will result in a build that uses the same revision. For non-triggered builds that specify `RepoSource`: * If the original build built from the tip of a branch, the retried build will build from the tip of that branch, which may not be the same revision as the original build. * If the original build specified a commit sha or revision ID, the retried build will use the identical source. For builds that specify `StorageSource`: * If the original build pulled source from Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source. * If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.", + "canonical": true, + "file": "cloud_build.retry_build.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RetryBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RetryBuild", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "RetryBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RetryBuild", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_ApproveBuild_async", + "title": "CloudBuild approveBuild Sample", + "origin": "API_DEFINITION", + "description": " Approves or rejects a pending build. If approved, the returned LRO will be analogous to the LRO returned from a CreateBuild call. If rejected, the returned LRO will be immediately done.", + "canonical": true, + "file": "cloud_build.approve_build.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ApproveBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ApproveBuild", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "approval_result", + "type": ".google.devtools.cloudbuild.v1.ApprovalResult" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "ApproveBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ApproveBuild", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async", + "title": "CloudBuild createBuildTrigger Sample", + "origin": "API_DEFINITION", + "description": " Creates a new `BuildTrigger`. This API is experimental.", + "canonical": true, + "file": "cloud_build.create_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuildTrigger", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger", + "type": ".google.devtools.cloudbuild.v1.BuildTrigger" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "CreateBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuildTrigger", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async", + "title": "CloudBuild getBuildTrigger Sample", + "origin": "API_DEFINITION", + "description": " Returns information about a `BuildTrigger`. This API is experimental.", + "canonical": true, + "file": "cloud_build.get_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuildTrigger", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "GetBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuildTrigger", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async", + "title": "CloudBuild listBuildTriggers Sample", + "origin": "API_DEFINITION", + "description": " Lists existing `BuildTrigger`s. This API is experimental.", + "canonical": true, + "file": "cloud_build.list_build_triggers.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBuildTriggers", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuildTriggers", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.ListBuildTriggersResponse", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "ListBuildTriggers", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuildTriggers", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async", + "title": "CloudBuild deleteBuildTrigger Sample", + "origin": "API_DEFINITION", + "description": " Deletes a `BuildTrigger` by its project ID and trigger ID. This API is experimental.", + "canonical": true, + "file": "cloud_build.delete_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteBuildTrigger", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "DeleteBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteBuildTrigger", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async", + "title": "CloudBuild updateBuildTrigger Sample", + "origin": "API_DEFINITION", + "description": " Updates a `BuildTrigger` by its project ID and trigger ID. This API is experimental.", + "canonical": true, + "file": "cloud_build.update_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateBuildTrigger", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger", + "type": ".google.devtools.cloudbuild.v1.BuildTrigger" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "UpdateBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateBuildTrigger", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async", + "title": "CloudBuild runBuildTrigger Sample", + "origin": "API_DEFINITION", + "description": " Runs a `BuildTrigger` at a particular source revision. To run a regional or global trigger, use the POST request that includes the location endpoint in the path (ex. v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The POST request that does not include the location endpoint in the path can only be used when running global triggers.", + "canonical": true, + "file": "cloud_build.run_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RunBuildTrigger", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger_id", + "type": "TYPE_STRING" + }, + { + "name": "source", + "type": ".google.devtools.cloudbuild.v1.RepoSource" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "RunBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RunBuildTrigger", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async", + "title": "CloudBuild receiveTriggerWebhook Sample", + "origin": "API_DEFINITION", + "description": " ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted at a specific trigger.", + "canonical": true, + "file": "cloud_build.receive_trigger_webhook.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReceiveTriggerWebhook", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ReceiveTriggerWebhook", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.api.HttpBody" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger", + "type": "TYPE_STRING" + }, + { + "name": "secret", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "ReceiveTriggerWebhook", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ReceiveTriggerWebhook", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async", + "title": "CloudBuild createWorkerPool Sample", + "origin": "API_DEFINITION", + "description": " Creates a `WorkerPool`.", + "canonical": true, + "file": "cloud_build.create_worker_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateWorkerPool", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "worker_pool", + "type": ".google.devtools.cloudbuild.v1.WorkerPool" + }, + { + "name": "worker_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "CreateWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateWorkerPool", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async", + "title": "CloudBuild getWorkerPool Sample", + "origin": "API_DEFINITION", + "description": " Returns details of a `WorkerPool`.", + "canonical": true, + "file": "cloud_build.get_worker_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetWorkerPool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.WorkerPool", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "GetWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetWorkerPool", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async", + "title": "CloudBuild deleteWorkerPool Sample", + "origin": "API_DEFINITION", + "description": " Deletes a `WorkerPool`.", + "canonical": true, + "file": "cloud_build.delete_worker_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteWorkerPool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "DeleteWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteWorkerPool", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async", + "title": "CloudBuild updateWorkerPool Sample", + "origin": "API_DEFINITION", + "description": " Updates a `WorkerPool`.", + "canonical": true, + "file": "cloud_build.update_worker_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateWorkerPool", + "async": true, + "parameters": [ + { + "name": "worker_pool", + "type": ".google.devtools.cloudbuild.v1.WorkerPool" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "UpdateWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateWorkerPool", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async", + "title": "CloudBuild listWorkerPools Sample", + "origin": "API_DEFINITION", + "description": " Lists `WorkerPool`s.", + "canonical": true, + "file": "cloud_build.list_worker_pools.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkerPools", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListWorkerPools", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.ListWorkerPoolsResponse", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "ListWorkerPools", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListWorkerPools", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts new file mode 100644 index 00000000000..68941b8a880 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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 CloudBuildClient = v1.CloudBuildClient; +type CloudBuildClient = v1.CloudBuildClient; +export {v1, CloudBuildClient}; +export default {v1, CloudBuildClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts new file mode 100644 index 00000000000..017c843e596 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts @@ -0,0 +1,3300 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/cloud_build_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cloud_build_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Creates and manages builds on Google Cloud Platform. + * + * The main concept used by this API is a `Build`, which describes the location + * of the source to build, how to build the source, and where to store the + * built artifacts, if any. + * + * A user can list previously-requested builds or get builds by their ID to + * determine the status of the build. + * @class + * @memberof v1 + */ +export class CloudBuildClient { + 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; + cloudBuildStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudBuildClient. + * + * @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 CloudBuildClient({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 CloudBuildClient; + 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/{keyring}/cryptoKeys/{key}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{network}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectBuildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/builds/{build}' + ), + projectConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/githubEnterpriseConfigs/{config}' + ), + projectLocationBuildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/builds/{build}' + ), + projectLocationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}' + ), + projectLocationTriggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + projectTriggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/triggers/{trigger}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}' + ), + secretVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/secrets/{secret}/versions/{version}' + ), + serviceAccountPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/serviceAccounts/{service_account}' + ), + subscriptionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/subscriptions/{subscription}' + ), + topicPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/topics/{topic}' + ), + 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 = { + listBuilds: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'builds'), + listBuildTriggers: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'triggers'), + listWorkerPools: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workerPools') + }; + + 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=operations/**}:cancel',body: '*',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=operations/**}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createBuildResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; + const createBuildMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; + const retryBuildResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; + const retryBuildMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; + const approveBuildResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; + const approveBuildMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; + const runBuildTriggerResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; + const runBuildTriggerMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; + const createWorkerPoolResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.WorkerPool') as gax.protobuf.Type; + const createWorkerPoolMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata') as gax.protobuf.Type; + const deleteWorkerPoolResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteWorkerPoolMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata') as gax.protobuf.Type; + const updateWorkerPoolResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.WorkerPool') as gax.protobuf.Type; + const updateWorkerPoolMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createBuild: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBuildResponse.decode.bind(createBuildResponse), + createBuildMetadata.decode.bind(createBuildMetadata)), + retryBuild: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + retryBuildResponse.decode.bind(retryBuildResponse), + retryBuildMetadata.decode.bind(retryBuildMetadata)), + approveBuild: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + approveBuildResponse.decode.bind(approveBuildResponse), + approveBuildMetadata.decode.bind(approveBuildMetadata)), + runBuildTrigger: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runBuildTriggerResponse.decode.bind(runBuildTriggerResponse), + runBuildTriggerMetadata.decode.bind(runBuildTriggerMetadata)), + createWorkerPool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkerPoolResponse.decode.bind(createWorkerPoolResponse), + createWorkerPoolMetadata.decode.bind(createWorkerPoolMetadata)), + deleteWorkerPool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkerPoolResponse.decode.bind(deleteWorkerPoolResponse), + deleteWorkerPoolMetadata.decode.bind(deleteWorkerPoolMetadata)), + updateWorkerPool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkerPoolResponse.decode.bind(updateWorkerPoolResponse), + updateWorkerPoolMetadata.decode.bind(updateWorkerPoolMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.devtools.cloudbuild.v1.CloudBuild', 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.cloudBuildStub) { + return this.cloudBuildStub; + } + + // Put together the "service stub" for + // google.devtools.cloudbuild.v1.CloudBuild. + this.cloudBuildStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.devtools.cloudbuild.v1.CloudBuild') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devtools.cloudbuild.v1.CloudBuild, + 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 cloudBuildStubMethods = + ['createBuild', 'getBuild', 'listBuilds', 'cancelBuild', 'retryBuild', 'approveBuild', 'createBuildTrigger', 'getBuildTrigger', 'listBuildTriggers', 'deleteBuildTrigger', 'updateBuildTrigger', 'runBuildTrigger', 'receiveTriggerWebhook', 'createWorkerPool', 'getWorkerPool', 'deleteWorkerPool', 'updateWorkerPool', 'listWorkerPools']; + for (const methodName of cloudBuildStubMethods) { + const callPromise = this.cloudBuildStub.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.cloudBuildStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudbuild.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 'cloudbuild.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 information about a previously requested build. + * + * The `Build` that is returned includes its status (such as `SUCCESS`, + * `FAILURE`, or `WORKING`), and timing information. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Build` to retrieve. + * Format: `projects/{project}/locations/{location}/builds/{build}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {string} request.id + * Required. ID of the build. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v1.Build|Build}. + * Please see the {@link 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_build.get_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_GetBuild_async + */ + getBuild( + request?: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|undefined, {}|undefined + ]>; + getBuild( + request: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, + {}|null|undefined>): void; + getBuild( + request: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, + {}|null|undefined>): void; + getBuild( + request?: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.getBuild(request, options, callback); + } +/** + * Cancels a build in progress. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Build` to cancel. + * Format: `projects/{project}/locations/{location}/builds/{build}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {string} request.id + * Required. ID of the build. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v1.Build|Build}. + * Please see the {@link 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_build.cancel_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CancelBuild_async + */ + cancelBuild( + request?: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|undefined, {}|undefined + ]>; + cancelBuild( + request: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, + {}|null|undefined>): void; + cancelBuild( + request: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, + {}|null|undefined>): void; + cancelBuild( + request?: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.cancelBuild(request, options, callback); + } +/** + * Creates a new `BuildTrigger`. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource where this trigger will be created. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project for which to configure automatic builds. + * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger + * Required. `BuildTrigger` 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 {@link protos.google.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger}. + * Please see the {@link 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_build.create_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async + */ + createBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|undefined, {}|undefined + ]>; + createBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + createBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + createBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.createBuildTrigger(request, options, callback); + } +/** + * Returns information about a `BuildTrigger`. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Trigger` to retrieve. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {string} request.projectId + * Required. ID of the project that owns the trigger. + * @param {string} request.triggerId + * Required. Identifier (`id` or `name`) of the `BuildTrigger` 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.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger}. + * Please see the {@link 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_build.get_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async + */ + getBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|undefined, {}|undefined + ]>; + getBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + getBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + getBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.getBuildTrigger(request, options, callback); + } +/** + * Deletes a `BuildTrigger` by its project ID and trigger ID. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Trigger` to delete. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {string} request.projectId + * Required. ID of the project that owns the trigger. + * @param {string} request.triggerId + * Required. ID of the `BuildTrigger` to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/cloud_build.delete_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async + */ + deleteBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|undefined, {}|undefined + ]>; + deleteBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + deleteBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + deleteBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.deleteBuildTrigger(request, options, callback); + } +/** + * Updates a `BuildTrigger` by its project ID and trigger ID. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. ID of the project that owns the trigger. + * @param {string} request.triggerId + * Required. ID of the `BuildTrigger` to update. + * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger + * Required. `BuildTrigger` to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Update mask for the resource. If this is set, + * the server will only update the fields specified in the field mask. + * Otherwise, a full update of the mutable resource fields will be performed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger}. + * Please see the {@link 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_build.update_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async + */ + updateBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|undefined, {}|undefined + ]>; + updateBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + updateBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + updateBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.trigger?.resourceName; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.updateBuildTrigger(request, options, callback); + } +/** + * ReceiveTriggerWebhook [Experimental] is called when the API receives a + * webhook request targeted at a specific trigger. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `ReceiveTriggerWebhook` to retrieve. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {google.api.HttpBody} request.body + * HTTP request body. + * @param {string} request.projectId + * Project in which the specified trigger lives + * @param {string} request.trigger + * Name of the trigger to run the payload against + * @param {string} request.secret + * Secret token used for authorization if an OAuth token isn't provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse|ReceiveTriggerWebhookResponse}. + * Please see the {@link 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_build.receive_trigger_webhook.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async + */ + receiveTriggerWebhook( + request?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|undefined, {}|undefined + ]>; + receiveTriggerWebhook( + request: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, + {}|null|undefined>): void; + receiveTriggerWebhook( + request: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, + {}|null|undefined>): void; + receiveTriggerWebhook( + request?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_id': request.projectId ?? '', + 'trigger': request.trigger ?? '', + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.receiveTriggerWebhook(request, options, callback); + } +/** + * Returns details of a `WorkerPool`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the `WorkerPool` to retrieve. + * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v1.WorkerPool|WorkerPool}. + * Please see the {@link 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_build.get_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async + */ + getWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|undefined, {}|undefined + ]>; + getWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, + {}|null|undefined>): void; + getWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, + {}|null|undefined>): void; + getWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.getWorkerPool(request, options, callback); + } + +/** + * Starts a build with the specified configuration. + * + * This method returns a long-running `Operation`, which includes the build + * ID. Pass the build ID to `GetBuild` to determine the build status (such as + * `SUCCESS` or `FAILURE`). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource where this build will be created. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {google.devtools.cloudbuild.v1.Build} request.build + * Required. Build resource 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/v1/cloud_build.create_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async + */ + createBuild( + request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBuild( + request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBuild( + request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBuild( + request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.createBuild(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBuild()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://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_build.create_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async + */ + async checkCreateBuildProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBuild, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new build based on the specified build. + * + * This method creates a new build using the original build request, which may + * or may not result in an identical build. + * + * For triggered builds: + * + * * Triggered builds resolve to a precise revision; therefore a retry of a + * triggered build will result in a build that uses the same revision. + * + * For non-triggered builds that specify `RepoSource`: + * + * * If the original build built from the tip of a branch, the retried build + * will build from the tip of that branch, which may not be the same revision + * as the original build. + * * If the original build specified a commit sha or revision ID, the retried + * build will use the identical source. + * + * For builds that specify `StorageSource`: + * + * * If the original build pulled source from Cloud Storage without + * specifying the generation of the object, the new build will use the current + * object, which may be different from the original build source. + * * If the original build pulled source from Cloud Storage and specified the + * generation of the object, the new build will attempt to use the same + * object, which may or may not be available depending on the bucket's + * lifecycle management settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Build` to retry. + * Format: `projects/{project}/locations/{location}/builds/{build}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {string} request.id + * Required. Build ID of the original build. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://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_build.retry_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async + */ + retryBuild( + request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + retryBuild( + request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + retryBuild( + request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + retryBuild( + request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.retryBuild(request, options, callback); + } +/** + * Check the status of the long running operation returned by `retryBuild()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://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_build.retry_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async + */ + async checkRetryBuildProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.retryBuild, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Approves or rejects a pending build. + * + * If approved, the returned LRO will be analogous to the LRO returned from + * a CreateBuild call. + * + * If rejected, the returned LRO will be immediately done. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the target build. + * For example: "projects/{$project_id}/builds/{$build_id}" + * @param {google.devtools.cloudbuild.v1.ApprovalResult} request.approvalResult + * Approval decision 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://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_build.approve_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ApproveBuild_async + */ + approveBuild( + request?: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + approveBuild( + request: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + approveBuild( + request: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + approveBuild( + request?: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.approveBuild(request, options, callback); + } +/** + * Check the status of the long running operation returned by `approveBuild()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://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_build.approve_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ApproveBuild_async + */ + async checkApproveBuildProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.approveBuild, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Runs a `BuildTrigger` at a particular source revision. + * + * To run a regional or global trigger, use the POST request + * that includes the location endpoint in the path (ex. + * v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The + * POST request that does not include the location endpoint in the path can + * only be used when running global triggers. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Trigger` to run. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {string} request.triggerId + * Required. ID of the trigger. + * @param {google.devtools.cloudbuild.v1.RepoSource} request.source + * Source to build against this trigger. + * Branch and tag names cannot consist of regular expressions. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://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_build.run_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async + */ + runBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.runBuildTrigger(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runBuildTrigger()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://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_build.run_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async + */ + async checkRunBuildTriggerProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runBuildTrigger, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a `WorkerPool`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this worker pool will be created. + * Format: `projects/{project}/locations/{location}`. + * @param {google.devtools.cloudbuild.v1.WorkerPool} request.workerPool + * Required. `WorkerPool` resource to create. + * @param {string} request.workerPoolId + * Required. Immutable. The ID to use for the `WorkerPool`, which will become + * the final component of the resource name. + * + * This value should be 1-63 characters, and valid characters + * are /{@link protos.0-9|a-z}-/. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the response, but do not actually + * post it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://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_build.create_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async + */ + createWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createWorkerPool( + request: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkerPool( + request: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.createWorkerPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createWorkerPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://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_build.create_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async + */ + async checkCreateWorkerPoolProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkerPool, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a `WorkerPool`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the `WorkerPool` to delete. + * Format: + * `projects/{project}/locations/{location}/workerPools/{workerPool}`. + * @param {string} [request.etag] + * Optional. If provided, it must match the server's etag on the workerpool + * for the request to be processed. + * @param {boolean} request.allowMissing + * If set to true, and the `WorkerPool` is not found, the request will succeed + * but no action will be taken on the server. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the response, but do not actually + * post it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://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_build.delete_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async + */ + deleteWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.deleteWorkerPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteWorkerPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://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_build.delete_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async + */ + async checkDeleteWorkerPoolProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkerPool, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a `WorkerPool`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.cloudbuild.v1.WorkerPool} request.workerPool + * Required. The `WorkerPool` to update. + * + * The `name` field is used to identify the `WorkerPool` to update. + * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + * @param {google.protobuf.FieldMask} request.updateMask + * A mask specifying which fields in `worker_pool` to update. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the response, but do not actually + * post it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://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_build.update_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async + */ + updateWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.workerPool?.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.updateWorkerPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateWorkerPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://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_build.update_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async + */ + async checkUpdateWorkerPoolProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkerPool, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists previously requested builds. + * + * Previously requested builds may still be in-progress, or may have finished + * successfully or unsuccessfully. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent of the collection of `Builds`. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * The page token for the next page of Builds. + * + * If unspecified, the first page of results is returned. + * + * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. + * In this case, the token should be discarded, and pagination should be + * restarted from the first page of results. + * + * See https://google.aip.dev/158 for more. + * @param {string} request.filter + * The raw filter text to constrain 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.devtools.cloudbuild.v1.Build|Build}. + * 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 `listBuildsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBuilds( + request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild[], + protos.google.devtools.cloudbuild.v1.IListBuildsRequest|null, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse + ]>; + listBuilds( + request: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuild>): void; + listBuilds( + request: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuild>): void; + listBuilds( + request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuild>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuild>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild[], + protos.google.devtools.cloudbuild.v1.IListBuildsRequest|null, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.listBuilds(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 of the collection of `Builds`. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * The page token for the next page of Builds. + * + * If unspecified, the first page of results is returned. + * + * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. + * In this case, the token should be discarded, and pagination should be + * restarted from the first page of results. + * + * See https://google.aip.dev/158 for more. + * @param {string} request.filter + * The raw filter text to constrain 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.devtools.cloudbuild.v1.Build|Build} 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 `listBuildsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBuildsStream( + request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + const defaultCallSettings = this._defaults['listBuilds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuilds.createStream( + this.innerApiCalls.listBuilds as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBuilds`, 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 of the collection of `Builds`. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * The page token for the next page of Builds. + * + * If unspecified, the first page of results is returned. + * + * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. + * In this case, the token should be discarded, and pagination should be + * restarted from the first page of results. + * + * See https://google.aip.dev/158 for more. + * @param {string} request.filter + * The raw filter text to constrain 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.devtools.cloudbuild.v1.Build|Build}. 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_build.list_builds.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ListBuilds_async + */ + listBuildsAsync( + request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + const defaultCallSettings = this._defaults['listBuilds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuilds.asyncIterate( + this.innerApiCalls['listBuilds'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists existing `BuildTrigger`s. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent of the collection of `Triggers`. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project for which to list BuildTriggers. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger}. + * 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 `listBuildTriggersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBuildTriggers( + request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger[], + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest|null, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse + ]>; + listBuildTriggers( + request: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuildTrigger>): void; + listBuildTriggers( + request: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuildTrigger>): void; + listBuildTriggers( + request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuildTrigger>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuildTrigger>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger[], + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest|null, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.listBuildTriggers(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 of the collection of `Triggers`. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project for which to list BuildTriggers. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger} 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 `listBuildTriggersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBuildTriggersStream( + request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + const defaultCallSettings = this._defaults['listBuildTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuildTriggers.createStream( + this.innerApiCalls.listBuildTriggers as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBuildTriggers`, 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 of the collection of `Triggers`. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project for which to list BuildTriggers. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger}. 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_build.list_build_triggers.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async + */ + listBuildTriggersAsync( + request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + const defaultCallSettings = this._defaults['listBuildTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuildTriggers.asyncIterate( + this.innerApiCalls['listBuildTriggers'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists `WorkerPool`s. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent of the collection of `WorkerPools`. + * Format: `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * The maximum number of `WorkerPool`s to return. The service may return + * fewer than this value. If omitted, the server will use a sensible default. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkerPools` call. Provide this + * to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.cloudbuild.v1.WorkerPool|WorkerPool}. + * 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 `listWorkerPoolsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkerPools( + request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IWorkerPool[], + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest|null, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse + ]>; + listWorkerPools( + request: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IWorkerPool>): void; + listWorkerPools( + request: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IWorkerPool>): void; + listWorkerPools( + request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IWorkerPool>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IWorkerPool>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IWorkerPool[], + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest|null, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.listWorkerPools(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 of the collection of `WorkerPools`. + * Format: `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * The maximum number of `WorkerPool`s to return. The service may return + * fewer than this value. If omitted, the server will use a sensible default. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkerPools` call. Provide this + * to retrieve the subsequent page. + * @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.devtools.cloudbuild.v1.WorkerPool|WorkerPool} 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 `listWorkerPoolsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkerPoolsStream( + request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + const defaultCallSettings = this._defaults['listWorkerPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkerPools.createStream( + this.innerApiCalls.listWorkerPools as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listWorkerPools`, 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 of the collection of `WorkerPools`. + * Format: `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * The maximum number of `WorkerPool`s to return. The service may return + * fewer than this value. If omitted, the server will use a sensible default. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkerPools` call. Provide this + * to retrieve the subsequent page. + * @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.devtools.cloudbuild.v1.WorkerPool|WorkerPool}. 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_build.list_worker_pools.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async + */ + listWorkerPoolsAsync( + request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + const defaultCallSettings = this._defaults['listWorkerPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkerPools.asyncIterate( + this.innerApiCalls['listWorkerPools'] 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} keyring + * @param {string} key + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyring:string,key:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + keyring: keyring, + key: key, + }); + } + + /** + * 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 keyring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the keyring. + */ + matchKeyringFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).keyring; + } + + /** + * Parse the key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key. + */ + matchKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).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 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 projectBuild resource name string. + * + * @param {string} project + * @param {string} build + * @returns {string} Resource name string. + */ + projectBuildPath(project:string,build:string) { + return this.pathTemplates.projectBuildPathTemplate.render({ + project: project, + build: build, + }); + } + + /** + * Parse the project from ProjectBuild resource. + * + * @param {string} projectBuildName + * A fully-qualified path representing project_build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectBuildName(projectBuildName: string) { + return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).project; + } + + /** + * Parse the build from ProjectBuild resource. + * + * @param {string} projectBuildName + * A fully-qualified path representing project_build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromProjectBuildName(projectBuildName: string) { + return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).build; + } + + /** + * Return a fully-qualified projectConfig resource name string. + * + * @param {string} project + * @param {string} config + * @returns {string} Resource name string. + */ + projectConfigPath(project:string,config:string) { + return this.pathTemplates.projectConfigPathTemplate.render({ + project: project, + config: config, + }); + } + + /** + * Parse the project from ProjectConfig resource. + * + * @param {string} projectConfigName + * A fully-qualified path representing project_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConfigName(projectConfigName: string) { + return this.pathTemplates.projectConfigPathTemplate.match(projectConfigName).project; + } + + /** + * Parse the config from ProjectConfig resource. + * + * @param {string} projectConfigName + * A fully-qualified path representing project_config resource. + * @returns {string} A string representing the config. + */ + matchConfigFromProjectConfigName(projectConfigName: string) { + return this.pathTemplates.projectConfigPathTemplate.match(projectConfigName).config; + } + + /** + * Return a fully-qualified projectLocationBuild resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} build + * @returns {string} Resource name string. + */ + projectLocationBuildPath(project:string,location:string,build:string) { + return this.pathTemplates.projectLocationBuildPathTemplate.render({ + project: project, + location: location, + build: build, + }); + } + + /** + * Parse the project from ProjectLocationBuild resource. + * + * @param {string} projectLocationBuildName + * A fully-qualified path representing project_location_build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBuildName(projectLocationBuildName: string) { + return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).project; + } + + /** + * Parse the location from ProjectLocationBuild resource. + * + * @param {string} projectLocationBuildName + * A fully-qualified path representing project_location_build resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBuildName(projectLocationBuildName: string) { + return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).location; + } + + /** + * Parse the build from ProjectLocationBuild resource. + * + * @param {string} projectLocationBuildName + * A fully-qualified path representing project_location_build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromProjectLocationBuildName(projectLocationBuildName: string) { + return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).build; + } + + /** + * Return a fully-qualified projectLocationConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} config + * @returns {string} Resource name string. + */ + projectLocationConfigPath(project:string,location:string,config:string) { + return this.pathTemplates.projectLocationConfigPathTemplate.render({ + project: project, + location: location, + config: config, + }); + } + + /** + * Parse the project from ProjectLocationConfig resource. + * + * @param {string} projectLocationConfigName + * A fully-qualified path representing project_location_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConfigName(projectLocationConfigName: string) { + return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).project; + } + + /** + * Parse the location from ProjectLocationConfig resource. + * + * @param {string} projectLocationConfigName + * A fully-qualified path representing project_location_config resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConfigName(projectLocationConfigName: string) { + return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).location; + } + + /** + * Parse the config from ProjectLocationConfig resource. + * + * @param {string} projectLocationConfigName + * A fully-qualified path representing project_location_config resource. + * @returns {string} A string representing the config. + */ + matchConfigFromProjectLocationConfigName(projectLocationConfigName: string) { + return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).config; + } + + /** + * Return a fully-qualified projectLocationTrigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} trigger + * @returns {string} Resource name string. + */ + projectLocationTriggerPath(project:string,location:string,trigger:string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.render({ + project: project, + location: location, + trigger: trigger, + }); + } + + /** + * Parse the project from ProjectLocationTrigger resource. + * + * @param {string} projectLocationTriggerName + * A fully-qualified path representing project_location_trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationTriggerName(projectLocationTriggerName: string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).project; + } + + /** + * Parse the location from ProjectLocationTrigger resource. + * + * @param {string} projectLocationTriggerName + * A fully-qualified path representing project_location_trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationTriggerName(projectLocationTriggerName: string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).location; + } + + /** + * Parse the trigger from ProjectLocationTrigger resource. + * + * @param {string} projectLocationTriggerName + * A fully-qualified path representing project_location_trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromProjectLocationTriggerName(projectLocationTriggerName: string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).trigger; + } + + /** + * Return a fully-qualified projectTrigger resource name string. + * + * @param {string} project + * @param {string} trigger + * @returns {string} Resource name string. + */ + projectTriggerPath(project:string,trigger:string) { + return this.pathTemplates.projectTriggerPathTemplate.render({ + project: project, + trigger: trigger, + }); + } + + /** + * Parse the project from ProjectTrigger resource. + * + * @param {string} projectTriggerName + * A fully-qualified path representing project_trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTriggerName(projectTriggerName: string) { + return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).project; + } + + /** + * Parse the trigger from ProjectTrigger resource. + * + * @param {string} projectTriggerName + * A fully-qualified path representing project_trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromProjectTriggerName(projectTriggerName: string) { + return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).trigger; + } + + /** + * Return a fully-qualified repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connection + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project:string,location:string,connection:string,repository:string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + connection: connection, + 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 connection from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the connection. + */ + matchConnectionFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).connection; + } + + /** + * 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 secretVersion resource name string. + * + * @param {string} project + * @param {string} secret + * @param {string} version + * @returns {string} Resource name string. + */ + secretVersionPath(project:string,secret:string,version:string) { + return this.pathTemplates.secretVersionPathTemplate.render({ + project: project, + secret: secret, + version: version, + }); + } + + /** + * Parse the project from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).project; + } + + /** + * Parse the secret from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the secret. + */ + matchSecretFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).secret; + } + + /** + * Parse the version from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the version. + */ + matchVersionFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).version; + } + + /** + * Return a fully-qualified serviceAccount resource name string. + * + * @param {string} project + * @param {string} service_account + * @returns {string} Resource name string. + */ + serviceAccountPath(project:string,serviceAccount:string) { + return this.pathTemplates.serviceAccountPathTemplate.render({ + project: project, + service_account: serviceAccount, + }); + } + + /** + * Parse the project from ServiceAccount resource. + * + * @param {string} serviceAccountName + * A fully-qualified path representing ServiceAccount resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceAccountName(serviceAccountName: string) { + return this.pathTemplates.serviceAccountPathTemplate.match(serviceAccountName).project; + } + + /** + * Parse the service_account from ServiceAccount resource. + * + * @param {string} serviceAccountName + * A fully-qualified path representing ServiceAccount resource. + * @returns {string} A string representing the service_account. + */ + matchServiceAccountFromServiceAccountName(serviceAccountName: string) { + return this.pathTemplates.serviceAccountPathTemplate.match(serviceAccountName).service_account; + } + + /** + * Return a fully-qualified subscription resource name string. + * + * @param {string} project + * @param {string} subscription + * @returns {string} Resource name string. + */ + subscriptionPath(project:string,subscription:string) { + return this.pathTemplates.subscriptionPathTemplate.render({ + project: project, + subscription: subscription, + }); + } + + /** + * Parse the project from Subscription resource. + * + * @param {string} subscriptionName + * A fully-qualified path representing Subscription resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSubscriptionName(subscriptionName: string) { + return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName).project; + } + + /** + * Parse the subscription from Subscription resource. + * + * @param {string} subscriptionName + * A fully-qualified path representing Subscription resource. + * @returns {string} A string representing the subscription. + */ + matchSubscriptionFromSubscriptionName(subscriptionName: string) { + return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName).subscription; + } + + /** + * 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 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.cloudBuildStub && !this._terminated) { + return this.cloudBuildStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json new file mode 100644 index 00000000000..c677cba6cb7 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json @@ -0,0 +1,114 @@ +{ + "interfaces": { + "google.devtools.cloudbuild.v1.CloudBuild": { + "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": { + "CreateBuild": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBuild": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListBuilds": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CancelBuild": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RetryBuild": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ApproveBuild": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateBuildTrigger": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBuildTrigger": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListBuildTriggers": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteBuildTrigger": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateBuildTrigger": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RunBuildTrigger": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReceiveTriggerWebhook": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateWorkerPool": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetWorkerPool": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteWorkerPool": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkerPool": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListWorkerPools": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json new file mode 100644 index 00000000000..ef522572f3b --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/devtools/cloudbuild/v1/cloudbuild.proto" +] diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..33226421337 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json @@ -0,0 +1,215 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.devtools.cloudbuild.v1", + "libraryPackage": "@google-cloud/cloudbuild", + "services": { + "CloudBuild": { + "clients": { + "grpc": { + "libraryClient": "CloudBuildClient", + "rpcs": { + "GetBuild": { + "methods": [ + "getBuild" + ] + }, + "CancelBuild": { + "methods": [ + "cancelBuild" + ] + }, + "CreateBuildTrigger": { + "methods": [ + "createBuildTrigger" + ] + }, + "GetBuildTrigger": { + "methods": [ + "getBuildTrigger" + ] + }, + "DeleteBuildTrigger": { + "methods": [ + "deleteBuildTrigger" + ] + }, + "UpdateBuildTrigger": { + "methods": [ + "updateBuildTrigger" + ] + }, + "ReceiveTriggerWebhook": { + "methods": [ + "receiveTriggerWebhook" + ] + }, + "GetWorkerPool": { + "methods": [ + "getWorkerPool" + ] + }, + "CreateBuild": { + "methods": [ + "createBuild" + ] + }, + "RetryBuild": { + "methods": [ + "retryBuild" + ] + }, + "ApproveBuild": { + "methods": [ + "approveBuild" + ] + }, + "RunBuildTrigger": { + "methods": [ + "runBuildTrigger" + ] + }, + "CreateWorkerPool": { + "methods": [ + "createWorkerPool" + ] + }, + "DeleteWorkerPool": { + "methods": [ + "deleteWorkerPool" + ] + }, + "UpdateWorkerPool": { + "methods": [ + "updateWorkerPool" + ] + }, + "ListBuilds": { + "methods": [ + "listBuilds", + "listBuildsStream", + "listBuildsAsync" + ] + }, + "ListBuildTriggers": { + "methods": [ + "listBuildTriggers", + "listBuildTriggersStream", + "listBuildTriggersAsync" + ] + }, + "ListWorkerPools": { + "methods": [ + "listWorkerPools", + "listWorkerPoolsStream", + "listWorkerPoolsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudBuildClient", + "rpcs": { + "GetBuild": { + "methods": [ + "getBuild" + ] + }, + "CancelBuild": { + "methods": [ + "cancelBuild" + ] + }, + "CreateBuildTrigger": { + "methods": [ + "createBuildTrigger" + ] + }, + "GetBuildTrigger": { + "methods": [ + "getBuildTrigger" + ] + }, + "DeleteBuildTrigger": { + "methods": [ + "deleteBuildTrigger" + ] + }, + "UpdateBuildTrigger": { + "methods": [ + "updateBuildTrigger" + ] + }, + "ReceiveTriggerWebhook": { + "methods": [ + "receiveTriggerWebhook" + ] + }, + "GetWorkerPool": { + "methods": [ + "getWorkerPool" + ] + }, + "CreateBuild": { + "methods": [ + "createBuild" + ] + }, + "RetryBuild": { + "methods": [ + "retryBuild" + ] + }, + "ApproveBuild": { + "methods": [ + "approveBuild" + ] + }, + "RunBuildTrigger": { + "methods": [ + "runBuildTrigger" + ] + }, + "CreateWorkerPool": { + "methods": [ + "createWorkerPool" + ] + }, + "DeleteWorkerPool": { + "methods": [ + "deleteWorkerPool" + ] + }, + "UpdateWorkerPool": { + "methods": [ + "updateWorkerPool" + ] + }, + "ListBuilds": { + "methods": [ + "listBuilds", + "listBuildsStream", + "listBuildsAsync" + ] + }, + "ListBuildTriggers": { + "methods": [ + "listBuildTriggers", + "listBuildTriggersStream", + "listBuildTriggersAsync" + ] + }, + "ListWorkerPools": { + "methods": [ + "listWorkerPools", + "listWorkerPoolsStream", + "listWorkerPoolsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts new file mode 100644 index 00000000000..f01e5acb61b --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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 {CloudBuildClient} from './cloud_build_client'; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..21a069f2aec --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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 cloudbuild = require('@google-cloud/cloudbuild'); + +function main() { + const cloudBuildClient = new cloudbuild.CloudBuildClient(); +} + +main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..9d43cef7252 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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 {CloudBuildClient} from '@google-cloud/cloudbuild'; + +// check that the client class type name can be used +function doStuffWithCloudBuildClient(client: CloudBuildClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const cloudBuildClient = new CloudBuildClient(); + doStuffWithCloudBuildClient(cloudBuildClient); +} + +main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts new file mode 100644 index 00000000000..e3376f4a516 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts @@ -0,0 +1,3520 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 cloudbuildModule 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.CloudBuildClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = cloudbuildModule.v1.CloudBuildClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudbuildModule.v1.CloudBuildClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudbuildModule.v1.CloudBuildClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudbuildModule.v1.CloudBuildClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudBuildStub, undefined); + await client.initialize(); + assert(client.cloudBuildStub); + }); + + it('has close method for the initialized client', done => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.cloudBuildStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudBuildStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudbuildModule.v1.CloudBuildClient({ + 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 cloudbuildModule.v1.CloudBuildClient({ + 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('getBuild', () => { + it('invokes getBuild without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.Build() + ); + client.innerApiCalls.getBuild = stubSimpleCall(expectedResponse); + const [response] = await client.getBuild(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBuild without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.Build() + ); + client.innerApiCalls.getBuild = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBuild( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBuild with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.getBuild = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBuild(request), expectedError); + const actualRequest = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBuild with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBuild(request), expectedError); + }); + }); + + describe('cancelBuild', () => { + it('invokes cancelBuild without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.Build() + ); + client.innerApiCalls.cancelBuild = stubSimpleCall(expectedResponse); + const [response] = await client.cancelBuild(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelBuild without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.Build() + ); + client.innerApiCalls.cancelBuild = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelBuild( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelBuild with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelBuild = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelBuild(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelBuild with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelBuild(request), expectedError); + }); + }); + + describe('createBuildTrigger', () => { + it('invokes createBuildTrigger without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.BuildTrigger() + ); + client.innerApiCalls.createBuildTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.createBuildTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBuildTrigger without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.BuildTrigger() + ); + client.innerApiCalls.createBuildTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBuildTrigger( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBuildTrigger with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.createBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createBuildTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBuildTrigger with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createBuildTrigger(request), expectedError); + }); + }); + + describe('getBuildTrigger', () => { + it('invokes getBuildTrigger without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.BuildTrigger() + ); + client.innerApiCalls.getBuildTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.getBuildTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBuildTrigger without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.BuildTrigger() + ); + client.innerApiCalls.getBuildTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBuildTrigger( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBuildTrigger with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.getBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBuildTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBuildTrigger with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBuildTrigger(request), expectedError); + }); + }); + + describe('deleteBuildTrigger', () => { + it('invokes deleteBuildTrigger without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBuildTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBuildTrigger without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBuildTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBuildTrigger( + 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.deleteBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBuildTrigger with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteBuildTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBuildTrigger with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteBuildTrigger(request), expectedError); + }); + }); + + describe('updateBuildTrigger', () => { + it('invokes updateBuildTrigger without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() + ); + request.trigger = {}; + // path template: projects/*/locations/{location=*}/triggers/* + request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.BuildTrigger() + ); + client.innerApiCalls.updateBuildTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.updateBuildTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBuildTrigger without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() + ); + request.trigger = {}; + // path template: projects/*/locations/{location=*}/triggers/* + request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.BuildTrigger() + ); + client.innerApiCalls.updateBuildTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBuildTrigger( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBuildTrigger with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() + ); + request.trigger = {}; + // path template: projects/*/locations/{location=*}/triggers/* + request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateBuildTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBuildTrigger with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() + ); + request.trigger = {}; + // path template: projects/*/locations/{location=*}/triggers/* + request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateBuildTrigger(request), expectedError); + }); + }); + + describe('receiveTriggerWebhook', () => { + it('invokes receiveTriggerWebhook without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); + request.trigger = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse() + ); + client.innerApiCalls.receiveTriggerWebhook = stubSimpleCall(expectedResponse); + const [response] = await client.receiveTriggerWebhook(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes receiveTriggerWebhook without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); + request.trigger = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse() + ); + client.innerApiCalls.receiveTriggerWebhook = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.receiveTriggerWebhook( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes receiveTriggerWebhook with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); + request.trigger = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.receiveTriggerWebhook = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.receiveTriggerWebhook(request), expectedError); + const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes receiveTriggerWebhook with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); + request.trigger = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); + request.name = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.receiveTriggerWebhook(request), expectedError); + }); + }); + + describe('getWorkerPool', () => { + it('invokes getWorkerPool without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.WorkerPool() + ); + client.innerApiCalls.getWorkerPool = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkerPool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkerPool without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.WorkerPool() + ); + client.innerApiCalls.getWorkerPool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkerPool( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IWorkerPool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkerPool with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkerPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkerPool(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkerPool with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkerPool(request), expectedError); + }); + }); + + describe('createBuild', () => { + it('invokes createBuild without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateBuildRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBuild = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBuild(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBuild without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateBuildRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBuild = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBuild( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBuild with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateBuildRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.createBuild = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBuild(request), expectedError); + const actualRequest = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBuild with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateBuildRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.createBuild = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBuild(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBuildProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBuildProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBuildProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBuildProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('retryBuild', () => { + it('invokes retryBuild without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.retryBuild = stubLongRunningCall(expectedResponse); + const [operation] = await client.retryBuild(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes retryBuild without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.retryBuild = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.retryBuild( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes retryBuild with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.retryBuild(request), expectedError); + const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes retryBuild with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.retryBuild(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRetryBuildProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRetryBuildProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRetryBuildProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRetryBuildProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('approveBuild', () => { + it('invokes approveBuild without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.approveBuild = stubLongRunningCall(expectedResponse); + const [operation] = await client.approveBuild(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes approveBuild without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.approveBuild = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.approveBuild( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes approveBuild with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.approveBuild(request), expectedError); + const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes approveBuild with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.approveBuild(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkApproveBuildProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkApproveBuildProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkApproveBuildProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkApproveBuildProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('runBuildTrigger', () => { + it('invokes runBuildTrigger without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runBuildTrigger = stubLongRunningCall(expectedResponse); + const [operation] = await client.runBuildTrigger(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runBuildTrigger without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runBuildTrigger = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runBuildTrigger( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runBuildTrigger with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runBuildTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runBuildTrigger with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runBuildTrigger(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRunBuildTriggerProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunBuildTriggerProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunBuildTriggerProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRunBuildTriggerProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createWorkerPool', () => { + it('invokes createWorkerPool without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkerPool = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkerPool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkerPool without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkerPool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkerPool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkerPool with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkerPool(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkerPool with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkerPool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateWorkerPoolProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkerPoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkerPoolProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkerPoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteWorkerPool', () => { + it('invokes deleteWorkerPool without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkerPool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkerPool without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkerPool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkerPool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkerPool with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkerPool(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkerPool with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkerPool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteWorkerPoolProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkerPoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkerPoolProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkerPoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateWorkerPool', () => { + it('invokes updateWorkerPool without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest() + ); + request.workerPool = {}; + // path template: projects/*/locations/{location=*}/workerPools/* + request.workerPool.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkerPool = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkerPool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkerPool without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest() + ); + request.workerPool = {}; + // path template: projects/*/locations/{location=*}/workerPools/* + request.workerPool.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkerPool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkerPool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkerPool with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest() + ); + request.workerPool = {}; + // path template: projects/*/locations/{location=*}/workerPools/* + request.workerPool.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkerPool(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkerPool with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest() + ); + request.workerPool = {}; + // path template: projects/*/locations/{location=*}/workerPools/* + request.workerPool.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkerPool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateWorkerPoolProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkerPoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkerPoolProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkerPoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listBuilds', () => { + it('invokes listBuilds without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + ]; + client.innerApiCalls.listBuilds = stubSimpleCall(expectedResponse); + const [response] = await client.listBuilds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBuilds without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + ]; + client.innerApiCalls.listBuilds = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBuilds( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBuilds with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.listBuilds = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBuilds(request), expectedError); + const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBuildsStream without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + ]; + client.descriptors.page.listBuilds.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBuildsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.Build[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.Build) => { + 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.listBuilds.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuilds, request)); + assert( + (client.descriptors.page.listBuilds.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBuildsStream with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.descriptors.page.listBuilds.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBuildsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.Build[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.Build) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBuilds.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuilds, request)); + assert( + (client.descriptors.page.listBuilds.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBuilds without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + ]; + client.descriptors.page.listBuilds.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v1.IBuild[] = []; + const iterable = client.listBuildsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBuilds.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBuilds.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBuilds with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.descriptors.page.listBuilds.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBuildsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v1.IBuild[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBuilds.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBuilds.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listBuildTriggers', () => { + it('invokes listBuildTriggers without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + ]; + client.innerApiCalls.listBuildTriggers = stubSimpleCall(expectedResponse); + const [response] = await client.listBuildTriggers(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBuildTriggers without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + ]; + client.innerApiCalls.listBuildTriggers = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBuildTriggers( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBuildTriggers with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.listBuildTriggers = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBuildTriggers(request), expectedError); + const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBuildTriggersStream without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + ]; + client.descriptors.page.listBuildTriggers.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBuildTriggersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.BuildTrigger[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.BuildTrigger) => { + 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.listBuildTriggers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuildTriggers, request)); + assert( + (client.descriptors.page.listBuildTriggers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBuildTriggersStream with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.descriptors.page.listBuildTriggers.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBuildTriggersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.BuildTrigger[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.BuildTrigger) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBuildTriggers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuildTriggers, request)); + assert( + (client.descriptors.page.listBuildTriggers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBuildTriggers without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + ]; + client.descriptors.page.listBuildTriggers.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v1.IBuildTrigger[] = []; + const iterable = client.listBuildTriggersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBuildTriggers with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.descriptors.page.listBuildTriggers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBuildTriggersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v1.IBuildTrigger[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listWorkerPools', () => { + it('invokes listWorkerPools without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + ]; + client.innerApiCalls.listWorkerPools = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkerPools(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkerPools without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + ]; + client.innerApiCalls.listWorkerPools = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkerPools( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IWorkerPool[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkerPools with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkerPools = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkerPools(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkerPoolsStream without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + ]; + client.descriptors.page.listWorkerPools.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkerPoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.WorkerPool[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.WorkerPool) => { + 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.listWorkerPools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkerPools, request)); + assert( + (client.descriptors.page.listWorkerPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkerPoolsStream with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkerPools.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkerPoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.WorkerPool[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.WorkerPool) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkerPools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkerPools, request)); + assert( + (client.descriptors.page.listWorkerPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkerPools without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + ]; + client.descriptors.page.listWorkerPools.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v1.IWorkerPool[] = []; + const iterable = client.listWorkerPoolsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkerPools with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkerPools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkerPoolsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v1.IWorkerPool[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkerPools.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", + keyring: "keyringValue", + key: "keyValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + 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", "keyValue"); + 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('matchKeyFromCryptoKeyName', () => { + const result = client.matchKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, "keyValue"); + 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 cloudbuildModule.v1.CloudBuildClient({ + 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", + network: "networkValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + 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 cloudbuildModule.v1.CloudBuildClient({ + 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('projectBuild', () => { + const fakePath = "/rendered/path/projectBuild"; + const expectedParameters = { + project: "projectValue", + build: "buildValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectBuildPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectBuildPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectBuildPath', () => { + const result = client.projectBuildPath("projectValue", "buildValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectBuildPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectBuildName', () => { + const result = client.matchProjectFromProjectBuildName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBuildFromProjectBuildName', () => { + const result = client.matchBuildFromProjectBuildName(fakePath); + assert.strictEqual(result, "buildValue"); + assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConfig', () => { + const fakePath = "/rendered/path/projectConfig"; + const expectedParameters = { + project: "projectValue", + config: "configValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConfigPath', () => { + const result = client.projectConfigPath("projectValue", "configValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConfigName', () => { + const result = client.matchProjectFromProjectConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConfigFromProjectConfigName', () => { + const result = client.matchConfigFromProjectConfigName(fakePath); + assert.strictEqual(result, "configValue"); + assert((client.pathTemplates.projectConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBuild', () => { + const fakePath = "/rendered/path/projectLocationBuild"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + build: "buildValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBuildPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBuildPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBuildPath', () => { + const result = client.projectLocationBuildPath("projectValue", "locationValue", "buildValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBuildPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBuildName', () => { + const result = client.matchProjectFromProjectLocationBuildName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBuildName', () => { + const result = client.matchLocationFromProjectLocationBuildName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBuildFromProjectLocationBuildName', () => { + const result = client.matchBuildFromProjectLocationBuildName(fakePath); + assert.strictEqual(result, "buildValue"); + assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConfig', () => { + const fakePath = "/rendered/path/projectLocationConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + config: "configValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConfigPath', () => { + const result = client.projectLocationConfigPath("projectValue", "locationValue", "configValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConfigName', () => { + const result = client.matchProjectFromProjectLocationConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConfigName', () => { + const result = client.matchLocationFromProjectLocationConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConfigFromProjectLocationConfigName', () => { + const result = client.matchConfigFromProjectLocationConfigName(fakePath); + assert.strictEqual(result, "configValue"); + assert((client.pathTemplates.projectLocationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationTrigger', () => { + const fakePath = "/rendered/path/projectLocationTrigger"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + trigger: "triggerValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationTriggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationTriggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationTriggerPath', () => { + const result = client.projectLocationTriggerPath("projectValue", "locationValue", "triggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationTriggerName', () => { + const result = client.matchProjectFromProjectLocationTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationTriggerName', () => { + const result = client.matchLocationFromProjectLocationTriggerName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTriggerFromProjectLocationTriggerName', () => { + const result = client.matchTriggerFromProjectLocationTriggerName(fakePath); + assert.strictEqual(result, "triggerValue"); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTrigger', () => { + const fakePath = "/rendered/path/projectTrigger"; + const expectedParameters = { + project: "projectValue", + trigger: "triggerValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTriggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTriggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTriggerPath', () => { + const result = client.projectTriggerPath("projectValue", "triggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTriggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTriggerName', () => { + const result = client.matchProjectFromProjectTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTriggerFromProjectTriggerName', () => { + const result = client.matchTriggerFromProjectTriggerName(fakePath); + assert.strictEqual(result, "triggerValue"); + assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('repository', () => { + const fakePath = "/rendered/path/repository"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + connection: "connectionValue", + repository: "repositoryValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + 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", "connectionValue", "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('matchConnectionFromRepositoryName', () => { + const result = client.matchConnectionFromRepositoryName(fakePath); + assert.strictEqual(result, "connectionValue"); + 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('secretVersion', () => { + const fakePath = "/rendered/path/secretVersion"; + const expectedParameters = { + project: "projectValue", + secret: "secretValue", + version: "versionValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.secretVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.secretVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('secretVersionPath', () => { + const result = client.secretVersionPath("projectValue", "secretValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.secretVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSecretVersionName', () => { + const result = client.matchProjectFromSecretVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSecretFromSecretVersionName', () => { + const result = client.matchSecretFromSecretVersionName(fakePath); + assert.strictEqual(result, "secretValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromSecretVersionName', () => { + const result = client.matchVersionFromSecretVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('serviceAccount', () => { + const fakePath = "/rendered/path/serviceAccount"; + const expectedParameters = { + project: "projectValue", + service_account: "serviceAccountValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.serviceAccountPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.serviceAccountPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('serviceAccountPath', () => { + const result = client.serviceAccountPath("projectValue", "serviceAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.serviceAccountPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceAccountName', () => { + const result = client.matchProjectFromServiceAccountName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceAccountFromServiceAccountName', () => { + const result = client.matchServiceAccountFromServiceAccountName(fakePath); + assert.strictEqual(result, "serviceAccountValue"); + assert((client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('subscription', () => { + const fakePath = "/rendered/path/subscription"; + const expectedParameters = { + project: "projectValue", + subscription: "subscriptionValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.subscriptionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.subscriptionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('subscriptionPath', () => { + const result = client.subscriptionPath("projectValue", "subscriptionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.subscriptionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSubscriptionName', () => { + const result = client.matchProjectFromSubscriptionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.subscriptionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSubscriptionFromSubscriptionName', () => { + const result = client.matchSubscriptionFromSubscriptionName(fakePath); + assert.strictEqual(result, "subscriptionValue"); + assert((client.pathTemplates.subscriptionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('topic', () => { + const fakePath = "/rendered/path/topic"; + const expectedParameters = { + project: "projectValue", + topic: "topicValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + 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('workerPool', () => { + const fakePath = "/rendered/path/workerPool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + worker_pool: "workerPoolValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + 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-devtools-cloudbuild/v1/tsconfig.json b/owl-bot-staging/google-devtools-cloudbuild/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v1/webpack.config.js b/owl-bot-staging/google-devtools-cloudbuild/v1/webpack.config.js new file mode 100644 index 00000000000..f667feb1580 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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: 'CloudBuild', + filename: './cloud-build.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-devtools-cloudbuild/v2/.eslintignore b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore b/owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v2/.jsdoc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.jsdoc.js new file mode 100644 index 00000000000..09c8e7ac916 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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/cloudbuild', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v2/.prettierrc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v2/README.md b/owl-bot-staging/google-devtools-cloudbuild/v2/README.md new file mode 100644 index 00000000000..1e997bef7bc --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/README.md @@ -0,0 +1 @@ +Cloudbuild: Nodejs Client diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/package.json b/owl-bot-staging/google-devtools-cloudbuild/v2/package.json new file mode 100644 index 00000000000..3d2b92e0fa5 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/cloudbuild", + "version": "0.1.0", + "description": "Cloudbuild client for Node.js", + "repository": "googleapis/nodejs-cloudbuild", + "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 cloudbuild", + "cloudbuild", + "repository 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-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto new file mode 100644 index 00000000000..8a2fb350d39 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto @@ -0,0 +1,112 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.cloudbuild.v2; + +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 csharp_namespace = "Google.Cloud.CloudBuild.V2"; +option go_package = "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb;cloudbuildpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudBuildProto"; +option java_package = "com.google.cloudbuild.v2"; +option objc_class_prefix = "GCB"; +option php_namespace = "Google\\Cloud\\Build\\V2"; +option ruby_package = "Google::Cloud::Build::V2"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; +option (google.api.resource_definition) = { + type: "iam.googleapis.com/ServiceAccount" + pattern: "projects/{project}/serviceAccounts/{service_account}" +}; +option (google.api.resource_definition) = { + type: "secretmanager.googleapis.com/Secret" + pattern: "projects/{project}/secrets/{secret}" +}; +option (google.api.resource_definition) = { + type: "secretmanager.googleapis.com/SecretVersion" + pattern: "projects/{project}/secrets/{secret}/versions/{version}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/githubEnterpriseConfig" + pattern: "projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}" +}; + +// 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]; +} + +// Represents the custom metadata of the RunWorkflow long-running operation. +message RunWorkflowCustomOperationMetadata { + // 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. Name of the verb executed by the operation. + string verb = 3 [(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 = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. ID of the pipeline run created by RunWorkflow. + string pipeline_run_id = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto new file mode 100644 index 00000000000..41583e70d4e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto @@ -0,0 +1,802 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.cloudbuild.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/httpbody.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"; + +option csharp_namespace = "Google.Cloud.CloudBuild.V2"; +option go_package = "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb;cloudbuildpb"; +option java_multiple_files = true; +option java_outer_classname = "RepositoryManagerProto"; +option java_package = "com.google.cloudbuild.v2"; +option objc_class_prefix = "GCB"; +option php_namespace = "Google\\Cloud\\Build\\V2"; +option ruby_package = "Google::Cloud::Build::V2"; +option (google.api.resource_definition) = { + type: "servicedirectory.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}" +}; + +// Manages connections to source code repositories. +service RepositoryManager { + option (google.api.default_host) = "cloudbuild.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Connection. + rpc CreateConnection(CreateConnectionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/connections" + body: "connection" + }; + option (google.api.method_signature) = "parent,connection,connection_id"; + option (google.longrunning.operation_info) = { + response_type: "Connection" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Gets details of a single connection. + rpc GetConnection(GetConnectionRequest) returns (Connection) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/connections/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists Connections in a given project and location. + rpc ListConnections(ListConnectionsRequest) + returns (ListConnectionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/connections" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates a single connection. + rpc UpdateConnection(UpdateConnectionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{connection.name=projects/*/locations/*/connections/*}" + body: "connection" + }; + option (google.api.method_signature) = "connection,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Connection" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Deletes a single connection. + rpc DeleteConnection(DeleteConnectionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/connections/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Creates a Repository. + rpc CreateRepository(CreateRepositoryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/connections/*}/repositories" + body: "repository" + }; + option (google.api.method_signature) = "parent,repository,repository_id"; + option (google.longrunning.operation_info) = { + response_type: "Repository" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Creates multiple repositories inside a connection. + rpc BatchCreateRepositories(BatchCreateRepositoriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/connections/*}/repositories:batchCreate" + body: "*" + }; + option (google.api.method_signature) = "parent,requests"; + option (google.longrunning.operation_info) = { + response_type: "BatchCreateRepositoriesResponse" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Gets details of a single repository. + rpc GetRepository(GetRepositoryRequest) returns (Repository) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/connections/*/repositories/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists Repositories in a given connection. + rpc ListRepositories(ListRepositoriesRequest) + returns (ListRepositoriesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*/connections/*}/repositories" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a single repository. + rpc DeleteRepository(DeleteRepositoryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/connections/*/repositories/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Fetches read/write token of a given repository. + rpc FetchReadWriteToken(FetchReadWriteTokenRequest) + returns (FetchReadWriteTokenResponse) { + option (google.api.http) = { + post: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:accessReadWriteToken" + body: "*" + }; + option (google.api.method_signature) = "repository"; + } + + // Fetches read token of a given repository. + rpc FetchReadToken(FetchReadTokenRequest) returns (FetchReadTokenResponse) { + option (google.api.http) = { + post: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:accessReadToken" + body: "*" + }; + option (google.api.method_signature) = "repository"; + } + + // FetchLinkableRepositories get repositories from SCM that are + // accessible and could be added to the connection. + rpc FetchLinkableRepositories(FetchLinkableRepositoriesRequest) + returns (FetchLinkableRepositoriesResponse) { + option (google.api.http) = { + get: "/v2/{connection=projects/*/locations/*/connections/*}:fetchLinkableRepositories" + }; + } + + // Fetch the list of branches or tags for a given repository. + rpc FetchGitRefs(FetchGitRefsRequest) returns (FetchGitRefsResponse) { + option (google.api.http) = { + get: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:fetchGitRefs" + }; + option (google.api.method_signature) = "repository"; + } +} + +// A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Server or +// GitLab. +message Connection { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/Connection" + pattern: "projects/{project}/locations/{location}/connections/{connection}" + plural: "connections" + singular: "connection" + style: DECLARATIVE_FRIENDLY + }; + + // Immutable. The resource name of the connection, in the format + // `projects/{project}/locations/{location}/connections/{connection_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. Server assigned timestamp for when the connection was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server assigned timestamp for when the connection was updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Configuration for the connection depending on the type of provider. + oneof connection_config { + // Configuration for connections to github.com. + GitHubConfig github_config = 5; + + // Configuration for connections to an instance of GitHub Enterprise. + GitHubEnterpriseConfig github_enterprise_config = 6; + + // Configuration for connections to gitlab.com or an instance of GitLab + // Enterprise. + GitLabConfig gitlab_config = 7; + } + + // Output only. Installation state of the Connection. + InstallationState installation_state = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // If disabled is set to true, functionality is disabled for this connection. + // Repository based API methods and webhooks processing for repositories in + // this connection will be disabled. + bool disabled = 13; + + // Output only. Set to true when the connection is being set up or updated in + // the background. + bool reconciling = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows clients to store small amounts of arbitrary data. + map annotations = 15; + + // This checksum is computed by the server based on the value of other + // fields, and may be sent on update and delete requests to ensure the + // client has an up-to-date value before proceeding. + string etag = 16; +} + +// Describes stage and necessary actions to be taken by the +// user to complete the installation. Used for GitHub and GitHub Enterprise +// based connections. +message InstallationState { + // Stage of the installation process. + enum Stage { + // No stage specified. + STAGE_UNSPECIFIED = 0; + + // Only for GitHub Enterprise. An App creation has been requested. + // The user needs to confirm the creation in their GitHub enterprise host. + PENDING_CREATE_APP = 1; + + // User needs to authorize the GitHub (or Enterprise) App via OAuth. + PENDING_USER_OAUTH = 2; + + // User needs to follow the link to install the GitHub (or Enterprise) App. + PENDING_INSTALL_APP = 3; + + // Installation process has been completed. + COMPLETE = 10; + } + + // Output only. Current step of the installation process. + Stage stage = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Message of what the user should do next to continue the + // installation. Empty string if the installation is already complete. + string message = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Link to follow for next action. Empty string if the + // installation is already complete. + string action_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for FetchLinkableRepositories. +message FetchLinkableRepositoriesRequest { + // Required. The name of the Connection. + // Format: `projects/*/locations/*/connections/*`. + string connection = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // Number of results to return in the list. Default to 20. + int32 page_size = 2; + + // Page start. + string page_token = 3; +} + +// Response message for FetchLinkableRepositories. +message FetchLinkableRepositoriesResponse { + // repositories ready to be created. + repeated Repository repositories = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; +} + +// Configuration for connections to github.com. +message GitHubConfig { + // OAuth credential of the account that authorized the Cloud Build GitHub App. + // It is recommended to use a robot account instead of a human user account. + // The OAuth token must be tied to the Cloud Build GitHub App. + OAuthCredential authorizer_credential = 1; + + // GitHub App installation id. + int64 app_installation_id = 2; +} + +// Configuration for connections to an instance of GitHub Enterprise. +message GitHubEnterpriseConfig { + // Required. The URI of the GitHub Enterprise host this connection is for. + string host_uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. API Key used for authentication of webhook events. + string api_key = 12 [(google.api.field_behavior) = REQUIRED]; + + // Id of the GitHub App created from the manifest. + int64 app_id = 2; + + // The URL-friendly name of the GitHub App. + string app_slug = 13; + + // SecretManager resource containing the private key of the GitHub App, + // formatted as `projects/*/secrets/*/versions/*`. + string private_key_secret_version = 4 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // SecretManager resource containing the webhook secret of the GitHub App, + // formatted as `projects/*/secrets/*/versions/*`. + string webhook_secret_secret_version = 5 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // ID of the installation of the GitHub App. + int64 app_installation_id = 9; + + // Configuration for using Service Directory to privately connect to a GitHub + // Enterprise server. This should only be set if the GitHub Enterprise server + // is hosted on-premises and not reachable by public internet. If this field + // is left empty, calls to the GitHub Enterprise server will be made over the + // public internet. + ServiceDirectoryConfig service_directory_config = 10; + + // SSL certificate to use for requests to GitHub Enterprise. + string ssl_ca = 11; + + // Output only. GitHub Enterprise version installed at the host_uri. + string server_version = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration for connections to gitlab.com or an instance of GitLab +// Enterprise. +message GitLabConfig { + // The URI of the GitLab Enterprise host this connection is for. + // If not specified, the default value is https://gitlab.com. + string host_uri = 1; + + // Required. Immutable. SecretManager resource containing the webhook secret + // of a GitLab Enterprise project, formatted as + // `projects/*/secrets/*/versions/*`. + string webhook_secret_secret_version = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; + + // Required. A GitLab personal access token with the minimum `read_api` scope + // access. + UserCredential read_authorizer_credential = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Required. A GitLab personal access token with the `api` scope access. + UserCredential authorizer_credential = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Configuration for using Service Directory to privately connect to a GitLab + // Enterprise server. This should only be set if the GitLab Enterprise server + // is hosted on-premises and not reachable by public internet. If this field + // is left empty, calls to the GitLab Enterprise server will be made over the + // public internet. + ServiceDirectoryConfig service_directory_config = 5; + + // SSL certificate to use for requests to GitLab Enterprise. + string ssl_ca = 6; + + // Output only. Version of the GitLab Enterprise server running on the + // `host_uri`. + string server_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// ServiceDirectoryConfig represents Service Directory configuration for a +// connection. +message ServiceDirectoryConfig { + // Required. The Service Directory service name. + // Format: + // projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Service" + } + ]; +} + +// A repository associated to a parent connection. +message Repository { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}" + plural: "repositories" + singular: "repository" + style: DECLARATIVE_FRIENDLY + }; + + // Immutable. Resource name of the repository, in the format + // `projects/*/locations/*/connections/*/repositories/*`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. Git Clone HTTPS URI. + string remote_uri = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Server assigned timestamp for when the connection was created. + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server assigned timestamp for when the connection was updated. + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows clients to store small amounts of arbitrary data. + map annotations = 6; + + // This checksum is computed by the server based on the value of other + // fields, and may be sent on update and delete requests to ensure the + // client has an up-to-date value before proceeding. + string etag = 7; + + // Output only. External ID of the webhook created for the repository. + string webhook_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents an OAuth token of the account that authorized the Connection, +// and associated metadata. +message OAuthCredential { + // A SecretManager resource containing the OAuth token that authorizes + // the Cloud Build connection. Format: `projects/*/secrets/*/versions/*`. + string oauth_token_secret_version = 1 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // Output only. The username associated to this token. + string username = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a personal access token that authorized the Connection, +// and associated metadata. +message UserCredential { + // Required. A SecretManager resource containing the user token that + // authorizes the Cloud Build connection. Format: + // `projects/*/secrets/*/versions/*`. + string user_token_secret_version = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; + + // Output only. The username associated to this token. + string username = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Message for creating a Connection +message CreateConnectionRequest { + // Required. Project and location where the connection will be created. + // Format: `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // Required. The Connection to create. + Connection connection = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the Connection, which will become the final + // component of the Connection's resource name. Names must be unique + // per-project per-location. Allows alphanumeric characters and any of + // -._~%!$&'()*+,;=@. + string connection_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Message for getting the details of a Connection. +message GetConnectionRequest { + // Required. The name of the Connection to retrieve. + // Format: `projects/*/locations/*/connections/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Connection" + } + ]; +} + +// Message for requesting list of Connections. +message ListConnectionsRequest { + // Required. The parent, which owns this collection of Connections. + // Format: `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // Number of results to return in the list. + int32 page_size = 2; + + // Page start. + string page_token = 3; +} + +// Message for response to listing Connections. +message ListConnectionsResponse { + // The list of Connections. + repeated Connection connections = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; +} + +// Message for updating a Connection. +message UpdateConnectionRequest { + // Required. The Connection to update. + Connection connection = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the connection is not found a new connection + // will be created. In this situation `update_mask` is ignored. + // The creation will succeed only if the input connection has all the + // necessary information (e.g a github_config with both user_oauth_token and + // installation_id properties). + bool allow_missing = 3; + + // The current etag of the connection. + // If an etag is provided and does not match the current etag of the + // connection, update will be blocked and an ABORTED error will be returned. + string etag = 4; +} + +// Message for deleting a Connection. +message DeleteConnectionRequest { + // Required. The name of the Connection to delete. + // Format: `projects/*/locations/*/connections/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // The current etag of the connection. + // If an etag is provided and does not match the current etag of the + // connection, deletion will be blocked and an ABORTED error will be returned. + string etag = 2; + + // If set, validate the request, but do not actually post it. + bool validate_only = 3; +} + +// Message for creating a Repository. +message CreateRepositoryRequest { + // Required. The connection to contain the repository. If the request is part + // of a BatchCreateRepositoriesRequest, this field should be empty or match + // the parent specified there. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // Required. The repository to create. + Repository repository = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the repository, which will become the final + // component of the repository's resource name. This ID should be unique in + // the connection. Allows alphanumeric characters and any of + // -._~%!$&'()*+,;=@. + string repository_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Message for creating repositoritories in batch. +message BatchCreateRepositoriesRequest { + // Required. The connection to contain all the repositories being created. + // Format: projects/*/locations/*/connections/* + // The parent field in the CreateRepositoryRequest messages + // must either be empty or match this field. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // Required. The request messages specifying the repositories to create. + repeated CreateRepositoryRequest requests = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Message for response of creating repositories in batch. +message BatchCreateRepositoriesResponse { + // Repository resources created. + repeated Repository repositories = 1; +} + +// Message for getting the details of a Repository. +message GetRepositoryRequest { + // Required. The name of the Repository to retrieve. + // Format: `projects/*/locations/*/connections/*/repositories/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + } + ]; +} + +// Message for requesting list of Repositories. +message ListRepositoriesRequest { + // Required. The parent, which owns this collection of Repositories. + // Format: `projects/*/locations/*/connections/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Repository" + } + ]; + + // Number of results to return in the list. + int32 page_size = 2; + + // Page start. + string page_token = 3; + + // A filter expression that filters resources listed in the response. + // Expressions must follow API improvement proposal + // [AIP-160](https://google.aip.dev/160). e.g. + // `remote_uri:"https://github.com*"`. + string filter = 4; +} + +// Message for response to listing Repositories. +message ListRepositoriesResponse { + // The list of Repositories. + repeated Repository repositories = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; +} + +// Message for deleting a Repository. +message DeleteRepositoryRequest { + // Required. The name of the Repository to delete. + // Format: `projects/*/locations/*/connections/*/repositories/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + } + ]; + + // The current etag of the repository. + // If an etag is provided and does not match the current etag of the + // repository, deletion will be blocked and an ABORTED error will be returned. + string etag = 2; + + // If set, validate the request, but do not actually post it. + bool validate_only = 3; +} + +// Message for fetching SCM read/write token. +message FetchReadWriteTokenRequest { + // Required. The resource name of the repository in the format + // `projects/*/locations/*/connections/*/repositories/*`. + string repository = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + } + ]; +} + +// Message for fetching SCM read token. +message FetchReadTokenRequest { + // Required. The resource name of the repository in the format + // `projects/*/locations/*/connections/*/repositories/*`. + string repository = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + } + ]; +} + +// Message for responding to get read token. +message FetchReadTokenResponse { + // The token content. + string token = 1; + + // Expiration timestamp. Can be empty if unknown or non-expiring. + google.protobuf.Timestamp expiration_time = 2; +} + +// Message for responding to get read/write token. +message FetchReadWriteTokenResponse { + // The token content. + string token = 1; + + // Expiration timestamp. Can be empty if unknown or non-expiring. + google.protobuf.Timestamp expiration_time = 2; +} + +// RPC request object accepted by the ProcessWebhook RPC method. +message ProcessWebhookRequest { + // Required. Project and location where the webhook will be received. + // Format: `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // HTTP request body. + google.api.HttpBody body = 2; + + // Arbitrary additional key to find the maching repository for a webhook event + // if needed. + string webhook_key = 3; +} + +// Request for fetching git refs +message FetchGitRefsRequest { + // Type of refs + enum RefType { + // No type specified. + REF_TYPE_UNSPECIFIED = 0; + + // To fetch tags. + TAG = 1; + + // To fetch branches. + BRANCH = 2; + } + + // Required. The resource name of the repository in the format + // `projects/*/locations/*/connections/*/repositories/*`. + string repository = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + } + ]; + + // Type of refs to fetch + RefType ref_type = 2; +} + +// Response for fetching git refs +message FetchGitRefsResponse { + // Name of the refs fetched. + repeated string ref_names = 1; +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js new file mode 100644 index 00000000000..9bdc0b8d979 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.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, requests) { + // [START cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The connection to contain all the repositories being created. + * Format: projects/* /locations/* /connections/* + * The parent field in the CreateRepositoryRequest messages + * must either be empty or match this field. + */ + // const parent = 'abc123' + /** + * Required. The request messages specifying the repositories to create. + */ + // const requests = [1,2,3,4] + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callBatchCreateRepositories() { + // Construct request + const request = { + parent, + requests, + }; + + // Run request + const [operation] = await cloudbuildClient.batchCreateRepositories(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchCreateRepositories(); + // [END cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js new file mode 100644 index 00000000000..1ff4f1186b5 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.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, connection, connectionId) { + // [START cloudbuild_v2_generated_RepositoryManager_CreateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Project and location where the connection will be created. + * Format: `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Required. The Connection to create. + */ + // const connection = {} + /** + * Required. The ID to use for the Connection, which will become the final + * component of the Connection's resource name. Names must be unique + * per-project per-location. Allows alphanumeric characters and any of + * -._~%!$&'()*+,;=@. + */ + // const connectionId = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callCreateConnection() { + // Construct request + const request = { + parent, + connection, + connectionId, + }; + + // Run request + const [operation] = await cloudbuildClient.createConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConnection(); + // [END cloudbuild_v2_generated_RepositoryManager_CreateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js new file mode 100644 index 00000000000..d4def936139 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.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, repository, repositoryId) { + // [START cloudbuild_v2_generated_RepositoryManager_CreateRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The connection to contain the repository. If the request is part + * of a BatchCreateRepositoriesRequest, this field should be empty or match + * the parent specified there. + */ + // const parent = 'abc123' + /** + * Required. The repository to create. + */ + // const repository = {} + /** + * Required. The ID to use for the repository, which will become the final + * component of the repository's resource name. This ID should be unique in + * the connection. Allows alphanumeric characters and any of + * -._~%!$&'()*+,;=@. + */ + // const repositoryId = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callCreateRepository() { + // Construct request + const request = { + parent, + repository, + repositoryId, + }; + + // Run request + const [operation] = await cloudbuildClient.createRepository(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateRepository(); + // [END cloudbuild_v2_generated_RepositoryManager_CreateRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js new file mode 100644 index 00000000000..46a5ff3ce9a --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.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 cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Connection to delete. + * Format: `projects/* /locations/* /connections/*`. + */ + // const name = 'abc123' + /** + * The current etag of the connection. + * If an etag is provided and does not match the current etag of the + * connection, deletion will be blocked and an ABORTED error will be returned. + */ + // const etag = 'abc123' + /** + * If set, validate the request, but do not actually post it. + */ + // const validateOnly = true + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callDeleteConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await cloudbuildClient.deleteConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteConnection(); + // [END cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js new file mode 100644 index 00000000000..42194417a03 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.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 cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Repository to delete. + * Format: `projects/* /locations/* /connections/* /repositories/*`. + */ + // const name = 'abc123' + /** + * The current etag of the repository. + * If an etag is provided and does not match the current etag of the + * repository, deletion will be blocked and an ABORTED error will be returned. + */ + // const etag = 'abc123' + /** + * If set, validate the request, but do not actually post it. + */ + // const validateOnly = true + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callDeleteRepository() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await cloudbuildClient.deleteRepository(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteRepository(); + // [END cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js new file mode 100644 index 00000000000..96728361b81 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.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(repository) { + // [START cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + */ + // const repository = 'abc123' + /** + * Type of refs to fetch + */ + // const refType = {} + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callFetchGitRefs() { + // Construct request + const request = { + repository, + }; + + // Run request + const response = await cloudbuildClient.fetchGitRefs(request); + console.log(response); + } + + callFetchGitRefs(); + // [END cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js new file mode 100644 index 00000000000..3d722ecc9ac --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.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(connection) { + // [START cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Connection. + * Format: `projects/* /locations/* /connections/*`. + */ + // const connection = 'abc123' + /** + * Number of results to return in the list. Default to 20. + */ + // const pageSize = 1234 + /** + * Page start. + */ + // const pageToken = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callFetchLinkableRepositories() { + // Construct request + const request = { + connection, + }; + + // Run request + const iterable = await cloudbuildClient.fetchLinkableRepositoriesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callFetchLinkableRepositories(); + // [END cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js new file mode 100644 index 00000000000..623c8b64bc2 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.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(repository) { + // [START cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + */ + // const repository = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callFetchReadToken() { + // Construct request + const request = { + repository, + }; + + // Run request + const response = await cloudbuildClient.fetchReadToken(request); + console.log(response); + } + + callFetchReadToken(); + // [END cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js new file mode 100644 index 00000000000..8aaabdabd84 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.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(repository) { + // [START cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + */ + // const repository = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callFetchReadWriteToken() { + // Construct request + const request = { + repository, + }; + + // Run request + const response = await cloudbuildClient.fetchReadWriteToken(request); + console.log(response); + } + + callFetchReadWriteToken(); + // [END cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js new file mode 100644 index 00000000000..f4146b898e5 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_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 cloudbuild_v2_generated_RepositoryManager_GetConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Connection to retrieve. + * Format: `projects/* /locations/* /connections/*`. + */ + // const name = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callGetConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await cloudbuildClient.getConnection(request); + console.log(response); + } + + callGetConnection(); + // [END cloudbuild_v2_generated_RepositoryManager_GetConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js new file mode 100644 index 00000000000..deca8de40e8 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.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 cloudbuild_v2_generated_RepositoryManager_GetRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Repository to retrieve. + * Format: `projects/* /locations/* /connections/* /repositories/*`. + */ + // const name = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callGetRepository() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await cloudbuildClient.getRepository(request); + console.log(response); + } + + callGetRepository(); + // [END cloudbuild_v2_generated_RepositoryManager_GetRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js new file mode 100644 index 00000000000..63a97011b65 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.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(parent) { + // [START cloudbuild_v2_generated_RepositoryManager_ListConnections_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Connections. + * Format: `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Number of results to return in the list. + */ + // const pageSize = 1234 + /** + * Page start. + */ + // const pageToken = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callListConnections() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await cloudbuildClient.listConnectionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConnections(); + // [END cloudbuild_v2_generated_RepositoryManager_ListConnections_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js new file mode 100644 index 00000000000..fc2a8e319b2 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.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 cloudbuild_v2_generated_RepositoryManager_ListRepositories_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Repositories. + * Format: `projects/* /locations/* /connections/*`. + */ + // const parent = 'abc123' + /** + * Number of results to return in the list. + */ + // const pageSize = 1234 + /** + * Page start. + */ + // const pageToken = 'abc123' + /** + * A filter expression that filters resources listed in the response. + * Expressions must follow API improvement proposal + * AIP-160 (https://google.aip.dev/160). e.g. + * `remote_uri:"https://github.com*"`. + */ + // const filter = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callListRepositories() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await cloudbuildClient.listRepositoriesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRepositories(); + // [END cloudbuild_v2_generated_RepositoryManager_ListRepositories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js new file mode 100644 index 00000000000..4525a347001 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.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(connection) { + // [START cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Connection to update. + */ + // const connection = {} + /** + * The list of fields to be updated. + */ + // const updateMask = {} + /** + * If set to true, and the connection is not found a new connection + * will be created. In this situation `update_mask` is ignored. + * The creation will succeed only if the input connection has all the + * necessary information (e.g a github_config with both user_oauth_token and + * installation_id properties). + */ + // const allowMissing = true + /** + * The current etag of the connection. + * If an etag is provided and does not match the current etag of the + * connection, update will be blocked and an ABORTED error will be returned. + */ + // const etag = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callUpdateConnection() { + // Construct request + const request = { + connection, + }; + + // Run request + const [operation] = await cloudbuildClient.updateConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateConnection(); + // [END cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata_google.devtools.cloudbuild.v2.json b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata_google.devtools.cloudbuild.v2.json new file mode 100644 index 00000000000..bf929148640 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata_google.devtools.cloudbuild.v2.json @@ -0,0 +1,655 @@ +{ + "clientLibrary": { + "name": "nodejs-cloudbuild", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.devtools.cloudbuild.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_CreateConnection_async", + "title": "RepositoryManager createConnection Sample", + "origin": "API_DEFINITION", + "description": " Creates a Connection.", + "canonical": true, + "file": "repository_manager.create_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateConnection", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "connection", + "type": ".google.devtools.cloudbuild.v2.Connection" + }, + { + "name": "connection_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "CreateConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateConnection", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_GetConnection_async", + "title": "RepositoryManager getConnection Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single connection.", + "canonical": true, + "file": "repository_manager.get_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.Connection", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "GetConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetConnection", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_ListConnections_async", + "title": "RepositoryManager listConnections Sample", + "origin": "API_DEFINITION", + "description": " Lists Connections in a given project and location.", + "canonical": true, + "file": "repository_manager.list_connections.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConnections", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListConnections", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.ListConnectionsResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "ListConnections", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListConnections", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async", + "title": "RepositoryManager updateConnection Sample", + "origin": "API_DEFINITION", + "description": " Updates a single connection.", + "canonical": true, + "file": "repository_manager.update_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.UpdateConnection", + "async": true, + "parameters": [ + { + "name": "connection", + "type": ".google.devtools.cloudbuild.v2.Connection" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "UpdateConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.UpdateConnection", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async", + "title": "RepositoryManager deleteConnection Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single connection.", + "canonical": true, + "file": "repository_manager.delete_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "DeleteConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteConnection", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_CreateRepository_async", + "title": "RepositoryManager createRepository Sample", + "origin": "API_DEFINITION", + "description": " Creates a Repository.", + "canonical": true, + "file": "repository_manager.create_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateRepository", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "repository", + "type": ".google.devtools.cloudbuild.v2.Repository" + }, + { + "name": "repository_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "CreateRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateRepository", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async", + "title": "RepositoryManager batchCreateRepositories Sample", + "origin": "API_DEFINITION", + "description": " Creates multiple repositories inside a connection.", + "canonical": true, + "file": "repository_manager.batch_create_repositories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.BatchCreateRepositories", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "requests", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "BatchCreateRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.BatchCreateRepositories", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_GetRepository_async", + "title": "RepositoryManager getRepository Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single repository.", + "canonical": true, + "file": "repository_manager.get_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetRepository", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.Repository", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "GetRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetRepository", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_ListRepositories_async", + "title": "RepositoryManager listRepositories Sample", + "origin": "API_DEFINITION", + "description": " Lists Repositories in a given connection.", + "canonical": true, + "file": "repository_manager.list_repositories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListRepositories", + "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" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.ListRepositoriesResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "ListRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListRepositories", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async", + "title": "RepositoryManager deleteRepository Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single repository.", + "canonical": true, + "file": "repository_manager.delete_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteRepository", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "DeleteRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteRepository", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async", + "title": "RepositoryManager fetchReadWriteToken Sample", + "origin": "API_DEFINITION", + "description": " Fetches read/write token of a given repository.", + "canonical": true, + "file": "repository_manager.fetch_read_write_token.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchReadWriteToken", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadWriteToken", + "async": true, + "parameters": [ + { + "name": "repository", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "FetchReadWriteToken", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadWriteToken", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async", + "title": "RepositoryManager fetchReadToken Sample", + "origin": "API_DEFINITION", + "description": " Fetches read token of a given repository.", + "canonical": true, + "file": "repository_manager.fetch_read_token.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchReadToken", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadToken", + "async": true, + "parameters": [ + { + "name": "repository", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.FetchReadTokenResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "FetchReadToken", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadToken", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async", + "title": "RepositoryManager fetchLinkableRepositories Sample", + "origin": "API_DEFINITION", + "description": " FetchLinkableRepositories get repositories from SCM that are accessible and could be added to the connection.", + "canonical": true, + "file": "repository_manager.fetch_linkable_repositories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchLinkableRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchLinkableRepositories", + "async": true, + "parameters": [ + { + "name": "connection", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.FetchLinkableRepositoriesResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "FetchLinkableRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchLinkableRepositories", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async", + "title": "RepositoryManager fetchGitRefs Sample", + "origin": "API_DEFINITION", + "description": " Fetch the list of branches or tags for a given repository.", + "canonical": true, + "file": "repository_manager.fetch_git_refs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchGitRefs", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchGitRefs", + "async": true, + "parameters": [ + { + "name": "repository", + "type": "TYPE_STRING" + }, + { + "name": "ref_type", + "type": ".google.devtools.cloudbuild.v2.FetchGitRefsRequest.RefType" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.FetchGitRefsResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "FetchGitRefs", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchGitRefs", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts new file mode 100644 index 00000000000..87935397b2a --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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 RepositoryManagerClient = v2.RepositoryManagerClient; +type RepositoryManagerClient = v2.RepositoryManagerClient; +export {v2, RepositoryManagerClient}; +export default {v2, RepositoryManagerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..e99fba47b64 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json @@ -0,0 +1,175 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.devtools.cloudbuild.v2", + "libraryPackage": "@google-cloud/cloudbuild", + "services": { + "RepositoryManager": { + "clients": { + "grpc": { + "libraryClient": "RepositoryManagerClient", + "rpcs": { + "GetConnection": { + "methods": [ + "getConnection" + ] + }, + "GetRepository": { + "methods": [ + "getRepository" + ] + }, + "FetchReadWriteToken": { + "methods": [ + "fetchReadWriteToken" + ] + }, + "FetchReadToken": { + "methods": [ + "fetchReadToken" + ] + }, + "FetchGitRefs": { + "methods": [ + "fetchGitRefs" + ] + }, + "CreateConnection": { + "methods": [ + "createConnection" + ] + }, + "UpdateConnection": { + "methods": [ + "updateConnection" + ] + }, + "DeleteConnection": { + "methods": [ + "deleteConnection" + ] + }, + "CreateRepository": { + "methods": [ + "createRepository" + ] + }, + "BatchCreateRepositories": { + "methods": [ + "batchCreateRepositories" + ] + }, + "DeleteRepository": { + "methods": [ + "deleteRepository" + ] + }, + "ListConnections": { + "methods": [ + "listConnections", + "listConnectionsStream", + "listConnectionsAsync" + ] + }, + "ListRepositories": { + "methods": [ + "listRepositories", + "listRepositoriesStream", + "listRepositoriesAsync" + ] + }, + "FetchLinkableRepositories": { + "methods": [ + "fetchLinkableRepositories", + "fetchLinkableRepositoriesStream", + "fetchLinkableRepositoriesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "RepositoryManagerClient", + "rpcs": { + "GetConnection": { + "methods": [ + "getConnection" + ] + }, + "GetRepository": { + "methods": [ + "getRepository" + ] + }, + "FetchReadWriteToken": { + "methods": [ + "fetchReadWriteToken" + ] + }, + "FetchReadToken": { + "methods": [ + "fetchReadToken" + ] + }, + "FetchGitRefs": { + "methods": [ + "fetchGitRefs" + ] + }, + "CreateConnection": { + "methods": [ + "createConnection" + ] + }, + "UpdateConnection": { + "methods": [ + "updateConnection" + ] + }, + "DeleteConnection": { + "methods": [ + "deleteConnection" + ] + }, + "CreateRepository": { + "methods": [ + "createRepository" + ] + }, + "BatchCreateRepositories": { + "methods": [ + "batchCreateRepositories" + ] + }, + "DeleteRepository": { + "methods": [ + "deleteRepository" + ] + }, + "ListConnections": { + "methods": [ + "listConnections", + "listConnectionsStream", + "listConnectionsAsync" + ] + }, + "ListRepositories": { + "methods": [ + "listRepositories", + "listRepositoriesStream", + "listRepositoriesAsync" + ] + }, + "FetchLinkableRepositories": { + "methods": [ + "fetchLinkableRepositories", + "fetchLinkableRepositoriesStream", + "fetchLinkableRepositoriesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts new file mode 100644 index 00000000000..026d90530f0 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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 {RepositoryManagerClient} from './repository_manager_client'; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts new file mode 100644 index 00000000000..2970f3599f0 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts @@ -0,0 +1,2572 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/repository_manager_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './repository_manager_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Manages connections to source code repositories. + * @class + * @memberof v2 + */ +export class RepositoryManagerClient { + 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; + repositoryManagerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of RepositoryManagerClient. + * + * @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 RepositoryManagerClient({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 RepositoryManagerClient; + 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 = { + connectionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connections/{connection}' + ), + 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}/connections/{connection}/repositories/{repository}' + ), + secretVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/secrets/{secret}/versions/{version}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/namespaces/{namespace}/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 = { + listConnections: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'connections'), + listRepositories: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories'), + fetchLinkableRepositories: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories') + }; + + 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.iam.v1.IAMPolicy.GetIamPolicy',get: '/v2/{resource=projects/*/locations/*/connections/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v2/{resource=projects/*/locations/*/connections/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v2/{resource=projects/*/locations/*/connections/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/locations/*/operations/*}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createConnectionResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.Connection') as gax.protobuf.Type; + const createConnectionMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + const updateConnectionResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.Connection') as gax.protobuf.Type; + const updateConnectionMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + const deleteConnectionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteConnectionMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + const createRepositoryResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.Repository') as gax.protobuf.Type; + const createRepositoryMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + const batchCreateRepositoriesResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.BatchCreateRepositoriesResponse') as gax.protobuf.Type; + const batchCreateRepositoriesMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + const deleteRepositoryResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteRepositoryMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConnectionResponse.decode.bind(createConnectionResponse), + createConnectionMetadata.decode.bind(createConnectionMetadata)), + updateConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateConnectionResponse.decode.bind(updateConnectionResponse), + updateConnectionMetadata.decode.bind(updateConnectionMetadata)), + deleteConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteConnectionResponse.decode.bind(deleteConnectionResponse), + deleteConnectionMetadata.decode.bind(deleteConnectionMetadata)), + createRepository: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createRepositoryResponse.decode.bind(createRepositoryResponse), + createRepositoryMetadata.decode.bind(createRepositoryMetadata)), + batchCreateRepositories: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchCreateRepositoriesResponse.decode.bind(batchCreateRepositoriesResponse), + batchCreateRepositoriesMetadata.decode.bind(batchCreateRepositoriesMetadata)), + deleteRepository: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteRepositoryResponse.decode.bind(deleteRepositoryResponse), + deleteRepositoryMetadata.decode.bind(deleteRepositoryMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.devtools.cloudbuild.v2.RepositoryManager', 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.repositoryManagerStub) { + return this.repositoryManagerStub; + } + + // Put together the "service stub" for + // google.devtools.cloudbuild.v2.RepositoryManager. + this.repositoryManagerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.devtools.cloudbuild.v2.RepositoryManager') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devtools.cloudbuild.v2.RepositoryManager, + 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 repositoryManagerStubMethods = + ['createConnection', 'getConnection', 'listConnections', 'updateConnection', 'deleteConnection', 'createRepository', 'batchCreateRepositories', 'getRepository', 'listRepositories', 'deleteRepository', 'fetchReadWriteToken', 'fetchReadToken', 'fetchLinkableRepositories', 'fetchGitRefs']; + for (const methodName of repositoryManagerStubMethods) { + const callPromise = this.repositoryManagerStub.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.repositoryManagerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudbuild.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 'cloudbuild.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 connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Connection to retrieve. + * Format: `projects/* /locations/* /connections/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v2.Connection|Connection}. + * Please see the {@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/repository_manager.get_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_GetConnection_async + */ + getConnection( + request?: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|undefined, {}|undefined + ]>; + getConnection( + request: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, + {}|null|undefined>): void; + getConnection( + request: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, + {}|null|undefined>): void; + getConnection( + request?: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConnection(request, options, callback); + } +/** + * Gets details of a single repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Repository to retrieve. + * Format: `projects/* /locations/* /connections/* /repositories/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v2.Repository|Repository}. + * Please see the {@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/repository_manager.get_repository.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_GetRepository_async + */ + getRepository( + request?: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|undefined, {}|undefined + ]>; + getRepository( + request: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): void; + getRepository( + request: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): void; + getRepository( + request?: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getRepository(request, options, callback); + } +/** + * Fetches read/write token of a given repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.repository + * Required. The resource name of the repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse|FetchReadWriteTokenResponse}. + * Please see the {@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/repository_manager.fetch_read_write_token.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async + */ + fetchReadWriteToken( + request?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|undefined, {}|undefined + ]>; + fetchReadWriteToken( + request: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, + {}|null|undefined>): void; + fetchReadWriteToken( + request: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, + {}|null|undefined>): void; + fetchReadWriteToken( + request?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'repository': request.repository ?? '', + }); + this.initialize(); + return this.innerApiCalls.fetchReadWriteToken(request, options, callback); + } +/** + * Fetches read token of a given repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.repository + * Required. The resource name of the repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v2.FetchReadTokenResponse|FetchReadTokenResponse}. + * Please see the {@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/repository_manager.fetch_read_token.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async + */ + fetchReadToken( + request?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|undefined, {}|undefined + ]>; + fetchReadToken( + request: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, + {}|null|undefined>): void; + fetchReadToken( + request: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, + {}|null|undefined>): void; + fetchReadToken( + request?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'repository': request.repository ?? '', + }); + this.initialize(); + return this.innerApiCalls.fetchReadToken(request, options, callback); + } +/** + * Fetch the list of branches or tags for a given repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.repository + * Required. The resource name of the repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + * @param {google.devtools.cloudbuild.v2.FetchGitRefsRequest.RefType} request.refType + * Type of refs to fetch + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v2.FetchGitRefsResponse|FetchGitRefsResponse}. + * Please see the {@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/repository_manager.fetch_git_refs.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async + */ + fetchGitRefs( + request?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|undefined, {}|undefined + ]>; + fetchGitRefs( + request: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, + {}|null|undefined>): void; + fetchGitRefs( + request: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, + {}|null|undefined>): void; + fetchGitRefs( + request?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'repository': request.repository ?? '', + }); + this.initialize(); + return this.innerApiCalls.fetchGitRefs(request, options, callback); + } + +/** + * Creates a Connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location where the connection will be created. + * Format: `projects/* /locations/*`. + * @param {google.devtools.cloudbuild.v2.Connection} request.connection + * Required. The Connection to create. + * @param {string} request.connectionId + * Required. The ID to use for the Connection, which will become the final + * component of the Connection's resource name. Names must be unique + * per-project per-location. Allows alphanumeric characters and any of + * -._~%!$&'()*+,;=@. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/repository_manager.create_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateConnection_async + */ + createConnection( + request?: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createConnection( + request: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnection( + request: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnection( + request?: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/repository_manager.create_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateConnection_async + */ + async checkCreateConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a single connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.cloudbuild.v2.Connection} request.connection + * Required. The Connection to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * @param {boolean} request.allowMissing + * If set to true, and the connection is not found a new connection + * will be created. In this situation `update_mask` is ignored. + * The creation will succeed only if the input connection has all the + * necessary information (e.g a github_config with both user_oauth_token and + * installation_id properties). + * @param {string} request.etag + * The current etag of the connection. + * If an etag is provided and does not match the current etag of the + * connection, update will be blocked 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/v2/repository_manager.update_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async + */ + updateConnection( + request?: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateConnection( + request: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnection( + request: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnection( + request?: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'connection.name': request.connection!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/repository_manager.update_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async + */ + async checkUpdateConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Connection to delete. + * Format: `projects/* /locations/* /connections/*`. + * @param {string} request.etag + * The current etag of the connection. + * If an etag is provided and does not match the current etag of the + * connection, deletion will be blocked and an ABORTED error will be returned. + * @param {boolean} request.validateOnly + * If set, validate the request, but do not actually post it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/repository_manager.delete_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async + */ + deleteConnection( + request?: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteConnection( + request: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnection( + request: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnection( + request?: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/repository_manager.delete_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async + */ + async checkDeleteConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a Repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The connection to contain the repository. If the request is part + * of a BatchCreateRepositoriesRequest, this field should be empty or match + * the parent specified there. + * @param {google.devtools.cloudbuild.v2.Repository} request.repository + * Required. The repository to create. + * @param {string} request.repositoryId + * Required. The ID to use for the repository, which will become the final + * component of the repository's resource name. This ID should be unique in + * the connection. Allows alphanumeric characters and any of + * -._~%!$&'()*+,;=@. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/repository_manager.create_repository.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateRepository_async + */ + createRepository( + request?: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createRepository( + request: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRepository( + request: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRepository( + request?: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createRepository(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createRepository()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/repository_manager.create_repository.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateRepository_async + */ + async checkCreateRepositoryProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRepository, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates multiple repositories inside a connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The connection to contain all the repositories being created. + * Format: projects/* /locations/* /connections/* + * The parent field in the CreateRepositoryRequest messages + * must either be empty or match this field. + * @param {number[]} request.requests + * Required. The request messages specifying the repositories 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/v2/repository_manager.batch_create_repositories.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async + */ + batchCreateRepositories( + request?: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchCreateRepositories( + request: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchCreateRepositories( + request: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchCreateRepositories( + request?: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateRepositories(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchCreateRepositories()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/repository_manager.batch_create_repositories.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async + */ + async checkBatchCreateRepositoriesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchCreateRepositories, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Repository to delete. + * Format: `projects/* /locations/* /connections/* /repositories/*`. + * @param {string} request.etag + * The current etag of the repository. + * If an etag is provided and does not match the current etag of the + * repository, deletion will be blocked and an ABORTED error will be returned. + * @param {boolean} request.validateOnly + * If set, validate the request, but do not actually post it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/repository_manager.delete_repository.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async + */ + deleteRepository( + request?: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteRepository( + request: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRepository( + request: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRepository( + request?: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteRepository(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteRepository()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/repository_manager.delete_repository.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async + */ + async checkDeleteRepositoryProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRepository, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Connections 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 Connections. + * Format: `projects/* /locations/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.cloudbuild.v2.Connection|Connection}. + * 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 `listConnectionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listConnections( + request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IConnection[], + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest|null, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse + ]>; + listConnections( + request: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IConnection>): void; + listConnections( + request: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IConnection>): void; + listConnections( + request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IConnection>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IConnection>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IConnection[], + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest|null, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listConnections(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 Connections. + * Format: `projects/* /locations/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @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.devtools.cloudbuild.v2.Connection|Connection} 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 `listConnectionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listConnectionsStream( + request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + 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['listConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnections.createStream( + this.innerApiCalls.listConnections as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConnections`, 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 Connections. + * Format: `projects/* /locations/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @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.devtools.cloudbuild.v2.Connection|Connection}. 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/repository_manager.list_connections.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_ListConnections_async + */ + listConnectionsAsync( + request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + 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['listConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnections.asyncIterate( + this.innerApiCalls['listConnections'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists Repositories in a given connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of Repositories. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @param {string} request.filter + * A filter expression that filters resources listed in the response. + * Expressions must follow API improvement proposal + * [AIP-160](https://google.aip.dev/160). e.g. + * `remote_uri:"https://github.com*"`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.cloudbuild.v2.Repository|Repository}. + * 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 `listRepositoriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRepositories( + request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository[], + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest|null, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse + ]>; + listRepositories( + request: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): void; + listRepositories( + request: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): void; + listRepositories( + request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository[], + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest|null, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listRepositories(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 Repositories. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @param {string} request.filter + * A filter expression that filters resources listed in the response. + * Expressions must follow API improvement proposal + * [AIP-160](https://google.aip.dev/160). e.g. + * `remote_uri:"https://github.com*"`. + * @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.devtools.cloudbuild.v2.Repository|Repository} 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 `listRepositoriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRepositoriesStream( + request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + 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['listRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRepositories.createStream( + this.innerApiCalls.listRepositories as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listRepositories`, 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 Repositories. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @param {string} request.filter + * A filter expression that filters resources listed in the response. + * Expressions must follow API improvement proposal + * [AIP-160](https://google.aip.dev/160). e.g. + * `remote_uri:"https://github.com*"`. + * @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.devtools.cloudbuild.v2.Repository|Repository}. 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/repository_manager.list_repositories.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_ListRepositories_async + */ + listRepositoriesAsync( + request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + 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['listRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRepositories.asyncIterate( + this.innerApiCalls['listRepositories'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * FetchLinkableRepositories get repositories from SCM that are + * accessible and could be added to the connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.connection + * Required. The name of the Connection. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. Default to 20. + * @param {string} request.pageToken + * Page start. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.cloudbuild.v2.Repository|Repository}. + * 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 `fetchLinkableRepositoriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + fetchLinkableRepositories( + request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository[], + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest|null, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse + ]>; + fetchLinkableRepositories( + request: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): void; + fetchLinkableRepositories( + request: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): void; + fetchLinkableRepositories( + request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository[], + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest|null, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'connection': request.connection ?? '', + }); + this.initialize(); + return this.innerApiCalls.fetchLinkableRepositories(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.connection + * Required. The name of the Connection. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. Default to 20. + * @param {string} request.pageToken + * Page start. + * @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.devtools.cloudbuild.v2.Repository|Repository} 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 `fetchLinkableRepositoriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + fetchLinkableRepositoriesStream( + request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + 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({ + 'connection': request.connection ?? '', + }); + const defaultCallSettings = this._defaults['fetchLinkableRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.fetchLinkableRepositories.createStream( + this.innerApiCalls.fetchLinkableRepositories as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `fetchLinkableRepositories`, 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.connection + * Required. The name of the Connection. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. Default to 20. + * @param {string} request.pageToken + * Page start. + * @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.devtools.cloudbuild.v2.Repository|Repository}. 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/repository_manager.fetch_linkable_repositories.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async + */ + fetchLinkableRepositoriesAsync( + request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + 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({ + 'connection': request.connection ?? '', + }); + const defaultCallSettings = this._defaults['fetchLinkableRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.fetchLinkableRepositories.asyncIterate( + this.innerApiCalls['fetchLinkableRepositories'] 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 connection resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connection + * @returns {string} Resource name string. + */ + connectionPath(project:string,location:string,connection:string) { + return this.pathTemplates.connectionPathTemplate.render({ + project: project, + location: location, + connection: connection, + }); + } + + /** + * Parse the project from Connection resource. + * + * @param {string} connectionName + * A fully-qualified path representing Connection resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectionName(connectionName: string) { + return this.pathTemplates.connectionPathTemplate.match(connectionName).project; + } + + /** + * Parse the location from Connection resource. + * + * @param {string} connectionName + * A fully-qualified path representing Connection resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConnectionName(connectionName: string) { + return this.pathTemplates.connectionPathTemplate.match(connectionName).location; + } + + /** + * Parse the connection from Connection resource. + * + * @param {string} connectionName + * A fully-qualified path representing Connection resource. + * @returns {string} A string representing the connection. + */ + matchConnectionFromConnectionName(connectionName: string) { + return this.pathTemplates.connectionPathTemplate.match(connectionName).connection; + } + + /** + * 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} connection + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project:string,location:string,connection:string,repository:string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + connection: connection, + 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 connection from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the connection. + */ + matchConnectionFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).connection; + } + + /** + * 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 secretVersion resource name string. + * + * @param {string} project + * @param {string} secret + * @param {string} version + * @returns {string} Resource name string. + */ + secretVersionPath(project:string,secret:string,version:string) { + return this.pathTemplates.secretVersionPathTemplate.render({ + project: project, + secret: secret, + version: version, + }); + } + + /** + * Parse the project from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).project; + } + + /** + * Parse the secret from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the secret. + */ + matchSecretFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).secret; + } + + /** + * Parse the version from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the version. + */ + matchVersionFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).version; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} namespace + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,namespace:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + namespace: namespace, + 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 namespace from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the namespace. + */ + matchNamespaceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).namespace; + } + + /** + * 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.repositoryManagerStub && !this._terminated) { + return this.repositoryManagerStub.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-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json new file mode 100644 index 00000000000..6049df136e9 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json @@ -0,0 +1,106 @@ +{ + "interfaces": { + "google.devtools.cloudbuild.v2.RepositoryManager": { + "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": { + "CreateConnection": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetConnection": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListConnections": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateConnection": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteConnection": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateRepository": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchCreateRepositories": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetRepository": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListRepositories": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteRepository": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "FetchReadWriteToken": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "FetchReadToken": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "FetchLinkableRepositories": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "FetchGitRefs": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json new file mode 100644 index 00000000000..12097f770a6 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/devtools/cloudbuild/v2/cloudbuild.proto", + "../../protos/google/devtools/cloudbuild/v2/repositories.proto" +] diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..20dca8dade6 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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 cloudbuild = require('@google-cloud/cloudbuild'); + +function main() { + const repositoryManagerClient = new cloudbuild.RepositoryManagerClient(); +} + +main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..8c673824940 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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 {RepositoryManagerClient} from '@google-cloud/cloudbuild'; + +// check that the client class type name can be used +function doStuffWithRepositoryManagerClient(client: RepositoryManagerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const repositoryManagerClient = new RepositoryManagerClient(); + doStuffWithRepositoryManagerClient(repositoryManagerClient); +} + +main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts new file mode 100644 index 00000000000..da45ca63502 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts @@ -0,0 +1,3384 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 repositorymanagerModule 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.RepositoryManagerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = repositorymanagerModule.v2.RepositoryManagerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = repositorymanagerModule.v2.RepositoryManagerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = repositorymanagerModule.v2.RepositoryManagerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.repositoryManagerStub, undefined); + await client.initialize(); + assert(client.repositoryManagerStub); + }); + + it('has close method for the initialized client', done => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.repositoryManagerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.repositoryManagerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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('getConnection', () => { + it('invokes getConnection without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.Connection() + ); + client.innerApiCalls.getConnection = stubSimpleCall(expectedResponse); + const [response] = await client.getConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnection without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.Connection() + ); + client.innerApiCalls.getConnection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnection( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IConnection|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnection with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnection with closed client', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConnection(request), expectedError); + }); + }); + + describe('getRepository', () => { + it('invokes getRepository without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.Repository() + ); + client.innerApiCalls.getRepository = stubSimpleCall(expectedResponse); + const [response] = await client.getRepository(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.Repository() + ); + client.innerApiCalls.getRepository = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRepository( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRepository = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository with closed client', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getRepository(request), expectedError); + }); + }); + + describe('fetchReadWriteToken', () => { + it('invokes fetchReadWriteToken without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse() + ); + client.innerApiCalls.fetchReadWriteToken = stubSimpleCall(expectedResponse); + const [response] = await client.fetchReadWriteToken(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadWriteToken without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse() + ); + client.innerApiCalls.fetchReadWriteToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchReadWriteToken( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadWriteToken with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchReadWriteToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchReadWriteToken(request), expectedError); + const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadWriteToken with closed client', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchReadWriteToken(request), expectedError); + }); + }); + + describe('fetchReadToken', () => { + it('invokes fetchReadToken without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenResponse() + ); + client.innerApiCalls.fetchReadToken = stubSimpleCall(expectedResponse); + const [response] = await client.fetchReadToken(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadToken without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenResponse() + ); + client.innerApiCalls.fetchReadToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchReadToken( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadToken with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchReadToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchReadToken(request), expectedError); + const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadToken with closed client', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchReadToken(request), expectedError); + }); + }); + + describe('fetchGitRefs', () => { + it('invokes fetchGitRefs without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsResponse() + ); + client.innerApiCalls.fetchGitRefs = stubSimpleCall(expectedResponse); + const [response] = await client.fetchGitRefs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchGitRefs without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsResponse() + ); + client.innerApiCalls.fetchGitRefs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchGitRefs( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchGitRefs with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchGitRefs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchGitRefs(request), expectedError); + const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchGitRefs with closed client', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); + request.repository = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchGitRefs(request), expectedError); + }); + }); + + describe('createConnection', () => { + it('invokes createConnection without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.createConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnection without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConnection( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnection with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnection with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConnectionProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConnectionProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateConnection', () => { + it('invokes updateConnection without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() + ); + request.connection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); + request.connection.name = defaultValue1; + const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnection without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() + ); + request.connection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); + request.connection.name = defaultValue1; + const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateConnection( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnection with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() + ); + request.connection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); + request.connection.name = defaultValue1; + const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnection with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() + ); + request.connection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); + request.connection.name = defaultValue1; + const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateConnectionProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateConnectionProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteConnection', () => { + it('invokes deleteConnection without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnection without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConnection( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnection with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnection with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteConnectionProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteConnectionProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createRepository', () => { + it('invokes createRepository without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRepository = stubLongRunningCall(expectedResponse); + const [operation] = await client.createRepository(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRepository = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createRepository( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRepository = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRepository = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createRepository(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateRepositoryProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateRepositoryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateRepositoryProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateRepositoryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchCreateRepositories', () => { + it('invokes batchCreateRepositories without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchCreateRepositories(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateRepositories without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchCreateRepositories = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateRepositories( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateRepositories with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchCreateRepositories(request), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateRepositories with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchCreateRepositories(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchCreateRepositoriesProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchCreateRepositoriesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchCreateRepositoriesProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchCreateRepositoriesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteRepository', () => { + it('invokes deleteRepository without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRepository = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteRepository(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRepository = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteRepository( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteRepository(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteRepositoryProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteRepositoryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteRepositoryProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteRepositoryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listConnections', () => { + it('invokes listConnections without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + ]; + client.innerApiCalls.listConnections = stubSimpleCall(expectedResponse); + const [response] = await client.listConnections(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnections without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + ]; + client.innerApiCalls.listConnections = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConnections( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IConnection[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnections with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConnections = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConnections(request), expectedError); + const actualRequest = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectionsStream without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + ]; + client.descriptors.page.listConnections.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Connection[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Connection) => { + 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.listConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnections, request)); + assert( + (client.descriptors.page.listConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConnectionsStream with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnections.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Connection[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Connection) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnections, request)); + assert( + (client.descriptors.page.listConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnections without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + ]; + client.descriptors.page.listConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v2.IConnection[] = []; + const iterable = client.listConnectionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnections with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConnectionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v2.IConnection[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRepositories', () => { + it('invokes listRepositories without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.innerApiCalls.listRepositories = stubSimpleCall(expectedResponse); + const [response] = await client.listRepositories(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositories without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.innerApiCalls.listRepositories = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRepositories( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositories with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRepositories = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRepositories(request), expectedError); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositoriesStream without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { + 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.listRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); + assert( + (client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRepositoriesStream with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); + assert( + (client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRepositories without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; + const iterable = client.listRepositoriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRepositories with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRepositoriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('fetchLinkableRepositories', () => { + it('invokes fetchLinkableRepositories without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.innerApiCalls.fetchLinkableRepositories = stubSimpleCall(expectedResponse); + const [response] = await client.fetchLinkableRepositories(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchLinkableRepositories without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.innerApiCalls.fetchLinkableRepositories = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchLinkableRepositories( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchLinkableRepositories with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchLinkableRepositories = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchLinkableRepositories(request), expectedError); + const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchLinkableRepositoriesStream without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.descriptors.page.fetchLinkableRepositories.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.fetchLinkableRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { + 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.fetchLinkableRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.fetchLinkableRepositories, request)); + assert( + (client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes fetchLinkableRepositoriesStream with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchLinkableRepositories.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.fetchLinkableRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.fetchLinkableRepositories, request)); + assert( + (client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with fetchLinkableRepositories without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.descriptors.page.fetchLinkableRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; + const iterable = client.fetchLinkableRepositoriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with fetchLinkableRepositories with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchLinkableRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.fetchLinkableRepositoriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.fetchLinkableRepositories.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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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('connection', () => { + const fakePath = "/rendered/path/connection"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + connection: "connectionValue", + }; + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.connectionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('connectionPath', () => { + const result = client.connectionPath("projectValue", "locationValue", "connectionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.connectionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConnectionName', () => { + const result = client.matchProjectFromConnectionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConnectionName', () => { + const result = client.matchLocationFromConnectionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConnectionFromConnectionName', () => { + const result = client.matchConnectionFromConnectionName(fakePath); + assert.strictEqual(result, "connectionValue"); + assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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", + connection: "connectionValue", + repository: "repositoryValue", + }; + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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", "connectionValue", "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('matchConnectionFromRepositoryName', () => { + const result = client.matchConnectionFromRepositoryName(fakePath); + assert.strictEqual(result, "connectionValue"); + 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('secretVersion', () => { + const fakePath = "/rendered/path/secretVersion"; + const expectedParameters = { + project: "projectValue", + secret: "secretValue", + version: "versionValue", + }; + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.secretVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.secretVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('secretVersionPath', () => { + const result = client.secretVersionPath("projectValue", "secretValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.secretVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSecretVersionName', () => { + const result = client.matchProjectFromSecretVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSecretFromSecretVersionName', () => { + const result = client.matchSecretFromSecretVersionName(fakePath); + assert.strictEqual(result, "secretValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromSecretVersionName', () => { + const result = client.matchVersionFromSecretVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + namespace: "namespaceValue", + service: "serviceValue", + }; + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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", "namespaceValue", "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('matchNamespaceFromServiceName', () => { + const result = client.matchNamespaceFromServiceName(fakePath); + assert.strictEqual(result, "namespaceValue"); + 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-devtools-cloudbuild/v2/tsconfig.json b/owl-bot-staging/google-devtools-cloudbuild/v2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v2/webpack.config.js b/owl-bot-staging/google-devtools-cloudbuild/v2/webpack.config.js new file mode 100644 index 00000000000..0c12d4dc6a9 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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: 'RepositoryManager', + filename: './repository-manager.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-devtools-containeranalysis/v1/.eslintignore b/owl-bot-staging/google-devtools-containeranalysis/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/.eslintrc.json b/owl-bot-staging/google-devtools-containeranalysis/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/.gitignore b/owl-bot-staging/google-devtools-containeranalysis/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1/.jsdoc.js b/owl-bot-staging/google-devtools-containeranalysis/v1/.jsdoc.js new file mode 100644 index 00000000000..bc16644d92f --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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/containeranalysis', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/.mocharc.js b/owl-bot-staging/google-devtools-containeranalysis/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1/.prettierrc.js b/owl-bot-staging/google-devtools-containeranalysis/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1/README.md b/owl-bot-staging/google-devtools-containeranalysis/v1/README.md new file mode 100644 index 00000000000..dc843b72155 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/README.md @@ -0,0 +1 @@ +Containeranalysis: Nodejs Client diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/package.json b/owl-bot-staging/google-devtools-containeranalysis/v1/package.json new file mode 100644 index 00000000000..da07327d309 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/package.json @@ -0,0 +1,59 @@ +{ + "name": "@google-cloud/containeranalysis", + "version": "0.1.0", + "description": "Containeranalysis client for Node.js", + "repository": "googleapis/nodejs-containeranalysis", + "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 containeranalysis", + "containeranalysis", + "container analysis", + "grafeas" + ], + "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-devtools-containeranalysis/v1/protos/google/devtools/containeranalysis/v1/containeranalysis.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/google/devtools/containeranalysis/v1/containeranalysis.proto new file mode 100644 index 00000000000..c1bda557cd6 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/google/devtools/containeranalysis/v1/containeranalysis.proto @@ -0,0 +1,156 @@ +// 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.devtools.containeranalysis.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 "grafeas/v1/severity.proto"; + +option csharp_namespace = "Google.Cloud.DevTools.ContainerAnalysis.V1"; +option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis"; +option java_multiple_files = true; +option java_package = "com.google.containeranalysis.v1"; +option objc_class_prefix = "GCA"; +option ruby_package = "Google::Cloud::ContainerAnalysis::V1"; +option php_namespace = "Google\\Cloud\\ContainerAnalysis\\V1"; + +// Retrieves analysis results of Cloud components such as Docker container +// images. The Container Analysis API is an implementation of the +// [Grafeas](https://grafeas.io) API. +// +// Analysis results are stored as a series of occurrences. An `Occurrence` +// contains information about a specific analysis instance on a resource. An +// occurrence refers to a `Note`. A note contains details describing the +// analysis and is generally stored in a separate project, called a `Provider`. +// Multiple occurrences can refer to the same note. +// +// For example, an SSL vulnerability could affect multiple images. In this case, +// there would be one note for the vulnerability and an occurrence for each +// image with the vulnerability referring to that note. +service ContainerAnalysis { + option (google.api.default_host) = "containeranalysis.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Sets the access control policy on the specified note or occurrence. + // Requires `containeranalysis.notes.setIamPolicy` or + // `containeranalysis.occurrences.setIamPolicy` permission if the resource is + // a note or an occurrence, respectively. + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/notes/*}:setIamPolicy" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/occurrences/*}:setIamPolicy" + body: "*" + } + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Gets the access control policy for a note or an occurrence resource. + // Requires `containeranalysis.notes.setIamPolicy` or + // `containeranalysis.occurrences.setIamPolicy` permission if the resource is + // a note or occurrence, respectively. + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/notes/*}:getIamPolicy" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/occurrences/*}:getIamPolicy" + body: "*" + } + }; + option (google.api.method_signature) = "resource"; + } + + // Returns the permissions that a caller has on the specified note or + // occurrence. Requires list permission on the project (for example, + // `containeranalysis.notes.list`). + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/notes/*}:testIamPermissions" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/occurrences/*}:testIamPermissions" + body: "*" + } + }; + option (google.api.method_signature) = "resource,permissions"; + } + + // Gets a summary of the number and severity of occurrences. + rpc GetVulnerabilityOccurrencesSummary(GetVulnerabilityOccurrencesSummaryRequest) returns (VulnerabilityOccurrencesSummary) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/occurrences:vulnerabilitySummary" + }; + option (google.api.method_signature) = "parent,filter"; + } +} + +// Request to get a vulnerability summary for some set of occurrences. +message GetVulnerabilityOccurrencesSummaryRequest { + // Required. The name of the project to get a vulnerability summary for in the form of + // `projects/[PROJECT_ID]`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // The filter expression. + string filter = 2; +} + +// A summary of how many vulnerability occurrences there are per resource and +// severity type. +message VulnerabilityOccurrencesSummary { + // Per resource and severity counts of fixable and total vulnerabilities. + message FixableTotalByDigest { + // The affected resource. + string resource_uri = 1; + + // The severity for this count. SEVERITY_UNSPECIFIED indicates total across + // all severities. + grafeas.v1.Severity severity = 2; + + // The number of fixable vulnerabilities associated with this resource. + int64 fixable_count = 3; + + // The total number of vulnerabilities associated with this resource. + int64 total_count = 4; + } + + // A listing by resource of the number of fixable and total vulnerabilities. + repeated FixableTotalByDigest counts = 1; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/attestation.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/attestation.proto new file mode 100644 index 00000000000..f2854fe686b --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/attestation.proto @@ -0,0 +1,90 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "grafeas/v1/common.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// An attestation wrapper with a PGP-compatible signature. This message only +// supports `ATTACHED` signatures, where the payload that is signed is included +// alongside the signature itself in the same file. + +// Note kind that represents a logical attestation "role" or "authority". For +// example, an organization might have one `Authority` for "QA" and one for +// "build". This note is intended to act strictly as a grouping mechanism for +// the attached occurrences (Attestations). This grouping mechanism also +// provides a security boundary, since IAM ACLs gate the ability for a principle +// to attach an occurrence to a given note. It also provides a single point of +// lookup to find all attached attestation occurrences, even if they don't all +// live in the same project. +message AttestationNote { + // This submessage provides human-readable hints about the purpose of the + // authority. Because the name of a note acts as its resource reference, it is + // important to disambiguate the canonical name of the Note (which might be a + // UUID for security purposes) from "readable" names more suitable for debug + // output. Note that these hints should not be used to look up authorities in + // security sensitive contexts, such as when looking up attestations to + // verify. + message Hint { + // Required. The human readable name of this attestation authority, for + // example "qa". + string human_readable_name = 1; + } + + // Hint hints at the purpose of the attestation authority. + Hint hint = 1; +} + +message Jwt { + // The compact encoding of a JWS, which is always three base64 encoded strings + // joined by periods. For details, see: + // https://tools.ietf.org/html/rfc7515.html#section-3.1 + string compact_jwt = 1; +} + +// Occurrence that represents a single "attestation". The authenticity of an +// attestation can be verified using the attached signature. If the verifier +// trusts the public key of the signer, then verifying the signature is +// sufficient to establish trust. In this circumstance, the authority to which +// this attestation is attached is primarily useful for lookup (how to find +// this attestation if you already know the authority and artifact to be +// verified) and intent (for which authority this attestation was intended to +// sign. +message AttestationOccurrence { + // Required. The serialized payload that is verified by one or more + // `signatures`. + bytes serialized_payload = 1; + // One or more signatures over `serialized_payload`. Verifier implementations + // should consider this attestation message verified if at least one + // `signature` verifies `serialized_payload`. See `Signature` in common.proto + // for more details on signature structure and verification. + repeated Signature signatures = 2; + // One or more JWTs encoding a self-contained attestation. + // Each JWT encodes the payload that it verifies within the JWT itself. + // Verifier implementation SHOULD ignore the `serialized_payload` field + // when verifying these JWTs. + // If only JWTs are present on this AttestationOccurrence, then the + // `serialized_payload` SHOULD be left empty. + // Each JWT SHOULD encode a claim specific to the `resource_uri` of this + // Occurrence, but this is not validated by Grafeas metadata API + // implementations. The JWT itself is opaque to Grafeas. + repeated Jwt jwts = 3; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/build.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/build.proto new file mode 100644 index 00000000000..172637fd459 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/build.proto @@ -0,0 +1,62 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "grafeas/v1/intoto_provenance.proto"; +import "grafeas/v1/intoto_statement.proto"; +import "grafeas/v1/provenance.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Note holding the version of the provider's builder and the signature of the +// provenance message in the build details occurrence. +message BuildNote { + // Required. Immutable. Version of the builder which produced this build. + string builder_version = 1; +} + +// Details of a build occurrence. +message BuildOccurrence { + // The actual provenance for the build. + grafeas.v1.BuildProvenance provenance = 1; + + // Serialized JSON representation of the provenance, used in generating the + // build signature in the corresponding build note. After verifying the + // signature, `provenance_bytes` can be unmarshalled and compared to the + // provenance to confirm that it is unchanged. A base64-encoded string + // representation of the provenance bytes is used for the signature in order + // to interoperate with openssl which expects this format for signature + // verification. + // + // The serialized form is captured both to avoid ambiguity in how the + // provenance is marshalled to json as well to prevent incompatibilities with + // future changes. + string provenance_bytes = 2; + + // Deprecated. See InTotoStatement for the replacement. + // In-toto Provenance representation as defined in spec. + InTotoProvenance intoto_provenance = 3; + + // In-toto Statement representation as defined in spec. + // The intoto_statement can contain any type of provenance. The serialized + // payload of the statement can be stored and signed in the Occurrence's + // envelope. + InTotoStatement intoto_statement = 4; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/common.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/common.proto new file mode 100644 index 00000000000..1464ecc9be2 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/common.proto @@ -0,0 +1,152 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Kind represents the kinds of notes supported. +enum NoteKind { + // Default value. This value is unused. + NOTE_KIND_UNSPECIFIED = 0; + // The note and occurrence represent a package vulnerability. + VULNERABILITY = 1; + // The note and occurrence assert build provenance. + BUILD = 2; + // This represents an image basis relationship. + IMAGE = 3; + // This represents a package installed via a package manager. + PACKAGE = 4; + // The note and occurrence track deployment events. + DEPLOYMENT = 5; + // The note and occurrence track the initial discovery status of a resource. + DISCOVERY = 6; + // This represents a logical "role" that can attest to artifacts. + ATTESTATION = 7; + // This represents an available package upgrade. + UPGRADE = 8; + // This represents a Compliance Note + COMPLIANCE = 9; + // This represents a DSSE attestation Note + DSSE_ATTESTATION = 10; + // This represents a Vulnerability Assessment. + VULNERABILITY_ASSESSMENT = 11; +} + +// Metadata for any related URL information. +message RelatedUrl { + // Specific URL associated with the resource. + string url = 1; + // Label to describe usage of the URL. + string label = 2; +} + +// Verifiers (e.g. Kritis implementations) MUST verify signatures +// with respect to the trust anchors defined in policy (e.g. a Kritis policy). +// Typically this means that the verifier has been configured with a map from +// `public_key_id` to public key material (and any required parameters, e.g. +// signing algorithm). +// +// In particular, verification implementations MUST NOT treat the signature +// `public_key_id` as anything more than a key lookup hint. The `public_key_id` +// DOES NOT validate or authenticate a public key; it only provides a mechanism +// for quickly selecting a public key ALREADY CONFIGURED on the verifier through +// a trusted channel. Verification implementations MUST reject signatures in any +// of the following circumstances: +// * The `public_key_id` is not recognized by the verifier. +// * The public key that `public_key_id` refers to does not verify the +// signature with respect to the payload. +// +// The `signature` contents SHOULD NOT be "attached" (where the payload is +// included with the serialized `signature` bytes). Verifiers MUST ignore any +// "attached" payload and only verify signatures with respect to explicitly +// provided payload (e.g. a `payload` field on the proto message that holds +// this Signature, or the canonical serialization of the proto message that +// holds this signature). +message Signature { + // The content of the signature, an opaque bytestring. + // The payload that this signature verifies MUST be unambiguously provided + // with the Signature during verification. A wrapper message might provide + // the payload explicitly. Alternatively, a message might have a canonical + // serialization that can always be unambiguously computed to derive the + // payload. + bytes signature = 1; + + // The identifier for the public key that verifies this signature. + // * The `public_key_id` is required. + // * The `public_key_id` SHOULD be an RFC3986 conformant URI. + // * When possible, the `public_key_id` SHOULD be an immutable reference, + // such as a cryptographic digest. + // + // Examples of valid `public_key_id`s: + // + // OpenPGP V4 public key fingerprint: + // * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" + // See https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr for more + // details on this scheme. + // + // RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER + // serialization): + // * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU" + // * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5" + string public_key_id = 2; +} + +// MUST match +// https://github.com/secure-systems-lab/dsse/blob/master/envelope.proto. An +// authenticated message of arbitrary type. +message Envelope { + bytes payload = 1; + string payload_type = 2; + repeated EnvelopeSignature signatures = 3; +} + +message EnvelopeSignature { + bytes sig = 1; + string keyid = 2; +} + +// Indicates the location at which a package was found. +message FileLocation { + // For jars that are contained inside .war files, this filepath + // can indicate the path to war file combined with the path to jar file. + string file_path = 1; +} + +// License information. +message License { + // Often a single license can be used to represent the licensing terms. + // Sometimes it is necessary to include a choice of one or more licenses + // or some combination of license identifiers. + // Examples: "LGPL-2.1-only OR MIT", "LGPL-2.1-only AND MIT", + // "GPL-2.0-or-later WITH Bison-exception-2.2". + string expression = 1; + + // Comments + string comments = 2; +} + +// Digest information. +message Digest { + // `SHA1`, `SHA512` etc. + string algo = 1; + + // Value of the digest. + bytes digest_bytes = 2; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/compliance.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/compliance.proto new file mode 100644 index 00000000000..688fa82596b --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/compliance.proto @@ -0,0 +1,82 @@ +// Copyright 2021 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "grafeas/v1/severity.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +message ComplianceNote { + // The title that identifies this compliance check. + string title = 1; + // A description about this compliance check. + string description = 2; + // The OS and config versions the benchmark applies to. + repeated grafeas.v1.ComplianceVersion version = 3; + // A rationale for the existence of this compliance check. + string rationale = 4; + // A description of remediation steps if the compliance check fails. + string remediation = 5; + // A compliance check that is a CIS benchmark. + message CisBenchmark { + int32 profile_level = 1; + grafeas.v1.Severity severity = 2; + } + oneof compliance_type { + CisBenchmark cis_benchmark = 6; + } + // Serialized scan instructions with a predefined format. + bytes scan_instructions = 7; +} + +// Describes the CIS benchmark version that is applicable to a given OS and +// os version. +message ComplianceVersion { + // The CPE URI (https://cpe.mitre.org/specification/) this benchmark is + // applicable to. + string cpe_uri = 1; + // The name of the document that defines this benchmark, e.g. "CIS + // Container-Optimized OS". + string benchmark_document = 3; + // The version of the benchmark. This is set to the version of the OS-specific + // CIS document the benchmark is defined in. + string version = 2; +} + +// An indication that the compliance checks in the associated ComplianceNote +// were not satisfied for particular resources or a specified reason. +message ComplianceOccurrence { + repeated NonCompliantFile non_compliant_files = 2; + string non_compliance_reason = 3; +} + +// Details about files that caused a compliance check to fail. +message NonCompliantFile { + // display_command is a single command that can be used to display a list of + // non compliant files. When there is no such command, we can also iterate a + // list of non compliant file using 'path'. + + // Empty if `display_command` is set. + string path = 1; + // Command to display the non-compliant files. + string display_command = 2; + // Explains why a file is non compliant for a CIS check. + string reason = 3; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/cvss.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/cvss.proto new file mode 100644 index 00000000000..a9d018eee6d --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/cvss.proto @@ -0,0 +1,169 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; +option java_outer_classname = "CVSSProto"; + +// Common Vulnerability Scoring System version 3. +// For details, see https://www.first.org/cvss/specification-document +message CVSSv3 { + // The base score is a function of the base metric scores. + float base_score = 1; + + float exploitability_score = 2; + + float impact_score = 3; + + // Base Metrics + // Represents the intrinsic characteristics of a vulnerability that are + // constant over time and across user environments. + AttackVector attack_vector = 5; + AttackComplexity attack_complexity = 6; + PrivilegesRequired privileges_required = 7; + UserInteraction user_interaction = 8; + Scope scope = 9; + Impact confidentiality_impact = 10; + Impact integrity_impact = 11; + Impact availability_impact = 12; + + enum AttackVector { + ATTACK_VECTOR_UNSPECIFIED = 0; + ATTACK_VECTOR_NETWORK = 1; + ATTACK_VECTOR_ADJACENT = 2; + ATTACK_VECTOR_LOCAL = 3; + ATTACK_VECTOR_PHYSICAL = 4; + } + + enum AttackComplexity { + ATTACK_COMPLEXITY_UNSPECIFIED = 0; + ATTACK_COMPLEXITY_LOW = 1; + ATTACK_COMPLEXITY_HIGH = 2; + } + + enum PrivilegesRequired { + PRIVILEGES_REQUIRED_UNSPECIFIED = 0; + PRIVILEGES_REQUIRED_NONE = 1; + PRIVILEGES_REQUIRED_LOW = 2; + PRIVILEGES_REQUIRED_HIGH = 3; + } + + enum UserInteraction { + USER_INTERACTION_UNSPECIFIED = 0; + USER_INTERACTION_NONE = 1; + USER_INTERACTION_REQUIRED = 2; + } + + enum Scope { + SCOPE_UNSPECIFIED = 0; + SCOPE_UNCHANGED = 1; + SCOPE_CHANGED = 2; + } + + enum Impact { + IMPACT_UNSPECIFIED = 0; + IMPACT_HIGH = 1; + IMPACT_LOW = 2; + IMPACT_NONE = 3; + } +} + +// Common Vulnerability Scoring System. +// For details, see https://www.first.org/cvss/specification-document +// This is a message we will try to use for storing various versions of CVSS +// rather than making a separate proto for storing a specific version. +message CVSS { + // The base score is a function of the base metric scores. + float base_score = 1; + + float exploitability_score = 2; + + float impact_score = 3; + + // Base Metrics + // Represents the intrinsic characteristics of a vulnerability that are + // constant over time and across user environments. + AttackVector attack_vector = 4; + AttackComplexity attack_complexity = 5; + Authentication authentication = 6; + PrivilegesRequired privileges_required = 7; + UserInteraction user_interaction = 8; + Scope scope = 9; + Impact confidentiality_impact = 10; + Impact integrity_impact = 11; + Impact availability_impact = 12; + + enum AttackVector { + ATTACK_VECTOR_UNSPECIFIED = 0; + ATTACK_VECTOR_NETWORK = 1; + ATTACK_VECTOR_ADJACENT = 2; + ATTACK_VECTOR_LOCAL = 3; + ATTACK_VECTOR_PHYSICAL = 4; + } + + enum AttackComplexity { + ATTACK_COMPLEXITY_UNSPECIFIED = 0; + ATTACK_COMPLEXITY_LOW = 1; + ATTACK_COMPLEXITY_HIGH = 2; + ATTACK_COMPLEXITY_MEDIUM = 3; + } + + enum Authentication { + AUTHENTICATION_UNSPECIFIED = 0; + AUTHENTICATION_MULTIPLE = 1; + AUTHENTICATION_SINGLE = 2; + AUTHENTICATION_NONE = 3; + } + + enum PrivilegesRequired { + PRIVILEGES_REQUIRED_UNSPECIFIED = 0; + PRIVILEGES_REQUIRED_NONE = 1; + PRIVILEGES_REQUIRED_LOW = 2; + PRIVILEGES_REQUIRED_HIGH = 3; + } + + enum UserInteraction { + USER_INTERACTION_UNSPECIFIED = 0; + USER_INTERACTION_NONE = 1; + USER_INTERACTION_REQUIRED = 2; + } + + enum Scope { + SCOPE_UNSPECIFIED = 0; + SCOPE_UNCHANGED = 1; + SCOPE_CHANGED = 2; + } + + enum Impact { + IMPACT_UNSPECIFIED = 0; + IMPACT_HIGH = 1; + IMPACT_LOW = 2; + IMPACT_NONE = 3; + IMPACT_PARTIAL = 4; + IMPACT_COMPLETE = 5; + } +} + +// CVSS Version. +enum CVSSVersion { + CVSS_VERSION_UNSPECIFIED = 0; + CVSS_VERSION_2 = 1; + CVSS_VERSION_3 = 2; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/deployment.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/deployment.proto new file mode 100644 index 00000000000..5204004fd64 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/deployment.proto @@ -0,0 +1,66 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// An artifact that can be deployed in some runtime. +message DeploymentNote { + // Required. Resource URI for the artifact being deployed. + repeated string resource_uri = 1; +} + +// The period during which some deployable was active in a runtime. +message DeploymentOccurrence { + // Identity of the user that triggered this deployment. + string user_email = 1; + + // Required. Beginning of the lifetime of this deployment. + google.protobuf.Timestamp deploy_time = 2; + + // End of the lifetime of this deployment. + google.protobuf.Timestamp undeploy_time = 3; + + // Configuration used to create this deployment. + string config = 4; + + // Address of the runtime element hosting this deployment. + string address = 5; + + // Output only. Resource URI for the artifact being deployed taken from + // the deployable field with the same name. + repeated string resource_uri = 6; + + // Types of platforms. + enum Platform { + // Unknown. + PLATFORM_UNSPECIFIED = 0; + // Google Container Engine. + GKE = 1; + // Google App Engine: Flexible Environment. + FLEX = 2; + // Custom user-defined platform. + CUSTOM = 3; + } + // Platform hosting this deployment. + Platform platform = 7; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/discovery.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/discovery.proto new file mode 100644 index 00000000000..bfb94e4a347 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/discovery.proto @@ -0,0 +1,104 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "grafeas/v1/common.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// A note that indicates a type of analysis a provider would perform. This note +// exists in a provider's project. A `Discovery` occurrence is created in a +// consumer's project at the start of analysis. +message DiscoveryNote { + // Required. Immutable. The kind of analysis that is handled by this + // discovery. + grafeas.v1.NoteKind analysis_kind = 1; +} + +// Provides information about the analysis status of a discovered resource. +message DiscoveryOccurrence { + // Whether the resource is continuously analyzed. + enum ContinuousAnalysis { + // Unknown. + CONTINUOUS_ANALYSIS_UNSPECIFIED = 0; + // The resource is continuously analyzed. + ACTIVE = 1; + // The resource is ignored for continuous analysis. + INACTIVE = 2; + } + + // Whether the resource is continuously analyzed. + ContinuousAnalysis continuous_analysis = 1; + + // Analysis status for a resource. Currently for initial analysis only (not + // updated in continuous analysis). + enum AnalysisStatus { + option allow_alias = true; + + // Unknown. + ANALYSIS_STATUS_UNSPECIFIED = 0; + // Resource is known but no action has been taken yet. + PENDING = 1; + // Resource is being analyzed. + SCANNING = 2; + // Analysis has finished successfully. + FINISHED_SUCCESS = 3; + // Analysis has completed. + COMPLETE = 3; + // Analysis has finished unsuccessfully, the analysis itself is in a bad + // state. + FINISHED_FAILED = 4; + // The resource is known not to be supported. + FINISHED_UNSUPPORTED = 5; + } + + // The status of discovery for the resource. + AnalysisStatus analysis_status = 2; + + // Indicates which analysis completed successfully. Multiple types of + // analysis can be performed on a single resource. + message AnalysisCompleted { + repeated string analysis_type = 1; + } + + AnalysisCompleted analysis_completed = 7; + + // Indicates any errors encountered during analysis of a resource. There + // could be 0 or more of these errors. + repeated google.rpc.Status analysis_error = 8; + + // When an error is encountered this will contain a LocalizedMessage under + // details to show to the user. The LocalizedMessage is output only and + // populated by the API. + google.rpc.Status analysis_status_error = 3; + + // The CPE of the resource being scanned. + string cpe = 4; + + // The last time this resource was scanned. + google.protobuf.Timestamp last_scan_time = 5; + + // The time occurrences related to this discovery occurrence were archived. + google.protobuf.Timestamp archive_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/dsse_attestation.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/dsse_attestation.proto new file mode 100644 index 00000000000..34ba3df9f9b --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/dsse_attestation.proto @@ -0,0 +1,52 @@ +// Copyright 2021 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "grafeas/v1/common.proto"; +import "grafeas/v1/intoto_statement.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +message DSSEAttestationNote { + // This submessage provides human-readable hints about the purpose of the + // authority. Because the name of a note acts as its resource reference, it is + // important to disambiguate the canonical name of the Note (which might be a + // UUID for security purposes) from "readable" names more suitable for debug + // output. Note that these hints should not be used to look up authorities in + // security sensitive contexts, such as when looking up attestations to + // verify. + message DSSEHint { + // Required. The human readable name of this attestation authority, for + // example "cloudbuild-prod". + string human_readable_name = 1; + } + // DSSEHint hints at the purpose of the attestation authority. + DSSEHint hint = 1; +} + +// Deprecated. Prefer to use a regular Occurrence, and populate the +// Envelope at the top level of the Occurrence. +message DSSEAttestationOccurrence { + // If doing something security critical, make sure to verify the signatures in + // this metadata. + Envelope envelope = 1; + oneof decoded_payload { + InTotoStatement statement = 2; + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/grafeas.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/grafeas.proto new file mode 100644 index 00000000000..5ec930e6ef3 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/grafeas.proto @@ -0,0 +1,547 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.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/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "grafeas/v1/attestation.proto"; +import "grafeas/v1/build.proto"; +import "grafeas/v1/common.proto"; +import "grafeas/v1/compliance.proto"; +import "grafeas/v1/deployment.proto"; +import "grafeas/v1/discovery.proto"; +import "grafeas/v1/dsse_attestation.proto"; +import "grafeas/v1/image.proto"; +import "grafeas/v1/package.proto"; +import "grafeas/v1/upgrade.proto"; +import "grafeas/v1/vex.proto"; +import "grafeas/v1/vulnerability.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; +option (google.api.resource_definition) = { + type: "grafeas.io/Project" + pattern: "projects/{project}" +}; + +// [Grafeas](https://grafeas.io) API. +// +// Retrieves analysis results of Cloud components such as Docker container +// images. +// +// Analysis results are stored as a series of occurrences. An `Occurrence` +// contains information about a specific analysis instance on a resource. An +// occurrence refers to a `Note`. A note contains details describing the +// analysis and is generally stored in a separate project, called a `Provider`. +// Multiple occurrences can refer to the same note. +// +// For example, an SSL vulnerability could affect multiple images. In this case, +// there would be one note for the vulnerability and an occurrence for each +// image with the vulnerability referring to that note. +service Grafeas { + option (google.api.default_host) = "containeranalysis.googleapis.com"; + + // Gets the specified occurrence. + rpc GetOccurrence(GetOccurrenceRequest) returns (Occurrence) { + option (google.api.http) = { + get: "/v1/{name=projects/*/occurrences/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists occurrences for the specified project. + rpc ListOccurrences(ListOccurrencesRequest) + returns (ListOccurrencesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/occurrences" + }; + option (google.api.method_signature) = "parent,filter"; + } + + // Deletes the specified occurrence. For example, use this method to delete an + // occurrence when the occurrence is no longer applicable for the given + // resource. + rpc DeleteOccurrence(DeleteOccurrenceRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/occurrences/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new occurrence. + rpc CreateOccurrence(CreateOccurrenceRequest) returns (Occurrence) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/occurrences" + body: "occurrence" + }; + option (google.api.method_signature) = "parent,occurrence"; + } + + // Creates new occurrences in batch. + rpc BatchCreateOccurrences(BatchCreateOccurrencesRequest) + returns (BatchCreateOccurrencesResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/occurrences:batchCreate" + body: "*" + }; + option (google.api.method_signature) = "parent,occurrences"; + } + + // Updates the specified occurrence. + rpc UpdateOccurrence(UpdateOccurrenceRequest) returns (Occurrence) { + option (google.api.http) = { + patch: "/v1/{name=projects/*/occurrences/*}" + body: "occurrence" + }; + option (google.api.method_signature) = "name,occurrence,update_mask"; + } + + // Gets the note attached to the specified occurrence. Consumer projects can + // use this method to get a note that belongs to a provider project. + rpc GetOccurrenceNote(GetOccurrenceNoteRequest) returns (Note) { + option (google.api.http) = { + get: "/v1/{name=projects/*/occurrences/*}/notes" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the specified note. + rpc GetNote(GetNoteRequest) returns (Note) { + option (google.api.http) = { + get: "/v1/{name=projects/*/notes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists notes for the specified project. + rpc ListNotes(ListNotesRequest) returns (ListNotesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/notes" + }; + option (google.api.method_signature) = "parent,filter"; + } + + // Deletes the specified note. + rpc DeleteNote(DeleteNoteRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/notes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new note. + rpc CreateNote(CreateNoteRequest) returns (Note) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/notes" + body: "note" + }; + option (google.api.method_signature) = "parent,note_id,note"; + } + + // Creates new notes in batch. + rpc BatchCreateNotes(BatchCreateNotesRequest) + returns (BatchCreateNotesResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/notes:batchCreate" + body: "*" + }; + option (google.api.method_signature) = "parent,notes"; + } + + // Updates the specified note. + rpc UpdateNote(UpdateNoteRequest) returns (Note) { + option (google.api.http) = { + patch: "/v1/{name=projects/*/notes/*}" + body: "note" + }; + option (google.api.method_signature) = "name,note,update_mask"; + } + + // Lists occurrences referencing the specified note. Provider projects can use + // this method to get all occurrences across consumer projects referencing the + // specified note. + rpc ListNoteOccurrences(ListNoteOccurrencesRequest) + returns (ListNoteOccurrencesResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/notes/*}/occurrences" + }; + option (google.api.method_signature) = "name,filter"; + } +} + +// An instance of an analysis type that has been found on a resource. +message Occurrence { + option (google.api.resource) = { + type: "grafeas.io/Occurrence" + pattern: "projects/{project}/occurrences/{occurrence}" + }; + + // Output only. The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1; + + // Required. Immutable. A URI that represents the resource for which the + // occurrence applies. For example, + // `https://gcr.io/project/image@sha256:123abc` for a Docker image. + string resource_uri = 2; + + // Required. Immutable. The analysis note associated with this occurrence, in + // the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be + // used as a filter in list requests. + string note_name = 3; + + // Output only. This explicitly denotes which of the occurrence details are + // specified. This field can be used as a filter in list requests. + grafeas.v1.NoteKind kind = 4; + + // A description of actions that can be taken to remedy the note. + string remediation = 5; + + // Output only. The time this occurrence was created. + google.protobuf.Timestamp create_time = 6; + + // Output only. The time this occurrence was last updated. + google.protobuf.Timestamp update_time = 7; + + // Required. Immutable. Describes the details of the note kind found on this + // resource. + oneof details { + // Describes a security vulnerability. + grafeas.v1.VulnerabilityOccurrence vulnerability = 8; + // Describes a verifiable build. + grafeas.v1.BuildOccurrence build = 9; + // Describes how this resource derives from the basis in the associated + // note. + grafeas.v1.ImageOccurrence image = 10; + // Describes the installation of a package on the linked resource. + grafeas.v1.PackageOccurrence package = 11; + // Describes the deployment of an artifact on a runtime. + grafeas.v1.DeploymentOccurrence deployment = 12; + // Describes when a resource was discovered. + grafeas.v1.DiscoveryOccurrence discovery = 13; + // Describes an attestation of an artifact. + grafeas.v1.AttestationOccurrence attestation = 14; + // Describes an available package upgrade on the linked resource. + grafeas.v1.UpgradeOccurrence upgrade = 15; + // Describes a compliance violation on a linked resource. + grafeas.v1.ComplianceOccurrence compliance = 16; + // Describes an attestation of an artifact using dsse. + grafeas.v1.DSSEAttestationOccurrence dsse_attestation = 17; + } + + // https://github.com/secure-systems-lab/dsse + grafeas.v1.Envelope envelope = 18; +} + +// A type of analysis that can be done for a resource. +message Note { + option (google.api.resource) = { + type: "grafeas.io/Note" + pattern: "projects/{project}/notes/{note}" + }; + + // Output only. The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1; + + // A one sentence description of this note. + string short_description = 2; + + // A detailed description of this note. + string long_description = 3; + + // Output only. The type of analysis. This field can be used as a filter in + // list requests. + grafeas.v1.NoteKind kind = 4; + + // URLs associated with this note. + repeated grafeas.v1.RelatedUrl related_url = 5; + + // Time of expiration for this note. Empty if note does not expire. + google.protobuf.Timestamp expiration_time = 6; + + // Output only. The time this note was created. This field can be used as a + // filter in list requests. + google.protobuf.Timestamp create_time = 7; + + // Output only. The time this note was last updated. This field can be used as + // a filter in list requests. + google.protobuf.Timestamp update_time = 8; + + // Other notes related to this note. + repeated string related_note_names = 9; + + // Required. Immutable. The type of analysis this note represents. + oneof type { + // A note describing a package vulnerability. + grafeas.v1.VulnerabilityNote vulnerability = 10; + // A note describing build provenance for a verifiable build. + grafeas.v1.BuildNote build = 11; + // A note describing a base image. + grafeas.v1.ImageNote image = 12; + // A note describing a package hosted by various package managers. + grafeas.v1.PackageNote package = 13; + // A note describing something that can be deployed. + grafeas.v1.DeploymentNote deployment = 14; + // A note describing the initial analysis of a resource. + grafeas.v1.DiscoveryNote discovery = 15; + // A note describing an attestation role. + grafeas.v1.AttestationNote attestation = 16; + // A note describing available package upgrades. + grafeas.v1.UpgradeNote upgrade = 17; + // A note describing a compliance check. + grafeas.v1.ComplianceNote compliance = 18; + // A note describing a dsse attestation note. + grafeas.v1.DSSEAttestationNote dsse_attestation = 19; + // A note describing a vulnerability assessment. + grafeas.v1.VulnerabilityAssessmentNote vulnerability_assessment = 20; + } +} + +// Request to get an occurrence. +message GetOccurrenceRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Occurrence" + ]; +} + +// Request to list occurrences. +message ListOccurrencesRequest { + // The name of the project to list occurrences for in the form of + // `projects/[PROJECT_ID]`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Project" + ]; + + // The filter expression. + string filter = 2; + + // Number of occurrences to return in the list. Must be positive. Max allowed + // page size is 1000. If not specified, page size defaults to 20. + int32 page_size = 3; + + // Token to provide to skip to a particular spot in the list. + string page_token = 4; +} + +// Response for listing occurrences. +message ListOccurrencesResponse { + // The occurrences requested. + repeated Occurrence occurrences = 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 + // results. + string next_page_token = 2; +} + +// Request to delete an occurrence. +message DeleteOccurrenceRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Occurrence" + ]; +} + +// Request to create a new occurrence. +message CreateOccurrenceRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the occurrence is to be created. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Project" + ]; + // The occurrence to create. + Occurrence occurrence = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to update an occurrence. +message UpdateOccurrenceRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Occurrence" + ]; + // The updated occurrence. + Occurrence occurrence = 2 [(google.api.field_behavior) = REQUIRED]; + // The fields to update. + google.protobuf.FieldMask update_mask = 3; +} + +// Request to get a note. +message GetNoteRequest { + // The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Note" + ]; +} + +// Request to get the note to which the specified occurrence is attached. +message GetOccurrenceNoteRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Occurrence" + ]; +} + +// Request to list notes. +message ListNotesRequest { + // The name of the project to list notes for in the form of + // `projects/[PROJECT_ID]`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Project" + ]; + + // The filter expression. + string filter = 2; + + // Number of notes to return in the list. Must be positive. Max allowed page + // size is 1000. If not specified, page size defaults to 20. + int32 page_size = 3; + + // Token to provide to skip to a particular spot in the list. + string page_token = 4; +} + +// Response for listing notes. +message ListNotesResponse { + // The notes requested. + repeated Note notes = 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 + // results. + string next_page_token = 2; +} + +// Request to delete a note. +message DeleteNoteRequest { + // The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Note" + ]; +} + +// Request to create a new note. +message CreateNoteRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the note is to be created. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Project" + ]; + // The ID to use for this note. + string note_id = 2 [(google.api.field_behavior) = REQUIRED]; + // The note to create. + Note note = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to update a note. +message UpdateNoteRequest { + // The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Note" + ]; + // The updated note. + Note note = 2 [(google.api.field_behavior) = REQUIRED]; + // The fields to update. + google.protobuf.FieldMask update_mask = 3; +} + +// Request to list occurrences for a note. +message ListNoteOccurrencesRequest { + // The name of the note to list occurrences for in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Note" + ]; + // The filter expression. + string filter = 2; + // Number of occurrences to return in the list. + int32 page_size = 3; + // Token to provide to skip to a particular spot in the list. + string page_token = 4; +} + +// Response for listing occurrences for a note. +message ListNoteOccurrencesResponse { + // The occurrences attached to the specified note. + repeated Occurrence occurrences = 1; + // Token to provide to skip to a particular spot in the list. + string next_page_token = 2; +} + +// Request to create notes in batch. +message BatchCreateNotesRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the notes are to be created. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Project" + ]; + + // The notes to create. Max allowed length is 1000. + map notes = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response for creating notes in batch. +message BatchCreateNotesResponse { + // The notes that were created. + repeated Note notes = 1; +} + +// Request to create occurrences in batch. +message BatchCreateOccurrencesRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the occurrences are to be created. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "grafeas.io/Project" + ]; + + // The occurrences to create. Max allowed length is 1000. + repeated Occurrence occurrences = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response for creating occurrences in batch. +message BatchCreateOccurrencesResponse { + // The occurrences that were created. + repeated Occurrence occurrences = 1; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/image.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/image.proto new file mode 100644 index 00000000000..9ac162cec22 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/image.proto @@ -0,0 +1,83 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Layer holds metadata specific to a layer of a Docker image. +message Layer { + // Required. The recovered Dockerfile directive used to construct this layer. + // See https://docs.docker.com/engine/reference/builder/ for more information. + string directive = 1; + + // The recovered arguments to the Dockerfile directive. + string arguments = 2; +} + +// A set of properties that uniquely identify a given Docker image. +message Fingerprint { + // Required. The layer ID of the final layer in the Docker image's v1 + // representation. + string v1_name = 1; + + // Required. The ordered list of v2 blobs that represent a given image. + repeated string v2_blob = 2; + + // Output only. The name of the image's v2 blobs computed via: + // [bottom] := v2_blob[bottom] + // [N] := sha256(v2_blob[N] + " " + v2_name[N+1]) + // Only the name of the final blob is kept. + string v2_name = 3; +} + +// Basis describes the base image portion (Note) of the DockerImage +// relationship. Linked occurrences are derived from this or an equivalent image +// via: +// FROM +// Or an equivalent reference, e.g., a tag of the resource_url. +message ImageNote { + // Required. Immutable. The resource_url for the resource representing the + // basis of associated occurrence images. + string resource_url = 1; + + // Required. Immutable. The fingerprint of the base image. + Fingerprint fingerprint = 2; +} + +// Details of the derived image portion of the DockerImage relationship. This +// image would be produced from a Dockerfile with FROM . +message ImageOccurrence { + // Required. The fingerprint of the derived image. + Fingerprint fingerprint = 1; + + // Output only. The number of layers by which this image differs from the + // associated image basis. + int32 distance = 2; + + // This contains layer-specific metadata, if populated it has length + // "distance" and is ordered with [distance] being the layer immediately + // following the base image and [1] being the final layer. + repeated Layer layer_info = 3; + + // Output only. This contains the base image URL for the derived image + // occurrence. + string base_resource_url = 4; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_provenance.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_provenance.proto new file mode 100644 index 00000000000..78886b66e48 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_provenance.proto @@ -0,0 +1,113 @@ +// Copyright 2021 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; +option java_outer_classname = "InTotoProvenanceProto"; + +// Spec defined at +// https://github.com/in-toto/attestation/blob/main/spec/predicates/provenance.md + +// Steps taken to build the artifact. +// For a TaskRun, typically each container corresponds to one step in the +// recipe. +message Recipe { + // URI indicating what type of recipe was performed. It determines the meaning + // of recipe.entryPoint, recipe.arguments, recipe.environment, and materials. + string type = 1; + // Index in materials containing the recipe steps that are not implied by + // recipe.type. For example, if the recipe type were "make", then this would + // point to the source containing the Makefile, not the make program itself. + // Set to -1 if the recipe doesn't come from a material, as zero is default + // unset value for int64. + int64 defined_in_material = 2; + // String identifying the entry point into the build. + // This is often a path to a configuration file and/or a target label within + // that file. The syntax and meaning are defined by recipe.type. For example, + // if the recipe type were "make", then this would reference the directory in + // which to run make as well as which target to use. + string entry_point = 3; + // Collection of all external inputs that influenced the build on top of + // recipe.definedInMaterial and recipe.entryPoint. For example, if the recipe + // type were "make", then this might be the flags passed to make aside from + // the target, which is captured in recipe.entryPoint. Since the arguments + // field can greatly vary in structure, depending on the builder and recipe + // type, this is of form "Any". + repeated google.protobuf.Any arguments = 4; + // Any other builder-controlled inputs necessary for correctly evaluating the + // recipe. Usually only needed for reproducing the build but not evaluated as + // part of policy. Since the environment field can greatly vary in structure, + // depending on the builder and recipe type, this is of form "Any". + repeated google.protobuf.Any environment = 5; +} + +// Indicates that the builder claims certain fields in this message to be +// complete. +message Completeness { + // If true, the builder claims that recipe.arguments is complete, meaning that + // all external inputs are properly captured in the recipe. + bool arguments = 1; + // If true, the builder claims that recipe.environment is claimed to be + // complete. + bool environment = 2; + // If true, the builder claims that materials are complete, usually through + // some controls to prevent network access. Sometimes called "hermetic". + bool materials = 3; +} + +// Other properties of the build. +message Metadata { + // Identifies the particular build invocation, which can be useful for finding + // associated logs or other ad-hoc analysis. The value SHOULD be globally + // unique, per in-toto Provenance spec. + string build_invocation_id = 1; + // The timestamp of when the build started. + google.protobuf.Timestamp build_started_on = 2; + // The timestamp of when the build completed. + google.protobuf.Timestamp build_finished_on = 3; + // Indicates that the builder claims certain fields in this message to be + // complete. + Completeness completeness = 4; + // If true, the builder claims that running the recipe on materials will + // produce bit-for-bit identical output. + bool reproducible = 5; +} + +message BuilderConfig { + string id = 1; +} + +message InTotoProvenance { + BuilderConfig builder_config = 1; // required + // Identifies the configuration used for the build. + // When combined with materials, this SHOULD fully describe the build, + // such that re-running this recipe results in bit-for-bit identical output + // (if the build is reproducible). + Recipe recipe = 2; // required + Metadata metadata = 3; + // The collection of artifacts that influenced the build including sources, + // dependencies, build tools, base images, and so on. This is considered to be + // incomplete unless metadata.completeness.materials is true. Unset or null is + // equivalent to empty. + repeated string materials = 4; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_statement.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_statement.proto new file mode 100644 index 00000000000..1f798d0d65f --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_statement.proto @@ -0,0 +1,52 @@ +// Copyright 2021 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "grafeas/v1/intoto_provenance.proto"; +import "grafeas/v1/slsa_provenance.proto"; +import "grafeas/v1/slsa_provenance_zero_two.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; +option java_outer_classname = "InTotoStatementProto"; + +// Spec defined at +// https://github.com/in-toto/attestation/tree/main/spec#statement The +// serialized InTotoStatement will be stored as Envelope.payload. +// Envelope.payloadType is always "application/vnd.in-toto+json". +message InTotoStatement { + // Always `https://in-toto.io/Statement/v0.1`. + string type = 1 [json_name = "_type"]; + repeated Subject subject = 2; + // `https://slsa.dev/provenance/v0.1` for SlsaProvenance. + string predicate_type = 3; + oneof predicate { + InTotoProvenance provenance = 4; + SlsaProvenance slsa_provenance = 5; + SlsaProvenanceZeroTwo slsa_provenance_zero_two = 6; + } +} +message Subject { + string name = 1; + // `"": ""` + // Algorithms can be e.g. sha256, sha512 + // See + // https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet + map digest = 2; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/package.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/package.proto new file mode 100644 index 00000000000..61b21dbf032 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/package.proto @@ -0,0 +1,192 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "google/api/field_behavior.proto"; +import "grafeas/v1/common.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Instruction set architectures supported by various package managers. +enum Architecture { + // Unknown architecture. + ARCHITECTURE_UNSPECIFIED = 0; + // X86 architecture. + X86 = 1; + // X64 architecture. + X64 = 2; +} + +// This represents a particular channel of distribution for a given package. +// E.g., Debian's jessie-backports dpkg mirror. +message Distribution { + // The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + // denoting the package manager version distributing a package. + string cpe_uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // The CPU architecture for which packages in this distribution channel were + // built. + Architecture architecture = 2; + + // The latest available version of this package in this distribution channel. + Version latest_version = 3; + + // A freeform string denoting the maintainer of this package. + string maintainer = 4; + + // The distribution channel-specific homepage for this package. + string url = 5; + + // The distribution channel-specific description of this package. + string description = 6; +} + +// An occurrence of a particular package installation found within a system's +// filesystem. E.g., glibc was found in `/var/lib/dpkg/status`. +message Location { + // Deprecated. + // The CPE URI in [CPE format](https://cpe.mitre.org/specification/) + string cpe_uri = 1; + + // Deprecated. + // The version installed at this location. + Version version = 2; + + // The path from which we gathered that this package/version is installed. + string path = 3; +} + +// PackageNote represents a particular package version. +message PackageNote { + // The name of the package. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Deprecated. + // The various channels by which a package is distributed. + repeated Distribution distribution = 10; + + // The type of package; whether native or non native (e.g., ruby gems, + // node.js packages, etc.). + string package_type = 11; + + // The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + // denoting the package manager version distributing a package. + // The cpe_uri will be blank for language packages. + string cpe_uri = 12; + + // The CPU architecture for which packages in this distribution channel were + // built. Architecture will be blank for language packages. + Architecture architecture = 13; + + // The version of the package. + Version version = 14; + + // A freeform text denoting the maintainer of this package. + string maintainer = 15; + + // The homepage for this package. + string url = 16; + + // The description of this package. + string description = 17; + + // Licenses that have been declared by the authors of the package. + License license = 18; + + // Hash value, typically a file digest, that allows unique + // identification a specific package. + repeated Digest digest = 19; +} + +// Details on how a particular software package was installed on a system. +message PackageOccurrence { + // The name of the installed package. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // All of the places within the filesystem versions of this package + // have been found. + repeated Location location = 2; + + // The type of package; whether native or non native (e.g., ruby gems, + // node.js packages, etc.). + string package_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + // denoting the package manager version distributing a package. + // The cpe_uri will be blank for language packages. + string cpe_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The CPU architecture for which packages in this distribution channel were + // built. Architecture will be blank for language packages. + Architecture architecture = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Licenses that have been declared by the authors of the package. + License license = 6; + + // The version of the package. + Version version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Version contains structured information about the version of a package. +message Version { + // Used to correct mistakes in the version numbering scheme. + int32 epoch = 1; + + // Required only when version kind is NORMAL. The main part of the version + // name. + string name = 2; + + // The iteration of the package build from the above version. + string revision = 3; + + // Whether this version is specifying part of an inclusive range. Grafeas + // does not have the capability to specify version ranges; instead we have + // fields that specify start version and end versions. At times this is + // insufficient - we also need to specify whether the version is included in + // the range or is excluded from the range. This boolean is expected to be set + // to true when the version is included in a range. + bool inclusive = 6; + + // Whether this is an ordinary package version or a sentinel MIN/MAX version. + enum VersionKind { + // Unknown. + VERSION_KIND_UNSPECIFIED = 0; + // A standard package version. + NORMAL = 1; + // A special version representing negative infinity. + MINIMUM = 2; + // A special version representing positive infinity. + MAXIMUM = 3; + } + + // Required. Distinguishes between sentinel MIN/MAX versions and normal + // versions. + VersionKind kind = 4; + + // Human readable version string. This string is of the form + // :- and is only set when kind is NORMAL. + string full_name = 5; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/provenance.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/provenance.proto new file mode 100644 index 00000000000..06b109785f8 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/provenance.proto @@ -0,0 +1,265 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Provenance of a build. Contains all information needed to verify the full +// details about the build from source to completion. +message BuildProvenance { + // Required. Unique identifier of the build. + string id = 1; + + // ID of the project. + string project_id = 2; + + // Commands requested by the build. + repeated Command commands = 3; + + // Output of the build. + repeated Artifact built_artifacts = 4; + + // Time at which the build was created. + google.protobuf.Timestamp create_time = 5; + + // Time at which execution of the build was started. + google.protobuf.Timestamp start_time = 6; + + // Time at which execution of the build was finished. + google.protobuf.Timestamp end_time = 7; + + // E-mail address of the user who initiated this build. Note that this was the + // user's e-mail address at the time the build was initiated; this address may + // not represent the same end-user for all time. + string creator = 8; + + // URI where any logs for this provenance were written. + string logs_uri = 9; + + // Details of the Source input to the build. + Source source_provenance = 10; + + // Trigger identifier if the build was triggered automatically; empty if not. + string trigger_id = 11; + + // Special options applied to this build. This is a catch-all field where + // build providers can enter any desired additional details. + map build_options = 12; + + // Version string of the builder at the time this build was executed. + string builder_version = 13; +} + +// Source describes the location of the source used for the build. +message Source { + // If provided, the input binary artifacts for the build came from this + // location. + string artifact_storage_source_uri = 1; + + // Hash(es) of the build source, which can be used to verify that the original + // source integrity was maintained in the build. + // + // The keys to this map are file paths used as build source and the values + // contain the hash values for those files. + // + // If the build source came in a single package such as a gzipped tarfile + // (.tar.gz), the FileHash will be for the single path to that file. + map file_hashes = 2; + + // If provided, the source code used for the build came from this location. + SourceContext context = 3; + + // If provided, some of the source code used for the build may be found in + // these locations, in the case where the source repository had multiple + // remotes or submodules. This list will not include the context specified in + // the context field. + repeated SourceContext additional_contexts = 4; +} + +// Container message for hashes of byte content of files, used in source +// messages to verify integrity of source input to the build. +message FileHashes { + // Required. Collection of file hashes. + repeated Hash file_hash = 1; +} + +// Container message for hash values. +message Hash { + // Required. The type of hash that was performed, e.g. "SHA-256". + string type = 1; + // Required. The hash value. + bytes value = 2; +} + +// Command describes a step performed as part of the build pipeline. +message Command { + // Required. Name of the command, as presented on the command line, or if the + // command is packaged as a Docker container, as presented to `docker pull`. + string name = 1; + + // Environment variables set before running this command. + repeated string env = 2; + + // Command-line arguments used when executing this command. + repeated string args = 3; + + // Working directory (relative to project source root) used when running this + // command. + string dir = 4; + + // Optional unique identifier for this command, used in wait_for to reference + // this command as a dependency. + string id = 5; + + // The ID(s) of the command(s) that this command depends on. + repeated string wait_for = 6; +} + +// Artifact describes a build product. +message Artifact { + // Hash or checksum value of a binary, or Docker Registry 2.0 digest of a + // container. + string checksum = 1; + + // Artifact ID, if any; for container images, this will be a URL by digest + // like `gcr.io/projectID/imagename@sha256:123456`. + string id = 2; + + // Related artifact names. This may be the path to a binary or jar file, or in + // the case of a container build, the name used to push the container image to + // Google Container Registry, as presented to `docker push`. Note that a + // single Artifact ID can have multiple names, for example if two tags are + // applied to one image. + repeated string names = 3; +} + +// A SourceContext is a reference to a tree of files. A SourceContext together +// with a path point to a unique revision of a single file or directory. +message SourceContext { + // A SourceContext can refer any one of the following types of repositories. + oneof context { + // A SourceContext referring to a revision in a Google Cloud Source Repo. + CloudRepoSourceContext cloud_repo = 1; + + // A SourceContext referring to a Gerrit project. + GerritSourceContext gerrit = 2; + + // A SourceContext referring to any third party Git repo (e.g., GitHub). + GitSourceContext git = 3; + } + + // Labels with user defined metadata. + map labels = 4; +} + +// An alias to a repo revision. +message AliasContext { + // The type of an alias. + enum Kind { + // Unknown. + KIND_UNSPECIFIED = 0; + // Git tag. + FIXED = 1; + // Git branch. + MOVABLE = 2; + // Used to specify non-standard aliases. For example, if a Git repo has a + // ref named "refs/foo/bar". + OTHER = 4; + } + + // The alias kind. + Kind kind = 1; + + // The alias name. + string name = 2; +} + +// A CloudRepoSourceContext denotes a particular revision in a Google Cloud +// Source Repo. +message CloudRepoSourceContext { + // The ID of the repo. + RepoId repo_id = 1; + + // A revision in a Cloud Repo can be identified by either its revision ID or + // its alias. + oneof revision { + // A revision ID. + string revision_id = 2; + + // An alias, which may be a branch or tag. + AliasContext alias_context = 3; + } +} + +// A SourceContext referring to a Gerrit project. +message GerritSourceContext { + // The URI of a running Gerrit instance. + string host_uri = 1; + + // The full project name within the host. Projects may be nested, so + // "project/subproject" is a valid project name. The "repo name" is the + // hostURI/project. + string gerrit_project = 2; + + // A revision in a Gerrit project can be identified by either its revision ID + // or its alias. + oneof revision { + // A revision (commit) ID. + string revision_id = 3; + + // An alias, which may be a branch or tag. + AliasContext alias_context = 4; + } +} + +// A GitSourceContext denotes a particular revision in a third party Git +// repository (e.g., GitHub). +message GitSourceContext { + // Git repository URL. + string url = 1; + + // Git commit hash. + string revision_id = 2; +} + +// A unique identifier for a Cloud Repo. +message RepoId { + // A cloud repo can be identified by either its project ID and repository name + // combination, or its globally unique identifier. + oneof id { + // A combination of a project ID and a repo name. + ProjectRepoId project_repo_id = 1; + + // A server-assigned, globally unique identifier. + string uid = 2; + } +} + +// Selects a repo using a Google Cloud Platform project ID (e.g., +// winged-cargo-31) and a repo name within that project. +message ProjectRepoId { + // The ID of the project. + string project_id = 1; + + // The name of the repo. Leave empty for the default repo. + string repo_name = 2; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/severity.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/severity.proto new file mode 100644 index 00000000000..cc9cc384535 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/severity.proto @@ -0,0 +1,38 @@ +// Copyright 2021 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Note provider assigned severity/impact ranking. +enum Severity { + // Unknown. + SEVERITY_UNSPECIFIED = 0; + // Minimal severity. + MINIMAL = 1; + // Low severity. + LOW = 2; + // Medium severity. + MEDIUM = 3; + // High severity. + HIGH = 4; + // Critical severity. + CRITICAL = 5; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance.proto new file mode 100644 index 00000000000..c038af064e0 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance.proto @@ -0,0 +1,115 @@ +// Copyright 2021 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; +option java_outer_classname = "SlsaProvenanceProto"; + +message SlsaProvenance { + // Steps taken to build the artifact. + // For a TaskRun, typically each container corresponds to one step in the + // recipe. + message SlsaRecipe { + // URI indicating what type of recipe was performed. It determines the + // meaning of recipe.entryPoint, recipe.arguments, recipe.environment, and + // materials. + string type = 1; + // Index in materials containing the recipe steps that are not implied by + // recipe.type. For example, if the recipe type were "make", then this would + // point to the source containing the Makefile, not the make program itself. + // Set to -1 if the recipe doesn't come from a material, as zero is default + // unset value for int64. + int64 defined_in_material = 2; + // String identifying the entry point into the build. + // This is often a path to a configuration file and/or a target label within + // that file. The syntax and meaning are defined by recipe.type. For + // example, if the recipe type were "make", then this would reference the + // directory in which to run make as well as which target to use. + string entry_point = 3; + // Collection of all external inputs that influenced the build on top of + // recipe.definedInMaterial and recipe.entryPoint. For example, if the + // recipe type were "make", then this might be the flags passed to make + // aside from the target, which is captured in recipe.entryPoint. Depending + // on the recipe Type, the structure may be different. + google.protobuf.Any arguments = 4; + // Any other builder-controlled inputs necessary for correctly evaluating + // the recipe. Usually only needed for reproducing the build but not + // evaluated as part of policy. Depending on the recipe Type, the structure + // may be different. + google.protobuf.Any environment = 5; + } + + // Indicates that the builder claims certain fields in this message to be + // complete. + message SlsaCompleteness { + // If true, the builder claims that recipe.arguments is complete, meaning + // that all external inputs are properly captured in the recipe. + bool arguments = 1; + // If true, the builder claims that recipe.environment is claimed to be + // complete. + bool environment = 2; + // If true, the builder claims that materials are complete, usually through + // some controls to prevent network access. Sometimes called "hermetic". + bool materials = 3; + } + + // Other properties of the build. + message SlsaMetadata { + // Identifies the particular build invocation, which can be useful for + // finding associated logs or other ad-hoc analysis. The value SHOULD be + // globally unique, per in-toto Provenance spec. + string build_invocation_id = 1; + // The timestamp of when the build started. + google.protobuf.Timestamp build_started_on = 2; + // The timestamp of when the build completed. + google.protobuf.Timestamp build_finished_on = 3; + // Indicates that the builder claims certain fields in this message to be + // complete. + SlsaCompleteness completeness = 4; + // If true, the builder claims that running the recipe on materials will + // produce bit-for-bit identical output. + bool reproducible = 5; + } + + message SlsaBuilder { + string id = 1; + } + + message Material { + string uri = 1; + map digest = 2; + } + + SlsaBuilder builder = 1; // required + // Identifies the configuration used for the build. + // When combined with materials, this SHOULD fully describe the build, + // such that re-running this recipe results in bit-for-bit identical output + // (if the build is reproducible). + SlsaRecipe recipe = 2; // required + SlsaMetadata metadata = 3; + // The collection of artifacts that influenced the build including sources, + // dependencies, build tools, base images, and so on. This is considered to be + // incomplete unless metadata.completeness.materials is true. Unset or null is + // equivalent to empty. + repeated Material materials = 4; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance_zero_two.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance_zero_two.proto new file mode 100644 index 00000000000..11cdd1c0ba5 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance_zero_two.proto @@ -0,0 +1,82 @@ +// Copyright 2021 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; +option java_outer_classname = "SlsaProvenanceZeroTwoProto"; + +message SlsaProvenanceZeroTwo { + // See full explanation of fields at slsa.dev/provenance/v0.2. + + // Identifies the entity that executed the recipe, which is trusted to have + // correctly performed the operation and populated this provenance. + message SlsaBuilder { + string id = 1; + } + + // The collection of artifacts that influenced the build including sources, + // dependencies, build tools, base images, and so on. + message SlsaMaterial { + string uri = 1; + map digest = 2; + } + + // Identifies the event that kicked off the build. + message SlsaInvocation { + SlsaConfigSource config_source = 1; + google.protobuf.Struct parameters = 2; + google.protobuf.Struct environment = 3; + } + + // Describes where the config file that kicked off the build came from. + // This is effectively a pointer to the source where buildConfig came from. + message SlsaConfigSource { + string uri = 1; + map digest = 2; + string entry_point = 3; + } + + // Other properties of the build. + message SlsaMetadata { + string build_invocation_id = 1; + google.protobuf.Timestamp build_started_on = 2; + google.protobuf.Timestamp build_finished_on = 3; + SlsaCompleteness completeness = 4; + bool reproducible = 5; + } + + // Indicates that the builder claims certain fields in this message to be + // complete. + message SlsaCompleteness { + bool parameters = 1; + bool environment = 2; + bool materials = 3; + } + + SlsaBuilder builder = 1; + string build_type = 2; + SlsaInvocation invocation = 3; + google.protobuf.Struct build_config = 4; + SlsaMetadata metadata = 5; + repeated SlsaMaterial materials = 6; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/upgrade.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/upgrade.proto new file mode 100644 index 00000000000..89d38929919 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/upgrade.proto @@ -0,0 +1,114 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "google/protobuf/timestamp.proto"; +import "grafeas/v1/package.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// An Upgrade Note represents a potential upgrade of a package to a given +// version. For each package version combination (i.e. bash 4.0, bash 4.1, +// bash 4.1.2), there will be an Upgrade Note. For Windows, windows_update field +// represents the information related to the update. +message UpgradeNote { + // Required for non-Windows OS. The package this Upgrade is for. + string package = 1; + // Required for non-Windows OS. The version of the package in machine + human + // readable form. + grafeas.v1.Version version = 2; + // Metadata about the upgrade for each specific operating system. + repeated UpgradeDistribution distributions = 3; + // Required for Windows OS. Represents the metadata about the Windows update. + WindowsUpdate windows_update = 4; +} + +// The Upgrade Distribution represents metadata about the Upgrade for each +// operating system (CPE). Some distributions have additional metadata around +// updates, classifying them into various categories and severities. +message UpgradeDistribution { + // Required - The specific operating system this metadata applies to. See + // https://cpe.mitre.org/specification/. + string cpe_uri = 1; + // The operating system classification of this Upgrade, as specified by the + // upstream operating system upgrade feed. For Windows the classification is + // one of the category_ids listed at + // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ff357803(v=vs.85) + string classification = 2; + // The severity as specified by the upstream operating system. + string severity = 3; + // The cve tied to this Upgrade. + repeated string cve = 4; +} + +// Windows Update represents the metadata about the update for the Windows +// operating system. The fields in this message come from the Windows Update API +// documented at +// https://docs.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iupdate. +message WindowsUpdate { + // The unique identifier of the update. + message Identity { + // The revision independent identifier of the update. + string update_id = 1; + // The revision number of the update. + int32 revision = 2; + } + // Required - The unique identifier for the update. + Identity identity = 1; + // The localized title of the update. + string title = 2; + // The localized description of the update. + string description = 3; + // The category to which the update belongs. + message Category { + // The identifier of the category. + string category_id = 1; + // The localized name of the category. + string name = 2; + } + // The list of categories to which the update belongs. + repeated Category categories = 4; + // The Microsoft Knowledge Base article IDs that are associated with the + // update. + repeated string kb_article_ids = 5; + // The hyperlink to the support information for the update. + string support_url = 6; + // The last published timestamp of the update. + google.protobuf.Timestamp last_published_timestamp = 7; +} + +// An Upgrade Occurrence represents that a specific resource_url could install a +// specific upgrade. This presence is supplied via local sources (i.e. it is +// present in the mirror and the running system has noticed its availability). +// For Windows, both distribution and windows_update contain information for the +// Windows update. +message UpgradeOccurrence { + // Required for non-Windows OS. The package this Upgrade is for. + string package = 1; + // Required for non-Windows OS. The version of the package in a machine + + // human readable form. + grafeas.v1.Version parsed_version = 3; + // Metadata about the upgrade for available for the specific operating system + // for the resource_url. This allows efficient filtering, as well as + // making it easier to use the occurrence. + UpgradeDistribution distribution = 4; + // Required for Windows OS. Represents the metadata about the Windows update. + WindowsUpdate windows_update = 5; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vex.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vex.proto new file mode 100644 index 00000000000..ba53a8438ff --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vex.proto @@ -0,0 +1,203 @@ +// Copyright 2023 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "grafeas/v1/common.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// A single VulnerabilityAssessmentNote represents +// one particular product's vulnerability assessment for one CVE. +message VulnerabilityAssessmentNote { + // The title of the note. E.g. `Vex-Debian-11.4` + string title = 1; + + // A one sentence description of this Vex. + string short_description = 2; + + // A detailed description of this Vex. + string long_description = 3; + + // Identifies the language used by this document, + // corresponding to IETF BCP 47 / RFC 5646. + string language_code = 4; + + // Publisher contains information about the publisher of + // this Note. + // (-- api-linter: core::0123::resource-annotation=disabled + // aip.dev/not-precedent: Publisher is not a separate resource. --) + message Publisher { + // Name of the publisher. + // Examples: 'Google', 'Google Cloud Platform'. + string name = 1; + + // Provides information about the authority of the issuing party to + // release the document, in particular, the party's constituency and + // responsibilities or other obligations. + string issuing_authority = 2; + + // The context or namespace. + // Contains a URL which is under control of the issuing party and can + // be used as a globally unique identifier for that issuing party. + // Example: https://csaf.io + string publisher_namespace = 3; + } + + // Publisher details of this Note. + Publisher publisher = 5; + + // Product contains information about a product and how to uniquely identify + // it. + // (-- api-linter: core::0123::resource-annotation=disabled + // aip.dev/not-precedent: Product is not a separate resource. --) + message Product { + // Name of the product. + string name = 1; + + // Token that identifies a product so that it can be referred to from other + // parts in the document. There is no predefined format as long as it + // uniquely identifies a group in the context of the current document. + string id = 2; + + oneof identifier { + // Contains a URI which is vendor-specific. + // Example: The artifact repository URL of an image. + string generic_uri = 3; + } + } + + // The product affected by this vex. + Product product = 6; + + // Assessment provides all information that is related to a single + // vulnerability for this product. + message Assessment { + // Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) + // tracking number for the vulnerability. + string cve = 1; + + // A one sentence description of this Vex. + string short_description = 2; + + // A detailed description of this Vex. + string long_description = 3; + + // Holds a list of references associated with this vulnerability item and + // assessment. These uris have additional information about the + // vulnerability and the assessment itself. E.g. Link to a document which + // details how this assessment concluded the state of this vulnerability. + repeated grafeas.v1.RelatedUrl related_uris = 4; + + // Provides the state of this Vulnerability assessment. + enum State { + // No state is specified. + STATE_UNSPECIFIED = 0; + // This product is known to be affected by this vulnerability. + AFFECTED = 1; + // This product is known to be not affected by this vulnerability. + NOT_AFFECTED = 2; + // This product contains a fix for this vulnerability. + FIXED = 3; + // It is not known yet whether these versions are or are not affected + // by the vulnerability. However, it is still under investigation. + UNDER_INVESTIGATION = 4; + } + + // Provides the state of this Vulnerability assessment. + State state = 5; + + // Contains information about the impact of this vulnerability, + // this will change with time. + repeated string impacts = 6; + + // Justification provides the justification when the state of the + // assessment if NOT_AFFECTED. + message Justification { + // Provides the type of justification. + enum JustificationType { + // JUSTIFICATION_TYPE_UNSPECIFIED. + JUSTIFICATION_TYPE_UNSPECIFIED = 0; + // The vulnerable component is not present in the product. + COMPONENT_NOT_PRESENT = 1; + // The vulnerable code is not present. Typically this case + // occurs when source code is configured or built in a way that excludes + // the vulnerable code. + VULNERABLE_CODE_NOT_PRESENT = 2; + // The vulnerable code can not be executed. + // Typically this case occurs when the product includes the vulnerable + // code but does not call or use the vulnerable code. + VULNERABLE_CODE_NOT_IN_EXECUTE_PATH = 3; + // The vulnerable code cannot be controlled by an attacker to exploit + // the vulnerability. + VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY = 4; + // The product includes built-in protections or features that prevent + // exploitation of the vulnerability. These built-in protections cannot + // be subverted by the attacker and cannot be configured or disabled by + // the user. These mitigations completely prevent exploitation based on + // known attack vectors. + INLINE_MITIGATIONS_ALREADY_EXIST = 5; + } + + // The justification type for this vulnerability. + JustificationType justification_type = 1; + + // Additional details on why this justification was chosen. + string details = 2; + } + + // Justification provides the justification when the state of the + // assessment if NOT_AFFECTED. + Justification justification = 7; + + // Specifies details on how to handle (and presumably, fix) a vulnerability. + message Remediation { + // The type of remediation that can be applied. + enum RemediationType { + // No remediation type specified. + REMEDIATION_TYPE_UNSPECIFIED = 0; + // A MITIGATION is available. + MITIGATION = 1; + // No fix is planned. + NO_FIX_PLANNED = 2; + // Not available. + NONE_AVAILABLE = 3; + // A vendor fix is available. + VENDOR_FIX = 4; + // A workaround is available. + WORKAROUND = 5; + } + + // The type of remediation that can be applied. + RemediationType remediation_type = 1; + + // Contains a comprehensive human-readable discussion of the remediation. + string details = 2; + + // Contains the URL where to obtain the remediation. + grafeas.v1.RelatedUrl remediation_uri = 3; + } + + // Specifies details on how to handle (and presumably, fix) a vulnerability. + repeated Remediation remediations = 8; + } + + // Represents a vulnerability assessment for the product. + Assessment assessment = 7; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vulnerability.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vulnerability.proto new file mode 100644 index 00000000000..3b316eb8dd3 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vulnerability.proto @@ -0,0 +1,297 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; +import "grafeas/v1/common.proto"; +import "grafeas/v1/cvss.proto"; +import "grafeas/v1/package.proto"; +import "grafeas/v1/severity.proto"; +import "grafeas/v1/vex.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// A security vulnerability that can be found in resources. +message VulnerabilityNote { + // The CVSS score of this vulnerability. CVSS score is on a scale of 0 - 10 + // where 0 indicates low severity and 10 indicates high severity. + float cvss_score = 1; + + // The note provider assigned severity of this vulnerability. + grafeas.v1.Severity severity = 2; + + // Details of all known distros and packages affected by this vulnerability. + repeated Detail details = 3; + + // A detail for a distro and package affected by this vulnerability and its + // associated fix (if one is available). + message Detail { + // The distro assigned severity of this vulnerability. + string severity_name = 1; + + // A vendor-specific description of this vulnerability. + string description = 2; + + // The type of package; whether native or non native (e.g., ruby gems, + // node.js packages, etc.). + string package_type = 3; + + // Required. The [CPE URI](https://cpe.mitre.org/specification/) this + // vulnerability affects. + string affected_cpe_uri = 4; + + // Required. The package this vulnerability affects. + string affected_package = 5; + + // The version number at the start of an interval in which this + // vulnerability exists. A vulnerability can affect a package between + // version numbers that are disjoint sets of intervals (example: + // [1.0.0-1.1.0], [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be + // represented in its own Detail. If a specific affected version is provided + // by a vulnerability database, affected_version_start and + // affected_version_end will be the same in that Detail. + grafeas.v1.Version affected_version_start = 6; + + // The version number at the end of an interval in which this vulnerability + // exists. A vulnerability can affect a package between version numbers + // that are disjoint sets of intervals (example: [1.0.0-1.1.0], + // [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be represented in its + // own Detail. If a specific affected version is provided by a vulnerability + // database, affected_version_start and affected_version_end will be the + // same in that Detail. + grafeas.v1.Version affected_version_end = 7; + + // The distro recommended [CPE URI](https://cpe.mitre.org/specification/) + // to update to that contains a fix for this vulnerability. It is possible + // for this to be different from the affected_cpe_uri. + string fixed_cpe_uri = 8; + + // The distro recommended package to update to that contains a fix for this + // vulnerability. It is possible for this to be different from the + // affected_package. + string fixed_package = 9; + + // The distro recommended version to update to that contains a + // fix for this vulnerability. Setting this to VersionKind.MAXIMUM means no + // such version is yet available. + grafeas.v1.Version fixed_version = 10; + + // Whether this detail is obsolete. Occurrences are expected not to point to + // obsolete details. + bool is_obsolete = 11; + + // The time this information was last changed at the source. This is an + // upstream timestamp from the underlying information source - e.g. Ubuntu + // security tracker. + google.protobuf.Timestamp source_update_time = 12; + + // The source from which the information in this Detail was obtained. + string source = 13; + + // The name of the vendor of the product. + string vendor = 14; + } + + // The full description of the CVSSv3 for this vulnerability. + CVSSv3 cvss_v3 = 4; + + // Windows details get their own format because the information format and + // model don't match a normal detail. Specifically Windows updates are done as + // patches, thus Windows vulnerabilities really are a missing package, rather + // than a package being at an incorrect version. + repeated WindowsDetail windows_details = 5; + + message WindowsDetail { + // Required. The [CPE URI](https://cpe.mitre.org/specification/) this + // vulnerability affects. + string cpe_uri = 1; + + // Required. The name of this vulnerability. + string name = 2; + + // The description of this vulnerability. + string description = 3; + + // Required. The names of the KBs which have hotfixes to mitigate this + // vulnerability. Note that there may be multiple hotfixes (and thus + // multiple KBs) that mitigate a given vulnerability. Currently any listed + // KBs presence is considered a fix. + repeated KnowledgeBase fixing_kbs = 4; + + message KnowledgeBase { + // The KB name (generally of the form KB[0-9]+ (e.g., KB123456)). + string name = 1; + // A link to the KB in the [Windows update catalog] + // (https://www.catalog.update.microsoft.com/). + string url = 2; + } + } + + // The time this information was last changed at the source. This is an + // upstream timestamp from the underlying information source - e.g. Ubuntu + // security tracker. + google.protobuf.Timestamp source_update_time = 6; + + // CVSS version used to populate cvss_score and severity. + grafeas.v1.CVSSVersion cvss_version = 7; + + // The full description of the v2 CVSS for this vulnerability. + CVSS cvss_v2 = 8; + + // Next free ID is 9. +} + +// An occurrence of a severity vulnerability on a resource. +message VulnerabilityOccurrence { + // The type of package; whether native or non native (e.g., ruby gems, node.js + // packages, etc.). + string type = 1; + + // Output only. The note provider assigned severity of this vulnerability. + grafeas.v1.Severity severity = 2; + + // Output only. The CVSS score of this vulnerability. CVSS score is on a + // scale of 0 - 10 where 0 indicates low severity and 10 indicates high + // severity. + float cvss_score = 3; + + // The cvss v3 score for the vulnerability. + CVSS cvssv3 = 10; + + // Required. The set of affected locations and their fixes (if available) + // within the associated resource. + repeated PackageIssue package_issue = 4; + + // A detail for a distro and package this vulnerability occurrence was found + // in and its associated fix (if one is available). + message PackageIssue { + // Required. The [CPE URI](https://cpe.mitre.org/specification/) this + // vulnerability was found in. + string affected_cpe_uri = 1; + + // Required. The package this vulnerability was found in. + string affected_package = 2; + + // Required. The version of the package that is installed on the resource + // affected by this vulnerability. + grafeas.v1.Version affected_version = 3; + + // The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability + // was fixed in. It is possible for this to be different from the + // affected_cpe_uri. + string fixed_cpe_uri = 4; + + // The package this vulnerability was fixed in. It is possible for this to + // be different from the affected_package. + string fixed_package = 5; + + // Required. The version of the package this vulnerability was fixed in. + // Setting this to VersionKind.MAXIMUM means no fix is yet available. + grafeas.v1.Version fixed_version = 6; + + // Output only. Whether a fix is available for this package. + bool fix_available = 7; + + // The type of package (e.g. OS, MAVEN, GO). + string package_type = 8; + + // The distro or language system assigned severity for this vulnerability + // when that is available and note provider assigned severity when it is not + // available. + grafeas.v1.Severity effective_severity = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The location at which this package was found. + repeated FileLocation file_location = 10; + } + + // Output only. A one sentence description of this vulnerability. + string short_description = 5; + + // Output only. A detailed description of this vulnerability. + string long_description = 6; + + // Output only. URLs related to this vulnerability. + repeated grafeas.v1.RelatedUrl related_urls = 7; + + // The distro assigned severity for this vulnerability when it is available, + // otherwise this is the note provider assigned severity. + // + // When there are multiple PackageIssues for this vulnerability, they can have + // different effective severities because some might be provided by the distro + // while others are provided by the language ecosystem for a language pack. + // For this reason, it is advised to use the effective severity on the + // PackageIssue level. In the case where multiple PackageIssues have differing + // effective severities, this field should be the highest severity for any of + // the PackageIssues. + grafeas.v1.Severity effective_severity = 8; + + // Output only. Whether at least one of the affected packages has a fix + // available. + bool fix_available = 9; + + // Output only. CVSS version used to populate cvss_score and severity. + grafeas.v1.CVSSVersion cvss_version = 11; + + // The cvss v2 score for the vulnerability. + CVSS cvss_v2 = 12; + + // VexAssessment provides all publisher provided Vex information that is + // related to this vulnerability. + message VexAssessment { + // Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) + // tracking number for the vulnerability. + string cve = 1; + + // Holds a list of references associated with this vulnerability item and + // assessment. + repeated grafeas.v1.RelatedUrl related_uris = 2; + + // The VulnerabilityAssessment note from which this VexAssessment was + // generated. + // This will be of the form: `projects/[PROJECT_ID]/notes/[NOTE_ID]`. + // (-- api-linter: core::0122::name-suffix=disabled + // aip.dev/not-precedent: The suffix is kept for consistency. --) + string note_name = 3; + + // Provides the state of this Vulnerability assessment. + grafeas.v1.VulnerabilityAssessmentNote.Assessment.State state = 4; + + // Contains information about the impact of this vulnerability, + // this will change with time. + repeated string impacts = 5; + + // Specifies details on how to handle (and presumably, fix) a vulnerability. + repeated grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation + remediations = 6; + + // Justification provides the justification when the state of the + // assessment if NOT_AFFECTED. + grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification + justification = 7; + + // Next ID: 8 + } + + VexAssessment vex_assessment = 13; + + // Next free ID is 14. +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_iam_policy.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_iam_policy.js new file mode 100644 index 00000000000..c933a75f614 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.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 containeranalysis_v1_generated_ContainerAnalysis_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 Containeranalysis library + const {ContainerAnalysisClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new ContainerAnalysisClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await containeranalysisClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END containeranalysis_v1_generated_ContainerAnalysis_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-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_vulnerability_occurrences_summary.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_vulnerability_occurrences_summary.js new file mode 100644 index 00000000000..ff47d3b8766 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_vulnerability_occurrences_summary.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(parent) { + // [START containeranalysis_v1_generated_ContainerAnalysis_GetVulnerabilityOccurrencesSummary_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 project to get a vulnerability summary for in the form of + * `projects/[PROJECT_ID]`. + */ + // const parent = 'abc123' + /** + * The filter expression. + */ + // const filter = 'abc123' + + // Imports the Containeranalysis library + const {ContainerAnalysisClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new ContainerAnalysisClient(); + + async function callGetVulnerabilityOccurrencesSummary() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await containeranalysisClient.getVulnerabilityOccurrencesSummary(request); + console.log(response); + } + + callGetVulnerabilityOccurrencesSummary(); + // [END containeranalysis_v1_generated_ContainerAnalysis_GetVulnerabilityOccurrencesSummary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.set_iam_policy.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.set_iam_policy.js new file mode 100644 index 00000000000..972488ce8f9 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.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 containeranalysis_v1_generated_ContainerAnalysis_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 Containeranalysis library + const {ContainerAnalysisClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new ContainerAnalysisClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await containeranalysisClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END containeranalysis_v1_generated_ContainerAnalysis_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-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.test_iam_permissions.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.test_iam_permissions.js new file mode 100644 index 00000000000..94185903521 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.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 containeranalysis_v1_generated_ContainerAnalysis_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 Containeranalysis library + const {ContainerAnalysisClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new ContainerAnalysisClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await containeranalysisClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END containeranalysis_v1_generated_ContainerAnalysis_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-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_notes.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_notes.js new file mode 100644 index 00000000000..192667e26d5 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_notes.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, notes) { + // [START containeranalysis_v1_generated_Grafeas_BatchCreateNotes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project in the form of `projects/[PROJECT_ID]`, under which + * the notes are to be created. + */ + // const parent = 'abc123' + /** + * The notes to create. Max allowed length is 1000. + */ + // const notes = [1,2,3,4] + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callBatchCreateNotes() { + // Construct request + const request = { + parent, + notes, + }; + + // Run request + const response = await containeranalysisClient.batchCreateNotes(request); + console.log(response); + } + + callBatchCreateNotes(); + // [END containeranalysis_v1_generated_Grafeas_BatchCreateNotes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_occurrences.js new file mode 100644 index 00000000000..a04632298f4 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_occurrences.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, occurrences) { + // [START containeranalysis_v1_generated_Grafeas_BatchCreateOccurrences_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrences are to be created. + */ + // const parent = 'abc123' + /** + * The occurrences to create. Max allowed length is 1000. + */ + // const occurrences = [1,2,3,4] + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callBatchCreateOccurrences() { + // Construct request + const request = { + parent, + occurrences, + }; + + // Run request + const response = await containeranalysisClient.batchCreateOccurrences(request); + console.log(response); + } + + callBatchCreateOccurrences(); + // [END containeranalysis_v1_generated_Grafeas_BatchCreateOccurrences_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_note.js new file mode 100644 index 00000000000..2f79faf7ea8 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_note.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(parent, noteId, note) { + // [START containeranalysis_v1_generated_Grafeas_CreateNote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project in the form of `projects/[PROJECT_ID]`, under which + * the note is to be created. + */ + // const parent = 'abc123' + /** + * The ID to use for this note. + */ + // const noteId = 'abc123' + /** + * The note to create. + */ + // const note = {} + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callCreateNote() { + // Construct request + const request = { + parent, + noteId, + note, + }; + + // Run request + const response = await containeranalysisClient.createNote(request); + console.log(response); + } + + callCreateNote(); + // [END containeranalysis_v1_generated_Grafeas_CreateNote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_occurrence.js new file mode 100644 index 00000000000..8e36f36e044 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_occurrence.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, occurrence) { + // [START containeranalysis_v1_generated_Grafeas_CreateOccurrence_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrence is to be created. + */ + // const parent = 'abc123' + /** + * The occurrence to create. + */ + // const occurrence = {} + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callCreateOccurrence() { + // Construct request + const request = { + parent, + occurrence, + }; + + // Run request + const response = await containeranalysisClient.createOccurrence(request); + console.log(response); + } + + callCreateOccurrence(); + // [END containeranalysis_v1_generated_Grafeas_CreateOccurrence_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_note.js new file mode 100644 index 00000000000..40034933871 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_note.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 containeranalysis_v1_generated_Grafeas_DeleteNote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callDeleteNote() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await containeranalysisClient.deleteNote(request); + console.log(response); + } + + callDeleteNote(); + // [END containeranalysis_v1_generated_Grafeas_DeleteNote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_occurrence.js new file mode 100644 index 00000000000..f8342ce8c8b --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_occurrence.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 containeranalysis_v1_generated_Grafeas_DeleteOccurrence_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callDeleteOccurrence() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await containeranalysisClient.deleteOccurrence(request); + console.log(response); + } + + callDeleteOccurrence(); + // [END containeranalysis_v1_generated_Grafeas_DeleteOccurrence_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_note.js new file mode 100644 index 00000000000..b57805866c3 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_note.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 containeranalysis_v1_generated_Grafeas_GetNote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callGetNote() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await containeranalysisClient.getNote(request); + console.log(response); + } + + callGetNote(); + // [END containeranalysis_v1_generated_Grafeas_GetNote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence.js new file mode 100644 index 00000000000..af3812b9910 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence.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 containeranalysis_v1_generated_Grafeas_GetOccurrence_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callGetOccurrence() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await containeranalysisClient.getOccurrence(request); + console.log(response); + } + + callGetOccurrence(); + // [END containeranalysis_v1_generated_Grafeas_GetOccurrence_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence_note.js new file mode 100644 index 00000000000..7c8017e6e1c --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence_note.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 containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callGetOccurrenceNote() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await containeranalysisClient.getOccurrenceNote(request); + console.log(response); + } + + callGetOccurrenceNote(); + // [END containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_note_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_note_occurrences.js new file mode 100644 index 00000000000..253b9ab0955 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_note_occurrences.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 containeranalysis_v1_generated_Grafeas_ListNoteOccurrences_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + */ + // const name = 'abc123' + /** + * The filter expression. + */ + // const filter = 'abc123' + /** + * Number of occurrences to return in the list. + */ + // const pageSize = 1234 + /** + * Token to provide to skip to a particular spot in the list. + */ + // const pageToken = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callListNoteOccurrences() { + // Construct request + const request = { + name, + }; + + // Run request + const iterable = await containeranalysisClient.listNoteOccurrencesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNoteOccurrences(); + // [END containeranalysis_v1_generated_Grafeas_ListNoteOccurrences_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_notes.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_notes.js new file mode 100644 index 00000000000..103280dd10e --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_notes.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 containeranalysis_v1_generated_Grafeas_ListNotes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + */ + // const parent = 'abc123' + /** + * The filter expression. + */ + // const filter = 'abc123' + /** + * Number of notes to return in the list. Must be positive. Max allowed page + * size is 1000. If not specified, page size defaults to 20. + */ + // const pageSize = 1234 + /** + * Token to provide to skip to a particular spot in the list. + */ + // const pageToken = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callListNotes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await containeranalysisClient.listNotesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNotes(); + // [END containeranalysis_v1_generated_Grafeas_ListNotes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_occurrences.js new file mode 100644 index 00000000000..a3fdab99499 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_occurrences.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 containeranalysis_v1_generated_Grafeas_ListOccurrences_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + */ + // const parent = 'abc123' + /** + * The filter expression. + */ + // const filter = 'abc123' + /** + * Number of occurrences to return in the list. Must be positive. Max allowed + * page size is 1000. If not specified, page size defaults to 20. + */ + // const pageSize = 1234 + /** + * Token to provide to skip to a particular spot in the list. + */ + // const pageToken = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callListOccurrences() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await containeranalysisClient.listOccurrencesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListOccurrences(); + // [END containeranalysis_v1_generated_Grafeas_ListOccurrences_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_note.js new file mode 100644 index 00000000000..c8f3b365cf3 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_note.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(name, note) { + // [START containeranalysis_v1_generated_Grafeas_UpdateNote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + */ + // const name = 'abc123' + /** + * The updated note. + */ + // const note = {} + /** + * The fields to update. + */ + // const updateMask = {} + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callUpdateNote() { + // Construct request + const request = { + name, + note, + }; + + // Run request + const response = await containeranalysisClient.updateNote(request); + console.log(response); + } + + callUpdateNote(); + // [END containeranalysis_v1_generated_Grafeas_UpdateNote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_occurrence.js new file mode 100644 index 00000000000..27d7f27cdcc --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_occurrence.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(name, occurrence) { + // [START containeranalysis_v1_generated_Grafeas_UpdateOccurrence_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + */ + // const name = 'abc123' + /** + * The updated occurrence. + */ + // const occurrence = {} + /** + * The fields to update. + */ + // const updateMask = {} + + // Imports the Containeranalysis library + const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; + + // Instantiates a client + const containeranalysisClient = new GrafeasClient(); + + async function callUpdateOccurrence() { + // Construct request + const request = { + name, + occurrence, + }; + + // Run request + const response = await containeranalysisClient.updateOccurrence(request); + console.log(response); + } + + callUpdateOccurrence(); + // [END containeranalysis_v1_generated_Grafeas_UpdateOccurrence_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/snippet_metadata_google.devtools.containeranalysis.v1.json b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/snippet_metadata_google.devtools.containeranalysis.v1.json new file mode 100644 index 00000000000..04873218834 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/snippet_metadata_google.devtools.containeranalysis.v1.json @@ -0,0 +1,827 @@ +{ + "clientLibrary": { + "name": "nodejs-containeranalysis", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.devtools.containeranalysis.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "containeranalysis_v1_generated_ContainerAnalysis_SetIamPolicy_async", + "title": "containeranalysis setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on the specified note or occurrence. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or an occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", + "canonical": true, + "file": "container_analysis.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.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": "ContainerAnalysisClient", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysisClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.SetIamPolicy", + "service": { + "shortName": "ContainerAnalysis", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_ContainerAnalysis_GetIamPolicy_async", + "title": "containeranalysis getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy for a note or an occurrence resource. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", + "canonical": true, + "file": "container_analysis.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "ContainerAnalysisClient", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysisClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.GetIamPolicy", + "service": { + "shortName": "ContainerAnalysis", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_ContainerAnalysis_TestIamPermissions_async", + "title": "containeranalysis testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, `containeranalysis.notes.list`). The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", + "canonical": true, + "file": "container_analysis.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "ContainerAnalysisClient", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysisClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.TestIamPermissions", + "service": { + "shortName": "ContainerAnalysis", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_ContainerAnalysis_GetVulnerabilityOccurrencesSummary_async", + "title": "containeranalysis getVulnerabilityOccurrencesSummary Sample", + "origin": "API_DEFINITION", + "description": " Gets a summary of the number and severity of occurrences.", + "canonical": true, + "file": "container_analysis.get_vulnerability_occurrences_summary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVulnerabilityOccurrencesSummary", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.GetVulnerabilityOccurrencesSummary", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary", + "client": { + "shortName": "ContainerAnalysisClient", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysisClient" + }, + "method": { + "shortName": "GetVulnerabilityOccurrencesSummary", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.GetVulnerabilityOccurrencesSummary", + "service": { + "shortName": "ContainerAnalysis", + "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_GetOccurrence_async", + "title": "containeranalysis getOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Gets the specified occurrence.", + "canonical": true, + "file": "grafeas.get_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOccurrence", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetOccurrence", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.Occurrence", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "GetOccurrence", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetOccurrence", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_ListOccurrences_async", + "title": "containeranalysis listOccurrences Sample", + "origin": "API_DEFINITION", + "description": " Lists occurrences for the specified project.", + "canonical": true, + "file": "grafeas.list_occurrences.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListOccurrences", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListOccurrences", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.ListOccurrencesResponse", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "ListOccurrences", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListOccurrences", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_DeleteOccurrence_async", + "title": "containeranalysis deleteOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.", + "canonical": true, + "file": "grafeas.delete_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteOccurrence", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.DeleteOccurrence", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "DeleteOccurrence", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.DeleteOccurrence", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_CreateOccurrence_async", + "title": "containeranalysis createOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Creates a new occurrence.", + "canonical": true, + "file": "grafeas.create_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateOccurrence", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.CreateOccurrence", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "occurrence", + "type": ".grafeas.v1.Occurrence" + } + ], + "resultType": ".grafeas.v1.Occurrence", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "CreateOccurrence", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.CreateOccurrence", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_BatchCreateOccurrences_async", + "title": "containeranalysis batchCreateOccurrences Sample", + "origin": "API_DEFINITION", + "description": " Creates new occurrences in batch.", + "canonical": true, + "file": "grafeas.batch_create_occurrences.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateOccurrences", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.BatchCreateOccurrences", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "occurrences", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".grafeas.v1.BatchCreateOccurrencesResponse", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "BatchCreateOccurrences", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.BatchCreateOccurrences", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_UpdateOccurrence_async", + "title": "containeranalysis updateOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified occurrence.", + "canonical": true, + "file": "grafeas.update_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateOccurrence", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.UpdateOccurrence", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "occurrence", + "type": ".grafeas.v1.Occurrence" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".grafeas.v1.Occurrence", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "UpdateOccurrence", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.UpdateOccurrence", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_async", + "title": "containeranalysis getOccurrenceNote Sample", + "origin": "API_DEFINITION", + "description": " Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.", + "canonical": true, + "file": "grafeas.get_occurrence_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOccurrenceNote", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetOccurrenceNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.Note", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "GetOccurrenceNote", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetOccurrenceNote", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_GetNote_async", + "title": "containeranalysis getNote Sample", + "origin": "API_DEFINITION", + "description": " Gets the specified note.", + "canonical": true, + "file": "grafeas.get_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNote", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.Note", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "GetNote", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetNote", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_ListNotes_async", + "title": "containeranalysis listNotes Sample", + "origin": "API_DEFINITION", + "description": " Lists notes for the specified project.", + "canonical": true, + "file": "grafeas.list_notes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNotes", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListNotes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.ListNotesResponse", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "ListNotes", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListNotes", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_DeleteNote_async", + "title": "containeranalysis deleteNote Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified note.", + "canonical": true, + "file": "grafeas.delete_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNote", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.DeleteNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "DeleteNote", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.DeleteNote", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_CreateNote_async", + "title": "containeranalysis createNote Sample", + "origin": "API_DEFINITION", + "description": " Creates a new note.", + "canonical": true, + "file": "grafeas.create_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNote", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.CreateNote", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "note_id", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": ".grafeas.v1.Note" + } + ], + "resultType": ".grafeas.v1.Note", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "CreateNote", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.CreateNote", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_BatchCreateNotes_async", + "title": "containeranalysis batchCreateNotes Sample", + "origin": "API_DEFINITION", + "description": " Creates new notes in batch.", + "canonical": true, + "file": "grafeas.batch_create_notes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateNotes", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.BatchCreateNotes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "notes", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".grafeas.v1.BatchCreateNotesResponse", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "BatchCreateNotes", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.BatchCreateNotes", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_UpdateNote_async", + "title": "containeranalysis updateNote Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified note.", + "canonical": true, + "file": "grafeas.update_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNote", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.UpdateNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": ".grafeas.v1.Note" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".grafeas.v1.Note", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "UpdateNote", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.UpdateNote", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_ListNoteOccurrences_async", + "title": "containeranalysis listNoteOccurrences Sample", + "origin": "API_DEFINITION", + "description": " Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.", + "canonical": true, + "file": "grafeas.list_note_occurrences.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNoteOccurrences", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListNoteOccurrences", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.ListNoteOccurrencesResponse", + "client": { + "shortName": "GrafeasClient", + "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" + }, + "method": { + "shortName": "ListNoteOccurrences", + "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListNoteOccurrences", + "service": { + "shortName": "Grafeas", + "fullName": "google.devtools.containeranalysis.v1.Grafeas" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/src/index.ts new file mode 100644 index 00000000000..e7c583a367b --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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 ContainerAnalysisClient = v1.ContainerAnalysisClient; +type ContainerAnalysisClient = v1.ContainerAnalysisClient; +const GrafeasClient = v1.GrafeasClient; +type GrafeasClient = v1.GrafeasClient; +export {v1, ContainerAnalysisClient, GrafeasClient}; +export default {v1, ContainerAnalysisClient, GrafeasClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client.ts new file mode 100644 index 00000000000..0a132c96912 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client.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. ** + +/* 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/container_analysis_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './container_analysis_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Retrieves analysis results of Cloud components such as Docker container + * images. The Container Analysis API is an implementation of the + * [Grafeas](https://grafeas.io) API. + * + * Analysis results are stored as a series of occurrences. An `Occurrence` + * contains information about a specific analysis instance on a resource. An + * occurrence refers to a `Note`. A note contains details describing the + * analysis and is generally stored in a separate project, called a `Provider`. + * Multiple occurrences can refer to the same note. + * + * For example, an SSL vulnerability could affect multiple images. In this case, + * there would be one note for the vulnerability and an occurrence for each + * image with the vulnerability referring to that note. + * @class + * @memberof v1 + */ +export class ContainerAnalysisClient { + 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}; + containerAnalysisStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ContainerAnalysisClient. + * + * @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 ContainerAnalysisClient({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 ContainerAnalysisClient; + 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 = { + notePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notes/{note}' + ), + occurrencePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/occurrences/{occurrence}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.devtools.containeranalysis.v1.ContainerAnalysis', 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.containerAnalysisStub) { + return this.containerAnalysisStub; + } + + // Put together the "service stub" for + // google.devtools.containeranalysis.v1.ContainerAnalysis. + this.containerAnalysisStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.devtools.containeranalysis.v1.ContainerAnalysis') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devtools.containeranalysis.v1.ContainerAnalysis, + 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 containerAnalysisStubMethods = + ['setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'getVulnerabilityOccurrencesSummary']; + for (const methodName of containerAnalysisStubMethods) { + const callPromise = this.containerAnalysisStub.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.containerAnalysisStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'containeranalysis.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 'containeranalysis.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 on the specified note or occurrence. + * Requires `containeranalysis.notes.setIamPolicy` or + * `containeranalysis.occurrences.setIamPolicy` permission if the resource is + * a note or an occurrence, respectively. + * + * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + * occurrences. + * + * @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/container_analysis.set_iam_policy.js + * region_tag:containeranalysis_v1_generated_ContainerAnalysis_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 note or an occurrence resource. + * Requires `containeranalysis.notes.setIamPolicy` or + * `containeranalysis.occurrences.setIamPolicy` permission if the resource is + * a note or occurrence, respectively. + * + * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + * occurrences. + * + * @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/container_analysis.get_iam_policy.js + * region_tag:containeranalysis_v1_generated_ContainerAnalysis_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 the permissions that a caller has on the specified note or + * occurrence. Requires list permission on the project (for example, + * `containeranalysis.notes.list`). + * + * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + * occurrences. + * + * @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/container_analysis.test_iam_permissions.js + * region_tag:containeranalysis_v1_generated_ContainerAnalysis_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 a summary of the number and severity of occurrences. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project to get a vulnerability summary for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary|VulnerabilityOccurrencesSummary}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/container_analysis.get_vulnerability_occurrences_summary.js + * region_tag:containeranalysis_v1_generated_ContainerAnalysis_GetVulnerabilityOccurrencesSummary_async + */ + getVulnerabilityOccurrencesSummary( + request?: protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, + protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|undefined, {}|undefined + ]>; + getVulnerabilityOccurrencesSummary( + request: protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, + protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, + {}|null|undefined>): void; + getVulnerabilityOccurrencesSummary( + request: protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest, + callback: Callback< + protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, + protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, + {}|null|undefined>): void; + getVulnerabilityOccurrencesSummary( + request?: protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, + protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, + protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, + protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.getVulnerabilityOccurrencesSummary(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified note resource name string. + * + * @param {string} project + * @param {string} note + * @returns {string} Resource name string. + */ + notePath(project:string,note:string) { + return this.pathTemplates.notePathTemplate.render({ + project: project, + note: note, + }); + } + + /** + * Parse the project from Note resource. + * + * @param {string} noteName + * A fully-qualified path representing Note resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNoteName(noteName: string) { + return this.pathTemplates.notePathTemplate.match(noteName).project; + } + + /** + * Parse the note from Note resource. + * + * @param {string} noteName + * A fully-qualified path representing Note resource. + * @returns {string} A string representing the note. + */ + matchNoteFromNoteName(noteName: string) { + return this.pathTemplates.notePathTemplate.match(noteName).note; + } + + /** + * Return a fully-qualified occurrence resource name string. + * + * @param {string} project + * @param {string} occurrence + * @returns {string} Resource name string. + */ + occurrencePath(project:string,occurrence:string) { + return this.pathTemplates.occurrencePathTemplate.render({ + project: project, + occurrence: occurrence, + }); + } + + /** + * Parse the project from Occurrence resource. + * + * @param {string} occurrenceName + * A fully-qualified path representing Occurrence resource. + * @returns {string} A string representing the project. + */ + matchProjectFromOccurrenceName(occurrenceName: string) { + return this.pathTemplates.occurrencePathTemplate.match(occurrenceName).project; + } + + /** + * Parse the occurrence from Occurrence resource. + * + * @param {string} occurrenceName + * A fully-qualified path representing Occurrence resource. + * @returns {string} A string representing the occurrence. + */ + matchOccurrenceFromOccurrenceName(occurrenceName: string) { + return this.pathTemplates.occurrencePathTemplate.match(occurrenceName).occurrence; + } + + /** + * 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.containerAnalysisStub && !this._terminated) { + return this.containerAnalysisStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client_config.json b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client_config.json new file mode 100644 index 00000000000..244ccccd2d3 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client_config.json @@ -0,0 +1,42 @@ +{ + "interfaces": { + "google.devtools.containeranalysis.v1.ContainerAnalysis": { + "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": { + "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" + }, + "GetVulnerabilityOccurrencesSummary": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_proto_list.json b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_proto_list.json new file mode 100644 index 00000000000..7def0c8942f --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/devtools/containeranalysis/v1/containeranalysis.proto", + "../../protos/grafeas/v1/attestation.proto", + "../../protos/grafeas/v1/build.proto", + "../../protos/grafeas/v1/common.proto", + "../../protos/grafeas/v1/compliance.proto", + "../../protos/grafeas/v1/cvss.proto", + "../../protos/grafeas/v1/deployment.proto", + "../../protos/grafeas/v1/discovery.proto", + "../../protos/grafeas/v1/dsse_attestation.proto", + "../../protos/grafeas/v1/grafeas.proto", + "../../protos/grafeas/v1/image.proto", + "../../protos/grafeas/v1/intoto_provenance.proto", + "../../protos/grafeas/v1/intoto_statement.proto", + "../../protos/grafeas/v1/package.proto", + "../../protos/grafeas/v1/provenance.proto", + "../../protos/grafeas/v1/severity.proto", + "../../protos/grafeas/v1/slsa_provenance.proto", + "../../protos/grafeas/v1/slsa_provenance_zero_two.proto", + "../../protos/grafeas/v1/upgrade.proto", + "../../protos/grafeas/v1/vex.proto", + "../../protos/grafeas/v1/vulnerability.proto" +] diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..322e34eece8 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/gapic_metadata.json @@ -0,0 +1,229 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.devtools.containeranalysis.v1", + "libraryPackage": "@google-cloud/containeranalysis", + "services": { + "ContainerAnalysis": { + "clients": { + "grpc": { + "libraryClient": "ContainerAnalysisClient", + "rpcs": { + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "GetVulnerabilityOccurrencesSummary": { + "methods": [ + "getVulnerabilityOccurrencesSummary" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ContainerAnalysisClient", + "rpcs": { + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "GetVulnerabilityOccurrencesSummary": { + "methods": [ + "getVulnerabilityOccurrencesSummary" + ] + } + } + } + } + }, + "Grafeas": { + "clients": { + "grpc": { + "libraryClient": "GrafeasClient", + "rpcs": { + "GetOccurrence": { + "methods": [ + "getOccurrence" + ] + }, + "DeleteOccurrence": { + "methods": [ + "deleteOccurrence" + ] + }, + "CreateOccurrence": { + "methods": [ + "createOccurrence" + ] + }, + "BatchCreateOccurrences": { + "methods": [ + "batchCreateOccurrences" + ] + }, + "UpdateOccurrence": { + "methods": [ + "updateOccurrence" + ] + }, + "GetOccurrenceNote": { + "methods": [ + "getOccurrenceNote" + ] + }, + "GetNote": { + "methods": [ + "getNote" + ] + }, + "DeleteNote": { + "methods": [ + "deleteNote" + ] + }, + "CreateNote": { + "methods": [ + "createNote" + ] + }, + "BatchCreateNotes": { + "methods": [ + "batchCreateNotes" + ] + }, + "UpdateNote": { + "methods": [ + "updateNote" + ] + }, + "ListOccurrences": { + "methods": [ + "listOccurrences", + "listOccurrencesStream", + "listOccurrencesAsync" + ] + }, + "ListNotes": { + "methods": [ + "listNotes", + "listNotesStream", + "listNotesAsync" + ] + }, + "ListNoteOccurrences": { + "methods": [ + "listNoteOccurrences", + "listNoteOccurrencesStream", + "listNoteOccurrencesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "GrafeasClient", + "rpcs": { + "GetOccurrence": { + "methods": [ + "getOccurrence" + ] + }, + "DeleteOccurrence": { + "methods": [ + "deleteOccurrence" + ] + }, + "CreateOccurrence": { + "methods": [ + "createOccurrence" + ] + }, + "BatchCreateOccurrences": { + "methods": [ + "batchCreateOccurrences" + ] + }, + "UpdateOccurrence": { + "methods": [ + "updateOccurrence" + ] + }, + "GetOccurrenceNote": { + "methods": [ + "getOccurrenceNote" + ] + }, + "GetNote": { + "methods": [ + "getNote" + ] + }, + "DeleteNote": { + "methods": [ + "deleteNote" + ] + }, + "CreateNote": { + "methods": [ + "createNote" + ] + }, + "BatchCreateNotes": { + "methods": [ + "batchCreateNotes" + ] + }, + "UpdateNote": { + "methods": [ + "updateNote" + ] + }, + "ListOccurrences": { + "methods": [ + "listOccurrences", + "listOccurrencesStream", + "listOccurrencesAsync" + ] + }, + "ListNotes": { + "methods": [ + "listNotes", + "listNotesStream", + "listNotesAsync" + ] + }, + "ListNoteOccurrences": { + "methods": [ + "listNoteOccurrences", + "listNoteOccurrencesStream", + "listNoteOccurrencesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client.ts new file mode 100644 index 00000000000..a7a4b7176ed --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client.ts @@ -0,0 +1,1791 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/grafeas_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './grafeas_client_config.json'; +const version = require('../../../package.json').version; + +/** + * [Grafeas](https://grafeas.io) API. + * + * Retrieves analysis results of Cloud components such as Docker container + * images. + * + * Analysis results are stored as a series of occurrences. An `Occurrence` + * contains information about a specific analysis instance on a resource. An + * occurrence refers to a `Note`. A note contains details describing the + * analysis and is generally stored in a separate project, called a `Provider`. + * Multiple occurrences can refer to the same note. + * + * For example, an SSL vulnerability could affect multiple images. In this case, + * there would be one note for the vulnerability and an occurrence for each + * image with the vulnerability referring to that note. + * @class + * @memberof v1 + */ +export class GrafeasClient { + 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}; + grafeasStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of GrafeasClient. + * + * @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 GrafeasClient({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 GrafeasClient; + 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 = { + notePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notes/{note}' + ), + occurrencePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/occurrences/{occurrence}' + ), + 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 = { + listOccurrences: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'occurrences'), + listNotes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notes'), + listNoteOccurrences: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'occurrences') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.devtools.containeranalysis.v1.Grafeas', 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.grafeasStub) { + return this.grafeasStub; + } + + // Put together the "service stub" for + // google.devtools.containeranalysis.v1.Grafeas. + this.grafeasStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.devtools.containeranalysis.v1.Grafeas') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devtools.containeranalysis.v1.Grafeas, + 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 grafeasStubMethods = + ['getOccurrence', 'listOccurrences', 'deleteOccurrence', 'createOccurrence', 'batchCreateOccurrences', 'updateOccurrence', 'getOccurrenceNote', 'getNote', 'listNotes', 'deleteNote', 'createNote', 'batchCreateNotes', 'updateNote', 'listNoteOccurrences']; + for (const methodName of grafeasStubMethods) { + const callPromise = this.grafeasStub.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.grafeasStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'containeranalysis.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 'containeranalysis.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 []; + } + + 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 specified occurrence. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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.grafeas.v1.Occurrence|Occurrence}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/grafeas.get_occurrence.js + * region_tag:containeranalysis_v1_generated_Grafeas_GetOccurrence_async + */ + getOccurrence( + request?: protos.grafeas.v1.IGetOccurrenceRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IGetOccurrenceRequest|undefined, {}|undefined + ]>; + getOccurrence( + request: protos.grafeas.v1.IGetOccurrenceRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IGetOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + getOccurrence( + request: protos.grafeas.v1.IGetOccurrenceRequest, + callback: Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IGetOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + getOccurrence( + request?: protos.grafeas.v1.IGetOccurrenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IGetOccurrenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IGetOccurrenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IGetOccurrenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getOccurrence(request, options, callback); + } +/** + * Deletes the specified occurrence. For example, use this method to delete an + * occurrence when the occurrence is no longer applicable for the given + * resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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/grafeas.delete_occurrence.js + * region_tag:containeranalysis_v1_generated_Grafeas_DeleteOccurrence_async + */ + deleteOccurrence( + request?: protos.grafeas.v1.IDeleteOccurrenceRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteOccurrenceRequest|undefined, {}|undefined + ]>; + deleteOccurrence( + request: protos.grafeas.v1.IDeleteOccurrenceRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + deleteOccurrence( + request: protos.grafeas.v1.IDeleteOccurrenceRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + deleteOccurrence( + request?: protos.grafeas.v1.IDeleteOccurrenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteOccurrenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteOccurrenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteOccurrenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteOccurrence(request, options, callback); + } +/** + * Creates a new occurrence. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrence is to be created. + * @param {grafeas.v1.Occurrence} request.occurrence + * The occurrence 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 {@link protos.grafeas.v1.Occurrence|Occurrence}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/grafeas.create_occurrence.js + * region_tag:containeranalysis_v1_generated_Grafeas_CreateOccurrence_async + */ + createOccurrence( + request?: protos.grafeas.v1.ICreateOccurrenceRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.ICreateOccurrenceRequest|undefined, {}|undefined + ]>; + createOccurrence( + request: protos.grafeas.v1.ICreateOccurrenceRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.ICreateOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + createOccurrence( + request: protos.grafeas.v1.ICreateOccurrenceRequest, + callback: Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.ICreateOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + createOccurrence( + request?: protos.grafeas.v1.ICreateOccurrenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.ICreateOccurrenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.ICreateOccurrenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.ICreateOccurrenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createOccurrence(request, options, callback); + } +/** + * Creates new occurrences in batch. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrences are to be created. + * @param {number[]} request.occurrences + * The occurrences to create. Max allowed length is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.grafeas.v1.BatchCreateOccurrencesResponse|BatchCreateOccurrencesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/grafeas.batch_create_occurrences.js + * region_tag:containeranalysis_v1_generated_Grafeas_BatchCreateOccurrences_async + */ + batchCreateOccurrences( + request?: protos.grafeas.v1.IBatchCreateOccurrencesRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1.IBatchCreateOccurrencesRequest|undefined, {}|undefined + ]>; + batchCreateOccurrences( + request: protos.grafeas.v1.IBatchCreateOccurrencesRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1.IBatchCreateOccurrencesRequest|null|undefined, + {}|null|undefined>): void; + batchCreateOccurrences( + request: protos.grafeas.v1.IBatchCreateOccurrencesRequest, + callback: Callback< + protos.grafeas.v1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1.IBatchCreateOccurrencesRequest|null|undefined, + {}|null|undefined>): void; + batchCreateOccurrences( + request?: protos.grafeas.v1.IBatchCreateOccurrencesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1.IBatchCreateOccurrencesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1.IBatchCreateOccurrencesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1.IBatchCreateOccurrencesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateOccurrences(request, options, callback); + } +/** + * Updates the specified occurrence. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @param {grafeas.v1.Occurrence} request.occurrence + * The updated occurrence. + * @param {google.protobuf.FieldMask} request.updateMask + * The fields to update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.grafeas.v1.Occurrence|Occurrence}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/grafeas.update_occurrence.js + * region_tag:containeranalysis_v1_generated_Grafeas_UpdateOccurrence_async + */ + updateOccurrence( + request?: protos.grafeas.v1.IUpdateOccurrenceRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IUpdateOccurrenceRequest|undefined, {}|undefined + ]>; + updateOccurrence( + request: protos.grafeas.v1.IUpdateOccurrenceRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IUpdateOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + updateOccurrence( + request: protos.grafeas.v1.IUpdateOccurrenceRequest, + callback: Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IUpdateOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + updateOccurrence( + request?: protos.grafeas.v1.IUpdateOccurrenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IUpdateOccurrenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IUpdateOccurrenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IUpdateOccurrenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateOccurrence(request, options, callback); + } +/** + * Gets the note attached to the specified occurrence. Consumer projects can + * use this method to get a note that belongs to a provider project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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.grafeas.v1.Note|Note}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/grafeas.get_occurrence_note.js + * region_tag:containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_async + */ + getOccurrenceNote( + request?: protos.grafeas.v1.IGetOccurrenceNoteRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetOccurrenceNoteRequest|undefined, {}|undefined + ]>; + getOccurrenceNote( + request: protos.grafeas.v1.IGetOccurrenceNoteRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetOccurrenceNoteRequest|null|undefined, + {}|null|undefined>): void; + getOccurrenceNote( + request: protos.grafeas.v1.IGetOccurrenceNoteRequest, + callback: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetOccurrenceNoteRequest|null|undefined, + {}|null|undefined>): void; + getOccurrenceNote( + request?: protos.grafeas.v1.IGetOccurrenceNoteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetOccurrenceNoteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetOccurrenceNoteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetOccurrenceNoteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getOccurrenceNote(request, options, callback); + } +/** + * Gets the specified note. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_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.grafeas.v1.Note|Note}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/grafeas.get_note.js + * region_tag:containeranalysis_v1_generated_Grafeas_GetNote_async + */ + getNote( + request?: protos.grafeas.v1.IGetNoteRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetNoteRequest|undefined, {}|undefined + ]>; + getNote( + request: protos.grafeas.v1.IGetNoteRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetNoteRequest|null|undefined, + {}|null|undefined>): void; + getNote( + request: protos.grafeas.v1.IGetNoteRequest, + callback: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetNoteRequest|null|undefined, + {}|null|undefined>): void; + getNote( + request?: protos.grafeas.v1.IGetNoteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetNoteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetNoteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetNoteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getNote(request, options, callback); + } +/** + * Deletes the specified note. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_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/grafeas.delete_note.js + * region_tag:containeranalysis_v1_generated_Grafeas_DeleteNote_async + */ + deleteNote( + request?: protos.grafeas.v1.IDeleteNoteRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteNoteRequest|undefined, {}|undefined + ]>; + deleteNote( + request: protos.grafeas.v1.IDeleteNoteRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteNoteRequest|null|undefined, + {}|null|undefined>): void; + deleteNote( + request: protos.grafeas.v1.IDeleteNoteRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteNoteRequest|null|undefined, + {}|null|undefined>): void; + deleteNote( + request?: protos.grafeas.v1.IDeleteNoteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteNoteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteNoteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteNoteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteNote(request, options, callback); + } +/** + * Creates a new note. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the note is to be created. + * @param {string} request.noteId + * The ID to use for this note. + * @param {grafeas.v1.Note} request.note + * The note 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 {@link protos.grafeas.v1.Note|Note}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/grafeas.create_note.js + * region_tag:containeranalysis_v1_generated_Grafeas_CreateNote_async + */ + createNote( + request?: protos.grafeas.v1.ICreateNoteRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.INote, + protos.grafeas.v1.ICreateNoteRequest|undefined, {}|undefined + ]>; + createNote( + request: protos.grafeas.v1.ICreateNoteRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.ICreateNoteRequest|null|undefined, + {}|null|undefined>): void; + createNote( + request: protos.grafeas.v1.ICreateNoteRequest, + callback: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.ICreateNoteRequest|null|undefined, + {}|null|undefined>): void; + createNote( + request?: protos.grafeas.v1.ICreateNoteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.ICreateNoteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.ICreateNoteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1.INote, + protos.grafeas.v1.ICreateNoteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createNote(request, options, callback); + } +/** + * Creates new notes in batch. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the notes are to be created. + * @param {number[]} request.notes + * The notes to create. Max allowed length is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.grafeas.v1.BatchCreateNotesResponse|BatchCreateNotesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/grafeas.batch_create_notes.js + * region_tag:containeranalysis_v1_generated_Grafeas_BatchCreateNotes_async + */ + batchCreateNotes( + request?: protos.grafeas.v1.IBatchCreateNotesRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.IBatchCreateNotesResponse, + protos.grafeas.v1.IBatchCreateNotesRequest|undefined, {}|undefined + ]>; + batchCreateNotes( + request: protos.grafeas.v1.IBatchCreateNotesRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1.IBatchCreateNotesResponse, + protos.grafeas.v1.IBatchCreateNotesRequest|null|undefined, + {}|null|undefined>): void; + batchCreateNotes( + request: protos.grafeas.v1.IBatchCreateNotesRequest, + callback: Callback< + protos.grafeas.v1.IBatchCreateNotesResponse, + protos.grafeas.v1.IBatchCreateNotesRequest|null|undefined, + {}|null|undefined>): void; + batchCreateNotes( + request?: protos.grafeas.v1.IBatchCreateNotesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1.IBatchCreateNotesResponse, + protos.grafeas.v1.IBatchCreateNotesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1.IBatchCreateNotesResponse, + protos.grafeas.v1.IBatchCreateNotesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1.IBatchCreateNotesResponse, + protos.grafeas.v1.IBatchCreateNotesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateNotes(request, options, callback); + } +/** + * Updates the specified note. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param {grafeas.v1.Note} request.note + * The updated note. + * @param {google.protobuf.FieldMask} request.updateMask + * The fields to update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.grafeas.v1.Note|Note}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/grafeas.update_note.js + * region_tag:containeranalysis_v1_generated_Grafeas_UpdateNote_async + */ + updateNote( + request?: protos.grafeas.v1.IUpdateNoteRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.INote, + protos.grafeas.v1.IUpdateNoteRequest|undefined, {}|undefined + ]>; + updateNote( + request: protos.grafeas.v1.IUpdateNoteRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IUpdateNoteRequest|null|undefined, + {}|null|undefined>): void; + updateNote( + request: protos.grafeas.v1.IUpdateNoteRequest, + callback: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IUpdateNoteRequest|null|undefined, + {}|null|undefined>): void; + updateNote( + request?: protos.grafeas.v1.IUpdateNoteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IUpdateNoteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IUpdateNoteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1.INote, + protos.grafeas.v1.IUpdateNoteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateNote(request, options, callback); + } + + /** + * Lists occurrences for the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. Must be positive. Max allowed + * page size is 1000. If not specified, page size defaults to 20. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence}. + * 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 `listOccurrencesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listOccurrences( + request?: protos.grafeas.v1.IListOccurrencesRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.IOccurrence[], + protos.grafeas.v1.IListOccurrencesRequest|null, + protos.grafeas.v1.IListOccurrencesResponse + ]>; + listOccurrences( + request: protos.grafeas.v1.IListOccurrencesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.grafeas.v1.IListOccurrencesRequest, + protos.grafeas.v1.IListOccurrencesResponse|null|undefined, + protos.grafeas.v1.IOccurrence>): void; + listOccurrences( + request: protos.grafeas.v1.IListOccurrencesRequest, + callback: PaginationCallback< + protos.grafeas.v1.IListOccurrencesRequest, + protos.grafeas.v1.IListOccurrencesResponse|null|undefined, + protos.grafeas.v1.IOccurrence>): void; + listOccurrences( + request?: protos.grafeas.v1.IListOccurrencesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.grafeas.v1.IListOccurrencesRequest, + protos.grafeas.v1.IListOccurrencesResponse|null|undefined, + protos.grafeas.v1.IOccurrence>, + callback?: PaginationCallback< + protos.grafeas.v1.IListOccurrencesRequest, + protos.grafeas.v1.IListOccurrencesResponse|null|undefined, + protos.grafeas.v1.IOccurrence>): + Promise<[ + protos.grafeas.v1.IOccurrence[], + protos.grafeas.v1.IListOccurrencesRequest|null, + protos.grafeas.v1.IListOccurrencesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listOccurrences(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 name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. Must be positive. Max allowed + * page size is 1000. If not specified, page size defaults to 20. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence} 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 `listOccurrencesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listOccurrencesStream( + request?: protos.grafeas.v1.IListOccurrencesRequest, + 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['listOccurrences']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listOccurrences.createStream( + this.innerApiCalls.listOccurrences as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listOccurrences`, 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 name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. Must be positive. Max allowed + * page size is 1000. If not specified, page size defaults to 20. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence}. 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/grafeas.list_occurrences.js + * region_tag:containeranalysis_v1_generated_Grafeas_ListOccurrences_async + */ + listOccurrencesAsync( + request?: protos.grafeas.v1.IListOccurrencesRequest, + 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['listOccurrences']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listOccurrences.asyncIterate( + this.innerApiCalls['listOccurrences'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists notes for the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of notes to return in the list. Must be positive. Max allowed page + * size is 1000. If not specified, page size defaults to 20. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1.Note|Note}. + * 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 `listNotesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNotes( + request?: protos.grafeas.v1.IListNotesRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.INote[], + protos.grafeas.v1.IListNotesRequest|null, + protos.grafeas.v1.IListNotesResponse + ]>; + listNotes( + request: protos.grafeas.v1.IListNotesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.grafeas.v1.IListNotesRequest, + protos.grafeas.v1.IListNotesResponse|null|undefined, + protos.grafeas.v1.INote>): void; + listNotes( + request: protos.grafeas.v1.IListNotesRequest, + callback: PaginationCallback< + protos.grafeas.v1.IListNotesRequest, + protos.grafeas.v1.IListNotesResponse|null|undefined, + protos.grafeas.v1.INote>): void; + listNotes( + request?: protos.grafeas.v1.IListNotesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.grafeas.v1.IListNotesRequest, + protos.grafeas.v1.IListNotesResponse|null|undefined, + protos.grafeas.v1.INote>, + callback?: PaginationCallback< + protos.grafeas.v1.IListNotesRequest, + protos.grafeas.v1.IListNotesResponse|null|undefined, + protos.grafeas.v1.INote>): + Promise<[ + protos.grafeas.v1.INote[], + protos.grafeas.v1.IListNotesRequest|null, + protos.grafeas.v1.IListNotesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listNotes(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 name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of notes to return in the list. Must be positive. Max allowed page + * size is 1000. If not specified, page size defaults to 20. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1.Note|Note} 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 `listNotesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNotesStream( + request?: protos.grafeas.v1.IListNotesRequest, + 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['listNotes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotes.createStream( + this.innerApiCalls.listNotes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNotes`, 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 name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of notes to return in the list. Must be positive. Max allowed page + * size is 1000. If not specified, page size defaults to 20. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1.Note|Note}. 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/grafeas.list_notes.js + * region_tag:containeranalysis_v1_generated_Grafeas_ListNotes_async + */ + listNotesAsync( + request?: protos.grafeas.v1.IListNotesRequest, + 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['listNotes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotes.asyncIterate( + this.innerApiCalls['listNotes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists occurrences referencing the specified note. Provider projects can use + * this method to get all occurrences across consumer projects referencing the + * specified note. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence}. + * 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 `listNoteOccurrencesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNoteOccurrences( + request?: protos.grafeas.v1.IListNoteOccurrencesRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1.IOccurrence[], + protos.grafeas.v1.IListNoteOccurrencesRequest|null, + protos.grafeas.v1.IListNoteOccurrencesResponse + ]>; + listNoteOccurrences( + request: protos.grafeas.v1.IListNoteOccurrencesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.grafeas.v1.IListNoteOccurrencesRequest, + protos.grafeas.v1.IListNoteOccurrencesResponse|null|undefined, + protos.grafeas.v1.IOccurrence>): void; + listNoteOccurrences( + request: protos.grafeas.v1.IListNoteOccurrencesRequest, + callback: PaginationCallback< + protos.grafeas.v1.IListNoteOccurrencesRequest, + protos.grafeas.v1.IListNoteOccurrencesResponse|null|undefined, + protos.grafeas.v1.IOccurrence>): void; + listNoteOccurrences( + request?: protos.grafeas.v1.IListNoteOccurrencesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.grafeas.v1.IListNoteOccurrencesRequest, + protos.grafeas.v1.IListNoteOccurrencesResponse|null|undefined, + protos.grafeas.v1.IOccurrence>, + callback?: PaginationCallback< + protos.grafeas.v1.IListNoteOccurrencesRequest, + protos.grafeas.v1.IListNoteOccurrencesResponse|null|undefined, + protos.grafeas.v1.IOccurrence>): + Promise<[ + protos.grafeas.v1.IOccurrence[], + protos.grafeas.v1.IListNoteOccurrencesRequest|null, + protos.grafeas.v1.IListNoteOccurrencesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.listNoteOccurrences(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.name + * The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence} 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 `listNoteOccurrencesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNoteOccurrencesStream( + request?: protos.grafeas.v1.IListNoteOccurrencesRequest, + 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({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listNoteOccurrences']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNoteOccurrences.createStream( + this.innerApiCalls.listNoteOccurrences as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNoteOccurrences`, 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.name + * The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence}. 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/grafeas.list_note_occurrences.js + * region_tag:containeranalysis_v1_generated_Grafeas_ListNoteOccurrences_async + */ + listNoteOccurrencesAsync( + request?: protos.grafeas.v1.IListNoteOccurrencesRequest, + 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({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listNoteOccurrences']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNoteOccurrences.asyncIterate( + this.innerApiCalls['listNoteOccurrences'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified note resource name string. + * + * @param {string} project + * @param {string} note + * @returns {string} Resource name string. + */ + notePath(project:string,note:string) { + return this.pathTemplates.notePathTemplate.render({ + project: project, + note: note, + }); + } + + /** + * Parse the project from Note resource. + * + * @param {string} noteName + * A fully-qualified path representing Note resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNoteName(noteName: string) { + return this.pathTemplates.notePathTemplate.match(noteName).project; + } + + /** + * Parse the note from Note resource. + * + * @param {string} noteName + * A fully-qualified path representing Note resource. + * @returns {string} A string representing the note. + */ + matchNoteFromNoteName(noteName: string) { + return this.pathTemplates.notePathTemplate.match(noteName).note; + } + + /** + * Return a fully-qualified occurrence resource name string. + * + * @param {string} project + * @param {string} occurrence + * @returns {string} Resource name string. + */ + occurrencePath(project:string,occurrence:string) { + return this.pathTemplates.occurrencePathTemplate.render({ + project: project, + occurrence: occurrence, + }); + } + + /** + * Parse the project from Occurrence resource. + * + * @param {string} occurrenceName + * A fully-qualified path representing Occurrence resource. + * @returns {string} A string representing the project. + */ + matchProjectFromOccurrenceName(occurrenceName: string) { + return this.pathTemplates.occurrencePathTemplate.match(occurrenceName).project; + } + + /** + * Parse the occurrence from Occurrence resource. + * + * @param {string} occurrenceName + * A fully-qualified path representing Occurrence resource. + * @returns {string} A string representing the occurrence. + */ + matchOccurrenceFromOccurrenceName(occurrenceName: string) { + return this.pathTemplates.occurrencePathTemplate.match(occurrenceName).occurrence; + } + + /** + * 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.grafeasStub && !this._terminated) { + return this.grafeasStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client_config.json b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client_config.json new file mode 100644 index 00000000000..5a325a2642b --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client_config.json @@ -0,0 +1,82 @@ +{ + "interfaces": { + "google.devtools.containeranalysis.v1.Grafeas": { + "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": { + "GetOccurrence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListOccurrences": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteOccurrence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateOccurrence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchCreateOccurrences": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateOccurrence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetOccurrenceNote": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetNote": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListNotes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNote": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateNote": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchCreateNotes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNote": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListNoteOccurrences": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_proto_list.json b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_proto_list.json new file mode 100644 index 00000000000..7def0c8942f --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/devtools/containeranalysis/v1/containeranalysis.proto", + "../../protos/grafeas/v1/attestation.proto", + "../../protos/grafeas/v1/build.proto", + "../../protos/grafeas/v1/common.proto", + "../../protos/grafeas/v1/compliance.proto", + "../../protos/grafeas/v1/cvss.proto", + "../../protos/grafeas/v1/deployment.proto", + "../../protos/grafeas/v1/discovery.proto", + "../../protos/grafeas/v1/dsse_attestation.proto", + "../../protos/grafeas/v1/grafeas.proto", + "../../protos/grafeas/v1/image.proto", + "../../protos/grafeas/v1/intoto_provenance.proto", + "../../protos/grafeas/v1/intoto_statement.proto", + "../../protos/grafeas/v1/package.proto", + "../../protos/grafeas/v1/provenance.proto", + "../../protos/grafeas/v1/severity.proto", + "../../protos/grafeas/v1/slsa_provenance.proto", + "../../protos/grafeas/v1/slsa_provenance_zero_two.proto", + "../../protos/grafeas/v1/upgrade.proto", + "../../protos/grafeas/v1/vex.proto", + "../../protos/grafeas/v1/vulnerability.proto" +] diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/index.ts new file mode 100644 index 00000000000..acbad9d23df --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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 {ContainerAnalysisClient} from './container_analysis_client'; +export {GrafeasClient} from './grafeas_client'; diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..b1e0d92929f --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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 containeranalysis = require('@google-cloud/containeranalysis'); + +function main() { + const containerAnalysisClient = new containeranalysis.ContainerAnalysisClient(); + const grafeasClient = new containeranalysis.GrafeasClient(); +} + +main(); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..06459bfc2e1 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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 {ContainerAnalysisClient, GrafeasClient} from '@google-cloud/containeranalysis'; + +// check that the client class type name can be used +function doStuffWithContainerAnalysisClient(client: ContainerAnalysisClient) { + client.close(); +} +function doStuffWithGrafeasClient(client: GrafeasClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const containerAnalysisClient = new ContainerAnalysisClient(); + doStuffWithContainerAnalysisClient(containerAnalysisClient); + // check that the client instance can be created + const grafeasClient = new GrafeasClient(); + doStuffWithGrafeasClient(grafeasClient); +} + +main(); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/install.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1/test/gapic_container_analysis_v1.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_container_analysis_v1.ts new file mode 100644 index 00000000000..4a04a18a249 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_container_analysis_v1.ts @@ -0,0 +1,691 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 containeranalysisModule 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.ContainerAnalysisClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = containeranalysisModule.v1.ContainerAnalysisClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = containeranalysisModule.v1.ContainerAnalysisClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = containeranalysisModule.v1.ContainerAnalysisClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new containeranalysisModule.v1.ContainerAnalysisClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.containerAnalysisStub, undefined); + await client.initialize(); + assert(client.containerAnalysisStub); + }); + + it('has close method for the initialized client', done => { + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.containerAnalysisStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.containerAnalysisStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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 containeranalysisModule.v1.ContainerAnalysisClient({ + 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('getVulnerabilityOccurrencesSummary', () => { + it('invokes getVulnerabilityOccurrencesSummary without error', async () => { + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary() + ); + client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCall(expectedResponse); + const [response] = await client.getVulnerabilityOccurrencesSummary(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVulnerabilityOccurrencesSummary without error using callback', async () => { + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary() + ); + client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVulnerabilityOccurrencesSummary( + request, + (err?: Error|null, result?: protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVulnerabilityOccurrencesSummary with error', async () => { + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVulnerabilityOccurrencesSummary(request), expectedError); + const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVulnerabilityOccurrencesSummary with closed client', async () => { + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVulnerabilityOccurrencesSummary(request), expectedError); + }); + }); + + describe('Path templates', () => { + + describe('note', () => { + const fakePath = "/rendered/path/note"; + const expectedParameters = { + project: "projectValue", + note: "noteValue", + }; + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.notePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.notePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('notePath', () => { + const result = client.notePath("projectValue", "noteValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.notePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNoteName', () => { + const result = client.matchProjectFromNoteName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.notePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNoteFromNoteName', () => { + const result = client.matchNoteFromNoteName(fakePath); + assert.strictEqual(result, "noteValue"); + assert((client.pathTemplates.notePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('occurrence', () => { + const fakePath = "/rendered/path/occurrence"; + const expectedParameters = { + project: "projectValue", + occurrence: "occurrenceValue", + }; + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.occurrencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.occurrencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('occurrencePath', () => { + const result = client.occurrencePath("projectValue", "occurrenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.occurrencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromOccurrenceName', () => { + const result = client.matchProjectFromOccurrenceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.occurrencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchOccurrenceFromOccurrenceName', () => { + const result = client.matchOccurrenceFromOccurrenceName(fakePath); + assert.strictEqual(result, "occurrenceValue"); + assert((client.pathTemplates.occurrencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new containeranalysisModule.v1.ContainerAnalysisClient({ + 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-devtools-containeranalysis/v1/test/gapic_grafeas_v1.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_grafeas_v1.ts new file mode 100644 index 00000000000..3cb11ce1fd7 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_grafeas_v1.ts @@ -0,0 +1,2229 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 grafeasModule 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.GrafeasClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = grafeasModule.v1.GrafeasClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = grafeasModule.v1.GrafeasClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = grafeasModule.v1.GrafeasClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new grafeasModule.v1.GrafeasClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new grafeasModule.v1.GrafeasClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.grafeasStub, undefined); + await client.initialize(); + assert(client.grafeasStub); + }); + + it('has close method for the initialized client', done => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.grafeasStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.grafeasStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new grafeasModule.v1.GrafeasClient({ + 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 grafeasModule.v1.GrafeasClient({ + 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('getOccurrence', () => { + it('invokes getOccurrence without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Occurrence() + ); + client.innerApiCalls.getOccurrence = stubSimpleCall(expectedResponse); + const [response] = await client.getOccurrence(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrence without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Occurrence() + ); + client.innerApiCalls.getOccurrence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOccurrence( + request, + (err?: Error|null, result?: protos.grafeas.v1.IOccurrence|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrence with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getOccurrence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOccurrence(request), expectedError); + const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrence with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOccurrence(request), expectedError); + }); + }); + + describe('deleteOccurrence', () => { + it('invokes deleteOccurrence without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.DeleteOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.DeleteOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteOccurrence = stubSimpleCall(expectedResponse); + const [response] = await client.deleteOccurrence(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteOccurrence without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.DeleteOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.DeleteOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteOccurrence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteOccurrence( + 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.deleteOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteOccurrence with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.DeleteOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.DeleteOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteOccurrence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteOccurrence(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteOccurrence with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.DeleteOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.DeleteOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteOccurrence(request), expectedError); + }); + }); + + describe('createOccurrence', () => { + it('invokes createOccurrence without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.CreateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.CreateOccurrenceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Occurrence() + ); + client.innerApiCalls.createOccurrence = stubSimpleCall(expectedResponse); + const [response] = await client.createOccurrence(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createOccurrence without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.CreateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.CreateOccurrenceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Occurrence() + ); + client.innerApiCalls.createOccurrence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createOccurrence( + request, + (err?: Error|null, result?: protos.grafeas.v1.IOccurrence|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createOccurrence with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.CreateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.CreateOccurrenceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createOccurrence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createOccurrence(request), expectedError); + const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createOccurrence with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.CreateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.CreateOccurrenceRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createOccurrence(request), expectedError); + }); + }); + + describe('batchCreateOccurrences', () => { + it('invokes batchCreateOccurrences without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.BatchCreateOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.BatchCreateOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.BatchCreateOccurrencesResponse() + ); + client.innerApiCalls.batchCreateOccurrences = stubSimpleCall(expectedResponse); + const [response] = await client.batchCreateOccurrences(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateOccurrences without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.BatchCreateOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.BatchCreateOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.BatchCreateOccurrencesResponse() + ); + client.innerApiCalls.batchCreateOccurrences = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateOccurrences( + request, + (err?: Error|null, result?: protos.grafeas.v1.IBatchCreateOccurrencesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateOccurrences with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.BatchCreateOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.BatchCreateOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateOccurrences = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchCreateOccurrences(request), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateOccurrences with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.BatchCreateOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.BatchCreateOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.batchCreateOccurrences(request), expectedError); + }); + }); + + describe('updateOccurrence', () => { + it('invokes updateOccurrence without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.UpdateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.UpdateOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Occurrence() + ); + client.innerApiCalls.updateOccurrence = stubSimpleCall(expectedResponse); + const [response] = await client.updateOccurrence(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOccurrence without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.UpdateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.UpdateOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Occurrence() + ); + client.innerApiCalls.updateOccurrence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateOccurrence( + request, + (err?: Error|null, result?: protos.grafeas.v1.IOccurrence|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOccurrence with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.UpdateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.UpdateOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateOccurrence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateOccurrence(request), expectedError); + const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOccurrence with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.UpdateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.UpdateOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateOccurrence(request), expectedError); + }); + }); + + describe('getOccurrenceNote', () => { + it('invokes getOccurrenceNote without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetOccurrenceNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetOccurrenceNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Note() + ); + client.innerApiCalls.getOccurrenceNote = stubSimpleCall(expectedResponse); + const [response] = await client.getOccurrenceNote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrenceNote without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetOccurrenceNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetOccurrenceNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Note() + ); + client.innerApiCalls.getOccurrenceNote = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOccurrenceNote( + request, + (err?: Error|null, result?: protos.grafeas.v1.INote|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrenceNote with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetOccurrenceNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetOccurrenceNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getOccurrenceNote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOccurrenceNote(request), expectedError); + const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrenceNote with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetOccurrenceNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetOccurrenceNoteRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOccurrenceNote(request), expectedError); + }); + }); + + describe('getNote', () => { + it('invokes getNote without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Note() + ); + client.innerApiCalls.getNote = stubSimpleCall(expectedResponse); + const [response] = await client.getNote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNote without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Note() + ); + client.innerApiCalls.getNote = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNote( + request, + (err?: Error|null, result?: protos.grafeas.v1.INote|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNote with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNote(request), expectedError); + const actualRequest = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNote with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.GetNoteRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNote(request), expectedError); + }); + }); + + describe('deleteNote', () => { + it('invokes deleteNote without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.DeleteNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.DeleteNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteNote = stubSimpleCall(expectedResponse); + const [response] = await client.deleteNote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNote without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.DeleteNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.DeleteNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteNote = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNote( + 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.deleteNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNote with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.DeleteNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.DeleteNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteNote(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNote with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.DeleteNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.DeleteNoteRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteNote(request), expectedError); + }); + }); + + describe('createNote', () => { + it('invokes createNote without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.CreateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.CreateNoteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Note() + ); + client.innerApiCalls.createNote = stubSimpleCall(expectedResponse); + const [response] = await client.createNote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNote without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.CreateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.CreateNoteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Note() + ); + client.innerApiCalls.createNote = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNote( + request, + (err?: Error|null, result?: protos.grafeas.v1.INote|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNote with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.CreateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.CreateNoteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createNote(request), expectedError); + const actualRequest = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNote with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.CreateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.CreateNoteRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createNote(request), expectedError); + }); + }); + + describe('batchCreateNotes', () => { + it('invokes batchCreateNotes without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.BatchCreateNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.BatchCreateNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.BatchCreateNotesResponse() + ); + client.innerApiCalls.batchCreateNotes = stubSimpleCall(expectedResponse); + const [response] = await client.batchCreateNotes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateNotes without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.BatchCreateNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.BatchCreateNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.BatchCreateNotesResponse() + ); + client.innerApiCalls.batchCreateNotes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateNotes( + request, + (err?: Error|null, result?: protos.grafeas.v1.IBatchCreateNotesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateNotes with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.BatchCreateNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.BatchCreateNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateNotes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchCreateNotes(request), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateNotes with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.BatchCreateNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.BatchCreateNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.batchCreateNotes(request), expectedError); + }); + }); + + describe('updateNote', () => { + it('invokes updateNote without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.UpdateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.UpdateNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Note() + ); + client.innerApiCalls.updateNote = stubSimpleCall(expectedResponse); + const [response] = await client.updateNote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNote without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.UpdateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.UpdateNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1.Note() + ); + client.innerApiCalls.updateNote = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNote( + request, + (err?: Error|null, result?: protos.grafeas.v1.INote|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNote with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.UpdateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.UpdateNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateNote(request), expectedError); + const actualRequest = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNote with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.UpdateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.UpdateNoteRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateNote(request), expectedError); + }); + }); + + describe('listOccurrences', () => { + it('invokes listOccurrences without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + ]; + client.innerApiCalls.listOccurrences = stubSimpleCall(expectedResponse); + const [response] = await client.listOccurrences(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOccurrences without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + ]; + client.innerApiCalls.listOccurrences = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listOccurrences( + request, + (err?: Error|null, result?: protos.grafeas.v1.IOccurrence[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOccurrences with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listOccurrences = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listOccurrences(request), expectedError); + const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOccurrencesStream without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + ]; + client.descriptors.page.listOccurrences.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listOccurrencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1.Occurrence[] = []; + stream.on('data', (response: protos.grafeas.v1.Occurrence) => { + 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.listOccurrences.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listOccurrences, request)); + assert( + (client.descriptors.page.listOccurrences.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listOccurrencesStream with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listOccurrences.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listOccurrencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1.Occurrence[] = []; + stream.on('data', (response: protos.grafeas.v1.Occurrence) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listOccurrences.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listOccurrences, request)); + assert( + (client.descriptors.page.listOccurrences.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listOccurrences without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + ]; + client.descriptors.page.listOccurrences.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.grafeas.v1.IOccurrence[] = []; + const iterable = client.listOccurrencesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listOccurrences with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listOccurrences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listOccurrencesAsync(request); + await assert.rejects(async () => { + const responses: protos.grafeas.v1.IOccurrence[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listNotes', () => { + it('invokes listNotes without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Note()), + generateSampleMessage(new protos.grafeas.v1.Note()), + generateSampleMessage(new protos.grafeas.v1.Note()), + ]; + client.innerApiCalls.listNotes = stubSimpleCall(expectedResponse); + const [response] = await client.listNotes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotes without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Note()), + generateSampleMessage(new protos.grafeas.v1.Note()), + generateSampleMessage(new protos.grafeas.v1.Note()), + ]; + client.innerApiCalls.listNotes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNotes( + request, + (err?: Error|null, result?: protos.grafeas.v1.INote[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotes with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNotes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNotes(request), expectedError); + const actualRequest = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotesStream without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Note()), + generateSampleMessage(new protos.grafeas.v1.Note()), + generateSampleMessage(new protos.grafeas.v1.Note()), + ]; + client.descriptors.page.listNotes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNotesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1.Note[] = []; + stream.on('data', (response: protos.grafeas.v1.Note) => { + 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.listNotes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotes, request)); + assert( + (client.descriptors.page.listNotes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNotesStream with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNotesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1.Note[] = []; + stream.on('data', (response: protos.grafeas.v1.Note) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNotes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotes, request)); + assert( + (client.descriptors.page.listNotes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNotes without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Note()), + generateSampleMessage(new protos.grafeas.v1.Note()), + generateSampleMessage(new protos.grafeas.v1.Note()), + ]; + client.descriptors.page.listNotes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.grafeas.v1.INote[] = []; + const iterable = client.listNotesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNotes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNotes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNotes with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNotesAsync(request); + await assert.rejects(async () => { + const responses: protos.grafeas.v1.INote[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNotes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNotes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listNoteOccurrences', () => { + it('invokes listNoteOccurrences without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + ]; + client.innerApiCalls.listNoteOccurrences = stubSimpleCall(expectedResponse); + const [response] = await client.listNoteOccurrences(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNoteOccurrences without error using callback', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + ]; + client.innerApiCalls.listNoteOccurrences = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNoteOccurrences( + request, + (err?: Error|null, result?: protos.grafeas.v1.IOccurrence[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNoteOccurrences with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNoteOccurrences = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNoteOccurrences(request), expectedError); + const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNoteOccurrencesStream without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + ]; + client.descriptors.page.listNoteOccurrences.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNoteOccurrencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1.Occurrence[] = []; + stream.on('data', (response: protos.grafeas.v1.Occurrence) => { + 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.listNoteOccurrences.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNoteOccurrences, request)); + assert( + (client.descriptors.page.listNoteOccurrences.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNoteOccurrencesStream with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNoteOccurrences.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNoteOccurrencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1.Occurrence[] = []; + stream.on('data', (response: protos.grafeas.v1.Occurrence) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNoteOccurrences.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNoteOccurrences, request)); + assert( + (client.descriptors.page.listNoteOccurrences.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNoteOccurrences without error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1.Occurrence()), + ]; + client.descriptors.page.listNoteOccurrences.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.grafeas.v1.IOccurrence[] = []; + const iterable = client.listNoteOccurrencesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNoteOccurrences with error', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNoteOccurrences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNoteOccurrencesAsync(request); + await assert.rejects(async () => { + const responses: protos.grafeas.v1.IOccurrence[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('note', () => { + const fakePath = "/rendered/path/note"; + const expectedParameters = { + project: "projectValue", + note: "noteValue", + }; + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.notePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.notePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('notePath', () => { + const result = client.notePath("projectValue", "noteValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.notePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNoteName', () => { + const result = client.matchProjectFromNoteName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.notePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNoteFromNoteName', () => { + const result = client.matchNoteFromNoteName(fakePath); + assert.strictEqual(result, "noteValue"); + assert((client.pathTemplates.notePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('occurrence', () => { + const fakePath = "/rendered/path/occurrence"; + const expectedParameters = { + project: "projectValue", + occurrence: "occurrenceValue", + }; + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.occurrencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.occurrencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('occurrencePath', () => { + const result = client.occurrencePath("projectValue", "occurrenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.occurrencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromOccurrenceName', () => { + const result = client.matchProjectFromOccurrenceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.occurrencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchOccurrenceFromOccurrenceName', () => { + const result = client.matchOccurrenceFromOccurrenceName(fakePath); + assert.strictEqual(result, "occurrenceValue"); + assert((client.pathTemplates.occurrencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new grafeasModule.v1.GrafeasClient({ + 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-devtools-containeranalysis/v1/tsconfig.json b/owl-bot-staging/google-devtools-containeranalysis/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1/webpack.config.js b/owl-bot-staging/google-devtools-containeranalysis/v1/webpack.config.js new file mode 100644 index 00000000000..f9beacf3ce3 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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: 'containeranalysis', + filename: './containeranalysis.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-devtools-containeranalysis/v1beta1/.eslintignore b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintrc.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.gitignore b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1beta1/.jsdoc.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.jsdoc.js new file mode 100644 index 00000000000..bc16644d92f --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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/containeranalysis', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.mocharc.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1beta1/.prettierrc.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1beta1/README.md b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/README.md new file mode 100644 index 00000000000..dc843b72155 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/README.md @@ -0,0 +1 @@ +Containeranalysis: Nodejs Client diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/package.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/package.json new file mode 100644 index 00000000000..da5dd18c670 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/package.json @@ -0,0 +1,59 @@ +{ + "name": "@google-cloud/containeranalysis", + "version": "0.1.0", + "description": "Containeranalysis client for Node.js", + "repository": "googleapis/nodejs-containeranalysis", + "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 containeranalysis", + "containeranalysis", + "container analysis v1 beta1", + "grafeas 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-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto new file mode 100644 index 00000000000..15447183eb0 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto @@ -0,0 +1,170 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.attestation; + +import "google/devtools/containeranalysis/v1beta1/common/common.proto"; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1.attestation"; +option objc_class_prefix = "GRA"; + +// An attestation wrapper with a PGP-compatible signature. This message only +// supports `ATTACHED` signatures, where the payload that is signed is included +// alongside the signature itself in the same file. +message PgpSignedAttestation { + // Required. The raw content of the signature, as output by GNU Privacy Guard + // (GPG) or equivalent. Since this message only supports attached signatures, + // the payload that was signed must be attached. While the signature format + // supported is dependent on the verification implementation, currently only + // ASCII-armored (`--armor` to gpg), non-clearsigned (`--sign` rather than + // `--clearsign` to gpg) are supported. Concretely, `gpg --sign --armor + // --output=signature.gpg payload.json` will create the signature content + // expected in this field in `signature.gpg` for the `payload.json` + // attestation payload. + string signature = 1; + + // Type (for example schema) of the attestation payload that was signed. + enum ContentType { + // `ContentType` is not set. + CONTENT_TYPE_UNSPECIFIED = 0; + // Atomic format attestation signature. See + // https://github.com/containers/image/blob/8a5d2f82a6e3263290c8e0276c3e0f64e77723e7/docs/atomic-signature.md + // The payload extracted from `signature` is a JSON blob conforming to the + // linked schema. + SIMPLE_SIGNING_JSON = 1; + } + + // Type (for example schema) of the attestation payload that was signed. + // The verifier must ensure that the provided type is one that the verifier + // supports, and that the attestation payload is a valid instantiation of that + // type (for example by validating a JSON schema). + ContentType content_type = 3; + + // This field is used by verifiers to select the public key used to validate + // the signature. Note that the policy of the verifier ultimately determines + // which public keys verify a signature based on the context of the + // verification. There is no guarantee validation will succeed if the + // verifier has no key matching this ID, even if it has a key under a + // different ID that would verify the signature. Note that this ID should also + // be present in the signature content above, but that is not expected to be + // used by the verifier. + oneof key_id { + // The cryptographic fingerprint of the key used to generate the signature, + // as output by, e.g. `gpg --list-keys`. This should be the version 4, full + // 160-bit fingerprint, expressed as a 40 character hexidecimal string. See + // https://tools.ietf.org/html/rfc4880#section-12.2 for details. + // Implementations may choose to acknowledge "LONG", "SHORT", or other + // abbreviated key IDs, but only the full fingerprint is guaranteed to work. + // In gpg, the full fingerprint can be retrieved from the `fpr` field + // returned when calling --list-keys with --with-colons. For example: + // ``` + // gpg --with-colons --with-fingerprint --force-v4-certs \ + // --list-keys attester@example.com + // tru::1:1513631572:0:3:1:5 + // pub:...... + // fpr:::::::::24FF6481B76AC91E66A00AC657A93A81EF3AE6FB: + // ``` + // Above, the fingerprint is `24FF6481B76AC91E66A00AC657A93A81EF3AE6FB`. + string pgp_key_id = 2; + } +} + +// An attestation wrapper that uses the Grafeas `Signature` message. +// This attestation must define the `serialized_payload` that the `signatures` +// verify and any metadata necessary to interpret that plaintext. The +// signatures should always be over the `serialized_payload` bytestring. +message GenericSignedAttestation { + // Type of the attestation plaintext that was signed. + enum ContentType { + // `ContentType` is not set. + CONTENT_TYPE_UNSPECIFIED = 0; + // Atomic format attestation signature. See + // https://github.com/containers/image/blob/8a5d2f82a6e3263290c8e0276c3e0f64e77723e7/docs/atomic-signature.md + // The payload extracted in `plaintext` is a JSON blob conforming to the + // linked schema. + SIMPLE_SIGNING_JSON = 1; + } + + // Type (for example schema) of the attestation payload that was signed. + // The verifier must ensure that the provided type is one that the verifier + // supports, and that the attestation payload is a valid instantiation of that + // type (for example by validating a JSON schema). + ContentType content_type = 1; + + // The serialized payload that is verified by one or more `signatures`. + // The encoding and semantic meaning of this payload must match what is set in + // `content_type`. + bytes serialized_payload = 2; + + // One or more signatures over `serialized_payload`. Verifier implementations + // should consider this attestation message verified if at least one + // `signature` verifies `serialized_payload`. See `Signature` in common.proto + // for more details on signature structure and verification. + repeated Signature signatures = 3; +} + +// Note kind that represents a logical attestation "role" or "authority". For +// example, an organization might have one `Authority` for "QA" and one for +// "build". This note is intended to act strictly as a grouping mechanism for +// the attached occurrences (Attestations). This grouping mechanism also +// provides a security boundary, since IAM ACLs gate the ability for a principle +// to attach an occurrence to a given note. It also provides a single point of +// lookup to find all attached attestation occurrences, even if they don't all +// live in the same project. +message Authority { + // This submessage provides human-readable hints about the purpose of the + // authority. Because the name of a note acts as its resource reference, it is + // important to disambiguate the canonical name of the Note (which might be a + // UUID for security purposes) from "readable" names more suitable for debug + // output. Note that these hints should not be used to look up authorities in + // security sensitive contexts, such as when looking up attestations to + // verify. + message Hint { + // Required. The human readable name of this attestation authority, for + // example "qa". + string human_readable_name = 1; + } + + // Hint hints at the purpose of the attestation authority. + Hint hint = 1; +} + +// Details of an attestation occurrence. +message Details { + // Required. Attestation for the resource. + Attestation attestation = 1; +} + +// Occurrence that represents a single "attestation". The authenticity of an +// attestation can be verified using the attached signature. If the verifier +// trusts the public key of the signer, then verifying the signature is +// sufficient to establish trust. In this circumstance, the authority to which +// this attestation is attached is primarily useful for look-up (how to find +// this attestation if you already know the authority and artifact to be +// verified) and intent (which authority was this attestation intended to sign +// for). +message Attestation { + // Required. The signature, generally over the `resource_url`, that verifies + // this attestation. The semantics of the signature veracity are ultimately + // determined by the verification engine. + oneof signature { + // A PGP signed attestation. + PgpSignedAttestation pgp_signed_attestation = 1; + GenericSignedAttestation generic_signed_attestation = 2; + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/build/build.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/build/build.proto new file mode 100644 index 00000000000..dc0f2b4e21b --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/build/build.proto @@ -0,0 +1,96 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.build; + +import "google/devtools/containeranalysis/v1beta1/provenance/provenance.proto"; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1.build"; +option objc_class_prefix = "GRA"; + +// Note holding the version of the provider's builder and the signature of the +// provenance message in the build details occurrence. +message Build { + // Required. Immutable. Version of the builder which produced this build. + string builder_version = 1; + + // Signature of the build in occurrences pointing to this build note + // containing build details. + BuildSignature signature = 2; +} + +// Message encapsulating the signature of the verified build. +message BuildSignature { + // Public key of the builder which can be used to verify that the related + // findings are valid and unchanged. If `key_type` is empty, this defaults + // to PEM encoded public keys. + // + // This field may be empty if `key_id` references an external key. + // + // For Cloud Build based signatures, this is a PEM encoded public + // key. To verify the Cloud Build signature, place the contents of + // this field into a file (public.pem). The signature field is base64-decoded + // into its binary representation in signature.bin, and the provenance bytes + // from `BuildDetails` are base64-decoded into a binary representation in + // signed.bin. OpenSSL can then verify the signature: + // `openssl sha256 -verify public.pem -signature signature.bin signed.bin` + string public_key = 1; + + // Required. Signature of the related `BuildProvenance`. In JSON, this is + // base-64 encoded. + bytes signature = 2; + + // An ID for the key used to sign. This could be either an ID for the key + // stored in `public_key` (such as the ID or fingerprint for a PGP key, or the + // CN for a cert), or a reference to an external key (such as a reference to a + // key in Cloud Key Management Service). + string key_id = 3; + + // Public key formats. + enum KeyType { + // `KeyType` is not set. + KEY_TYPE_UNSPECIFIED = 0; + // `PGP ASCII Armored` public key. + PGP_ASCII_ARMORED = 1; + // `PKIX PEM` public key. + PKIX_PEM = 2; + } + + // The type of the key, either stored in `public_key` or referenced in + // `key_id`. + KeyType key_type = 4; +} + +// Details of a build occurrence. +message Details { + // Required. The actual provenance for the build. + grafeas.v1beta1.provenance.BuildProvenance provenance = 1; + + // Serialized JSON representation of the provenance, used in generating the + // build signature in the corresponding build note. After verifying the + // signature, `provenance_bytes` can be unmarshalled and compared to the + // provenance to confirm that it is unchanged. A base64-encoded string + // representation of the provenance bytes is used for the signature in order + // to interoperate with openssl which expects this format for signature + // verification. + // + // The serialized form is captured both to avoid ambiguity in how the + // provenance is marshalled to json as well to prevent incompatibilities with + // future changes. + string provenance_bytes = 2; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/common/common.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/common/common.proto new file mode 100644 index 00000000000..fd941c83286 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/common/common.proto @@ -0,0 +1,101 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1.common"; +option objc_class_prefix = "GRA"; + +// Kind represents the kinds of notes supported. +enum NoteKind { + // Unknown. + NOTE_KIND_UNSPECIFIED = 0; + // The note and occurrence represent a package vulnerability. + VULNERABILITY = 1; + // The note and occurrence assert build provenance. + BUILD = 2; + // This represents an image basis relationship. + IMAGE = 3; + // This represents a package installed via a package manager. + PACKAGE = 4; + // The note and occurrence track deployment events. + DEPLOYMENT = 5; + // The note and occurrence track the initial discovery status of a resource. + DISCOVERY = 6; + // This represents a logical "role" that can attest to artifacts. + ATTESTATION = 7; +} + +// Metadata for any related URL information. +message RelatedUrl { + // Specific URL associated with the resource. + string url = 1; + // Label to describe usage of the URL. + string label = 2; +} + +// Verifiers (e.g. Kritis implementations) MUST verify signatures +// with respect to the trust anchors defined in policy (e.g. a Kritis policy). +// Typically this means that the verifier has been configured with a map from +// `public_key_id` to public key material (and any required parameters, e.g. +// signing algorithm). +// +// In particular, verification implementations MUST NOT treat the signature +// `public_key_id` as anything more than a key lookup hint. The `public_key_id` +// DOES NOT validate or authenticate a public key; it only provides a mechanism +// for quickly selecting a public key ALREADY CONFIGURED on the verifier through +// a trusted channel. Verification implementations MUST reject signatures in any +// of the following circumstances: +// * The `public_key_id` is not recognized by the verifier. +// * The public key that `public_key_id` refers to does not verify the +// signature with respect to the payload. +// +// The `signature` contents SHOULD NOT be "attached" (where the payload is +// included with the serialized `signature` bytes). Verifiers MUST ignore any +// "attached" payload and only verify signatures with respect to explicitly +// provided payload (e.g. a `payload` field on the proto message that holds +// this Signature, or the canonical serialization of the proto message that +// holds this signature). +message Signature { + // The content of the signature, an opaque bytestring. + // The payload that this signature verifies MUST be unambiguously provided + // with the Signature during verification. A wrapper message might provide + // the payload explicitly. Alternatively, a message might have a canonical + // serialization that can always be unambiguously computed to derive the + // payload. + bytes signature = 1; + + // The identifier for the public key that verifies this signature. + // * The `public_key_id` is required. + // * The `public_key_id` MUST be an RFC3986 conformant URI. + // * When possible, the `public_key_id` SHOULD be an immutable reference, + // such as a cryptographic digest. + // + // Examples of valid `public_key_id`s: + // + // OpenPGP V4 public key fingerprint: + // * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" + // See https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr for more + // details on this scheme. + // + // RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER + // serialization): + // * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU" + // * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5" + string public_key_id = 2; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto new file mode 100644 index 00000000000..b8eacc87543 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto @@ -0,0 +1,148 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.devtools.containeranalysis.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "com.google.containeranalysis.v1beta1"; +option objc_class_prefix = "GCA"; + +// Retrieves analysis results of Cloud components such as Docker container +// images. The Container Analysis API is an implementation of the +// [Grafeas](https://grafeas.io) API. +// +// Analysis results are stored as a series of occurrences. An `Occurrence` +// contains information about a specific analysis instance on a resource. An +// occurrence refers to a `Note`. A note contains details describing the +// analysis and is generally stored in a separate project, called a `Provider`. +// Multiple occurrences can refer to the same note. +// +// For example, an SSL vulnerability could affect multiple images. In this case, +// there would be one note for the vulnerability and an occurrence for each +// image with the vulnerability referring to that note. +service ContainerAnalysisV1Beta1 { + option (google.api.default_host) = "containeranalysis.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Sets the access control policy on the specified note or occurrence. + // Requires `containeranalysis.notes.setIamPolicy` or + // `containeranalysis.occurrences.setIamPolicy` permission if the resource is + // a note or an occurrence, respectively. + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1beta1/{resource=projects/*/notes/*}:setIamPolicy" + body: "*" + additional_bindings { + post: "/v1beta1/{resource=projects/*/occurrences/*}:setIamPolicy" + body: "*" + } + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Gets the access control policy for a note or an occurrence resource. + // Requires `containeranalysis.notes.setIamPolicy` or + // `containeranalysis.occurrences.setIamPolicy` permission if the resource is + // a note or occurrence, respectively. + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1beta1/{resource=projects/*/notes/*}:getIamPolicy" + body: "*" + additional_bindings { + post: "/v1beta1/{resource=projects/*/occurrences/*}:getIamPolicy" + body: "*" + } + }; + option (google.api.method_signature) = "resource"; + } + + // Returns the permissions that a caller has on the specified note or + // occurrence. Requires list permission on the project (for example, + // `containeranalysis.notes.list`). + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1beta1/{resource=projects/*/notes/*}:testIamPermissions" + body: "*" + additional_bindings { + post: "/v1beta1/{resource=projects/*/occurrences/*}:testIamPermissions" + body: "*" + } + }; + option (google.api.method_signature) = "resource,permissions"; + } + + // Gets a summary of the packages within a given resource. + rpc GeneratePackagesSummary(GeneratePackagesSummaryRequest) + returns (PackagesSummaryResponse) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/resources/**}:generatePackagesSummary" + body: "*" + }; + } +} + +// GeneratePackagesSummaryRequest is the request body for the +// GeneratePackagesSummary API method. It just takes a single name argument, +// referring to the resource. +message GeneratePackagesSummaryRequest { + // Required. The name of the resource to get a packages summary for in the + // form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// A summary of the packages found within the given resource. +message PackagesSummaryResponse { + // Per license count + message LicensesSummary { + // The license of the package. Note that the format of this value is not + // guaranteed. It may be nil, an empty string, a boolean value (A | B), a + // differently formed boolean value (A OR B), etc... + string license = 1; + + // The number of fixable vulnerabilities associated with this resource. + int64 count = 2; + } + + // The unique URL of the image or the container for which this summary + // applies. + string resource_url = 1; + + // A listing by license name of each of the licenses and their counts. + repeated LicensesSummary licenses_summary = 2; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto new file mode 100644 index 00000000000..8d78138d19e --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto @@ -0,0 +1,85 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.vulnerability; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1.vulnerability"; +option objc_class_prefix = "GRA"; + +// Common Vulnerability Scoring System version 3. +// For details, see https://www.first.org/cvss/specification-document +message CVSSv3 { + // The base score is a function of the base metric scores. + float base_score = 1; + + float exploitability_score = 2; + + float impact_score = 3; + + // Base Metrics + // Represents the intrinsic characteristics of a vulnerability that are + // constant over time and across user environments. + AttackVector attack_vector = 5; + AttackComplexity attack_complexity = 6; + PrivilegesRequired privileges_required = 7; + UserInteraction user_interaction = 8; + Scope scope = 9; + Impact confidentiality_impact = 10; + Impact integrity_impact = 11; + Impact availability_impact = 12; + + enum AttackVector { + ATTACK_VECTOR_UNSPECIFIED = 0; + ATTACK_VECTOR_NETWORK = 1; + ATTACK_VECTOR_ADJACENT = 2; + ATTACK_VECTOR_LOCAL = 3; + ATTACK_VECTOR_PHYSICAL = 4; + } + + enum AttackComplexity { + ATTACK_COMPLEXITY_UNSPECIFIED = 0; + ATTACK_COMPLEXITY_LOW = 1; + ATTACK_COMPLEXITY_HIGH = 2; + } + + enum PrivilegesRequired { + PRIVILEGES_REQUIRED_UNSPECIFIED = 0; + PRIVILEGES_REQUIRED_NONE = 1; + PRIVILEGES_REQUIRED_LOW = 2; + PRIVILEGES_REQUIRED_HIGH = 3; + } + + enum UserInteraction { + USER_INTERACTION_UNSPECIFIED = 0; + USER_INTERACTION_NONE = 1; + USER_INTERACTION_REQUIRED = 2; + } + + enum Scope { + SCOPE_UNSPECIFIED = 0; + SCOPE_UNCHANGED = 1; + SCOPE_CHANGED = 2; + } + + enum Impact { + IMPACT_UNSPECIFIED = 0; + IMPACT_HIGH = 1; + IMPACT_LOW = 2; + IMPACT_NONE = 3; + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto new file mode 100644 index 00000000000..f5e196f67b1 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto @@ -0,0 +1,74 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.deployment; + +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1.deployment"; +option objc_class_prefix = "GRA"; + +// An artifact that can be deployed in some runtime. +message Deployable { + // Required. Resource URI for the artifact being deployed. + repeated string resource_uri = 1; +} + +// Details of a deployment occurrence. +message Details { + // Required. Deployment history for the resource. + Deployment deployment = 1; +} + +// The period during which some deployable was active in a runtime. +message Deployment { + // Identity of the user that triggered this deployment. + string user_email = 1; + + // Required. Beginning of the lifetime of this deployment. + google.protobuf.Timestamp deploy_time = 2; + + // End of the lifetime of this deployment. + google.protobuf.Timestamp undeploy_time = 3; + + // Configuration used to create this deployment. + string config = 4; + + // Address of the runtime element hosting this deployment. + string address = 5; + + // Output only. Resource URI for the artifact being deployed taken from + // the deployable field with the same name. + repeated string resource_uri = 6; + + // Types of platforms. + enum Platform { + // Unknown. + PLATFORM_UNSPECIFIED = 0; + // Google Container Engine. + GKE = 1; + // Google App Engine: Flexible Environment. + FLEX = 2; + // Custom user-defined platform. + CUSTOM = 3; + } + // Platform hosting this deployment. + Platform platform = 7; + + // next_id = 8; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto new file mode 100644 index 00000000000..7e48f772670 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto @@ -0,0 +1,86 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.discovery; + +import "google/devtools/containeranalysis/v1beta1/common/common.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1.discovery"; +option objc_class_prefix = "GRA"; + +// A note that indicates a type of analysis a provider would perform. This note +// exists in a provider's project. A `Discovery` occurrence is created in a +// consumer's project at the start of analysis. +message Discovery { + // Required. Immutable. The kind of analysis that is handled by this + // discovery. + grafeas.v1beta1.NoteKind analysis_kind = 1; +} + +// Details of a discovery occurrence. +message Details { + // Required. Analysis status for the discovered resource. + Discovered discovered = 1; +} + +// Provides information about the analysis status of a discovered resource. +message Discovered { + // Whether the resource is continuously analyzed. + enum ContinuousAnalysis { + // Unknown. + CONTINUOUS_ANALYSIS_UNSPECIFIED = 0; + // The resource is continuously analyzed. + ACTIVE = 1; + // The resource is ignored for continuous analysis. + INACTIVE = 2; + } + + // Whether the resource is continuously analyzed. + ContinuousAnalysis continuous_analysis = 1; + + // The last time continuous analysis was done for this resource. + google.protobuf.Timestamp last_analysis_time = 2; + + // Analysis status for a resource. Currently for initial analysis only (not + // updated in continuous analysis). + enum AnalysisStatus { + // Unknown. + ANALYSIS_STATUS_UNSPECIFIED = 0; + // Resource is known but no action has been taken yet. + PENDING = 1; + // Resource is being analyzed. + SCANNING = 2; + // Analysis has finished successfully. + FINISHED_SUCCESS = 3; + // Analysis has finished unsuccessfully, the analysis itself is in a bad + // state. + FINISHED_FAILED = 4; + // The resource is known not to be supported + FINISHED_UNSUPPORTED = 5; + } + + // The status of discovery for the resource. + AnalysisStatus analysis_status = 3; + + // When an error is encountered this will contain a LocalizedMessage under + // details to show to the user. The LocalizedMessage is output only and + // populated by the API. + google.rpc.Status analysis_status_error = 4; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto new file mode 100644 index 00000000000..8952164eb44 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto @@ -0,0 +1,506 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/devtools/containeranalysis/v1beta1/attestation/attestation.proto"; +import "google/devtools/containeranalysis/v1beta1/build/build.proto"; +import "google/devtools/containeranalysis/v1beta1/common/common.proto"; +import "google/devtools/containeranalysis/v1beta1/deployment/deployment.proto"; +import "google/devtools/containeranalysis/v1beta1/discovery/discovery.proto"; +import "google/devtools/containeranalysis/v1beta1/image/image.proto"; +import "google/devtools/containeranalysis/v1beta1/package/package.proto"; +import "google/devtools/containeranalysis/v1beta1/provenance/provenance.proto"; +import "google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1"; +option objc_class_prefix = "GRA"; + +// [Grafeas](grafeas.io) API. +// +// Retrieves analysis results of Cloud components such as Docker container +// images. +// +// Analysis results are stored as a series of occurrences. An `Occurrence` +// contains information about a specific analysis instance on a resource. An +// occurrence refers to a `Note`. A note contains details describing the +// analysis and is generally stored in a separate project, called a `Provider`. +// Multiple occurrences can refer to the same note. +// +// For example, an SSL vulnerability could affect multiple images. In this case, +// there would be one note for the vulnerability and an occurrence for each +// image with the vulnerability referring to that note. +service GrafeasV1Beta1 { + option (google.api.default_host) = "containeranalysis.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Gets the specified occurrence. + rpc GetOccurrence(GetOccurrenceRequest) returns (Occurrence) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/occurrences/*}" + }; + } + + // Lists occurrences for the specified project. + rpc ListOccurrences(ListOccurrencesRequest) + returns (ListOccurrencesResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*}/occurrences" + }; + } + + // Deletes the specified occurrence. For example, use this method to delete an + // occurrence when the occurrence is no longer applicable for the given + // resource. + rpc DeleteOccurrence(DeleteOccurrenceRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/occurrences/*}" + }; + } + + // Creates a new occurrence. + rpc CreateOccurrence(CreateOccurrenceRequest) returns (Occurrence) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*}/occurrences" + body: "occurrence" + }; + } + + // Creates new occurrences in batch. + rpc BatchCreateOccurrences(BatchCreateOccurrencesRequest) + returns (BatchCreateOccurrencesResponse) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*}/occurrences:batchCreate" + body: "*" + }; + } + + // Updates the specified occurrence. + rpc UpdateOccurrence(UpdateOccurrenceRequest) returns (Occurrence) { + option (google.api.http) = { + patch: "/v1beta1/{name=projects/*/occurrences/*}" + body: "occurrence" + }; + } + + // Gets the note attached to the specified occurrence. Consumer projects can + // use this method to get a note that belongs to a provider project. + rpc GetOccurrenceNote(GetOccurrenceNoteRequest) returns (Note) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/occurrences/*}/notes" + }; + } + + // Gets the specified note. + rpc GetNote(GetNoteRequest) returns (Note) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/notes/*}" + }; + } + + // Lists notes for the specified project. + rpc ListNotes(ListNotesRequest) returns (ListNotesResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*}/notes" + }; + } + + // Deletes the specified note. + rpc DeleteNote(DeleteNoteRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/notes/*}" + }; + } + + // Creates a new note. + rpc CreateNote(CreateNoteRequest) returns (Note) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*}/notes" + body: "note" + }; + } + + // Creates new notes in batch. + rpc BatchCreateNotes(BatchCreateNotesRequest) + returns (BatchCreateNotesResponse) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*}/notes:batchCreate" + body: "*" + }; + } + + // Updates the specified note. + rpc UpdateNote(UpdateNoteRequest) returns (Note) { + option (google.api.http) = { + patch: "/v1beta1/{name=projects/*/notes/*}" + body: "note" + }; + } + + // Lists occurrences referencing the specified note. Provider projects can use + // this method to get all occurrences across consumer projects referencing the + // specified note. + rpc ListNoteOccurrences(ListNoteOccurrencesRequest) + returns (ListNoteOccurrencesResponse) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/notes/*}/occurrences" + }; + } + + // Gets a summary of the number and severity of occurrences. + rpc GetVulnerabilityOccurrencesSummary( + GetVulnerabilityOccurrencesSummaryRequest) + returns (VulnerabilityOccurrencesSummary) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*}/occurrences:vulnerabilitySummary" + }; + } +} + +// An instance of an analysis type that has been found on a resource. +message Occurrence { + // Output only. The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1; + + // Required. Immutable. The resource for which the occurrence applies. + Resource resource = 2; + + // Required. Immutable. The analysis note associated with this occurrence, in + // the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be + // used as a filter in list requests. + string note_name = 3; + + // Output only. This explicitly denotes which of the occurrence details are + // specified. This field can be used as a filter in list requests. + grafeas.v1beta1.NoteKind kind = 4; + + // A description of actions that can be taken to remedy the note. + string remediation = 5; + + // Output only. The time this occurrence was created. + google.protobuf.Timestamp create_time = 6; + + // Output only. The time this occurrence was last updated. + google.protobuf.Timestamp update_time = 7; + + // Required. Immutable. Describes the details of the note kind found on this + // resource. + oneof details { + // Describes a security vulnerability. + grafeas.v1beta1.vulnerability.Details vulnerability = 8; + // Describes a verifiable build. + grafeas.v1beta1.build.Details build = 9; + // Describes how this resource derives from the basis in the associated + // note. + grafeas.v1beta1.image.Details derived_image = 10; + // Describes the installation of a package on the linked resource. + grafeas.v1beta1.package.Details installation = 11; + // Describes the deployment of an artifact on a runtime. + grafeas.v1beta1.deployment.Details deployment = 12; + // Describes when a resource was discovered. + grafeas.v1beta1.discovery.Details discovered = 13; + // Describes an attestation of an artifact. + grafeas.v1beta1.attestation.Details attestation = 14; + } + + // next_id = 15; +} + +// An entity that can have metadata. For example, a Docker image. +message Resource { + // The name of the resource. For example, the name of a Docker image - + // "Debian". + string name = 1; + // Required. The unique URI of the resource. For example, + // `https://gcr.io/project/image@sha256:foo` for a Docker image. + string uri = 2; + // The hash of the resource content. For example, the Docker digest. + grafeas.v1beta1.provenance.Hash content_hash = 3; + + // next_id = 4; +} + +// A type of analysis that can be done for a resource. +message Note { + // Output only. The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1; + + // A one sentence description of this note. + string short_description = 2; + + // A detailed description of this note. + string long_description = 3; + + // Output only. The type of analysis. This field can be used as a filter in + // list requests. + grafeas.v1beta1.NoteKind kind = 4; + + // URLs associated with this note. + repeated grafeas.v1beta1.RelatedUrl related_url = 5; + + // Time of expiration for this note. Empty if note does not expire. + google.protobuf.Timestamp expiration_time = 6; + + // Output only. The time this note was created. This field can be used as a + // filter in list requests. + google.protobuf.Timestamp create_time = 7; + + // Output only. The time this note was last updated. This field can be used as + // a filter in list requests. + google.protobuf.Timestamp update_time = 8; + + // Other notes related to this note. + repeated string related_note_names = 9; + + // Required. Immutable. The type of analysis this note represents. + oneof type { + // A note describing a package vulnerability. + grafeas.v1beta1.vulnerability.Vulnerability vulnerability = 10; + // A note describing build provenance for a verifiable build. + grafeas.v1beta1.build.Build build = 11; + // A note describing a base image. + grafeas.v1beta1.image.Basis base_image = 12; + // A note describing a package hosted by various package managers. + grafeas.v1beta1.package.Package package = 13; + // A note describing something that can be deployed. + grafeas.v1beta1.deployment.Deployable deployable = 14; + // A note describing the initial analysis of a resource. + grafeas.v1beta1.discovery.Discovery discovery = 15; + // A note describing an attestation role. + grafeas.v1beta1.attestation.Authority attestation_authority = 16; + } + + // next_id = 17; +} + +// Request to get an occurrence. +message GetOccurrenceRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1; +} + +// Request to list occurrences. +message ListOccurrencesRequest { + // The name of the project to list occurrences for in the form of + // `projects/[PROJECT_ID]`. + string parent = 1; + + // The filter expression. + string filter = 2; + + // Number of occurrences to return in the list. + int32 page_size = 3; + + // Token to provide to skip to a particular spot in the list. + string page_token = 4; + + // next_id = 7; +} + +// Response for listing occurrences. +message ListOccurrencesResponse { + // The occurrences requested. + repeated Occurrence occurrences = 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 + // results. + string next_page_token = 2; +} + +// Request to delete a occurrence. +message DeleteOccurrenceRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1; +} + +// Request to create a new occurrence. +message CreateOccurrenceRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the occurrence is to be created. + string parent = 1; + // The occurrence to create. + Occurrence occurrence = 2; +} + +// Request to update an occurrence. +message UpdateOccurrenceRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1; + // The updated occurrence. + Occurrence occurrence = 2; + // The fields to update. + google.protobuf.FieldMask update_mask = 3; +} + +// Request to get a note. +message GetNoteRequest { + // The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1; +} + +// Request to get the note to which the specified occurrence is attached. +message GetOccurrenceNoteRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1; +} + +// Request to list notes. +message ListNotesRequest { + // The name of the project to list notes for in the form of + // `projects/[PROJECT_ID]`. + string parent = 1; + // The filter expression. + string filter = 2; + // Number of notes to return in the list. + int32 page_size = 3; + // Token to provide to skip to a particular spot in the list. + string page_token = 4; +} + +// Response for listing notes. +message ListNotesResponse { + // The notes requested. + repeated Note notes = 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 + // results. + string next_page_token = 2; +} + +// Request to delete a note. +message DeleteNoteRequest { + // The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1; +} + +// Request to create a new note. +message CreateNoteRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the note is to be created. + string parent = 1; + // The ID to use for this note. + string note_id = 2; + // The note to create. + Note note = 3; +} + +// Request to update a note. +message UpdateNoteRequest { + // The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1; + // The updated note. + Note note = 2; + // The fields to update. + google.protobuf.FieldMask update_mask = 3; +} + +// Request to list occurrences for a note. +message ListNoteOccurrencesRequest { + // The name of the note to list occurrences for in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1; + // The filter expression. + string filter = 2; + // Number of occurrences to return in the list. + int32 page_size = 3; + // Token to provide to skip to a particular spot in the list. + string page_token = 4; +} + +// Response for listing occurrences for a note. +message ListNoteOccurrencesResponse { + // The occurrences attached to the specified note. + repeated Occurrence occurrences = 1; + // Token to provide to skip to a particular spot in the list. + string next_page_token = 2; +} + +// Request to create notes in batch. +message BatchCreateNotesRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the notes are to be created. + string parent = 1; + + // The notes to create. + map notes = 2; +} + +// Response for creating notes in batch. +message BatchCreateNotesResponse { + // The notes that were created. + repeated Note notes = 1; +} + +// Request to create occurrences in batch. +message BatchCreateOccurrencesRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the occurrences are to be created. + string parent = 1; + // The occurrences to create. + repeated Occurrence occurrences = 2; +} + +// Response for creating occurrences in batch. +message BatchCreateOccurrencesResponse { + // The occurrences that were created. + repeated Occurrence occurrences = 1; +} + +// Request to get a vulnerability summary for some set of occurrences. +message GetVulnerabilityOccurrencesSummaryRequest { + // The name of the project to get a vulnerability summary for in the form of + // `projects/[PROJECT_ID]`. + string parent = 1; + // The filter expression. + string filter = 2; +} + +// A summary of how many vulnerability occurrences there are per resource and +// severity type. +message VulnerabilityOccurrencesSummary { + // A listing by resource of the number of fixable and total vulnerabilities. + repeated FixableTotalByDigest counts = 1; + + // Per resource and severity counts of fixable and total vulnerabilities. + message FixableTotalByDigest { + // The affected resource. + Resource resource = 1; + // The severity for this count. SEVERITY_UNSPECIFIED indicates total across + // all severities. + grafeas.v1beta1.vulnerability.Severity severity = 2; + // The number of fixable vulnerabilities associated with this resource. + int64 fixable_count = 3; + // The total number of vulnerabilities associated with this resource. + int64 total_count = 4; + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/image/image.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/image/image.proto new file mode 100644 index 00000000000..1493c0516b0 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/image/image.proto @@ -0,0 +1,145 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.image; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1.image"; +option objc_class_prefix = "GRA"; + +// Layer holds metadata specific to a layer of a Docker image. +message Layer { + // Instructions from Dockerfile. + enum Directive { + // Default value for unsupported/missing directive. + DIRECTIVE_UNSPECIFIED = 0; + + // https://docs.docker.com/engine/reference/builder/ + MAINTAINER = 1; + + // https://docs.docker.com/engine/reference/builder/ + RUN = 2; + + // https://docs.docker.com/engine/reference/builder/ + CMD = 3; + + // https://docs.docker.com/engine/reference/builder/ + LABEL = 4; + + // https://docs.docker.com/engine/reference/builder/ + EXPOSE = 5; + + // https://docs.docker.com/engine/reference/builder/ + ENV = 6; + + // https://docs.docker.com/engine/reference/builder/ + ADD = 7; + + // https://docs.docker.com/engine/reference/builder/ + COPY = 8; + + // https://docs.docker.com/engine/reference/builder/ + ENTRYPOINT = 9; + + // https://docs.docker.com/engine/reference/builder/ + VOLUME = 10; + + // https://docs.docker.com/engine/reference/builder/ + USER = 11; + + // https://docs.docker.com/engine/reference/builder/ + WORKDIR = 12; + + // https://docs.docker.com/engine/reference/builder/ + ARG = 13; + + // https://docs.docker.com/engine/reference/builder/ + ONBUILD = 14; + + // https://docs.docker.com/engine/reference/builder/ + STOPSIGNAL = 15; + + // https://docs.docker.com/engine/reference/builder/ + HEALTHCHECK = 16; + + // https://docs.docker.com/engine/reference/builder/ + SHELL = 17; + } + + // Required. The recovered Dockerfile directive used to construct this layer. + Directive directive = 1; + + // The recovered arguments to the Dockerfile directive. + string arguments = 2; +} + +// A set of properties that uniquely identify a given Docker image. +message Fingerprint { + // Required. The layer ID of the final layer in the Docker image's v1 + // representation. + string v1_name = 1; + + // Required. The ordered list of v2 blobs that represent a given image. + repeated string v2_blob = 2; + + // Output only. The name of the image's v2 blobs computed via: + // [bottom] := v2_blob[bottom] + // [N] := sha256(v2_blob[N] + " " + v2_name[N+1]) + // Only the name of the final blob is kept. + string v2_name = 3; +} + +// Basis describes the base image portion (Note) of the DockerImage +// relationship. Linked occurrences are derived from this or an +// equivalent image via: +// FROM +// Or an equivalent reference, e.g. a tag of the resource_url. +message Basis { + // Required. Immutable. The resource_url for the resource representing the + // basis of associated occurrence images. + string resource_url = 1; + + // Required. Immutable. The fingerprint of the base image. + Fingerprint fingerprint = 2; +} + +// Details of an image occurrence. +message Details { + // Required. Immutable. The child image derived from the base image. + Derived derived_image = 1; +} + +// Derived describes the derived image portion (Occurrence) of the DockerImage +// relationship. This image would be produced from a Dockerfile with FROM +// . +message Derived { + // Required. The fingerprint of the derived image. + Fingerprint fingerprint = 1; + + // Output only. The number of layers by which this image differs from the + // associated image basis. + int32 distance = 2; + + // This contains layer-specific metadata, if populated it has length + // "distance" and is ordered with [distance] being the layer immediately + // following the base image and [1] being the final layer. + repeated Layer layer_info = 3; + + // Output only. This contains the base image URL for the derived image + // occurrence. + string base_resource_url = 4; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/package/package.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/package/package.proto new file mode 100644 index 00000000000..4bc7c2af1f7 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/package/package.proto @@ -0,0 +1,127 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.package; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1.pkg"; +option objc_class_prefix = "GRA"; + +// Instruction set architectures supported by various package managers. +enum Architecture { + // Unknown architecture. + ARCHITECTURE_UNSPECIFIED = 0; + // X86 architecture. + X86 = 1; + // X64 architecture. + X64 = 2; +} + +// This represents a particular channel of distribution for a given package. +// E.g., Debian's jessie-backports dpkg mirror. +message Distribution { + // Required. The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + // denoting the package manager version distributing a package. + string cpe_uri = 1; + + // The CPU architecture for which packages in this distribution channel were + // built. + Architecture architecture = 2; + + // The latest available version of this package in this distribution channel. + Version latest_version = 3; + + // A freeform string denoting the maintainer of this package. + string maintainer = 4; + + // The distribution channel-specific homepage for this package. + string url = 5; + + // The distribution channel-specific description of this package. + string description = 6; +} + +// An occurrence of a particular package installation found within a system's +// filesystem. E.g., glibc was found in `/var/lib/dpkg/status`. +message Location { + // Required. The CPE URI in [CPE format](https://cpe.mitre.org/specification/) + // denoting the package manager version distributing a package. + string cpe_uri = 1; + + // The version installed at this location. + Version version = 2; + + // The path from which we gathered that this package/version is installed. + string path = 3; +} + +// This represents a particular package that is distributed over various +// channels. E.g., glibc (aka libc6) is distributed by many, at various +// versions. +message Package { + // Required. Immutable. The name of the package. + string name = 1; + + // The various channels by which a package is distributed. + repeated Distribution distribution = 10; +} + +// Details of a package occurrence. +message Details { + // Required. Where the package was installed. + Installation installation = 1; +} + +// This represents how a particular software package may be installed on a +// system. +message Installation { + // Output only. The name of the installed package. + string name = 1; + + // Required. All of the places within the filesystem versions of this package + // have been found. + repeated Location location = 2; +} + +// Version contains structured information about the version of a package. +message Version { + // Used to correct mistakes in the version numbering scheme. + int32 epoch = 1; + + // Required only when version kind is NORMAL. The main part of the version + // name. + string name = 2; + + // The iteration of the package build from the above version. + string revision = 3; + + // Whether this is an ordinary package version or a sentinel MIN/MAX version. + enum VersionKind { + // Unknown. + VERSION_KIND_UNSPECIFIED = 0; + // A standard package version. + NORMAL = 1; + // A special version representing negative infinity. + MINIMUM = 2; + // A special version representing positive infinity. + MAXIMUM = 3; + }; + + // Required. Distinguishes between sentinel MIN/MAX versions and normal + // versions. + VersionKind kind = 4; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto new file mode 100644 index 00000000000..146915572be --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto @@ -0,0 +1,164 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.provenance; + +import "google/devtools/containeranalysis/v1beta1/source/source.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1.provenance"; +option objc_class_prefix = "GRA"; + +// Provenance of a build. Contains all information needed to verify the full +// details about the build from source to completion. +message BuildProvenance { + // Required. Unique identifier of the build. + string id = 1; + + // ID of the project. + string project_id = 2; + + // Commands requested by the build. + repeated Command commands = 3; + + // Output of the build. + repeated Artifact built_artifacts = 4; + + // Time at which the build was created. + google.protobuf.Timestamp create_time = 5; + + // Time at which execution of the build was started. + google.protobuf.Timestamp start_time = 6; + + // Time at which execution of the build was finished. + google.protobuf.Timestamp end_time = 7; + + // E-mail address of the user who initiated this build. Note that this was the + // user's e-mail address at the time the build was initiated; this address may + // not represent the same end-user for all time. + string creator = 8; + + // URI where any logs for this provenance were written. + string logs_uri = 9; + + // Details of the Source input to the build. + Source source_provenance = 10; + + // Trigger identifier if the build was triggered automatically; empty if not. + string trigger_id = 11; + + // Special options applied to this build. This is a catch-all field where + // build providers can enter any desired additional details. + map build_options = 12; + + // Version string of the builder at the time this build was executed. + string builder_version = 13; + + // next_id = 14 +} + +// Source describes the location of the source used for the build. +message Source { + // If provided, the input binary artifacts for the build came from this + // location. + string artifact_storage_source_uri = 1; + + // Hash(es) of the build source, which can be used to verify that the original + // source integrity was maintained in the build. + // + // The keys to this map are file paths used as build source and the values + // contain the hash values for those files. + // + // If the build source came in a single package such as a gzipped tarfile + // (.tar.gz), the FileHash will be for the single path to that file. + map file_hashes = 2; + + // If provided, the source code used for the build came from this location. + grafeas.v1beta1.source.SourceContext context = 3; + + // If provided, some of the source code used for the build may be found in + // these locations, in the case where the source repository had multiple + // remotes or submodules. This list will not include the context specified in + // the context field. + repeated grafeas.v1beta1.source.SourceContext additional_contexts = 4; +} + +// Container message for hashes of byte content of files, used in source +// messages to verify integrity of source input to the build. +message FileHashes { + // Required. Collection of file hashes. + repeated Hash file_hash = 1; +} + +// Container message for hash values. +message Hash { + // Specifies the hash algorithm. + enum HashType { + // Unknown. + HASH_TYPE_UNSPECIFIED = 0; + // A SHA-256 hash. + SHA256 = 1; + } + + // Required. The type of hash that was performed. + HashType type = 1; + // Required. The hash value. + bytes value = 2; +} + +// Command describes a step performed as part of the build pipeline. +message Command { + // Required. Name of the command, as presented on the command line, or if the + // command is packaged as a Docker container, as presented to `docker pull`. + string name = 1; + + // Environment variables set before running this command. + repeated string env = 2; + + // Command-line arguments used when executing this command. + repeated string args = 3; + + // Working directory (relative to project source root) used when running this + // command. + string dir = 4; + + // Optional unique identifier for this command, used in wait_for to reference + // this command as a dependency. + string id = 5; + + // The ID(s) of the command(s) that this command depends on. + repeated string wait_for = 6; +} + +// Artifact describes a build product. +message Artifact { + // Hash or checksum value of a binary, or Docker Registry 2.0 digest of a + // container. + string checksum = 1; + + // Artifact ID, if any; for container images, this will be a URL by digest + // like `gcr.io/projectID/imagename@sha256:123456`. + string id = 2; + + // Related artifact names. This may be the path to a binary or jar file, or in + // the case of a container build, the name used to push the container image to + // Google Container Registry, as presented to `docker push`. Note that a + // single Artifact ID can have multiple names, for example if two tags are + // applied to one image. + repeated string names = 3; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/source/source.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/source/source.proto new file mode 100644 index 00000000000..ff60d7c2303 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/source/source.proto @@ -0,0 +1,134 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.source; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1.source"; +option objc_class_prefix = "GRA"; + +// A SourceContext is a reference to a tree of files. A SourceContext together +// with a path point to a unique revision of a single file or directory. +message SourceContext { + // A SourceContext can refer any one of the following types of repositories. + oneof context { + // A SourceContext referring to a revision in a Google Cloud Source Repo. + CloudRepoSourceContext cloud_repo = 1; + + // A SourceContext referring to a Gerrit project. + GerritSourceContext gerrit = 2; + + // A SourceContext referring to any third party Git repo (e.g., GitHub). + GitSourceContext git = 3; + } + + // Labels with user defined metadata. + map labels = 4; +} + +// An alias to a repo revision. +message AliasContext { + // The type of an alias. + enum Kind { + // Unknown. + KIND_UNSPECIFIED = 0; + // Git tag. + FIXED = 1; + // Git branch. + MOVABLE = 2; + // Used to specify non-standard aliases. For example, if a Git repo has a + // ref named "refs/foo/bar". + OTHER = 4; + } + + // The alias kind. + Kind kind = 1; + + // The alias name. + string name = 2; +} + +// A CloudRepoSourceContext denotes a particular revision in a Google Cloud +// Source Repo. +message CloudRepoSourceContext { + // The ID of the repo. + RepoId repo_id = 1; + + // A revision in a Cloud Repo can be identified by either its revision ID or + // its alias. + oneof revision { + // A revision ID. + string revision_id = 2; + + // An alias, which may be a branch or tag. + AliasContext alias_context = 3; + } +} + +// A SourceContext referring to a Gerrit project. +message GerritSourceContext { + // The URI of a running Gerrit instance. + string host_uri = 1; + + // The full project name within the host. Projects may be nested, so + // "project/subproject" is a valid project name. The "repo name" is the + // hostURI/project. + string gerrit_project = 2; + + // A revision in a Gerrit project can be identified by either its revision ID + // or its alias. + oneof revision { + // A revision (commit) ID. + string revision_id = 3; + + // An alias, which may be a branch or tag. + AliasContext alias_context = 4; + } +} + +// A GitSourceContext denotes a particular revision in a third party Git +// repository (e.g., GitHub). +message GitSourceContext { + // Git repository URL. + string url = 1; + + // Git commit hash. + string revision_id = 2; +} + +// A unique identifier for a Cloud Repo. +message RepoId { + // A cloud repo can be identified by either its project ID and repository name + // combination, or its globally unique identifier. + oneof id { + // A combination of a project ID and a repo name. + ProjectRepoId project_repo_id = 1; + + // A server-assigned, globally unique identifier. + string uid = 2; + } +} + +// Selects a repo using a Google Cloud Platform project ID (e.g., +// winged-cargo-31) and a repo name within that project. +message ProjectRepoId { + // The ID of the project. + string project_id = 1; + + // The name of the repo. Leave empty for the default repo. + string repo_name = 2; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto new file mode 100644 index 00000000000..d9c740646a7 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto @@ -0,0 +1,203 @@ +// Copyright 2018 The Grafeas Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.vulnerability; + +import "google/protobuf/timestamp.proto"; +import "google/devtools/containeranalysis/v1beta1/common/common.proto"; +import "google/devtools/containeranalysis/v1beta1/cvss/cvss.proto"; +import "google/devtools/containeranalysis/v1beta1/package/package.proto"; + +option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1beta1.vulnerability"; +option objc_class_prefix = "GRA"; + +// Note provider-assigned severity/impact ranking. +enum Severity { + // Unknown. + SEVERITY_UNSPECIFIED = 0; + // Minimal severity. + MINIMAL = 1; + // Low severity. + LOW = 2; + // Medium severity. + MEDIUM = 3; + // High severity. + HIGH = 4; + // Critical severity. + CRITICAL = 5; +} + +// Vulnerability provides metadata about a security vulnerability in a Note. +message Vulnerability { + // The CVSS score for this vulnerability. + float cvss_score = 1; + + // Note provider assigned impact of the vulnerability. + Severity severity = 2; + + // All information about the package to specifically identify this + // vulnerability. One entry per (version range and cpe_uri) the package + // vulnerability has manifested in. + repeated Detail details = 3; + + // Identifies all appearances of this vulnerability in the package for a + // specific distro/location. For example: glibc in + // cpe:/o:debian:debian_linux:8 for versions 2.1 - 2.2 + message Detail { + // Required. The CPE URI in + // [cpe format](https://cpe.mitre.org/specification/) in which the + // vulnerability manifests. Examples include distro or storage location for + // vulnerable jar. + string cpe_uri = 1; + + // Required. The name of the package where the vulnerability was found. + string package = 2; + + // The min version of the package in which the vulnerability exists. + grafeas.v1beta1.package.Version min_affected_version = 3; + + // The max version of the package in which the vulnerability exists. + grafeas.v1beta1.package.Version max_affected_version = 4; + + // The severity (eg: distro assigned severity) for this vulnerability. + string severity_name = 5; + + // A vendor-specific description of this note. + string description = 6; + + // The fix for this specific package version. + VulnerabilityLocation fixed_location = 7; + + // The type of package; whether native or non native(ruby gems, node.js + // packages etc). + string package_type = 8; + + // Whether this detail is obsolete. Occurrences are expected not to point to + // obsolete details. + bool is_obsolete = 9; + + // The time this information was last changed at the source. This is an + // upstream timestamp from the underlying information source - e.g. Ubuntu + // security tracker. + google.protobuf.Timestamp source_update_time = 10; + } + + // The full description of the CVSSv3. + CVSSv3 cvss_v3 = 4; + + // Windows details get their own format because the information format and + // model don't match a normal detail. Specifically Windows updates are done as + // patches, thus Windows vulnerabilities really are a missing package, rather + // than a package being at an incorrect version. + repeated WindowsDetail windows_details = 5; + + message WindowsDetail { + // Required. The CPE URI in + // [cpe format](https://cpe.mitre.org/specification/) in which the + // vulnerability manifests. Examples include distro or storage location for + // vulnerable jar. + string cpe_uri = 1; + + // Required. The name of the vulnerability. + string name = 2; + + // The description of the vulnerability. + string description = 3; + + // Required. The names of the KBs which have hotfixes to mitigate this + // vulnerability. Note that there may be multiple hotfixes (and thus + // multiple KBs) that mitigate a given vulnerability. Currently any listed + // kb's presence is considered a fix. + repeated KnowledgeBase fixing_kbs = 4; + + message KnowledgeBase { + // The KB name (generally of the form KB[0-9]+ i.e. KB123456). + string name = 1; + // A link to the KB in the Windows update catalog - + // https://www.catalog.update.microsoft.com/ + string url = 2; + } + } + + // The time this information was last changed at the source. This is an + // upstream timestamp from the underlying information source - e.g. Ubuntu + // security tracker. + google.protobuf.Timestamp source_update_time = 6; + + // Next free ID is 7. +} + +// Details of a vulnerability Occurrence. +message Details { + // The type of package; whether native or non native(ruby gems, node.js + // packages etc) + string type = 1; + + // Output only. The note provider assigned Severity of the vulnerability. + Severity severity = 2; + + // Output only. The CVSS score of this vulnerability. CVSS score is on a + // scale of 0-10 where 0 indicates low severity and 10 indicates high + // severity. + float cvss_score = 3; + + // Required. The set of affected locations and their fixes (if available) + // within the associated resource. + repeated PackageIssue package_issue = 4; + + // Output only. A one sentence description of this vulnerability. + string short_description = 5; + + // Output only. A detailed description of this vulnerability. + string long_description = 6; + + // Output only. URLs related to this vulnerability. + repeated grafeas.v1beta1.RelatedUrl related_urls = 7; + + // The distro assigned severity for this vulnerability when it is + // available, and note provider assigned severity when distro has not yet + // assigned a severity for this vulnerability. + Severity effective_severity = 8; +} + +// This message wraps a location affected by a vulnerability and its +// associated fix (if one is available). +message PackageIssue { + // Required. The location of the vulnerability. + VulnerabilityLocation affected_location = 1; + + // The location of the available fix for vulnerability. + VulnerabilityLocation fixed_location = 2; + + // Deprecated, use Details.effective_severity instead + // The severity (e.g., distro assigned severity) for this vulnerability. + string severity_name = 3; +} + +// The location of the vulnerability. +message VulnerabilityLocation { + // Required. The CPE URI in [cpe format](https://cpe.mitre.org/specification/) + // format. Examples include distro or storage location for vulnerable jar. + string cpe_uri = 1; + + // Required. The package being described. + string package = 2; + + // Required. The version of the package being described. + grafeas.v1beta1.package.Version version = 3; +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js new file mode 100644 index 00000000000..33b45f71689 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_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 containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 resource to get a packages summary for in the + * form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {ContainerAnalysisV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new ContainerAnalysisV1Beta1Client(); + + async function callGeneratePackagesSummary() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await containeranalysisClient.generatePackagesSummary(request); + console.log(response); + } + + callGeneratePackagesSummary(); + // [END containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.get_iam_policy.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.get_iam_policy.js new file mode 100644 index 00000000000..8d14e1488fc --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_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 containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 Containeranalysis library + const {ContainerAnalysisV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new ContainerAnalysisV1Beta1Client(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await containeranalysisClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.set_iam_policy.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.set_iam_policy.js new file mode 100644 index 00000000000..68df30f5afe --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_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 containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 Containeranalysis library + const {ContainerAnalysisV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new ContainerAnalysisV1Beta1Client(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await containeranalysisClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.test_iam_permissions.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.test_iam_permissions.js new file mode 100644 index 00000000000..09c5b3b0223 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_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 containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 Containeranalysis library + const {ContainerAnalysisV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new ContainerAnalysisV1Beta1Client(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await containeranalysisClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_notes.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_notes.js new file mode 100644 index 00000000000..ebb0fe289fb --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_notes.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() { + // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateNotes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project in the form of `projects/[PROJECT_ID]`, under which + * the notes are to be created. + */ + // const parent = 'abc123' + /** + * The notes to create. + */ + // const notes = [1,2,3,4] + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callBatchCreateNotes() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.batchCreateNotes(request); + console.log(response); + } + + callBatchCreateNotes(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateNotes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_occurrences.js new file mode 100644 index 00000000000..deb937b4301 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_occurrences.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() { + // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateOccurrences_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrences are to be created. + */ + // const parent = 'abc123' + /** + * The occurrences to create. + */ + // const occurrences = [1,2,3,4] + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callBatchCreateOccurrences() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.batchCreateOccurrences(request); + console.log(response); + } + + callBatchCreateOccurrences(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateOccurrences_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_note.js new file mode 100644 index 00000000000..6e64d8e4695 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_note.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateNote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project in the form of `projects/[PROJECT_ID]`, under which + * the note is to be created. + */ + // const parent = 'abc123' + /** + * The ID to use for this note. + */ + // const noteId = 'abc123' + /** + * The note to create. + */ + // const note = {} + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callCreateNote() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.createNote(request); + console.log(response); + } + + callCreateNote(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateNote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_occurrence.js new file mode 100644 index 00000000000..8ca47649de1 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_occurrence.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() { + // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateOccurrence_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrence is to be created. + */ + // const parent = 'abc123' + /** + * The occurrence to create. + */ + // const occurrence = {} + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callCreateOccurrence() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.createOccurrence(request); + console.log(response); + } + + callCreateOccurrence(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateOccurrence_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_note.js new file mode 100644 index 00000000000..dfe500ad2cd --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_note.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteNote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callDeleteNote() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.deleteNote(request); + console.log(response); + } + + callDeleteNote(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteNote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_occurrence.js new file mode 100644 index 00000000000..425dde46108 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_occurrence.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteOccurrence_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callDeleteOccurrence() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.deleteOccurrence(request); + console.log(response); + } + + callDeleteOccurrence(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteOccurrence_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_note.js new file mode 100644 index 00000000000..c498f1f7948 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_note.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetNote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callGetNote() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.getNote(request); + console.log(response); + } + + callGetNote(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetNote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence.js new file mode 100644 index 00000000000..e062f404f9f --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrence_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callGetOccurrence() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.getOccurrence(request); + console.log(response); + } + + callGetOccurrence(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrence_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence_note.js new file mode 100644 index 00000000000..012f47c8b3f --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence_note.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrenceNote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callGetOccurrenceNote() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.getOccurrenceNote(request); + console.log(response); + } + + callGetOccurrenceNote(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrenceNote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_vulnerability_occurrences_summary.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_vulnerability_occurrences_summary.js new file mode 100644 index 00000000000..a95d9608aff --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_vulnerability_occurrences_summary.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() { + // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetVulnerabilityOccurrencesSummary_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project to get a vulnerability summary for in the form of + * `projects/[PROJECT_ID]`. + */ + // const parent = 'abc123' + /** + * The filter expression. + */ + // const filter = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callGetVulnerabilityOccurrencesSummary() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.getVulnerabilityOccurrencesSummary(request); + console.log(response); + } + + callGetVulnerabilityOccurrencesSummary(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetVulnerabilityOccurrencesSummary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_note_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_note_occurrences.js new file mode 100644 index 00000000000..fd4d81e0b71 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_note_occurrences.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() { + // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNoteOccurrences_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + */ + // const name = 'abc123' + /** + * The filter expression. + */ + // const filter = 'abc123' + /** + * Number of occurrences to return in the list. + */ + // const pageSize = 1234 + /** + * Token to provide to skip to a particular spot in the list. + */ + // const pageToken = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callListNoteOccurrences() { + // Construct request + const request = { + }; + + // Run request + const iterable = await containeranalysisClient.listNoteOccurrencesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNoteOccurrences(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNoteOccurrences_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_notes.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_notes.js new file mode 100644 index 00000000000..8b8a3059e9d --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_notes.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() { + // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNotes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + */ + // const parent = 'abc123' + /** + * The filter expression. + */ + // const filter = 'abc123' + /** + * Number of notes to return in the list. + */ + // const pageSize = 1234 + /** + * Token to provide to skip to a particular spot in the list. + */ + // const pageToken = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callListNotes() { + // Construct request + const request = { + }; + + // Run request + const iterable = await containeranalysisClient.listNotesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNotes(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNotes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_occurrences.js new file mode 100644 index 00000000000..548c45904eb --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_occurrences.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() { + // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListOccurrences_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + */ + // const parent = 'abc123' + /** + * The filter expression. + */ + // const filter = 'abc123' + /** + * Number of occurrences to return in the list. + */ + // const pageSize = 1234 + /** + * Token to provide to skip to a particular spot in the list. + */ + // const pageToken = 'abc123' + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callListOccurrences() { + // Construct request + const request = { + }; + + // Run request + const iterable = await containeranalysisClient.listOccurrencesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListOccurrences(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListOccurrences_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_note.js new file mode 100644 index 00000000000..ef54381eb4c --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_note.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateNote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + */ + // const name = 'abc123' + /** + * The updated note. + */ + // const note = {} + /** + * The fields to update. + */ + // const updateMask = {} + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callUpdateNote() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.updateNote(request); + console.log(response); + } + + callUpdateNote(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateNote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_occurrence.js new file mode 100644 index 00000000000..8ab1ed0fa5e --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_occurrence.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateOccurrence_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + */ + // const name = 'abc123' + /** + * The updated occurrence. + */ + // const occurrence = {} + /** + * The fields to update. + */ + // const updateMask = {} + + // Imports the Containeranalysis library + const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new GrafeasV1Beta1Client(); + + async function callUpdateOccurrence() { + // Construct request + const request = { + }; + + // Run request + const response = await containeranalysisClient.updateOccurrence(request); + console.log(response); + } + + callUpdateOccurrence(); + // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateOccurrence_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/snippet_metadata_google.devtools.containeranalysis.v1beta1.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/snippet_metadata_google.devtools.containeranalysis.v1beta1.json new file mode 100644 index 00000000000..1f10feb48f8 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/snippet_metadata_google.devtools.containeranalysis.v1beta1.json @@ -0,0 +1,867 @@ +{ + "clientLibrary": { + "name": "nodejs-containeranalysis", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.devtools.containeranalysis.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_SetIamPolicy_async", + "title": "containeranalysis setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on the specified note or occurrence. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or an occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", + "canonical": true, + "file": "container_analysis_v1_beta1.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.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": "ContainerAnalysisV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1Client" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.SetIamPolicy", + "service": { + "shortName": "ContainerAnalysisV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GetIamPolicy_async", + "title": "containeranalysis getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy for a note or an occurrence resource. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", + "canonical": true, + "file": "container_analysis_v1_beta1.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "ContainerAnalysisV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1Client" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GetIamPolicy", + "service": { + "shortName": "ContainerAnalysisV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_TestIamPermissions_async", + "title": "containeranalysis testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, `containeranalysis.notes.list`). The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", + "canonical": true, + "file": "container_analysis_v1_beta1.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "ContainerAnalysisV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1Client" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.TestIamPermissions", + "service": { + "shortName": "ContainerAnalysisV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async", + "title": "containeranalysis generatePackagesSummary Sample", + "origin": "API_DEFINITION", + "description": " Gets a summary of the packages within a given resource.", + "canonical": true, + "file": "container_analysis_v1_beta1.generate_packages_summary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GeneratePackagesSummary", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GeneratePackagesSummary", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse", + "client": { + "shortName": "ContainerAnalysisV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1Client" + }, + "method": { + "shortName": "GeneratePackagesSummary", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GeneratePackagesSummary", + "service": { + "shortName": "ContainerAnalysisV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrence_async", + "title": "containeranalysis getOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Gets the specified occurrence.", + "canonical": true, + "file": "grafeas_v1_beta1.get_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOccurrence", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetOccurrence", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1beta1.Occurrence", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "GetOccurrence", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetOccurrence", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListOccurrences_async", + "title": "containeranalysis listOccurrences Sample", + "origin": "API_DEFINITION", + "description": " Lists occurrences for the specified project.", + "canonical": true, + "file": "grafeas_v1_beta1.list_occurrences.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListOccurrences", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListOccurrences", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1beta1.ListOccurrencesResponse", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "ListOccurrences", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListOccurrences", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteOccurrence_async", + "title": "containeranalysis deleteOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.", + "canonical": true, + "file": "grafeas_v1_beta1.delete_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteOccurrence", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.DeleteOccurrence", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "DeleteOccurrence", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.DeleteOccurrence", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateOccurrence_async", + "title": "containeranalysis createOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Creates a new occurrence.", + "canonical": true, + "file": "grafeas_v1_beta1.create_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateOccurrence", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.CreateOccurrence", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "occurrence", + "type": ".grafeas.v1beta1.Occurrence" + } + ], + "resultType": ".grafeas.v1beta1.Occurrence", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "CreateOccurrence", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.CreateOccurrence", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateOccurrences_async", + "title": "containeranalysis batchCreateOccurrences Sample", + "origin": "API_DEFINITION", + "description": " Creates new occurrences in batch.", + "canonical": true, + "file": "grafeas_v1_beta1.batch_create_occurrences.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateOccurrences", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.BatchCreateOccurrences", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "occurrences", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".grafeas.v1beta1.BatchCreateOccurrencesResponse", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "BatchCreateOccurrences", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.BatchCreateOccurrences", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateOccurrence_async", + "title": "containeranalysis updateOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified occurrence.", + "canonical": true, + "file": "grafeas_v1_beta1.update_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateOccurrence", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.UpdateOccurrence", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "occurrence", + "type": ".grafeas.v1beta1.Occurrence" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".grafeas.v1beta1.Occurrence", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "UpdateOccurrence", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.UpdateOccurrence", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrenceNote_async", + "title": "containeranalysis getOccurrenceNote Sample", + "origin": "API_DEFINITION", + "description": " Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.", + "canonical": true, + "file": "grafeas_v1_beta1.get_occurrence_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOccurrenceNote", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetOccurrenceNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1beta1.Note", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "GetOccurrenceNote", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetOccurrenceNote", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetNote_async", + "title": "containeranalysis getNote Sample", + "origin": "API_DEFINITION", + "description": " Gets the specified note.", + "canonical": true, + "file": "grafeas_v1_beta1.get_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNote", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1beta1.Note", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "GetNote", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetNote", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNotes_async", + "title": "containeranalysis listNotes Sample", + "origin": "API_DEFINITION", + "description": " Lists notes for the specified project.", + "canonical": true, + "file": "grafeas_v1_beta1.list_notes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNotes", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListNotes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1beta1.ListNotesResponse", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "ListNotes", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListNotes", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteNote_async", + "title": "containeranalysis deleteNote Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified note.", + "canonical": true, + "file": "grafeas_v1_beta1.delete_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNote", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.DeleteNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "DeleteNote", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.DeleteNote", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateNote_async", + "title": "containeranalysis createNote Sample", + "origin": "API_DEFINITION", + "description": " Creates a new note.", + "canonical": true, + "file": "grafeas_v1_beta1.create_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNote", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.CreateNote", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "note_id", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": ".grafeas.v1beta1.Note" + } + ], + "resultType": ".grafeas.v1beta1.Note", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "CreateNote", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.CreateNote", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateNotes_async", + "title": "containeranalysis batchCreateNotes Sample", + "origin": "API_DEFINITION", + "description": " Creates new notes in batch.", + "canonical": true, + "file": "grafeas_v1_beta1.batch_create_notes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateNotes", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.BatchCreateNotes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "notes", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".grafeas.v1beta1.BatchCreateNotesResponse", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "BatchCreateNotes", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.BatchCreateNotes", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateNote_async", + "title": "containeranalysis updateNote Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified note.", + "canonical": true, + "file": "grafeas_v1_beta1.update_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNote", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.UpdateNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": ".grafeas.v1beta1.Note" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".grafeas.v1beta1.Note", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "UpdateNote", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.UpdateNote", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNoteOccurrences_async", + "title": "containeranalysis listNoteOccurrences Sample", + "origin": "API_DEFINITION", + "description": " Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.", + "canonical": true, + "file": "grafeas_v1_beta1.list_note_occurrences.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNoteOccurrences", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListNoteOccurrences", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1beta1.ListNoteOccurrencesResponse", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "ListNoteOccurrences", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListNoteOccurrences", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + }, + { + "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetVulnerabilityOccurrencesSummary_async", + "title": "containeranalysis getVulnerabilityOccurrencesSummary Sample", + "origin": "API_DEFINITION", + "description": " Gets a summary of the number and severity of occurrences.", + "canonical": true, + "file": "grafeas_v1_beta1.get_vulnerability_occurrences_summary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVulnerabilityOccurrencesSummary", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetVulnerabilityOccurrencesSummary", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1beta1.VulnerabilityOccurrencesSummary", + "client": { + "shortName": "GrafeasV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" + }, + "method": { + "shortName": "GetVulnerabilityOccurrencesSummary", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetVulnerabilityOccurrencesSummary", + "service": { + "shortName": "GrafeasV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/index.ts new file mode 100644 index 00000000000..2a51d901047 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/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 v1beta1 from './v1beta1'; +const ContainerAnalysisV1Beta1Client = v1beta1.ContainerAnalysisV1Beta1Client; +type ContainerAnalysisV1Beta1Client = v1beta1.ContainerAnalysisV1Beta1Client; +const GrafeasV1Beta1Client = v1beta1.GrafeasV1Beta1Client; +type GrafeasV1Beta1Client = v1beta1.GrafeasV1Beta1Client; +export {v1beta1, ContainerAnalysisV1Beta1Client, GrafeasV1Beta1Client}; +export default {v1beta1, ContainerAnalysisV1Beta1Client, GrafeasV1Beta1Client}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client.ts new file mode 100644 index 00000000000..f529bd4e4b5 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client.ts @@ -0,0 +1,641 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/container_analysis_v1_beta1_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './container_analysis_v1_beta1_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Retrieves analysis results of Cloud components such as Docker container + * images. The Container Analysis API is an implementation of the + * [Grafeas](https://grafeas.io) API. + * + * Analysis results are stored as a series of occurrences. An `Occurrence` + * contains information about a specific analysis instance on a resource. An + * occurrence refers to a `Note`. A note contains details describing the + * analysis and is generally stored in a separate project, called a `Provider`. + * Multiple occurrences can refer to the same note. + * + * For example, an SSL vulnerability could affect multiple images. In this case, + * there would be one note for the vulnerability and an occurrence for each + * image with the vulnerability referring to that note. + * @class + * @memberof v1beta1 + */ +export class ContainerAnalysisV1Beta1Client { + 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}; + containerAnalysisV1Beta1Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ContainerAnalysisV1Beta1Client. + * + * @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 ContainerAnalysisV1Beta1Client({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 ContainerAnalysisV1Beta1Client; + 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.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1', 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.containerAnalysisV1Beta1Stub) { + return this.containerAnalysisV1Beta1Stub; + } + + // Put together the "service stub" for + // google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1. + this.containerAnalysisV1Beta1Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1, + 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 containerAnalysisV1Beta1StubMethods = + ['setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'generatePackagesSummary']; + for (const methodName of containerAnalysisV1Beta1StubMethods) { + const callPromise = this.containerAnalysisV1Beta1Stub.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.containerAnalysisV1Beta1Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'containeranalysis.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 'containeranalysis.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 on the specified note or occurrence. + * Requires `containeranalysis.notes.setIamPolicy` or + * `containeranalysis.occurrences.setIamPolicy` permission if the resource is + * a note or an occurrence, respectively. + * + * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + * occurrences. + * + * @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/container_analysis_v1_beta1.set_iam_policy.js + * region_tag:containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 note or an occurrence resource. + * Requires `containeranalysis.notes.setIamPolicy` or + * `containeranalysis.occurrences.setIamPolicy` permission if the resource is + * a note or occurrence, respectively. + * + * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + * occurrences. + * + * @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/container_analysis_v1_beta1.get_iam_policy.js + * region_tag:containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 the permissions that a caller has on the specified note or + * occurrence. Requires list permission on the project (for example, + * `containeranalysis.notes.list`). + * + * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + * occurrences. + * + * @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/container_analysis_v1_beta1.test_iam_permissions.js + * region_tag:containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 a summary of the packages within a given resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the resource to get a packages summary for in the + * form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse|PackagesSummaryResponse}. + * Please see the {@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/container_analysis_v1_beta1.generate_packages_summary.js + * region_tag:containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async + */ + generatePackagesSummary( + request?: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|undefined, {}|undefined + ]>; + generatePackagesSummary( + request: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|null|undefined, + {}|null|undefined>): void; + generatePackagesSummary( + request: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, + callback: Callback< + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|null|undefined, + {}|null|undefined>): void; + generatePackagesSummary( + request?: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.generatePackagesSummary(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.containerAnalysisV1Beta1Stub && !this._terminated) { + return this.containerAnalysisV1Beta1Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client_config.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client_config.json new file mode 100644 index 00000000000..cda6d95cb3a --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client_config.json @@ -0,0 +1,42 @@ +{ + "interfaces": { + "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1": { + "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": { + "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" + }, + "GeneratePackagesSummary": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_proto_list.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_proto_list.json new file mode 100644 index 00000000000..9ad38a4354a --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_proto_list.json @@ -0,0 +1,15 @@ +[ + "../../protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/build/build.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/common/common.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/image/image.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/package/package.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/source/source.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto" +] diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..7d486f3ad4d --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,239 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.devtools.containeranalysis.v1beta1", + "libraryPackage": "@google-cloud/containeranalysis", + "services": { + "ContainerAnalysisV1Beta1": { + "clients": { + "grpc": { + "libraryClient": "ContainerAnalysisV1Beta1Client", + "rpcs": { + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "GeneratePackagesSummary": { + "methods": [ + "generatePackagesSummary" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ContainerAnalysisV1Beta1Client", + "rpcs": { + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "GeneratePackagesSummary": { + "methods": [ + "generatePackagesSummary" + ] + } + } + } + } + }, + "GrafeasV1Beta1": { + "clients": { + "grpc": { + "libraryClient": "GrafeasV1Beta1Client", + "rpcs": { + "GetOccurrence": { + "methods": [ + "getOccurrence" + ] + }, + "DeleteOccurrence": { + "methods": [ + "deleteOccurrence" + ] + }, + "CreateOccurrence": { + "methods": [ + "createOccurrence" + ] + }, + "BatchCreateOccurrences": { + "methods": [ + "batchCreateOccurrences" + ] + }, + "UpdateOccurrence": { + "methods": [ + "updateOccurrence" + ] + }, + "GetOccurrenceNote": { + "methods": [ + "getOccurrenceNote" + ] + }, + "GetNote": { + "methods": [ + "getNote" + ] + }, + "DeleteNote": { + "methods": [ + "deleteNote" + ] + }, + "CreateNote": { + "methods": [ + "createNote" + ] + }, + "BatchCreateNotes": { + "methods": [ + "batchCreateNotes" + ] + }, + "UpdateNote": { + "methods": [ + "updateNote" + ] + }, + "GetVulnerabilityOccurrencesSummary": { + "methods": [ + "getVulnerabilityOccurrencesSummary" + ] + }, + "ListOccurrences": { + "methods": [ + "listOccurrences", + "listOccurrencesStream", + "listOccurrencesAsync" + ] + }, + "ListNotes": { + "methods": [ + "listNotes", + "listNotesStream", + "listNotesAsync" + ] + }, + "ListNoteOccurrences": { + "methods": [ + "listNoteOccurrences", + "listNoteOccurrencesStream", + "listNoteOccurrencesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "GrafeasV1Beta1Client", + "rpcs": { + "GetOccurrence": { + "methods": [ + "getOccurrence" + ] + }, + "DeleteOccurrence": { + "methods": [ + "deleteOccurrence" + ] + }, + "CreateOccurrence": { + "methods": [ + "createOccurrence" + ] + }, + "BatchCreateOccurrences": { + "methods": [ + "batchCreateOccurrences" + ] + }, + "UpdateOccurrence": { + "methods": [ + "updateOccurrence" + ] + }, + "GetOccurrenceNote": { + "methods": [ + "getOccurrenceNote" + ] + }, + "GetNote": { + "methods": [ + "getNote" + ] + }, + "DeleteNote": { + "methods": [ + "deleteNote" + ] + }, + "CreateNote": { + "methods": [ + "createNote" + ] + }, + "BatchCreateNotes": { + "methods": [ + "batchCreateNotes" + ] + }, + "UpdateNote": { + "methods": [ + "updateNote" + ] + }, + "GetVulnerabilityOccurrencesSummary": { + "methods": [ + "getVulnerabilityOccurrencesSummary" + ] + }, + "ListOccurrences": { + "methods": [ + "listOccurrences", + "listOccurrencesStream", + "listOccurrencesAsync" + ] + }, + "ListNotes": { + "methods": [ + "listNotes", + "listNotesStream", + "listNotesAsync" + ] + }, + "ListNoteOccurrences": { + "methods": [ + "listNoteOccurrences", + "listNoteOccurrencesStream", + "listNoteOccurrencesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client.ts new file mode 100644 index 00000000000..39408955b17 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client.ts @@ -0,0 +1,1746 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1beta1/grafeas_v1_beta1_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './grafeas_v1_beta1_client_config.json'; +const version = require('../../../package.json').version; + +/** + * [Grafeas](grafeas.io) API. + * + * Retrieves analysis results of Cloud components such as Docker container + * images. + * + * Analysis results are stored as a series of occurrences. An `Occurrence` + * contains information about a specific analysis instance on a resource. An + * occurrence refers to a `Note`. A note contains details describing the + * analysis and is generally stored in a separate project, called a `Provider`. + * Multiple occurrences can refer to the same note. + * + * For example, an SSL vulnerability could affect multiple images. In this case, + * there would be one note for the vulnerability and an occurrence for each + * image with the vulnerability referring to that note. + * @class + * @memberof v1beta1 + */ +export class GrafeasV1Beta1Client { + 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}; + grafeasV1Beta1Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of GrafeasV1Beta1Client. + * + * @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 GrafeasV1Beta1Client({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 GrafeasV1Beta1Client; + 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 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 = { + listOccurrences: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'occurrences'), + listNotes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notes'), + listNoteOccurrences: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'occurrences') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1', 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.grafeasV1Beta1Stub) { + return this.grafeasV1Beta1Stub; + } + + // Put together the "service stub" for + // google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1. + this.grafeasV1Beta1Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1, + 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 grafeasV1Beta1StubMethods = + ['getOccurrence', 'listOccurrences', 'deleteOccurrence', 'createOccurrence', 'batchCreateOccurrences', 'updateOccurrence', 'getOccurrenceNote', 'getNote', 'listNotes', 'deleteNote', 'createNote', 'batchCreateNotes', 'updateNote', 'listNoteOccurrences', 'getVulnerabilityOccurrencesSummary']; + for (const methodName of grafeasV1Beta1StubMethods) { + const callPromise = this.grafeasV1Beta1Stub.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.grafeasV1Beta1Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'containeranalysis.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 'containeranalysis.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 specified occurrence. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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.grafeas.v1beta1.Occurrence|Occurrence}. + * Please see the {@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/grafeas_v1_beta1.get_occurrence.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrence_async + */ + getOccurrence( + request?: protos.grafeas.v1beta1.IGetOccurrenceRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IGetOccurrenceRequest|undefined, {}|undefined + ]>; + getOccurrence( + request: protos.grafeas.v1beta1.IGetOccurrenceRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IGetOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + getOccurrence( + request: protos.grafeas.v1beta1.IGetOccurrenceRequest, + callback: Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IGetOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + getOccurrence( + request?: protos.grafeas.v1beta1.IGetOccurrenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IGetOccurrenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IGetOccurrenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IGetOccurrenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getOccurrence(request, options, callback); + } +/** + * Deletes the specified occurrence. For example, use this method to delete an + * occurrence when the occurrence is no longer applicable for the given + * resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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/v1beta1/grafeas_v1_beta1.delete_occurrence.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteOccurrence_async + */ + deleteOccurrence( + request?: protos.grafeas.v1beta1.IDeleteOccurrenceRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteOccurrenceRequest|undefined, {}|undefined + ]>; + deleteOccurrence( + request: protos.grafeas.v1beta1.IDeleteOccurrenceRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + deleteOccurrence( + request: protos.grafeas.v1beta1.IDeleteOccurrenceRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + deleteOccurrence( + request?: protos.grafeas.v1beta1.IDeleteOccurrenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteOccurrenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteOccurrenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteOccurrenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteOccurrence(request, options, callback); + } +/** + * Creates a new occurrence. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrence is to be created. + * @param {grafeas.v1beta1.Occurrence} request.occurrence + * The occurrence 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 {@link protos.grafeas.v1beta1.Occurrence|Occurrence}. + * Please see the {@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/grafeas_v1_beta1.create_occurrence.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateOccurrence_async + */ + createOccurrence( + request?: protos.grafeas.v1beta1.ICreateOccurrenceRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.ICreateOccurrenceRequest|undefined, {}|undefined + ]>; + createOccurrence( + request: protos.grafeas.v1beta1.ICreateOccurrenceRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.ICreateOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + createOccurrence( + request: protos.grafeas.v1beta1.ICreateOccurrenceRequest, + callback: Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.ICreateOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + createOccurrence( + request?: protos.grafeas.v1beta1.ICreateOccurrenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.ICreateOccurrenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.ICreateOccurrenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.ICreateOccurrenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createOccurrence(request, options, callback); + } +/** + * Creates new occurrences in batch. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the occurrences are to be created. + * @param {number[]} request.occurrences + * The occurrences 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 {@link protos.grafeas.v1beta1.BatchCreateOccurrencesResponse|BatchCreateOccurrencesResponse}. + * Please see the {@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/grafeas_v1_beta1.batch_create_occurrences.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateOccurrences_async + */ + batchCreateOccurrences( + request?: protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|undefined, {}|undefined + ]>; + batchCreateOccurrences( + request: protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|null|undefined, + {}|null|undefined>): void; + batchCreateOccurrences( + request: protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest, + callback: Callback< + protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|null|undefined, + {}|null|undefined>): void; + batchCreateOccurrences( + request?: protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateOccurrences(request, options, callback); + } +/** + * Updates the specified occurrence. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @param {grafeas.v1beta1.Occurrence} request.occurrence + * The updated occurrence. + * @param {google.protobuf.FieldMask} request.updateMask + * The fields to update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.grafeas.v1beta1.Occurrence|Occurrence}. + * Please see the {@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/grafeas_v1_beta1.update_occurrence.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateOccurrence_async + */ + updateOccurrence( + request?: protos.grafeas.v1beta1.IUpdateOccurrenceRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IUpdateOccurrenceRequest|undefined, {}|undefined + ]>; + updateOccurrence( + request: protos.grafeas.v1beta1.IUpdateOccurrenceRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IUpdateOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + updateOccurrence( + request: protos.grafeas.v1beta1.IUpdateOccurrenceRequest, + callback: Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IUpdateOccurrenceRequest|null|undefined, + {}|null|undefined>): void; + updateOccurrence( + request?: protos.grafeas.v1beta1.IUpdateOccurrenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IUpdateOccurrenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IUpdateOccurrenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1beta1.IOccurrence, + protos.grafeas.v1beta1.IUpdateOccurrenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateOccurrence(request, options, callback); + } +/** + * Gets the note attached to the specified occurrence. Consumer projects can + * use this method to get a note that belongs to a provider project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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.grafeas.v1beta1.Note|Note}. + * Please see the {@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/grafeas_v1_beta1.get_occurrence_note.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrenceNote_async + */ + getOccurrenceNote( + request?: protos.grafeas.v1beta1.IGetOccurrenceNoteRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|undefined, {}|undefined + ]>; + getOccurrenceNote( + request: protos.grafeas.v1beta1.IGetOccurrenceNoteRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|null|undefined, + {}|null|undefined>): void; + getOccurrenceNote( + request: protos.grafeas.v1beta1.IGetOccurrenceNoteRequest, + callback: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|null|undefined, + {}|null|undefined>): void; + getOccurrenceNote( + request?: protos.grafeas.v1beta1.IGetOccurrenceNoteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getOccurrenceNote(request, options, callback); + } +/** + * Gets the specified note. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_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.grafeas.v1beta1.Note|Note}. + * Please see the {@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/grafeas_v1_beta1.get_note.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetNote_async + */ + getNote( + request?: protos.grafeas.v1beta1.IGetNoteRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetNoteRequest|undefined, {}|undefined + ]>; + getNote( + request: protos.grafeas.v1beta1.IGetNoteRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetNoteRequest|null|undefined, + {}|null|undefined>): void; + getNote( + request: protos.grafeas.v1beta1.IGetNoteRequest, + callback: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetNoteRequest|null|undefined, + {}|null|undefined>): void; + getNote( + request?: protos.grafeas.v1beta1.IGetNoteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetNoteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetNoteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IGetNoteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getNote(request, options, callback); + } +/** + * Deletes the specified note. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_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/v1beta1/grafeas_v1_beta1.delete_note.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteNote_async + */ + deleteNote( + request?: protos.grafeas.v1beta1.IDeleteNoteRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteNoteRequest|undefined, {}|undefined + ]>; + deleteNote( + request: protos.grafeas.v1beta1.IDeleteNoteRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteNoteRequest|null|undefined, + {}|null|undefined>): void; + deleteNote( + request: protos.grafeas.v1beta1.IDeleteNoteRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteNoteRequest|null|undefined, + {}|null|undefined>): void; + deleteNote( + request?: protos.grafeas.v1beta1.IDeleteNoteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteNoteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteNoteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.grafeas.v1beta1.IDeleteNoteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteNote(request, options, callback); + } +/** + * Creates a new note. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the note is to be created. + * @param {string} request.noteId + * The ID to use for this note. + * @param {grafeas.v1beta1.Note} request.note + * The note 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 {@link protos.grafeas.v1beta1.Note|Note}. + * Please see the {@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/grafeas_v1_beta1.create_note.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateNote_async + */ + createNote( + request?: protos.grafeas.v1beta1.ICreateNoteRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.ICreateNoteRequest|undefined, {}|undefined + ]>; + createNote( + request: protos.grafeas.v1beta1.ICreateNoteRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.ICreateNoteRequest|null|undefined, + {}|null|undefined>): void; + createNote( + request: protos.grafeas.v1beta1.ICreateNoteRequest, + callback: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.ICreateNoteRequest|null|undefined, + {}|null|undefined>): void; + createNote( + request?: protos.grafeas.v1beta1.ICreateNoteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.ICreateNoteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.ICreateNoteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.ICreateNoteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createNote(request, options, callback); + } +/** + * Creates new notes in batch. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project in the form of `projects/[PROJECT_ID]`, under which + * the notes are to be created. + * @param {number[]} request.notes + * The notes 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 {@link protos.grafeas.v1beta1.BatchCreateNotesResponse|BatchCreateNotesResponse}. + * Please see the {@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/grafeas_v1_beta1.batch_create_notes.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateNotes_async + */ + batchCreateNotes( + request?: protos.grafeas.v1beta1.IBatchCreateNotesRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.IBatchCreateNotesResponse, + protos.grafeas.v1beta1.IBatchCreateNotesRequest|undefined, {}|undefined + ]>; + batchCreateNotes( + request: protos.grafeas.v1beta1.IBatchCreateNotesRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1beta1.IBatchCreateNotesResponse, + protos.grafeas.v1beta1.IBatchCreateNotesRequest|null|undefined, + {}|null|undefined>): void; + batchCreateNotes( + request: protos.grafeas.v1beta1.IBatchCreateNotesRequest, + callback: Callback< + protos.grafeas.v1beta1.IBatchCreateNotesResponse, + protos.grafeas.v1beta1.IBatchCreateNotesRequest|null|undefined, + {}|null|undefined>): void; + batchCreateNotes( + request?: protos.grafeas.v1beta1.IBatchCreateNotesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1beta1.IBatchCreateNotesResponse, + protos.grafeas.v1beta1.IBatchCreateNotesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1beta1.IBatchCreateNotesResponse, + protos.grafeas.v1beta1.IBatchCreateNotesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1beta1.IBatchCreateNotesResponse, + protos.grafeas.v1beta1.IBatchCreateNotesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateNotes(request, options, callback); + } +/** + * Updates the specified note. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the note in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param {grafeas.v1beta1.Note} request.note + * The updated note. + * @param {google.protobuf.FieldMask} request.updateMask + * The fields to update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.grafeas.v1beta1.Note|Note}. + * Please see the {@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/grafeas_v1_beta1.update_note.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateNote_async + */ + updateNote( + request?: protos.grafeas.v1beta1.IUpdateNoteRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IUpdateNoteRequest|undefined, {}|undefined + ]>; + updateNote( + request: protos.grafeas.v1beta1.IUpdateNoteRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IUpdateNoteRequest|null|undefined, + {}|null|undefined>): void; + updateNote( + request: protos.grafeas.v1beta1.IUpdateNoteRequest, + callback: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IUpdateNoteRequest|null|undefined, + {}|null|undefined>): void; + updateNote( + request?: protos.grafeas.v1beta1.IUpdateNoteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IUpdateNoteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IUpdateNoteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1beta1.INote, + protos.grafeas.v1beta1.IUpdateNoteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateNote(request, options, callback); + } +/** + * Gets a summary of the number and severity of occurrences. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project to get a vulnerability summary for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.grafeas.v1beta1.VulnerabilityOccurrencesSummary|VulnerabilityOccurrencesSummary}. + * Please see the {@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/grafeas_v1_beta1.get_vulnerability_occurrences_summary.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetVulnerabilityOccurrencesSummary_async + */ + getVulnerabilityOccurrencesSummary( + request?: protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, + protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|undefined, {}|undefined + ]>; + getVulnerabilityOccurrencesSummary( + request: protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest, + options: CallOptions, + callback: Callback< + protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, + protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, + {}|null|undefined>): void; + getVulnerabilityOccurrencesSummary( + request: protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest, + callback: Callback< + protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, + protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, + {}|null|undefined>): void; + getVulnerabilityOccurrencesSummary( + request?: protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, + protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, + protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, + protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.getVulnerabilityOccurrencesSummary(request, options, callback); + } + + /** + * Lists occurrences for the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence}. + * 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 `listOccurrencesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listOccurrences( + request?: protos.grafeas.v1beta1.IListOccurrencesRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.IOccurrence[], + protos.grafeas.v1beta1.IListOccurrencesRequest|null, + protos.grafeas.v1beta1.IListOccurrencesResponse + ]>; + listOccurrences( + request: protos.grafeas.v1beta1.IListOccurrencesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.grafeas.v1beta1.IListOccurrencesRequest, + protos.grafeas.v1beta1.IListOccurrencesResponse|null|undefined, + protos.grafeas.v1beta1.IOccurrence>): void; + listOccurrences( + request: protos.grafeas.v1beta1.IListOccurrencesRequest, + callback: PaginationCallback< + protos.grafeas.v1beta1.IListOccurrencesRequest, + protos.grafeas.v1beta1.IListOccurrencesResponse|null|undefined, + protos.grafeas.v1beta1.IOccurrence>): void; + listOccurrences( + request?: protos.grafeas.v1beta1.IListOccurrencesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.grafeas.v1beta1.IListOccurrencesRequest, + protos.grafeas.v1beta1.IListOccurrencesResponse|null|undefined, + protos.grafeas.v1beta1.IOccurrence>, + callback?: PaginationCallback< + protos.grafeas.v1beta1.IListOccurrencesRequest, + protos.grafeas.v1beta1.IListOccurrencesResponse|null|undefined, + protos.grafeas.v1beta1.IOccurrence>): + Promise<[ + protos.grafeas.v1beta1.IOccurrence[], + protos.grafeas.v1beta1.IListOccurrencesRequest|null, + protos.grafeas.v1beta1.IListOccurrencesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listOccurrences(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 name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence} 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 `listOccurrencesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listOccurrencesStream( + request?: protos.grafeas.v1beta1.IListOccurrencesRequest, + 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['listOccurrences']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listOccurrences.createStream( + this.innerApiCalls.listOccurrences as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listOccurrences`, 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 name of the project to list occurrences for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence}. 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/grafeas_v1_beta1.list_occurrences.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListOccurrences_async + */ + listOccurrencesAsync( + request?: protos.grafeas.v1beta1.IListOccurrencesRequest, + 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['listOccurrences']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listOccurrences.asyncIterate( + this.innerApiCalls['listOccurrences'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists notes for the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of notes to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Note|Note}. + * 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 `listNotesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNotes( + request?: protos.grafeas.v1beta1.IListNotesRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.INote[], + protos.grafeas.v1beta1.IListNotesRequest|null, + protos.grafeas.v1beta1.IListNotesResponse + ]>; + listNotes( + request: protos.grafeas.v1beta1.IListNotesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.grafeas.v1beta1.IListNotesRequest, + protos.grafeas.v1beta1.IListNotesResponse|null|undefined, + protos.grafeas.v1beta1.INote>): void; + listNotes( + request: protos.grafeas.v1beta1.IListNotesRequest, + callback: PaginationCallback< + protos.grafeas.v1beta1.IListNotesRequest, + protos.grafeas.v1beta1.IListNotesResponse|null|undefined, + protos.grafeas.v1beta1.INote>): void; + listNotes( + request?: protos.grafeas.v1beta1.IListNotesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.grafeas.v1beta1.IListNotesRequest, + protos.grafeas.v1beta1.IListNotesResponse|null|undefined, + protos.grafeas.v1beta1.INote>, + callback?: PaginationCallback< + protos.grafeas.v1beta1.IListNotesRequest, + protos.grafeas.v1beta1.IListNotesResponse|null|undefined, + protos.grafeas.v1beta1.INote>): + Promise<[ + protos.grafeas.v1beta1.INote[], + protos.grafeas.v1beta1.IListNotesRequest|null, + protos.grafeas.v1beta1.IListNotesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listNotes(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 name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of notes to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Note|Note} 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 `listNotesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNotesStream( + request?: protos.grafeas.v1beta1.IListNotesRequest, + 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['listNotes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotes.createStream( + this.innerApiCalls.listNotes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNotes`, 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 name of the project to list notes for in the form of + * `projects/[PROJECT_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of notes to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Note|Note}. 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/grafeas_v1_beta1.list_notes.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNotes_async + */ + listNotesAsync( + request?: protos.grafeas.v1beta1.IListNotesRequest, + 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['listNotes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotes.asyncIterate( + this.innerApiCalls['listNotes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists occurrences referencing the specified note. Provider projects can use + * this method to get all occurrences across consumer projects referencing the + * specified note. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence}. + * 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 `listNoteOccurrencesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNoteOccurrences( + request?: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, + options?: CallOptions): + Promise<[ + protos.grafeas.v1beta1.IOccurrence[], + protos.grafeas.v1beta1.IListNoteOccurrencesRequest|null, + protos.grafeas.v1beta1.IListNoteOccurrencesResponse + ]>; + listNoteOccurrences( + request: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.grafeas.v1beta1.IListNoteOccurrencesRequest, + protos.grafeas.v1beta1.IListNoteOccurrencesResponse|null|undefined, + protos.grafeas.v1beta1.IOccurrence>): void; + listNoteOccurrences( + request: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, + callback: PaginationCallback< + protos.grafeas.v1beta1.IListNoteOccurrencesRequest, + protos.grafeas.v1beta1.IListNoteOccurrencesResponse|null|undefined, + protos.grafeas.v1beta1.IOccurrence>): void; + listNoteOccurrences( + request?: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.grafeas.v1beta1.IListNoteOccurrencesRequest, + protos.grafeas.v1beta1.IListNoteOccurrencesResponse|null|undefined, + protos.grafeas.v1beta1.IOccurrence>, + callback?: PaginationCallback< + protos.grafeas.v1beta1.IListNoteOccurrencesRequest, + protos.grafeas.v1beta1.IListNoteOccurrencesResponse|null|undefined, + protos.grafeas.v1beta1.IOccurrence>): + Promise<[ + protos.grafeas.v1beta1.IOccurrence[], + protos.grafeas.v1beta1.IListNoteOccurrencesRequest|null, + protos.grafeas.v1beta1.IListNoteOccurrencesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.listNoteOccurrences(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.name + * The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence} 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 `listNoteOccurrencesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listNoteOccurrencesStream( + request?: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, + 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({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listNoteOccurrences']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNoteOccurrences.createStream( + this.innerApiCalls.listNoteOccurrences as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNoteOccurrences`, 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.name + * The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param {string} request.filter + * The filter expression. + * @param {number} request.pageSize + * Number of occurrences to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence}. 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/grafeas_v1_beta1.list_note_occurrences.js + * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNoteOccurrences_async + */ + listNoteOccurrencesAsync( + request?: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, + 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({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listNoteOccurrences']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNoteOccurrences.asyncIterate( + this.innerApiCalls['listNoteOccurrences'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + + /** + * 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.grafeasV1Beta1Stub && !this._terminated) { + return this.grafeasV1Beta1Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client_config.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client_config.json new file mode 100644 index 00000000000..8c9edc4b411 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client_config.json @@ -0,0 +1,86 @@ +{ + "interfaces": { + "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1": { + "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": { + "GetOccurrence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListOccurrences": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteOccurrence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateOccurrence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchCreateOccurrences": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateOccurrence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetOccurrenceNote": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetNote": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListNotes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNote": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateNote": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchCreateNotes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNote": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListNoteOccurrences": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetVulnerabilityOccurrencesSummary": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_proto_list.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_proto_list.json new file mode 100644 index 00000000000..9ad38a4354a --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_proto_list.json @@ -0,0 +1,15 @@ +[ + "../../protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/build/build.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/common/common.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/image/image.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/package/package.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/source/source.proto", + "../../protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto" +] diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000000..619ba56f58e --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/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 {ContainerAnalysisV1Beta1Client} from './container_analysis_v1_beta1_client'; +export {GrafeasV1Beta1Client} from './grafeas_v1_beta1_client'; diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..5470be044e7 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/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 containeranalysis = require('@google-cloud/containeranalysis'); + +function main() { + const containerAnalysisV1Beta1Client = new containeranalysis.ContainerAnalysisV1Beta1Client(); + const grafeasV1Beta1Client = new containeranalysis.GrafeasV1Beta1Client(); +} + +main(); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..c5a91cc661c --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/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 {ContainerAnalysisV1Beta1Client, GrafeasV1Beta1Client} from '@google-cloud/containeranalysis'; + +// check that the client class type name can be used +function doStuffWithContainerAnalysisV1Beta1Client(client: ContainerAnalysisV1Beta1Client) { + client.close(); +} +function doStuffWithGrafeasV1Beta1Client(client: GrafeasV1Beta1Client) { + client.close(); +} + +function main() { + // check that the client instance can be created + const containerAnalysisV1Beta1Client = new ContainerAnalysisV1Beta1Client(); + doStuffWithContainerAnalysisV1Beta1Client(containerAnalysisV1Beta1Client); + // check that the client instance can be created + const grafeasV1Beta1Client = new GrafeasV1Beta1Client(); + doStuffWithGrafeasV1Beta1Client(grafeasV1Beta1Client); +} + +main(); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/install.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1beta1/test/gapic_container_analysis_v1_beta1_v1beta1.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_container_analysis_v1_beta1_v1beta1.ts new file mode 100644 index 00000000000..434cb9e1ee9 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_container_analysis_v1_beta1_v1beta1.ts @@ -0,0 +1,582 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 containeranalysisv1beta1Module 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.ContainerAnalysisV1Beta1Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.containerAnalysisV1Beta1Stub, undefined); + await client.initialize(); + assert(client.containerAnalysisV1Beta1Stub); + }); + + it('has close method for the initialized client', done => { + const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.containerAnalysisV1Beta1Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.containerAnalysisV1Beta1Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + 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('generatePackagesSummary', () => { + it('invokes generatePackagesSummary without error', async () => { + const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse() + ); + client.innerApiCalls.generatePackagesSummary = stubSimpleCall(expectedResponse); + const [response] = await client.generatePackagesSummary(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generatePackagesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generatePackagesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generatePackagesSummary without error using callback', async () => { + const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse() + ); + client.innerApiCalls.generatePackagesSummary = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generatePackagesSummary( + request, + (err?: Error|null, result?: protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generatePackagesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generatePackagesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generatePackagesSummary with error', async () => { + const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generatePackagesSummary = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generatePackagesSummary(request), expectedError); + const actualRequest = (client.innerApiCalls.generatePackagesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generatePackagesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generatePackagesSummary with closed client', async () => { + const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generatePackagesSummary(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_grafeas_v1_beta1_v1beta1.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_grafeas_v1_beta1_v1beta1.ts new file mode 100644 index 00000000000..1e0db3c9020 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_grafeas_v1_beta1_v1beta1.ts @@ -0,0 +1,2228 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 grafeasv1beta1Module 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('v1beta1.GrafeasV1Beta1Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.grafeasV1Beta1Stub, undefined); + await client.initialize(); + assert(client.grafeasV1Beta1Stub); + }); + + it('has close method for the initialized client', done => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.grafeasV1Beta1Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.grafeasV1Beta1Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + 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 grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + 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('getOccurrence', () => { + it('invokes getOccurrence without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Occurrence() + ); + client.innerApiCalls.getOccurrence = stubSimpleCall(expectedResponse); + const [response] = await client.getOccurrence(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrence without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Occurrence() + ); + client.innerApiCalls.getOccurrence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOccurrence( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.IOccurrence|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrence with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getOccurrence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOccurrence(request), expectedError); + const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrence with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOccurrence(request), expectedError); + }); + }); + + describe('deleteOccurrence', () => { + it('invokes deleteOccurrence without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.DeleteOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.DeleteOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteOccurrence = stubSimpleCall(expectedResponse); + const [response] = await client.deleteOccurrence(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteOccurrence without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.DeleteOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.DeleteOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteOccurrence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteOccurrence( + 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.deleteOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteOccurrence with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.DeleteOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.DeleteOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteOccurrence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteOccurrence(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteOccurrence with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.DeleteOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.DeleteOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteOccurrence(request), expectedError); + }); + }); + + describe('createOccurrence', () => { + it('invokes createOccurrence without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.CreateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.CreateOccurrenceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Occurrence() + ); + client.innerApiCalls.createOccurrence = stubSimpleCall(expectedResponse); + const [response] = await client.createOccurrence(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createOccurrence without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.CreateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.CreateOccurrenceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Occurrence() + ); + client.innerApiCalls.createOccurrence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createOccurrence( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.IOccurrence|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createOccurrence with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.CreateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.CreateOccurrenceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createOccurrence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createOccurrence(request), expectedError); + const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createOccurrence with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.CreateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.CreateOccurrenceRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createOccurrence(request), expectedError); + }); + }); + + describe('batchCreateOccurrences', () => { + it('invokes batchCreateOccurrences without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.BatchCreateOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateOccurrencesResponse() + ); + client.innerApiCalls.batchCreateOccurrences = stubSimpleCall(expectedResponse); + const [response] = await client.batchCreateOccurrences(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateOccurrences without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.BatchCreateOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateOccurrencesResponse() + ); + client.innerApiCalls.batchCreateOccurrences = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateOccurrences( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateOccurrences with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.BatchCreateOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateOccurrences = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchCreateOccurrences(request), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateOccurrences with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.BatchCreateOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.batchCreateOccurrences(request), expectedError); + }); + }); + + describe('updateOccurrence', () => { + it('invokes updateOccurrence without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.UpdateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.UpdateOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Occurrence() + ); + client.innerApiCalls.updateOccurrence = stubSimpleCall(expectedResponse); + const [response] = await client.updateOccurrence(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOccurrence without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.UpdateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.UpdateOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Occurrence() + ); + client.innerApiCalls.updateOccurrence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateOccurrence( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.IOccurrence|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOccurrence with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.UpdateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.UpdateOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateOccurrence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateOccurrence(request), expectedError); + const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOccurrence with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.UpdateOccurrenceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.UpdateOccurrenceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateOccurrence(request), expectedError); + }); + }); + + describe('getOccurrenceNote', () => { + it('invokes getOccurrenceNote without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetOccurrenceNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Note() + ); + client.innerApiCalls.getOccurrenceNote = stubSimpleCall(expectedResponse); + const [response] = await client.getOccurrenceNote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrenceNote without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetOccurrenceNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Note() + ); + client.innerApiCalls.getOccurrenceNote = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOccurrenceNote( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.INote|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrenceNote with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetOccurrenceNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getOccurrenceNote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOccurrenceNote(request), expectedError); + const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOccurrenceNote with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetOccurrenceNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceNoteRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOccurrenceNote(request), expectedError); + }); + }); + + describe('getNote', () => { + it('invokes getNote without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Note() + ); + client.innerApiCalls.getNote = stubSimpleCall(expectedResponse); + const [response] = await client.getNote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNote without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Note() + ); + client.innerApiCalls.getNote = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNote( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.INote|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNote with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNote(request), expectedError); + const actualRequest = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNote with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetNoteRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNote(request), expectedError); + }); + }); + + describe('deleteNote', () => { + it('invokes deleteNote without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.DeleteNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.DeleteNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteNote = stubSimpleCall(expectedResponse); + const [response] = await client.deleteNote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNote without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.DeleteNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.DeleteNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteNote = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNote( + 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.deleteNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNote with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.DeleteNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.DeleteNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteNote(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNote with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.DeleteNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.DeleteNoteRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteNote(request), expectedError); + }); + }); + + describe('createNote', () => { + it('invokes createNote without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.CreateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.CreateNoteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Note() + ); + client.innerApiCalls.createNote = stubSimpleCall(expectedResponse); + const [response] = await client.createNote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNote without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.CreateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.CreateNoteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Note() + ); + client.innerApiCalls.createNote = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNote( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.INote|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNote with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.CreateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.CreateNoteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createNote(request), expectedError); + const actualRequest = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNote with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.CreateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.CreateNoteRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createNote(request), expectedError); + }); + }); + + describe('batchCreateNotes', () => { + it('invokes batchCreateNotes without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.BatchCreateNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateNotesResponse() + ); + client.innerApiCalls.batchCreateNotes = stubSimpleCall(expectedResponse); + const [response] = await client.batchCreateNotes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateNotes without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.BatchCreateNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateNotesResponse() + ); + client.innerApiCalls.batchCreateNotes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateNotes( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.IBatchCreateNotesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateNotes with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.BatchCreateNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateNotes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchCreateNotes(request), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateNotes with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.BatchCreateNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.BatchCreateNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.batchCreateNotes(request), expectedError); + }); + }); + + describe('updateNote', () => { + it('invokes updateNote without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.UpdateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.UpdateNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Note() + ); + client.innerApiCalls.updateNote = stubSimpleCall(expectedResponse); + const [response] = await client.updateNote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNote without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.UpdateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.UpdateNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.Note() + ); + client.innerApiCalls.updateNote = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNote( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.INote|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNote with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.UpdateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.UpdateNoteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateNote(request), expectedError); + const actualRequest = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNote with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.UpdateNoteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.UpdateNoteRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateNote(request), expectedError); + }); + }); + + describe('getVulnerabilityOccurrencesSummary', () => { + it('invokes getVulnerabilityOccurrencesSummary without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.VulnerabilityOccurrencesSummary() + ); + client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCall(expectedResponse); + const [response] = await client.getVulnerabilityOccurrencesSummary(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVulnerabilityOccurrencesSummary without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.grafeas.v1beta1.VulnerabilityOccurrencesSummary() + ); + client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVulnerabilityOccurrencesSummary( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVulnerabilityOccurrencesSummary with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVulnerabilityOccurrencesSummary(request), expectedError); + const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVulnerabilityOccurrencesSummary with closed client', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVulnerabilityOccurrencesSummary(request), expectedError); + }); + }); + + describe('listOccurrences', () => { + it('invokes listOccurrences without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + ]; + client.innerApiCalls.listOccurrences = stubSimpleCall(expectedResponse); + const [response] = await client.listOccurrences(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOccurrences without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + ]; + client.innerApiCalls.listOccurrences = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listOccurrences( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.IOccurrence[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOccurrences with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listOccurrences = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listOccurrences(request), expectedError); + const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listOccurrencesStream without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + ]; + client.descriptors.page.listOccurrences.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listOccurrencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1beta1.Occurrence[] = []; + stream.on('data', (response: protos.grafeas.v1beta1.Occurrence) => { + 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.listOccurrences.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listOccurrences, request)); + assert( + (client.descriptors.page.listOccurrences.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listOccurrencesStream with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listOccurrences.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listOccurrencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1beta1.Occurrence[] = []; + stream.on('data', (response: protos.grafeas.v1beta1.Occurrence) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listOccurrences.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listOccurrences, request)); + assert( + (client.descriptors.page.listOccurrences.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listOccurrences without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + ]; + client.descriptors.page.listOccurrences.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.grafeas.v1beta1.IOccurrence[] = []; + const iterable = client.listOccurrencesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listOccurrences with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listOccurrences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listOccurrencesAsync(request); + await assert.rejects(async () => { + const responses: protos.grafeas.v1beta1.IOccurrence[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listNotes', () => { + it('invokes listNotes without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + ]; + client.innerApiCalls.listNotes = stubSimpleCall(expectedResponse); + const [response] = await client.listNotes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotes without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + ]; + client.innerApiCalls.listNotes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNotes( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.INote[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotes with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNotes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNotes(request), expectedError); + const actualRequest = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotesStream without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + ]; + client.descriptors.page.listNotes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNotesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1beta1.Note[] = []; + stream.on('data', (response: protos.grafeas.v1beta1.Note) => { + 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.listNotes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotes, request)); + assert( + (client.descriptors.page.listNotes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNotesStream with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNotesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1beta1.Note[] = []; + stream.on('data', (response: protos.grafeas.v1beta1.Note) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNotes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotes, request)); + assert( + (client.descriptors.page.listNotes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNotes without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + generateSampleMessage(new protos.grafeas.v1beta1.Note()), + ]; + client.descriptors.page.listNotes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.grafeas.v1beta1.INote[] = []; + const iterable = client.listNotesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNotes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNotes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNotes with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNotesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNotesAsync(request); + await assert.rejects(async () => { + const responses: protos.grafeas.v1beta1.INote[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNotes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNotes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listNoteOccurrences', () => { + it('invokes listNoteOccurrences without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + ]; + client.innerApiCalls.listNoteOccurrences = stubSimpleCall(expectedResponse); + const [response] = await client.listNoteOccurrences(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNoteOccurrences without error using callback', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + ]; + client.innerApiCalls.listNoteOccurrences = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNoteOccurrences( + request, + (err?: Error|null, result?: protos.grafeas.v1beta1.IOccurrence[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNoteOccurrences with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNoteOccurrences = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNoteOccurrences(request), expectedError); + const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNoteOccurrencesStream without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + ]; + client.descriptors.page.listNoteOccurrences.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNoteOccurrencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1beta1.Occurrence[] = []; + stream.on('data', (response: protos.grafeas.v1beta1.Occurrence) => { + 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.listNoteOccurrences.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNoteOccurrences, request)); + assert( + (client.descriptors.page.listNoteOccurrences.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNoteOccurrencesStream with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNoteOccurrences.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNoteOccurrencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.grafeas.v1beta1.Occurrence[] = []; + stream.on('data', (response: protos.grafeas.v1beta1.Occurrence) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNoteOccurrences.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNoteOccurrences, request)); + assert( + (client.descriptors.page.listNoteOccurrences.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNoteOccurrences without error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), + ]; + client.descriptors.page.listNoteOccurrences.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.grafeas.v1beta1.IOccurrence[] = []; + const iterable = client.listNoteOccurrencesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNoteOccurrences with error', async () => { + const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNoteOccurrences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNoteOccurrencesAsync(request); + await assert.rejects(async () => { + const responses: protos.grafeas.v1beta1.IOccurrence[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); +}); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/tsconfig.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1beta1/webpack.config.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/webpack.config.js new file mode 100644 index 00000000000..f9beacf3ce3 --- /dev/null +++ b/owl-bot-staging/google-devtools-containeranalysis/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: 'containeranalysis', + filename: './containeranalysis.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-iam-credentials/v1/.eslintignore b/owl-bot-staging/google-iam-credentials/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-iam-credentials/v1/.eslintrc.json b/owl-bot-staging/google-iam-credentials/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-iam-credentials/v1/.gitignore b/owl-bot-staging/google-iam-credentials/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/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-iam-credentials/v1/.jsdoc.js b/owl-bot-staging/google-iam-credentials/v1/.jsdoc.js new file mode 100644 index 00000000000..0c36c8c44aa --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/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/iam-credentials', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-iam-credentials/v1/.mocharc.js b/owl-bot-staging/google-iam-credentials/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/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-iam-credentials/v1/.prettierrc.js b/owl-bot-staging/google-iam-credentials/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/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-iam-credentials/v1/README.md b/owl-bot-staging/google-iam-credentials/v1/README.md new file mode 100644 index 00000000000..da07c65a8b1 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/README.md @@ -0,0 +1 @@ +Credentials: Nodejs Client diff --git a/owl-bot-staging/google-iam-credentials/v1/package.json b/owl-bot-staging/google-iam-credentials/v1/package.json new file mode 100644 index 00000000000..e77115cfa45 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/iam-credentials", + "version": "0.1.0", + "description": "Credentials client for Node.js", + "repository": "googleapis/nodejs-credentials", + "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 credentials", + "credentials", + "i a m credentials" + ], + "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-iam-credentials/v1/protos/google/iam/credentials/v1/common.proto b/owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/common.proto new file mode 100644 index 00000000000..5f2d0fdc735 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/common.proto @@ -0,0 +1,190 @@ +// 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.iam.credentials.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Iam.Credentials.V1"; +option go_package = "cloud.google.com/go/iam/credentials/apiv1/credentialspb;credentialspb"; +option java_multiple_files = true; +option java_outer_classname = "IAMCredentialsCommonProto"; +option java_package = "com.google.cloud.iam.credentials.v1"; +option php_namespace = "Google\\Cloud\\Iam\\Credentials\\V1"; +option (google.api.resource_definition) = { + type: "iam.googleapis.com/ServiceAccount" + pattern: "projects/{project}/serviceAccounts/{service_account}" +}; + +message GenerateAccessTokenRequest { + // Required. The resource name of the service account for which the credentials + // are requested, in the following format: + // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + // character is required; replacing it with a project ID is invalid. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + } + ]; + + // The sequence of service accounts in a delegation chain. Each service + // account must be granted the `roles/iam.serviceAccountTokenCreator` role + // on its next service account in the chain. The last service account in the + // chain must be granted the `roles/iam.serviceAccountTokenCreator` role + // on the service account that is specified in the `name` field of the + // request. + // + // The delegates must have the following format: + // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + // character is required; replacing it with a project ID is invalid. + repeated string delegates = 2; + + // Required. Code to identify the scopes to be included in the OAuth 2.0 access token. + // See https://developers.google.com/identity/protocols/googlescopes for more + // information. + // At least one value required. + repeated string scope = 4 [(google.api.field_behavior) = REQUIRED]; + + // The desired lifetime duration of the access token in seconds. + // Must be set to a value less than or equal to 3600 (1 hour). If a value is + // not specified, the token's lifetime will be set to a default value of one + // hour. + google.protobuf.Duration lifetime = 7; +} + +message GenerateAccessTokenResponse { + // The OAuth 2.0 access token. + string access_token = 1; + + // Token expiration time. + // The expiration time is always set. + google.protobuf.Timestamp expire_time = 3; +} + +message SignBlobRequest { + // Required. The resource name of the service account for which the credentials + // are requested, in the following format: + // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + // character is required; replacing it with a project ID is invalid. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + } + ]; + + // The sequence of service accounts in a delegation chain. Each service + // account must be granted the `roles/iam.serviceAccountTokenCreator` role + // on its next service account in the chain. The last service account in the + // chain must be granted the `roles/iam.serviceAccountTokenCreator` role + // on the service account that is specified in the `name` field of the + // request. + // + // The delegates must have the following format: + // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + // character is required; replacing it with a project ID is invalid. + repeated string delegates = 3; + + // Required. The bytes to sign. + bytes payload = 5 [(google.api.field_behavior) = REQUIRED]; +} + +message SignBlobResponse { + // The ID of the key used to sign the blob. + string key_id = 1; + + // The signed blob. + bytes signed_blob = 4; +} + +message SignJwtRequest { + // Required. The resource name of the service account for which the credentials + // are requested, in the following format: + // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + // character is required; replacing it with a project ID is invalid. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + } + ]; + + // The sequence of service accounts in a delegation chain. Each service + // account must be granted the `roles/iam.serviceAccountTokenCreator` role + // on its next service account in the chain. The last service account in the + // chain must be granted the `roles/iam.serviceAccountTokenCreator` role + // on the service account that is specified in the `name` field of the + // request. + // + // The delegates must have the following format: + // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + // character is required; replacing it with a project ID is invalid. + repeated string delegates = 3; + + // Required. The JWT payload to sign: a JSON object that contains a JWT Claims Set. + string payload = 5 [(google.api.field_behavior) = REQUIRED]; +} + +message SignJwtResponse { + // The ID of the key used to sign the JWT. + string key_id = 1; + + // The signed JWT. + string signed_jwt = 2; +} + +message GenerateIdTokenRequest { + // Required. The resource name of the service account for which the credentials + // are requested, in the following format: + // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + // character is required; replacing it with a project ID is invalid. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + } + ]; + + // The sequence of service accounts in a delegation chain. Each service + // account must be granted the `roles/iam.serviceAccountTokenCreator` role + // on its next service account in the chain. The last service account in the + // chain must be granted the `roles/iam.serviceAccountTokenCreator` role + // on the service account that is specified in the `name` field of the + // request. + // + // The delegates must have the following format: + // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + // character is required; replacing it with a project ID is invalid. + repeated string delegates = 2; + + // Required. The audience for the token, such as the API or account that this token + // grants access to. + string audience = 3 [(google.api.field_behavior) = REQUIRED]; + + // Include the service account email in the token. If set to `true`, the + // token will contain `email` and `email_verified` claims. + bool include_email = 4; +} + +message GenerateIdTokenResponse { + // The OpenId Connect ID token. + string token = 1; +} diff --git a/owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/iamcredentials.proto b/owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/iamcredentials.proto new file mode 100644 index 00000000000..4bbd1a16f6c --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/iamcredentials.proto @@ -0,0 +1,79 @@ +// 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.iam.credentials.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/iam/credentials/v1/common.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Iam.Credentials.V1"; +option go_package = "cloud.google.com/go/iam/credentials/apiv1/credentialspb;credentialspb"; +option java_multiple_files = true; +option java_outer_classname = "IAMCredentialsProto"; +option java_package = "com.google.cloud.iam.credentials.v1"; +option php_namespace = "Google\\Cloud\\Iam\\Credentials\\V1"; + +// A service account is a special type of Google account that belongs to your +// application or a virtual machine (VM), instead of to an individual end user. +// Your application assumes the identity of the service account to call Google +// APIs, so that the users aren't directly involved. +// +// Service account credentials are used to temporarily assume the identity +// of the service account. Supported credential types include OAuth 2.0 access +// tokens, OpenID Connect ID tokens, self-signed JSON Web Tokens (JWTs), and +// more. +service IAMCredentials { + option (google.api.default_host) = "iamcredentials.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Generates an OAuth 2.0 access token for a service account. + rpc GenerateAccessToken(GenerateAccessTokenRequest) returns (GenerateAccessTokenResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/serviceAccounts/*}:generateAccessToken" + body: "*" + }; + option (google.api.method_signature) = "name,delegates,scope,lifetime"; + } + + // Generates an OpenID Connect ID token for a service account. + rpc GenerateIdToken(GenerateIdTokenRequest) returns (GenerateIdTokenResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/serviceAccounts/*}:generateIdToken" + body: "*" + }; + option (google.api.method_signature) = "name,delegates,audience,include_email"; + } + + // Signs a blob using a service account's system-managed private key. + rpc SignBlob(SignBlobRequest) returns (SignBlobResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/serviceAccounts/*}:signBlob" + body: "*" + }; + option (google.api.method_signature) = "name,delegates,payload"; + } + + // Signs a JWT using a service account's system-managed private key. + rpc SignJwt(SignJwtRequest) returns (SignJwtResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/serviceAccounts/*}:signJwt" + body: "*" + }; + option (google.api.method_signature) = "name,delegates,payload"; + } +} diff --git a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_access_token.js b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_access_token.js new file mode 100644 index 00000000000..bebdd288dc9 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_access_token.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(name, scope) { + // [START iamcredentials_v1_generated_IAMCredentials_GenerateAccessToken_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 service account for which the credentials + * are requested, in the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + */ + // const name = 'abc123' + /** + * The sequence of service accounts in a delegation chain. Each service + * account must be granted the `roles/iam.serviceAccountTokenCreator` role + * on its next service account in the chain. The last service account in the + * chain must be granted the `roles/iam.serviceAccountTokenCreator` role + * on the service account that is specified in the `name` field of the + * request. + * The delegates must have the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + */ + // const delegates = ['abc','def'] + /** + * Required. Code to identify the scopes to be included in the OAuth 2.0 access token. + * See https://developers.google.com/identity/protocols/googlescopes for more + * information. + * At least one value required. + */ + // const scope = ['abc','def'] + /** + * The desired lifetime duration of the access token in seconds. + * Must be set to a value less than or equal to 3600 (1 hour). If a value is + * not specified, the token's lifetime will be set to a default value of one + * hour. + */ + // const lifetime = {} + + // Imports the Credentials library + const {IAMCredentialsClient} = require('@google-cloud/iam-credentials').v1; + + // Instantiates a client + const credentialsClient = new IAMCredentialsClient(); + + async function callGenerateAccessToken() { + // Construct request + const request = { + name, + scope, + }; + + // Run request + const response = await credentialsClient.generateAccessToken(request); + console.log(response); + } + + callGenerateAccessToken(); + // [END iamcredentials_v1_generated_IAMCredentials_GenerateAccessToken_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_id_token.js b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_id_token.js new file mode 100644 index 00000000000..10f504b98d7 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_id_token.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, audience) { + // [START iamcredentials_v1_generated_IAMCredentials_GenerateIdToken_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 service account for which the credentials + * are requested, in the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + */ + // const name = 'abc123' + /** + * The sequence of service accounts in a delegation chain. Each service + * account must be granted the `roles/iam.serviceAccountTokenCreator` role + * on its next service account in the chain. The last service account in the + * chain must be granted the `roles/iam.serviceAccountTokenCreator` role + * on the service account that is specified in the `name` field of the + * request. + * The delegates must have the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + */ + // const delegates = ['abc','def'] + /** + * Required. The audience for the token, such as the API or account that this token + * grants access to. + */ + // const audience = 'abc123' + /** + * Include the service account email in the token. If set to `true`, the + * token will contain `email` and `email_verified` claims. + */ + // const includeEmail = true + + // Imports the Credentials library + const {IAMCredentialsClient} = require('@google-cloud/iam-credentials').v1; + + // Instantiates a client + const credentialsClient = new IAMCredentialsClient(); + + async function callGenerateIdToken() { + // Construct request + const request = { + name, + audience, + }; + + // Run request + const response = await credentialsClient.generateIdToken(request); + console.log(response); + } + + callGenerateIdToken(); + // [END iamcredentials_v1_generated_IAMCredentials_GenerateIdToken_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_blob.js b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_blob.js new file mode 100644 index 00000000000..47f010b247d --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_blob.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(name, payload) { + // [START iamcredentials_v1_generated_IAMCredentials_SignBlob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 service account for which the credentials + * are requested, in the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + */ + // const name = 'abc123' + /** + * The sequence of service accounts in a delegation chain. Each service + * account must be granted the `roles/iam.serviceAccountTokenCreator` role + * on its next service account in the chain. The last service account in the + * chain must be granted the `roles/iam.serviceAccountTokenCreator` role + * on the service account that is specified in the `name` field of the + * request. + * The delegates must have the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + */ + // const delegates = ['abc','def'] + /** + * Required. The bytes to sign. + */ + // const payload = Buffer.from('string') + + // Imports the Credentials library + const {IAMCredentialsClient} = require('@google-cloud/iam-credentials').v1; + + // Instantiates a client + const credentialsClient = new IAMCredentialsClient(); + + async function callSignBlob() { + // Construct request + const request = { + name, + payload, + }; + + // Run request + const response = await credentialsClient.signBlob(request); + console.log(response); + } + + callSignBlob(); + // [END iamcredentials_v1_generated_IAMCredentials_SignBlob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_jwt.js b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_jwt.js new file mode 100644 index 00000000000..3f0726fff1e --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_jwt.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(name, payload) { + // [START iamcredentials_v1_generated_IAMCredentials_SignJwt_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 service account for which the credentials + * are requested, in the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + */ + // const name = 'abc123' + /** + * The sequence of service accounts in a delegation chain. Each service + * account must be granted the `roles/iam.serviceAccountTokenCreator` role + * on its next service account in the chain. The last service account in the + * chain must be granted the `roles/iam.serviceAccountTokenCreator` role + * on the service account that is specified in the `name` field of the + * request. + * The delegates must have the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + */ + // const delegates = ['abc','def'] + /** + * Required. The JWT payload to sign: a JSON object that contains a JWT Claims Set. + */ + // const payload = 'abc123' + + // Imports the Credentials library + const {IAMCredentialsClient} = require('@google-cloud/iam-credentials').v1; + + // Instantiates a client + const credentialsClient = new IAMCredentialsClient(); + + async function callSignJwt() { + // Construct request + const request = { + name, + payload, + }; + + // Run request + const response = await credentialsClient.signJwt(request); + console.log(response); + } + + callSignJwt(); + // [END iamcredentials_v1_generated_IAMCredentials_SignJwt_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/snippet_metadata_google.iam.credentials.v1.json b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/snippet_metadata_google.iam.credentials.v1.json new file mode 100644 index 00000000000..3810f790eb6 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/snippet_metadata_google.iam.credentials.v1.json @@ -0,0 +1,215 @@ +{ + "clientLibrary": { + "name": "nodejs-credentials", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.iam.credentials.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "iamcredentials_v1_generated_IAMCredentials_GenerateAccessToken_async", + "title": "IAMCredentials generateAccessToken Sample", + "origin": "API_DEFINITION", + "description": " Generates an OAuth 2.0 access token for a service account.", + "canonical": true, + "file": "i_a_m_credentials.generate_access_token.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateAccessToken", + "fullName": "google.iam.credentials.v1.IAMCredentials.GenerateAccessToken", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "delegates", + "type": "TYPE_STRING[]" + }, + { + "name": "scope", + "type": "TYPE_STRING[]" + }, + { + "name": "lifetime", + "type": ".google.protobuf.Duration" + } + ], + "resultType": ".google.iam.credentials.v1.GenerateAccessTokenResponse", + "client": { + "shortName": "IAMCredentialsClient", + "fullName": "google.iam.credentials.v1.IAMCredentialsClient" + }, + "method": { + "shortName": "GenerateAccessToken", + "fullName": "google.iam.credentials.v1.IAMCredentials.GenerateAccessToken", + "service": { + "shortName": "IAMCredentials", + "fullName": "google.iam.credentials.v1.IAMCredentials" + } + } + } + }, + { + "regionTag": "iamcredentials_v1_generated_IAMCredentials_GenerateIdToken_async", + "title": "IAMCredentials generateIdToken Sample", + "origin": "API_DEFINITION", + "description": " Generates an OpenID Connect ID token for a service account.", + "canonical": true, + "file": "i_a_m_credentials.generate_id_token.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateIdToken", + "fullName": "google.iam.credentials.v1.IAMCredentials.GenerateIdToken", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "delegates", + "type": "TYPE_STRING[]" + }, + { + "name": "audience", + "type": "TYPE_STRING" + }, + { + "name": "include_email", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.iam.credentials.v1.GenerateIdTokenResponse", + "client": { + "shortName": "IAMCredentialsClient", + "fullName": "google.iam.credentials.v1.IAMCredentialsClient" + }, + "method": { + "shortName": "GenerateIdToken", + "fullName": "google.iam.credentials.v1.IAMCredentials.GenerateIdToken", + "service": { + "shortName": "IAMCredentials", + "fullName": "google.iam.credentials.v1.IAMCredentials" + } + } + } + }, + { + "regionTag": "iamcredentials_v1_generated_IAMCredentials_SignBlob_async", + "title": "IAMCredentials signBlob Sample", + "origin": "API_DEFINITION", + "description": " Signs a blob using a service account's system-managed private key.", + "canonical": true, + "file": "i_a_m_credentials.sign_blob.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SignBlob", + "fullName": "google.iam.credentials.v1.IAMCredentials.SignBlob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "delegates", + "type": "TYPE_STRING[]" + }, + { + "name": "payload", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.iam.credentials.v1.SignBlobResponse", + "client": { + "shortName": "IAMCredentialsClient", + "fullName": "google.iam.credentials.v1.IAMCredentialsClient" + }, + "method": { + "shortName": "SignBlob", + "fullName": "google.iam.credentials.v1.IAMCredentials.SignBlob", + "service": { + "shortName": "IAMCredentials", + "fullName": "google.iam.credentials.v1.IAMCredentials" + } + } + } + }, + { + "regionTag": "iamcredentials_v1_generated_IAMCredentials_SignJwt_async", + "title": "IAMCredentials signJwt Sample", + "origin": "API_DEFINITION", + "description": " Signs a JWT using a service account's system-managed private key.", + "canonical": true, + "file": "i_a_m_credentials.sign_jwt.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SignJwt", + "fullName": "google.iam.credentials.v1.IAMCredentials.SignJwt", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "delegates", + "type": "TYPE_STRING[]" + }, + { + "name": "payload", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.iam.credentials.v1.SignJwtResponse", + "client": { + "shortName": "IAMCredentialsClient", + "fullName": "google.iam.credentials.v1.IAMCredentialsClient" + }, + "method": { + "shortName": "SignJwt", + "fullName": "google.iam.credentials.v1.IAMCredentials.SignJwt", + "service": { + "shortName": "IAMCredentials", + "fullName": "google.iam.credentials.v1.IAMCredentials" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-iam-credentials/v1/src/index.ts b/owl-bot-staging/google-iam-credentials/v1/src/index.ts new file mode 100644 index 00000000000..f9b086d4911 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/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 IAMCredentialsClient = v1.IAMCredentialsClient; +type IAMCredentialsClient = v1.IAMCredentialsClient; +export {v1, IAMCredentialsClient}; +export default {v1, IAMCredentialsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-iam-credentials/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-iam-credentials/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..a463d17b104 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/src/v1/gapic_metadata.json @@ -0,0 +1,63 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.iam.credentials.v1", + "libraryPackage": "@google-cloud/iam-credentials", + "services": { + "IAMCredentials": { + "clients": { + "grpc": { + "libraryClient": "IAMCredentialsClient", + "rpcs": { + "GenerateAccessToken": { + "methods": [ + "generateAccessToken" + ] + }, + "GenerateIdToken": { + "methods": [ + "generateIdToken" + ] + }, + "SignBlob": { + "methods": [ + "signBlob" + ] + }, + "SignJwt": { + "methods": [ + "signJwt" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "IAMCredentialsClient", + "rpcs": { + "GenerateAccessToken": { + "methods": [ + "generateAccessToken" + ] + }, + "GenerateIdToken": { + "methods": [ + "generateIdToken" + ] + }, + "SignBlob": { + "methods": [ + "signBlob" + ] + }, + "SignJwt": { + "methods": [ + "signJwt" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client.ts b/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client.ts new file mode 100644 index 00000000000..7e5f818ae4e --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client.ts @@ -0,0 +1,670 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/i_a_m_credentials_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './i_a_m_credentials_client_config.json'; +const version = require('../../../package.json').version; + +/** + * A service account is a special type of Google account that belongs to your + * application or a virtual machine (VM), instead of to an individual end user. + * Your application assumes the identity of the service account to call Google + * APIs, so that the users aren't directly involved. + * + * Service account credentials are used to temporarily assume the identity + * of the service account. Supported credential types include OAuth 2.0 access + * tokens, OpenID Connect ID tokens, self-signed JSON Web Tokens (JWTs), and + * more. + * @class + * @memberof v1 + */ +export class IAMCredentialsClient { + 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}; + iAMCredentialsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of IAMCredentialsClient. + * + * @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 IAMCredentialsClient({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 IAMCredentialsClient; + 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.iam.credentials.v1.IAMCredentials', 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.iAMCredentialsStub) { + return this.iAMCredentialsStub; + } + + // Put together the "service stub" for + // google.iam.credentials.v1.IAMCredentials. + this.iAMCredentialsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.iam.credentials.v1.IAMCredentials') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.iam.credentials.v1.IAMCredentials, + 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 iAMCredentialsStubMethods = + ['generateAccessToken', 'generateIdToken', 'signBlob', 'signJwt']; + for (const methodName of iAMCredentialsStubMethods) { + const callPromise = this.iAMCredentialsStub.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.iAMCredentialsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'iamcredentials.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 'iamcredentials.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 -- + // ------------------- +/** + * Generates an OAuth 2.0 access token for a service account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the service account for which the credentials + * are requested, in the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + * @param {string[]} request.delegates + * The sequence of service accounts in a delegation chain. Each service + * account must be granted the `roles/iam.serviceAccountTokenCreator` role + * on its next service account in the chain. The last service account in the + * chain must be granted the `roles/iam.serviceAccountTokenCreator` role + * on the service account that is specified in the `name` field of the + * request. + * + * The delegates must have the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + * @param {string[]} request.scope + * Required. Code to identify the scopes to be included in the OAuth 2.0 access token. + * See https://developers.google.com/identity/protocols/googlescopes for more + * information. + * At least one value required. + * @param {google.protobuf.Duration} request.lifetime + * The desired lifetime duration of the access token in seconds. + * Must be set to a value less than or equal to 3600 (1 hour). If a value is + * not specified, the token's lifetime will be set to a default value of one + * hour. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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.credentials.v1.GenerateAccessTokenResponse|GenerateAccessTokenResponse}. + * Please see the {@link 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_a_m_credentials.generate_access_token.js + * region_tag:iamcredentials_v1_generated_IAMCredentials_GenerateAccessToken_async + */ + generateAccessToken( + request?: protos.google.iam.credentials.v1.IGenerateAccessTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, + protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|undefined, {}|undefined + ]>; + generateAccessToken( + request: protos.google.iam.credentials.v1.IGenerateAccessTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, + protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>): void; + generateAccessToken( + request: protos.google.iam.credentials.v1.IGenerateAccessTokenRequest, + callback: Callback< + protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, + protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>): void; + generateAccessToken( + request?: protos.google.iam.credentials.v1.IGenerateAccessTokenRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, + protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, + protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, + protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.generateAccessToken(request, options, callback); + } +/** + * Generates an OpenID Connect ID token for a service account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the service account for which the credentials + * are requested, in the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + * @param {string[]} request.delegates + * The sequence of service accounts in a delegation chain. Each service + * account must be granted the `roles/iam.serviceAccountTokenCreator` role + * on its next service account in the chain. The last service account in the + * chain must be granted the `roles/iam.serviceAccountTokenCreator` role + * on the service account that is specified in the `name` field of the + * request. + * + * The delegates must have the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + * @param {string} request.audience + * Required. The audience for the token, such as the API or account that this token + * grants access to. + * @param {boolean} request.includeEmail + * Include the service account email in the token. If set to `true`, the + * token will contain `email` and `email_verified` claims. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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.credentials.v1.GenerateIdTokenResponse|GenerateIdTokenResponse}. + * Please see the {@link 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_a_m_credentials.generate_id_token.js + * region_tag:iamcredentials_v1_generated_IAMCredentials_GenerateIdToken_async + */ + generateIdToken( + request?: protos.google.iam.credentials.v1.IGenerateIdTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.credentials.v1.IGenerateIdTokenResponse, + protos.google.iam.credentials.v1.IGenerateIdTokenRequest|undefined, {}|undefined + ]>; + generateIdToken( + request: protos.google.iam.credentials.v1.IGenerateIdTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.credentials.v1.IGenerateIdTokenResponse, + protos.google.iam.credentials.v1.IGenerateIdTokenRequest|null|undefined, + {}|null|undefined>): void; + generateIdToken( + request: protos.google.iam.credentials.v1.IGenerateIdTokenRequest, + callback: Callback< + protos.google.iam.credentials.v1.IGenerateIdTokenResponse, + protos.google.iam.credentials.v1.IGenerateIdTokenRequest|null|undefined, + {}|null|undefined>): void; + generateIdToken( + request?: protos.google.iam.credentials.v1.IGenerateIdTokenRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.credentials.v1.IGenerateIdTokenResponse, + protos.google.iam.credentials.v1.IGenerateIdTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.credentials.v1.IGenerateIdTokenResponse, + protos.google.iam.credentials.v1.IGenerateIdTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.credentials.v1.IGenerateIdTokenResponse, + protos.google.iam.credentials.v1.IGenerateIdTokenRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.generateIdToken(request, options, callback); + } +/** + * Signs a blob using a service account's system-managed private key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the service account for which the credentials + * are requested, in the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + * @param {string[]} request.delegates + * The sequence of service accounts in a delegation chain. Each service + * account must be granted the `roles/iam.serviceAccountTokenCreator` role + * on its next service account in the chain. The last service account in the + * chain must be granted the `roles/iam.serviceAccountTokenCreator` role + * on the service account that is specified in the `name` field of the + * request. + * + * The delegates must have the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + * @param {Buffer} request.payload + * Required. The bytes to sign. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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.credentials.v1.SignBlobResponse|SignBlobResponse}. + * Please see the {@link 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_a_m_credentials.sign_blob.js + * region_tag:iamcredentials_v1_generated_IAMCredentials_SignBlob_async + */ + signBlob( + request?: protos.google.iam.credentials.v1.ISignBlobRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.credentials.v1.ISignBlobResponse, + protos.google.iam.credentials.v1.ISignBlobRequest|undefined, {}|undefined + ]>; + signBlob( + request: protos.google.iam.credentials.v1.ISignBlobRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.credentials.v1.ISignBlobResponse, + protos.google.iam.credentials.v1.ISignBlobRequest|null|undefined, + {}|null|undefined>): void; + signBlob( + request: protos.google.iam.credentials.v1.ISignBlobRequest, + callback: Callback< + protos.google.iam.credentials.v1.ISignBlobResponse, + protos.google.iam.credentials.v1.ISignBlobRequest|null|undefined, + {}|null|undefined>): void; + signBlob( + request?: protos.google.iam.credentials.v1.ISignBlobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.credentials.v1.ISignBlobResponse, + protos.google.iam.credentials.v1.ISignBlobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.credentials.v1.ISignBlobResponse, + protos.google.iam.credentials.v1.ISignBlobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.credentials.v1.ISignBlobResponse, + protos.google.iam.credentials.v1.ISignBlobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.signBlob(request, options, callback); + } +/** + * Signs a JWT using a service account's system-managed private key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the service account for which the credentials + * are requested, in the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + * @param {string[]} request.delegates + * The sequence of service accounts in a delegation chain. Each service + * account must be granted the `roles/iam.serviceAccountTokenCreator` role + * on its next service account in the chain. The last service account in the + * chain must be granted the `roles/iam.serviceAccountTokenCreator` role + * on the service account that is specified in the `name` field of the + * request. + * + * The delegates must have the following format: + * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + * character is required; replacing it with a project ID is invalid. + * @param {string} request.payload + * Required. The JWT payload to sign: a JSON object that contains a JWT Claims 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.iam.credentials.v1.SignJwtResponse|SignJwtResponse}. + * Please see the {@link 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_a_m_credentials.sign_jwt.js + * region_tag:iamcredentials_v1_generated_IAMCredentials_SignJwt_async + */ + signJwt( + request?: protos.google.iam.credentials.v1.ISignJwtRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.credentials.v1.ISignJwtResponse, + protos.google.iam.credentials.v1.ISignJwtRequest|undefined, {}|undefined + ]>; + signJwt( + request: protos.google.iam.credentials.v1.ISignJwtRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.credentials.v1.ISignJwtResponse, + protos.google.iam.credentials.v1.ISignJwtRequest|null|undefined, + {}|null|undefined>): void; + signJwt( + request: protos.google.iam.credentials.v1.ISignJwtRequest, + callback: Callback< + protos.google.iam.credentials.v1.ISignJwtResponse, + protos.google.iam.credentials.v1.ISignJwtRequest|null|undefined, + {}|null|undefined>): void; + signJwt( + request?: protos.google.iam.credentials.v1.ISignJwtRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.credentials.v1.ISignJwtResponse, + protos.google.iam.credentials.v1.ISignJwtRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.credentials.v1.ISignJwtResponse, + protos.google.iam.credentials.v1.ISignJwtRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.credentials.v1.ISignJwtResponse, + protos.google.iam.credentials.v1.ISignJwtRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.signJwt(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.iAMCredentialsStub && !this._terminated) { + return this.iAMCredentialsStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client_config.json b/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client_config.json new file mode 100644 index 00000000000..8415ecc505a --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.iam.credentials.v1.IAMCredentials": { + "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": { + "GenerateAccessToken": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GenerateIdToken": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SignBlob": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SignJwt": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_proto_list.json b/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_proto_list.json new file mode 100644 index 00000000000..8cc4ef0beee --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/iam/credentials/v1/common.proto", + "../../protos/google/iam/credentials/v1/iamcredentials.proto" +] diff --git a/owl-bot-staging/google-iam-credentials/v1/src/v1/index.ts b/owl-bot-staging/google-iam-credentials/v1/src/v1/index.ts new file mode 100644 index 00000000000..7a588581bf2 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/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 {IAMCredentialsClient} from './i_a_m_credentials_client'; diff --git a/owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..62a9d42357d --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/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 credentials = require('@google-cloud/iam-credentials'); + +function main() { + const iAMCredentialsClient = new credentials.IAMCredentialsClient(); +} + +main(); diff --git a/owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..b74908e57a1 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/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 {IAMCredentialsClient} from '@google-cloud/iam-credentials'; + +// check that the client class type name can be used +function doStuffWithIAMCredentialsClient(client: IAMCredentialsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const iAMCredentialsClient = new IAMCredentialsClient(); + doStuffWithIAMCredentialsClient(iAMCredentialsClient); +} + +main(); diff --git a/owl-bot-staging/google-iam-credentials/v1/system-test/install.ts b/owl-bot-staging/google-iam-credentials/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/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-iam-credentials/v1/test/gapic_i_a_m_credentials_v1.ts b/owl-bot-staging/google-iam-credentials/v1/test/gapic_i_a_m_credentials_v1.ts new file mode 100644 index 00000000000..3596307a297 --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/v1/test/gapic_i_a_m_credentials_v1.ts @@ -0,0 +1,582 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 iamcredentialsModule 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.IAMCredentialsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = iamcredentialsModule.v1.IAMCredentialsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = iamcredentialsModule.v1.IAMCredentialsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = iamcredentialsModule.v1.IAMCredentialsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.iAMCredentialsStub, undefined); + await client.initialize(); + assert(client.iAMCredentialsStub); + }); + + it('has close method for the initialized client', done => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.iAMCredentialsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.iAMCredentialsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + 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 iamcredentialsModule.v1.IAMCredentialsClient({ + 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('generateAccessToken', () => { + it('invokes generateAccessToken without error', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.GenerateAccessTokenRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateAccessTokenResponse() + ); + client.innerApiCalls.generateAccessToken = stubSimpleCall(expectedResponse); + const [response] = await client.generateAccessToken(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAccessToken without error using callback', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.GenerateAccessTokenRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateAccessTokenResponse() + ); + client.innerApiCalls.generateAccessToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateAccessToken( + request, + (err?: Error|null, result?: protos.google.iam.credentials.v1.IGenerateAccessTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAccessToken with error', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.GenerateAccessTokenRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateAccessToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateAccessToken(request), expectedError); + const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateAccessToken with closed client', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateAccessTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.GenerateAccessTokenRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateAccessToken(request), expectedError); + }); + }); + + describe('generateIdToken', () => { + it('invokes generateIdToken without error', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateIdTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.GenerateIdTokenRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateIdTokenResponse() + ); + client.innerApiCalls.generateIdToken = stubSimpleCall(expectedResponse); + const [response] = await client.generateIdToken(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateIdToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateIdToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateIdToken without error using callback', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateIdTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.GenerateIdTokenRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateIdTokenResponse() + ); + client.innerApiCalls.generateIdToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateIdToken( + request, + (err?: Error|null, result?: protos.google.iam.credentials.v1.IGenerateIdTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateIdToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateIdToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateIdToken with error', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateIdTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.GenerateIdTokenRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateIdToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateIdToken(request), expectedError); + const actualRequest = (client.innerApiCalls.generateIdToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateIdToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateIdToken with closed client', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.GenerateIdTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.GenerateIdTokenRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateIdToken(request), expectedError); + }); + }); + + describe('signBlob', () => { + it('invokes signBlob without error', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.SignBlobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.SignBlobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.credentials.v1.SignBlobResponse() + ); + client.innerApiCalls.signBlob = stubSimpleCall(expectedResponse); + const [response] = await client.signBlob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.signBlob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.signBlob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes signBlob without error using callback', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.SignBlobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.SignBlobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.credentials.v1.SignBlobResponse() + ); + client.innerApiCalls.signBlob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.signBlob( + request, + (err?: Error|null, result?: protos.google.iam.credentials.v1.ISignBlobResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.signBlob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.signBlob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes signBlob with error', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.SignBlobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.SignBlobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.signBlob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.signBlob(request), expectedError); + const actualRequest = (client.innerApiCalls.signBlob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.signBlob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes signBlob with closed client', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.SignBlobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.SignBlobRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.signBlob(request), expectedError); + }); + }); + + describe('signJwt', () => { + it('invokes signJwt without error', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.SignJwtRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.SignJwtRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.credentials.v1.SignJwtResponse() + ); + client.innerApiCalls.signJwt = stubSimpleCall(expectedResponse); + const [response] = await client.signJwt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.signJwt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.signJwt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes signJwt without error using callback', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.SignJwtRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.SignJwtRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.credentials.v1.SignJwtResponse() + ); + client.innerApiCalls.signJwt = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.signJwt( + request, + (err?: Error|null, result?: protos.google.iam.credentials.v1.ISignJwtResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.signJwt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.signJwt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes signJwt with error', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.SignJwtRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.SignJwtRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.signJwt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.signJwt(request), expectedError); + const actualRequest = (client.innerApiCalls.signJwt as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.signJwt as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes signJwt with closed client', async () => { + const client = new iamcredentialsModule.v1.IAMCredentialsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.credentials.v1.SignJwtRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.credentials.v1.SignJwtRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.signJwt(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-iam-credentials/v1/tsconfig.json b/owl-bot-staging/google-iam-credentials/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/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-iam-credentials/v1/webpack.config.js b/owl-bot-staging/google-iam-credentials/v1/webpack.config.js new file mode 100644 index 00000000000..2bd0f07dfee --- /dev/null +++ b/owl-bot-staging/google-iam-credentials/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: 'IAMCredentials', + filename: './i-a-m-credentials.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-iam/v2/.eslintignore b/owl-bot-staging/google-iam/v2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-iam/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-iam/v2/.eslintrc.json b/owl-bot-staging/google-iam/v2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-iam/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-iam/v2/.gitignore b/owl-bot-staging/google-iam/v2/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-iam/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-iam/v2/.jsdoc.js b/owl-bot-staging/google-iam/v2/.jsdoc.js new file mode 100644 index 00000000000..cdc66248f75 --- /dev/null +++ b/owl-bot-staging/google-iam/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/iam', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-iam/v2/.mocharc.js b/owl-bot-staging/google-iam/v2/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-iam/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-iam/v2/.prettierrc.js b/owl-bot-staging/google-iam/v2/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-iam/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-iam/v2/README.md b/owl-bot-staging/google-iam/v2/README.md new file mode 100644 index 00000000000..905fae6bcad --- /dev/null +++ b/owl-bot-staging/google-iam/v2/README.md @@ -0,0 +1 @@ +Iam: Nodejs Client diff --git a/owl-bot-staging/google-iam/v2/package.json b/owl-bot-staging/google-iam/v2/package.json new file mode 100644 index 00000000000..46b77b4750e --- /dev/null +++ b/owl-bot-staging/google-iam/v2/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/iam", + "version": "0.1.0", + "description": "Iam client for Node.js", + "repository": "googleapis/nodejs-iam", + "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 iam", + "iam", + "policies" + ], + "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-iam/v2/protos/google/iam/v2/deny.proto b/owl-bot-staging/google-iam/v2/protos/google/iam/v2/deny.proto new file mode 100644 index 00000000000..a3c8ff14e9a --- /dev/null +++ b/owl-bot-staging/google-iam/v2/protos/google/iam/v2/deny.proto @@ -0,0 +1,109 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.iam.v2; + +import "google/type/expr.proto"; + +option csharp_namespace = "Google.Cloud.Iam.V2"; +option go_package = "cloud.google.com/go/iam/apiv2/iampb;iampb"; +option java_multiple_files = true; +option java_outer_classname = "DenyRuleProto"; +option java_package = "com.google.iam.v2"; +option php_namespace = "Google\\Cloud\\Iam\\V2"; + +// A deny rule in an IAM deny policy. +message DenyRule { + // The identities that are prevented from using one or more permissions on + // Google Cloud resources. This field can contain the following values: + // + // * `principalSet://goog/public:all`: A special identifier that represents + // any principal that is on the internet, even if they do not have a Google + // Account or are not logged in. + // + // * `principal://goog/subject/{email_id}`: A specific Google Account. + // Includes Gmail, Cloud Identity, and Google Workspace user accounts. For + // example, `principal://goog/subject/alice@example.com`. + // + // * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific + // Google Account that was deleted recently. For example, + // `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If + // the Google Account is recovered, this identifier reverts to the standard + // identifier for a Google Account. + // + // * `principalSet://goog/group/{group_id}`: A Google group. For example, + // `principalSet://goog/group/admins@example.com`. + // + // * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group + // that was deleted recently. For example, + // `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If + // the Google group is restored, this identifier reverts to the standard + // identifier for a Google group. + // + // * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`: + // A Google Cloud service account. For example, + // `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`. + // + // * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`: + // A Google Cloud service account that was deleted recently. For example, + // `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`. + // If the service account is undeleted, this identifier reverts to the + // standard identifier for a service account. + // + // * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the + // principals associated with the specified Google Workspace or Cloud + // Identity customer ID. For example, + // `principalSet://goog/cloudIdentityCustomerId/C01Abc35`. + repeated string denied_principals = 1; + + // The identities that are excluded from the deny rule, even if they are + // listed in the `denied_principals`. For example, you could add a Google + // group to the `denied_principals`, then exclude specific users who belong to + // that group. + // + // This field can contain the same values as the `denied_principals` field, + // excluding `principalSet://goog/public:all`, which represents all users on + // the internet. + repeated string exception_principals = 2; + + // The permissions that are explicitly denied by this rule. Each permission + // uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}` + // is the fully qualified domain name for the service. For example, + // `iam.googleapis.com/roles.list`. + repeated string denied_permissions = 3; + + // Specifies the permissions that this rule excludes from the set of denied + // permissions given by `denied_permissions`. If a permission appears in + // `denied_permissions` _and_ in `exception_permissions` then it will _not_ be + // denied. + // + // The excluded permissions can be specified using the same syntax as + // `denied_permissions`. + repeated string exception_permissions = 4; + + // The condition that determines whether this deny rule applies to a request. + // If the condition expression evaluates to `true`, then the deny rule is + // applied; otherwise, the deny rule is not applied. + // + // Each deny rule is evaluated independently. If this deny rule does not apply + // to a request, other deny rules might still apply. + // + // The condition can use CEL functions that evaluate + // [resource + // tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other + // functions and operators are not supported. + google.type.Expr denial_condition = 5; +} diff --git a/owl-bot-staging/google-iam/v2/protos/google/iam/v2/policy.proto b/owl-bot-staging/google-iam/v2/protos/google/iam/v2/policy.proto new file mode 100644 index 00000000000..56f73da089b --- /dev/null +++ b/owl-bot-staging/google-iam/v2/protos/google/iam/v2/policy.proto @@ -0,0 +1,287 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.iam.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/iam/v2/deny.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Iam.V2"; +option go_package = "cloud.google.com/go/iam/apiv2/iampb;iampb"; +option java_multiple_files = true; +option java_outer_classname = "PolicyProto"; +option java_package = "com.google.iam.v2"; +option php_namespace = "Google\\Cloud\\Iam\\V2"; + +// An interface for managing Identity and Access Management (IAM) policies. +service Policies { + option (google.api.default_host) = "iam.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Retrieves the policies of the specified kind that are attached to a + // resource. + // + // The response lists only policy metadata. In particular, policy rules are + // omitted. + rpc ListPolicies(ListPoliciesRequest) returns (ListPoliciesResponse) { + option (google.api.http) = { + get: "/v2/{parent=policies/*/*}" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a policy. + rpc GetPolicy(GetPolicyRequest) returns (Policy) { + option (google.api.http) = { + get: "/v2/{name=policies/*/*/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a policy. + rpc CreatePolicy(CreatePolicyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=policies/*/*}" + body: "policy" + }; + option (google.api.method_signature) = "parent,policy,policy_id"; + option (google.longrunning.operation_info) = { + response_type: "Policy" + metadata_type: "PolicyOperationMetadata" + }; + } + + // Updates the specified policy. + // + // You can update only the rules and the display name for the policy. + // + // To update a policy, you should use a read-modify-write loop: + // + // 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the policy. + // 2. Modify the policy as needed. + // 3. Use `UpdatePolicy` to write the updated policy. + // + // This pattern helps prevent conflicts between concurrent updates. + rpc UpdatePolicy(UpdatePolicyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + put: "/v2/{policy.name=policies/*/*/*}" + body: "policy" + }; + option (google.longrunning.operation_info) = { + response_type: "Policy" + metadata_type: "PolicyOperationMetadata" + }; + } + + // Deletes a policy. This action is permanent. + rpc DeletePolicy(DeletePolicyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=policies/*/*/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Policy" + metadata_type: "PolicyOperationMetadata" + }; + } +} + +// Data for an IAM policy. +message Policy { + // Immutable. The resource name of the `Policy`, which must be unique. Format: + // `policies/{attachment_point}/denypolicies/{policy_id}` + // + // + // The attachment point is identified by its URL-encoded full resource name, + // which means that the forward-slash character, `/`, must be written as + // `%2F`. For example, + // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`. + // + // For organizations and folders, use the numeric ID in the full resource + // name. For projects, requests can use the alphanumeric or the numeric ID. + // Responses always contain the numeric ID. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. The globally unique ID of the `Policy`. Assigned automatically when the + // `Policy` is created. + string uid = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The kind of the `Policy`. Always contains the value `DenyPolicy`. + string kind = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A user-specified description of the `Policy`. This value can be up to 63 + // characters. + string display_name = 4; + + // A key-value map to store arbitrary metadata for the `Policy`. Keys + // can be up to 63 characters. Values can be up to 255 characters. + map annotations = 5; + + // An opaque tag that identifies the current version of the `Policy`. IAM uses + // this value to help manage concurrent updates, so they do not cause one + // update to be overwritten by another. + // + // If this field is present in a [CreatePolicy][] request, the value is + // ignored. + string etag = 6; + + // Output only. The time when the `Policy` was created. + google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the `Policy` was last updated. + google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the `Policy` was deleted. Empty if the policy is not deleted. + google.protobuf.Timestamp delete_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A list of rules that specify the behavior of the `Policy`. All of the rules + // should be of the `kind` specified in the `Policy`. + repeated PolicyRule rules = 10; + + // Immutable. Specifies that this policy is managed by an authority and can only be + // modified by that authority. Usage is restricted. + string managing_authority = 11 [(google.api.field_behavior) = IMMUTABLE]; +} + +// A single rule in a `Policy`. +message PolicyRule { + oneof kind { + // A rule for a deny policy. + DenyRule deny_rule = 2; + } + + // A user-specified description of the rule. This value can be up to 256 + // characters. + string description = 1; +} + +// Request message for `ListPolicies`. +message ListPoliciesRequest { + // Required. The resource that the policy is attached to, along with the kind of policy + // to list. Format: + // `policies/{attachment_point}/denypolicies` + // + // + // The attachment point is identified by its URL-encoded full resource name, + // which means that the forward-slash character, `/`, must be written as + // `%2F`. For example, + // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + // + // For organizations and folders, use the numeric ID in the full resource + // name. For projects, you can use the alphanumeric or the numeric ID. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The maximum number of policies to return. IAM ignores this value and uses + // the value 1000. + int32 page_size = 2; + + // A page token received in a [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this token to + // retrieve the next page. + string page_token = 3; +} + +// Response message for `ListPolicies`. +message ListPoliciesResponse { + // Metadata for the policies that are attached to the resource. + repeated Policy policies = 1; + + // A page token that you can use in a [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the + // next page. If this field is omitted, there are no additional pages. + string next_page_token = 2; +} + +// Request message for `GetPolicy`. +message GetPolicyRequest { + // Required. The resource name of the policy to retrieve. Format: + // `policies/{attachment_point}/denypolicies/{policy_id}` + // + // + // Use the URL-encoded full resource name, which means that the forward-slash + // character, `/`, must be written as `%2F`. For example, + // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + // + // For organizations and folders, use the numeric ID in the full resource + // name. For projects, you can use the alphanumeric or the numeric ID. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `CreatePolicy`. +message CreatePolicyRequest { + // Required. The resource that the policy is attached to, along with the kind of policy + // to create. Format: `policies/{attachment_point}/denypolicies` + // + // + // The attachment point is identified by its URL-encoded full resource name, + // which means that the forward-slash character, `/`, must be written as + // `%2F`. For example, + // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + // + // For organizations and folders, use the numeric ID in the full resource + // name. For projects, you can use the alphanumeric or the numeric ID. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The policy to create. + Policy policy = 2 [(google.api.field_behavior) = REQUIRED]; + + // The ID to use for this policy, which will become the final component of + // the policy's resource name. The ID must contain 3 to 63 characters. It can + // contain lowercase letters and numbers, as well as dashes (`-`) and periods + // (`.`). The first character must be a lowercase letter. + string policy_id = 3; +} + +// Request message for `UpdatePolicy`. +message UpdatePolicyRequest { + // Required. The policy to update. + // + // To prevent conflicting updates, the `etag` value must match the value that + // is stored in IAM. If the `etag` values do not match, the request fails with + // a `409` error code and `ABORTED` status. + Policy policy = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `DeletePolicy`. +message DeletePolicyRequest { + // Required. The resource name of the policy to delete. Format: + // `policies/{attachment_point}/denypolicies/{policy_id}` + // + // + // Use the URL-encoded full resource name, which means that the forward-slash + // character, `/`, must be written as `%2F`. For example, + // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + // + // For organizations and folders, use the numeric ID in the full resource + // name. For projects, you can use the alphanumeric or the numeric ID. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The expected `etag` of the policy to delete. If the value does not match + // the value that is stored in IAM, the request fails with a `409` error code + // and `ABORTED` status. + // + // If you omit this field, the policy is deleted regardless of its current + // `etag`. + string etag = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Metadata for long-running `Policy` operations. +message PolicyOperationMetadata { + // Timestamp when the `google.longrunning.Operation` was created. + google.protobuf.Timestamp create_time = 1; +} diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.create_policy.js b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.create_policy.js new file mode 100644 index 00000000000..f27ce1187aa --- /dev/null +++ b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.create_policy.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, policy) { + // [START iam_v2_generated_Policies_CreatePolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 that the policy is attached to, along with the kind of policy + * to create. Format: `policies/{attachment_point}/denypolicies` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + */ + // const parent = 'abc123' + /** + * Required. The policy to create. + */ + // const policy = {} + /** + * The ID to use for this policy, which will become the final component of + * the policy's resource name. The ID must contain 3 to 63 characters. It can + * contain lowercase letters and numbers, as well as dashes (`-`) and periods + * (`.`). The first character must be a lowercase letter. + */ + // const policyId = 'abc123' + + // Imports the Iam library + const {PoliciesClient} = require('@google-cloud/iam').v2; + + // Instantiates a client + const iamClient = new PoliciesClient(); + + async function callCreatePolicy() { + // Construct request + const request = { + parent, + policy, + }; + + // Run request + const [operation] = await iamClient.createPolicy(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreatePolicy(); + // [END iam_v2_generated_Policies_CreatePolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.delete_policy.js b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.delete_policy.js new file mode 100644 index 00000000000..600b94734cd --- /dev/null +++ b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.delete_policy.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 iam_v2_generated_Policies_DeletePolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 policy to delete. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + */ + // const name = 'abc123' + /** + * Optional. The expected `etag` of the policy to delete. If the value does not match + * the value that is stored in IAM, the request fails with a `409` error code + * and `ABORTED` status. + * If you omit this field, the policy is deleted regardless of its current + * `etag`. + */ + // const etag = 'abc123' + + // Imports the Iam library + const {PoliciesClient} = require('@google-cloud/iam').v2; + + // Instantiates a client + const iamClient = new PoliciesClient(); + + async function callDeletePolicy() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await iamClient.deletePolicy(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeletePolicy(); + // [END iam_v2_generated_Policies_DeletePolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.get_policy.js b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.get_policy.js new file mode 100644 index 00000000000..007c04a9db7 --- /dev/null +++ b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.get_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(name) { + // [START iam_v2_generated_Policies_GetPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 policy to retrieve. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + */ + // const name = 'abc123' + + // Imports the Iam library + const {PoliciesClient} = require('@google-cloud/iam').v2; + + // Instantiates a client + const iamClient = new PoliciesClient(); + + async function callGetPolicy() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iamClient.getPolicy(request); + console.log(response); + } + + callGetPolicy(); + // [END iam_v2_generated_Policies_GetPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.list_policies.js b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.list_policies.js new file mode 100644 index 00000000000..5ea4cc723d6 --- /dev/null +++ b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.list_policies.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 iam_v2_generated_Policies_ListPolicies_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 that the policy is attached to, along with the kind of policy + * to list. Format: + * `policies/{attachment_point}/denypolicies` + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + */ + // const parent = 'abc123' + /** + * The maximum number of policies to return. IAM ignores this value and uses + * the value 1000. + */ + // const pageSize = 1234 + /** + * A page token received in a ListPoliciesResponse google.iam.v2.ListPoliciesResponse. Provide this token to + * retrieve the next page. + */ + // const pageToken = 'abc123' + + // Imports the Iam library + const {PoliciesClient} = require('@google-cloud/iam').v2; + + // Instantiates a client + const iamClient = new PoliciesClient(); + + async function callListPolicies() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await iamClient.listPoliciesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListPolicies(); + // [END iam_v2_generated_Policies_ListPolicies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.update_policy.js b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.update_policy.js new file mode 100644 index 00000000000..eba19718d10 --- /dev/null +++ b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.update_policy.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(policy) { + // [START iam_v2_generated_Policies_UpdatePolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The policy to update. + * To prevent conflicting updates, the `etag` value must match the value that + * is stored in IAM. If the `etag` values do not match, the request fails with + * a `409` error code and `ABORTED` status. + */ + // const policy = {} + + // Imports the Iam library + const {PoliciesClient} = require('@google-cloud/iam').v2; + + // Instantiates a client + const iamClient = new PoliciesClient(); + + async function callUpdatePolicy() { + // Construct request + const request = { + policy, + }; + + // Run request + const [operation] = await iamClient.updatePolicy(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdatePolicy(); + // [END iam_v2_generated_Policies_UpdatePolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/snippet_metadata_google.iam.v2.json b/owl-bot-staging/google-iam/v2/samples/generated/v2/snippet_metadata_google.iam.v2.json new file mode 100644 index 00000000000..7d4d77a9b85 --- /dev/null +++ b/owl-bot-staging/google-iam/v2/samples/generated/v2/snippet_metadata_google.iam.v2.json @@ -0,0 +1,235 @@ +{ + "clientLibrary": { + "name": "nodejs-iam", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.iam.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "iam_v2_generated_Policies_ListPolicies_async", + "title": "Policies listPolicies Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the policies of the specified kind that are attached to a resource. The response lists only policy metadata. In particular, policy rules are omitted.", + "canonical": true, + "file": "policies.list_policies.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListPolicies", + "fullName": "google.iam.v2.Policies.ListPolicies", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.iam.v2.ListPoliciesResponse", + "client": { + "shortName": "PoliciesClient", + "fullName": "google.iam.v2.PoliciesClient" + }, + "method": { + "shortName": "ListPolicies", + "fullName": "google.iam.v2.Policies.ListPolicies", + "service": { + "shortName": "Policies", + "fullName": "google.iam.v2.Policies" + } + } + } + }, + { + "regionTag": "iam_v2_generated_Policies_GetPolicy_async", + "title": "Policies getPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets a policy.", + "canonical": true, + "file": "policies.get_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetPolicy", + "fullName": "google.iam.v2.Policies.GetPolicy", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.iam.v2.Policy", + "client": { + "shortName": "PoliciesClient", + "fullName": "google.iam.v2.PoliciesClient" + }, + "method": { + "shortName": "GetPolicy", + "fullName": "google.iam.v2.Policies.GetPolicy", + "service": { + "shortName": "Policies", + "fullName": "google.iam.v2.Policies" + } + } + } + }, + { + "regionTag": "iam_v2_generated_Policies_CreatePolicy_async", + "title": "Policies createPolicy Sample", + "origin": "API_DEFINITION", + "description": " Creates a policy.", + "canonical": true, + "file": "policies.create_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreatePolicy", + "fullName": "google.iam.v2.Policies.CreatePolicy", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v2.Policy" + }, + { + "name": "policy_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "PoliciesClient", + "fullName": "google.iam.v2.PoliciesClient" + }, + "method": { + "shortName": "CreatePolicy", + "fullName": "google.iam.v2.Policies.CreatePolicy", + "service": { + "shortName": "Policies", + "fullName": "google.iam.v2.Policies" + } + } + } + }, + { + "regionTag": "iam_v2_generated_Policies_UpdatePolicy_async", + "title": "Policies updatePolicy Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified policy. You can update only the rules and the display name for the policy. To update a policy, you should use a read-modify-write loop: 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the policy. 2. Modify the policy as needed. 3. Use `UpdatePolicy` to write the updated policy. This pattern helps prevent conflicts between concurrent updates.", + "canonical": true, + "file": "policies.update_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdatePolicy", + "fullName": "google.iam.v2.Policies.UpdatePolicy", + "async": true, + "parameters": [ + { + "name": "policy", + "type": ".google.iam.v2.Policy" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "PoliciesClient", + "fullName": "google.iam.v2.PoliciesClient" + }, + "method": { + "shortName": "UpdatePolicy", + "fullName": "google.iam.v2.Policies.UpdatePolicy", + "service": { + "shortName": "Policies", + "fullName": "google.iam.v2.Policies" + } + } + } + }, + { + "regionTag": "iam_v2_generated_Policies_DeletePolicy_async", + "title": "Policies deletePolicy Sample", + "origin": "API_DEFINITION", + "description": " Deletes a policy. This action is permanent.", + "canonical": true, + "file": "policies.delete_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePolicy", + "fullName": "google.iam.v2.Policies.DeletePolicy", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "PoliciesClient", + "fullName": "google.iam.v2.PoliciesClient" + }, + "method": { + "shortName": "DeletePolicy", + "fullName": "google.iam.v2.Policies.DeletePolicy", + "service": { + "shortName": "Policies", + "fullName": "google.iam.v2.Policies" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-iam/v2/src/index.ts b/owl-bot-staging/google-iam/v2/src/index.ts new file mode 100644 index 00000000000..98cfa9dbaf1 --- /dev/null +++ b/owl-bot-staging/google-iam/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 PoliciesClient = v2.PoliciesClient; +type PoliciesClient = v2.PoliciesClient; +export {v2, PoliciesClient}; +export default {v2, PoliciesClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-iam/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-iam/v2/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..5e81e797a26 --- /dev/null +++ b/owl-bot-staging/google-iam/v2/src/v2/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.iam.v2", + "libraryPackage": "@google-cloud/iam", + "services": { + "Policies": { + "clients": { + "grpc": { + "libraryClient": "PoliciesClient", + "rpcs": { + "GetPolicy": { + "methods": [ + "getPolicy" + ] + }, + "CreatePolicy": { + "methods": [ + "createPolicy" + ] + }, + "UpdatePolicy": { + "methods": [ + "updatePolicy" + ] + }, + "DeletePolicy": { + "methods": [ + "deletePolicy" + ] + }, + "ListPolicies": { + "methods": [ + "listPolicies", + "listPoliciesStream", + "listPoliciesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "PoliciesClient", + "rpcs": { + "GetPolicy": { + "methods": [ + "getPolicy" + ] + }, + "CreatePolicy": { + "methods": [ + "createPolicy" + ] + }, + "UpdatePolicy": { + "methods": [ + "updatePolicy" + ] + }, + "DeletePolicy": { + "methods": [ + "deletePolicy" + ] + }, + "ListPolicies": { + "methods": [ + "listPolicies", + "listPoliciesStream", + "listPoliciesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-iam/v2/src/v2/index.ts b/owl-bot-staging/google-iam/v2/src/v2/index.ts new file mode 100644 index 00000000000..3a7592244f8 --- /dev/null +++ b/owl-bot-staging/google-iam/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 {PoliciesClient} from './policies_client'; diff --git a/owl-bot-staging/google-iam/v2/src/v2/policies_client.ts b/owl-bot-staging/google-iam/v2/src/v2/policies_client.ts new file mode 100644 index 00000000000..f023bad4a5c --- /dev/null +++ b/owl-bot-staging/google-iam/v2/src/v2/policies_client.ts @@ -0,0 +1,1140 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v2/policies_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './policies_client_config.json'; +const version = require('../../../package.json').version; + +/** + * An interface for managing Identity and Access Management (IAM) policies. + * @class + * @memberof v2 + */ +export class PoliciesClient { + 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}; + operationsClient: gax.OperationsClient; + policiesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of PoliciesClient. + * + * @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 PoliciesClient({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 PoliciesClient; + 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 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 = { + listPolicies: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'policies') + }; + + 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.GetOperation',get: '/v2/{name=policies/*/*/*/operations/*}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createPolicyResponse = protoFilesRoot.lookup( + '.google.iam.v2.Policy') as gax.protobuf.Type; + const createPolicyMetadata = protoFilesRoot.lookup( + '.google.iam.v2.PolicyOperationMetadata') as gax.protobuf.Type; + const updatePolicyResponse = protoFilesRoot.lookup( + '.google.iam.v2.Policy') as gax.protobuf.Type; + const updatePolicyMetadata = protoFilesRoot.lookup( + '.google.iam.v2.PolicyOperationMetadata') as gax.protobuf.Type; + const deletePolicyResponse = protoFilesRoot.lookup( + '.google.iam.v2.Policy') as gax.protobuf.Type; + const deletePolicyMetadata = protoFilesRoot.lookup( + '.google.iam.v2.PolicyOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createPolicy: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createPolicyResponse.decode.bind(createPolicyResponse), + createPolicyMetadata.decode.bind(createPolicyMetadata)), + updatePolicy: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updatePolicyResponse.decode.bind(updatePolicyResponse), + updatePolicyMetadata.decode.bind(updatePolicyMetadata)), + deletePolicy: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deletePolicyResponse.decode.bind(deletePolicyResponse), + deletePolicyMetadata.decode.bind(deletePolicyMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.iam.v2.Policies', 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.policiesStub) { + return this.policiesStub; + } + + // Put together the "service stub" for + // google.iam.v2.Policies. + this.policiesStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.iam.v2.Policies') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.iam.v2.Policies, + 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 policiesStubMethods = + ['listPolicies', 'getPolicy', 'createPolicy', 'updatePolicy', 'deletePolicy']; + for (const methodName of policiesStubMethods) { + const callPromise = this.policiesStub.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.policiesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'iam.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 'iam.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 a policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the policy to retrieve. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * + * + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric 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.iam.v2.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/v2/policies.get_policy.js + * region_tag:iam_v2_generated_Policies_GetPolicy_async + */ + getPolicy( + request?: protos.google.iam.v2.IGetPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v2.IPolicy, + protos.google.iam.v2.IGetPolicyRequest|undefined, {}|undefined + ]>; + getPolicy( + request: protos.google.iam.v2.IGetPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v2.IPolicy, + protos.google.iam.v2.IGetPolicyRequest|null|undefined, + {}|null|undefined>): void; + getPolicy( + request: protos.google.iam.v2.IGetPolicyRequest, + callback: Callback< + protos.google.iam.v2.IPolicy, + protos.google.iam.v2.IGetPolicyRequest|null|undefined, + {}|null|undefined>): void; + getPolicy( + request?: protos.google.iam.v2.IGetPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v2.IPolicy, + protos.google.iam.v2.IGetPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v2.IPolicy, + protos.google.iam.v2.IGetPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v2.IPolicy, + protos.google.iam.v2.IGetPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getPolicy(request, options, callback); + } + +/** + * Creates a policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource that the policy is attached to, along with the kind of policy + * to create. Format: `policies/{attachment_point}/denypolicies` + * + * + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @param {google.iam.v2.Policy} request.policy + * Required. The policy to create. + * @param {string} request.policyId + * The ID to use for this policy, which will become the final component of + * the policy's resource name. The ID must contain 3 to 63 characters. It can + * contain lowercase letters and numbers, as well as dashes (`-`) and periods + * (`.`). The first character must be a lowercase letter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/policies.create_policy.js + * region_tag:iam_v2_generated_Policies_CreatePolicy_async + */ + createPolicy( + request?: protos.google.iam.v2.ICreatePolicyRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createPolicy( + request: protos.google.iam.v2.ICreatePolicyRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPolicy( + request: protos.google.iam.v2.ICreatePolicyRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPolicy( + request?: protos.google.iam.v2.ICreatePolicyRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createPolicy(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createPolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/policies.create_policy.js + * region_tag:iam_v2_generated_Policies_CreatePolicy_async + */ + async checkCreatePolicyProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPolicy, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the specified policy. + * + * You can update only the rules and the display name for the policy. + * + * To update a policy, you should use a read-modify-write loop: + * + * 1. Use {@link protos.google.iam.v2.Policies.GetPolicy|GetPolicy} to read the current version of the policy. + * 2. Modify the policy as needed. + * 3. Use `UpdatePolicy` to write the updated policy. + * + * This pattern helps prevent conflicts between concurrent updates. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.iam.v2.Policy} request.policy + * Required. The policy to update. + * + * To prevent conflicting updates, the `etag` value must match the value that + * is stored in IAM. If the `etag` values do not match, the request fails with + * a `409` error code and `ABORTED` status. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/policies.update_policy.js + * region_tag:iam_v2_generated_Policies_UpdatePolicy_async + */ + updatePolicy( + request?: protos.google.iam.v2.IUpdatePolicyRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updatePolicy( + request: protos.google.iam.v2.IUpdatePolicyRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updatePolicy( + request: protos.google.iam.v2.IUpdatePolicyRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updatePolicy( + request?: protos.google.iam.v2.IUpdatePolicyRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'policy.name': request.policy!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updatePolicy(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updatePolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/policies.update_policy.js + * region_tag:iam_v2_generated_Policies_UpdatePolicy_async + */ + async checkUpdatePolicyProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updatePolicy, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a policy. This action is permanent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the policy to delete. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + * + * + * Use the URL-encoded full resource name, which means that the forward-slash + * character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @param {string} [request.etag] + * Optional. The expected `etag` of the policy to delete. If the value does not match + * the value that is stored in IAM, the request fails with a `409` error code + * and `ABORTED` status. + * + * If you omit this field, the policy is deleted regardless of its current + * `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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/policies.delete_policy.js + * region_tag:iam_v2_generated_Policies_DeletePolicy_async + */ + deletePolicy( + request?: protos.google.iam.v2.IDeletePolicyRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deletePolicy( + request: protos.google.iam.v2.IDeletePolicyRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePolicy( + request: protos.google.iam.v2.IDeletePolicyRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePolicy( + request?: protos.google.iam.v2.IDeletePolicyRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deletePolicy(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deletePolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/policies.delete_policy.js + * region_tag:iam_v2_generated_Policies_DeletePolicy_async + */ + async checkDeletePolicyProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePolicy, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Retrieves the policies of the specified kind that are attached to a + * resource. + * + * The response lists only policy metadata. In particular, policy rules are + * omitted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource that the policy is attached to, along with the kind of policy + * to list. Format: + * `policies/{attachment_point}/denypolicies` + * + * + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @param {number} request.pageSize + * The maximum number of policies to return. IAM ignores this value and uses + * the value 1000. + * @param {string} request.pageToken + * A page token received in a {@link protos.google.iam.v2.ListPoliciesResponse|ListPoliciesResponse}. Provide this token to + * retrieve the next page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.iam.v2.Policy|Policy}. + * 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 `listPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPolicies( + request?: protos.google.iam.v2.IListPoliciesRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v2.IPolicy[], + protos.google.iam.v2.IListPoliciesRequest|null, + protos.google.iam.v2.IListPoliciesResponse + ]>; + listPolicies( + request: protos.google.iam.v2.IListPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.iam.v2.IListPoliciesRequest, + protos.google.iam.v2.IListPoliciesResponse|null|undefined, + protos.google.iam.v2.IPolicy>): void; + listPolicies( + request: protos.google.iam.v2.IListPoliciesRequest, + callback: PaginationCallback< + protos.google.iam.v2.IListPoliciesRequest, + protos.google.iam.v2.IListPoliciesResponse|null|undefined, + protos.google.iam.v2.IPolicy>): void; + listPolicies( + request?: protos.google.iam.v2.IListPoliciesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.iam.v2.IListPoliciesRequest, + protos.google.iam.v2.IListPoliciesResponse|null|undefined, + protos.google.iam.v2.IPolicy>, + callback?: PaginationCallback< + protos.google.iam.v2.IListPoliciesRequest, + protos.google.iam.v2.IListPoliciesResponse|null|undefined, + protos.google.iam.v2.IPolicy>): + Promise<[ + protos.google.iam.v2.IPolicy[], + protos.google.iam.v2.IListPoliciesRequest|null, + protos.google.iam.v2.IListPoliciesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listPolicies(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 that the policy is attached to, along with the kind of policy + * to list. Format: + * `policies/{attachment_point}/denypolicies` + * + * + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @param {number} request.pageSize + * The maximum number of policies to return. IAM ignores this value and uses + * the value 1000. + * @param {string} request.pageToken + * A page token received in a {@link protos.google.iam.v2.ListPoliciesResponse|ListPoliciesResponse}. Provide this token to + * retrieve the next page. + * @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.iam.v2.Policy|Policy} 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 `listPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listPoliciesStream( + request?: protos.google.iam.v2.IListPoliciesRequest, + 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['listPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPolicies.createStream( + this.innerApiCalls.listPolicies as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listPolicies`, 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 that the policy is attached to, along with the kind of policy + * to list. Format: + * `policies/{attachment_point}/denypolicies` + * + * + * The attachment point is identified by its URL-encoded full resource name, + * which means that the forward-slash character, `/`, must be written as + * `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + * + * For organizations and folders, use the numeric ID in the full resource + * name. For projects, you can use the alphanumeric or the numeric ID. + * @param {number} request.pageSize + * The maximum number of policies to return. IAM ignores this value and uses + * the value 1000. + * @param {string} request.pageToken + * A page token received in a {@link protos.google.iam.v2.ListPoliciesResponse|ListPoliciesResponse}. Provide this token to + * retrieve the next page. + * @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.iam.v2.Policy|Policy}. 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/policies.list_policies.js + * region_tag:iam_v2_generated_Policies_ListPolicies_async + */ + listPoliciesAsync( + request?: protos.google.iam.v2.IListPoliciesRequest, + 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['listPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPolicies.asyncIterate( + this.innerApiCalls['listPolicies'] 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); + } + + + /** + * 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.policiesStub && !this._terminated) { + return this.policiesStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-iam/v2/src/v2/policies_client_config.json b/owl-bot-staging/google-iam/v2/src/v2/policies_client_config.json new file mode 100644 index 00000000000..8203a45ed79 --- /dev/null +++ b/owl-bot-staging/google-iam/v2/src/v2/policies_client_config.json @@ -0,0 +1,63 @@ +{ + "interfaces": { + "google.iam.v2.Policies": { + "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": { + "ListPolicies": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreatePolicy": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdatePolicy": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeletePolicy": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-iam/v2/src/v2/policies_proto_list.json b/owl-bot-staging/google-iam/v2/src/v2/policies_proto_list.json new file mode 100644 index 00000000000..d55442fe205 --- /dev/null +++ b/owl-bot-staging/google-iam/v2/src/v2/policies_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/iam/v2/deny.proto", + "../../protos/google/iam/v2/policy.proto" +] diff --git a/owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..4f3724eae54 --- /dev/null +++ b/owl-bot-staging/google-iam/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 iam = require('@google-cloud/iam'); + +function main() { + const policiesClient = new iam.PoliciesClient(); +} + +main(); diff --git a/owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..ef513718ec1 --- /dev/null +++ b/owl-bot-staging/google-iam/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 {PoliciesClient} from '@google-cloud/iam'; + +// check that the client class type name can be used +function doStuffWithPoliciesClient(client: PoliciesClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const policiesClient = new PoliciesClient(); + doStuffWithPoliciesClient(policiesClient); +} + +main(); diff --git a/owl-bot-staging/google-iam/v2/system-test/install.ts b/owl-bot-staging/google-iam/v2/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-iam/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-iam/v2/test/gapic_policies_v2.ts b/owl-bot-staging/google-iam/v2/test/gapic_policies_v2.ts new file mode 100644 index 00000000000..08dc181fa40 --- /dev/null +++ b/owl-bot-staging/google-iam/v2/test/gapic_policies_v2.ts @@ -0,0 +1,1287 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 policiesModule 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('v2.PoliciesClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = policiesModule.v2.PoliciesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = policiesModule.v2.PoliciesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = policiesModule.v2.PoliciesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new policiesModule.v2.PoliciesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new policiesModule.v2.PoliciesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.policiesStub, undefined); + await client.initialize(); + assert(client.policiesStub); + }); + + it('has close method for the initialized client', done => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.policiesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.policiesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new policiesModule.v2.PoliciesClient({ + 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 policiesModule.v2.PoliciesClient({ + 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('getPolicy', () => { + it('invokes getPolicy without error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.GetPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.GetPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v2.Policy() + ); + client.innerApiCalls.getPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPolicy without error using callback', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.GetPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.GetPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v2.Policy() + ); + client.innerApiCalls.getPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v2.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPolicy with error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.GetPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.GetPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.getPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPolicy with closed client', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.GetPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.GetPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getPolicy(request), expectedError); + }); + }); + + describe('createPolicy', () => { + it('invokes createPolicy without error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.CreatePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.CreatePolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPolicy = stubLongRunningCall(expectedResponse); + const [operation] = await client.createPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPolicy without error using callback', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.CreatePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.CreatePolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPolicy = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createPolicy( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPolicy with call error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.CreatePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.CreatePolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPolicy = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.createPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPolicy with LRO error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.CreatePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.CreatePolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPolicy = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreatePolicyProgress without error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreatePolicyProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreatePolicyProgress with error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreatePolicyProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updatePolicy', () => { + it('invokes updatePolicy without error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.UpdatePolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.UpdatePolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updatePolicy = stubLongRunningCall(expectedResponse); + const [operation] = await client.updatePolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updatePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePolicy without error using callback', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.UpdatePolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.UpdatePolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updatePolicy = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updatePolicy( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updatePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePolicy with call error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.UpdatePolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.UpdatePolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePolicy = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updatePolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.updatePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updatePolicy with LRO error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.UpdatePolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.UpdatePolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePolicy = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updatePolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updatePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updatePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdatePolicyProgress without error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdatePolicyProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdatePolicyProgress with error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdatePolicyProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deletePolicy', () => { + it('invokes deletePolicy without error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.DeletePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.DeletePolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePolicy = stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePolicy without error using callback', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.DeletePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.DeletePolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePolicy = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePolicy( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePolicy with call error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.DeletePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.DeletePolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePolicy = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deletePolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.deletePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePolicy with LRO error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.DeletePolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.DeletePolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePolicy = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deletePolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deletePolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeletePolicyProgress without error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeletePolicyProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeletePolicyProgress with error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeletePolicyProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listPolicies', () => { + it('invokes listPolicies without error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.ListPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.iam.v2.Policy()), + generateSampleMessage(new protos.google.iam.v2.Policy()), + generateSampleMessage(new protos.google.iam.v2.Policy()), + ]; + client.innerApiCalls.listPolicies = stubSimpleCall(expectedResponse); + const [response] = await client.listPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPolicies without error using callback', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.ListPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.iam.v2.Policy()), + generateSampleMessage(new protos.google.iam.v2.Policy()), + generateSampleMessage(new protos.google.iam.v2.Policy()), + ]; + client.innerApiCalls.listPolicies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPolicies( + request, + (err?: Error|null, result?: protos.google.iam.v2.IPolicy[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPolicies with error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.ListPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPolicies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPolicies(request), expectedError); + const actualRequest = (client.innerApiCalls.listPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPoliciesStream without error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.ListPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.iam.v2.Policy()), + generateSampleMessage(new protos.google.iam.v2.Policy()), + generateSampleMessage(new protos.google.iam.v2.Policy()), + ]; + client.descriptors.page.listPolicies.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.iam.v2.Policy[] = []; + stream.on('data', (response: protos.google.iam.v2.Policy) => { + 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.listPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPolicies, request)); + assert( + (client.descriptors.page.listPolicies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listPoliciesStream with error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.ListPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPolicies.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.iam.v2.Policy[] = []; + stream.on('data', (response: protos.google.iam.v2.Policy) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPolicies, request)); + assert( + (client.descriptors.page.listPolicies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPolicies without error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.ListPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.iam.v2.Policy()), + generateSampleMessage(new protos.google.iam.v2.Policy()), + generateSampleMessage(new protos.google.iam.v2.Policy()), + ]; + client.descriptors.page.listPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.iam.v2.IPolicy[] = []; + const iterable = client.listPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPolicies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPolicies with error', async () => { + const client = new policiesModule.v2.PoliciesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v2.ListPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.iam.v2.IPolicy[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPolicies.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 policiesModule.v2.PoliciesClient({ + 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 policiesModule.v2.PoliciesClient({ + 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 policiesModule.v2.PoliciesClient({ + 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 policiesModule.v2.PoliciesClient({ + 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 policiesModule.v2.PoliciesClient({ + 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 policiesModule.v2.PoliciesClient({ + 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 policiesModule.v2.PoliciesClient({ + 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 policiesModule.v2.PoliciesClient({ + 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 policiesModule.v2.PoliciesClient({ + 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 policiesModule.v2.PoliciesClient({ + 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 policiesModule.v2.PoliciesClient({ + 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-iam/v2/tsconfig.json b/owl-bot-staging/google-iam/v2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-iam/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-iam/v2/webpack.config.js b/owl-bot-staging/google-iam/v2/webpack.config.js new file mode 100644 index 00000000000..f423e0d5294 --- /dev/null +++ b/owl-bot-staging/google-iam/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: 'Policies', + filename: './policies.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-identity-accesscontextmanager/v1/.eslintignore b/owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintrc.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/.gitignore b/owl-bot-staging/google-identity-accesscontextmanager/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/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-identity-accesscontextmanager/v1/.jsdoc.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/.jsdoc.js new file mode 100644 index 00000000000..4680e389321 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/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/access-context-manager', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/.mocharc.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/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-identity-accesscontextmanager/v1/.prettierrc.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/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-identity-accesscontextmanager/v1/README.md b/owl-bot-staging/google-identity-accesscontextmanager/v1/README.md new file mode 100644 index 00000000000..15e69d163d1 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/README.md @@ -0,0 +1 @@ +Accesscontextmanager: Nodejs Client diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/package.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/package.json new file mode 100644 index 00000000000..0ce46b6a858 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/access-context-manager", + "version": "0.1.0", + "description": "Accesscontextmanager client for Node.js", + "repository": "googleapis/nodejs-accesscontextmanager", + "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 accesscontextmanager", + "accesscontextmanager", + "access context 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-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/type/device_resources.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/type/device_resources.proto new file mode 100644 index 00000000000..a3f000cf8a0 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/type/device_resources.proto @@ -0,0 +1,83 @@ +// 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.identity.accesscontextmanager.type; + +option csharp_namespace = "Google.Identity.AccessContextManager.Type"; +option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/type"; +option java_package = "com.google.identity.accesscontextmanager.type"; +option java_multiple_files = true; +option java_outer_classname = "TypeProto"; +option php_namespace = "Google\\Identity\\AccessContextManager\\Type"; +option ruby_package = "Google::Identity::AccessContextManager::Type"; + +// The encryption state of the device. +enum DeviceEncryptionStatus { + // The encryption status of the device is not specified or not known. + ENCRYPTION_UNSPECIFIED = 0; + + // The device does not support encryption. + ENCRYPTION_UNSUPPORTED = 1; + + // The device supports encryption, but is currently unencrypted. + UNENCRYPTED = 2; + + // The device is encrypted. + ENCRYPTED = 3; +} + +// The operating system type of the device. +// Next id: 7 +enum OsType { + // The operating system of the device is not specified or not known. + OS_UNSPECIFIED = 0; + + // A desktop Mac operating system. + DESKTOP_MAC = 1; + + // A desktop Windows operating system. + DESKTOP_WINDOWS = 2; + + // A desktop Linux operating system. + DESKTOP_LINUX = 3; + + // A desktop ChromeOS operating system. + DESKTOP_CHROME_OS = 6; + + // An Android operating system. + ANDROID = 4; + + // An iOS operating system. + IOS = 5; +} + +// The degree to which the device is managed by the Cloud organization. +enum DeviceManagementLevel { + // The device's management level is not specified or not known. + MANAGEMENT_UNSPECIFIED = 0; + + // The device is not managed. + NONE = 1; + + // Basic management is enabled, which is generally limited to monitoring and + // wiping the corporate account. + BASIC = 2; + + // Complete device management. This includes more thorough monitoring and the + // ability to directly manage the device (such as remote wiping). This can be + // enabled through the Android Enterprise Platform. + COMPLETE = 3; +} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_context_manager.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_context_manager.proto new file mode 100644 index 00000000000..c2ea6103b21 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_context_manager.proto @@ -0,0 +1,986 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.identity.accesscontextmanager.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/identity/accesscontextmanager/v1/access_level.proto"; +import "google/identity/accesscontextmanager/v1/access_policy.proto"; +import "google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto"; +import "google/identity/accesscontextmanager/v1/service_perimeter.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Identity.AccessContextManager.V1"; +option go_package = "cloud.google.com/go/accesscontextmanager/apiv1/accesscontextmanagerpb;accesscontextmanagerpb"; +option java_multiple_files = true; +option java_outer_classname = "AccessContextManagerProto"; +option java_package = "com.google.identity.accesscontextmanager.v1"; +option objc_class_prefix = "GACM"; +option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; +option ruby_package = "Google::Identity::AccessContextManager::V1"; + +// API for setting [access levels] +// [google.identity.accesscontextmanager.v1.AccessLevel] and [service +// perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] +// for Google Cloud projects. Each organization has one [access policy] +// [google.identity.accesscontextmanager.v1.AccessPolicy] that contains the +// [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] +// and [service perimeters] +// [google.identity.accesscontextmanager.v1.ServicePerimeter]. This +// [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] is +// applicable to all resources in the organization. +// AccessPolicies +service AccessContextManager { + option (google.api.default_host) = "accesscontextmanager.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all [access policies] + // [google.identity.accesscontextmanager.v1.AccessPolicy] in an + // organization. + rpc ListAccessPolicies(ListAccessPoliciesRequest) returns (ListAccessPoliciesResponse) { + option (google.api.http) = { + get: "/v1/accessPolicies" + }; + } + + // Returns an [access policy] + // [google.identity.accesscontextmanager.v1.AccessPolicy] based on the name. + rpc GetAccessPolicy(GetAccessPolicyRequest) returns (AccessPolicy) { + option (google.api.http) = { + get: "/v1/{name=accessPolicies/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an access policy. This method fails if the organization already has + // an access policy. The long-running operation has a successful status + // after the access policy propagates to long-lasting storage. + // Syntactic and basic semantic errors are returned in `metadata` as a + // BadRequest proto. + rpc CreateAccessPolicy(AccessPolicy) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/accessPolicies" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "AccessPolicy" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Updates an [access policy] + // [google.identity.accesscontextmanager.v1.AccessPolicy]. The + // long-running operation from this RPC has a successful status after the + // changes to the [access policy] + // [google.identity.accesscontextmanager.v1.AccessPolicy] propagate + // to long-lasting storage. + rpc UpdateAccessPolicy(UpdateAccessPolicyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{policy.name=accessPolicies/*}" + body: "policy" + }; + option (google.api.method_signature) = "policy,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "AccessPolicy" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Deletes an [access policy] + // [google.identity.accesscontextmanager.v1.AccessPolicy] based on the + // resource name. The long-running operation has a successful status after the + // [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] + // is removed from long-lasting storage. + rpc DeleteAccessPolicy(DeleteAccessPolicyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=accessPolicies/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Lists all [access levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] for an access + // policy. + rpc ListAccessLevels(ListAccessLevelsRequest) returns (ListAccessLevelsResponse) { + option (google.api.http) = { + get: "/v1/{parent=accessPolicies/*}/accessLevels" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets an [access level] + // [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource + // name. + rpc GetAccessLevel(GetAccessLevelRequest) returns (AccessLevel) { + option (google.api.http) = { + get: "/v1/{name=accessPolicies/*/accessLevels/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an [access level] + // [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running + // operation from this RPC has a successful status after the [access + // level] [google.identity.accesscontextmanager.v1.AccessLevel] + // propagates to long-lasting storage. If [access levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] contain + // errors, an error response is returned for the first error encountered. + rpc CreateAccessLevel(CreateAccessLevelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=accessPolicies/*}/accessLevels" + body: "access_level" + }; + option (google.api.method_signature) = "parent,access_level"; + option (google.longrunning.operation_info) = { + response_type: "AccessLevel" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Updates an [access level] + // [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running + // operation from this RPC has a successful status after the changes to + // the [access level] + // [google.identity.accesscontextmanager.v1.AccessLevel] propagate + // to long-lasting storage. If [access levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] contain + // errors, an error response is returned for the first error encountered. + rpc UpdateAccessLevel(UpdateAccessLevelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{access_level.name=accessPolicies/*/accessLevels/*}" + body: "access_level" + }; + option (google.api.method_signature) = "access_level,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "AccessLevel" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Deletes an [access level] + // [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource + // name. The long-running operation from this RPC has a successful status + // after the [access level] + // [google.identity.accesscontextmanager.v1.AccessLevel] has been removed + // from long-lasting storage. + rpc DeleteAccessLevel(DeleteAccessLevelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=accessPolicies/*/accessLevels/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Replaces all existing [access levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] in an [access + // policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with + // the [access levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] provided. This + // is done atomically. The long-running operation from this RPC has a + // successful status after all replacements propagate to long-lasting + // storage. If the replacement contains errors, an error response is returned + // for the first error encountered. Upon error, the replacement is cancelled, + // and existing [access levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] are not + // affected. The Operation.response field contains + // ReplaceAccessLevelsResponse. Removing [access levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] contained in existing + // [service perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] result in an + // error. + rpc ReplaceAccessLevels(ReplaceAccessLevelsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=accessPolicies/*}/accessLevels:replaceAll" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "ReplaceAccessLevelsResponse" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Lists all [service perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] for an + // access policy. + rpc ListServicePerimeters(ListServicePerimetersRequest) returns (ListServicePerimetersResponse) { + option (google.api.http) = { + get: "/v1/{parent=accessPolicies/*}/servicePerimeters" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a [service perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the + // resource name. + rpc GetServicePerimeter(GetServicePerimeterRequest) returns (ServicePerimeter) { + option (google.api.http) = { + get: "/v1/{name=accessPolicies/*/servicePerimeters/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a [service perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter]. The + // long-running operation from this RPC has a successful status after the + // [service perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] + // propagates to long-lasting storage. If a [service perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] contains + // errors, an error response is returned for the first error encountered. + rpc CreateServicePerimeter(CreateServicePerimeterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=accessPolicies/*}/servicePerimeters" + body: "service_perimeter" + }; + option (google.api.method_signature) = "parent,service_perimeter"; + option (google.longrunning.operation_info) = { + response_type: "ServicePerimeter" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Updates a [service perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter]. The + // long-running operation from this RPC has a successful status after the + // [service perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] + // propagates to long-lasting storage. If a [service perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] contains + // errors, an error response is returned for the first error encountered. + rpc UpdateServicePerimeter(UpdateServicePerimeterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{service_perimeter.name=accessPolicies/*/servicePerimeters/*}" + body: "service_perimeter" + }; + option (google.api.method_signature) = "service_perimeter,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "ServicePerimeter" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Deletes a [service perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the + // resource name. The long-running operation from this RPC has a successful + // status after the [service perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] is removed from + // long-lasting storage. + rpc DeleteServicePerimeter(DeleteServicePerimeterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=accessPolicies/*/servicePerimeters/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Replace all existing [service perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] in an [access + // policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with the + // [service perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] provided. This + // is done atomically. The long-running operation from this RPC has a + // successful status after all replacements propagate to long-lasting storage. + // Replacements containing errors result in an error response for the first + // error encountered. Upon an error, replacement are cancelled and existing + // [service perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] are not + // affected. The Operation.response field contains + // ReplaceServicePerimetersResponse. + rpc ReplaceServicePerimeters(ReplaceServicePerimetersRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=accessPolicies/*}/servicePerimeters:replaceAll" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "ReplaceServicePerimetersResponse" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Commits the dry-run specification for all the [service perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] in an + // [access policy][google.identity.accesscontextmanager.v1.AccessPolicy]. + // A commit operation on a service perimeter involves copying its `spec` field + // to the `status` field of the service perimeter. Only [service perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] with + // `use_explicit_dry_run_spec` field set to true are affected by a commit + // operation. The long-running operation from this RPC has a successful + // status after the dry-run specifications for all the [service perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] have been + // committed. If a commit fails, it causes the long-running operation to + // return an error response and the entire commit operation is cancelled. + // When successful, the Operation.response field contains + // CommitServicePerimetersResponse. The `dry_run` and the `spec` fields are + // cleared after a successful commit operation. + rpc CommitServicePerimeters(CommitServicePerimetersRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=accessPolicies/*}/servicePerimeters:commit" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "CommitServicePerimetersResponse" + metadata_type: "AccessContextManagerOperationMetadata" + }; + } + + // Lists all [GcpUserAccessBindings] + // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] for a + // Google Cloud organization. + rpc ListGcpUserAccessBindings(ListGcpUserAccessBindingsRequest) returns (ListGcpUserAccessBindingsResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*}/gcpUserAccessBindings" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the [GcpUserAccessBinding] + // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] with + // the given name. + rpc GetGcpUserAccessBinding(GetGcpUserAccessBindingRequest) returns (GcpUserAccessBinding) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/gcpUserAccessBindings/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a [GcpUserAccessBinding] + // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. If the + // client specifies a [name] + // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.name], + // the server ignores it. Fails if a resource already exists with the same + // [group_key] + // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.group_key]. + // Completion of this long-running operation does not necessarily signify that + // the new binding is deployed onto all affected users, which may take more + // time. + rpc CreateGcpUserAccessBinding(CreateGcpUserAccessBindingRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/gcpUserAccessBindings" + body: "gcp_user_access_binding" + }; + option (google.api.method_signature) = "parent,gcp_user_access_binding"; + option (google.longrunning.operation_info) = { + response_type: "GcpUserAccessBinding" + metadata_type: "GcpUserAccessBindingOperationMetadata" + }; + } + + // Updates a [GcpUserAccessBinding] + // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. + // Completion of this long-running operation does not necessarily signify that + // the changed binding is deployed onto all affected users, which may take + // more time. + rpc UpdateGcpUserAccessBinding(UpdateGcpUserAccessBindingRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{gcp_user_access_binding.name=organizations/*/gcpUserAccessBindings/*}" + body: "gcp_user_access_binding" + }; + option (google.api.method_signature) = "gcp_user_access_binding,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "GcpUserAccessBinding" + metadata_type: "GcpUserAccessBindingOperationMetadata" + }; + } + + // Deletes a [GcpUserAccessBinding] + // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. + // Completion of this long-running operation does not necessarily signify that + // the binding deletion is deployed onto all affected users, which may take + // more time. + rpc DeleteGcpUserAccessBinding(DeleteGcpUserAccessBindingRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=organizations/*/gcpUserAccessBindings/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "GcpUserAccessBindingOperationMetadata" + }; + } + + // Sets the IAM policy for the specified Access Context Manager + // [access policy][google.identity.accesscontextmanager.v1.AccessPolicy]. + // This method replaces the existing IAM policy on the access policy. The IAM + // policy controls the set of users who can perform specific operations on the + // Access Context Manager [access + // policy][google.identity.accesscontextmanager.v1.AccessPolicy]. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=accessPolicies/*}:setIamPolicy" + body: "*" + }; + } + + // Gets the IAM policy for the specified Access Context Manager + // [access policy][google.identity.accesscontextmanager.v1.AccessPolicy]. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=accessPolicies/*}:getIamPolicy" + body: "*" + }; + } + + // Returns the IAM permissions that the caller has on the specified Access + // Context Manager resource. The resource can be an + // [AccessPolicy][google.identity.accesscontextmanager.v1.AccessPolicy], + // [AccessLevel][google.identity.accesscontextmanager.v1.AccessLevel], or + // [ServicePerimeter][google.identity.accesscontextmanager.v1.ServicePerimeter + // ]. This method does not support other resources. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=accessPolicies/*}:testIamPermissions" + body: "*" + additional_bindings { + post: "/v1/{resource=accessPolicies/*/accessLevels/*}:testIamPermissions" + body: "*" + } + additional_bindings { + post: "/v1/{resource=accessPolicies/*/servicePerimeters/*}:testIamPermissions" + body: "*" + } + }; + } +} + +// A request to list all `AccessPolicies` for a container. +message ListAccessPoliciesRequest { + // Required. Resource name for the container to list AccessPolicy instances + // from. + // + // Format: + // `organizations/{org_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Number of AccessPolicy instances to include in the list. Default 100. + int32 page_size = 2; + + // Next page token for the next batch of AccessPolicy instances. Defaults to + // the first page of results. + string page_token = 3; +} + +// A response to `ListAccessPoliciesRequest`. +message ListAccessPoliciesResponse { + // List of the AccessPolicy instances. + repeated AccessPolicy access_policies = 1; + + // The pagination token to retrieve the next page of results. If the value is + // empty, no further results remain. + string next_page_token = 2; +} + +// A request to get a particular `AccessPolicy`. +message GetAccessPolicyRequest { + // Required. Resource name for the access policy to get. + // + // Format `accessPolicies/{policy_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "accesscontextmanager.googleapis.com/AccessPolicy" + } + ]; +} + +// A request to update an `AccessPolicy`. +message UpdateAccessPolicyRequest { + // Required. The updated AccessPolicy. + AccessPolicy policy = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask to control which fields get updated. Must be non-empty. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to delete an `AccessPolicy`. +message DeleteAccessPolicyRequest { + // Required. Resource name for the access policy to delete. + // + // Format `accessPolicies/{policy_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "accesscontextmanager.googleapis.com/AccessPolicy" + } + ]; +} + +// A request to list all `AccessLevels` in an `AccessPolicy`. +message ListAccessLevelsRequest { + // Required. Resource name for the access policy to list [Access Levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] from. + // + // Format: + // `accessPolicies/{policy_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "accesscontextmanager.googleapis.com/AccessLevel" + } + ]; + + // Number of [Access Levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] to include in + // the list. Default 100. + int32 page_size = 2; + + // Next page token for the next batch of [Access Level] + // [google.identity.accesscontextmanager.v1.AccessLevel] instances. + // Defaults to the first page of results. + string page_token = 3; + + // Whether to return `BasicLevels` in the Cloud Common Expression language, as + // `CustomLevels`, rather than as `BasicLevels`. Defaults to returning + // `AccessLevels` in the format they were defined. + LevelFormat access_level_format = 4; +} + +// A response to `ListAccessLevelsRequest`. +message ListAccessLevelsResponse { + // List of the [Access Level] + // [google.identity.accesscontextmanager.v1.AccessLevel] instances. + repeated AccessLevel access_levels = 1; + + // The pagination token to retrieve the next page of results. If the value is + // empty, no further results remain. + string next_page_token = 2; +} + +// A request to get a particular `AccessLevel`. +message GetAccessLevelRequest { + // Required. Resource name for the [Access Level] + // [google.identity.accesscontextmanager.v1.AccessLevel]. + // + // Format: + // `accessPolicies/{policy_id}/accessLevels/{access_level_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "accesscontextmanager.googleapis.com/AccessLevel" + } + ]; + + // Whether to return `BasicLevels` in the Cloud Common Expression + // Language rather than as `BasicLevels`. Defaults to AS_DEFINED, where + // [Access Levels] [google.identity.accesscontextmanager.v1.AccessLevel] + // are returned as `BasicLevels` or `CustomLevels` based on how they were + // created. If set to CEL, all [Access Levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] are returned as + // `CustomLevels`. In the CEL case, `BasicLevels` are translated to equivalent + // `CustomLevels`. + LevelFormat access_level_format = 2; +} + +// A request to create an `AccessLevel`. +message CreateAccessLevelRequest { + // Required. Resource name for the access policy which owns this [Access + // Level] [google.identity.accesscontextmanager.v1.AccessLevel]. + // + // Format: `accessPolicies/{policy_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "accesscontextmanager.googleapis.com/AccessLevel" + } + ]; + + // Required. The [Access Level] + // [google.identity.accesscontextmanager.v1.AccessLevel] to create. + // Syntactic correctness of the [Access Level] + // [google.identity.accesscontextmanager.v1.AccessLevel] is a + // precondition for creation. + AccessLevel access_level = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to update an `AccessLevel`. +message UpdateAccessLevelRequest { + // Required. The updated [Access Level] + // [google.identity.accesscontextmanager.v1.AccessLevel]. Syntactic + // correctness of the [Access Level] + // [google.identity.accesscontextmanager.v1.AccessLevel] is a + // precondition for creation. + AccessLevel access_level = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask to control which fields get updated. Must be non-empty. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to delete an `AccessLevel`. +message DeleteAccessLevelRequest { + // Required. Resource name for the [Access Level] + // [google.identity.accesscontextmanager.v1.AccessLevel]. + // + // Format: + // `accessPolicies/{policy_id}/accessLevels/{access_level_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "accesscontextmanager.googleapis.com/AccessLevel" + } + ]; +} + +// A request to replace all existing Access Levels in an Access Policy with +// the Access Levels provided. This is done atomically. +message ReplaceAccessLevelsRequest { + // Required. Resource name for the access policy which owns these + // [Access Levels] + // [google.identity.accesscontextmanager.v1.AccessLevel]. + // + // Format: `accessPolicies/{policy_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "accesscontextmanager.googleapis.com/AccessLevel" + } + ]; + + // Required. The desired [Access Levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] that should + // replace all existing [Access Levels] + // [google.identity.accesscontextmanager.v1.AccessLevel] in the + // [Access Policy] + // [google.identity.accesscontextmanager.v1.AccessPolicy]. + repeated AccessLevel access_levels = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The etag for the version of the [Access Policy] + // [google.identity.accesscontextmanager.v1.AccessPolicy] that this + // replace operation is to be performed on. If, at the time of replace, the + // etag for the Access Policy stored in Access Context Manager is different + // from the specified etag, then the replace operation will not be performed + // and the call will fail. This field is not required. If etag is not + // provided, the operation will be performed as if a valid etag is provided. + string etag = 4; +} + +// A response to ReplaceAccessLevelsRequest. This will be put inside of +// Operation.response field. +message ReplaceAccessLevelsResponse { + // List of the [Access Level] + // [google.identity.accesscontextmanager.v1.AccessLevel] instances. + repeated AccessLevel access_levels = 1; +} + +// A request to list all `ServicePerimeters` in an `AccessPolicy`. +message ListServicePerimetersRequest { + // Required. Resource name for the access policy to list [Service Perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] from. + // + // Format: + // `accessPolicies/{policy_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "accesscontextmanager.googleapis.com/ServicePerimeter" + } + ]; + + // Number of [Service Perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] to include + // in the list. Default 100. + int32 page_size = 2; + + // Next page token for the next batch of [Service Perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. + // Defaults to the first page of results. + string page_token = 3; +} + +// A response to `ListServicePerimetersRequest`. +message ListServicePerimetersResponse { + // List of the [Service Perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. + repeated ServicePerimeter service_perimeters = 1; + + // The pagination token to retrieve the next page of results. If the value is + // empty, no further results remain. + string next_page_token = 2; +} + +// A request to get a particular `ServicePerimeter`. +message GetServicePerimeterRequest { + // Required. Resource name for the [Service Perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter]. + // + // Format: + // `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "accesscontextmanager.googleapis.com/ServicePerimeter" + } + ]; +} + +// A request to create a `ServicePerimeter`. +message CreateServicePerimeterRequest { + // Required. Resource name for the access policy which owns this [Service + // Perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter]. + // + // Format: `accessPolicies/{policy_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "accesscontextmanager.googleapis.com/ServicePerimeter" + } + ]; + + // Required. The [Service Perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] to create. + // Syntactic correctness of the [Service Perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] is a + // precondition for creation. + ServicePerimeter service_perimeter = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to update a `ServicePerimeter`. +message UpdateServicePerimeterRequest { + // Required. The updated `ServicePerimeter`. Syntactic correctness of the + // `ServicePerimeter` is a precondition for creation. + ServicePerimeter service_perimeter = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask to control which fields get updated. Must be non-empty. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to delete a `ServicePerimeter`. +message DeleteServicePerimeterRequest { + // Required. Resource name for the [Service Perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter]. + // + // Format: + // `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "accesscontextmanager.googleapis.com/ServicePerimeter" + } + ]; +} + +// A request to replace all existing Service Perimeters in an Access Policy +// with the Service Perimeters provided. This is done atomically. +message ReplaceServicePerimetersRequest { + // Required. Resource name for the access policy which owns these + // [Service Perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter]. + // + // Format: `accessPolicies/{policy_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "accesscontextmanager.googleapis.com/ServicePerimeter" + } + ]; + + // Required. The desired [Service Perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] that should + // replace all existing [Service Perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] in the + // [Access Policy] + // [google.identity.accesscontextmanager.v1.AccessPolicy]. + repeated ServicePerimeter service_perimeters = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The etag for the version of the [Access Policy] + // [google.identity.accesscontextmanager.v1.AccessPolicy] that this + // replace operation is to be performed on. If, at the time of replace, the + // etag for the Access Policy stored in Access Context Manager is different + // from the specified etag, then the replace operation will not be performed + // and the call will fail. This field is not required. If etag is not + // provided, the operation will be performed as if a valid etag is provided. + string etag = 3; +} + +// A response to ReplaceServicePerimetersRequest. This will be put inside of +// Operation.response field. +message ReplaceServicePerimetersResponse { + // List of the [Service Perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. + repeated ServicePerimeter service_perimeters = 1; +} + +// A request to commit dry-run specs in all [Service Perimeters] +// [google.identity.accesscontextmanager.v1.ServicePerimeter] belonging to +// an [Access Policy][google.identity.accesscontextmanager.v1.AccessPolicy]. +message CommitServicePerimetersRequest { + // Required. Resource name for the parent [Access Policy] + // [google.identity.accesscontextmanager.v1.AccessPolicy] which owns all + // [Service Perimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] in scope for + // the commit operation. + // + // Format: `accessPolicies/{policy_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "accesscontextmanager.googleapis.com/ServicePerimeter" + } + ]; + + // Optional. The etag for the version of the [Access Policy] + // [google.identity.accesscontextmanager.v1.AccessPolicy] that this + // commit operation is to be performed on. If, at the time of commit, the + // etag for the Access Policy stored in Access Context Manager is different + // from the specified etag, then the commit operation will not be performed + // and the call will fail. This field is not required. If etag is not + // provided, the operation will be performed as if a valid etag is provided. + string etag = 2; +} + +// A response to CommitServicePerimetersRequest. This will be put inside of +// Operation.response field. +message CommitServicePerimetersResponse { + // List of all the [Service Perimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] instances in + // the [Access Policy] + // [google.identity.accesscontextmanager.v1.AccessPolicy]. + repeated ServicePerimeter service_perimeters = 1; +} + +// The format used in an `AccessLevel`. +enum LevelFormat { + // The format was not specified. + LEVEL_FORMAT_UNSPECIFIED = 0; + + // Uses the format the resource was defined in. BasicLevels are returned as + // BasicLevels, CustomLevels are returned as CustomLevels. + AS_DEFINED = 1; + + // Use Cloud Common Expression Language when returning the resource. Both + // BasicLevels and CustomLevels are returned as CustomLevels. + CEL = 2; +} + +// Request of [ListGcpUserAccessBindings] +// [google.identity.accesscontextmanager.v1.AccessContextManager.ListGcpUserAccessBindings]. +message ListGcpUserAccessBindingsRequest { + // Required. Example: "organizations/256" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Optional. Maximum number of items to return. The server may return fewer items. + // If left blank, the server may return any number of items. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If left blank, returns the first page. To enumerate all items, use the + // [next_page_token] + // [google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse.next_page_token] + // from your previous list operation. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response of [ListGcpUserAccessBindings] +// [google.identity.accesscontextmanager.v1.AccessContextManager.ListGcpUserAccessBindings]. +message ListGcpUserAccessBindingsResponse { + // [GcpUserAccessBinding] + // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] + repeated GcpUserAccessBinding gcp_user_access_bindings = 1; + + // Token to get the next page of items. If blank, there are no more items. + string next_page_token = 2; +} + +// Request of [GetGcpUserAccessBinding] +// [google.identity.accesscontextmanager.v1.AccessContextManager.GetGcpUserAccessBinding]. +message GetGcpUserAccessBindingRequest { + // Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "accesscontextmanager.googleapis.com/GcpUserAccessBinding" + } + ]; +} + +// Request of [CreateGcpUserAccessBinding] +// [google.identity.accesscontextmanager.v1.AccessContextManager.CreateGcpUserAccessBinding]. +message CreateGcpUserAccessBindingRequest { + // Required. Example: "organizations/256" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Required. [GcpUserAccessBinding] + // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] + GcpUserAccessBinding gcp_user_access_binding = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request of [UpdateGcpUserAccessBinding] +// [google.identity.accesscontextmanager.v1.AccessContextManager.UpdateGcpUserAccessBinding]. +message UpdateGcpUserAccessBindingRequest { + // Required. [GcpUserAccessBinding] + // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] + GcpUserAccessBinding gcp_user_access_binding = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Only the fields specified in this mask are updated. Because name and + // group_key cannot be changed, update_mask is required and must always be: + // + // update_mask { + // paths: "access_levels" + // } + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request of [DeleteGcpUserAccessBinding] +// [google.identity.accesscontextmanager.v1.AccessContextManager.DeleteGcpUserAccessBinding]. +message DeleteGcpUserAccessBindingRequest { + // Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "accesscontextmanager.googleapis.com/GcpUserAccessBinding" + } + ]; +} + +// Currently, a completed operation means nothing. In the future, this metadata +// and a completed operation may indicate that the binding has taken effect and +// is affecting access decisions for all users. +message GcpUserAccessBindingOperationMetadata { + +} + +// Metadata of Access Context Manager's Long Running Operations. +message AccessContextManagerOperationMetadata { + +} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_level.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_level.proto new file mode 100644 index 00000000000..9c2db6c74b4 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_level.proto @@ -0,0 +1,192 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.identity.accesscontextmanager.v1; + +import "google/api/resource.proto"; +import "google/identity/accesscontextmanager/type/device_resources.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/expr.proto"; + +option csharp_namespace = "Google.Identity.AccessContextManager.V1"; +option go_package = "cloud.google.com/go/accesscontextmanager/apiv1/accesscontextmanagerpb;accesscontextmanagerpb"; +option java_multiple_files = true; +option java_outer_classname = "AccessLevelProto"; +option java_package = "com.google.identity.accesscontextmanager.v1"; +option objc_class_prefix = "GACM"; +option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; +option ruby_package = "Google::Identity::AccessContextManager::V1"; + +// An `AccessLevel` is a label that can be applied to requests to Google Cloud +// services, along with a list of requirements necessary for the label to be +// applied. +message AccessLevel { + option (google.api.resource) = { + type: "accesscontextmanager.googleapis.com/AccessLevel" + pattern: "accessPolicies/{access_policy}/accessLevels/{access_level}" + }; + + // Required. Resource name for the Access Level. The `short_name` component + // must begin with a letter and only include alphanumeric and '_'. Format: + // `accessPolicies/{access_policy}/accessLevels/{access_level}`. The maximum + // length of the `access_level` component is 50 characters. + string name = 1; + + // Human readable title. Must be unique within the Policy. + string title = 2; + + // Description of the `AccessLevel` and its use. Does not affect behavior. + string description = 3; + + // Required. Describes the necessary conditions for the level to apply. + oneof level { + // A `BasicLevel` composed of `Conditions`. + BasicLevel basic = 4; + + // A `CustomLevel` written in the Common Expression Language. + CustomLevel custom = 5; + } + + // Output only. Time the `AccessLevel` was created in UTC. + google.protobuf.Timestamp create_time = 6; + + // Output only. Time the `AccessLevel` was updated in UTC. + google.protobuf.Timestamp update_time = 7; +} + +// `BasicLevel` is an `AccessLevel` using a set of recommended features. +message BasicLevel { + // Options for how the `conditions` list should be combined to determine if + // this `AccessLevel` is applied. Default is AND. + enum ConditionCombiningFunction { + // All `Conditions` must be true for the `BasicLevel` to be true. + AND = 0; + + // If at least one `Condition` is true, then the `BasicLevel` is true. + OR = 1; + } + + // Required. A list of requirements for the `AccessLevel` to be granted. + repeated Condition conditions = 1; + + // How the `conditions` list should be combined to determine if a request is + // granted this `AccessLevel`. If AND is used, each `Condition` in + // `conditions` must be satisfied for the `AccessLevel` to be applied. If OR + // is used, at least one `Condition` in `conditions` must be satisfied for the + // `AccessLevel` to be applied. Default behavior is AND. + ConditionCombiningFunction combining_function = 2; +} + +// A condition necessary for an `AccessLevel` to be granted. The Condition is an +// AND over its fields. So a Condition is true if: 1) the request IP is from one +// of the listed subnetworks AND 2) the originating device complies with the +// listed device policy AND 3) all listed access levels are granted AND 4) the +// request was sent at a time allowed by the DateTimeRestriction. +message Condition { + // CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for + // a CIDR IP address block, the specified IP address portion must be properly + // truncated (i.e. all the host bits must be zero) or the input is considered + // malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is + // not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas + // "2001:db8::1/32" is not. The originating IP of a request must be in one of + // the listed subnets in order for this Condition to be true. If empty, all IP + // addresses are allowed. + repeated string ip_subnetworks = 1; + + // Device specific restrictions, all restrictions must hold for the + // Condition to be true. If not specified, all devices are allowed. + DevicePolicy device_policy = 2; + + // A list of other access levels defined in the same `Policy`, referenced by + // resource name. Referencing an `AccessLevel` which does not exist is an + // error. All access levels listed must be granted for the Condition + // to be true. Example: + // "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"` + repeated string required_access_levels = 3; + + // Whether to negate the Condition. If true, the Condition becomes a NAND over + // its non-empty fields, each field must be false for the Condition overall to + // be satisfied. Defaults to false. + bool negate = 5; + + // The request must be made by one of the provided user or service + // accounts. Groups are not supported. + // Syntax: + // `user:{emailid}` + // `serviceAccount:{emailid}` + // If not specified, a request may come from any user. + repeated string members = 6; + + // The request must originate from one of the provided countries/regions. + // Must be valid ISO 3166-1 alpha-2 codes. + repeated string regions = 7; +} + +// `CustomLevel` is an `AccessLevel` using the Cloud Common Expression Language +// to represent the necessary conditions for the level to apply to a request. +// See CEL spec at: https://github.com/google/cel-spec +message CustomLevel { + // Required. A Cloud CEL expression evaluating to a boolean. + google.type.Expr expr = 1; +} + +// `DevicePolicy` specifies device specific restrictions necessary to acquire a +// given access level. A `DevicePolicy` specifies requirements for requests from +// devices to be granted access levels, it does not do any enforcement on the +// device. `DevicePolicy` acts as an AND over all specified fields, and each +// repeated field is an OR over its elements. Any unset fields are ignored. For +// example, if the proto is { os_type : DESKTOP_WINDOWS, os_type : +// DESKTOP_LINUX, encryption_status: ENCRYPTED}, then the DevicePolicy will be +// true for requests originating from encrypted Linux desktops and encrypted +// Windows desktops. +message DevicePolicy { + // Whether or not screenlock is required for the DevicePolicy to be true. + // Defaults to `false`. + bool require_screenlock = 1; + + // Allowed encryptions statuses, an empty list allows all statuses. + repeated google.identity.accesscontextmanager.type.DeviceEncryptionStatus allowed_encryption_statuses = 2; + + // Allowed OS versions, an empty list allows all types and all versions. + repeated OsConstraint os_constraints = 3; + + // Allowed device management levels, an empty list allows all management + // levels. + repeated google.identity.accesscontextmanager.type.DeviceManagementLevel allowed_device_management_levels = 6; + + // Whether the device needs to be approved by the customer admin. + bool require_admin_approval = 7; + + // Whether the device needs to be corp owned. + bool require_corp_owned = 8; +} + +// A restriction on the OS type and version of devices making requests. +message OsConstraint { + // Required. The allowed OS type. + google.identity.accesscontextmanager.type.OsType os_type = 1; + + // The minimum allowed OS version. If not set, any version of this OS + // satisfies the constraint. Format: `"major.minor.patch"`. + // Examples: `"10.5.301"`, `"9.2.1"`. + string minimum_version = 2; + + // Only allows requests from devices with a verified Chrome OS. + // Verifications includes requirements that the device is enterprise-managed, + // conformant to domain policies, and the caller has permission to call + // the API targeted by the request. + bool require_verified_chrome_os = 3; +} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_policy.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_policy.proto new file mode 100644 index 00000000000..86d6541afa1 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_policy.proto @@ -0,0 +1,81 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.identity.accesscontextmanager.v1; + +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Identity.AccessContextManager.V1"; +option go_package = "cloud.google.com/go/accesscontextmanager/apiv1/accesscontextmanagerpb;accesscontextmanagerpb"; +option java_multiple_files = true; +option java_outer_classname = "PolicyProto"; +option java_package = "com.google.identity.accesscontextmanager.v1"; +option objc_class_prefix = "GACM"; +option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; +option ruby_package = "Google::Identity::AccessContextManager::V1"; + +// `AccessPolicy` is a container for `AccessLevels` (which define the necessary +// attributes to use Google Cloud services) and `ServicePerimeters` (which +// define regions of services able to freely pass data within a perimeter). An +// access policy is globally visible within an organization, and the +// restrictions it specifies apply to all projects within an organization. +message AccessPolicy { + option (google.api.resource) = { + type: "accesscontextmanager.googleapis.com/AccessPolicy" + pattern: "accessPolicies/{access_policy}" + }; + + // Output only. Resource name of the `AccessPolicy`. Format: + // `accessPolicies/{access_policy}` + string name = 1; + + // Required. The parent of this `AccessPolicy` in the Cloud Resource + // Hierarchy. Currently immutable once created. Format: + // `organizations/{organization_id}` + string parent = 2; + + // Required. Human readable title. Does not affect behavior. + string title = 3; + + // The scopes of a policy define which resources an ACM policy can restrict, + // and where ACM resources can be referenced. + // For example, a policy with scopes=["folders/123"] has the following + // behavior: + // - vpcsc perimeters can only restrict projects within folders/123 + // - access levels can only be referenced by resources within folders/123. + // If empty, there are no limitations on which resources can be restricted by + // an ACM policy, and there are no limitations on where ACM resources can be + // referenced. + // Only one policy can include a given scope (attempting to create a second + // policy which includes "folders/123" will result in an error). + // Currently, scopes cannot be modified after a policy is created. + // Currently, policies can only have a single scope. + // Format: list of `folders/{folder_number}` or `projects/{project_number}` + repeated string scopes = 7; + + // Output only. Time the `AccessPolicy` was created in UTC. + google.protobuf.Timestamp create_time = 4; + + // Output only. Time the `AccessPolicy` was updated in UTC. + google.protobuf.Timestamp update_time = 5; + + // Output only. An opaque identifier for the current version of the + // `AccessPolicy`. This will always be a strongly validated etag, meaning that + // two Access Polices will be identical if and only if their etags are + // identical. Clients should not expect this to be in any specific format. + string etag = 6; +} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto new file mode 100644 index 00000000000..4a296d57226 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.identity.accesscontextmanager.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Identity.AccessContextManager.V1"; +option go_package = "cloud.google.com/go/accesscontextmanager/apiv1/accesscontextmanagerpb;accesscontextmanagerpb"; +option java_multiple_files = true; +option java_outer_classname = "GcpUserAccessBindingProto"; +option java_package = "com.google.identity.accesscontextmanager.v1"; +option objc_class_prefix = "GACM"; +option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; +option ruby_package = "Google::Identity::AccessContextManager::V1"; + +// Restricts access to Cloud Console and Google Cloud APIs for a set of users +// using Context-Aware Access. +message GcpUserAccessBinding { + option (google.api.resource) = { + type: "accesscontextmanager.googleapis.com/GcpUserAccessBinding" + pattern: "organizations/{organization}/gcpUserAccessBindings/{gcp_user_access_binding}" + }; + + // Immutable. Assigned by the server during creation. The last segment has an arbitrary + // length and has only URI unreserved characters (as defined by + // [RFC 3986 Section 2.3](https://tools.ietf.org/html/rfc3986#section-2.3)). + // Should not be specified by the client during creation. + // Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. Immutable. Google Group id whose members are subject to this binding's restrictions. + // See "id" in the [G Suite Directory API's Groups resource] + // (https://developers.google.com/admin-sdk/directory/v1/reference/groups#resource). + // If a group's email address/alias is changed, this resource will continue + // to point at the changed group. This field does not accept group email + // addresses or aliases. + // Example: "01d520gv4vjcrht" + string group_key = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. Access level that a user must have to be granted access. Only one access + // level is supported, not multiple. This repeated field must have exactly + // one element. + // Example: "accessPolicies/9522/accessLevels/device_trusted" + repeated string access_levels = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "accesscontextmanager.googleapis.com/AccessLevel" + } + ]; +} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto new file mode 100644 index 00000000000..03c324dbf50 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto @@ -0,0 +1,472 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.identity.accesscontextmanager.v1; + +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Identity.AccessContextManager.V1"; +option go_package = "cloud.google.com/go/accesscontextmanager/apiv1/accesscontextmanagerpb;accesscontextmanagerpb"; +option java_multiple_files = true; +option java_outer_classname = "ServicePerimeterProto"; +option java_package = "com.google.identity.accesscontextmanager.v1"; +option objc_class_prefix = "GACM"; +option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; +option ruby_package = "Google::Identity::AccessContextManager::V1"; + +// `ServicePerimeter` describes a set of Google Cloud resources which can freely +// import and export data amongst themselves, but not export outside of the +// `ServicePerimeter`. If a request with a source within this `ServicePerimeter` +// has a target outside of the `ServicePerimeter`, the request will be blocked. +// Otherwise the request is allowed. There are two types of Service Perimeter - +// Regular and Bridge. Regular Service Perimeters cannot overlap, a single +// Google Cloud project can only belong to a single regular Service Perimeter. +// Service Perimeter Bridges can contain only Google Cloud projects as members, +// a single Google Cloud project may belong to multiple Service Perimeter +// Bridges. +message ServicePerimeter { + option (google.api.resource) = { + type: "accesscontextmanager.googleapis.com/ServicePerimeter" + pattern: "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}" + }; + + // Specifies the type of the Perimeter. There are two types: regular and + // bridge. Regular Service Perimeter contains resources, access levels, and + // restricted services. Every resource can be in at most ONE + // regular Service Perimeter. + // + // In addition to being in a regular service perimeter, a resource can also + // be in zero or more perimeter bridges. A perimeter bridge only contains + // resources. Cross project operations are permitted if all effected + // resources share some perimeter (whether bridge or regular). Perimeter + // Bridge does not contain access levels or services: those are governed + // entirely by the regular perimeter that resource is in. + // + // Perimeter Bridges are typically useful when building more complex toplogies + // with many independent perimeters that need to share some data with a common + // perimeter, but should not be able to share data among themselves. + enum PerimeterType { + // Regular Perimeter. + PERIMETER_TYPE_REGULAR = 0; + + // Perimeter Bridge. + PERIMETER_TYPE_BRIDGE = 1; + } + + // Required. Resource name for the ServicePerimeter. The `short_name` + // component must begin with a letter and only include alphanumeric and '_'. + // Format: + // `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}` + string name = 1; + + // Human readable title. Must be unique within the Policy. + string title = 2; + + // Description of the `ServicePerimeter` and its use. Does not affect + // behavior. + string description = 3; + + // Output only. Time the `ServicePerimeter` was created in UTC. + google.protobuf.Timestamp create_time = 4; + + // Output only. Time the `ServicePerimeter` was updated in UTC. + google.protobuf.Timestamp update_time = 5; + + // Perimeter type indicator. A single project is + // allowed to be a member of single regular perimeter, but multiple service + // perimeter bridges. A project cannot be a included in a perimeter bridge + // without being included in regular perimeter. For perimeter bridges, + // the restricted service list as well as access level lists must be + // empty. + PerimeterType perimeter_type = 6; + + // Current ServicePerimeter configuration. Specifies sets of resources, + // restricted services and access levels that determine perimeter + // content and boundaries. + ServicePerimeterConfig status = 7; + + // Proposed (or dry run) ServicePerimeter configuration. This configuration + // allows to specify and test ServicePerimeter configuration without enforcing + // actual access restrictions. Only allowed to be set when the + // "use_explicit_dry_run_spec" flag is set. + ServicePerimeterConfig spec = 8; + + // Use explicit dry run spec flag. Ordinarily, a dry-run spec implicitly + // exists for all Service Perimeters, and that spec is identical to the + // status for those Service Perimeters. When this flag is set, it inhibits the + // generation of the implicit spec, thereby allowing the user to explicitly + // provide a configuration ("spec") to use in a dry-run version of the Service + // Perimeter. This allows the user to test changes to the enforced config + // ("status") without actually enforcing them. This testing is done through + // analyzing the differences between currently enforced and suggested + // restrictions. use_explicit_dry_run_spec must bet set to True if any of the + // fields in the spec are set to non-default values. + bool use_explicit_dry_run_spec = 9; +} + +// `ServicePerimeterConfig` specifies a set of Google Cloud resources that +// describe specific Service Perimeter configuration. +message ServicePerimeterConfig { + // Specifies how APIs are allowed to communicate within the Service + // Perimeter. + message VpcAccessibleServices { + // Whether to restrict API calls within the Service Perimeter to the list of + // APIs specified in 'allowed_services'. + bool enable_restriction = 1; + + // The list of APIs usable within the Service Perimeter. Must be empty + // unless 'enable_restriction' is True. You can specify a list of individual + // services, as well as include the 'RESTRICTED-SERVICES' value, which + // automatically includes all of the services protected by the perimeter. + repeated string allowed_services = 2; + } + + // Specifies the types of identities that are allowed access in either + // [IngressFrom] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressFrom] + // or [EgressFrom] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom] + // rules. + enum IdentityType { + // No blanket identity group specified. + IDENTITY_TYPE_UNSPECIFIED = 0; + + // Authorize access from all identities outside the perimeter. + ANY_IDENTITY = 1; + + // Authorize access from all human users outside the perimeter. + ANY_USER_ACCOUNT = 2; + + // Authorize access from all service accounts outside the perimeter. + ANY_SERVICE_ACCOUNT = 3; + } + + // An allowed method or permission of a service specified in [ApiOperation] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]. + message MethodSelector { + // The API method name or Cloud IAM permission name to allow. + oneof kind { + // Value for `method` should be a valid method name for the corresponding + // `service_name` in [ApiOperation] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]. + // If `*` used as value for `method`, then ALL methods and permissions are + // allowed. + string method = 1; + + // Value for `permission` should be a valid Cloud IAM permission for the + // corresponding `service_name` in [ApiOperation] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]. + string permission = 2; + } + } + + // Identification for an API Operation. + message ApiOperation { + // The name of the API whose methods or permissions the [IngressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // or [EgressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // want to allow. A single [ApiOperation] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] + // with `service_name` field set to `*` will allow all methods AND + // permissions for all services. + string service_name = 1; + + // API methods or permissions to allow. Method or permission must belong to + // the service specified by `service_name` field. A single [MethodSelector] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.MethodSelector] + // entry with `*` specified for the `method` field will allow all methods + // AND permissions for the service specified in `service_name`. + repeated MethodSelector method_selectors = 2; + } + + // The source that [IngressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // authorizes access from. + message IngressSource { + // Allowed ingress source. It can be one of [AccessLevel] + // [google.identity.accesscontextmanager.v1.AccessLevel] or Google + // Cloud resource. + oneof source { + // An [AccessLevel] + // [google.identity.accesscontextmanager.v1.AccessLevel] resource + // name that allow resources within the [ServicePerimeters] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] to be + // accessed from the internet. [AccessLevels] + // [google.identity.accesscontextmanager.v1.AccessLevel] listed must + // be in the same policy as this [ServicePerimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter]. + // Referencing a nonexistent [AccessLevel] + // [google.identity.accesscontextmanager.v1.AccessLevel] will cause + // an error. If no [AccessLevel] + // [google.identity.accesscontextmanager.v1.AccessLevel] names are + // listed, resources within the perimeter can only be accessed via Google + // Cloud calls with request origins within the perimeter. Example: + // `accessPolicies/MY_POLICY/accessLevels/MY_LEVEL`. If a single `*` is + // specified for `access_level`, then all [IngressSources] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressSource] + // will be allowed. + string access_level = 1; + + // A Google Cloud resource that is allowed to ingress the perimeter. + // Requests from these resources will be allowed to access perimeter data. + // Currently only projects are allowed. + // Format: `projects/{project_number}` + // The project may be in any Google Cloud organization, not just the + // organization that the perimeter is defined in. `*` is not allowed, the + // case of allowing all Google Cloud resources only is not supported. + string resource = 2; + } + } + + // Defines the conditions under which an [IngressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // matches a request. Conditions are based on information about the source of + // the request. The request must satisfy what is defined in `sources` AND + // identity related fields in order to match. + message IngressFrom { + // Sources that this [IngressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // authorizes access from. + repeated IngressSource sources = 1; + + // A list of identities that are allowed access through this ingress + // policy. Should be in the format of email address. The email address + // should represent individual user or service account only. + repeated string identities = 2; + + // Specifies the type of identities that are allowed access from outside the + // perimeter. If left unspecified, then members of `identities` field will + // be allowed access. + IdentityType identity_type = 3; + } + + // Defines the conditions under which an [IngressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // matches a request. Conditions are based on information about the + // [ApiOperation] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] + // intended to be performed on the target resource of the request. The request + // must satisfy what is defined in `operations` AND `resources` in order to + // match. + message IngressTo { + // A list of [ApiOperations] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] + // allowed to be performed by the sources specified in corresponding + // [IngressFrom] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressFrom] + // in this [ServicePerimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter]. + repeated ApiOperation operations = 1; + + // A list of resources, currently only projects in the form + // `projects/`, protected by this [ServicePerimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] that are + // allowed to be accessed by sources defined in the corresponding + // [IngressFrom] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressFrom]. + // If a single `*` is specified, then access to all resources inside the + // perimeter are allowed. + repeated string resources = 2; + } + + // Policy for ingress into [ServicePerimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter]. + // + // [IngressPolicies] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // match requests based on `ingress_from` and `ingress_to` stanzas. For an + // ingress policy to match, both the `ingress_from` and `ingress_to` stanzas + // must be matched. If an [IngressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // matches a request, the request is allowed through the perimeter boundary + // from outside the perimeter. + // + // For example, access from the internet can be allowed either + // based on an [AccessLevel] + // [google.identity.accesscontextmanager.v1.AccessLevel] or, for traffic + // hosted on Google Cloud, the project of the source network. For access from + // private networks, using the project of the hosting network is required. + // + // Individual ingress policies can be limited by restricting which + // services and/or actions they match using the `ingress_to` field. + message IngressPolicy { + // Defines the conditions on the source of a request causing this + // [IngressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // to apply. + IngressFrom ingress_from = 1; + + // Defines the conditions on the [ApiOperation] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] + // and request destination that cause this [IngressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // to apply. + IngressTo ingress_to = 2; + } + + // Defines the conditions under which an [EgressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // matches a request. Conditions based on information about the source of the + // request. Note that if the destination of the request is also protected by a + // [ServicePerimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter], then that + // [ServicePerimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] must have + // an [IngressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // which allows access in order for this request to succeed. + message EgressFrom { + // A list of identities that are allowed access through this [EgressPolicy]. + // Should be in the format of email address. The email address should + // represent individual user or service account only. + repeated string identities = 1; + + // Specifies the type of identities that are allowed access to outside the + // perimeter. If left unspecified, then members of `identities` field will + // be allowed access. + IdentityType identity_type = 2; + } + + // Defines the conditions under which an [EgressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // matches a request. Conditions are based on information about the + // [ApiOperation] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] + // intended to be performed on the `resources` specified. Note that if the + // destination of the request is also protected by a [ServicePerimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter], then that + // [ServicePerimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] must have + // an [IngressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // which allows access in order for this request to succeed. The request must + // match `operations` AND `resources` fields in order to be allowed egress out + // of the perimeter. + message EgressTo { + // A list of resources, currently only projects in the form + // `projects/`, that are allowed to be accessed by sources + // defined in the corresponding [EgressFrom] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom]. + // A request matches if it contains a resource in this list. If `*` is + // specified for `resources`, then this [EgressTo] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressTo] + // rule will authorize access to all resources outside the perimeter. + repeated string resources = 1; + + // A list of [ApiOperations] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] + // allowed to be performed by the sources specified in the corresponding + // [EgressFrom] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom]. + // A request matches if it uses an operation/service in this list. + repeated ApiOperation operations = 2; + + // A list of external resources that are allowed to be accessed. Only AWS + // and Azure resources are supported. For Amazon S3, the supported format is + // s3://BUCKET_NAME. For Azure Storage, the supported format is + // azure://myaccount.blob.core.windows.net/CONTAINER_NAME. A request matches + // if it contains an external resource in this list (Example: + // s3://bucket/path). Currently '*' is not allowed. + repeated string external_resources = 3; + } + + // Policy for egress from perimeter. + // + // [EgressPolicies] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // match requests based on `egress_from` and `egress_to` stanzas. For an + // [EgressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // to match, both `egress_from` and `egress_to` stanzas must be matched. If an + // [EgressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // matches a request, the request is allowed to span the [ServicePerimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] boundary. + // For example, an [EgressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // can be used to allow VMs on networks within the [ServicePerimeter] + // [google.identity.accesscontextmanager.v1.ServicePerimeter] to access a + // defined set of projects outside the perimeter in certain contexts (e.g. to + // read data from a Cloud Storage bucket or query against a BigQuery dataset). + // + // [EgressPolicies] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // are concerned with the *resources* that a request relates as well as the + // API services and API actions being used. They do not related to the + // direction of data movement. More detailed documentation for this concept + // can be found in the descriptions of [EgressFrom] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom] + // and [EgressTo] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressTo]. + message EgressPolicy { + // Defines conditions on the source of a request causing this [EgressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // to apply. + EgressFrom egress_from = 1; + + // Defines the conditions on the [ApiOperation] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] + // and destination resources that cause this [EgressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // to apply. + EgressTo egress_to = 2; + } + + // A list of Google Cloud resources that are inside of the service perimeter. + // Currently only projects are allowed. Format: `projects/{project_number}` + repeated string resources = 1; + + // A list of `AccessLevel` resource names that allow resources within the + // `ServicePerimeter` to be accessed from the internet. `AccessLevels` listed + // must be in the same policy as this `ServicePerimeter`. Referencing a + // nonexistent `AccessLevel` is a syntax error. If no `AccessLevel` names are + // listed, resources within the perimeter can only be accessed via Google + // Cloud calls with request origins within the perimeter. Example: + // `"accessPolicies/MY_POLICY/accessLevels/MY_LEVEL"`. + // For Service Perimeter Bridge, must be empty. + repeated string access_levels = 2; + + // Google Cloud services that are subject to the Service Perimeter + // restrictions. For example, if `storage.googleapis.com` is specified, access + // to the storage buckets inside the perimeter must meet the perimeter's + // access restrictions. + repeated string restricted_services = 4; + + // Configuration for APIs allowed within Perimeter. + VpcAccessibleServices vpc_accessible_services = 10; + + // List of [IngressPolicies] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // to apply to the perimeter. A perimeter may have multiple [IngressPolicies] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy], + // each of which is evaluated separately. Access is granted if any [Ingress + // Policy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] + // grants it. Must be empty for a perimeter bridge. + repeated IngressPolicy ingress_policies = 8; + + // List of [EgressPolicies] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // to apply to the perimeter. A perimeter may have multiple [EgressPolicies] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy], + // each of which is evaluated separately. Access is granted if any + // [EgressPolicy] + // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] + // grants it. Must be empty for a perimeter bridge. + repeated EgressPolicy egress_policies = 9; +} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.commit_service_perimeters.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.commit_service_perimeters.js new file mode 100644 index 00000000000..210e7050918 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.commit_service_perimeters.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 accesscontextmanager_v1_generated_AccessContextManager_CommitServicePerimeters_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the parent Access Policy + * google.identity.accesscontextmanager.v1.AccessPolicy which owns all + * Service Perimeters + * google.identity.accesscontextmanager.v1.ServicePerimeter in scope for + * the commit operation. + * Format: `accessPolicies/{policy_id}` + */ + // const parent = 'abc123' + /** + * Optional. The etag for the version of the Access Policy + * google.identity.accesscontextmanager.v1.AccessPolicy that this + * commit operation is to be performed on. If, at the time of commit, the + * etag for the Access Policy stored in Access Context Manager is different + * from the specified etag, then the commit operation will not be performed + * and the call will fail. This field is not required. If etag is not + * provided, the operation will be performed as if a valid etag is provided. + */ + // const etag = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callCommitServicePerimeters() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.commitServicePerimeters(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCommitServicePerimeters(); + // [END accesscontextmanager_v1_generated_AccessContextManager_CommitServicePerimeters_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_level.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_level.js new file mode 100644 index 00000000000..31e72bfd6ee --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_level.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, accessLevel) { + // [START accesscontextmanager_v1_generated_AccessContextManager_CreateAccessLevel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the access policy which owns this Access + * Level google.identity.accesscontextmanager.v1.AccessLevel. + * Format: `accessPolicies/{policy_id}` + */ + // const parent = 'abc123' + /** + * Required. The Access Level + * google.identity.accesscontextmanager.v1.AccessLevel to create. + * Syntactic correctness of the Access Level + * google.identity.accesscontextmanager.v1.AccessLevel is a + * precondition for creation. + */ + // const accessLevel = {} + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callCreateAccessLevel() { + // Construct request + const request = { + parent, + accessLevel, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.createAccessLevel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateAccessLevel(); + // [END accesscontextmanager_v1_generated_AccessContextManager_CreateAccessLevel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_policy.js new file mode 100644 index 00000000000..5dfff5a268a --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_policy.js @@ -0,0 +1,104 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 accesscontextmanager_v1_generated_AccessContextManager_CreateAccessPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Output only. Resource name of the `AccessPolicy`. Format: + * `accessPolicies/{access_policy}` + */ + // const name = 'abc123' + /** + * Required. The parent of this `AccessPolicy` in the Cloud Resource + * Hierarchy. Currently immutable once created. Format: + * `organizations/{organization_id}` + */ + // const parent = 'abc123' + /** + * Required. Human readable title. Does not affect behavior. + */ + // const title = 'abc123' + /** + * The scopes of a policy define which resources an ACM policy can restrict, + * and where ACM resources can be referenced. + * For example, a policy with scopes="folders/123" has the following + * behavior: + * - vpcsc perimeters can only restrict projects within folders/123 + * - access levels can only be referenced by resources within folders/123. + * If empty, there are no limitations on which resources can be restricted by + * an ACM policy, and there are no limitations on where ACM resources can be + * referenced. + * Only one policy can include a given scope (attempting to create a second + * policy which includes "folders/123" will result in an error). + * Currently, scopes cannot be modified after a policy is created. + * Currently, policies can only have a single scope. + * Format: list of `folders/{folder_number}` or `projects/{project_number}` + */ + // const scopes = ['abc','def'] + /** + * Output only. Time the `AccessPolicy` was created in UTC. + */ + // const createTime = {} + /** + * Output only. Time the `AccessPolicy` was updated in UTC. + */ + // const updateTime = {} + /** + * Output only. An opaque identifier for the current version of the + * `AccessPolicy`. This will always be a strongly validated etag, meaning that + * two Access Polices will be identical if and only if their etags are + * identical. Clients should not expect this to be in any specific format. + */ + // const etag = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callCreateAccessPolicy() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await accesscontextmanagerClient.createAccessPolicy(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateAccessPolicy(); + // [END accesscontextmanager_v1_generated_AccessContextManager_CreateAccessPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_gcp_user_access_binding.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_gcp_user_access_binding.js new file mode 100644 index 00000000000..02e0848f4a6 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_gcp_user_access_binding.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(parent, gcpUserAccessBinding) { + // [START accesscontextmanager_v1_generated_AccessContextManager_CreateGcpUserAccessBinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Example: "organizations/256" + */ + // const parent = 'abc123' + /** + * Required. GcpUserAccessBinding + * google.identity.accesscontextmanager.v1.GcpUserAccessBinding + */ + // const gcpUserAccessBinding = {} + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callCreateGcpUserAccessBinding() { + // Construct request + const request = { + parent, + gcpUserAccessBinding, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.createGcpUserAccessBinding(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateGcpUserAccessBinding(); + // [END accesscontextmanager_v1_generated_AccessContextManager_CreateGcpUserAccessBinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_service_perimeter.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_service_perimeter.js new file mode 100644 index 00000000000..4a12581b96d --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_service_perimeter.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, servicePerimeter) { + // [START accesscontextmanager_v1_generated_AccessContextManager_CreateServicePerimeter_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the access policy which owns this Service + * Perimeter google.identity.accesscontextmanager.v1.ServicePerimeter. + * Format: `accessPolicies/{policy_id}` + */ + // const parent = 'abc123' + /** + * Required. The Service Perimeter + * google.identity.accesscontextmanager.v1.ServicePerimeter to create. + * Syntactic correctness of the Service Perimeter + * google.identity.accesscontextmanager.v1.ServicePerimeter is a + * precondition for creation. + */ + // const servicePerimeter = {} + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callCreateServicePerimeter() { + // Construct request + const request = { + parent, + servicePerimeter, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.createServicePerimeter(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateServicePerimeter(); + // [END accesscontextmanager_v1_generated_AccessContextManager_CreateServicePerimeter_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_level.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_level.js new file mode 100644 index 00000000000..2538dfeef01 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_level.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 accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessLevel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the Access Level + * google.identity.accesscontextmanager.v1.AccessLevel. + * Format: + * `accessPolicies/{policy_id}/accessLevels/{access_level_id}` + */ + // const name = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callDeleteAccessLevel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.deleteAccessLevel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteAccessLevel(); + // [END accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessLevel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_policy.js new file mode 100644 index 00000000000..7bd92cc2e23 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_policy.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 accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the access policy to delete. + * Format `accessPolicies/{policy_id}` + */ + // const name = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callDeleteAccessPolicy() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.deleteAccessPolicy(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteAccessPolicy(); + // [END accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.js new file mode 100644 index 00000000000..b3c61f4b2d1 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.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 accesscontextmanager_v1_generated_AccessContextManager_DeleteGcpUserAccessBinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" + */ + // const name = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callDeleteGcpUserAccessBinding() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.deleteGcpUserAccessBinding(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteGcpUserAccessBinding(); + // [END accesscontextmanager_v1_generated_AccessContextManager_DeleteGcpUserAccessBinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_service_perimeter.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_service_perimeter.js new file mode 100644 index 00000000000..c8e4c28c416 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_service_perimeter.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 accesscontextmanager_v1_generated_AccessContextManager_DeleteServicePerimeter_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the Service Perimeter + * google.identity.accesscontextmanager.v1.ServicePerimeter. + * Format: + * `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}` + */ + // const name = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callDeleteServicePerimeter() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.deleteServicePerimeter(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteServicePerimeter(); + // [END accesscontextmanager_v1_generated_AccessContextManager_DeleteServicePerimeter_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_level.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_level.js new file mode 100644 index 00000000000..c3565fa9d8e --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_level.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 accesscontextmanager_v1_generated_AccessContextManager_GetAccessLevel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the Access Level + * google.identity.accesscontextmanager.v1.AccessLevel. + * Format: + * `accessPolicies/{policy_id}/accessLevels/{access_level_id}` + */ + // const name = 'abc123' + /** + * Whether to return `BasicLevels` in the Cloud Common Expression + * Language rather than as `BasicLevels`. Defaults to AS_DEFINED, where + * Access Levels google.identity.accesscontextmanager.v1.AccessLevel + * are returned as `BasicLevels` or `CustomLevels` based on how they were + * created. If set to CEL, all Access Levels + * google.identity.accesscontextmanager.v1.AccessLevel are returned as + * `CustomLevels`. In the CEL case, `BasicLevels` are translated to equivalent + * `CustomLevels`. + */ + // const accessLevelFormat = {} + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callGetAccessLevel() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await accesscontextmanagerClient.getAccessLevel(request); + console.log(response); + } + + callGetAccessLevel(); + // [END accesscontextmanager_v1_generated_AccessContextManager_GetAccessLevel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_policy.js new file mode 100644 index 00000000000..9662e2e2d90 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_policy.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 accesscontextmanager_v1_generated_AccessContextManager_GetAccessPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the access policy to get. + * Format `accessPolicies/{policy_id}` + */ + // const name = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callGetAccessPolicy() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await accesscontextmanagerClient.getAccessPolicy(request); + console.log(response); + } + + callGetAccessPolicy(); + // [END accesscontextmanager_v1_generated_AccessContextManager_GetAccessPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_gcp_user_access_binding.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_gcp_user_access_binding.js new file mode 100644 index 00000000000..f114b04f82c --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_gcp_user_access_binding.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 accesscontextmanager_v1_generated_AccessContextManager_GetGcpUserAccessBinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" + */ + // const name = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callGetGcpUserAccessBinding() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await accesscontextmanagerClient.getGcpUserAccessBinding(request); + console.log(response); + } + + callGetGcpUserAccessBinding(); + // [END accesscontextmanager_v1_generated_AccessContextManager_GetGcpUserAccessBinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_iam_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_iam_policy.js new file mode 100644 index 00000000000..a15dc6fd627 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_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 accesscontextmanager_v1_generated_AccessContextManager_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 Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await accesscontextmanagerClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END accesscontextmanager_v1_generated_AccessContextManager_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-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_service_perimeter.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_service_perimeter.js new file mode 100644 index 00000000000..a7a3e04d88a --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_service_perimeter.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 accesscontextmanager_v1_generated_AccessContextManager_GetServicePerimeter_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the Service Perimeter + * google.identity.accesscontextmanager.v1.ServicePerimeter. + * Format: + * `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}` + */ + // const name = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callGetServicePerimeter() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await accesscontextmanagerClient.getServicePerimeter(request); + console.log(response); + } + + callGetServicePerimeter(); + // [END accesscontextmanager_v1_generated_AccessContextManager_GetServicePerimeter_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_levels.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_levels.js new file mode 100644 index 00000000000..6ab5cfc5811 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_levels.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 accesscontextmanager_v1_generated_AccessContextManager_ListAccessLevels_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the access policy to list Access Levels + * google.identity.accesscontextmanager.v1.AccessLevel from. + * Format: + * `accessPolicies/{policy_id}` + */ + // const parent = 'abc123' + /** + * Number of Access Levels + * google.identity.accesscontextmanager.v1.AccessLevel to include in + * the list. Default 100. + */ + // const pageSize = 1234 + /** + * Next page token for the next batch of Access Level + * google.identity.accesscontextmanager.v1.AccessLevel instances. + * Defaults to the first page of results. + */ + // const pageToken = 'abc123' + /** + * Whether to return `BasicLevels` in the Cloud Common Expression language, as + * `CustomLevels`, rather than as `BasicLevels`. Defaults to returning + * `AccessLevels` in the format they were defined. + */ + // const accessLevelFormat = {} + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callListAccessLevels() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await accesscontextmanagerClient.listAccessLevelsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAccessLevels(); + // [END accesscontextmanager_v1_generated_AccessContextManager_ListAccessLevels_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_policies.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_policies.js new file mode 100644 index 00000000000..42db69d60bc --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_policies.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 accesscontextmanager_v1_generated_AccessContextManager_ListAccessPolicies_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the container to list AccessPolicy instances + * from. + * Format: + * `organizations/{org_id}` + */ + // const parent = 'abc123' + /** + * Number of AccessPolicy instances to include in the list. Default 100. + */ + // const pageSize = 1234 + /** + * Next page token for the next batch of AccessPolicy instances. Defaults to + * the first page of results. + */ + // const pageToken = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callListAccessPolicies() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await accesscontextmanagerClient.listAccessPoliciesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAccessPolicies(); + // [END accesscontextmanager_v1_generated_AccessContextManager_ListAccessPolicies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_gcp_user_access_bindings.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_gcp_user_access_bindings.js new file mode 100644 index 00000000000..9e8746afca0 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_gcp_user_access_bindings.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 accesscontextmanager_v1_generated_AccessContextManager_ListGcpUserAccessBindings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Example: "organizations/256" + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of items to return. The server may return fewer items. + * If left blank, the server may return any number of items. + */ + // const pageSize = 1234 + /** + * Optional. If left blank, returns the first page. To enumerate all items, use the + * next_page_token + * google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse.next_page_token + * from your previous list operation. + */ + // const pageToken = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callListGcpUserAccessBindings() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await accesscontextmanagerClient.listGcpUserAccessBindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListGcpUserAccessBindings(); + // [END accesscontextmanager_v1_generated_AccessContextManager_ListGcpUserAccessBindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_service_perimeters.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_service_perimeters.js new file mode 100644 index 00000000000..4c1cce77f94 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_service_perimeters.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 accesscontextmanager_v1_generated_AccessContextManager_ListServicePerimeters_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the access policy to list Service Perimeters + * google.identity.accesscontextmanager.v1.ServicePerimeter from. + * Format: + * `accessPolicies/{policy_id}` + */ + // const parent = 'abc123' + /** + * Number of Service Perimeters + * google.identity.accesscontextmanager.v1.ServicePerimeter to include + * in the list. Default 100. + */ + // const pageSize = 1234 + /** + * Next page token for the next batch of Service Perimeter + * google.identity.accesscontextmanager.v1.ServicePerimeter instances. + * Defaults to the first page of results. + */ + // const pageToken = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callListServicePerimeters() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await accesscontextmanagerClient.listServicePerimetersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListServicePerimeters(); + // [END accesscontextmanager_v1_generated_AccessContextManager_ListServicePerimeters_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_access_levels.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_access_levels.js new file mode 100644 index 00000000000..991b664d369 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_access_levels.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, accessLevels) { + // [START accesscontextmanager_v1_generated_AccessContextManager_ReplaceAccessLevels_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the access policy which owns these + * Access Levels + * google.identity.accesscontextmanager.v1.AccessLevel. + * Format: `accessPolicies/{policy_id}` + */ + // const parent = 'abc123' + /** + * Required. The desired Access Levels + * google.identity.accesscontextmanager.v1.AccessLevel that should + * replace all existing Access Levels + * google.identity.accesscontextmanager.v1.AccessLevel in the + * Access Policy + * google.identity.accesscontextmanager.v1.AccessPolicy. + */ + // const accessLevels = [1,2,3,4] + /** + * Optional. The etag for the version of the Access Policy + * google.identity.accesscontextmanager.v1.AccessPolicy that this + * replace operation is to be performed on. If, at the time of replace, the + * etag for the Access Policy stored in Access Context Manager is different + * from the specified etag, then the replace operation will not be performed + * and the call will fail. This field is not required. If etag is not + * provided, the operation will be performed as if a valid etag is provided. + */ + // const etag = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callReplaceAccessLevels() { + // Construct request + const request = { + parent, + accessLevels, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.replaceAccessLevels(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReplaceAccessLevels(); + // [END accesscontextmanager_v1_generated_AccessContextManager_ReplaceAccessLevels_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_service_perimeters.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_service_perimeters.js new file mode 100644 index 00000000000..72b88043e21 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_service_perimeters.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, servicePerimeters) { + // [START accesscontextmanager_v1_generated_AccessContextManager_ReplaceServicePerimeters_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 for the access policy which owns these + * Service Perimeters + * google.identity.accesscontextmanager.v1.ServicePerimeter. + * Format: `accessPolicies/{policy_id}` + */ + // const parent = 'abc123' + /** + * Required. The desired Service Perimeters + * google.identity.accesscontextmanager.v1.ServicePerimeter that should + * replace all existing Service Perimeters + * google.identity.accesscontextmanager.v1.ServicePerimeter in the + * Access Policy + * google.identity.accesscontextmanager.v1.AccessPolicy. + */ + // const servicePerimeters = [1,2,3,4] + /** + * Optional. The etag for the version of the Access Policy + * google.identity.accesscontextmanager.v1.AccessPolicy that this + * replace operation is to be performed on. If, at the time of replace, the + * etag for the Access Policy stored in Access Context Manager is different + * from the specified etag, then the replace operation will not be performed + * and the call will fail. This field is not required. If etag is not + * provided, the operation will be performed as if a valid etag is provided. + */ + // const etag = 'abc123' + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callReplaceServicePerimeters() { + // Construct request + const request = { + parent, + servicePerimeters, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.replaceServicePerimeters(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReplaceServicePerimeters(); + // [END accesscontextmanager_v1_generated_AccessContextManager_ReplaceServicePerimeters_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.set_iam_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.set_iam_policy.js new file mode 100644 index 00000000000..c504b30d177 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_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 accesscontextmanager_v1_generated_AccessContextManager_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 Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await accesscontextmanagerClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END accesscontextmanager_v1_generated_AccessContextManager_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-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.test_iam_permissions.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.test_iam_permissions.js new file mode 100644 index 00000000000..ef70853583a --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_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 accesscontextmanager_v1_generated_AccessContextManager_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 Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await accesscontextmanagerClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END accesscontextmanager_v1_generated_AccessContextManager_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-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_level.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_level.js new file mode 100644 index 00000000000..8355eb85987 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_level.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(accessLevel, updateMask) { + // [START accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessLevel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The updated Access Level + * google.identity.accesscontextmanager.v1.AccessLevel. Syntactic + * correctness of the Access Level + * google.identity.accesscontextmanager.v1.AccessLevel is a + * precondition for creation. + */ + // const accessLevel = {} + /** + * Required. Mask to control which fields get updated. Must be non-empty. + */ + // const updateMask = {} + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callUpdateAccessLevel() { + // Construct request + const request = { + accessLevel, + updateMask, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.updateAccessLevel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateAccessLevel(); + // [END accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessLevel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_policy.js new file mode 100644 index 00000000000..2d29738361c --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_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(policy, updateMask) { + // [START accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The updated AccessPolicy. + */ + // const policy = {} + /** + * Required. Mask to control which fields get updated. Must be non-empty. + */ + // const updateMask = {} + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callUpdateAccessPolicy() { + // Construct request + const request = { + policy, + updateMask, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.updateAccessPolicy(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateAccessPolicy(); + // [END accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_gcp_user_access_binding.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_gcp_user_access_binding.js new file mode 100644 index 00000000000..2873107428d --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_gcp_user_access_binding.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(gcpUserAccessBinding, updateMask) { + // [START accesscontextmanager_v1_generated_AccessContextManager_UpdateGcpUserAccessBinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. GcpUserAccessBinding + * google.identity.accesscontextmanager.v1.GcpUserAccessBinding + */ + // const gcpUserAccessBinding = {} + /** + * Required. Only the fields specified in this mask are updated. Because name and + * group_key cannot be changed, update_mask is required and must always be: + * update_mask { + * paths: "access_levels" + * } + */ + // const updateMask = {} + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callUpdateGcpUserAccessBinding() { + // Construct request + const request = { + gcpUserAccessBinding, + updateMask, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.updateGcpUserAccessBinding(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateGcpUserAccessBinding(); + // [END accesscontextmanager_v1_generated_AccessContextManager_UpdateGcpUserAccessBinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_service_perimeter.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_service_perimeter.js new file mode 100644 index 00000000000..5c88f932f93 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_service_perimeter.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(servicePerimeter, updateMask) { + // [START accesscontextmanager_v1_generated_AccessContextManager_UpdateServicePerimeter_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The updated `ServicePerimeter`. Syntactic correctness of the + * `ServicePerimeter` is a precondition for creation. + */ + // const servicePerimeter = {} + /** + * Required. Mask to control which fields get updated. Must be non-empty. + */ + // const updateMask = {} + + // Imports the Accesscontextmanager library + const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; + + // Instantiates a client + const accesscontextmanagerClient = new AccessContextManagerClient(); + + async function callUpdateServicePerimeter() { + // Construct request + const request = { + servicePerimeter, + updateMask, + }; + + // Run request + const [operation] = await accesscontextmanagerClient.updateServicePerimeter(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateServicePerimeter(); + // [END accesscontextmanager_v1_generated_AccessContextManager_UpdateServicePerimeter_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/snippet_metadata_google.identity.accesscontextmanager.v1.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/snippet_metadata_google.identity.accesscontextmanager.v1.json new file mode 100644 index 00000000000..91524c383b0 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/snippet_metadata_google.identity.accesscontextmanager.v1.json @@ -0,0 +1,1183 @@ +{ + "clientLibrary": { + "name": "nodejs-accesscontextmanager", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.identity.accesscontextmanager.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ListAccessPolicies_async", + "title": "AccessContextManager listAccessPolicies Sample", + "origin": "API_DEFINITION", + "description": " Lists all [access policies] [google.identity.accesscontextmanager.v1.AccessPolicy] in an organization.", + "canonical": true, + "file": "access_context_manager.list_access_policies.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAccessPolicies", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListAccessPolicies", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.identity.accesscontextmanager.v1.ListAccessPoliciesResponse", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "ListAccessPolicies", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListAccessPolicies", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_GetAccessPolicy_async", + "title": "AccessContextManager getAccessPolicy Sample", + "origin": "API_DEFINITION", + "description": " Returns an [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] based on the name.", + "canonical": true, + "file": "access_context_manager.get_access_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAccessPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetAccessPolicy", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.identity.accesscontextmanager.v1.AccessPolicy", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "GetAccessPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetAccessPolicy", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_CreateAccessPolicy_async", + "title": "AccessContextManager createAccessPolicy Sample", + "origin": "API_DEFINITION", + "description": " Creates an access policy. This method fails if the organization already has an access policy. The long-running operation has a successful status after the access policy propagates to long-lasting storage. Syntactic and basic semantic errors are returned in `metadata` as a BadRequest proto.", + "canonical": true, + "file": "access_context_manager.create_access_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 96, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAccessPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateAccessPolicy", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "title", + "type": "TYPE_STRING" + }, + { + "name": "scopes", + "type": "TYPE_STRING[]" + }, + { + "name": "create_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "update_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "CreateAccessPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateAccessPolicy", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessPolicy_async", + "title": "AccessContextManager updateAccessPolicy Sample", + "origin": "API_DEFINITION", + "description": " Updates an [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy]. The long-running operation from this RPC has a successful status after the changes to the [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] propagate to long-lasting storage.", + "canonical": true, + "file": "access_context_manager.update_access_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAccessPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateAccessPolicy", + "async": true, + "parameters": [ + { + "name": "policy", + "type": ".google.identity.accesscontextmanager.v1.AccessPolicy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "UpdateAccessPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateAccessPolicy", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessPolicy_async", + "title": "AccessContextManager deleteAccessPolicy Sample", + "origin": "API_DEFINITION", + "description": " Deletes an [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] based on the resource name. The long-running operation has a successful status after the [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] is removed from long-lasting storage.", + "canonical": true, + "file": "access_context_manager.delete_access_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAccessPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteAccessPolicy", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "DeleteAccessPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteAccessPolicy", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ListAccessLevels_async", + "title": "AccessContextManager listAccessLevels Sample", + "origin": "API_DEFINITION", + "description": " Lists all [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] for an access policy.", + "canonical": true, + "file": "access_context_manager.list_access_levels.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAccessLevels", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListAccessLevels", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "access_level_format", + "type": ".google.identity.accesscontextmanager.v1.LevelFormat" + } + ], + "resultType": ".google.identity.accesscontextmanager.v1.ListAccessLevelsResponse", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "ListAccessLevels", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListAccessLevels", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_GetAccessLevel_async", + "title": "AccessContextManager getAccessLevel Sample", + "origin": "API_DEFINITION", + "description": " Gets an [access level] [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource name.", + "canonical": true, + "file": "access_context_manager.get_access_level.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAccessLevel", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetAccessLevel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "access_level_format", + "type": ".google.identity.accesscontextmanager.v1.LevelFormat" + } + ], + "resultType": ".google.identity.accesscontextmanager.v1.AccessLevel", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "GetAccessLevel", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetAccessLevel", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_CreateAccessLevel_async", + "title": "AccessContextManager createAccessLevel Sample", + "origin": "API_DEFINITION", + "description": " Creates an [access level] [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running operation from this RPC has a successful status after the [access level] [google.identity.accesscontextmanager.v1.AccessLevel] propagates to long-lasting storage. If [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] contain errors, an error response is returned for the first error encountered.", + "canonical": true, + "file": "access_context_manager.create_access_level.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAccessLevel", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateAccessLevel", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "access_level", + "type": ".google.identity.accesscontextmanager.v1.AccessLevel" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "CreateAccessLevel", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateAccessLevel", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessLevel_async", + "title": "AccessContextManager updateAccessLevel Sample", + "origin": "API_DEFINITION", + "description": " Updates an [access level] [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running operation from this RPC has a successful status after the changes to the [access level] [google.identity.accesscontextmanager.v1.AccessLevel] propagate to long-lasting storage. If [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] contain errors, an error response is returned for the first error encountered.", + "canonical": true, + "file": "access_context_manager.update_access_level.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAccessLevel", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateAccessLevel", + "async": true, + "parameters": [ + { + "name": "access_level", + "type": ".google.identity.accesscontextmanager.v1.AccessLevel" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "UpdateAccessLevel", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateAccessLevel", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessLevel_async", + "title": "AccessContextManager deleteAccessLevel Sample", + "origin": "API_DEFINITION", + "description": " Deletes an [access level] [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource name. The long-running operation from this RPC has a successful status after the [access level] [google.identity.accesscontextmanager.v1.AccessLevel] has been removed from long-lasting storage.", + "canonical": true, + "file": "access_context_manager.delete_access_level.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAccessLevel", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteAccessLevel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "DeleteAccessLevel", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteAccessLevel", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ReplaceAccessLevels_async", + "title": "AccessContextManager replaceAccessLevels Sample", + "origin": "API_DEFINITION", + "description": " Replaces all existing [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] in an [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with the [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] provided. This is done atomically. The long-running operation from this RPC has a successful status after all replacements propagate to long-lasting storage. If the replacement contains errors, an error response is returned for the first error encountered. Upon error, the replacement is cancelled, and existing [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] are not affected. The Operation.response field contains ReplaceAccessLevelsResponse. Removing [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] contained in existing [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] result in an error.", + "canonical": true, + "file": "access_context_manager.replace_access_levels.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReplaceAccessLevels", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ReplaceAccessLevels", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "access_levels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "ReplaceAccessLevels", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ReplaceAccessLevels", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ListServicePerimeters_async", + "title": "AccessContextManager listServicePerimeters Sample", + "origin": "API_DEFINITION", + "description": " Lists all [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] for an access policy.", + "canonical": true, + "file": "access_context_manager.list_service_perimeters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServicePerimeters", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListServicePerimeters", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.identity.accesscontextmanager.v1.ListServicePerimetersResponse", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "ListServicePerimeters", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListServicePerimeters", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_GetServicePerimeter_async", + "title": "AccessContextManager getServicePerimeter Sample", + "origin": "API_DEFINITION", + "description": " Gets a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the resource name.", + "canonical": true, + "file": "access_context_manager.get_service_perimeter.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetServicePerimeter", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetServicePerimeter", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.identity.accesscontextmanager.v1.ServicePerimeter", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "GetServicePerimeter", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetServicePerimeter", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_CreateServicePerimeter_async", + "title": "AccessContextManager createServicePerimeter Sample", + "origin": "API_DEFINITION", + "description": " Creates a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter]. The long-running operation from this RPC has a successful status after the [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] propagates to long-lasting storage. If a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] contains errors, an error response is returned for the first error encountered.", + "canonical": true, + "file": "access_context_manager.create_service_perimeter.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateServicePerimeter", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateServicePerimeter", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "service_perimeter", + "type": ".google.identity.accesscontextmanager.v1.ServicePerimeter" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "CreateServicePerimeter", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateServicePerimeter", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_UpdateServicePerimeter_async", + "title": "AccessContextManager updateServicePerimeter Sample", + "origin": "API_DEFINITION", + "description": " Updates a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter]. The long-running operation from this RPC has a successful status after the [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] propagates to long-lasting storage. If a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] contains errors, an error response is returned for the first error encountered.", + "canonical": true, + "file": "access_context_manager.update_service_perimeter.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateServicePerimeter", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateServicePerimeter", + "async": true, + "parameters": [ + { + "name": "service_perimeter", + "type": ".google.identity.accesscontextmanager.v1.ServicePerimeter" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "UpdateServicePerimeter", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateServicePerimeter", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_DeleteServicePerimeter_async", + "title": "AccessContextManager deleteServicePerimeter Sample", + "origin": "API_DEFINITION", + "description": " Deletes a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the resource name. The long-running operation from this RPC has a successful status after the [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] is removed from long-lasting storage.", + "canonical": true, + "file": "access_context_manager.delete_service_perimeter.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteServicePerimeter", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteServicePerimeter", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "DeleteServicePerimeter", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteServicePerimeter", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ReplaceServicePerimeters_async", + "title": "AccessContextManager replaceServicePerimeters Sample", + "origin": "API_DEFINITION", + "description": " Replace all existing [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] in an [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with the [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] provided. This is done atomically. The long-running operation from this RPC has a successful status after all replacements propagate to long-lasting storage. Replacements containing errors result in an error response for the first error encountered. Upon an error, replacement are cancelled and existing [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] are not affected. The Operation.response field contains ReplaceServicePerimetersResponse.", + "canonical": true, + "file": "access_context_manager.replace_service_perimeters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReplaceServicePerimeters", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ReplaceServicePerimeters", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "service_perimeters", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "ReplaceServicePerimeters", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ReplaceServicePerimeters", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_CommitServicePerimeters_async", + "title": "AccessContextManager commitServicePerimeters Sample", + "origin": "API_DEFINITION", + "description": " Commits the dry-run specification for all the [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] in an [access policy][google.identity.accesscontextmanager.v1.AccessPolicy]. A commit operation on a service perimeter involves copying its `spec` field to the `status` field of the service perimeter. Only [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] with `use_explicit_dry_run_spec` field set to true are affected by a commit operation. The long-running operation from this RPC has a successful status after the dry-run specifications for all the [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] have been committed. If a commit fails, it causes the long-running operation to return an error response and the entire commit operation is cancelled. When successful, the Operation.response field contains CommitServicePerimetersResponse. The `dry_run` and the `spec` fields are cleared after a successful commit operation.", + "canonical": true, + "file": "access_context_manager.commit_service_perimeters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CommitServicePerimeters", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CommitServicePerimeters", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "CommitServicePerimeters", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CommitServicePerimeters", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ListGcpUserAccessBindings_async", + "title": "AccessContextManager listGcpUserAccessBindings Sample", + "origin": "API_DEFINITION", + "description": " Lists all [GcpUserAccessBindings] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] for a Google Cloud organization.", + "canonical": true, + "file": "access_context_manager.list_gcp_user_access_bindings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListGcpUserAccessBindings", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListGcpUserAccessBindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "ListGcpUserAccessBindings", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListGcpUserAccessBindings", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_GetGcpUserAccessBinding_async", + "title": "AccessContextManager getGcpUserAccessBinding Sample", + "origin": "API_DEFINITION", + "description": " Gets the [GcpUserAccessBinding] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] with the given name.", + "canonical": true, + "file": "access_context_manager.get_gcp_user_access_binding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGcpUserAccessBinding", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetGcpUserAccessBinding", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.identity.accesscontextmanager.v1.GcpUserAccessBinding", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "GetGcpUserAccessBinding", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetGcpUserAccessBinding", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_CreateGcpUserAccessBinding_async", + "title": "AccessContextManager createGcpUserAccessBinding Sample", + "origin": "API_DEFINITION", + "description": " Creates a [GcpUserAccessBinding] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. If the client specifies a [name] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.name], the server ignores it. Fails if a resource already exists with the same [group_key] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.group_key]. Completion of this long-running operation does not necessarily signify that the new binding is deployed onto all affected users, which may take more time.", + "canonical": true, + "file": "access_context_manager.create_gcp_user_access_binding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateGcpUserAccessBinding", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateGcpUserAccessBinding", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "gcp_user_access_binding", + "type": ".google.identity.accesscontextmanager.v1.GcpUserAccessBinding" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "CreateGcpUserAccessBinding", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateGcpUserAccessBinding", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_UpdateGcpUserAccessBinding_async", + "title": "AccessContextManager updateGcpUserAccessBinding Sample", + "origin": "API_DEFINITION", + "description": " Updates a [GcpUserAccessBinding] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. Completion of this long-running operation does not necessarily signify that the changed binding is deployed onto all affected users, which may take more time.", + "canonical": true, + "file": "access_context_manager.update_gcp_user_access_binding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateGcpUserAccessBinding", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateGcpUserAccessBinding", + "async": true, + "parameters": [ + { + "name": "gcp_user_access_binding", + "type": ".google.identity.accesscontextmanager.v1.GcpUserAccessBinding" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "UpdateGcpUserAccessBinding", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateGcpUserAccessBinding", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_DeleteGcpUserAccessBinding_async", + "title": "AccessContextManager deleteGcpUserAccessBinding Sample", + "origin": "API_DEFINITION", + "description": " Deletes a [GcpUserAccessBinding] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. Completion of this long-running operation does not necessarily signify that the binding deletion is deployed onto all affected users, which may take more time.", + "canonical": true, + "file": "access_context_manager.delete_gcp_user_access_binding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteGcpUserAccessBinding", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteGcpUserAccessBinding", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "DeleteGcpUserAccessBinding", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteGcpUserAccessBinding", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_SetIamPolicy_async", + "title": "AccessContextManager setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the IAM policy for the specified Access Context Manager [access policy][google.identity.accesscontextmanager.v1.AccessPolicy]. This method replaces the existing IAM policy on the access policy. The IAM policy controls the set of users who can perform specific operations on the Access Context Manager [access policy][google.identity.accesscontextmanager.v1.AccessPolicy].", + "canonical": true, + "file": "access_context_manager.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.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": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.SetIamPolicy", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_GetIamPolicy_async", + "title": "AccessContextManager getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the IAM policy for the specified Access Context Manager [access policy][google.identity.accesscontextmanager.v1.AccessPolicy].", + "canonical": true, + "file": "access_context_manager.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetIamPolicy", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + }, + { + "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_TestIamPermissions_async", + "title": "AccessContextManager testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns the IAM permissions that the caller has on the specified Access Context Manager resource. The resource can be an [AccessPolicy][google.identity.accesscontextmanager.v1.AccessPolicy], [AccessLevel][google.identity.accesscontextmanager.v1.AccessLevel], or [ServicePerimeter][google.identity.accesscontextmanager.v1.ServicePerimeter ]. This method does not support other resources.", + "canonical": true, + "file": "access_context_manager.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "AccessContextManagerClient", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.TestIamPermissions", + "service": { + "shortName": "AccessContextManager", + "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/index.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/index.ts new file mode 100644 index 00000000000..110dc64554d --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/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 AccessContextManagerClient = v1.AccessContextManagerClient; +type AccessContextManagerClient = v1.AccessContextManagerClient; +export {v1, AccessContextManagerClient}; +export default {v1, AccessContextManagerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client.ts new file mode 100644 index 00000000000..3df0a032f95 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client.ts @@ -0,0 +1,3706 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/access_context_manager_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './access_context_manager_client_config.json'; +const version = require('../../../package.json').version; + +/** + * API for setting [access levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] and [service + * perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] + * for Google Cloud projects. Each organization has one [access policy] + * [google.identity.accesscontextmanager.v1.AccessPolicy] that contains the + * [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] + * and [service perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter]. This + * [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] is + * applicable to all resources in the organization. + * AccessPolicies + * @class + * @memberof v1 + */ +export class AccessContextManagerClient { + 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; + accessContextManagerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AccessContextManagerClient. + * + * @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 AccessContextManagerClient({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 AccessContextManagerClient; + 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 = { + accessLevelPathTemplate: new this._gaxModule.PathTemplate( + 'accessPolicies/{access_policy}/accessLevels/{access_level}' + ), + accessPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'accessPolicies/{access_policy}' + ), + gcpUserAccessBindingPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/gcpUserAccessBindings/{gcp_user_access_binding}' + ), + organizationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}' + ), + servicePerimeterPathTemplate: new this._gaxModule.PathTemplate( + 'accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}' + ), + }; + + // 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 = { + listAccessPolicies: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'accessPolicies'), + listAccessLevels: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'accessLevels'), + listServicePerimeters: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'servicePerimeters'), + listGcpUserAccessBindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'gcpUserAccessBindings') + }; + + 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.GetOperation',get: '/v1/{name=operations/**}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createAccessPolicyResponse = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessPolicy') as gax.protobuf.Type; + const createAccessPolicyMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const updateAccessPolicyResponse = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessPolicy') as gax.protobuf.Type; + const updateAccessPolicyMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const deleteAccessPolicyResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteAccessPolicyMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const createAccessLevelResponse = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessLevel') as gax.protobuf.Type; + const createAccessLevelMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const updateAccessLevelResponse = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessLevel') as gax.protobuf.Type; + const updateAccessLevelMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const deleteAccessLevelResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteAccessLevelMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const replaceAccessLevelsResponse = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsResponse') as gax.protobuf.Type; + const replaceAccessLevelsMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const createServicePerimeterResponse = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.ServicePerimeter') as gax.protobuf.Type; + const createServicePerimeterMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const updateServicePerimeterResponse = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.ServicePerimeter') as gax.protobuf.Type; + const updateServicePerimeterMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const deleteServicePerimeterResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteServicePerimeterMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const replaceServicePerimetersResponse = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersResponse') as gax.protobuf.Type; + const replaceServicePerimetersMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const commitServicePerimetersResponse = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.CommitServicePerimetersResponse') as gax.protobuf.Type; + const commitServicePerimetersMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; + const createGcpUserAccessBindingResponse = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.GcpUserAccessBinding') as gax.protobuf.Type; + const createGcpUserAccessBindingMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.GcpUserAccessBindingOperationMetadata') as gax.protobuf.Type; + const updateGcpUserAccessBindingResponse = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.GcpUserAccessBinding') as gax.protobuf.Type; + const updateGcpUserAccessBindingMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.GcpUserAccessBindingOperationMetadata') as gax.protobuf.Type; + const deleteGcpUserAccessBindingResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteGcpUserAccessBindingMetadata = protoFilesRoot.lookup( + '.google.identity.accesscontextmanager.v1.GcpUserAccessBindingOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createAccessPolicy: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createAccessPolicyResponse.decode.bind(createAccessPolicyResponse), + createAccessPolicyMetadata.decode.bind(createAccessPolicyMetadata)), + updateAccessPolicy: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateAccessPolicyResponse.decode.bind(updateAccessPolicyResponse), + updateAccessPolicyMetadata.decode.bind(updateAccessPolicyMetadata)), + deleteAccessPolicy: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteAccessPolicyResponse.decode.bind(deleteAccessPolicyResponse), + deleteAccessPolicyMetadata.decode.bind(deleteAccessPolicyMetadata)), + createAccessLevel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createAccessLevelResponse.decode.bind(createAccessLevelResponse), + createAccessLevelMetadata.decode.bind(createAccessLevelMetadata)), + updateAccessLevel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateAccessLevelResponse.decode.bind(updateAccessLevelResponse), + updateAccessLevelMetadata.decode.bind(updateAccessLevelMetadata)), + deleteAccessLevel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteAccessLevelResponse.decode.bind(deleteAccessLevelResponse), + deleteAccessLevelMetadata.decode.bind(deleteAccessLevelMetadata)), + replaceAccessLevels: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + replaceAccessLevelsResponse.decode.bind(replaceAccessLevelsResponse), + replaceAccessLevelsMetadata.decode.bind(replaceAccessLevelsMetadata)), + createServicePerimeter: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createServicePerimeterResponse.decode.bind(createServicePerimeterResponse), + createServicePerimeterMetadata.decode.bind(createServicePerimeterMetadata)), + updateServicePerimeter: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateServicePerimeterResponse.decode.bind(updateServicePerimeterResponse), + updateServicePerimeterMetadata.decode.bind(updateServicePerimeterMetadata)), + deleteServicePerimeter: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteServicePerimeterResponse.decode.bind(deleteServicePerimeterResponse), + deleteServicePerimeterMetadata.decode.bind(deleteServicePerimeterMetadata)), + replaceServicePerimeters: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + replaceServicePerimetersResponse.decode.bind(replaceServicePerimetersResponse), + replaceServicePerimetersMetadata.decode.bind(replaceServicePerimetersMetadata)), + commitServicePerimeters: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + commitServicePerimetersResponse.decode.bind(commitServicePerimetersResponse), + commitServicePerimetersMetadata.decode.bind(commitServicePerimetersMetadata)), + createGcpUserAccessBinding: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createGcpUserAccessBindingResponse.decode.bind(createGcpUserAccessBindingResponse), + createGcpUserAccessBindingMetadata.decode.bind(createGcpUserAccessBindingMetadata)), + updateGcpUserAccessBinding: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateGcpUserAccessBindingResponse.decode.bind(updateGcpUserAccessBindingResponse), + updateGcpUserAccessBindingMetadata.decode.bind(updateGcpUserAccessBindingMetadata)), + deleteGcpUserAccessBinding: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteGcpUserAccessBindingResponse.decode.bind(deleteGcpUserAccessBindingResponse), + deleteGcpUserAccessBindingMetadata.decode.bind(deleteGcpUserAccessBindingMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.identity.accesscontextmanager.v1.AccessContextManager', 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.accessContextManagerStub) { + return this.accessContextManagerStub; + } + + // Put together the "service stub" for + // google.identity.accesscontextmanager.v1.AccessContextManager. + this.accessContextManagerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.identity.accesscontextmanager.v1.AccessContextManager') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.identity.accesscontextmanager.v1.AccessContextManager, + 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 accessContextManagerStubMethods = + ['listAccessPolicies', 'getAccessPolicy', 'createAccessPolicy', 'updateAccessPolicy', 'deleteAccessPolicy', 'listAccessLevels', 'getAccessLevel', 'createAccessLevel', 'updateAccessLevel', 'deleteAccessLevel', 'replaceAccessLevels', 'listServicePerimeters', 'getServicePerimeter', 'createServicePerimeter', 'updateServicePerimeter', 'deleteServicePerimeter', 'replaceServicePerimeters', 'commitServicePerimeters', 'listGcpUserAccessBindings', 'getGcpUserAccessBinding', 'createGcpUserAccessBinding', 'updateGcpUserAccessBinding', 'deleteGcpUserAccessBinding', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions']; + for (const methodName of accessContextManagerStubMethods) { + const callPromise = this.accessContextManagerStub.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.accessContextManagerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'accesscontextmanager.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 'accesscontextmanager.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 an [access policy] + * [google.identity.accesscontextmanager.v1.AccessPolicy] based on the name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name for the access policy to get. + * + * Format `accessPolicies/{policy_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.identity.accesscontextmanager.v1.AccessPolicy|AccessPolicy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.get_access_policy.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_GetAccessPolicy_async + */ + getAccessPolicy( + request?: protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IAccessPolicy, + protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|undefined, {}|undefined + ]>; + getAccessPolicy( + request: protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.identity.accesscontextmanager.v1.IAccessPolicy, + protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|null|undefined, + {}|null|undefined>): void; + getAccessPolicy( + request: protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest, + callback: Callback< + protos.google.identity.accesscontextmanager.v1.IAccessPolicy, + protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|null|undefined, + {}|null|undefined>): void; + getAccessPolicy( + request?: protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.identity.accesscontextmanager.v1.IAccessPolicy, + protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.identity.accesscontextmanager.v1.IAccessPolicy, + protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IAccessPolicy, + protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getAccessPolicy(request, options, callback); + } +/** + * Gets an [access level] + * [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource + * name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name for the [Access Level] + * [google.identity.accesscontextmanager.v1.AccessLevel]. + * + * Format: + * `accessPolicies/{policy_id}/accessLevels/{access_level_id}` + * @param {google.identity.accesscontextmanager.v1.LevelFormat} request.accessLevelFormat + * Whether to return `BasicLevels` in the Cloud Common Expression + * Language rather than as `BasicLevels`. Defaults to AS_DEFINED, where + * [Access Levels] [google.identity.accesscontextmanager.v1.AccessLevel] + * are returned as `BasicLevels` or `CustomLevels` based on how they were + * created. If set to CEL, all [Access Levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] are returned as + * `CustomLevels`. In the CEL case, `BasicLevels` are translated to equivalent + * `CustomLevels`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.identity.accesscontextmanager.v1.AccessLevel|AccessLevel}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.get_access_level.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_GetAccessLevel_async + */ + getAccessLevel( + request?: protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest, + options?: CallOptions): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IAccessLevel, + protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|undefined, {}|undefined + ]>; + getAccessLevel( + request: protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest, + options: CallOptions, + callback: Callback< + protos.google.identity.accesscontextmanager.v1.IAccessLevel, + protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|null|undefined, + {}|null|undefined>): void; + getAccessLevel( + request: protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest, + callback: Callback< + protos.google.identity.accesscontextmanager.v1.IAccessLevel, + protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|null|undefined, + {}|null|undefined>): void; + getAccessLevel( + request?: protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.identity.accesscontextmanager.v1.IAccessLevel, + protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.identity.accesscontextmanager.v1.IAccessLevel, + protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IAccessLevel, + protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getAccessLevel(request, options, callback); + } +/** + * Gets a [service perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the + * resource name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name for the [Service Perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter]. + * + * Format: + * `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_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.identity.accesscontextmanager.v1.ServicePerimeter|ServicePerimeter}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.get_service_perimeter.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_GetServicePerimeter_async + */ + getServicePerimeter( + request?: protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest, + options?: CallOptions): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IServicePerimeter, + protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|undefined, {}|undefined + ]>; + getServicePerimeter( + request: protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest, + options: CallOptions, + callback: Callback< + protos.google.identity.accesscontextmanager.v1.IServicePerimeter, + protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|null|undefined, + {}|null|undefined>): void; + getServicePerimeter( + request: protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest, + callback: Callback< + protos.google.identity.accesscontextmanager.v1.IServicePerimeter, + protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|null|undefined, + {}|null|undefined>): void; + getServicePerimeter( + request?: protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.identity.accesscontextmanager.v1.IServicePerimeter, + protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.identity.accesscontextmanager.v1.IServicePerimeter, + protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IServicePerimeter, + protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getServicePerimeter(request, options, callback); + } +/** + * Gets the [GcpUserAccessBinding] + * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] with + * the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding|GcpUserAccessBinding}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.get_gcp_user_access_binding.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_GetGcpUserAccessBinding_async + */ + getGcpUserAccessBinding( + request?: protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest, + options?: CallOptions): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, + protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|undefined, {}|undefined + ]>; + getGcpUserAccessBinding( + request: protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest, + options: CallOptions, + callback: Callback< + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, + protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|null|undefined, + {}|null|undefined>): void; + getGcpUserAccessBinding( + request: protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest, + callback: Callback< + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, + protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|null|undefined, + {}|null|undefined>): void; + getGcpUserAccessBinding( + request?: protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, + protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, + protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, + protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getGcpUserAccessBinding(request, options, callback); + } +/** + * Sets the IAM policy for the specified Access Context Manager + * {@link protos.google.identity.accesscontextmanager.v1.AccessPolicy|access policy}. + * This method replaces the existing IAM policy on the access policy. The IAM + * policy controls the set of users who can perform specific operations on the + * Access Context Manager [access + * policy][google.identity.accesscontextmanager.v1.AccessPolicy]. + * + * @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/access_context_manager.set_iam_policy.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_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 policy for the specified Access Context Manager + * {@link protos.google.identity.accesscontextmanager.v1.AccessPolicy|access policy}. + * + * @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/access_context_manager.get_iam_policy.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_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 the IAM permissions that the caller has on the specified Access + * Context Manager resource. The resource can be an + * {@link protos.google.identity.accesscontextmanager.v1.AccessPolicy|AccessPolicy}, + * {@link protos.google.identity.accesscontextmanager.v1.AccessLevel|AccessLevel}, or + * [ServicePerimeter][google.identity.accesscontextmanager.v1.ServicePerimeter + * ]. This method does not support other resources. + * + * @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/access_context_manager.test_iam_permissions.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_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 an access policy. This method fails if the organization already has + * an access policy. The long-running operation has a successful status + * after the access policy propagates to long-lasting storage. + * Syntactic and basic semantic errors are returned in `metadata` as a + * BadRequest proto. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Output only. Resource name of the `AccessPolicy`. Format: + * `accessPolicies/{access_policy}` + * @param {string} request.parent + * Required. The parent of this `AccessPolicy` in the Cloud Resource + * Hierarchy. Currently immutable once created. Format: + * `organizations/{organization_id}` + * @param {string} request.title + * Required. Human readable title. Does not affect behavior. + * @param {string[]} request.scopes + * The scopes of a policy define which resources an ACM policy can restrict, + * and where ACM resources can be referenced. + * For example, a policy with scopes=["folders/123"] has the following + * behavior: + * - vpcsc perimeters can only restrict projects within folders/123 + * - access levels can only be referenced by resources within folders/123. + * If empty, there are no limitations on which resources can be restricted by + * an ACM policy, and there are no limitations on where ACM resources can be + * referenced. + * Only one policy can include a given scope (attempting to create a second + * policy which includes "folders/123" will result in an error). + * Currently, scopes cannot be modified after a policy is created. + * Currently, policies can only have a single scope. + * Format: list of `folders/{folder_number}` or `projects/{project_number}` + * @param {google.protobuf.Timestamp} request.createTime + * Output only. Time the `AccessPolicy` was created in UTC. + * @param {google.protobuf.Timestamp} request.updateTime + * Output only. Time the `AccessPolicy` was updated in UTC. + * @param {string} request.etag + * Output only. An opaque identifier for the current version of the + * `AccessPolicy`. This will always be a strongly validated etag, meaning that + * two Access Polices will be identical if and only if their etags are + * identical. Clients should not expect this to be in any specific format. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.create_access_policy.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateAccessPolicy_async + */ + createAccessPolicy( + request?: protos.google.identity.accesscontextmanager.v1.IAccessPolicy, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createAccessPolicy( + request: protos.google.identity.accesscontextmanager.v1.IAccessPolicy, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAccessPolicy( + request: protos.google.identity.accesscontextmanager.v1.IAccessPolicy, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAccessPolicy( + request?: protos.google.identity.accesscontextmanager.v1.IAccessPolicy, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.createAccessPolicy(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createAccessPolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.create_access_policy.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateAccessPolicy_async + */ + async checkCreateAccessPolicyProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAccessPolicy, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an [access policy] + * [google.identity.accesscontextmanager.v1.AccessPolicy]. The + * long-running operation from this RPC has a successful status after the + * changes to the [access policy] + * [google.identity.accesscontextmanager.v1.AccessPolicy] propagate + * to long-lasting storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.identity.accesscontextmanager.v1.AccessPolicy} request.policy + * Required. The updated AccessPolicy. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask to control which fields get updated. Must be non-empty. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.update_access_policy.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessPolicy_async + */ + updateAccessPolicy( + request?: protos.google.identity.accesscontextmanager.v1.IUpdateAccessPolicyRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateAccessPolicy( + request: protos.google.identity.accesscontextmanager.v1.IUpdateAccessPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAccessPolicy( + request: protos.google.identity.accesscontextmanager.v1.IUpdateAccessPolicyRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAccessPolicy( + request?: protos.google.identity.accesscontextmanager.v1.IUpdateAccessPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'policy.name': request.policy!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAccessPolicy(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateAccessPolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.update_access_policy.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessPolicy_async + */ + async checkUpdateAccessPolicyProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAccessPolicy, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes an [access policy] + * [google.identity.accesscontextmanager.v1.AccessPolicy] based on the + * resource name. The long-running operation has a successful status after the + * [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] + * is removed from long-lasting storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name for the access policy to delete. + * + * Format `accessPolicies/{policy_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/access_context_manager.delete_access_policy.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessPolicy_async + */ + deleteAccessPolicy( + request?: protos.google.identity.accesscontextmanager.v1.IDeleteAccessPolicyRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteAccessPolicy( + request: protos.google.identity.accesscontextmanager.v1.IDeleteAccessPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAccessPolicy( + request: protos.google.identity.accesscontextmanager.v1.IDeleteAccessPolicyRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAccessPolicy( + request?: protos.google.identity.accesscontextmanager.v1.IDeleteAccessPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAccessPolicy(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteAccessPolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.delete_access_policy.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessPolicy_async + */ + async checkDeleteAccessPolicyProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAccessPolicy, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates an [access level] + * [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running + * operation from this RPC has a successful status after the [access + * level] [google.identity.accesscontextmanager.v1.AccessLevel] + * propagates to long-lasting storage. If [access levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] contain + * errors, an error response is returned for the first error encountered. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name for the access policy which owns this [Access + * Level] [google.identity.accesscontextmanager.v1.AccessLevel]. + * + * Format: `accessPolicies/{policy_id}` + * @param {google.identity.accesscontextmanager.v1.AccessLevel} request.accessLevel + * Required. The [Access Level] + * [google.identity.accesscontextmanager.v1.AccessLevel] to create. + * Syntactic correctness of the [Access Level] + * [google.identity.accesscontextmanager.v1.AccessLevel] is a + * precondition for creation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.create_access_level.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateAccessLevel_async + */ + createAccessLevel( + request?: protos.google.identity.accesscontextmanager.v1.ICreateAccessLevelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createAccessLevel( + request: protos.google.identity.accesscontextmanager.v1.ICreateAccessLevelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAccessLevel( + request: protos.google.identity.accesscontextmanager.v1.ICreateAccessLevelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAccessLevel( + request?: protos.google.identity.accesscontextmanager.v1.ICreateAccessLevelRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createAccessLevel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createAccessLevel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.create_access_level.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateAccessLevel_async + */ + async checkCreateAccessLevelProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAccessLevel, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an [access level] + * [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running + * operation from this RPC has a successful status after the changes to + * the [access level] + * [google.identity.accesscontextmanager.v1.AccessLevel] propagate + * to long-lasting storage. If [access levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] contain + * errors, an error response is returned for the first error encountered. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.identity.accesscontextmanager.v1.AccessLevel} request.accessLevel + * Required. The updated [Access Level] + * [google.identity.accesscontextmanager.v1.AccessLevel]. Syntactic + * correctness of the [Access Level] + * [google.identity.accesscontextmanager.v1.AccessLevel] is a + * precondition for creation. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask to control which fields get updated. Must be non-empty. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.update_access_level.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessLevel_async + */ + updateAccessLevel( + request?: protos.google.identity.accesscontextmanager.v1.IUpdateAccessLevelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateAccessLevel( + request: protos.google.identity.accesscontextmanager.v1.IUpdateAccessLevelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAccessLevel( + request: protos.google.identity.accesscontextmanager.v1.IUpdateAccessLevelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAccessLevel( + request?: protos.google.identity.accesscontextmanager.v1.IUpdateAccessLevelRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'access_level.name': request.accessLevel!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAccessLevel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateAccessLevel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.update_access_level.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessLevel_async + */ + async checkUpdateAccessLevelProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAccessLevel, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes an [access level] + * [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource + * name. The long-running operation from this RPC has a successful status + * after the [access level] + * [google.identity.accesscontextmanager.v1.AccessLevel] has been removed + * from long-lasting storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name for the [Access Level] + * [google.identity.accesscontextmanager.v1.AccessLevel]. + * + * Format: + * `accessPolicies/{policy_id}/accessLevels/{access_level_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/access_context_manager.delete_access_level.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessLevel_async + */ + deleteAccessLevel( + request?: protos.google.identity.accesscontextmanager.v1.IDeleteAccessLevelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteAccessLevel( + request: protos.google.identity.accesscontextmanager.v1.IDeleteAccessLevelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAccessLevel( + request: protos.google.identity.accesscontextmanager.v1.IDeleteAccessLevelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteAccessLevel( + request?: protos.google.identity.accesscontextmanager.v1.IDeleteAccessLevelRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAccessLevel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteAccessLevel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.delete_access_level.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessLevel_async + */ + async checkDeleteAccessLevelProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAccessLevel, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Replaces all existing [access levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] in an [access + * policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with + * the [access levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] provided. This + * is done atomically. The long-running operation from this RPC has a + * successful status after all replacements propagate to long-lasting + * storage. If the replacement contains errors, an error response is returned + * for the first error encountered. Upon error, the replacement is cancelled, + * and existing [access levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] are not + * affected. The Operation.response field contains + * ReplaceAccessLevelsResponse. Removing [access levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] contained in existing + * [service perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] result in an + * error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name for the access policy which owns these + * [Access Levels] + * [google.identity.accesscontextmanager.v1.AccessLevel]. + * + * Format: `accessPolicies/{policy_id}` + * @param {number[]} request.accessLevels + * Required. The desired [Access Levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] that should + * replace all existing [Access Levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] in the + * [Access Policy] + * [google.identity.accesscontextmanager.v1.AccessPolicy]. + * @param {string} request.etag + * Optional. The etag for the version of the [Access Policy] + * [google.identity.accesscontextmanager.v1.AccessPolicy] that this + * replace operation is to be performed on. If, at the time of replace, the + * etag for the Access Policy stored in Access Context Manager is different + * from the specified etag, then the replace operation will not be performed + * and the call will fail. This field is not required. If etag is not + * provided, the operation will be performed as if a valid etag is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.replace_access_levels.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ReplaceAccessLevels_async + */ + replaceAccessLevels( + request?: protos.google.identity.accesscontextmanager.v1.IReplaceAccessLevelsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + replaceAccessLevels( + request: protos.google.identity.accesscontextmanager.v1.IReplaceAccessLevelsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + replaceAccessLevels( + request: protos.google.identity.accesscontextmanager.v1.IReplaceAccessLevelsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + replaceAccessLevels( + request?: protos.google.identity.accesscontextmanager.v1.IReplaceAccessLevelsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.replaceAccessLevels(request, options, callback); + } +/** + * Check the status of the long running operation returned by `replaceAccessLevels()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.replace_access_levels.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ReplaceAccessLevels_async + */ + async checkReplaceAccessLevelsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.replaceAccessLevels, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a [service perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter]. The + * long-running operation from this RPC has a successful status after the + * [service perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] + * propagates to long-lasting storage. If a [service perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] contains + * errors, an error response is returned for the first error encountered. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name for the access policy which owns this [Service + * Perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter]. + * + * Format: `accessPolicies/{policy_id}` + * @param {google.identity.accesscontextmanager.v1.ServicePerimeter} request.servicePerimeter + * Required. The [Service Perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] to create. + * Syntactic correctness of the [Service Perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] is a + * precondition for creation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.create_service_perimeter.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateServicePerimeter_async + */ + createServicePerimeter( + request?: protos.google.identity.accesscontextmanager.v1.ICreateServicePerimeterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createServicePerimeter( + request: protos.google.identity.accesscontextmanager.v1.ICreateServicePerimeterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createServicePerimeter( + request: protos.google.identity.accesscontextmanager.v1.ICreateServicePerimeterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createServicePerimeter( + request?: protos.google.identity.accesscontextmanager.v1.ICreateServicePerimeterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createServicePerimeter(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createServicePerimeter()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.create_service_perimeter.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateServicePerimeter_async + */ + async checkCreateServicePerimeterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createServicePerimeter, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a [service perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter]. The + * long-running operation from this RPC has a successful status after the + * [service perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] + * propagates to long-lasting storage. If a [service perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] contains + * errors, an error response is returned for the first error encountered. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.identity.accesscontextmanager.v1.ServicePerimeter} request.servicePerimeter + * Required. The updated `ServicePerimeter`. Syntactic correctness of the + * `ServicePerimeter` is a precondition for creation. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask to control which fields get updated. Must be non-empty. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.update_service_perimeter.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateServicePerimeter_async + */ + updateServicePerimeter( + request?: protos.google.identity.accesscontextmanager.v1.IUpdateServicePerimeterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateServicePerimeter( + request: protos.google.identity.accesscontextmanager.v1.IUpdateServicePerimeterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateServicePerimeter( + request: protos.google.identity.accesscontextmanager.v1.IUpdateServicePerimeterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateServicePerimeter( + request?: protos.google.identity.accesscontextmanager.v1.IUpdateServicePerimeterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as 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_perimeter.name': request.servicePerimeter!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateServicePerimeter(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateServicePerimeter()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.update_service_perimeter.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateServicePerimeter_async + */ + async checkUpdateServicePerimeterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateServicePerimeter, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a [service perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the + * resource name. The long-running operation from this RPC has a successful + * status after the [service perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] is removed from + * long-lasting storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name for the [Service Perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter]. + * + * Format: + * `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_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/access_context_manager.delete_service_perimeter.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteServicePerimeter_async + */ + deleteServicePerimeter( + request?: protos.google.identity.accesscontextmanager.v1.IDeleteServicePerimeterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteServicePerimeter( + request: protos.google.identity.accesscontextmanager.v1.IDeleteServicePerimeterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteServicePerimeter( + request: protos.google.identity.accesscontextmanager.v1.IDeleteServicePerimeterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteServicePerimeter( + request?: protos.google.identity.accesscontextmanager.v1.IDeleteServicePerimeterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteServicePerimeter(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteServicePerimeter()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.delete_service_perimeter.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteServicePerimeter_async + */ + async checkDeleteServicePerimeterProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteServicePerimeter, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Replace all existing [service perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] in an [access + * policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with the + * [service perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] provided. This + * is done atomically. The long-running operation from this RPC has a + * successful status after all replacements propagate to long-lasting storage. + * Replacements containing errors result in an error response for the first + * error encountered. Upon an error, replacement are cancelled and existing + * [service perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] are not + * affected. The Operation.response field contains + * ReplaceServicePerimetersResponse. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name for the access policy which owns these + * [Service Perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter]. + * + * Format: `accessPolicies/{policy_id}` + * @param {number[]} request.servicePerimeters + * Required. The desired [Service Perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] that should + * replace all existing [Service Perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] in the + * [Access Policy] + * [google.identity.accesscontextmanager.v1.AccessPolicy]. + * @param {string} request.etag + * Optional. The etag for the version of the [Access Policy] + * [google.identity.accesscontextmanager.v1.AccessPolicy] that this + * replace operation is to be performed on. If, at the time of replace, the + * etag for the Access Policy stored in Access Context Manager is different + * from the specified etag, then the replace operation will not be performed + * and the call will fail. This field is not required. If etag is not + * provided, the operation will be performed as if a valid etag is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.replace_service_perimeters.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ReplaceServicePerimeters_async + */ + replaceServicePerimeters( + request?: protos.google.identity.accesscontextmanager.v1.IReplaceServicePerimetersRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + replaceServicePerimeters( + request: protos.google.identity.accesscontextmanager.v1.IReplaceServicePerimetersRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + replaceServicePerimeters( + request: protos.google.identity.accesscontextmanager.v1.IReplaceServicePerimetersRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + replaceServicePerimeters( + request?: protos.google.identity.accesscontextmanager.v1.IReplaceServicePerimetersRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.replaceServicePerimeters(request, options, callback); + } +/** + * Check the status of the long running operation returned by `replaceServicePerimeters()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.replace_service_perimeters.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ReplaceServicePerimeters_async + */ + async checkReplaceServicePerimetersProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.replaceServicePerimeters, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Commits the dry-run specification for all the [service perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] in an + * {@link protos.google.identity.accesscontextmanager.v1.AccessPolicy|access policy}. + * A commit operation on a service perimeter involves copying its `spec` field + * to the `status` field of the service perimeter. Only [service perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] with + * `use_explicit_dry_run_spec` field set to true are affected by a commit + * operation. The long-running operation from this RPC has a successful + * status after the dry-run specifications for all the [service perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] have been + * committed. If a commit fails, it causes the long-running operation to + * return an error response and the entire commit operation is cancelled. + * When successful, the Operation.response field contains + * CommitServicePerimetersResponse. The `dry_run` and the `spec` fields are + * cleared after a successful commit operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name for the parent [Access Policy] + * [google.identity.accesscontextmanager.v1.AccessPolicy] which owns all + * [Service Perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] in scope for + * the commit operation. + * + * Format: `accessPolicies/{policy_id}` + * @param {string} request.etag + * Optional. The etag for the version of the [Access Policy] + * [google.identity.accesscontextmanager.v1.AccessPolicy] that this + * commit operation is to be performed on. If, at the time of commit, the + * etag for the Access Policy stored in Access Context Manager is different + * from the specified etag, then the commit operation will not be performed + * and the call will fail. This field is not required. If etag is not + * provided, the operation will be performed as if a valid etag is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.commit_service_perimeters.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CommitServicePerimeters_async + */ + commitServicePerimeters( + request?: protos.google.identity.accesscontextmanager.v1.ICommitServicePerimetersRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + commitServicePerimeters( + request: protos.google.identity.accesscontextmanager.v1.ICommitServicePerimetersRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + commitServicePerimeters( + request: protos.google.identity.accesscontextmanager.v1.ICommitServicePerimetersRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + commitServicePerimeters( + request?: protos.google.identity.accesscontextmanager.v1.ICommitServicePerimetersRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.commitServicePerimeters(request, options, callback); + } +/** + * Check the status of the long running operation returned by `commitServicePerimeters()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.commit_service_perimeters.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CommitServicePerimeters_async + */ + async checkCommitServicePerimetersProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.commitServicePerimeters, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a [GcpUserAccessBinding] + * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. If the + * client specifies a [name] + * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.name], + * the server ignores it. Fails if a resource already exists with the same + * [group_key] + * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.group_key]. + * Completion of this long-running operation does not necessarily signify that + * the new binding is deployed onto all affected users, which may take more + * time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example: "organizations/256" + * @param {google.identity.accesscontextmanager.v1.GcpUserAccessBinding} request.gcpUserAccessBinding + * Required. [GcpUserAccessBinding] + * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.create_gcp_user_access_binding.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateGcpUserAccessBinding_async + */ + createGcpUserAccessBinding( + request?: protos.google.identity.accesscontextmanager.v1.ICreateGcpUserAccessBindingRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createGcpUserAccessBinding( + request: protos.google.identity.accesscontextmanager.v1.ICreateGcpUserAccessBindingRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createGcpUserAccessBinding( + request: protos.google.identity.accesscontextmanager.v1.ICreateGcpUserAccessBindingRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createGcpUserAccessBinding( + request?: protos.google.identity.accesscontextmanager.v1.ICreateGcpUserAccessBindingRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createGcpUserAccessBinding(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createGcpUserAccessBinding()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.create_gcp_user_access_binding.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateGcpUserAccessBinding_async + */ + async checkCreateGcpUserAccessBindingProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createGcpUserAccessBinding, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a [GcpUserAccessBinding] + * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. + * Completion of this long-running operation does not necessarily signify that + * the changed binding is deployed onto all affected users, which may take + * more time. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.identity.accesscontextmanager.v1.GcpUserAccessBinding} request.gcpUserAccessBinding + * Required. [GcpUserAccessBinding] + * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Only the fields specified in this mask are updated. Because name and + * group_key cannot be changed, update_mask is required and must always be: + * + * update_mask { + * paths: "access_levels" + * } + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.update_gcp_user_access_binding.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateGcpUserAccessBinding_async + */ + updateGcpUserAccessBinding( + request?: protos.google.identity.accesscontextmanager.v1.IUpdateGcpUserAccessBindingRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateGcpUserAccessBinding( + request: protos.google.identity.accesscontextmanager.v1.IUpdateGcpUserAccessBindingRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateGcpUserAccessBinding( + request: protos.google.identity.accesscontextmanager.v1.IUpdateGcpUserAccessBindingRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateGcpUserAccessBinding( + request?: protos.google.identity.accesscontextmanager.v1.IUpdateGcpUserAccessBindingRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'gcp_user_access_binding.name': request.gcpUserAccessBinding!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateGcpUserAccessBinding(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateGcpUserAccessBinding()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.update_gcp_user_access_binding.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateGcpUserAccessBinding_async + */ + async checkUpdateGcpUserAccessBindingProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateGcpUserAccessBinding, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a [GcpUserAccessBinding] + * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. + * Completion of this long-running operation does not necessarily signify that + * the binding deletion is deployed onto all affected users, which may take + * more time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteGcpUserAccessBinding_async + */ + deleteGcpUserAccessBinding( + request?: protos.google.identity.accesscontextmanager.v1.IDeleteGcpUserAccessBindingRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteGcpUserAccessBinding( + request: protos.google.identity.accesscontextmanager.v1.IDeleteGcpUserAccessBindingRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteGcpUserAccessBinding( + request: protos.google.identity.accesscontextmanager.v1.IDeleteGcpUserAccessBindingRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteGcpUserAccessBinding( + request?: protos.google.identity.accesscontextmanager.v1.IDeleteGcpUserAccessBindingRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteGcpUserAccessBinding(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteGcpUserAccessBinding()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteGcpUserAccessBinding_async + */ + async checkDeleteGcpUserAccessBindingProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteGcpUserAccessBinding, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all [access policies] + * [google.identity.accesscontextmanager.v1.AccessPolicy] in an + * organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name for the container to list AccessPolicy instances + * from. + * + * Format: + * `organizations/{org_id}` + * @param {number} request.pageSize + * Number of AccessPolicy instances to include in the list. Default 100. + * @param {string} request.pageToken + * Next page token for the next batch of AccessPolicy instances. Defaults to + * the first 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.identity.accesscontextmanager.v1.AccessPolicy|AccessPolicy}. + * 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 `listAccessPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAccessPolicies( + request?: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, + options?: CallOptions): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IAccessPolicy[], + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest|null, + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse + ]>; + listAccessPolicies( + request: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IAccessPolicy>): void; + listAccessPolicies( + request: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, + callback: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IAccessPolicy>): void; + listAccessPolicies( + request?: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IAccessPolicy>, + callback?: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IAccessPolicy>): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IAccessPolicy[], + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest|null, + protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.listAccessPolicies(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. Resource name for the container to list AccessPolicy instances + * from. + * + * Format: + * `organizations/{org_id}` + * @param {number} request.pageSize + * Number of AccessPolicy instances to include in the list. Default 100. + * @param {string} request.pageToken + * Next page token for the next batch of AccessPolicy instances. Defaults to + * the first 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.identity.accesscontextmanager.v1.AccessPolicy|AccessPolicy} 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 `listAccessPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAccessPoliciesStream( + request?: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listAccessPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAccessPolicies.createStream( + this.innerApiCalls.listAccessPolicies as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAccessPolicies`, 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. Resource name for the container to list AccessPolicy instances + * from. + * + * Format: + * `organizations/{org_id}` + * @param {number} request.pageSize + * Number of AccessPolicy instances to include in the list. Default 100. + * @param {string} request.pageToken + * Next page token for the next batch of AccessPolicy instances. Defaults to + * the first 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.identity.accesscontextmanager.v1.AccessPolicy|AccessPolicy}. 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/access_context_manager.list_access_policies.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ListAccessPolicies_async + */ + listAccessPoliciesAsync( + request?: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listAccessPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAccessPolicies.asyncIterate( + this.innerApiCalls['listAccessPolicies'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all [access levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] for an access + * policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name for the access policy to list [Access Levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] from. + * + * Format: + * `accessPolicies/{policy_id}` + * @param {number} request.pageSize + * Number of [Access Levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] to include in + * the list. Default 100. + * @param {string} request.pageToken + * Next page token for the next batch of [Access Level] + * [google.identity.accesscontextmanager.v1.AccessLevel] instances. + * Defaults to the first page of results. + * @param {google.identity.accesscontextmanager.v1.LevelFormat} request.accessLevelFormat + * Whether to return `BasicLevels` in the Cloud Common Expression language, as + * `CustomLevels`, rather than as `BasicLevels`. Defaults to returning + * `AccessLevels` in the format they were defined. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.identity.accesscontextmanager.v1.AccessLevel|AccessLevel}. + * 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 `listAccessLevelsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAccessLevels( + request?: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, + options?: CallOptions): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IAccessLevel[], + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest|null, + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse + ]>; + listAccessLevels( + request: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IAccessLevel>): void; + listAccessLevels( + request: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, + callback: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IAccessLevel>): void; + listAccessLevels( + request?: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IAccessLevel>, + callback?: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IAccessLevel>): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IAccessLevel[], + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest|null, + protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listAccessLevels(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. Resource name for the access policy to list [Access Levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] from. + * + * Format: + * `accessPolicies/{policy_id}` + * @param {number} request.pageSize + * Number of [Access Levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] to include in + * the list. Default 100. + * @param {string} request.pageToken + * Next page token for the next batch of [Access Level] + * [google.identity.accesscontextmanager.v1.AccessLevel] instances. + * Defaults to the first page of results. + * @param {google.identity.accesscontextmanager.v1.LevelFormat} request.accessLevelFormat + * Whether to return `BasicLevels` in the Cloud Common Expression language, as + * `CustomLevels`, rather than as `BasicLevels`. Defaults to returning + * `AccessLevels` in the format they were defined. + * @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.identity.accesscontextmanager.v1.AccessLevel|AccessLevel} 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 `listAccessLevelsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAccessLevelsStream( + request?: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, + 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['listAccessLevels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAccessLevels.createStream( + this.innerApiCalls.listAccessLevels as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAccessLevels`, 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. Resource name for the access policy to list [Access Levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] from. + * + * Format: + * `accessPolicies/{policy_id}` + * @param {number} request.pageSize + * Number of [Access Levels] + * [google.identity.accesscontextmanager.v1.AccessLevel] to include in + * the list. Default 100. + * @param {string} request.pageToken + * Next page token for the next batch of [Access Level] + * [google.identity.accesscontextmanager.v1.AccessLevel] instances. + * Defaults to the first page of results. + * @param {google.identity.accesscontextmanager.v1.LevelFormat} request.accessLevelFormat + * Whether to return `BasicLevels` in the Cloud Common Expression language, as + * `CustomLevels`, rather than as `BasicLevels`. Defaults to returning + * `AccessLevels` in the format they were defined. + * @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.identity.accesscontextmanager.v1.AccessLevel|AccessLevel}. 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/access_context_manager.list_access_levels.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ListAccessLevels_async + */ + listAccessLevelsAsync( + request?: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, + 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['listAccessLevels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAccessLevels.asyncIterate( + this.innerApiCalls['listAccessLevels'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all [service perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] for an + * access policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name for the access policy to list [Service Perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] from. + * + * Format: + * `accessPolicies/{policy_id}` + * @param {number} request.pageSize + * Number of [Service Perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] to include + * in the list. Default 100. + * @param {string} request.pageToken + * Next page token for the next batch of [Service Perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. + * Defaults to the first 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.identity.accesscontextmanager.v1.ServicePerimeter|ServicePerimeter}. + * 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 `listServicePerimetersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listServicePerimeters( + request?: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, + options?: CallOptions): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IServicePerimeter[], + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest|null, + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse + ]>; + listServicePerimeters( + request: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IServicePerimeter>): void; + listServicePerimeters( + request: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, + callback: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IServicePerimeter>): void; + listServicePerimeters( + request?: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IServicePerimeter>, + callback?: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IServicePerimeter>): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IServicePerimeter[], + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest|null, + protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listServicePerimeters(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. Resource name for the access policy to list [Service Perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] from. + * + * Format: + * `accessPolicies/{policy_id}` + * @param {number} request.pageSize + * Number of [Service Perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] to include + * in the list. Default 100. + * @param {string} request.pageToken + * Next page token for the next batch of [Service Perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. + * Defaults to the first 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.identity.accesscontextmanager.v1.ServicePerimeter|ServicePerimeter} 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 `listServicePerimetersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listServicePerimetersStream( + request?: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, + 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['listServicePerimeters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServicePerimeters.createStream( + this.innerApiCalls.listServicePerimeters as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listServicePerimeters`, 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. Resource name for the access policy to list [Service Perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] from. + * + * Format: + * `accessPolicies/{policy_id}` + * @param {number} request.pageSize + * Number of [Service Perimeters] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] to include + * in the list. Default 100. + * @param {string} request.pageToken + * Next page token for the next batch of [Service Perimeter] + * [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. + * Defaults to the first 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.identity.accesscontextmanager.v1.ServicePerimeter|ServicePerimeter}. 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/access_context_manager.list_service_perimeters.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ListServicePerimeters_async + */ + listServicePerimetersAsync( + request?: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, + 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['listServicePerimeters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServicePerimeters.asyncIterate( + this.innerApiCalls['listServicePerimeters'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all [GcpUserAccessBindings] + * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] for a + * Google Cloud organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example: "organizations/256" + * @param {number} [request.pageSize] + * Optional. Maximum number of items to return. The server may return fewer items. + * If left blank, the server may return any number of items. + * @param {string} [request.pageToken] + * Optional. If left blank, returns the first page. To enumerate all items, use the + * [next_page_token] + * [google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse.next_page_token] + * from your previous list operation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.identity.accesscontextmanager.v1.GcpUserAccessBinding|GcpUserAccessBinding}. + * 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 `listGcpUserAccessBindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listGcpUserAccessBindings( + request?: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding[], + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest|null, + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse + ]>; + listGcpUserAccessBindings( + request: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding>): void; + listGcpUserAccessBindings( + request: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, + callback: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding>): void; + listGcpUserAccessBindings( + request?: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding>, + callback?: PaginationCallback< + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse|null|undefined, + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding>): + Promise<[ + protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding[], + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest|null, + protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listGcpUserAccessBindings(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. Example: "organizations/256" + * @param {number} [request.pageSize] + * Optional. Maximum number of items to return. The server may return fewer items. + * If left blank, the server may return any number of items. + * @param {string} [request.pageToken] + * Optional. If left blank, returns the first page. To enumerate all items, use the + * [next_page_token] + * [google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse.next_page_token] + * from your previous list operation. + * @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.identity.accesscontextmanager.v1.GcpUserAccessBinding|GcpUserAccessBinding} 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 `listGcpUserAccessBindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listGcpUserAccessBindingsStream( + request?: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, + 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['listGcpUserAccessBindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listGcpUserAccessBindings.createStream( + this.innerApiCalls.listGcpUserAccessBindings as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listGcpUserAccessBindings`, 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. Example: "organizations/256" + * @param {number} [request.pageSize] + * Optional. Maximum number of items to return. The server may return fewer items. + * If left blank, the server may return any number of items. + * @param {string} [request.pageToken] + * Optional. If left blank, returns the first page. To enumerate all items, use the + * [next_page_token] + * [google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse.next_page_token] + * from your previous list operation. + * @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.identity.accesscontextmanager.v1.GcpUserAccessBinding|GcpUserAccessBinding}. 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/access_context_manager.list_gcp_user_access_bindings.js + * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ListGcpUserAccessBindings_async + */ + listGcpUserAccessBindingsAsync( + request?: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, + 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['listGcpUserAccessBindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listGcpUserAccessBindings.asyncIterate( + this.innerApiCalls['listGcpUserAccessBindings'] 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 accessLevel resource name string. + * + * @param {string} access_policy + * @param {string} access_level + * @returns {string} Resource name string. + */ + accessLevelPath(accessPolicy:string,accessLevel:string) { + return this.pathTemplates.accessLevelPathTemplate.render({ + access_policy: accessPolicy, + access_level: accessLevel, + }); + } + + /** + * Parse the access_policy from AccessLevel resource. + * + * @param {string} accessLevelName + * A fully-qualified path representing AccessLevel resource. + * @returns {string} A string representing the access_policy. + */ + matchAccessPolicyFromAccessLevelName(accessLevelName: string) { + return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_policy; + } + + /** + * Parse the access_level from AccessLevel resource. + * + * @param {string} accessLevelName + * A fully-qualified path representing AccessLevel resource. + * @returns {string} A string representing the access_level. + */ + matchAccessLevelFromAccessLevelName(accessLevelName: string) { + return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_level; + } + + /** + * Return a fully-qualified accessPolicy resource name string. + * + * @param {string} access_policy + * @returns {string} Resource name string. + */ + accessPolicyPath(accessPolicy:string) { + return this.pathTemplates.accessPolicyPathTemplate.render({ + access_policy: accessPolicy, + }); + } + + /** + * Parse the access_policy from AccessPolicy resource. + * + * @param {string} accessPolicyName + * A fully-qualified path representing AccessPolicy resource. + * @returns {string} A string representing the access_policy. + */ + matchAccessPolicyFromAccessPolicyName(accessPolicyName: string) { + return this.pathTemplates.accessPolicyPathTemplate.match(accessPolicyName).access_policy; + } + + /** + * Return a fully-qualified gcpUserAccessBinding resource name string. + * + * @param {string} organization + * @param {string} gcp_user_access_binding + * @returns {string} Resource name string. + */ + gcpUserAccessBindingPath(organization:string,gcpUserAccessBinding:string) { + return this.pathTemplates.gcpUserAccessBindingPathTemplate.render({ + organization: organization, + gcp_user_access_binding: gcpUserAccessBinding, + }); + } + + /** + * Parse the organization from GcpUserAccessBinding resource. + * + * @param {string} gcpUserAccessBindingName + * A fully-qualified path representing GcpUserAccessBinding resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromGcpUserAccessBindingName(gcpUserAccessBindingName: string) { + return this.pathTemplates.gcpUserAccessBindingPathTemplate.match(gcpUserAccessBindingName).organization; + } + + /** + * Parse the gcp_user_access_binding from GcpUserAccessBinding resource. + * + * @param {string} gcpUserAccessBindingName + * A fully-qualified path representing GcpUserAccessBinding resource. + * @returns {string} A string representing the gcp_user_access_binding. + */ + matchGcpUserAccessBindingFromGcpUserAccessBindingName(gcpUserAccessBindingName: string) { + return this.pathTemplates.gcpUserAccessBindingPathTemplate.match(gcpUserAccessBindingName).gcp_user_access_binding; + } + + /** + * 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 servicePerimeter resource name string. + * + * @param {string} access_policy + * @param {string} service_perimeter + * @returns {string} Resource name string. + */ + servicePerimeterPath(accessPolicy:string,servicePerimeter:string) { + return this.pathTemplates.servicePerimeterPathTemplate.render({ + access_policy: accessPolicy, + service_perimeter: servicePerimeter, + }); + } + + /** + * Parse the access_policy from ServicePerimeter resource. + * + * @param {string} servicePerimeterName + * A fully-qualified path representing ServicePerimeter resource. + * @returns {string} A string representing the access_policy. + */ + matchAccessPolicyFromServicePerimeterName(servicePerimeterName: string) { + return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).access_policy; + } + + /** + * Parse the service_perimeter from ServicePerimeter resource. + * + * @param {string} servicePerimeterName + * A fully-qualified path representing ServicePerimeter resource. + * @returns {string} A string representing the service_perimeter. + */ + matchServicePerimeterFromServicePerimeterName(servicePerimeterName: string) { + return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).service_perimeter; + } + + /** + * 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.accessContextManagerStub && !this._terminated) { + return this.accessContextManagerStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client_config.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client_config.json new file mode 100644 index 00000000000..ac86647c705 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client_config.json @@ -0,0 +1,156 @@ +{ + "interfaces": { + "google.identity.accesscontextmanager.v1.AccessContextManager": { + "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": { + "ListAccessPolicies": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAccessPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateAccessPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAccessPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteAccessPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListAccessLevels": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAccessLevel": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateAccessLevel": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAccessLevel": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteAccessLevel": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReplaceAccessLevels": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListServicePerimeters": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetServicePerimeter": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateServicePerimeter": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateServicePerimeter": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteServicePerimeter": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReplaceServicePerimeters": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CommitServicePerimeters": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListGcpUserAccessBindings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetGcpUserAccessBinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateGcpUserAccessBinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateGcpUserAccessBinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteGcpUserAccessBinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "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-identity-accesscontextmanager/v1/src/v1/access_context_manager_proto_list.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_proto_list.json new file mode 100644 index 00000000000..7ac8f3e0fd9 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/identity/accesscontextmanager/type/device_resources.proto", + "../../protos/google/identity/accesscontextmanager/v1/access_context_manager.proto", + "../../protos/google/identity/accesscontextmanager/v1/access_level.proto", + "../../protos/google/identity/accesscontextmanager/v1/access_policy.proto", + "../../protos/google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto", + "../../protos/google/identity/accesscontextmanager/v1/service_perimeter.proto" +] diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..9a97f9b98ed --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/gapic_metadata.json @@ -0,0 +1,299 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.identity.accesscontextmanager.v1", + "libraryPackage": "@google-cloud/access-context-manager", + "services": { + "AccessContextManager": { + "clients": { + "grpc": { + "libraryClient": "AccessContextManagerClient", + "rpcs": { + "GetAccessPolicy": { + "methods": [ + "getAccessPolicy" + ] + }, + "GetAccessLevel": { + "methods": [ + "getAccessLevel" + ] + }, + "GetServicePerimeter": { + "methods": [ + "getServicePerimeter" + ] + }, + "GetGcpUserAccessBinding": { + "methods": [ + "getGcpUserAccessBinding" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "CreateAccessPolicy": { + "methods": [ + "createAccessPolicy" + ] + }, + "UpdateAccessPolicy": { + "methods": [ + "updateAccessPolicy" + ] + }, + "DeleteAccessPolicy": { + "methods": [ + "deleteAccessPolicy" + ] + }, + "CreateAccessLevel": { + "methods": [ + "createAccessLevel" + ] + }, + "UpdateAccessLevel": { + "methods": [ + "updateAccessLevel" + ] + }, + "DeleteAccessLevel": { + "methods": [ + "deleteAccessLevel" + ] + }, + "ReplaceAccessLevels": { + "methods": [ + "replaceAccessLevels" + ] + }, + "CreateServicePerimeter": { + "methods": [ + "createServicePerimeter" + ] + }, + "UpdateServicePerimeter": { + "methods": [ + "updateServicePerimeter" + ] + }, + "DeleteServicePerimeter": { + "methods": [ + "deleteServicePerimeter" + ] + }, + "ReplaceServicePerimeters": { + "methods": [ + "replaceServicePerimeters" + ] + }, + "CommitServicePerimeters": { + "methods": [ + "commitServicePerimeters" + ] + }, + "CreateGcpUserAccessBinding": { + "methods": [ + "createGcpUserAccessBinding" + ] + }, + "UpdateGcpUserAccessBinding": { + "methods": [ + "updateGcpUserAccessBinding" + ] + }, + "DeleteGcpUserAccessBinding": { + "methods": [ + "deleteGcpUserAccessBinding" + ] + }, + "ListAccessPolicies": { + "methods": [ + "listAccessPolicies", + "listAccessPoliciesStream", + "listAccessPoliciesAsync" + ] + }, + "ListAccessLevels": { + "methods": [ + "listAccessLevels", + "listAccessLevelsStream", + "listAccessLevelsAsync" + ] + }, + "ListServicePerimeters": { + "methods": [ + "listServicePerimeters", + "listServicePerimetersStream", + "listServicePerimetersAsync" + ] + }, + "ListGcpUserAccessBindings": { + "methods": [ + "listGcpUserAccessBindings", + "listGcpUserAccessBindingsStream", + "listGcpUserAccessBindingsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AccessContextManagerClient", + "rpcs": { + "GetAccessPolicy": { + "methods": [ + "getAccessPolicy" + ] + }, + "GetAccessLevel": { + "methods": [ + "getAccessLevel" + ] + }, + "GetServicePerimeter": { + "methods": [ + "getServicePerimeter" + ] + }, + "GetGcpUserAccessBinding": { + "methods": [ + "getGcpUserAccessBinding" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "CreateAccessPolicy": { + "methods": [ + "createAccessPolicy" + ] + }, + "UpdateAccessPolicy": { + "methods": [ + "updateAccessPolicy" + ] + }, + "DeleteAccessPolicy": { + "methods": [ + "deleteAccessPolicy" + ] + }, + "CreateAccessLevel": { + "methods": [ + "createAccessLevel" + ] + }, + "UpdateAccessLevel": { + "methods": [ + "updateAccessLevel" + ] + }, + "DeleteAccessLevel": { + "methods": [ + "deleteAccessLevel" + ] + }, + "ReplaceAccessLevels": { + "methods": [ + "replaceAccessLevels" + ] + }, + "CreateServicePerimeter": { + "methods": [ + "createServicePerimeter" + ] + }, + "UpdateServicePerimeter": { + "methods": [ + "updateServicePerimeter" + ] + }, + "DeleteServicePerimeter": { + "methods": [ + "deleteServicePerimeter" + ] + }, + "ReplaceServicePerimeters": { + "methods": [ + "replaceServicePerimeters" + ] + }, + "CommitServicePerimeters": { + "methods": [ + "commitServicePerimeters" + ] + }, + "CreateGcpUserAccessBinding": { + "methods": [ + "createGcpUserAccessBinding" + ] + }, + "UpdateGcpUserAccessBinding": { + "methods": [ + "updateGcpUserAccessBinding" + ] + }, + "DeleteGcpUserAccessBinding": { + "methods": [ + "deleteGcpUserAccessBinding" + ] + }, + "ListAccessPolicies": { + "methods": [ + "listAccessPolicies", + "listAccessPoliciesStream", + "listAccessPoliciesAsync" + ] + }, + "ListAccessLevels": { + "methods": [ + "listAccessLevels", + "listAccessLevelsStream", + "listAccessLevelsAsync" + ] + }, + "ListServicePerimeters": { + "methods": [ + "listServicePerimeters", + "listServicePerimetersStream", + "listServicePerimetersAsync" + ] + }, + "ListGcpUserAccessBindings": { + "methods": [ + "listGcpUserAccessBindings", + "listGcpUserAccessBindingsStream", + "listGcpUserAccessBindingsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/index.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/index.ts new file mode 100644 index 00000000000..643d738a52f --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/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 {AccessContextManagerClient} from './access_context_manager_client'; diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..63ebbe60da3 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/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 accesscontextmanager = require('@google-cloud/access-context-manager'); + +function main() { + const accessContextManagerClient = new accesscontextmanager.AccessContextManagerClient(); +} + +main(); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..ececac41a3c --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/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 {AccessContextManagerClient} from '@google-cloud/access-context-manager'; + +// check that the client class type name can be used +function doStuffWithAccessContextManagerClient(client: AccessContextManagerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const accessContextManagerClient = new AccessContextManagerClient(); + doStuffWithAccessContextManagerClient(accessContextManagerClient); +} + +main(); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/install.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/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-identity-accesscontextmanager/v1/test/gapic_access_context_manager_v1.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/test/gapic_access_context_manager_v1.ts new file mode 100644 index 00000000000..dcb1778ed84 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/v1/test/gapic_access_context_manager_v1.ts @@ -0,0 +1,4597 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 accesscontextmanagerModule 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.AccessContextManagerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = accesscontextmanagerModule.v1.AccessContextManagerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = accesscontextmanagerModule.v1.AccessContextManagerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = accesscontextmanagerModule.v1.AccessContextManagerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.accessContextManagerStub, undefined); + await client.initialize(); + assert(client.accessContextManagerStub); + }); + + it('has close method for the initialized client', done => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.accessContextManagerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.accessContextManagerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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('getAccessPolicy', () => { + it('invokes getAccessPolicy without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.AccessPolicy() + ); + client.innerApiCalls.getAccessPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getAccessPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAccessPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAccessPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAccessPolicy without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.AccessPolicy() + ); + client.innerApiCalls.getAccessPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAccessPolicy( + request, + (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IAccessPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAccessPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAccessPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAccessPolicy with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAccessPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAccessPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.getAccessPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAccessPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAccessPolicy with closed client', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAccessPolicy(request), expectedError); + }); + }); + + describe('getAccessLevel', () => { + it('invokes getAccessLevel without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessLevelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.AccessLevel() + ); + client.innerApiCalls.getAccessLevel = stubSimpleCall(expectedResponse); + const [response] = await client.getAccessLevel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAccessLevel without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessLevelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.AccessLevel() + ); + client.innerApiCalls.getAccessLevel = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAccessLevel( + request, + (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IAccessLevel|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAccessLevel with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessLevelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAccessLevel = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAccessLevel(request), expectedError); + const actualRequest = (client.innerApiCalls.getAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAccessLevel with closed client', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessLevelRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAccessLevel(request), expectedError); + }); + }); + + describe('getServicePerimeter', () => { + it('invokes getServicePerimeter without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ServicePerimeter() + ); + client.innerApiCalls.getServicePerimeter = stubSimpleCall(expectedResponse); + const [response] = await client.getServicePerimeter(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServicePerimeter without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ServicePerimeter() + ); + client.innerApiCalls.getServicePerimeter = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getServicePerimeter( + request, + (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IServicePerimeter|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServicePerimeter with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getServicePerimeter = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getServicePerimeter(request), expectedError); + const actualRequest = (client.innerApiCalls.getServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServicePerimeter with closed client', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getServicePerimeter(request), expectedError); + }); + }); + + describe('getGcpUserAccessBinding', () => { + it('invokes getGcpUserAccessBinding without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding() + ); + client.innerApiCalls.getGcpUserAccessBinding = stubSimpleCall(expectedResponse); + const [response] = await client.getGcpUserAccessBinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGcpUserAccessBinding without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding() + ); + client.innerApiCalls.getGcpUserAccessBinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGcpUserAccessBinding( + request, + (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGcpUserAccessBinding with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGcpUserAccessBinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getGcpUserAccessBinding(request), expectedError); + const actualRequest = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGcpUserAccessBinding with closed client', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getGcpUserAccessBinding(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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('createAccessPolicy', () => { + it('invokes createAccessPolicy without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.AccessPolicy() + ); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAccessPolicy = stubLongRunningCall(expectedResponse); + const [operation] = await client.createAccessPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes createAccessPolicy without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.AccessPolicy() + ); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAccessPolicy = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAccessPolicy( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes createAccessPolicy with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.AccessPolicy() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.createAccessPolicy = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createAccessPolicy(request), expectedError); + }); + + it('invokes createAccessPolicy with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.AccessPolicy() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.createAccessPolicy = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createAccessPolicy(request); + await assert.rejects(operation.promise(), expectedError); + }); + + it('invokes checkCreateAccessPolicyProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateAccessPolicyProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateAccessPolicyProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateAccessPolicyProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateAccessPolicy', () => { + it('invokes updateAccessPolicy without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAccessPolicy = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAccessPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAccessPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAccessPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAccessPolicy without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAccessPolicy = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAccessPolicy( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAccessPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAccessPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAccessPolicy with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAccessPolicy = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateAccessPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAccessPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAccessPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAccessPolicy with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAccessPolicy = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateAccessPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateAccessPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAccessPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateAccessPolicyProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateAccessPolicyProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateAccessPolicyProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateAccessPolicyProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteAccessPolicy', () => { + it('invokes deleteAccessPolicy without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAccessPolicy = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAccessPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAccessPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAccessPolicy without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAccessPolicy = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAccessPolicy( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAccessPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAccessPolicy with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAccessPolicy = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteAccessPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAccessPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAccessPolicy with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAccessPolicy = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteAccessPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteAccessPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteAccessPolicyProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteAccessPolicyProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteAccessPolicyProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteAccessPolicyProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createAccessLevel', () => { + it('invokes createAccessLevel without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAccessLevel = stubLongRunningCall(expectedResponse); + const [operation] = await client.createAccessLevel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAccessLevel without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createAccessLevel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAccessLevel( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAccessLevel with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAccessLevel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createAccessLevel(request), expectedError); + const actualRequest = (client.innerApiCalls.createAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAccessLevel with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAccessLevel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createAccessLevel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateAccessLevelProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateAccessLevelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateAccessLevelProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateAccessLevelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateAccessLevel', () => { + it('invokes updateAccessLevel without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest() + ); + request.accessLevel ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest', ['accessLevel', 'name']); + request.accessLevel.name = defaultValue1; + const expectedHeaderRequestParams = `access_level.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAccessLevel = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAccessLevel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAccessLevel without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest() + ); + request.accessLevel ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest', ['accessLevel', 'name']); + request.accessLevel.name = defaultValue1; + const expectedHeaderRequestParams = `access_level.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateAccessLevel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAccessLevel( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAccessLevel with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest() + ); + request.accessLevel ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest', ['accessLevel', 'name']); + request.accessLevel.name = defaultValue1; + const expectedHeaderRequestParams = `access_level.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAccessLevel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateAccessLevel(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAccessLevel with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest() + ); + request.accessLevel ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest', ['accessLevel', 'name']); + request.accessLevel.name = defaultValue1; + const expectedHeaderRequestParams = `access_level.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAccessLevel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateAccessLevel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateAccessLevelProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateAccessLevelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateAccessLevelProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateAccessLevelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteAccessLevel', () => { + it('invokes deleteAccessLevel without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAccessLevel = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAccessLevel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAccessLevel without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteAccessLevel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAccessLevel( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAccessLevel with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAccessLevel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteAccessLevel(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAccessLevel with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAccessLevel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteAccessLevel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteAccessLevel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessLevel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteAccessLevelProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteAccessLevelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteAccessLevelProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteAccessLevelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('replaceAccessLevels', () => { + it('invokes replaceAccessLevels without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.replaceAccessLevels = stubLongRunningCall(expectedResponse); + const [operation] = await client.replaceAccessLevels(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.replaceAccessLevels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceAccessLevels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceAccessLevels without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.replaceAccessLevels = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.replaceAccessLevels( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.replaceAccessLevels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceAccessLevels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceAccessLevels with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.replaceAccessLevels = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.replaceAccessLevels(request), expectedError); + const actualRequest = (client.innerApiCalls.replaceAccessLevels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceAccessLevels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceAccessLevels with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.replaceAccessLevels = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.replaceAccessLevels(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.replaceAccessLevels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceAccessLevels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkReplaceAccessLevelsProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkReplaceAccessLevelsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReplaceAccessLevelsProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkReplaceAccessLevelsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createServicePerimeter', () => { + it('invokes createServicePerimeter without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createServicePerimeter = stubLongRunningCall(expectedResponse); + const [operation] = await client.createServicePerimeter(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createServicePerimeter without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createServicePerimeter = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createServicePerimeter( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createServicePerimeter with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createServicePerimeter = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createServicePerimeter(request), expectedError); + const actualRequest = (client.innerApiCalls.createServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createServicePerimeter with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createServicePerimeter = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createServicePerimeter(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateServicePerimeterProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateServicePerimeterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateServicePerimeterProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateServicePerimeterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateServicePerimeter', () => { + it('invokes updateServicePerimeter without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest() + ); + request.servicePerimeter ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest', ['servicePerimeter', 'name']); + request.servicePerimeter.name = defaultValue1; + const expectedHeaderRequestParams = `service_perimeter.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateServicePerimeter = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateServicePerimeter(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateServicePerimeter without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest() + ); + request.servicePerimeter ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest', ['servicePerimeter', 'name']); + request.servicePerimeter.name = defaultValue1; + const expectedHeaderRequestParams = `service_perimeter.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateServicePerimeter = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateServicePerimeter( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateServicePerimeter with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest() + ); + request.servicePerimeter ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest', ['servicePerimeter', 'name']); + request.servicePerimeter.name = defaultValue1; + const expectedHeaderRequestParams = `service_perimeter.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServicePerimeter = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateServicePerimeter(request), expectedError); + const actualRequest = (client.innerApiCalls.updateServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateServicePerimeter with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest() + ); + request.servicePerimeter ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest', ['servicePerimeter', 'name']); + request.servicePerimeter.name = defaultValue1; + const expectedHeaderRequestParams = `service_perimeter.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServicePerimeter = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateServicePerimeter(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateServicePerimeterProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateServicePerimeterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateServicePerimeterProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateServicePerimeterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteServicePerimeter', () => { + it('invokes deleteServicePerimeter without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteServicePerimeter = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteServicePerimeter(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteServicePerimeter without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteServicePerimeter = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteServicePerimeter( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteServicePerimeter with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServicePerimeter = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteServicePerimeter(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteServicePerimeter with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServicePerimeter = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteServicePerimeter(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteServicePerimeter as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteServicePerimeter as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteServicePerimeterProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteServicePerimeterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteServicePerimeterProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteServicePerimeterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('replaceServicePerimeters', () => { + it('invokes replaceServicePerimeters without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.replaceServicePerimeters = stubLongRunningCall(expectedResponse); + const [operation] = await client.replaceServicePerimeters(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.replaceServicePerimeters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceServicePerimeters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceServicePerimeters without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.replaceServicePerimeters = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.replaceServicePerimeters( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.replaceServicePerimeters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceServicePerimeters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceServicePerimeters with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.replaceServicePerimeters = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.replaceServicePerimeters(request), expectedError); + const actualRequest = (client.innerApiCalls.replaceServicePerimeters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceServicePerimeters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceServicePerimeters with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.replaceServicePerimeters = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.replaceServicePerimeters(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.replaceServicePerimeters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceServicePerimeters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkReplaceServicePerimetersProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkReplaceServicePerimetersProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReplaceServicePerimetersProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkReplaceServicePerimetersProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('commitServicePerimeters', () => { + it('invokes commitServicePerimeters without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.commitServicePerimeters = stubLongRunningCall(expectedResponse); + const [operation] = await client.commitServicePerimeters(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.commitServicePerimeters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.commitServicePerimeters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes commitServicePerimeters without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.commitServicePerimeters = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.commitServicePerimeters( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.commitServicePerimeters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.commitServicePerimeters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes commitServicePerimeters with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.commitServicePerimeters = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.commitServicePerimeters(request), expectedError); + const actualRequest = (client.innerApiCalls.commitServicePerimeters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.commitServicePerimeters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes commitServicePerimeters with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.commitServicePerimeters = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.commitServicePerimeters(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.commitServicePerimeters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.commitServicePerimeters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCommitServicePerimetersProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCommitServicePerimetersProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCommitServicePerimetersProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCommitServicePerimetersProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createGcpUserAccessBinding', () => { + it('invokes createGcpUserAccessBinding without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createGcpUserAccessBinding = stubLongRunningCall(expectedResponse); + const [operation] = await client.createGcpUserAccessBinding(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGcpUserAccessBinding without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createGcpUserAccessBinding = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGcpUserAccessBinding( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGcpUserAccessBinding with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGcpUserAccessBinding = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createGcpUserAccessBinding(request), expectedError); + const actualRequest = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGcpUserAccessBinding with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGcpUserAccessBinding = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createGcpUserAccessBinding(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateGcpUserAccessBindingProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateGcpUserAccessBindingProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateGcpUserAccessBindingProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateGcpUserAccessBindingProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateGcpUserAccessBinding', () => { + it('invokes updateGcpUserAccessBinding without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest() + ); + request.gcpUserAccessBinding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest', ['gcpUserAccessBinding', 'name']); + request.gcpUserAccessBinding.name = defaultValue1; + const expectedHeaderRequestParams = `gcp_user_access_binding.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateGcpUserAccessBinding = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateGcpUserAccessBinding(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateGcpUserAccessBinding without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest() + ); + request.gcpUserAccessBinding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest', ['gcpUserAccessBinding', 'name']); + request.gcpUserAccessBinding.name = defaultValue1; + const expectedHeaderRequestParams = `gcp_user_access_binding.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateGcpUserAccessBinding = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateGcpUserAccessBinding( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateGcpUserAccessBinding with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest() + ); + request.gcpUserAccessBinding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest', ['gcpUserAccessBinding', 'name']); + request.gcpUserAccessBinding.name = defaultValue1; + const expectedHeaderRequestParams = `gcp_user_access_binding.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGcpUserAccessBinding = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateGcpUserAccessBinding(request), expectedError); + const actualRequest = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateGcpUserAccessBinding with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest() + ); + request.gcpUserAccessBinding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest', ['gcpUserAccessBinding', 'name']); + request.gcpUserAccessBinding.name = defaultValue1; + const expectedHeaderRequestParams = `gcp_user_access_binding.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGcpUserAccessBinding = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateGcpUserAccessBinding(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateGcpUserAccessBindingProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateGcpUserAccessBindingProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateGcpUserAccessBindingProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateGcpUserAccessBindingProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteGcpUserAccessBinding', () => { + it('invokes deleteGcpUserAccessBinding without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteGcpUserAccessBinding = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteGcpUserAccessBinding(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGcpUserAccessBinding without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteGcpUserAccessBinding = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGcpUserAccessBinding( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGcpUserAccessBinding with call error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGcpUserAccessBinding = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteGcpUserAccessBinding(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGcpUserAccessBinding with LRO error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGcpUserAccessBinding = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteGcpUserAccessBinding(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteGcpUserAccessBindingProgress without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteGcpUserAccessBindingProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteGcpUserAccessBindingProgress with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteGcpUserAccessBindingProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listAccessPolicies', () => { + it('invokes listAccessPolicies without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + ]; + client.innerApiCalls.listAccessPolicies = stubSimpleCall(expectedResponse); + const [response] = await client.listAccessPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listAccessPolicies without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + ]; + client.innerApiCalls.listAccessPolicies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAccessPolicies( + request, + (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IAccessPolicy[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listAccessPolicies with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.listAccessPolicies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAccessPolicies(request), expectedError); + }); + + it('invokes listAccessPoliciesStream without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + ]; + client.descriptors.page.listAccessPolicies.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAccessPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.identity.accesscontextmanager.v1.AccessPolicy[] = []; + stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.AccessPolicy) => { + 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.listAccessPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAccessPolicies, request)); + }); + + it('invokes listAccessPoliciesStream with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listAccessPolicies.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAccessPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.identity.accesscontextmanager.v1.AccessPolicy[] = []; + stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.AccessPolicy) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAccessPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAccessPolicies, request)); + }); + + it('uses async iteration with listAccessPolicies without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), + ]; + client.descriptors.page.listAccessPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.identity.accesscontextmanager.v1.IAccessPolicy[] = []; + const iterable = client.listAccessPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAccessPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + + it('uses async iteration with listAccessPolicies with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listAccessPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAccessPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.identity.accesscontextmanager.v1.IAccessPolicy[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAccessPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('listAccessLevels', () => { + it('invokes listAccessLevels without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + ]; + client.innerApiCalls.listAccessLevels = stubSimpleCall(expectedResponse); + const [response] = await client.listAccessLevels(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAccessLevels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAccessLevels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAccessLevels without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + ]; + client.innerApiCalls.listAccessLevels = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAccessLevels( + request, + (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IAccessLevel[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAccessLevels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAccessLevels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAccessLevels with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAccessLevels = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAccessLevels(request), expectedError); + const actualRequest = (client.innerApiCalls.listAccessLevels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAccessLevels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAccessLevelsStream without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + ]; + client.descriptors.page.listAccessLevels.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAccessLevelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.identity.accesscontextmanager.v1.AccessLevel[] = []; + stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.AccessLevel) => { + 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.listAccessLevels.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAccessLevels, request)); + assert( + (client.descriptors.page.listAccessLevels.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAccessLevelsStream with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAccessLevels.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAccessLevelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.identity.accesscontextmanager.v1.AccessLevel[] = []; + stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.AccessLevel) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAccessLevels.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAccessLevels, request)); + assert( + (client.descriptors.page.listAccessLevels.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAccessLevels without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), + ]; + client.descriptors.page.listAccessLevels.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.identity.accesscontextmanager.v1.IAccessLevel[] = []; + const iterable = client.listAccessLevelsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAccessLevels.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAccessLevels.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAccessLevels with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAccessLevels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAccessLevelsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.identity.accesscontextmanager.v1.IAccessLevel[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAccessLevels.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAccessLevels.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listServicePerimeters', () => { + it('invokes listServicePerimeters without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + ]; + client.innerApiCalls.listServicePerimeters = stubSimpleCall(expectedResponse); + const [response] = await client.listServicePerimeters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServicePerimeters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServicePerimeters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServicePerimeters without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + ]; + client.innerApiCalls.listServicePerimeters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServicePerimeters( + request, + (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IServicePerimeter[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServicePerimeters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServicePerimeters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServicePerimeters with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServicePerimeters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listServicePerimeters(request), expectedError); + const actualRequest = (client.innerApiCalls.listServicePerimeters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServicePerimeters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServicePerimetersStream without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + ]; + client.descriptors.page.listServicePerimeters.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listServicePerimetersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.identity.accesscontextmanager.v1.ServicePerimeter[] = []; + stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.ServicePerimeter) => { + 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.listServicePerimeters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServicePerimeters, request)); + assert( + (client.descriptors.page.listServicePerimeters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listServicePerimetersStream with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServicePerimeters.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listServicePerimetersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.identity.accesscontextmanager.v1.ServicePerimeter[] = []; + stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.ServicePerimeter) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listServicePerimeters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServicePerimeters, request)); + assert( + (client.descriptors.page.listServicePerimeters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServicePerimeters without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), + ]; + client.descriptors.page.listServicePerimeters.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.identity.accesscontextmanager.v1.IServicePerimeter[] = []; + const iterable = client.listServicePerimetersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listServicePerimeters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServicePerimeters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServicePerimeters with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServicePerimeters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServicePerimetersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.identity.accesscontextmanager.v1.IServicePerimeter[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listServicePerimeters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServicePerimeters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listGcpUserAccessBindings', () => { + it('invokes listGcpUserAccessBindings without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + ]; + client.innerApiCalls.listGcpUserAccessBindings = stubSimpleCall(expectedResponse); + const [response] = await client.listGcpUserAccessBindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGcpUserAccessBindings without error using callback', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + ]; + client.innerApiCalls.listGcpUserAccessBindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGcpUserAccessBindings( + request, + (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGcpUserAccessBindings with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listGcpUserAccessBindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listGcpUserAccessBindings(request), expectedError); + const actualRequest = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGcpUserAccessBindingsStream without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + ]; + client.descriptors.page.listGcpUserAccessBindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listGcpUserAccessBindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding[] = []; + stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding) => { + 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.listGcpUserAccessBindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listGcpUserAccessBindings, request)); + assert( + (client.descriptors.page.listGcpUserAccessBindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listGcpUserAccessBindingsStream with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGcpUserAccessBindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listGcpUserAccessBindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding[] = []; + stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listGcpUserAccessBindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listGcpUserAccessBindings, request)); + assert( + (client.descriptors.page.listGcpUserAccessBindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listGcpUserAccessBindings without error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), + ]; + client.descriptors.page.listGcpUserAccessBindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding[] = []; + const iterable = client.listGcpUserAccessBindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listGcpUserAccessBindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listGcpUserAccessBindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listGcpUserAccessBindings with error', async () => { + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGcpUserAccessBindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listGcpUserAccessBindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listGcpUserAccessBindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listGcpUserAccessBindings.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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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('accessLevel', () => { + const fakePath = "/rendered/path/accessLevel"; + const expectedParameters = { + access_policy: "accessPolicyValue", + access_level: "accessLevelValue", + }; + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.accessLevelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.accessLevelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('accessLevelPath', () => { + const result = client.accessLevelPath("accessPolicyValue", "accessLevelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.accessLevelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccessPolicyFromAccessLevelName', () => { + const result = client.matchAccessPolicyFromAccessLevelName(fakePath); + assert.strictEqual(result, "accessPolicyValue"); + assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAccessLevelFromAccessLevelName', () => { + const result = client.matchAccessLevelFromAccessLevelName(fakePath); + assert.strictEqual(result, "accessLevelValue"); + assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('accessPolicy', () => { + const fakePath = "/rendered/path/accessPolicy"; + const expectedParameters = { + access_policy: "accessPolicyValue", + }; + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.accessPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.accessPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('accessPolicyPath', () => { + const result = client.accessPolicyPath("accessPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.accessPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccessPolicyFromAccessPolicyName', () => { + const result = client.matchAccessPolicyFromAccessPolicyName(fakePath); + assert.strictEqual(result, "accessPolicyValue"); + assert((client.pathTemplates.accessPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('gcpUserAccessBinding', () => { + const fakePath = "/rendered/path/gcpUserAccessBinding"; + const expectedParameters = { + organization: "organizationValue", + gcp_user_access_binding: "gcpUserAccessBindingValue", + }; + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.gcpUserAccessBindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.gcpUserAccessBindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('gcpUserAccessBindingPath', () => { + const result = client.gcpUserAccessBindingPath("organizationValue", "gcpUserAccessBindingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.gcpUserAccessBindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromGcpUserAccessBindingName', () => { + const result = client.matchOrganizationFromGcpUserAccessBindingName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.gcpUserAccessBindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchGcpUserAccessBindingFromGcpUserAccessBindingName', () => { + const result = client.matchGcpUserAccessBindingFromGcpUserAccessBindingName(fakePath); + assert.strictEqual(result, "gcpUserAccessBindingValue"); + assert((client.pathTemplates.gcpUserAccessBindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organization', () => { + const fakePath = "/rendered/path/organization"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + 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('servicePerimeter', () => { + const fakePath = "/rendered/path/servicePerimeter"; + const expectedParameters = { + access_policy: "accessPolicyValue", + service_perimeter: "servicePerimeterValue", + }; + const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePerimeterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePerimeterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePerimeterPath', () => { + const result = client.servicePerimeterPath("accessPolicyValue", "servicePerimeterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePerimeterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccessPolicyFromServicePerimeterName', () => { + const result = client.matchAccessPolicyFromServicePerimeterName(fakePath); + assert.strictEqual(result, "accessPolicyValue"); + assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServicePerimeterFromServicePerimeterName', () => { + const result = client.matchServicePerimeterFromServicePerimeterName(fakePath); + assert.strictEqual(result, "servicePerimeterValue"); + assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/tsconfig.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/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-identity-accesscontextmanager/v1/webpack.config.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/webpack.config.js new file mode 100644 index 00000000000..086c0168554 --- /dev/null +++ b/owl-bot-staging/google-identity-accesscontextmanager/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: 'AccessContextManager', + filename: './access-context-manager.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-maps-addressvalidation/v1/.eslintignore b/owl-bot-staging/google-maps-addressvalidation/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/.eslintrc.json b/owl-bot-staging/google-maps-addressvalidation/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/.gitignore b/owl-bot-staging/google-maps-addressvalidation/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/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-maps-addressvalidation/v1/.jsdoc.js b/owl-bot-staging/google-maps-addressvalidation/v1/.jsdoc.js new file mode 100644 index 00000000000..8678e46b46a --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/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: '@googlemaps/addressvalidation', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/.mocharc.js b/owl-bot-staging/google-maps-addressvalidation/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/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-maps-addressvalidation/v1/.prettierrc.js b/owl-bot-staging/google-maps-addressvalidation/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/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-maps-addressvalidation/v1/README.md b/owl-bot-staging/google-maps-addressvalidation/v1/README.md new file mode 100644 index 00000000000..cc068e17230 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/README.md @@ -0,0 +1 @@ +Addressvalidation: Nodejs Client diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/package.json b/owl-bot-staging/google-maps-addressvalidation/v1/package.json new file mode 100644 index 00000000000..f1350e5ac08 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@googlemaps/addressvalidation", + "version": "0.1.0", + "description": "Addressvalidation client for Node.js", + "repository": "googleapis/nodejs-addressvalidation", + "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 addressvalidation", + "addressvalidation", + "address validation" + ], + "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-maps-addressvalidation/v1/protos/google/geo/type/viewport.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/geo/type/viewport.proto new file mode 100644 index 00000000000..ad5029f8360 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/geo/type/viewport.proto @@ -0,0 +1,69 @@ +// 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.geo.type; + +import "google/type/latlng.proto"; + +option go_package = "google.golang.org/genproto/googleapis/geo/type/viewport;viewport"; +option java_multiple_files = true; +option java_outer_classname = "ViewportProto"; +option java_package = "com.google.geo.type"; +option objc_class_prefix = "GGTP"; + +// A latitude-longitude viewport, represented as two diagonally opposite `low` +// and `high` points. A viewport is considered a closed region, i.e. it includes +// its boundary. The latitude bounds must range between -90 to 90 degrees +// inclusive, and the longitude bounds must range between -180 to 180 degrees +// inclusive. Various cases include: +// +// - If `low` = `high`, the viewport consists of that single point. +// +// - If `low.longitude` > `high.longitude`, the longitude range is inverted +// (the viewport crosses the 180 degree longitude line). +// +// - If `low.longitude` = -180 degrees and `high.longitude` = 180 degrees, +// the viewport includes all longitudes. +// +// - If `low.longitude` = 180 degrees and `high.longitude` = -180 degrees, +// the longitude range is empty. +// +// - If `low.latitude` > `high.latitude`, the latitude range is empty. +// +// Both `low` and `high` must be populated, and the represented box cannot be +// empty (as specified by the definitions above). An empty viewport will result +// in an error. +// +// For example, this viewport fully encloses New York City: +// +// { +// "low": { +// "latitude": 40.477398, +// "longitude": -74.259087 +// }, +// "high": { +// "latitude": 40.91618, +// "longitude": -73.70018 +// } +// } +message Viewport { + // Required. The low point of the viewport. + google.type.LatLng low = 1; + + // Required. The high point of the viewport. + google.type.LatLng high = 2; +} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address.proto new file mode 100644 index 00000000000..c24a3bf9618 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address.proto @@ -0,0 +1,147 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.addressvalidation.v1; + +import "google/api/field_behavior.proto"; +import "google/type/postal_address.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.AddressValidation.V1"; +option go_package = "cloud.google.com/go/maps/addressvalidation/apiv1/addressvalidationpb;addressvalidationpb"; +option java_multiple_files = true; +option java_outer_classname = "AddressProto"; +option java_package = "com.google.maps.addressvalidation.v1"; +option objc_class_prefix = "GMPAVV1"; +option php_namespace = "Google\\Maps\\AddressValidation\\V1"; +option ruby_package = "Google::Maps::AddressValidation::V1"; + +// Details of the post-processed address. Post-processing includes +// correcting misspelled parts of the address, replacing incorrect parts, and +// inferring missing parts. +message Address { + // The post-processed address, formatted as a single-line address following + // the address formatting rules of the region where the address is located. + string formatted_address = 2; + + // The post-processed address represented as a postal address. + google.type.PostalAddress postal_address = 3; + + // Unordered list. The individual address components of the formatted and + // corrected address, along with validation information. This provides + // information on the validation status of the individual components. + // + // Address components are not ordered in a particular way. Do not make any + // assumptions on the ordering of the address components in the list. + repeated AddressComponent address_components = 4 + [(google.api.field_behavior) = UNORDERED_LIST]; + + // The types of components that were expected to be present in a correctly + // formatted mailing address but were not found in the input AND could + // not be inferred. Components of this type are not present in + // `formatted_address`, `postal_address`, or `address_components`. An + // example might be `['street_number', 'route']` for an input like + // "Boulder, Colorado, 80301, USA". The list of possible types can be found + // [here](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). + repeated string missing_component_types = 5; + + // The types of the components that are present in the `address_components` + // but could not be confirmed to be correct. This field is provided for the + // sake of convenience: its contents are equivalent to iterating through the + // `address_components` to find the types of all the components where the + // [confirmation_level][google.maps.addressvalidation.v1.AddressComponent.confirmation_level] + // is not + // [CONFIRMED][google.maps.addressvalidation.v1.AddressComponent.ConfirmationLevel.CONFIRMED] + // or the + // [inferred][google.maps.addressvalidation.v1.AddressComponent.inferred] + // flag is not set to `true`. The list of possible types can be found + // [here](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). + repeated string unconfirmed_component_types = 6; + + // Any tokens in the input that could not be resolved. This might be an + // input that was not recognized as a valid part of an address (for example + // in an input like "123235253253 Main St, San Francisco, CA, 94105", the + // unresolved tokens may look like `["123235253253"]` since that does not + // look like a valid street number. + repeated string unresolved_tokens = 7; +} + +// Represents an address component, such as a street, city, or state. +message AddressComponent { + // The different possible values for confirmation levels. + enum ConfirmationLevel { + // Default value. This value is unused. + CONFIRMATION_LEVEL_UNSPECIFIED = 0; + + // We were able to verify that this component exists and makes sense in the + // context of the rest of the address. + CONFIRMED = 1; + + // This component could not be confirmed, but it is plausible that it + // exists. For example, a street number within a known valid range of + // numbers on a street where specific house numbers are not known. + UNCONFIRMED_BUT_PLAUSIBLE = 2; + + // This component was not confirmed and is likely to be wrong. For + // example, a neighborhood that does not fit the rest of the address. + UNCONFIRMED_AND_SUSPICIOUS = 3; + } + + // The name for this component. + ComponentName component_name = 1; + + // The type of the address component. See + // [Table 2: Additional types returned by the Places + // service](https://developers.google.com/places/web-service/supported_types#table2) + // for a list of possible types. + string component_type = 2; + + // Indicates the level of certainty that we have that the component + // is correct. + ConfirmationLevel confirmation_level = 3; + + // Indicates that the component was not part of the input, but we + // inferred it for the address location and believe it should be provided + // for a complete address. + bool inferred = 4; + + // Indicates the spelling of the component name was corrected in a minor way, + // for example by switching two characters that appeared in the wrong order. + // This indicates a cosmetic change. + bool spell_corrected = 5; + + // Indicates the name of the component was replaced with a completely + // different one, for example a wrong postal code being replaced with one that + // is correct for the address. This is not a cosmetic change, the input + // component has been changed to a different one. + bool replaced = 6; + + // Indicates an address component that is not expected to be present in a + // postal address for the given region. We have retained it only because it + // was part of the input. + bool unexpected = 7; +} + +// A wrapper for the name of the component. +message ComponentName { + // The name text. For example, "5th Avenue" for a street name or "1253" for a + // street number. + string text = 1; + + // The BCP-47 language code. This will not be present if the component name is + // not associated with a language, such as a street number. + string language_code = 2; +} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address_validation_service.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address_validation_service.proto new file mode 100644 index 00000000000..ff19440eede --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address_validation_service.proto @@ -0,0 +1,278 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.addressvalidation.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/maps/addressvalidation/v1/address.proto"; +import "google/maps/addressvalidation/v1/geocode.proto"; +import "google/maps/addressvalidation/v1/metadata.proto"; +import "google/maps/addressvalidation/v1/usps_data.proto"; +import "google/type/postal_address.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.AddressValidation.V1"; +option go_package = "cloud.google.com/go/maps/addressvalidation/apiv1/addressvalidationpb;addressvalidationpb"; +option java_multiple_files = true; +option java_outer_classname = "AddressValidationServiceProto"; +option java_package = "com.google.maps.addressvalidation.v1"; +option objc_class_prefix = "GMPAVV1"; +option php_namespace = "Google\\Maps\\AddressValidation\\V1"; +option ruby_package = "Google::Maps::AddressValidation::V1"; + +// The service for validating addresses. +service AddressValidation { + option (google.api.default_host) = "addressvalidation.googleapis.com"; + + // Validates an address. + rpc ValidateAddress(ValidateAddressRequest) + returns (ValidateAddressResponse) { + option (google.api.http) = { + post: "/v1:validateAddress" + body: "*" + }; + } + + // Feedback about the outcome of the sequence of validation attempts. This + // should be the last call made after a sequence of validation calls for the + // same address, and should be called once the transaction is concluded. This + // should only be sent once for the sequence of `ValidateAddress` requests + // needed to validate an address fully. + rpc ProvideValidationFeedback(ProvideValidationFeedbackRequest) + returns (ProvideValidationFeedbackResponse) { + option (google.api.http) = { + post: "/v1:provideValidationFeedback" + body: "*" + }; + } +} + +// The request for validating an address. +message ValidateAddressRequest { + // Required. The address being validated. Unformatted addresses should be + // submitted via [`address_lines`][google.type.PostalAddress.address_lines]. + // + // The total length of the fields in this input must not exceed 280 + // characters. + // + // Supported regions can be found in the + // [FAQ](https://developers.google.com/maps/documentation/address-validation/faq#which_regions_are_currently_supported). + // + // The [language_code][google.type.PostalAddress.language_code] value in the + // input address is reserved for future uses and is ignored today. The + // validated address result will be populated based on the preferred language + // for the given address, as identified by the system. + // + // The Address Validation API ignores the values in + // [recipients][google.type.PostalAddress.recipients] and + // [organization][google.type.PostalAddress.organization]. Any values in those + // fields will be discarded and not returned. Please do not set them. + google.type.PostalAddress address = 1 + [(google.api.field_behavior) = REQUIRED]; + + // This field must be empty for the first address validation request. If + // more requests are necessary to fully validate a single address (for + // example if the changes the user makes after the initial validation need to + // be re-validated), then each followup request must populate this field with + // the + // [response_id][google.maps.addressvalidation.v1.ValidateAddressResponse.response_id] + // from the very first response in the validation sequence. + string previous_response_id = 2; + + // Enables USPS CASS compatible mode. This affects _only_ the + // [google.maps.addressvalidation.v1.ValidationResult.usps_data] field of + // [google.maps.addressvalidation.v1.ValidationResult]. Note: for USPS CASS + // enabled requests for addresses in Puerto Rico, a + // [google.type.PostalAddress.region_code] of the `address` must be provided + // as "PR", or an [google.type.PostalAddress.administrative_area] of the + // `address` must be provided as "Puerto Rico" (case-insensitive) or "PR". + // + // It's recommended to use a componentized `address`, or alternatively specify + // at least two [google.type.PostalAddress.address_lines] where the first line + // contains the street number and name and the second line contains the city, + // state, and zip code. + bool enable_usps_cass = 3; +} + +// The response to an address validation request. +message ValidateAddressResponse { + // The result of the address validation. + ValidationResult result = 1; + + // The UUID that identifies this response. If the address needs to be + // re-validated, this UUID *must* accompany the new request. + string response_id = 2; +} + +// The request for sending validation feedback. +message ProvideValidationFeedbackRequest { + // The possible final outcomes of the sequence of address validation requests + // needed to validate an address. + enum ValidationConclusion { + // This value is unused. + // If the `ProvideValidationFeedbackRequest.conclusion` field is set to + // `VALIDATION_CONCLUSION_UNSPECIFIED`, an `INVALID_ARGUMENT` error will be + // returned. + VALIDATION_CONCLUSION_UNSPECIFIED = 0; + + // The version of the address returned by the Address Validation API was + // used for the transaction. + VALIDATED_VERSION_USED = 1; + + // The version of the address provided by the user was used for the + // transaction + USER_VERSION_USED = 2; + + // A version of the address that was entered after the last validation + // attempt but that was not re-validated was used for the transaction. + UNVALIDATED_VERSION_USED = 3; + + // The transaction was abandoned and the address was not used. + UNUSED = 4; + } + + // Required. The outcome of the sequence of validation attempts. + // + // If this field is set to `VALIDATION_CONCLUSION_UNSPECIFIED`, an + // `INVALID_ARGUMENT` error will be returned. + ValidationConclusion conclusion = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the response that this feedback is for. This should be + // the + // [response_id][google.maps.addressvalidation.v1.ValidateAddressRequest.response_id] + // from the first response in a series of address validation attempts. + string response_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The response for validation feedback. +// +// The response is empty if the feedback is sent successfully. +message ProvideValidationFeedbackResponse {} + +// The result of validating an address. +message ValidationResult { + // Overall verdict flags + Verdict verdict = 1; + + // Information about the address itself as opposed to the geocode. + Address address = 2; + + // Information about the location and place that the address geocoded to. + Geocode geocode = 3; + + // Other information relevant to deliverability. `metadata` is not guaranteed + // to be fully populated for every address sent to the Address Validation API. + AddressMetadata metadata = 4; + + // Extra deliverability flags provided by USPS. Only provided in region `US` + // and `PR`. + UspsData usps_data = 5; +} + +// High level overview of the address validation result and geocode. +message Verdict { + // The various granularities that an address or a geocode can have. + // When used to indicate granularity for an *address*, these values indicate + // with how fine a granularity the address identifies a mailing destination. + // For example, an address such as "123 Main Street, Redwood City, CA, 94061" + // identifies a `PREMISE` while something like "Redwood City, CA, 94061" + // identifies a `LOCALITY`. However, if we are unable to find a geocode for + // "123 Main Street" in Redwood City, the geocode returned might be of + // `LOCALITY` granularity even though the address is more granular. + enum Granularity { + // Default value. This value is unused. + GRANULARITY_UNSPECIFIED = 0; + + // Below-building level result, such as an apartment. + SUB_PREMISE = 1; + + // Building-level result. + PREMISE = 2; + + // A geocode that should be very close to the building-level location of + // the address. + PREMISE_PROXIMITY = 3; + + // The address or geocode indicates a block. Only used in regions which + // have block-level addressing, such as Japan. + BLOCK = 4; + + // The geocode or address is granular to route, such as a street, road, or + // highway. + ROUTE = 5; + + // All other granularities, which are bucketed together since they are not + // deliverable. + OTHER = 6; + } + + // The granularity of the **input** address. This is the result of parsing the + // input address and does not give any validation signals. For validation + // signals, refer to `validation_granularity` below. + // + // For example, if the input address includes a specific apartment number, + // then the `input_granularity` here will be `SUB_PREMISE`. If we cannot match + // the apartment number in the databases or the apartment number is invalid, + // the `validation_granularity` will likely be `PREMISE` or below. + Granularity input_granularity = 1; + + // The granularity level that the API can fully **validate** the address to. + // For example, an `validation_granularity` of `PREMISE` indicates all address + // components at the level of `PREMISE` or more coarse can be validated. + // + // Per address component validation result can be found in + // [google.maps.addressvalidation.v1.Address.address_components]. + Granularity validation_granularity = 2; + + // Information about the granularity of the + // [`geocode`][google.maps.addressvalidation.v1.ValidationResult.geocode]. + // This can be understood as the semantic meaning of how coarse or fine the + // geocoded location is. + // + // This can differ from the `validation_granularity` above occasionally. For + // example, our database might record the existence of an apartment number but + // do not have a precise location for the apartment within a big apartment + // complex. In that case, the `validation_granularity` will be `SUB_PREMISE` + // but the `geocode_granularity` will be `PREMISE`. + Granularity geocode_granularity = 3; + + // The address is considered complete if there are no unresolved tokens, no + // unexpected or missing address components. See + // [`missing_component_types`][google.maps.addressvalidation.v1.Address.missing_component_types], + // [`unresolved_tokens`][google.maps.addressvalidation.v1.Address.unresolved_tokens] + // or + // [`unexpected`][google.maps.addressvalidation.v1.AddressComponent.unexpected] + // fields for more details. + bool address_complete = 4; + + // At least one address component cannot be categorized or validated, see + // [google.maps.addressvalidation.v1.Address.address_components] for + // details. + bool has_unconfirmed_components = 5; + + // At least one address component was inferred (added) that wasn't in the + // input, see + // [google.maps.addressvalidation.v1.Address.address_components] for + // details. + bool has_inferred_components = 6; + + // At least one address component was replaced, see + // [google.maps.addressvalidation.v1.Address.address_components] for + // details. + bool has_replaced_components = 7; +} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/geocode.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/geocode.proto new file mode 100644 index 00000000000..2caa88a4cd5 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/geocode.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.maps.addressvalidation.v1; + +import "google/geo/type/viewport.proto"; +import "google/type/latlng.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.AddressValidation.V1"; +option go_package = "cloud.google.com/go/maps/addressvalidation/apiv1/addressvalidationpb;addressvalidationpb"; +option java_multiple_files = true; +option java_outer_classname = "GeocodeProto"; +option java_package = "com.google.maps.addressvalidation.v1"; +option objc_class_prefix = "GMPAVV1"; +option php_namespace = "Google\\Maps\\AddressValidation\\V1"; +option ruby_package = "Google::Maps::AddressValidation::V1"; + +// Contains information about the place the input was geocoded to. +message Geocode { + // The geocoded location of the input. + // + // Using place IDs is preferred over using addresses, + // latitude/longitude coordinates, or plus codes. Using coordinates when + // routing or calculating driving directions will always result in the point + // being snapped to the road nearest to those coordinates. This may not be a + // road that will quickly or safely lead to the destination and may not be + // near an access point to the property. Additionally, when a location is + // reverse geocoded, there is no guarantee that the returned address will + // match the original. + google.type.LatLng location = 1; + + // The plus code corresponding to the `location`. + PlusCode plus_code = 2; + + // The bounds of the geocoded place. + google.geo.type.Viewport bounds = 4; + + // The size of the geocoded place, in meters. This is another measure of the + // coarseness of the geocoded location, but in physical size rather than in + // semantic meaning. + float feature_size_meters = 5; + + // The PlaceID of the place this input geocodes to. + // + // For more information about Place IDs see + // [here](https://developers.google.com/maps/documentation/places/web-service/place-id). + string place_id = 6; + + // The type(s) of place that the input geocoded to. For example, + // `['locality', 'political']`. The full list of types can be found + // [here](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). + repeated string place_types = 7; +} + +// Plus code (http://plus.codes) is a location reference with two formats: +// global code defining a 14mx14m (1/8000th of a degree) or smaller rectangle, +// and compound code, replacing the prefix with a reference location. +message PlusCode { + // Place's global (full) code, such as "9FWM33GV+HQ", representing an + // 1/8000 by 1/8000 degree area (~14 by 14 meters). + string global_code = 1; + + // Place's compound code, such as "33GV+HQ, Ramberg, Norway", containing + // the suffix of the global code and replacing the prefix with a formatted + // name of a reference entity. + string compound_code = 2; +} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/metadata.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/metadata.proto new file mode 100644 index 00000000000..b65b4984127 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/metadata.proto @@ -0,0 +1,43 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.addressvalidation.v1; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.AddressValidation.V1"; +option go_package = "cloud.google.com/go/maps/addressvalidation/apiv1/addressvalidationpb;addressvalidationpb"; +option java_multiple_files = true; +option java_outer_classname = "MetadataProto"; +option java_package = "com.google.maps.addressvalidation.v1"; +option objc_class_prefix = "GMPAVV1"; +option php_namespace = "Google\\Maps\\AddressValidation\\V1"; +option ruby_package = "Google::Maps::AddressValidation::V1"; + +// The metadata for the address. `metadata` is not guaranteed to be fully +// populated for every address sent to the Address Validation API. +message AddressMetadata { + // Indicates that this is the address of a business. + // If unset, indicates that the value is unknown. + optional bool business = 2; + + // Indicates that the address of a PO box. + // If unset, indicates that the value is unknown. + optional bool po_box = 3; + + // Indicates that this is the address of a residence. + // If unset, indicates that the value is unknown. + optional bool residential = 6; +} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/usps_data.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/usps_data.proto new file mode 100644 index 00000000000..c1680a12779 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/usps_data.proto @@ -0,0 +1,221 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.addressvalidation.v1; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.AddressValidation.V1"; +option go_package = "cloud.google.com/go/maps/addressvalidation/apiv1/addressvalidationpb;addressvalidationpb"; +option java_multiple_files = true; +option java_outer_classname = "UspsDataProto"; +option java_package = "com.google.maps.addressvalidation.v1"; +option objc_class_prefix = "GMPAVV1"; +option php_namespace = "Google\\Maps\\AddressValidation\\V1"; +option ruby_package = "Google::Maps::AddressValidation::V1"; + +// USPS representation of a US address. +message UspsAddress { + // First address line. + string first_address_line = 1; + + // Firm name. + string firm = 2; + + // Second address line. + string second_address_line = 3; + + // Puerto Rican urbanization name. + string urbanization = 4; + + // City + state + postal code. + string city_state_zip_address_line = 5; + + // City name. + string city = 6; + + // 2 letter state code. + string state = 7; + + // Postal code e.g. 10009. + string zip_code = 8; + + // 4-digit postal code extension e.g. 5023. + string zip_code_extension = 9; +} + +// The USPS data for the address. `uspsData` is not guaranteed to be fully +// populated for every US or PR address sent to the Address Validation API. It's +// recommended to integrate the backup address fields in the response if you +// utilize uspsData as the primary part of the response. +message UspsData { + // USPS standardized address. + UspsAddress standardized_address = 1; + + // 2 digit delivery point code + string delivery_point_code = 2; + + // The delivery point check digit. This number is added to the end of the + // delivery_point_barcode for mechanically scanned mail. Adding all the + // digits of the delivery_point_barcode, delivery_point_check_digit, postal + // code, and ZIP+4 together should yield a number divisible by 10. + string delivery_point_check_digit = 3; + + // The possible values for DPV confirmation. Returns a single character. + // + // * `Y`: Address was DPV confirmed for primary and any secondary numbers. + // * `N`: Primary and any secondary number information failed to + // DPV confirm. + // * `S`: Address was DPV confirmed for the primary number only, and the + // secondary number information was present by not confirmed. + // * `D`: Address was DPV confirmed for the primary number only, and the + // secondary number information was missing. + string dpv_confirmation = 4; + + // The footnotes from delivery point validation. + // Multiple footnotes may be strung together in the same string. + // + // * `AA`: Input address matched to the ZIP+4 file + // * `A1`: Input address was not matched to the ZIP+4 file + // * `BB`: Matched to DPV (all components) + // * `CC`: Secondary number not matched (present but invalid) + // * `N1`: High-rise address missing secondary number + // * `M1`: Primary number missing + // * `M3`: Primary number invalid + // * `P1`: Input address RR or HC box number missing + // * `P3`: Input address PO, RR, or HC Box number invalid + // * `F1`: Input address matched to a military address + // * `G1`: Input address matched to a general delivery address + // * `U1`: Input address matched to a unique ZIP code + // * `PB`: Input address matched to PBSA record + // * `RR`: DPV confirmed address with PMB information + // * `R1`: DPV confirmed address without PMB information + // * `R7`: Carrier Route R777 or R779 record + string dpv_footnote = 5; + + // Indicates if the address is a CMRA (Commercial Mail Receiving Agency)--a + // private business receiving mail for clients. Returns a single character. + // + // * `Y`: The address is a CMRA + // * `N`: The address is not a CMRA + string dpv_cmra = 6; + + // Is this place vacant? + // Returns a single character. + // + // * `Y`: The address is vacant + // * `N`: The address is not vacant + string dpv_vacant = 7; + + // Is this a no stat address or an active address? + // No stat addresses are ones which are not continuously occupied or addresses + // that the USPS does not service. Returns a single character. + // + // * `Y`: The address is not active + // * `N`: The address is active + string dpv_no_stat = 8; + + // The carrier route code. + // A four character code consisting of a one letter prefix and a three digit + // route designator. + // + // Prefixes: + // + // * `C`: Carrier route (or city route) + // * `R`: Rural route + // * `H`: Highway Contract Route + // * `B`: Post Office Box Section + // * `G`: General delivery unit + string carrier_route = 9; + + // Carrier route rate sort indicator. + string carrier_route_indicator = 10; + + // The delivery address is matchable, but the EWS file indicates that an exact + // match will be available soon. + bool ews_no_match = 11; + + // Main post office city. + string post_office_city = 12; + + // Main post office state. + string post_office_state = 13; + + // Abbreviated city. + string abbreviated_city = 14; + + // FIPS county code. + string fips_county_code = 15; + + // County name. + string county = 16; + + // Enhanced Line of Travel (eLOT) number. + string elot_number = 17; + + // eLOT Ascending/Descending Flag (A/D). + string elot_flag = 18; + + // LACSLink return code. + string lacs_link_return_code = 19; + + // LACSLink indicator. + string lacs_link_indicator = 20; + + // PO Box only postal code. + bool po_box_only_postal_code = 21; + + // Footnotes from matching a street or highrise record to suite information. + // If business name match is found, the secondary number is returned. + // + // * `A`: SuiteLink record match, business address improved. + // * `00`: No match, business address is not improved. + string suitelink_footnote = 22; + + // PMB (Private Mail Box) unit designator. + string pmb_designator = 23; + + // PMB (Private Mail Box) number; + string pmb_number = 24; + + // Type of the address record that matches the input address. + // + // * `F`: FIRM. This is a match to a Firm Record, which is the finest level of + // match available for an address. + // * `G`: GENERAL DELIVERY. This is a match to a General Delivery record. + // * `H`: BUILDING / APARTMENT. This is a match to a Building or Apartment + // record. + // * `P`: POST OFFICE BOX. This is a match to a Post Office Box. + // * `R`: RURAL ROUTE or HIGHWAY CONTRACT: This is a match to either a Rural + // Route or a Highway Contract record, both of which may have associated Box + // Number ranges. + // * `S`: STREET RECORD: This is a match to a Street record containing a valid + // primary number range. + string address_record_type = 25; + + // Indicator that a default address was found, but more specific addresses + // exists. + bool default_address = 26; + + // Error message for USPS data retrieval. This is populated when USPS + // processing is suspended because of the detection of artificially created + // addresses. + // + // The USPS data fields might not be populated when this error is present. + string error_message = 27; + + // Indicator that the request has been CASS processed. + bool cass_processed = 28; +} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.provide_validation_feedback.js b/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.provide_validation_feedback.js new file mode 100644 index 00000000000..009afa431d0 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.provide_validation_feedback.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(conclusion, responseId) { + // [START addressvalidation_v1_generated_AddressValidation_ProvideValidationFeedback_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The outcome of the sequence of validation attempts. + * If this field is set to `VALIDATION_CONCLUSION_UNSPECIFIED`, an + * `INVALID_ARGUMENT` error will be returned. + */ + // const conclusion = {} + /** + * Required. The ID of the response that this feedback is for. This should be + * the + * response_id google.maps.addressvalidation.v1.ValidateAddressRequest.response_id + * from the first response in a series of address validation attempts. + */ + // const responseId = 'abc123' + + // Imports the Addressvalidation library + const {AddressValidationClient} = require('@googlemaps/addressvalidation').v1; + + // Instantiates a client + const addressvalidationClient = new AddressValidationClient(); + + async function callProvideValidationFeedback() { + // Construct request + const request = { + conclusion, + responseId, + }; + + // Run request + const response = await addressvalidationClient.provideValidationFeedback(request); + console.log(response); + } + + callProvideValidationFeedback(); + // [END addressvalidation_v1_generated_AddressValidation_ProvideValidationFeedback_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.validate_address.js b/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.validate_address.js new file mode 100644 index 00000000000..4fcef6fdc8b --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.validate_address.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(address) { + // [START addressvalidation_v1_generated_AddressValidation_ValidateAddress_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The address being validated. Unformatted addresses should be + * submitted via `address_lines` google.type.PostalAddress.address_lines. + * The total length of the fields in this input must not exceed 280 + * characters. + * Supported regions can be found in the + * FAQ (https://developers.google.com/maps/documentation/address-validation/faq#which_regions_are_currently_supported). + * The language_code google.type.PostalAddress.language_code value in the + * input address is reserved for future uses and is ignored today. The + * validated address result will be populated based on the preferred language + * for the given address, as identified by the system. + * The Address Validation API ignores the values in + * recipients google.type.PostalAddress.recipients and + * organization google.type.PostalAddress.organization. Any values in those + * fields will be discarded and not returned. Please do not set them. + */ + // const address = {} + /** + * This field must be empty for the first address validation request. If + * more requests are necessary to fully validate a single address (for + * example if the changes the user makes after the initial validation need to + * be re-validated), then each followup request must populate this field with + * the + * response_id google.maps.addressvalidation.v1.ValidateAddressResponse.response_id + * from the very first response in the validation sequence. + */ + // const previousResponseId = 'abc123' + /** + * Enables USPS CASS compatible mode. This affects _only_ the + * google.maps.addressvalidation.v1.ValidationResult.usps_data field of + * google.maps.addressvalidation.v1.ValidationResult. Note: for USPS CASS + * enabled requests for addresses in Puerto Rico, a + * google.type.PostalAddress.region_code of the `address` must be provided + * as "PR", or an google.type.PostalAddress.administrative_area of the + * `address` must be provided as "Puerto Rico" (case-insensitive) or "PR". + * It's recommended to use a componentized `address`, or alternatively specify + * at least two google.type.PostalAddress.address_lines where the first line + * contains the street number and name and the second line contains the city, + * state, and zip code. + */ + // const enableUspsCass = true + + // Imports the Addressvalidation library + const {AddressValidationClient} = require('@googlemaps/addressvalidation').v1; + + // Instantiates a client + const addressvalidationClient = new AddressValidationClient(); + + async function callValidateAddress() { + // Construct request + const request = { + address, + }; + + // Run request + const response = await addressvalidationClient.validateAddress(request); + console.log(response); + } + + callValidateAddress(); + // [END addressvalidation_v1_generated_AddressValidation_ValidateAddress_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/snippet_metadata_google.maps.addressvalidation.v1.json b/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/snippet_metadata_google.maps.addressvalidation.v1.json new file mode 100644 index 00000000000..12872e9d560 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/snippet_metadata_google.maps.addressvalidation.v1.json @@ -0,0 +1,107 @@ +{ + "clientLibrary": { + "name": "nodejs-addressvalidation", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.maps.addressvalidation.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "addressvalidation_v1_generated_AddressValidation_ValidateAddress_async", + "title": "AddressValidation validateAddress Sample", + "origin": "API_DEFINITION", + "description": " Validates an address.", + "canonical": true, + "file": "address_validation.validate_address.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 90, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ValidateAddress", + "fullName": "google.maps.addressvalidation.v1.AddressValidation.ValidateAddress", + "async": true, + "parameters": [ + { + "name": "address", + "type": ".google.type.PostalAddress" + }, + { + "name": "previous_response_id", + "type": "TYPE_STRING" + }, + { + "name": "enable_usps_cass", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.maps.addressvalidation.v1.ValidateAddressResponse", + "client": { + "shortName": "AddressValidationClient", + "fullName": "google.maps.addressvalidation.v1.AddressValidationClient" + }, + "method": { + "shortName": "ValidateAddress", + "fullName": "google.maps.addressvalidation.v1.AddressValidation.ValidateAddress", + "service": { + "shortName": "AddressValidation", + "fullName": "google.maps.addressvalidation.v1.AddressValidation" + } + } + } + }, + { + "regionTag": "addressvalidation_v1_generated_AddressValidation_ProvideValidationFeedback_async", + "title": "AddressValidation provideValidationFeedback Sample", + "origin": "API_DEFINITION", + "description": " Feedback about the outcome of the sequence of validation attempts. This should be the last call made after a sequence of validation calls for the same address, and should be called once the transaction is concluded. This should only be sent once for the sequence of `ValidateAddress` requests needed to validate an address fully.", + "canonical": true, + "file": "address_validation.provide_validation_feedback.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ProvideValidationFeedback", + "fullName": "google.maps.addressvalidation.v1.AddressValidation.ProvideValidationFeedback", + "async": true, + "parameters": [ + { + "name": "conclusion", + "type": ".google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest.ValidationConclusion" + }, + { + "name": "response_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.maps.addressvalidation.v1.ProvideValidationFeedbackResponse", + "client": { + "shortName": "AddressValidationClient", + "fullName": "google.maps.addressvalidation.v1.AddressValidationClient" + }, + "method": { + "shortName": "ProvideValidationFeedback", + "fullName": "google.maps.addressvalidation.v1.AddressValidation.ProvideValidationFeedback", + "service": { + "shortName": "AddressValidation", + "fullName": "google.maps.addressvalidation.v1.AddressValidation" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/index.ts b/owl-bot-staging/google-maps-addressvalidation/v1/src/index.ts new file mode 100644 index 00000000000..38af5ee576f --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/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 AddressValidationClient = v1.AddressValidationClient; +type AddressValidationClient = v1.AddressValidationClient; +export {v1, AddressValidationClient}; +export default {v1, AddressValidationClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client.ts b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client.ts new file mode 100644 index 00000000000..5797e0352fc --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client.ts @@ -0,0 +1,484 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/address_validation_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './address_validation_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The service for validating addresses. + * @class + * @memberof v1 + */ +export class AddressValidationClient { + 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}; + addressValidationStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AddressValidationClient. + * + * @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 AddressValidationClient({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 AddressValidationClient; + 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.maps.addressvalidation.v1.AddressValidation', 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.addressValidationStub) { + return this.addressValidationStub; + } + + // Put together the "service stub" for + // google.maps.addressvalidation.v1.AddressValidation. + this.addressValidationStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.maps.addressvalidation.v1.AddressValidation') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.maps.addressvalidation.v1.AddressValidation, + 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 addressValidationStubMethods = + ['validateAddress', 'provideValidationFeedback']; + for (const methodName of addressValidationStubMethods) { + const callPromise = this.addressValidationStub.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.addressValidationStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'addressvalidation.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 'addressvalidation.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 []; + } + + 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 -- + // ------------------- +/** + * Validates an address. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.type.PostalAddress} request.address + * Required. The address being validated. Unformatted addresses should be + * submitted via {@link protos.google.type.PostalAddress.address_lines|`address_lines`}. + * + * The total length of the fields in this input must not exceed 280 + * characters. + * + * Supported regions can be found in the + * [FAQ](https://developers.google.com/maps/documentation/address-validation/faq#which_regions_are_currently_supported). + * + * The {@link protos.google.type.PostalAddress.language_code|language_code} value in the + * input address is reserved for future uses and is ignored today. The + * validated address result will be populated based on the preferred language + * for the given address, as identified by the system. + * + * The Address Validation API ignores the values in + * {@link protos.google.type.PostalAddress.recipients|recipients} and + * {@link protos.google.type.PostalAddress.organization|organization}. Any values in those + * fields will be discarded and not returned. Please do not set them. + * @param {string} request.previousResponseId + * This field must be empty for the first address validation request. If + * more requests are necessary to fully validate a single address (for + * example if the changes the user makes after the initial validation need to + * be re-validated), then each followup request must populate this field with + * the + * {@link protos.google.maps.addressvalidation.v1.ValidateAddressResponse.response_id|response_id} + * from the very first response in the validation sequence. + * @param {boolean} request.enableUspsCass + * Enables USPS CASS compatible mode. This affects _only_ the + * [google.maps.addressvalidation.v1.ValidationResult.usps_data] field of + * [google.maps.addressvalidation.v1.ValidationResult]. Note: for USPS CASS + * enabled requests for addresses in Puerto Rico, a + * [google.type.PostalAddress.region_code] of the `address` must be provided + * as "PR", or an [google.type.PostalAddress.administrative_area] of the + * `address` must be provided as "Puerto Rico" (case-insensitive) or "PR". + * + * It's recommended to use a componentized `address`, or alternatively specify + * at least two [google.type.PostalAddress.address_lines] where the first line + * contains the street number and name and the second line contains the city, + * state, and zip code. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.maps.addressvalidation.v1.ValidateAddressResponse|ValidateAddressResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/address_validation.validate_address.js + * region_tag:addressvalidation_v1_generated_AddressValidation_ValidateAddress_async + */ + validateAddress( + request?: protos.google.maps.addressvalidation.v1.IValidateAddressRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.addressvalidation.v1.IValidateAddressResponse, + protos.google.maps.addressvalidation.v1.IValidateAddressRequest|undefined, {}|undefined + ]>; + validateAddress( + request: protos.google.maps.addressvalidation.v1.IValidateAddressRequest, + options: CallOptions, + callback: Callback< + protos.google.maps.addressvalidation.v1.IValidateAddressResponse, + protos.google.maps.addressvalidation.v1.IValidateAddressRequest|null|undefined, + {}|null|undefined>): void; + validateAddress( + request: protos.google.maps.addressvalidation.v1.IValidateAddressRequest, + callback: Callback< + protos.google.maps.addressvalidation.v1.IValidateAddressResponse, + protos.google.maps.addressvalidation.v1.IValidateAddressRequest|null|undefined, + {}|null|undefined>): void; + validateAddress( + request?: protos.google.maps.addressvalidation.v1.IValidateAddressRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.maps.addressvalidation.v1.IValidateAddressResponse, + protos.google.maps.addressvalidation.v1.IValidateAddressRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.maps.addressvalidation.v1.IValidateAddressResponse, + protos.google.maps.addressvalidation.v1.IValidateAddressRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.maps.addressvalidation.v1.IValidateAddressResponse, + protos.google.maps.addressvalidation.v1.IValidateAddressRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.validateAddress(request, options, callback); + } +/** + * Feedback about the outcome of the sequence of validation attempts. This + * should be the last call made after a sequence of validation calls for the + * same address, and should be called once the transaction is concluded. This + * should only be sent once for the sequence of `ValidateAddress` requests + * needed to validate an address fully. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest.ValidationConclusion} request.conclusion + * Required. The outcome of the sequence of validation attempts. + * + * If this field is set to `VALIDATION_CONCLUSION_UNSPECIFIED`, an + * `INVALID_ARGUMENT` error will be returned. + * @param {string} request.responseId + * Required. The ID of the response that this feedback is for. This should be + * the + * {@link protos.google.maps.addressvalidation.v1.ValidateAddressRequest.response_id|response_id} + * from the first response in a series of address validation attempts. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackResponse|ProvideValidationFeedbackResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/address_validation.provide_validation_feedback.js + * region_tag:addressvalidation_v1_generated_AddressValidation_ProvideValidationFeedback_async + */ + provideValidationFeedback( + request?: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|undefined, {}|undefined + ]>; + provideValidationFeedback( + request: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest, + options: CallOptions, + callback: Callback< + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|null|undefined, + {}|null|undefined>): void; + provideValidationFeedback( + request: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest, + callback: Callback< + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|null|undefined, + {}|null|undefined>): void; + provideValidationFeedback( + request?: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, + protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.provideValidationFeedback(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.addressValidationStub && !this._terminated) { + return this.addressValidationStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client_config.json b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client_config.json new file mode 100644 index 00000000000..c3dd03edb53 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client_config.json @@ -0,0 +1,48 @@ +{ + "interfaces": { + "google.maps.addressvalidation.v1.AddressValidation": { + "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": { + "ValidateAddress": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ProvideValidationFeedback": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_proto_list.json b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_proto_list.json new file mode 100644 index 00000000000..9ab3e6f65b3 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/geo/type/viewport.proto", + "../../protos/google/maps/addressvalidation/v1/address.proto", + "../../protos/google/maps/addressvalidation/v1/address_validation_service.proto", + "../../protos/google/maps/addressvalidation/v1/geocode.proto", + "../../protos/google/maps/addressvalidation/v1/metadata.proto", + "../../protos/google/maps/addressvalidation/v1/usps_data.proto" +] diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..211049fb088 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/gapic_metadata.json @@ -0,0 +1,43 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.maps.addressvalidation.v1", + "libraryPackage": "@googlemaps/addressvalidation", + "services": { + "AddressValidation": { + "clients": { + "grpc": { + "libraryClient": "AddressValidationClient", + "rpcs": { + "ValidateAddress": { + "methods": [ + "validateAddress" + ] + }, + "ProvideValidationFeedback": { + "methods": [ + "provideValidationFeedback" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AddressValidationClient", + "rpcs": { + "ValidateAddress": { + "methods": [ + "validateAddress" + ] + }, + "ProvideValidationFeedback": { + "methods": [ + "provideValidationFeedback" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/index.ts b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/index.ts new file mode 100644 index 00000000000..cef71fb5605 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/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 {AddressValidationClient} from './address_validation_client'; diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..0e1c650f399 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/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 addressvalidation = require('@googlemaps/addressvalidation'); + +function main() { + const addressValidationClient = new addressvalidation.AddressValidationClient(); +} + +main(); diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..9ec2e4c7144 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/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 {AddressValidationClient} from '@googlemaps/addressvalidation'; + +// check that the client class type name can be used +function doStuffWithAddressValidationClient(client: AddressValidationClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const addressValidationClient = new AddressValidationClient(); + doStuffWithAddressValidationClient(addressValidationClient); +} + +main(); diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/system-test/install.ts b/owl-bot-staging/google-maps-addressvalidation/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/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-maps-addressvalidation/v1/test/gapic_address_validation_v1.ts b/owl-bot-staging/google-maps-addressvalidation/v1/test/gapic_address_validation_v1.ts new file mode 100644 index 00000000000..a0da41bdf1f --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/v1/test/gapic_address_validation_v1.ts @@ -0,0 +1,300 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 addressvalidationModule 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.AddressValidationClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = addressvalidationModule.v1.AddressValidationClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = addressvalidationModule.v1.AddressValidationClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = addressvalidationModule.v1.AddressValidationClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new addressvalidationModule.v1.AddressValidationClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.addressValidationStub, undefined); + await client.initialize(); + assert(client.addressValidationStub); + }); + + it('has close method for the initialized client', done => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.addressValidationStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.addressValidationStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new addressvalidationModule.v1.AddressValidationClient({ + 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 addressvalidationModule.v1.AddressValidationClient({ + 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('validateAddress', () => { + it('invokes validateAddress without error', async () => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ValidateAddressRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ValidateAddressResponse() + ); + client.innerApiCalls.validateAddress = stubSimpleCall(expectedResponse); + const [response] = await client.validateAddress(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes validateAddress without error using callback', async () => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ValidateAddressRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ValidateAddressResponse() + ); + client.innerApiCalls.validateAddress = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.validateAddress( + request, + (err?: Error|null, result?: protos.google.maps.addressvalidation.v1.IValidateAddressResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes validateAddress with error', async () => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ValidateAddressRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.validateAddress = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.validateAddress(request), expectedError); + }); + + it('invokes validateAddress with closed client', async () => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ValidateAddressRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.validateAddress(request), expectedError); + }); + }); + + describe('provideValidationFeedback', () => { + it('invokes provideValidationFeedback without error', async () => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackResponse() + ); + client.innerApiCalls.provideValidationFeedback = stubSimpleCall(expectedResponse); + const [response] = await client.provideValidationFeedback(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes provideValidationFeedback without error using callback', async () => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackResponse() + ); + client.innerApiCalls.provideValidationFeedback = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.provideValidationFeedback( + request, + (err?: Error|null, result?: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes provideValidationFeedback with error', async () => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.provideValidationFeedback = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.provideValidationFeedback(request), expectedError); + }); + + it('invokes provideValidationFeedback with closed client', async () => { + const client = new addressvalidationModule.v1.AddressValidationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.provideValidationFeedback(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/tsconfig.json b/owl-bot-staging/google-maps-addressvalidation/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/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-maps-addressvalidation/v1/webpack.config.js b/owl-bot-staging/google-maps-addressvalidation/v1/webpack.config.js new file mode 100644 index 00000000000..2a83cc6ddae --- /dev/null +++ b/owl-bot-staging/google-maps-addressvalidation/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: 'AddressValidation', + filename: './address-validation.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-maps-mapsplatformdatasets/v1/.eslintignore b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintrc.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.gitignore b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1/.jsdoc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.jsdoc.js new file mode 100644 index 00000000000..24b47733dc9 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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: '@googlemaps/maps-platform-datasets', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.mocharc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1/.prettierrc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1/README.md b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/README.md new file mode 100644 index 00000000000..e0e26d17fff --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/README.md @@ -0,0 +1 @@ +Mapsplatformdatasets: Nodejs Client diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/package.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/package.json new file mode 100644 index 00000000000..407201353ba --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@googlemaps/maps-platform-datasets", + "version": "0.1.0", + "description": "Mapsplatformdatasets client for Node.js", + "repository": "googleapis/nodejs-mapsplatformdatasets", + "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 mapsplatformdatasets", + "mapsplatformdatasets", + "maps platform datasets" + ], + "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-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/data_source.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/data_source.proto new file mode 100644 index 00000000000..fc92a0c83a0 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/data_source.proto @@ -0,0 +1,59 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.mapsplatformdatasets.v1; + +option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1"; +option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1/mapsplatformdatasetspb;mapsplatformdatasetspb"; +option java_multiple_files = true; +option java_outer_classname = "DataSourceProto"; +option java_package = "com.google.maps.mapsplatformdatasets.v1"; +option objc_class_prefix = "MDV1"; +option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1"; + +// The details about the data source when it is a local file. +message LocalFileSource { + // The file name of the uploaded file. + string filename = 1; + + // The format of the file that is being uploaded. + FileFormat file_format = 2; +} + +// The details about the data source when it is in Google Cloud Storage. +message GcsSource { + // Source data URI. For example, `gs://my_bucket/my_object`. + string input_uri = 1; + + // The file format of the Google Cloud Storage object. This is used mainly for + // validation. + FileFormat file_format = 2; +} + +// The format of the file being uploaded. +enum FileFormat { + // Unspecified file format. + FILE_FORMAT_UNSPECIFIED = 0; + + // GeoJson file. + FILE_FORMAT_GEOJSON = 1; + + // KML file. + FILE_FORMAT_KML = 2; + + // CSV file. + FILE_FORMAT_CSV = 3; +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/dataset.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/dataset.proto new file mode 100644 index 00000000000..0c9bda17822 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/dataset.proto @@ -0,0 +1,146 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.mapsplatformdatasets.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/maps/mapsplatformdatasets/v1/data_source.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1"; +option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1/mapsplatformdatasetspb;mapsplatformdatasetspb"; +option java_multiple_files = true; +option java_outer_classname = "DatasetProto"; +option java_package = "com.google.maps.mapsplatformdatasets.v1"; +option objc_class_prefix = "MDV1"; +option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1"; + +// A representation of a Maps Dataset resource. +message Dataset { + option (google.api.resource) = { + type: "mapsplatformdatasets.googleapis.com/Dataset" + pattern: "projects/{project}/datasets/{dataset}" + }; + + // Resource name, + // projects/{project}/datasets/{dataset_id} + string name = 1; + + // Human readable name, shown in the console UI . + string display_name = 2; + + // A description of this dataset . + string description = 3; + + // The version ID of the dataset. + string version_id = 4; + + // Specified use case for this dataset. + repeated Usage usage = 5; + + // Details about the source of the data for the dataset. + oneof data_source { + // A local file source for the dataset for a single upload. + LocalFileSource local_file_source = 6; + + // A Google Cloud Storage file source for the dataset for a single upload. + GcsSource gcs_source = 7; + } + + // Output only. The status of this dataset version. + Status status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when the dataset was first created. + google.protobuf.Timestamp create_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when the dataset metadata was last updated. + google.protobuf.Timestamp update_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when the data was uploaded. + google.protobuf.Timestamp version_create_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The description for this version of dataset. It is provided + // when importing data to the dataset. + string version_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Status of the dataset. +message Status { + // A list of states for the dataset. + enum State { + // The state of this dataset is not set. + STATE_UNSPECIFIED = 0; + + // Data is being imported to a dataset. + STATE_IMPORTING = 1; + + // Importing data to a dataset succeeded. + STATE_IMPORT_SUCCEEDED = 2; + + // Importing data to a dataset failed. + STATE_IMPORT_FAILED = 3; + + // The dataset is in the process of getting deleted. + STATE_DELETING = 4; + + // The deletion failed state. This state represents that dataset deletion + // has failed. Deletion may be retried. + STATE_DELETION_FAILED = 5; + + // Data is being processed. + STATE_PROCESSING = 6; + + // The processing failed state. This state represents that processing has + // failed and may report errors. + STATE_PROCESSING_FAILED = 7; + + // This state is currently not used. + STATE_NEEDS_REVIEW = 8; + + // The publishing state. This state represents the publishing is in + // progress. + STATE_PUBLISHING = 9; + + // The publishing failed states. This state represents that the + // publishing failed. Publishing may be retried. + STATE_PUBLISHING_FAILED = 10; + + // The completed state. This state represents the dataset being + // available for its specific usage. + STATE_COMPLETED = 11; + } + + // State enum for status. + State state = 1; + + // Error message indicating reason of failure. It is empty if the datasets is + // not in a failed state. + string error_message = 2; +} + +// Usage specifies where the data is intended to be used to inform how to +// process the data. +enum Usage { + // The usage of this dataset is not set. + USAGE_UNSPECIFIED = 0; + + // This dataset will be used for data driven styling. + USAGE_DATA_DRIVEN_STYLING = 1; +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto new file mode 100644 index 00000000000..4202decb0c2 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto @@ -0,0 +1,111 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.mapsplatformdatasets.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/maps/mapsplatformdatasets/v1/data_source.proto"; +import "google/maps/mapsplatformdatasets/v1/dataset.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1"; +option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1/mapsplatformdatasetspb;mapsplatformdatasetspb"; +option java_multiple_files = true; +option java_outer_classname = "MapsPlatformDatasetsProto"; +option java_package = "com.google.maps.mapsplatformdatasets.v1"; +option objc_class_prefix = "MDV1"; +option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1"; + +// Request to create a maps dataset. +message CreateDatasetRequest { + // Required. Parent project that will own the dataset. + // Format: projects/{$project} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The dataset version to create. + Dataset dataset = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to update the metadata fields of the dataset. +message UpdateDatasetMetadataRequest { + // Required. The dataset to update. The dataset's name is used to identify the + // dataset to be updated. The name has the format: + // projects/{project}/datasets/{dataset_id} + Dataset dataset = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. Support the value "*" for full + // replacement. + google.protobuf.FieldMask update_mask = 2; +} + +// Request to get the specified dataset. +message GetDatasetRequest { + // Required. Resource name. projects/{project}/datasets/{dataset_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "mapsplatformdatasets.googleapis.com/Dataset" + } + ]; +} + +// Request to list datasets for the project. +message ListDatasetsRequest { + // Required. The name of the project to list all the datasets for. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // The maximum number of versions to return per page. + // If unspecified (or zero), all datasets will be returned. + int32 page_size = 2; + + // The page token, received from a previous ListDatasets call. + // Provide this to retrieve the subsequent page. + string page_token = 3; +} + +// Response to list datasets for the project. +message ListDatasetsResponse { + // All the datasets for the project. + repeated Dataset datasets = 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; +} + +// Request to delete a dataset. +// +// The dataset to be deleted. +message DeleteDatasetRequest { + // Required. Format: projects/${project}/datasets/{dataset_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "mapsplatformdatasets.googleapis.com/Dataset" + } + ]; +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets_service.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets_service.proto new file mode 100644 index 00000000000..1ae92a7c4b4 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets_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.maps.mapsplatformdatasets.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/maps/mapsplatformdatasets/v1/dataset.proto"; +import "google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto"; +import "google/protobuf/empty.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1"; +option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1/mapsplatformdatasetspb;mapsplatformdatasetspb"; +option java_multiple_files = true; +option java_outer_classname = "MapsPlatformDatasetsServiceProto"; +option java_package = "com.google.maps.mapsplatformdatasets.v1"; +option objc_class_prefix = "MDV1"; +option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1"; + +// Service definition for the Maps Platform Datasets API. +service MapsPlatformDatasets { + option (google.api.default_host) = "mapsplatformdatasets.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Create a new dataset for the specified project. + rpc CreateDataset(CreateDatasetRequest) returns (Dataset) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/datasets" + body: "dataset" + }; + option (google.api.method_signature) = "parent,dataset"; + } + + // Update the metadata for the dataset. + rpc UpdateDatasetMetadata(UpdateDatasetMetadataRequest) returns (Dataset) { + option (google.api.http) = { + patch: "/v1/{dataset.name=projects/*/datasets/*}" + body: "dataset" + }; + option (google.api.method_signature) = "dataset,update_mask"; + } + + // Get the dataset. + rpc GetDataset(GetDatasetRequest) returns (Dataset) { + option (google.api.http) = { + get: "/v1/{name=projects/*/datasets/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List all the datasets for the specified project. + rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/datasets" + }; + option (google.api.method_signature) = "parent"; + } + + // Delete the specified dataset . + rpc DeleteDataset(DeleteDatasetRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/datasets/*}" + }; + option (google.api.method_signature) = "name"; + } +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.create_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.create_dataset.js new file mode 100644 index 00000000000..a927ae6e986 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.create_dataset.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, dataset) { + // [START mapsplatformdatasets_v1_generated_MapsPlatformDatasets_CreateDataset_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 project that will own the dataset. + * Format: projects/{$project} + */ + // const parent = 'abc123' + /** + * Required. The dataset version to create. + */ + // const dataset = {} + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient(); + + async function callCreateDataset() { + // Construct request + const request = { + parent, + dataset, + }; + + // Run request + const response = await mapsplatformdatasetsClient.createDataset(request); + console.log(response); + } + + callCreateDataset(); + // [END mapsplatformdatasets_v1_generated_MapsPlatformDatasets_CreateDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.delete_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.delete_dataset.js new file mode 100644 index 00000000000..9f171eed615 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.delete_dataset.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 mapsplatformdatasets_v1_generated_MapsPlatformDatasets_DeleteDataset_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Format: projects/${project}/datasets/{dataset_id} + */ + // const name = 'abc123' + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient(); + + async function callDeleteDataset() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await mapsplatformdatasetsClient.deleteDataset(request); + console.log(response); + } + + callDeleteDataset(); + // [END mapsplatformdatasets_v1_generated_MapsPlatformDatasets_DeleteDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.get_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.get_dataset.js new file mode 100644 index 00000000000..11aa1f8f40c --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.get_dataset.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 mapsplatformdatasets_v1_generated_MapsPlatformDatasets_GetDataset_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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. projects/{project}/datasets/{dataset_id} + */ + // const name = 'abc123' + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient(); + + async function callGetDataset() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await mapsplatformdatasetsClient.getDataset(request); + console.log(response); + } + + callGetDataset(); + // [END mapsplatformdatasets_v1_generated_MapsPlatformDatasets_GetDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.list_datasets.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.list_datasets.js new file mode 100644 index 00000000000..7244d3f36f5 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.list_datasets.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) { + // [START mapsplatformdatasets_v1_generated_MapsPlatformDatasets_ListDatasets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 project to list all the datasets for. + */ + // const parent = 'abc123' + /** + * The maximum number of versions to return per page. + * If unspecified (or zero), all datasets will be returned. + */ + // const pageSize = 1234 + /** + * The page token, received from a previous ListDatasets call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient(); + + async function callListDatasets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await mapsplatformdatasetsClient.listDatasetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDatasets(); + // [END mapsplatformdatasets_v1_generated_MapsPlatformDatasets_ListDatasets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.update_dataset_metadata.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.update_dataset_metadata.js new file mode 100644 index 00000000000..c7f42ea993c --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.update_dataset_metadata.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(dataset) { + // [START mapsplatformdatasets_v1_generated_MapsPlatformDatasets_UpdateDatasetMetadata_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The dataset to update. The dataset's name is used to identify the + * dataset to be updated. The name has the format: + * projects/{project}/datasets/{dataset_id} + */ + // const dataset = {} + /** + * The list of fields to be updated. Support the value "*" for full + * replacement. + */ + // const updateMask = {} + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient(); + + async function callUpdateDatasetMetadata() { + // Construct request + const request = { + dataset, + }; + + // Run request + const response = await mapsplatformdatasetsClient.updateDatasetMetadata(request); + console.log(response); + } + + callUpdateDatasetMetadata(); + // [END mapsplatformdatasets_v1_generated_MapsPlatformDatasets_UpdateDatasetMetadata_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/snippet_metadata_google.maps.mapsplatformdatasets.v1.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/snippet_metadata_google.maps.mapsplatformdatasets.v1.json new file mode 100644 index 00000000000..a20282f3595 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/snippet_metadata_google.maps.mapsplatformdatasets.v1.json @@ -0,0 +1,231 @@ +{ + "clientLibrary": { + "name": "nodejs-mapsplatformdatasets", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.maps.mapsplatformdatasets.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "mapsplatformdatasets_v1_generated_MapsPlatformDatasets_CreateDataset_async", + "title": "MapsPlatformDatasets createDataset Sample", + "origin": "API_DEFINITION", + "description": " Create a new dataset for the specified project.", + "canonical": true, + "file": "maps_platform_datasets.create_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDataset", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.CreateDataset", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "dataset", + "type": ".google.maps.mapsplatformdatasets.v1.Dataset" + } + ], + "resultType": ".google.maps.mapsplatformdatasets.v1.Dataset", + "client": { + "shortName": "MapsPlatformDatasetsClient", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasetsClient" + }, + "method": { + "shortName": "CreateDataset", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.CreateDataset", + "service": { + "shortName": "MapsPlatformDatasets", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets" + } + } + } + }, + { + "regionTag": "mapsplatformdatasets_v1_generated_MapsPlatformDatasets_UpdateDatasetMetadata_async", + "title": "MapsPlatformDatasets updateDatasetMetadata Sample", + "origin": "API_DEFINITION", + "description": " Update the metadata for the dataset.", + "canonical": true, + "file": "maps_platform_datasets.update_dataset_metadata.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDatasetMetadata", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.UpdateDatasetMetadata", + "async": true, + "parameters": [ + { + "name": "dataset", + "type": ".google.maps.mapsplatformdatasets.v1.Dataset" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.maps.mapsplatformdatasets.v1.Dataset", + "client": { + "shortName": "MapsPlatformDatasetsClient", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasetsClient" + }, + "method": { + "shortName": "UpdateDatasetMetadata", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.UpdateDatasetMetadata", + "service": { + "shortName": "MapsPlatformDatasets", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets" + } + } + } + }, + { + "regionTag": "mapsplatformdatasets_v1_generated_MapsPlatformDatasets_GetDataset_async", + "title": "MapsPlatformDatasets getDataset Sample", + "origin": "API_DEFINITION", + "description": " Get the dataset.", + "canonical": true, + "file": "maps_platform_datasets.get_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDataset", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.GetDataset", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.maps.mapsplatformdatasets.v1.Dataset", + "client": { + "shortName": "MapsPlatformDatasetsClient", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasetsClient" + }, + "method": { + "shortName": "GetDataset", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.GetDataset", + "service": { + "shortName": "MapsPlatformDatasets", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets" + } + } + } + }, + { + "regionTag": "mapsplatformdatasets_v1_generated_MapsPlatformDatasets_ListDatasets_async", + "title": "MapsPlatformDatasets listDatasets Sample", + "origin": "API_DEFINITION", + "description": " List all the datasets for the specified project.", + "canonical": true, + "file": "maps_platform_datasets.list_datasets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDatasets", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.ListDatasets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.maps.mapsplatformdatasets.v1.ListDatasetsResponse", + "client": { + "shortName": "MapsPlatformDatasetsClient", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasetsClient" + }, + "method": { + "shortName": "ListDatasets", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.ListDatasets", + "service": { + "shortName": "MapsPlatformDatasets", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets" + } + } + } + }, + { + "regionTag": "mapsplatformdatasets_v1_generated_MapsPlatformDatasets_DeleteDataset_async", + "title": "MapsPlatformDatasets deleteDataset Sample", + "origin": "API_DEFINITION", + "description": " Delete the specified dataset .", + "canonical": true, + "file": "maps_platform_datasets.delete_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDataset", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.DeleteDataset", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "MapsPlatformDatasetsClient", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasetsClient" + }, + "method": { + "shortName": "DeleteDataset", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.DeleteDataset", + "service": { + "shortName": "MapsPlatformDatasets", + "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/index.ts new file mode 100644 index 00000000000..e09c026b0c8 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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 MapsPlatformDatasetsClient = v1.MapsPlatformDatasetsClient; +type MapsPlatformDatasetsClient = v1.MapsPlatformDatasetsClient; +export {v1, MapsPlatformDatasetsClient}; +export default {v1, MapsPlatformDatasetsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..8c635052284 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/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.maps.mapsplatformdatasets.v1", + "libraryPackage": "@googlemaps/maps-platform-datasets", + "services": { + "MapsPlatformDatasets": { + "clients": { + "grpc": { + "libraryClient": "MapsPlatformDatasetsClient", + "rpcs": { + "CreateDataset": { + "methods": [ + "createDataset" + ] + }, + "UpdateDatasetMetadata": { + "methods": [ + "updateDatasetMetadata" + ] + }, + "GetDataset": { + "methods": [ + "getDataset" + ] + }, + "DeleteDataset": { + "methods": [ + "deleteDataset" + ] + }, + "ListDatasets": { + "methods": [ + "listDatasets", + "listDatasetsStream", + "listDatasetsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "MapsPlatformDatasetsClient", + "rpcs": { + "CreateDataset": { + "methods": [ + "createDataset" + ] + }, + "UpdateDatasetMetadata": { + "methods": [ + "updateDatasetMetadata" + ] + }, + "GetDataset": { + "methods": [ + "getDataset" + ] + }, + "DeleteDataset": { + "methods": [ + "deleteDataset" + ] + }, + "ListDatasets": { + "methods": [ + "listDatasets", + "listDatasetsStream", + "listDatasetsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/index.ts new file mode 100644 index 00000000000..ca0c9566b16 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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 {MapsPlatformDatasetsClient} from './maps_platform_datasets_client'; diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client.ts new file mode 100644 index 00000000000..04407482f0a --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client.ts @@ -0,0 +1,828 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/maps_platform_datasets_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './maps_platform_datasets_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service definition for the Maps Platform Datasets API. + * @class + * @memberof v1 + */ +export class MapsPlatformDatasetsClient { + 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}; + mapsPlatformDatasetsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of MapsPlatformDatasetsClient. + * + * @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 MapsPlatformDatasetsClient({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 MapsPlatformDatasetsClient; + 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 = { + datasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/datasets/{dataset}' + ), + }; + + // 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 = { + listDatasets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'datasets') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets', 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.mapsPlatformDatasetsStub) { + return this.mapsPlatformDatasetsStub; + } + + // Put together the "service stub" for + // google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets. + this.mapsPlatformDatasetsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets, + 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 mapsPlatformDatasetsStubMethods = + ['createDataset', 'updateDatasetMetadata', 'getDataset', 'listDatasets', 'deleteDataset']; + for (const methodName of mapsPlatformDatasetsStubMethods) { + const callPromise = this.mapsPlatformDatasetsStub.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.mapsPlatformDatasetsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'mapsplatformdatasets.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 'mapsplatformdatasets.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Create a new dataset for the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent project that will own the dataset. + * Format: projects/{$project} + * @param {google.maps.mapsplatformdatasets.v1.Dataset} request.dataset + * Required. The dataset version 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 {@link protos.google.maps.mapsplatformdatasets.v1.Dataset|Dataset}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/maps_platform_datasets.create_dataset.js + * region_tag:mapsplatformdatasets_v1_generated_MapsPlatformDatasets_CreateDataset_async + */ + createDataset( + request?: protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|undefined, {}|undefined + ]>; + createDataset( + request: protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest, + options: CallOptions, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|null|undefined, + {}|null|undefined>): void; + createDataset( + request: protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|null|undefined, + {}|null|undefined>): void; + createDataset( + request?: protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createDataset(request, options, callback); + } +/** + * Update the metadata for the dataset. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.maps.mapsplatformdatasets.v1.Dataset} request.dataset + * Required. The dataset to update. The dataset's name is used to identify the + * dataset to be updated. The name has the format: + * projects/{project}/datasets/{dataset_id} + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. Support the value "*" for full + * replacement. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.maps.mapsplatformdatasets.v1.Dataset|Dataset}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/maps_platform_datasets.update_dataset_metadata.js + * region_tag:mapsplatformdatasets_v1_generated_MapsPlatformDatasets_UpdateDatasetMetadata_async + */ + updateDatasetMetadata( + request?: protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|undefined, {}|undefined + ]>; + updateDatasetMetadata( + request: protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest, + options: CallOptions, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|null|undefined, + {}|null|undefined>): void; + updateDatasetMetadata( + request: protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|null|undefined, + {}|null|undefined>): void; + updateDatasetMetadata( + request?: protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'dataset.name': request.dataset!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateDatasetMetadata(request, options, callback); + } +/** + * Get the dataset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name. projects/{project}/datasets/{dataset_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.maps.mapsplatformdatasets.v1.Dataset|Dataset}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/maps_platform_datasets.get_dataset.js + * region_tag:mapsplatformdatasets_v1_generated_MapsPlatformDatasets_GetDataset_async + */ + getDataset( + request?: protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|undefined, {}|undefined + ]>; + getDataset( + request: protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest, + options: CallOptions, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|null|undefined, + {}|null|undefined>): void; + getDataset( + request: protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|null|undefined, + {}|null|undefined>): void; + getDataset( + request?: protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1.IDataset, + protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getDataset(request, options, callback); + } +/** + * Delete the specified dataset . + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Format: projects/${project}/datasets/{dataset_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/maps_platform_datasets.delete_dataset.js + * region_tag:mapsplatformdatasets_v1_generated_MapsPlatformDatasets_DeleteDataset_async + */ + deleteDataset( + request?: protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|undefined, {}|undefined + ]>; + deleteDataset( + request: protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|null|undefined, + {}|null|undefined>): void; + deleteDataset( + request: protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|null|undefined, + {}|null|undefined>): void; + deleteDataset( + request?: protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteDataset(request, options, callback); + } + + /** + * List all the datasets for the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project to list all the datasets for. + * @param {number} request.pageSize + * The maximum number of versions to return per page. + * If unspecified (or zero), all datasets will be returned. + * @param {string} request.pageToken + * The page token, received from a previous ListDatasets call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.maps.mapsplatformdatasets.v1.Dataset|Dataset}. + * 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 `listDatasetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDatasets( + request?: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1.IDataset[], + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest|null, + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse + ]>; + listDatasets( + request: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1.IDataset>): void; + listDatasets( + request: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, + callback: PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1.IDataset>): void; + listDatasets( + request?: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1.IDataset>, + callback?: PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1.IDataset>): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1.IDataset[], + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest|null, + protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listDatasets(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 name of the project to list all the datasets for. + * @param {number} request.pageSize + * The maximum number of versions to return per page. + * If unspecified (or zero), all datasets will be returned. + * @param {string} request.pageToken + * The page token, received from a previous ListDatasets call. + * Provide this to retrieve the subsequent page. + * @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.maps.mapsplatformdatasets.v1.Dataset|Dataset} 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 `listDatasetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDatasetsStream( + request?: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, + 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['listDatasets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDatasets.createStream( + this.innerApiCalls.listDatasets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDatasets`, 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 name of the project to list all the datasets for. + * @param {number} request.pageSize + * The maximum number of versions to return per page. + * If unspecified (or zero), all datasets will be returned. + * @param {string} request.pageToken + * The page token, received from a previous ListDatasets call. + * Provide this to retrieve the subsequent page. + * @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.maps.mapsplatformdatasets.v1.Dataset|Dataset}. 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/maps_platform_datasets.list_datasets.js + * region_tag:mapsplatformdatasets_v1_generated_MapsPlatformDatasets_ListDatasets_async + */ + listDatasetsAsync( + request?: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, + 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['listDatasets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDatasets.asyncIterate( + this.innerApiCalls['listDatasets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified dataset resource name string. + * + * @param {string} project + * @param {string} dataset + * @returns {string} Resource name string. + */ + datasetPath(project:string,dataset:string) { + return this.pathTemplates.datasetPathTemplate.render({ + project: project, + dataset: dataset, + }); + } + + /** + * Parse the project from Dataset resource. + * + * @param {string} datasetName + * A fully-qualified path representing Dataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDatasetName(datasetName: string) { + return this.pathTemplates.datasetPathTemplate.match(datasetName).project; + } + + /** + * Parse the dataset from Dataset resource. + * + * @param {string} datasetName + * A fully-qualified path representing Dataset resource. + * @returns {string} A string representing the dataset. + */ + matchDatasetFromDatasetName(datasetName: string) { + return this.pathTemplates.datasetPathTemplate.match(datasetName).dataset; + } + + /** + * 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.mapsPlatformDatasetsStub && !this._terminated) { + return this.mapsPlatformDatasetsStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client_config.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client_config.json new file mode 100644 index 00000000000..9a072527d2f --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client_config.json @@ -0,0 +1,63 @@ +{ + "interfaces": { + "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets": { + "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": { + "CreateDataset": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateDatasetMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDataset": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListDatasets": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteDataset": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_proto_list.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_proto_list.json new file mode 100644 index 00000000000..9a8bc9fc147 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_proto_list.json @@ -0,0 +1,6 @@ +[ + "../../protos/google/maps/mapsplatformdatasets/v1/data_source.proto", + "../../protos/google/maps/mapsplatformdatasets/v1/dataset.proto", + "../../protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto", + "../../protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets_service.proto" +] diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..38965d3e417 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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 mapsplatformdatasets = require('@googlemaps/maps-platform-datasets'); + +function main() { + const mapsPlatformDatasetsClient = new mapsplatformdatasets.MapsPlatformDatasetsClient(); +} + +main(); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..45508beeb01 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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 {MapsPlatformDatasetsClient} from '@googlemaps/maps-platform-datasets'; + +// check that the client class type name can be used +function doStuffWithMapsPlatformDatasetsClient(client: MapsPlatformDatasetsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const mapsPlatformDatasetsClient = new MapsPlatformDatasetsClient(); + doStuffWithMapsPlatformDatasetsClient(mapsPlatformDatasetsClient); +} + +main(); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/install.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1/test/gapic_maps_platform_datasets_v1.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/test/gapic_maps_platform_datasets_v1.ts new file mode 100644 index 00000000000..e0f678f7092 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/test/gapic_maps_platform_datasets_v1.ts @@ -0,0 +1,919 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 mapsplatformdatasetsModule 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.MapsPlatformDatasetsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.mapsPlatformDatasetsStub, undefined); + await client.initialize(); + assert(client.mapsPlatformDatasetsStub); + }); + + it('has close method for the initialized client', done => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.mapsPlatformDatasetsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.mapsPlatformDatasetsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + 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 mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + 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('createDataset', () => { + it('invokes createDataset without error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.Dataset() + ); + client.innerApiCalls.createDataset = stubSimpleCall(expectedResponse); + const [response] = await client.createDataset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDataset without error using callback', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.Dataset() + ); + client.innerApiCalls.createDataset = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDataset( + request, + (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1.IDataset|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDataset with error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDataset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createDataset(request), expectedError); + const actualRequest = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDataset with closed client', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createDataset(request), expectedError); + }); + }); + + describe('updateDatasetMetadata', () => { + it('invokes updateDatasetMetadata without error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest() + ); + request.dataset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest', ['dataset', 'name']); + request.dataset.name = defaultValue1; + const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.Dataset() + ); + client.innerApiCalls.updateDatasetMetadata = stubSimpleCall(expectedResponse); + const [response] = await client.updateDatasetMetadata(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDatasetMetadata without error using callback', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest() + ); + request.dataset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest', ['dataset', 'name']); + request.dataset.name = defaultValue1; + const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.Dataset() + ); + client.innerApiCalls.updateDatasetMetadata = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDatasetMetadata( + request, + (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1.IDataset|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDatasetMetadata with error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest() + ); + request.dataset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest', ['dataset', 'name']); + request.dataset.name = defaultValue1; + const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDatasetMetadata = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateDatasetMetadata(request), expectedError); + const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDatasetMetadata with closed client', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest() + ); + request.dataset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest', ['dataset', 'name']); + request.dataset.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateDatasetMetadata(request), expectedError); + }); + }); + + describe('getDataset', () => { + it('invokes getDataset without error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.GetDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.GetDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.Dataset() + ); + client.innerApiCalls.getDataset = stubSimpleCall(expectedResponse); + const [response] = await client.getDataset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDataset without error using callback', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.GetDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.GetDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.Dataset() + ); + client.innerApiCalls.getDataset = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDataset( + request, + (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1.IDataset|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDataset with error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.GetDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.GetDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDataset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDataset(request), expectedError); + const actualRequest = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDataset with closed client', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.GetDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.GetDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDataset(request), expectedError); + }); + }); + + describe('deleteDataset', () => { + it('invokes deleteDataset without error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDataset = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDataset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDataset without error using callback', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDataset = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDataset( + 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.deleteDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDataset with error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDataset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteDataset(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDataset with closed client', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteDataset(request), expectedError); + }); + }); + + describe('listDatasets', () => { + it('invokes listDatasets without error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + ]; + client.innerApiCalls.listDatasets = stubSimpleCall(expectedResponse); + const [response] = await client.listDatasets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatasets without error using callback', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + ]; + client.innerApiCalls.listDatasets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDatasets( + request, + (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1.IDataset[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatasets with error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDatasets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDatasets(request), expectedError); + const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatasetsStream without error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + ]; + client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDatasetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.maps.mapsplatformdatasets.v1.Dataset[] = []; + stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1.Dataset) => { + 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.listDatasets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); + assert( + (client.descriptors.page.listDatasets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDatasetsStream with error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDatasetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.maps.mapsplatformdatasets.v1.Dataset[] = []; + stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1.Dataset) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDatasets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); + assert( + (client.descriptors.page.listDatasets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDatasets without error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), + ]; + client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.maps.mapsplatformdatasets.v1.IDataset[] = []; + const iterable = client.listDatasetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDatasets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDatasets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDatasets with error', async () => { + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDatasetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.maps.mapsplatformdatasets.v1.IDataset[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDatasets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDatasets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('dataset', () => { + const fakePath = "/rendered/path/dataset"; + const expectedParameters = { + project: "projectValue", + dataset: "datasetValue", + }; + const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.datasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.datasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('datasetPath', () => { + const result = client.datasetPath("projectValue", "datasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.datasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDatasetName', () => { + const result = client.matchProjectFromDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.datasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDatasetFromDatasetName', () => { + const result = client.matchDatasetFromDatasetName(fakePath); + assert.strictEqual(result, "datasetValue"); + assert((client.pathTemplates.datasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/tsconfig.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1/webpack.config.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/webpack.config.js new file mode 100644 index 00000000000..3cf4c3f7aa5 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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: 'MapsPlatformDatasets', + filename: './maps-platform-datasets.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-maps-mapsplatformdatasets/v1alpha/.eslintignore b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintrc.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.gitignore b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1alpha/.jsdoc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.jsdoc.js new file mode 100644 index 00000000000..24b47733dc9 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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: '@googlemaps/maps-platform-datasets', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.mocharc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1alpha/.prettierrc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1alpha/README.md b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/README.md new file mode 100644 index 00000000000..e0e26d17fff --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/README.md @@ -0,0 +1 @@ +Mapsplatformdatasets: Nodejs Client diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/package.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/package.json new file mode 100644 index 00000000000..a7b6108c686 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/package.json @@ -0,0 +1,58 @@ +{ + "name": "@googlemaps/maps-platform-datasets", + "version": "0.1.0", + "description": "Mapsplatformdatasets client for Node.js", + "repository": "googleapis/nodejs-mapsplatformdatasets", + "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 mapsplatformdatasets", + "mapsplatformdatasets", + "maps platform datasets v1 alpha" + ], + "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-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/data_source.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/data_source.proto new file mode 100644 index 00000000000..f6907924164 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/data_source.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.maps.mapsplatformdatasets.v1alpha; + +option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1Alpha"; +option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb;mapsplatformdatasetspb"; +option java_multiple_files = true; +option java_outer_classname = "DataSourceProto"; +option java_package = "com.google.maps.mapsplatformdatasets.v1alpha"; +option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1alpha"; + +// The details about the data source when it is a local file. +message LocalFileSource { + // The file name and extension of the uploaded file. + string filename = 1; + + // The format of the file that is being uploaded. + FileFormat file_format = 2; +} + +// The details about the data source when it is in Google Cloud Storage. +message GcsSource { + // Source data URI. For example, `gs://my_bucket/my_object`. + string input_uri = 1; + + // The file format of the Google Cloud Storage object. This is used mainly for + // validation. + FileFormat file_format = 2; +} + +// The format of the file being uploaded. +enum FileFormat { + // Unspecified file format. + FILE_FORMAT_UNSPECIFIED = 0; + + // GeoJson file. + FILE_FORMAT_GEOJSON = 1; + + // KML file. + FILE_FORMAT_KML = 2; + + // CSV file. + FILE_FORMAT_CSV = 3; + + // Protobuf file. + FILE_FORMAT_PROTO = 4; + + // KMZ file. + FILE_FORMAT_KMZ = 5; +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/dataset.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/dataset.proto new file mode 100644 index 00000000000..b078deb55ff --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/dataset.proto @@ -0,0 +1,110 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.mapsplatformdatasets.v1alpha; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/maps/mapsplatformdatasets/v1alpha/data_source.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1Alpha"; +option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb;mapsplatformdatasetspb"; +option java_multiple_files = true; +option java_outer_classname = "DatasetProto"; +option java_package = "com.google.maps.mapsplatformdatasets.v1alpha"; +option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1alpha"; + +// A representation of a maps platform dataset. +message Dataset { + option (google.api.resource) = { + type: "mapsplatformdatasets.googleapis.com/Dataset" + pattern: "projects/{project}/datasets/{dataset}" + }; + + // Resource name, + // projects/{project}/datasets/{dataset_id} + string name = 1; + + // Human readable name, shown in the console UI. Set by customer. + string display_name = 2; + + // A description of this dataset; set by the customer. + string description = 3; + + // The version of the dataset. + string version_id = 4; + + // Specified use case(s) for this dataset. + repeated Usage usage = 5; + + // Details about the source of the data for the dataset. + oneof data_source { + // A local file source for the dataset for a single upload. + LocalFileSource local_file_source = 6; + + // A Google Cloud Storage file source for the dataset for a single upload. + GcsSource gcs_source = 7; + } + + // The status of the import of the latest dataset version. + State status = 12; + + // Output only. Time when the dataset was first created. + google.protobuf.Timestamp create_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when the dataset metadata was last updated. + google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this version of dataset was created. (It happened when importing + // data to the dataset) + google.protobuf.Timestamp version_create_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The description for this version of dataset. It is provided when importing + // data to the dataset. + string version_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Usage specifies where the data is intended to be used to inform how to +// process the data. +enum Usage { + // The usage of this dataset is not set. + USAGE_UNSPECIFIED = 0; + + // This dataset will be used for data driven styling. + USAGE_DATA_DRIVEN_STYLING = 1; + + // This dataset will be used for area affordances in routing. + USAGE_AREA_AFFORDANCES = 2; + + // This dataset will be used for assisted driving in routing. + USAGE_ASSISTED_DRIVING = 3; +} + +// State specifies the status of the import of the latest dataset version. +enum State { + // The state of this dataset is not set. + STATE_UNSPECIFIED = 0; + + // The dataset version is getting imported. + STATE_IMPORTING = 1; + + // The dataset version succeeded in getting imported. + STATE_IMPORT_SUCCEEDED = 2; + + // The dataset version failed to get imported. + STATE_IMPORT_FAILED = 3; +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto new file mode 100644 index 00000000000..0a03f5cc6f1 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto @@ -0,0 +1,167 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.mapsplatformdatasets.v1alpha; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/maps/mapsplatformdatasets/v1alpha/dataset.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1Alpha"; +option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb;mapsplatformdatasetspb"; +option java_multiple_files = true; +option java_outer_classname = "MapsPlatformDatasetsProto"; +option java_package = "com.google.maps.mapsplatformdatasets.v1alpha"; +option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1alpha"; + +// Request to create a maps dataset. +message CreateDatasetRequest { + // Required. Parent project that will own the dataset. + // Format: projects/{$project_number} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The dataset version to create. + Dataset dataset = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to update the metadata fields of the dataset. +message UpdateDatasetMetadataRequest { + // Required. The dataset to update. The dataset's name is used to identify the dataset + // to be updated. The name has the format: + // projects/{project}/datasets/{dataset_id} + Dataset dataset = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. Support the value "*" for full + // replacement. + google.protobuf.FieldMask update_mask = 2; +} + +// Request to get the specified dataset. +message GetDatasetRequest { + // Required. Resource name. Can also fetch a specified version + // projects/{project}/datasets/{dataset_id} + // projects/{project}/datasets/{dataset_id}@{version-id} + // + // In order to retrieve a previous version of the dataset, also provide + // the version ID. + // Example: projects/123/datasets/assisted-driving-preferences@c7cfa2a8 + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "mapsplatformdatasets.googleapis.com/Dataset" + } + ]; + + // If specified, will fetch the dataset details of the version published for + // the specified use case rather than the latest, if one exists. If a + // published version does not exist, will default to getting the dataset + // details of the latest version. + Usage published_usage = 2; +} + +// Request to list of all versions of the dataset. +message ListDatasetVersionsRequest { + // Required. The name of the dataset to list all the versions for. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "mapsplatformdatasets.googleapis.com/Dataset" + } + ]; + + // The maximum number of versions to return per page. + // If unspecified (or zero), at most 1000 versions will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // The page token, received from a previous GetDatasetVersions call. + // Provide this to retrieve the subsequent page. + string page_token = 3; +} + +// Response with list of all versions of the dataset. +message ListDatasetVersionsResponse { + // All the versions of the dataset. + repeated Dataset datasets = 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; +} + +// Request to list datasets for the project. +message ListDatasetsRequest { + // Required. The name of the project to list all the datasets for. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // The maximum number of versions to return per page. + // If unspecified (or zero), at most 1000 datasets will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // The page token, received from a previous GetDatasetVersions call. + // Provide this to retrieve the subsequent page. + string page_token = 3; +} + +// Response to list datasets for the project. +message ListDatasetsResponse { + // All the datasets for the project. + repeated Dataset datasets = 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; +} + +// Request to delete a dataset. +// +// The dataset to be deleted. +message DeleteDatasetRequest { + // Required. Format: projects/${project}/datasets/{dataset_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "mapsplatformdatasets.googleapis.com/Dataset" + } + ]; + + // If set to true, any dataset version for this dataset will also be deleted. + // (Otherwise, the request will only work if the dataset has no versions.) + bool force = 2; +} + +// Request to delete a version of a dataset. +message DeleteDatasetVersionRequest { + // Required. Format: projects/${project}/datasets/{dataset_id}@{version-id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "mapsplatformdatasets.googleapis.com/Dataset" + } + ]; +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets_alpha_service.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets_alpha_service.proto new file mode 100644 index 00000000000..12478bedd24 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets_alpha_service.proto @@ -0,0 +1,97 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.maps.mapsplatformdatasets.v1alpha; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/maps/mapsplatformdatasets/v1alpha/dataset.proto"; +import "google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto"; +import "google/protobuf/empty.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1Alpha"; +option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb;mapsplatformdatasetspb"; +option java_multiple_files = true; +option java_outer_classname = "MapsPlatformDatasetsV1AlphaServiceProto"; +option java_package = "com.google.maps.mapsplatformdatasets.v1alpha"; +option objc_class_prefix = "MDV1A"; +option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1alpha"; + +// Service definition for the Maps Platform Datasets API. +service MapsPlatformDatasetsV1Alpha { + option (google.api.default_host) = "mapsplatformdatasets.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Create a new dataset for the specified project. + rpc CreateDataset(CreateDatasetRequest) returns (Dataset) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*}/datasets" + body: "dataset" + }; + option (google.api.method_signature) = "parent,dataset"; + } + + // Update the metadata for the dataset. To update the data use: UploadDataset. + rpc UpdateDatasetMetadata(UpdateDatasetMetadataRequest) returns (Dataset) { + option (google.api.http) = { + patch: "/v1alpha/{dataset.name=projects/*/datasets/*}" + body: "dataset" + }; + option (google.api.method_signature) = "dataset,update_mask"; + } + + // Get the published or latest version of the dataset. + rpc GetDataset(GetDatasetRequest) returns (Dataset) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/datasets/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List all the versions of a dataset. + rpc ListDatasetVersions(ListDatasetVersionsRequest) returns (ListDatasetVersionsResponse) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/datasets/*}:listVersions" + }; + option (google.api.method_signature) = "name"; + } + + // List all the datasets for the specified project. + rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*}/datasets" + }; + option (google.api.method_signature) = "parent"; + } + + // Delete the specified dataset and optionally all its corresponding + // versions. + rpc DeleteDataset(DeleteDatasetRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/datasets/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Delete a specific version of the dataset. + rpc DeleteDatasetVersion(DeleteDatasetVersionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/datasets/*}:deleteVersion" + }; + option (google.api.method_signature) = "name"; + } +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.create_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.create_dataset.js new file mode 100644 index 00000000000..3f466f5351e --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.create_dataset.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, dataset) { + // [START mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_CreateDataset_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 project that will own the dataset. + * Format: projects/{$project_number} + */ + // const parent = 'abc123' + /** + * Required. The dataset version to create. + */ + // const dataset = {} + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); + + async function callCreateDataset() { + // Construct request + const request = { + parent, + dataset, + }; + + // Run request + const response = await mapsplatformdatasetsClient.createDataset(request); + console.log(response); + } + + callCreateDataset(); + // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_CreateDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset.js new file mode 100644 index 00000000000..f44ccd27cdc --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset.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 mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDataset_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Format: projects/${project}/datasets/{dataset_id} + */ + // const name = 'abc123' + /** + * If set to true, any dataset version for this dataset will also be deleted. + * (Otherwise, the request will only work if the dataset has no versions.) + */ + // const force = true + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); + + async function callDeleteDataset() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await mapsplatformdatasetsClient.deleteDataset(request); + console.log(response); + } + + callDeleteDataset(); + // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset_version.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset_version.js new file mode 100644 index 00000000000..a45747897c5 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset_version.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 mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDatasetVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Format: projects/${project}/datasets/{dataset_id}@{version-id} + */ + // const name = 'abc123' + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); + + async function callDeleteDatasetVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await mapsplatformdatasetsClient.deleteDatasetVersion(request); + console.log(response); + } + + callDeleteDatasetVersion(); + // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDatasetVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.get_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.get_dataset.js new file mode 100644 index 00000000000..dd3cf3d5033 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.get_dataset.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 mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_GetDataset_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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. Can also fetch a specified version + * projects/{project}/datasets/{dataset_id} + * projects/{project}/datasets/{dataset_id}@{version-id} + * In order to retrieve a previous version of the dataset, also provide + * the version ID. + * Example: projects/123/datasets/assisted-driving-preferences@c7cfa2a8 + */ + // const name = 'abc123' + /** + * If specified, will fetch the dataset details of the version published for + * the specified use case rather than the latest, if one exists. If a + * published version does not exist, will default to getting the dataset + * details of the latest version. + */ + // const publishedUsage = {} + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); + + async function callGetDataset() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await mapsplatformdatasetsClient.getDataset(request); + console.log(response); + } + + callGetDataset(); + // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_GetDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_dataset_versions.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_dataset_versions.js new file mode 100644 index 00000000000..a028467844e --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_dataset_versions.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 mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasetVersions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 dataset to list all the versions for. + */ + // const name = 'abc123' + /** + * The maximum number of versions to return per page. + * If unspecified (or zero), at most 1000 versions will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * The page token, received from a previous GetDatasetVersions call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); + + async function callListDatasetVersions() { + // Construct request + const request = { + name, + }; + + // Run request + const iterable = await mapsplatformdatasetsClient.listDatasetVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDatasetVersions(); + // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasetVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_datasets.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_datasets.js new file mode 100644 index 00000000000..c90ed91d61f --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_datasets.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) { + // [START mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 project to list all the datasets for. + */ + // const parent = 'abc123' + /** + * The maximum number of versions to return per page. + * If unspecified (or zero), at most 1000 datasets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * The page token, received from a previous GetDatasetVersions call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); + + async function callListDatasets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await mapsplatformdatasetsClient.listDatasetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDatasets(); + // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.update_dataset_metadata.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.update_dataset_metadata.js new file mode 100644 index 00000000000..eb94eb3c53c --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.update_dataset_metadata.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(dataset) { + // [START mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_UpdateDatasetMetadata_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The dataset to update. The dataset's name is used to identify the dataset + * to be updated. The name has the format: + * projects/{project}/datasets/{dataset_id} + */ + // const dataset = {} + /** + * The list of fields to be updated. Support the value "*" for full + * replacement. + */ + // const updateMask = {} + + // Imports the Mapsplatformdatasets library + const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; + + // Instantiates a client + const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); + + async function callUpdateDatasetMetadata() { + // Construct request + const request = { + dataset, + }; + + // Run request + const response = await mapsplatformdatasetsClient.updateDatasetMetadata(request); + console.log(response); + } + + callUpdateDatasetMetadata(); + // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_UpdateDatasetMetadata_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/snippet_metadata_google.maps.mapsplatformdatasets.v1alpha.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/snippet_metadata_google.maps.mapsplatformdatasets.v1alpha.json new file mode 100644 index 00000000000..8ce3d287d8f --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/snippet_metadata_google.maps.mapsplatformdatasets.v1alpha.json @@ -0,0 +1,327 @@ +{ + "clientLibrary": { + "name": "nodejs-mapsplatformdatasets", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.maps.mapsplatformdatasets.v1alpha", + "version": "v1alpha" + } + ] + }, + "snippets": [ + { + "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_CreateDataset_async", + "title": "MapsPlatformDatasetsV1Alpha createDataset Sample", + "origin": "API_DEFINITION", + "description": " Create a new dataset for the specified project.", + "canonical": true, + "file": "maps_platform_datasets_v1_alpha.create_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDataset", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.CreateDataset", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "dataset", + "type": ".google.maps.mapsplatformdatasets.v1alpha.Dataset" + } + ], + "resultType": ".google.maps.mapsplatformdatasets.v1alpha.Dataset", + "client": { + "shortName": "MapsPlatformDatasetsV1AlphaClient", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" + }, + "method": { + "shortName": "CreateDataset", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.CreateDataset", + "service": { + "shortName": "MapsPlatformDatasetsV1Alpha", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" + } + } + } + }, + { + "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_UpdateDatasetMetadata_async", + "title": "MapsPlatformDatasetsV1Alpha updateDatasetMetadata Sample", + "origin": "API_DEFINITION", + "description": " Update the metadata for the dataset. To update the data use: UploadDataset.", + "canonical": true, + "file": "maps_platform_datasets_v1_alpha.update_dataset_metadata.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDatasetMetadata", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.UpdateDatasetMetadata", + "async": true, + "parameters": [ + { + "name": "dataset", + "type": ".google.maps.mapsplatformdatasets.v1alpha.Dataset" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.maps.mapsplatformdatasets.v1alpha.Dataset", + "client": { + "shortName": "MapsPlatformDatasetsV1AlphaClient", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" + }, + "method": { + "shortName": "UpdateDatasetMetadata", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.UpdateDatasetMetadata", + "service": { + "shortName": "MapsPlatformDatasetsV1Alpha", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" + } + } + } + }, + { + "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_GetDataset_async", + "title": "MapsPlatformDatasetsV1Alpha getDataset Sample", + "origin": "API_DEFINITION", + "description": " Get the published or latest version of the dataset.", + "canonical": true, + "file": "maps_platform_datasets_v1_alpha.get_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDataset", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.GetDataset", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "published_usage", + "type": ".google.maps.mapsplatformdatasets.v1alpha.Usage" + } + ], + "resultType": ".google.maps.mapsplatformdatasets.v1alpha.Dataset", + "client": { + "shortName": "MapsPlatformDatasetsV1AlphaClient", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" + }, + "method": { + "shortName": "GetDataset", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.GetDataset", + "service": { + "shortName": "MapsPlatformDatasetsV1Alpha", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" + } + } + } + }, + { + "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasetVersions_async", + "title": "MapsPlatformDatasetsV1Alpha listDatasetVersions Sample", + "origin": "API_DEFINITION", + "description": " List all the versions of a dataset.", + "canonical": true, + "file": "maps_platform_datasets_v1_alpha.list_dataset_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDatasetVersions", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.ListDatasetVersions", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsResponse", + "client": { + "shortName": "MapsPlatformDatasetsV1AlphaClient", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" + }, + "method": { + "shortName": "ListDatasetVersions", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.ListDatasetVersions", + "service": { + "shortName": "MapsPlatformDatasetsV1Alpha", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" + } + } + } + }, + { + "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasets_async", + "title": "MapsPlatformDatasetsV1Alpha listDatasets Sample", + "origin": "API_DEFINITION", + "description": " List all the datasets for the specified project.", + "canonical": true, + "file": "maps_platform_datasets_v1_alpha.list_datasets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDatasets", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.ListDatasets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.maps.mapsplatformdatasets.v1alpha.ListDatasetsResponse", + "client": { + "shortName": "MapsPlatformDatasetsV1AlphaClient", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" + }, + "method": { + "shortName": "ListDatasets", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.ListDatasets", + "service": { + "shortName": "MapsPlatformDatasetsV1Alpha", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" + } + } + } + }, + { + "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDataset_async", + "title": "MapsPlatformDatasetsV1Alpha deleteDataset Sample", + "origin": "API_DEFINITION", + "description": " Delete the specified dataset and optionally all its corresponding versions.", + "canonical": true, + "file": "maps_platform_datasets_v1_alpha.delete_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDataset", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.DeleteDataset", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "MapsPlatformDatasetsV1AlphaClient", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" + }, + "method": { + "shortName": "DeleteDataset", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.DeleteDataset", + "service": { + "shortName": "MapsPlatformDatasetsV1Alpha", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" + } + } + } + }, + { + "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDatasetVersion_async", + "title": "MapsPlatformDatasetsV1Alpha deleteDatasetVersion Sample", + "origin": "API_DEFINITION", + "description": " Delete a specific version of the dataset.", + "canonical": true, + "file": "maps_platform_datasets_v1_alpha.delete_dataset_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDatasetVersion", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.DeleteDatasetVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "MapsPlatformDatasetsV1AlphaClient", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" + }, + "method": { + "shortName": "DeleteDatasetVersion", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.DeleteDatasetVersion", + "service": { + "shortName": "MapsPlatformDatasetsV1Alpha", + "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/index.ts new file mode 100644 index 00000000000..a03ae68158c --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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 MapsPlatformDatasetsV1AlphaClient = v1alpha.MapsPlatformDatasetsV1AlphaClient; +type MapsPlatformDatasetsV1AlphaClient = v1alpha.MapsPlatformDatasetsV1AlphaClient; +export {v1alpha, MapsPlatformDatasetsV1AlphaClient}; +export default {v1alpha, MapsPlatformDatasetsV1AlphaClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/gapic_metadata.json new file mode 100644 index 00000000000..a0ee6a8b453 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/gapic_metadata.json @@ -0,0 +1,101 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.maps.mapsplatformdatasets.v1alpha", + "libraryPackage": "@googlemaps/maps-platform-datasets", + "services": { + "MapsPlatformDatasetsV1Alpha": { + "clients": { + "grpc": { + "libraryClient": "MapsPlatformDatasetsV1AlphaClient", + "rpcs": { + "CreateDataset": { + "methods": [ + "createDataset" + ] + }, + "UpdateDatasetMetadata": { + "methods": [ + "updateDatasetMetadata" + ] + }, + "GetDataset": { + "methods": [ + "getDataset" + ] + }, + "DeleteDataset": { + "methods": [ + "deleteDataset" + ] + }, + "DeleteDatasetVersion": { + "methods": [ + "deleteDatasetVersion" + ] + }, + "ListDatasetVersions": { + "methods": [ + "listDatasetVersions", + "listDatasetVersionsStream", + "listDatasetVersionsAsync" + ] + }, + "ListDatasets": { + "methods": [ + "listDatasets", + "listDatasetsStream", + "listDatasetsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "MapsPlatformDatasetsV1AlphaClient", + "rpcs": { + "CreateDataset": { + "methods": [ + "createDataset" + ] + }, + "UpdateDatasetMetadata": { + "methods": [ + "updateDatasetMetadata" + ] + }, + "GetDataset": { + "methods": [ + "getDataset" + ] + }, + "DeleteDataset": { + "methods": [ + "deleteDataset" + ] + }, + "DeleteDatasetVersion": { + "methods": [ + "deleteDatasetVersion" + ] + }, + "ListDatasetVersions": { + "methods": [ + "listDatasetVersions", + "listDatasetVersionsStream", + "listDatasetVersionsAsync" + ] + }, + "ListDatasets": { + "methods": [ + "listDatasets", + "listDatasetsStream", + "listDatasetsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/index.ts new file mode 100644 index 00000000000..a91f63ad805 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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 {MapsPlatformDatasetsV1AlphaClient} from './maps_platform_datasets_v1_alpha_client'; diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts new file mode 100644 index 00000000000..63bf4a8dbd7 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts @@ -0,0 +1,1097 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v1alpha/maps_platform_datasets_v1_alpha_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './maps_platform_datasets_v1_alpha_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service definition for the Maps Platform Datasets API. + * @class + * @memberof v1alpha + */ +export class MapsPlatformDatasetsV1AlphaClient { + 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}; + mapsPlatformDatasetsV1AlphaStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of MapsPlatformDatasetsV1AlphaClient. + * + * @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 MapsPlatformDatasetsV1AlphaClient({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 MapsPlatformDatasetsV1AlphaClient; + 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 = { + datasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/datasets/{dataset}' + ), + }; + + // 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 = { + listDatasetVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'datasets'), + listDatasets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'datasets') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha', 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.mapsPlatformDatasetsV1AlphaStub) { + return this.mapsPlatformDatasetsV1AlphaStub; + } + + // Put together the "service stub" for + // google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha. + this.mapsPlatformDatasetsV1AlphaStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha, + 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 mapsPlatformDatasetsV1AlphaStubMethods = + ['createDataset', 'updateDatasetMetadata', 'getDataset', 'listDatasetVersions', 'listDatasets', 'deleteDataset', 'deleteDatasetVersion']; + for (const methodName of mapsPlatformDatasetsV1AlphaStubMethods) { + const callPromise = this.mapsPlatformDatasetsV1AlphaStub.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.mapsPlatformDatasetsV1AlphaStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'mapsplatformdatasets.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 'mapsplatformdatasets.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Create a new dataset for the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent project that will own the dataset. + * Format: projects/{$project_number} + * @param {google.maps.mapsplatformdatasets.v1alpha.Dataset} request.dataset + * Required. The dataset version 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 {@link protos.google.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. + * Please see the {@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/maps_platform_datasets_v1_alpha.create_dataset.js + * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_CreateDataset_async + */ + createDataset( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|undefined, {}|undefined + ]>; + createDataset( + request: protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest, + options: CallOptions, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|null|undefined, + {}|null|undefined>): void; + createDataset( + request: protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|null|undefined, + {}|null|undefined>): void; + createDataset( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createDataset(request, options, callback); + } +/** + * Update the metadata for the dataset. To update the data use: UploadDataset. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.maps.mapsplatformdatasets.v1alpha.Dataset} request.dataset + * Required. The dataset to update. The dataset's name is used to identify the dataset + * to be updated. The name has the format: + * projects/{project}/datasets/{dataset_id} + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. Support the value "*" for full + * replacement. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. + * Please see the {@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/maps_platform_datasets_v1_alpha.update_dataset_metadata.js + * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_UpdateDatasetMetadata_async + */ + updateDatasetMetadata( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|undefined, {}|undefined + ]>; + updateDatasetMetadata( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest, + options: CallOptions, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|null|undefined, + {}|null|undefined>): void; + updateDatasetMetadata( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|null|undefined, + {}|null|undefined>): void; + updateDatasetMetadata( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'dataset.name': request.dataset!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateDatasetMetadata(request, options, callback); + } +/** + * Get the published or latest version of the dataset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name. Can also fetch a specified version + * projects/{project}/datasets/{dataset_id} + * projects/{project}/datasets/{dataset_id}@{version-id} + * + * In order to retrieve a previous version of the dataset, also provide + * the version ID. + * Example: projects/123/datasets/assisted-driving-preferences@c7cfa2a8 + * @param {google.maps.mapsplatformdatasets.v1alpha.Usage} request.publishedUsage + * If specified, will fetch the dataset details of the version published for + * the specified use case rather than the latest, if one exists. If a + * published version does not exist, will default to getting the dataset + * details of the latest version. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. + * Please see the {@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/maps_platform_datasets_v1_alpha.get_dataset.js + * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_GetDataset_async + */ + getDataset( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|undefined, {}|undefined + ]>; + getDataset( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest, + options: CallOptions, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|null|undefined, + {}|null|undefined>): void; + getDataset( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest, + callback: Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|null|undefined, + {}|null|undefined>): void; + getDataset( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, + protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getDataset(request, options, callback); + } +/** + * Delete the specified dataset and optionally all its corresponding + * versions. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Format: projects/${project}/datasets/{dataset_id} + * @param {boolean} request.force + * If set to true, any dataset version for this dataset will also be deleted. + * (Otherwise, the request will only work if the dataset has no versions.) + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset.js + * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDataset_async + */ + deleteDataset( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|undefined, {}|undefined + ]>; + deleteDataset( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|null|undefined, + {}|null|undefined>): void; + deleteDataset( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|null|undefined, + {}|null|undefined>): void; + deleteDataset( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteDataset(request, options, callback); + } +/** + * Delete a specific version of the dataset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Format: projects/${project}/datasets/{dataset_id}@{version-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/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset_version.js + * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDatasetVersion_async + */ + deleteDatasetVersion( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|undefined, {}|undefined + ]>; + deleteDatasetVersion( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|null|undefined, + {}|null|undefined>): void; + deleteDatasetVersion( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|null|undefined, + {}|null|undefined>): void; + deleteDatasetVersion( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteDatasetVersion(request, options, callback); + } + + /** + * List all the versions of a dataset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the dataset to list all the versions for. + * @param {number} request.pageSize + * The maximum number of versions to return per page. + * If unspecified (or zero), at most 1000 versions will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * The page token, received from a previous GetDatasetVersions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. + * 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 `listDatasetVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDatasetVersions( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[], + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest|null, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse + ]>; + listDatasetVersions( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): void; + listDatasetVersions( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, + callback: PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): void; + listDatasetVersions( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>, + callback?: PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[], + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest|null, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.listDatasetVersions(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.name + * Required. The name of the dataset to list all the versions for. + * @param {number} request.pageSize + * The maximum number of versions to return per page. + * If unspecified (or zero), at most 1000 versions will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * The page token, received from a previous GetDatasetVersions call. + * Provide this to retrieve the subsequent page. + * @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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset} 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 `listDatasetVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDatasetVersionsStream( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, + 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({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listDatasetVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDatasetVersions.createStream( + this.innerApiCalls.listDatasetVersions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDatasetVersions`, 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.name + * Required. The name of the dataset to list all the versions for. + * @param {number} request.pageSize + * The maximum number of versions to return per page. + * If unspecified (or zero), at most 1000 versions will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * The page token, received from a previous GetDatasetVersions call. + * Provide this to retrieve the subsequent page. + * @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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. 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/maps_platform_datasets_v1_alpha.list_dataset_versions.js + * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasetVersions_async + */ + listDatasetVersionsAsync( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, + 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({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listDatasetVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDatasetVersions.asyncIterate( + this.innerApiCalls['listDatasetVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List all the datasets for the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project to list all the datasets for. + * @param {number} request.pageSize + * The maximum number of versions to return per page. + * If unspecified (or zero), at most 1000 datasets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * The page token, received from a previous GetDatasetVersions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. + * 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 `listDatasetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDatasets( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[], + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest|null, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse + ]>; + listDatasets( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): void; + listDatasets( + request: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, + callback: PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): void; + listDatasets( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>, + callback?: PaginationCallback< + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse|null|undefined, + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): + Promise<[ + protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[], + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest|null, + protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listDatasets(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 name of the project to list all the datasets for. + * @param {number} request.pageSize + * The maximum number of versions to return per page. + * If unspecified (or zero), at most 1000 datasets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * The page token, received from a previous GetDatasetVersions call. + * Provide this to retrieve the subsequent page. + * @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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset} 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 `listDatasetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDatasetsStream( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, + 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['listDatasets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDatasets.createStream( + this.innerApiCalls.listDatasets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDatasets`, 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 name of the project to list all the datasets for. + * @param {number} request.pageSize + * The maximum number of versions to return per page. + * If unspecified (or zero), at most 1000 datasets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * The page token, received from a previous GetDatasetVersions call. + * Provide this to retrieve the subsequent page. + * @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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. 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/maps_platform_datasets_v1_alpha.list_datasets.js + * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasets_async + */ + listDatasetsAsync( + request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, + 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['listDatasets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDatasets.asyncIterate( + this.innerApiCalls['listDatasets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified dataset resource name string. + * + * @param {string} project + * @param {string} dataset + * @returns {string} Resource name string. + */ + datasetPath(project:string,dataset:string) { + return this.pathTemplates.datasetPathTemplate.render({ + project: project, + dataset: dataset, + }); + } + + /** + * Parse the project from Dataset resource. + * + * @param {string} datasetName + * A fully-qualified path representing Dataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDatasetName(datasetName: string) { + return this.pathTemplates.datasetPathTemplate.match(datasetName).project; + } + + /** + * Parse the dataset from Dataset resource. + * + * @param {string} datasetName + * A fully-qualified path representing Dataset resource. + * @returns {string} A string representing the dataset. + */ + matchDatasetFromDatasetName(datasetName: string) { + return this.pathTemplates.datasetPathTemplate.match(datasetName).dataset; + } + + /** + * 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.mapsPlatformDatasetsV1AlphaStub && !this._terminated) { + return this.mapsPlatformDatasetsV1AlphaStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client_config.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client_config.json new file mode 100644 index 00000000000..9e8456f41a6 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client_config.json @@ -0,0 +1,72 @@ +{ + "interfaces": { + "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha": { + "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": { + "CreateDataset": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateDatasetMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDataset": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListDatasetVersions": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListDatasets": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteDataset": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteDatasetVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_proto_list.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_proto_list.json new file mode 100644 index 00000000000..07d014af0bc --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_proto_list.json @@ -0,0 +1,6 @@ +[ + "../../protos/google/maps/mapsplatformdatasets/v1alpha/data_source.proto", + "../../protos/google/maps/mapsplatformdatasets/v1alpha/dataset.proto", + "../../protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto", + "../../protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets_alpha_service.proto" +] diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..5a27191f69d --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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 mapsplatformdatasets = require('@googlemaps/maps-platform-datasets'); + +function main() { + const mapsPlatformDatasetsV1AlphaClient = new mapsplatformdatasets.MapsPlatformDatasetsV1AlphaClient(); +} + +main(); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..96ef770fc79 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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 {MapsPlatformDatasetsV1AlphaClient} from '@googlemaps/maps-platform-datasets'; + +// check that the client class type name can be used +function doStuffWithMapsPlatformDatasetsV1AlphaClient(client: MapsPlatformDatasetsV1AlphaClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const mapsPlatformDatasetsV1AlphaClient = new MapsPlatformDatasetsV1AlphaClient(); + doStuffWithMapsPlatformDatasetsV1AlphaClient(mapsPlatformDatasetsV1AlphaClient); +} + +main(); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/install.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1alpha/test/gapic_maps_platform_datasets_v1_alpha_v1alpha.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/test/gapic_maps_platform_datasets_v1_alpha_v1alpha.ts new file mode 100644 index 00000000000..cf3fa041dca --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/test/gapic_maps_platform_datasets_v1_alpha_v1alpha.ts @@ -0,0 +1,1272 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 mapsplatformdatasetsv1alphaModule 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('v1alpha.MapsPlatformDatasetsV1AlphaClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.mapsPlatformDatasetsV1AlphaStub, undefined); + await client.initialize(); + assert(client.mapsPlatformDatasetsV1AlphaStub); + }); + + it('has close method for the initialized client', done => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.mapsPlatformDatasetsV1AlphaStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.mapsPlatformDatasetsV1AlphaStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + 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 mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + 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('createDataset', () => { + it('invokes createDataset without error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() + ); + client.innerApiCalls.createDataset = stubSimpleCall(expectedResponse); + const [response] = await client.createDataset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDataset without error using callback', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() + ); + client.innerApiCalls.createDataset = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDataset( + request, + (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDataset with error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDataset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createDataset(request), expectedError); + const actualRequest = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDataset with closed client', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createDataset(request), expectedError); + }); + }); + + describe('updateDatasetMetadata', () => { + it('invokes updateDatasetMetadata without error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest() + ); + request.dataset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest', ['dataset', 'name']); + request.dataset.name = defaultValue1; + const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() + ); + client.innerApiCalls.updateDatasetMetadata = stubSimpleCall(expectedResponse); + const [response] = await client.updateDatasetMetadata(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDatasetMetadata without error using callback', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest() + ); + request.dataset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest', ['dataset', 'name']); + request.dataset.name = defaultValue1; + const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() + ); + client.innerApiCalls.updateDatasetMetadata = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDatasetMetadata( + request, + (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDatasetMetadata with error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest() + ); + request.dataset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest', ['dataset', 'name']); + request.dataset.name = defaultValue1; + const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDatasetMetadata = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateDatasetMetadata(request), expectedError); + const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDatasetMetadata with closed client', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest() + ); + request.dataset ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest', ['dataset', 'name']); + request.dataset.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateDatasetMetadata(request), expectedError); + }); + }); + + describe('getDataset', () => { + it('invokes getDataset without error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() + ); + client.innerApiCalls.getDataset = stubSimpleCall(expectedResponse); + const [response] = await client.getDataset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDataset without error using callback', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() + ); + client.innerApiCalls.getDataset = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDataset( + request, + (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDataset with error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDataset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDataset(request), expectedError); + const actualRequest = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDataset with closed client', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDataset(request), expectedError); + }); + }); + + describe('deleteDataset', () => { + it('invokes deleteDataset without error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDataset = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDataset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDataset without error using callback', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDataset = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDataset( + 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.deleteDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDataset with error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDataset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteDataset(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDataset with closed client', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteDataset(request), expectedError); + }); + }); + + describe('deleteDatasetVersion', () => { + it('invokes deleteDatasetVersion without error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDatasetVersion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDatasetVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDatasetVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDatasetVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDatasetVersion without error using callback', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDatasetVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDatasetVersion( + 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.deleteDatasetVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDatasetVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDatasetVersion with error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDatasetVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteDatasetVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDatasetVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDatasetVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDatasetVersion with closed client', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteDatasetVersion(request), expectedError); + }); + }); + + describe('listDatasetVersions', () => { + it('invokes listDatasetVersions without error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + ]; + client.innerApiCalls.listDatasetVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listDatasetVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDatasetVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDatasetVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatasetVersions without error using callback', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + ]; + client.innerApiCalls.listDatasetVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDatasetVersions( + request, + (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDatasetVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDatasetVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatasetVersions with error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDatasetVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDatasetVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listDatasetVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDatasetVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatasetVersionsStream without error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + ]; + client.descriptors.page.listDatasetVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDatasetVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset[] = []; + stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset) => { + 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.listDatasetVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDatasetVersions, request)); + assert( + (client.descriptors.page.listDatasetVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDatasetVersionsStream with error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDatasetVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDatasetVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset[] = []; + stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDatasetVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDatasetVersions, request)); + assert( + (client.descriptors.page.listDatasetVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDatasetVersions without error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + ]; + client.descriptors.page.listDatasetVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[] = []; + const iterable = client.listDatasetVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDatasetVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDatasetVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDatasetVersions with error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDatasetVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDatasetVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDatasetVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDatasetVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listDatasets', () => { + it('invokes listDatasets without error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + ]; + client.innerApiCalls.listDatasets = stubSimpleCall(expectedResponse); + const [response] = await client.listDatasets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatasets without error using callback', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + ]; + client.innerApiCalls.listDatasets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDatasets( + request, + (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatasets with error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDatasets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDatasets(request), expectedError); + const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatasetsStream without error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + ]; + client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDatasetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset[] = []; + stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset) => { + 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.listDatasets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); + assert( + (client.descriptors.page.listDatasets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDatasetsStream with error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDatasetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset[] = []; + stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDatasets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); + assert( + (client.descriptors.page.listDatasets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDatasets without error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), + ]; + client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[] = []; + const iterable = client.listDatasetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDatasets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDatasets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDatasets with error', async () => { + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDatasetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDatasets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDatasets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('dataset', () => { + const fakePath = "/rendered/path/dataset"; + const expectedParameters = { + project: "projectValue", + dataset: "datasetValue", + }; + const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.datasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.datasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('datasetPath', () => { + const result = client.datasetPath("projectValue", "datasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.datasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDatasetName', () => { + const result = client.matchProjectFromDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.datasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDatasetFromDatasetName', () => { + const result = client.matchDatasetFromDatasetName(fakePath); + assert.strictEqual(result, "datasetValue"); + assert((client.pathTemplates.datasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/tsconfig.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1alpha/webpack.config.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/webpack.config.js new file mode 100644 index 00000000000..e1a04f6cee0 --- /dev/null +++ b/owl-bot-staging/google-maps-mapsplatformdatasets/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: 'MapsPlatformDatasetsV1Alpha', + filename: './maps-platform-datasets-v1-alpha.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-maps-places/v1/.eslintignore b/owl-bot-staging/google-maps-places/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-maps-places/v1/.eslintrc.json b/owl-bot-staging/google-maps-places/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-maps-places/v1/.gitignore b/owl-bot-staging/google-maps-places/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-maps-places/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-maps-places/v1/.jsdoc.js b/owl-bot-staging/google-maps-places/v1/.jsdoc.js new file mode 100644 index 00000000000..ffd96935e51 --- /dev/null +++ b/owl-bot-staging/google-maps-places/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: '@googlemaps/places', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-maps-places/v1/.mocharc.js b/owl-bot-staging/google-maps-places/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-maps-places/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-maps-places/v1/.prettierrc.js b/owl-bot-staging/google-maps-places/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-maps-places/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-maps-places/v1/README.md b/owl-bot-staging/google-maps-places/v1/README.md new file mode 100644 index 00000000000..0e091236257 --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/README.md @@ -0,0 +1 @@ +Places: Nodejs Client diff --git a/owl-bot-staging/google-maps-places/v1/package.json b/owl-bot-staging/google-maps-places/v1/package.json new file mode 100644 index 00000000000..48485cfb41d --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@googlemaps/places", + "version": "0.1.0", + "description": "Places client for Node.js", + "repository": "googleapis/nodejs-places", + "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 places", + "places", + "places" + ], + "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-maps-places/v1/protos/google/geo/type/viewport.proto b/owl-bot-staging/google-maps-places/v1/protos/google/geo/type/viewport.proto new file mode 100644 index 00000000000..ad5029f8360 --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/protos/google/geo/type/viewport.proto @@ -0,0 +1,69 @@ +// 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.geo.type; + +import "google/type/latlng.proto"; + +option go_package = "google.golang.org/genproto/googleapis/geo/type/viewport;viewport"; +option java_multiple_files = true; +option java_outer_classname = "ViewportProto"; +option java_package = "com.google.geo.type"; +option objc_class_prefix = "GGTP"; + +// A latitude-longitude viewport, represented as two diagonally opposite `low` +// and `high` points. A viewport is considered a closed region, i.e. it includes +// its boundary. The latitude bounds must range between -90 to 90 degrees +// inclusive, and the longitude bounds must range between -180 to 180 degrees +// inclusive. Various cases include: +// +// - If `low` = `high`, the viewport consists of that single point. +// +// - If `low.longitude` > `high.longitude`, the longitude range is inverted +// (the viewport crosses the 180 degree longitude line). +// +// - If `low.longitude` = -180 degrees and `high.longitude` = 180 degrees, +// the viewport includes all longitudes. +// +// - If `low.longitude` = 180 degrees and `high.longitude` = -180 degrees, +// the longitude range is empty. +// +// - If `low.latitude` > `high.latitude`, the latitude range is empty. +// +// Both `low` and `high` must be populated, and the represented box cannot be +// empty (as specified by the definitions above). An empty viewport will result +// in an error. +// +// For example, this viewport fully encloses New York City: +// +// { +// "low": { +// "latitude": 40.477398, +// "longitude": -74.259087 +// }, +// "high": { +// "latitude": 40.91618, +// "longitude": -73.70018 +// } +// } +message Viewport { + // Required. The low point of the viewport. + google.type.LatLng low = 1; + + // Required. The high point of the viewport. + google.type.LatLng high = 2; +} diff --git a/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/geometry.proto b/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/geometry.proto new file mode 100644 index 00000000000..62596e7c2be --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/geometry.proto @@ -0,0 +1,42 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.places.v1; + +import "google/api/field_behavior.proto"; +import "google/type/latlng.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Places.V1"; +option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb"; +option java_multiple_files = true; +option java_outer_classname = "GeometryProto"; +option java_package = "com.google.maps.places.v1"; +option objc_class_prefix = "GMPSV1"; +option php_namespace = "Google\\Maps\\Places\\V1"; + +// Circle with a LatLng as center and radius. +message Circle { + // Required. Center latitude and longitude. + // + // The range of latitude must be within `[-90.0, 90.0]`. The range of the + // longitude must be within `[-180.0, 180.0]`. + google.type.LatLng center = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Radius measured in meters. The radius must be within `[0.0, + // 50000.0]`. + double radius = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/place.proto b/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/place.proto new file mode 100644 index 00000000000..2372f3629dc --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/place.proto @@ -0,0 +1,424 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.places.v1; + +import "google/api/field_behavior.proto"; +import "google/geo/type/viewport.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/date.proto"; +import "google/type/latlng.proto"; +import "google/type/localized_text.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Places.V1"; +option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb"; +option java_multiple_files = true; +option java_outer_classname = "PlaceProto"; +option java_package = "com.google.maps.places.v1"; +option objc_class_prefix = "GMPSV1"; +option php_namespace = "Google\\Maps\\Places\\V1"; + +// All the information representing a Place. +message Place { + // The structured components that form the formatted address, if this + // information is available. + message AddressComponent { + // The full text description or name of the address component. For example, + // an address component for the country Australia may have a long_name of + // "Australia". + string long_text = 1; + + // An abbreviated textual name for the address component, if available. For + // example, an address component for the country of Australia may have a + // short_name of "AU". + string short_text = 2; + + // An array indicating the type(s) of the address component. + repeated string types = 3; + + // The language used to format this components, in CLDR notation. + string language_code = 4; + } + + // Plus code (http://plus.codes) is a location reference with two formats: + // global code defining a 14mx14m (1/8000th of a degree) or smaller rectangle, + // and compound code, replacing the prefix with a reference location. + message PlusCode { + // Place's global (full) code, such as `9FWM33GV+HQ`, representing an + // 1/8000 by 1/8000 degree area (~14 by 14 meters). + string global_code = 1; + + // Place's compound code, such as `33GV+HQ, Ramberg, Norway`, containing + // the suffix of the global code and replacing the prefix with a formatted + // name of a reference entity. + string compound_code = 2; + } + + // Information about a review of the place. + message Review { + // Timestamp for the review, expressed in seconds since epoch. + google.protobuf.Timestamp publish_time = 1; + + // A string of formatted recent time, expressing the review time relative + // to the current time in a form appropriate for the language and country. + string relative_publish_time_description = 2; + + // The localized text of the review. + google.type.LocalizedText text = 9; + + // The name of the review author. + string author = 4; + + // A link to the review author's profile. + string author_uri = 5; + + // The author's profile photo. + string author_photo_uri = 6; + + // A whole number between 1.0 and 5.0, a.k.a. the number of stars. + double rating = 7; + + // A BCP-47 language code indicating the original language of the review. + // If the review has been translated, then original_language != language. + // This field contains the main language tag only, and not the secondary tag + // indicating country or region. For example, all the English reviews are + // tagged as 'en', and not 'en-AU' or 'en-UK' and so on.This field is empty + // if there is only a rating with no review text. + string original_language_code = 10; + + // A boolean value indicating if the review was translated from the original + // language it was written in. If a review has been translated, + // corresponding to a value of true, Google recommends that you indicate + // this to your users. For example, you can add the following string, + // “Translated by Google”, to the review. + bool translated = 11; + } + + // Information about business hour of the place. + message OpeningHours { + // A period the place remains in open_now status. + message OpeningHoursPeriod { + // Status changing points. + message OpeningHoursPoint { + // A day of the week, as an integer in the range 0-6. 0 is Sunday, 1 is + // Monday, etc. + optional int32 day = 1; + + // The hour in 2 digits. Ranges from 00 to 23. + optional int32 hour = 2; + + // The minute in 2 digits. Ranges from 00 to 59. + optional int32 minute = 3; + + // Date of the endpoint expressed in `RFC3339` format in the local + // timezone for the place. For example 2010-12-31. + string date_deprecated = 4 [deprecated = true]; + + // Date in the local timezone for the place. + google.type.Date date = 6; + + // Whether or not this endpoint was truncated. Truncation occurs when + // the real hours are outside the times we are willing to return hours + // between, so we truncate the hours back to these boundaries. This + // ensures that at most `24 * 7` hours from midnight of the day of the + // request are returned. + bool truncated = 5; + } + + // The time that the place starts to be open. + OpeningHoursPoint open = 1; + + // The time that the place starts to be closed. + OpeningHoursPoint close = 2; + } + + // A type used to identify the type of secondary hours. + enum SecondaryHourType { + // Default value when secondary hour type is not specified. + SECONDARY_HOUR_TYPE_UNSPECIFIED = 0; + + // The drive-through hour for banks, restaurants, or pharmacies. + DRIVE_THROUGH = 1; + + // The happy hour. + HAPPY_HOUR = 2; + + // The delivery hour. + DELIVERY = 3; + + // The takeout hour. + TAKEOUT = 4; + + // The kitchen hour. + KITCHEN = 5; + + // The breakfast hour. + BREAKFAST = 6; + + // The lunch hour. + LUNCH = 7; + + // The dinner hour. + DINNER = 8; + + // The brunch hour. + BRUNCH = 9; + + // The pickup hour. + PICKUP = 10; + + // The access hours for storage places. + ACCESS = 11; + + // The special hours for seniors. + SENIOR_HOURS = 12; + + // The online service hours. + ONLINE_SERVICE_HOURS = 13; + } + + // Structured information for special days that fall within the period that + // the returned opening hours cover. Special days are days that could impact + // the business hours of a place, e.g. Christmas day. + message SpecialDay { + // The date of this special day. + google.type.Date date = 1; + } + + // Is this place open right now? Always present unless we lack time-of-day + // or timezone data for these opening hours. + bool open_now = 1; + + // The periods that this place is open during the week. The periods are in + // chronological order, starting with Sunday in the place-local timezone. An + // empty (but not absent) value indicates a place that is never open, e.g. + // because it is closed temporarily for renovations. + repeated OpeningHoursPeriod periods = 2; + + // Localized strings describing the opening hours of this place, one string + // for each day of the week. Will be empty if the hours are unknown or + // could not be converted to localized text. Example: "Sun: 18:00–06:00" + repeated string weekday_descriptions = 3; + + // A type string used to identify the type of secondary hours. + SecondaryHourType secondary_hour_type = 4; + + // Structured information for special days that fall within the period that + // the returned opening hours cover. Special days are days that could impact + // the business hours of a place, e.g. Christmas day. Set for + // current_opening_hours and current_secondary_opening_hours if there are + // exceptional hours. + repeated SpecialDay special_days = 5; + } + + // Business status for the place. + enum BusinessStatus { + // Default value. This value is unused. + BUSINESS_STATUS_UNSPECIFIED = 0; + + // The establishment is operational, not necessarily open now. + OPERATIONAL = 1; + + // The establishment is temporarily closed. + CLOSED_TEMPORARILY = 2; + + // The establishment is permanently closed. + CLOSED_PERMANENTLY = 3; + } + + // Information about data providers of this place. + message Attribution { + // Name of the Place's data provider. + string provider = 1; + + // URI to the Place's data provider. + string provider_uri = 2; + } + + // Contains a summary of the place. + message EditorialSummary { + // A summary is comprised of a textual overview, and also includes the + // language code for these if applicable. Summary text must be presented + // as-is and can not be modified or altered. + google.type.LocalizedText overview = 1; + } + + // Required. The unique identifier of a place. + string id = 2 [(google.api.field_behavior) = REQUIRED]; + + // The localized name of the place, suitable as a short human-readable + // description. For example, "Google Sydney", "Starbucks", "Pyrmont", etc. + google.type.LocalizedText display_name = 31; + + // A set of type tags for this result. For example, "political" and + // "locality". + repeated string types = 5; + + // A human-readable phone number for the place, in national format. + string national_phone_number = 7; + + // A human-readable phone number for the place, in international format. + string international_phone_number = 8; + + // A full, human-readable address for this place. + string formatted_address = 9; + + // Repeated components for each locality level. + repeated AddressComponent address_components = 10; + + // Plus code of the place location lat/long. + PlusCode plus_code = 11; + + // The position of this place. + google.type.LatLng location = 12; + + // A viewport suitable for displaying the place on an average-sized map. + google.geo.type.Viewport viewport = 13; + + // A rating between 1.0 and 5.0, based on user reviews of this place. + double rating = 14; + + // A URL providing more information about this place. + string google_maps_uri = 15; + + // The authoritative website for this place, e.g. a business' homepage. + // Note that for places that are part of a chain (e.g. an IKEA store), this + // will usually be the website for the individual store, not the overall + // chain. + string website_uri = 16; + + // List of reviews about this place. + repeated Review reviews = 20; + + // The regular hours of operation. + OpeningHours opening_hours = 21; + + // Number of minutes this place's timezone is currently offset from UTC. + // This is expressed in minutes to support timezones that are offset by + // fractions of an hour, e.g. X hours and 15 minutes. + int32 utc_offset_minutes = 22; + + // The place's address in adr microformat: http://microformats.org/wiki/adr. + string adr_format_address = 24; + + // The business status for the place. + BusinessStatus business_status = 25; + + // Price level of the place. + PriceLevel price_level = 26; + + // A set of data provider that must be shown with this result. + repeated Attribution attributions = 27; + + // The total number of reviews (with or without text) for this place. + int32 user_rating_count = 28; + + // A truncated URL to an v2 icon mask. User can access different icon type by + // appending type suffix to the end (eg, ".svg" or ".png"). + string icon_mask_base_uri = 29; + + // Background color for icon_mask in hex format, e.g. #909CE1. + string icon_background_color = 30; + + // Specifies if the business supports takeout. + optional bool takeout = 33; + + // Specifies if the business supports delivery. + optional bool delivery = 34; + + // Specifies if the business supports indoor or outdoor seating options. + optional bool dine_in = 35; + + // Specifies if the business supports curbside pickup. + optional bool curbside_pickup = 36; + + // Specifies if the place has an entrance that is wheelchair-accessible. + optional bool wheelchair_accessible_entrance = 37; + + // Specifies if the place supports reservations. + optional bool reservable = 38; + + // Specifies if the place serves breakfast. + optional bool serves_breakfast = 39; + + // Specifies if the place serves lunch. + optional bool serves_lunch = 40; + + // Specifies if the place serves dinner. + optional bool serves_dinner = 41; + + // Specifies if the place serves beer. + optional bool serves_beer = 42; + + // Specifies if the place serves wine. + optional bool serves_wine = 43; + + // Specifies if the place serves brunch. + optional bool serves_brunch = 44; + + // Specifies if the place serves vegetarian food. + optional bool serves_vegetarian_food = 45; + + // The hours of operation for the next seven days (including today). The time + // period starts at midnight on the date of the request and ends at 11:59 pm + // six days later. This field includes the special_days subfield of all hours, + // set for dates that have exceptional hours. + OpeningHours current_opening_hours = 46; + + // Contains an array of entries for the next seven days including information + // about secondary hours of a business. Secondary hours are different from a + // business's main hours. For example, a restaurant can specify drive through + // hours or delivery hours as its secondary hours. This field populates the + // type subfield, which draws from a predefined list of opening hours types + // (such as DRIVE_THROUGH, PICKUP, or TAKEOUT) based on the types of the + // place. This field includes the special_days subfield of all hours, set for + // dates that have exceptional hours. + repeated OpeningHours current_secondary_opening_hours = 47; + + // Contains an array of entries for information about regular secondary hours + // of a business. Secondary hours are different from a business's main hours. + // For example, a restaurant can specify drive through hours or delivery hours + // as its secondary hours. This field populates the type subfield, which draws + // from a predefined list of opening hours types (such as DRIVE_THROUGH, + // PICKUP, or TAKEOUT) based on the types of the place. + repeated OpeningHours secondary_opening_hours = 49; + + // Contains a summary of the place. A summary is comprised of a textual + // overview, and also includes the language code for these if applicable. + // Summary text must be presented as-is and can not be modified or altered. + EditorialSummary editorial_summary = 48; +} + +// Price level of the place. +enum PriceLevel { + // Place price level is unspecified or unknown. + PRICE_LEVEL_UNSPECIFIED = 0; + + FREE = 1; + + // Place provides inexpensive services. + INEXPENSIVE = 2; + + // Place provides moderately priced services. + MODERATE = 3; + + // Place provides expensive services. + EXPENSIVE = 4; + + // Place provides very expensive services. + VERY_EXPENSIVE = 5; +} diff --git a/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/places_service.proto b/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/places_service.proto new file mode 100644 index 00000000000..b8b8ab69d98 --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/places_service.proto @@ -0,0 +1,199 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.places.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/geo/type/viewport.proto"; +import "google/maps/places/v1/geometry.proto"; +import "google/maps/places/v1/place.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Places.V1"; +option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb"; +option java_multiple_files = true; +option java_outer_classname = "PlacesServiceProto"; +option java_package = "com.google.maps.places.v1"; +option objc_class_prefix = "GMPSV1"; +option php_namespace = "Google\\Maps\\Places\\V1"; + +// Service definition for the Places API. +service Places { + option (google.api.default_host) = "places.googleapis.com"; + + // Text query based place search. + rpc SearchText(SearchTextRequest) returns (SearchTextResponse) { + option (google.api.http) = { + post: "/v1/Text:search" + body: "*" + }; + } +} + +// int 32 range. Both min and max are optional. If only min is set, then the +// range only has a lower bound. If only max is set, then range only has an +// upper bound. At least one of min and max must be set. Values are inclusive. +message Int32Range { + // Lower bound. If unset, behavior is documented on the range field. + optional int32 min = 1; + + // Upper bound. If unset, behavior is documented on the range field. + optional int32 max = 2; +} + +// Request data structure for SearchText. +message SearchTextRequest { + // How results will be ranked in the response. + enum RankPreference { + // RankPreference value not set. Will default to DISTANCE. + RANK_PREFERENCE_UNSPECIFIED = 0; + + // Ranks results by distance. + DISTANCE = 1; + + // Ranks results by relevance. Sort order determined by normal ranking + // stack. See SortRefinement::RELEVANCE. + RELEVANCE = 2; + } + + // The region to search. + // + // Deprecated. Use LocationRestriction or LocationBias instead. + message Location { + oneof type { + // A rectangle box defined by northeast and southwest corner. + google.geo.type.Viewport rectangle = 1; + } + + // Make location field a strict restriction and filter out POIs outside of + // the given location. If location type field is unset this field will have + // no effect. + bool strict_restriction = 2; + } + + // The region to search. This location serves as a bias which means results + // around given location might be returned. + message LocationBias { + oneof type { + // A rectangle box defined by northeast and southwest corner. + google.geo.type.Viewport rectangle = 1; + + // A circle defined by center point and radius. + Circle circle = 2; + } + } + + // The region to search. This location serves as a restriction which means + // results outside given location will not be returned. + message LocationRestriction { + oneof type { + // A rectangle box defined by northeast and southwest corner. + google.geo.type.Viewport rectangle = 1; + } + } + + // Required. The text query for textual search. + string text_query = 1 [(google.api.field_behavior) = REQUIRED]; + + // Place details will be displayed with the preferred language if available. + // If the language code is unspecified or unrecognized, place details of any + // language may be returned, with a preference for English if such details + // exist. + // + // Current list of supported languages: + // https://developers.google.com/maps/faq#languagesupport. + string language_code = 2; + + // The Unicode country/region code (CLDR) of the location where the + // request is coming from. It is used to display the place details, like + // region-specific place name, if available. + // + // For more information, see + // http://www.unicode.org/reports/tr35/#unicode_region_subtag. + // + // + // Note that 3-digit region codes are not currently supported. + string region_code = 3; + + // How results will be ranked in the response. + RankPreference rank_preference = 4; + + // The region to search. Setting location would usually yields + // better results. Recommended to set. This location serves as a bias unless + // strict_restriction is set to true, which turns the location to a strict + // restriction. + // + // Deprecated. Use LocationRestriction or LocationBias instead. + Location location = 5 [deprecated = true]; + + // The requested place type. Full list of types supported: + // https://developers.google.com/places/supported_types. Only support one + // included type. + string included_type = 6; + + // Used to restrict the search to places that are open at a specific time. + // open_now marks if a business is currently open. + bool open_now = 7; + + // [Deprecated!]Used to restrict the search to places that are within a + // certain price range. This is on a scale of 0 to 4. Set a minimum of 0 or + // set a maximum of 4 has no effect on the search results. Min price is + // default to 0 and max price is default to 4. Default value will be used if + // either min or max is unset. + Int32Range price_range = 8 [deprecated = true]; + + // Filter out results whose average user rating is strictly less than this + // limit. A valid value must be an float between 0 and 5 (inclusively) at a + // 0.5 cadence i.e. `[0, 0.5, 1.0, ... , 5.0]` inclusively. This is to keep + // parity with LocalRefinement_UserRating. The input rating will round up to + // the nearest 0.5(ceiling). For instance, a rating of 0.6 will eliminate all + // results with a less than 1.0 rating. + double min_rating = 9; + + // Maximum number of results to return. It must be between 1 and 20, + // inclusively. If the number is unset, it falls back to the upper limit. If + // the number is set to negative or exceeds the upper limit, an + // INVALID_ARGUMENT error is returned. + int32 max_result_count = 10; + + // Used to restrict the search to places that are marked as certain price + // levels. Users can choose any combinations of price levels. Default to + // select all price levels. + repeated PriceLevel price_levels = 11; + + // Used to set strict type filtering for included_type. If set to true, only + // results of the same type will be returned. Default to false. + bool strict_type_filtering = 12; + + // The region to search. This location serves as a bias which means results + // around given location might be returned. Cannot be set along with + // location_restriction. + LocationBias location_bias = 13; + + // The region to search. This location serves as a restriction which means + // results outside given location will not be returned. Cannot be set along + // with location_bias. + LocationRestriction location_restriction = 14; +} + +// Response proto for SearchText. +// +message SearchTextResponse { + // A list of places that meet the user's text search criteria. + repeated Place places = 1; +} diff --git a/owl-bot-staging/google-maps-places/v1/samples/generated/v1/places.search_text.js b/owl-bot-staging/google-maps-places/v1/samples/generated/v1/places.search_text.js new file mode 100644 index 00000000000..cd132b6f779 --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/samples/generated/v1/places.search_text.js @@ -0,0 +1,133 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(textQuery) { + // [START places_v1_generated_Places_SearchText_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The text query for textual search. + */ + // const textQuery = 'abc123' + /** + * Place details will be displayed with the preferred language if available. + * If the language code is unspecified or unrecognized, place details of any + * language may be returned, with a preference for English if such details + * exist. + * Current list of supported languages: + * https://developers.google.com/maps/faq#languagesupport. + */ + // const languageCode = 'abc123' + /** + * The Unicode country/region code (CLDR) of the location where the + * request is coming from. It is used to display the place details, like + * region-specific place name, if available. + * For more information, see + * http://www.unicode.org/reports/tr35/#unicode_region_subtag. + * Note that 3-digit region codes are not currently supported. + */ + // const regionCode = 'abc123' + /** + * How results will be ranked in the response. + */ + // const rankPreference = {} + /** + * The requested place type. Full list of types supported: + * https://developers.google.com/places/supported_types. Only support one + * included type. + */ + // const includedType = 'abc123' + /** + * Used to restrict the search to places that are open at a specific time. + * open_now marks if a business is currently open. + */ + // const openNow = true + /** + * Filter out results whose average user rating is strictly less than this + * limit. A valid value must be an float between 0 and 5 (inclusively) at a + * 0.5 cadence i.e. `[0, 0.5, 1.0, ... , 5.0]` inclusively. This is to keep + * parity with LocalRefinement_UserRating. The input rating will round up to + * the nearest 0.5(ceiling). For instance, a rating of 0.6 will eliminate all + * results with a less than 1.0 rating. + */ + // const minRating = 1234 + /** + * Maximum number of results to return. It must be between 1 and 20, + * inclusively. If the number is unset, it falls back to the upper limit. If + * the number is set to negative or exceeds the upper limit, an + * INVALID_ARGUMENT error is returned. + */ + // const maxResultCount = 1234 + /** + * Used to restrict the search to places that are marked as certain price + * levels. Users can choose any combinations of price levels. Default to + * select all price levels. + */ + // const priceLevels = [1,2,3,4] + /** + * Used to set strict type filtering for included_type. If set to true, only + * results of the same type will be returned. Default to false. + */ + // const strictTypeFiltering = true + /** + * The region to search. This location serves as a bias which means results + * around given location might be returned. Cannot be set along with + * location_restriction. + */ + // const locationBias = {} + /** + * The region to search. This location serves as a restriction which means + * results outside given location will not be returned. Cannot be set along + * with location_bias. + */ + // const locationRestriction = {} + + // Imports the Places library + const {PlacesClient} = require('@googlemaps/places').v1; + + // Instantiates a client + const placesClient = new PlacesClient(); + + async function callSearchText() { + // Construct request + const request = { + textQuery, + }; + + // Run request + const response = await placesClient.searchText(request); + console.log(response); + } + + callSearchText(); + // [END places_v1_generated_Places_SearchText_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-places/v1/samples/generated/v1/snippet_metadata_google.maps.places.v1.json b/owl-bot-staging/google-maps-places/v1/samples/generated/v1/snippet_metadata_google.maps.places.v1.json new file mode 100644 index 00000000000..eef96197d9a --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/samples/generated/v1/snippet_metadata_google.maps.places.v1.json @@ -0,0 +1,107 @@ +{ + "clientLibrary": { + "name": "nodejs-places", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.maps.places.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "places_v1_generated_Places_SearchText_async", + "title": "Places searchText Sample", + "origin": "API_DEFINITION", + "description": " Text query based place search.", + "canonical": true, + "file": "places.search_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 125, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchText", + "fullName": "google.maps.places.v1.Places.SearchText", + "async": true, + "parameters": [ + { + "name": "text_query", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "region_code", + "type": "TYPE_STRING" + }, + { + "name": "rank_preference", + "type": ".google.maps.places.v1.SearchTextRequest.RankPreference" + }, + { + "name": "location", + "type": ".google.maps.places.v1.SearchTextRequest.Location" + }, + { + "name": "included_type", + "type": "TYPE_STRING" + }, + { + "name": "open_now", + "type": "TYPE_BOOL" + }, + { + "name": "price_range", + "type": ".google.maps.places.v1.Int32Range" + }, + { + "name": "min_rating", + "type": "TYPE_DOUBLE" + }, + { + "name": "max_result_count", + "type": "TYPE_INT32" + }, + { + "name": "price_levels", + "type": "TYPE_ENUM[]" + }, + { + "name": "strict_type_filtering", + "type": "TYPE_BOOL" + }, + { + "name": "location_bias", + "type": ".google.maps.places.v1.SearchTextRequest.LocationBias" + }, + { + "name": "location_restriction", + "type": ".google.maps.places.v1.SearchTextRequest.LocationRestriction" + } + ], + "resultType": ".google.maps.places.v1.SearchTextResponse", + "client": { + "shortName": "PlacesClient", + "fullName": "google.maps.places.v1.PlacesClient" + }, + "method": { + "shortName": "SearchText", + "fullName": "google.maps.places.v1.Places.SearchText", + "service": { + "shortName": "Places", + "fullName": "google.maps.places.v1.Places" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-maps-places/v1/src/index.ts b/owl-bot-staging/google-maps-places/v1/src/index.ts new file mode 100644 index 00000000000..6b7e1657310 --- /dev/null +++ b/owl-bot-staging/google-maps-places/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 PlacesClient = v1.PlacesClient; +type PlacesClient = v1.PlacesClient; +export {v1, PlacesClient}; +export default {v1, PlacesClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-maps-places/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-maps-places/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..827d738ec76 --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/src/v1/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.maps.places.v1", + "libraryPackage": "@googlemaps/places", + "services": { + "Places": { + "clients": { + "grpc": { + "libraryClient": "PlacesClient", + "rpcs": { + "SearchText": { + "methods": [ + "searchText" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "PlacesClient", + "rpcs": { + "SearchText": { + "methods": [ + "searchText" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-maps-places/v1/src/v1/index.ts b/owl-bot-staging/google-maps-places/v1/src/v1/index.ts new file mode 100644 index 00000000000..f135558c071 --- /dev/null +++ b/owl-bot-staging/google-maps-places/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 {PlacesClient} from './places_client'; diff --git a/owl-bot-staging/google-maps-places/v1/src/v1/places_client.ts b/owl-bot-staging/google-maps-places/v1/src/v1/places_client.ts new file mode 100644 index 00000000000..86e697eca4e --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/src/v1/places_client.ts @@ -0,0 +1,436 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/places_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './places_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service definition for the Places API. + * @class + * @memberof v1 + */ +export class PlacesClient { + 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}; + placesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of PlacesClient. + * + * @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 PlacesClient({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 PlacesClient; + 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.maps.places.v1.Places', 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.placesStub) { + return this.placesStub; + } + + // Put together the "service stub" for + // google.maps.places.v1.Places. + this.placesStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.maps.places.v1.Places') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.maps.places.v1.Places, + 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 placesStubMethods = + ['searchText']; + for (const methodName of placesStubMethods) { + const callPromise = this.placesStub.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.placesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'places.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 'places.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 []; + } + + 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 -- + // ------------------- +/** + * Text query based place search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.textQuery + * Required. The text query for textual search. + * @param {string} request.languageCode + * Place details will be displayed with the preferred language if available. + * If the language code is unspecified or unrecognized, place details of any + * language may be returned, with a preference for English if such details + * exist. + * + * Current list of supported languages: + * https://developers.google.com/maps/faq#languagesupport. + * @param {string} request.regionCode + * The Unicode country/region code (CLDR) of the location where the + * request is coming from. It is used to display the place details, like + * region-specific place name, if available. + * + * For more information, see + * http://www.unicode.org/reports/tr35/#unicode_region_subtag. + * + * + * Note that 3-digit region codes are not currently supported. + * @param {google.maps.places.v1.SearchTextRequest.RankPreference} request.rankPreference + * How results will be ranked in the response. + * @param {google.maps.places.v1.SearchTextRequest.Location} request.location + * The region to search. Setting location would usually yields + * better results. Recommended to set. This location serves as a bias unless + * strict_restriction is set to true, which turns the location to a strict + * restriction. + * + * Deprecated. Use LocationRestriction or LocationBias instead. + * @param {string} request.includedType + * The requested place type. Full list of types supported: + * https://developers.google.com/places/supported_types. Only support one + * included type. + * @param {boolean} request.openNow + * Used to restrict the search to places that are open at a specific time. + * open_now marks if a business is currently open. + * @param {google.maps.places.v1.Int32Range} request.priceRange + * [Deprecated!]Used to restrict the search to places that are within a + * certain price range. This is on a scale of 0 to 4. Set a minimum of 0 or + * set a maximum of 4 has no effect on the search results. Min price is + * default to 0 and max price is default to 4. Default value will be used if + * either min or max is unset. + * @param {number} request.minRating + * Filter out results whose average user rating is strictly less than this + * limit. A valid value must be an float between 0 and 5 (inclusively) at a + * 0.5 cadence i.e. `[0, 0.5, 1.0, ... , 5.0]` inclusively. This is to keep + * parity with LocalRefinement_UserRating. The input rating will round up to + * the nearest 0.5(ceiling). For instance, a rating of 0.6 will eliminate all + * results with a less than 1.0 rating. + * @param {number} request.maxResultCount + * Maximum number of results to return. It must be between 1 and 20, + * inclusively. If the number is unset, it falls back to the upper limit. If + * the number is set to negative or exceeds the upper limit, an + * INVALID_ARGUMENT error is returned. + * @param {number[]} request.priceLevels + * Used to restrict the search to places that are marked as certain price + * levels. Users can choose any combinations of price levels. Default to + * select all price levels. + * @param {boolean} request.strictTypeFiltering + * Used to set strict type filtering for included_type. If set to true, only + * results of the same type will be returned. Default to false. + * @param {google.maps.places.v1.SearchTextRequest.LocationBias} request.locationBias + * The region to search. This location serves as a bias which means results + * around given location might be returned. Cannot be set along with + * location_restriction. + * @param {google.maps.places.v1.SearchTextRequest.LocationRestriction} request.locationRestriction + * The region to search. This location serves as a restriction which means + * results outside given location will not be returned. Cannot be set along + * with location_bias. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.maps.places.v1.SearchTextResponse|SearchTextResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/places.search_text.js + * region_tag:places_v1_generated_Places_SearchText_async + */ + searchText( + request?: protos.google.maps.places.v1.ISearchTextRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.places.v1.ISearchTextResponse, + protos.google.maps.places.v1.ISearchTextRequest|undefined, {}|undefined + ]>; + searchText( + request: protos.google.maps.places.v1.ISearchTextRequest, + options: CallOptions, + callback: Callback< + protos.google.maps.places.v1.ISearchTextResponse, + protos.google.maps.places.v1.ISearchTextRequest|null|undefined, + {}|null|undefined>): void; + searchText( + request: protos.google.maps.places.v1.ISearchTextRequest, + callback: Callback< + protos.google.maps.places.v1.ISearchTextResponse, + protos.google.maps.places.v1.ISearchTextRequest|null|undefined, + {}|null|undefined>): void; + searchText( + request?: protos.google.maps.places.v1.ISearchTextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.maps.places.v1.ISearchTextResponse, + protos.google.maps.places.v1.ISearchTextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.maps.places.v1.ISearchTextResponse, + protos.google.maps.places.v1.ISearchTextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.maps.places.v1.ISearchTextResponse, + protos.google.maps.places.v1.ISearchTextRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.searchText(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.placesStub && !this._terminated) { + return this.placesStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-maps-places/v1/src/v1/places_client_config.json b/owl-bot-staging/google-maps-places/v1/src/v1/places_client_config.json new file mode 100644 index 00000000000..dcc25703b98 --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/src/v1/places_client_config.json @@ -0,0 +1,30 @@ +{ + "interfaces": { + "google.maps.places.v1.Places": { + "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": { + "SearchText": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-maps-places/v1/src/v1/places_proto_list.json b/owl-bot-staging/google-maps-places/v1/src/v1/places_proto_list.json new file mode 100644 index 00000000000..ca12c21c188 --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/src/v1/places_proto_list.json @@ -0,0 +1,6 @@ +[ + "../../protos/google/geo/type/viewport.proto", + "../../protos/google/maps/places/v1/geometry.proto", + "../../protos/google/maps/places/v1/place.proto", + "../../protos/google/maps/places/v1/places_service.proto" +] diff --git a/owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..79e4ed8f104 --- /dev/null +++ b/owl-bot-staging/google-maps-places/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 places = require('@googlemaps/places'); + +function main() { + const placesClient = new places.PlacesClient(); +} + +main(); diff --git a/owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..56ce2c77cc4 --- /dev/null +++ b/owl-bot-staging/google-maps-places/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 {PlacesClient} from '@googlemaps/places'; + +// check that the client class type name can be used +function doStuffWithPlacesClient(client: PlacesClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const placesClient = new PlacesClient(); + doStuffWithPlacesClient(placesClient); +} + +main(); diff --git a/owl-bot-staging/google-maps-places/v1/system-test/install.ts b/owl-bot-staging/google-maps-places/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-maps-places/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-maps-places/v1/test/gapic_places_v1.ts b/owl-bot-staging/google-maps-places/v1/test/gapic_places_v1.ts new file mode 100644 index 00000000000..3fde5fedd35 --- /dev/null +++ b/owl-bot-staging/google-maps-places/v1/test/gapic_places_v1.ts @@ -0,0 +1,225 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 placesModule 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.PlacesClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = placesModule.v1.PlacesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = placesModule.v1.PlacesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = placesModule.v1.PlacesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new placesModule.v1.PlacesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new placesModule.v1.PlacesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new placesModule.v1.PlacesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.placesStub, undefined); + await client.initialize(); + assert(client.placesStub); + }); + + it('has close method for the initialized client', done => { + const client = new placesModule.v1.PlacesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.placesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new placesModule.v1.PlacesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.placesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new placesModule.v1.PlacesClient({ + 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 placesModule.v1.PlacesClient({ + 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('searchText', () => { + it('invokes searchText without error', async () => { + const client = new placesModule.v1.PlacesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.places.v1.SearchTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.maps.places.v1.SearchTextResponse() + ); + client.innerApiCalls.searchText = stubSimpleCall(expectedResponse); + const [response] = await client.searchText(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchText without error using callback', async () => { + const client = new placesModule.v1.PlacesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.places.v1.SearchTextRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.maps.places.v1.SearchTextResponse() + ); + client.innerApiCalls.searchText = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchText( + request, + (err?: Error|null, result?: protos.google.maps.places.v1.ISearchTextResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchText with error', async () => { + const client = new placesModule.v1.PlacesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.places.v1.SearchTextRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.searchText = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchText(request), expectedError); + }); + + it('invokes searchText with closed client', async () => { + const client = new placesModule.v1.PlacesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.places.v1.SearchTextRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.searchText(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-maps-places/v1/tsconfig.json b/owl-bot-staging/google-maps-places/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-maps-places/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-maps-places/v1/webpack.config.js b/owl-bot-staging/google-maps-places/v1/webpack.config.js new file mode 100644 index 00000000000..6f1933d317a --- /dev/null +++ b/owl-bot-staging/google-maps-places/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: 'Places', + filename: './places.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-maps-routing/v2/.eslintignore b/owl-bot-staging/google-maps-routing/v2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-maps-routing/v2/.eslintrc.json b/owl-bot-staging/google-maps-routing/v2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-maps-routing/v2/.gitignore b/owl-bot-staging/google-maps-routing/v2/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-maps-routing/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-maps-routing/v2/.jsdoc.js b/owl-bot-staging/google-maps-routing/v2/.jsdoc.js new file mode 100644 index 00000000000..8a30e43d717 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/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: '@googlemaps/routing', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-maps-routing/v2/.mocharc.js b/owl-bot-staging/google-maps-routing/v2/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/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-maps-routing/v2/.prettierrc.js b/owl-bot-staging/google-maps-routing/v2/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-maps-routing/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-maps-routing/v2/README.md b/owl-bot-staging/google-maps-routing/v2/README.md new file mode 100644 index 00000000000..86d380e7032 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/README.md @@ -0,0 +1 @@ +Routing: Nodejs Client diff --git a/owl-bot-staging/google-maps-routing/v2/package.json b/owl-bot-staging/google-maps-routing/v2/package.json new file mode 100644 index 00000000000..8b9a8d4bb1b --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/package.json @@ -0,0 +1,58 @@ +{ + "name": "@googlemaps/routing", + "version": "0.1.0", + "description": "Routing client for Node.js", + "repository": "googleapis/nodejs-routing", + "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 routing", + "routing", + "routes" + ], + "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-maps-routing/v2/protos/google/geo/type/viewport.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/geo/type/viewport.proto new file mode 100644 index 00000000000..ad5029f8360 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/geo/type/viewport.proto @@ -0,0 +1,69 @@ +// 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.geo.type; + +import "google/type/latlng.proto"; + +option go_package = "google.golang.org/genproto/googleapis/geo/type/viewport;viewport"; +option java_multiple_files = true; +option java_outer_classname = "ViewportProto"; +option java_package = "com.google.geo.type"; +option objc_class_prefix = "GGTP"; + +// A latitude-longitude viewport, represented as two diagonally opposite `low` +// and `high` points. A viewport is considered a closed region, i.e. it includes +// its boundary. The latitude bounds must range between -90 to 90 degrees +// inclusive, and the longitude bounds must range between -180 to 180 degrees +// inclusive. Various cases include: +// +// - If `low` = `high`, the viewport consists of that single point. +// +// - If `low.longitude` > `high.longitude`, the longitude range is inverted +// (the viewport crosses the 180 degree longitude line). +// +// - If `low.longitude` = -180 degrees and `high.longitude` = 180 degrees, +// the viewport includes all longitudes. +// +// - If `low.longitude` = 180 degrees and `high.longitude` = -180 degrees, +// the longitude range is empty. +// +// - If `low.latitude` > `high.latitude`, the latitude range is empty. +// +// Both `low` and `high` must be populated, and the represented box cannot be +// empty (as specified by the definitions above). An empty viewport will result +// in an error. +// +// For example, this viewport fully encloses New York City: +// +// { +// "low": { +// "latitude": 40.477398, +// "longitude": -74.259087 +// }, +// "high": { +// "latitude": 40.91618, +// "longitude": -73.70018 +// } +// } +message Viewport { + // Required. The low point of the viewport. + google.type.LatLng low = 1; + + // Required. The high point of the viewport. + google.type.LatLng high = 2; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/fallback_info.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/fallback_info.proto new file mode 100644 index 00000000000..3af720b9b8c --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/fallback_info.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.maps.routing.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "FallbackInfoProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Information related to how and why a fallback result was used. If this field +// is set, then it means the server used a different routing mode from your +// preferred mode as fallback. +message FallbackInfo { + // Routing mode used for the response. If fallback was triggered, the mode + // may be different from routing preference set in the original client + // request. + FallbackRoutingMode routing_mode = 1; + + // The reason why fallback response was used instead of the original response. + // This field is only populated when the fallback mode is triggered and the + // fallback response is returned. + FallbackReason reason = 2; +} + +// Reasons for using fallback response. +enum FallbackReason { + // No fallback reason specified. + FALLBACK_REASON_UNSPECIFIED = 0; + + // A server error happened while calculating routes with your preferred + // routing mode, but we were able to return a result calculated by an + // alternative mode. + SERVER_ERROR = 1; + + // We were not able to finish the calculation with your preferred routing mode + // on time, but we were able to return a result calculated by an alternative + // mode. + LATENCY_EXCEEDED = 2; +} + +// Actual routing mode used for returned fallback response. +enum FallbackRoutingMode { + // Not used. + FALLBACK_ROUTING_MODE_UNSPECIFIED = 0; + + // Indicates the `TRAFFIC_UNAWARE` [google.maps.routing.v2.RoutingPreference] + // was used to compute the response. + FALLBACK_TRAFFIC_UNAWARE = 1; + + // Indicates the `TRAFFIC_AWARE` + // [RoutingPreference][google.maps.routing.v2.RoutingPreference] was used to + // compute the response. + FALLBACK_TRAFFIC_AWARE = 2; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/geocoding_results.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/geocoding_results.proto new file mode 100644 index 00000000000..8532119d24a --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/geocoding_results.proto @@ -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 +// +// 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.maps.routing.v2; + +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "GeocodingResultsProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Contains [GeocodedWaypoints][google.maps.routing.v2.GeocodedWaypoint] for +// origin, destination and intermediate waypoints. Only populated for address +// waypoints. +message GeocodingResults { + // Origin geocoded waypoint. + GeocodedWaypoint origin = 1; + + // Destination geocoded waypoint. + GeocodedWaypoint destination = 2; + + // A list of intermediate geocoded waypoints each containing an index field + // that corresponds to the zero-based position of the waypoint in the order + // they were specified in the request. + repeated GeocodedWaypoint intermediates = 3; +} + +// Details about the locations used as waypoints. Only populated for address +// waypoints. Includes details about the geocoding results for the purposes of +// determining what the address was geocoded to. +message GeocodedWaypoint { + // Indicates the status code resulting from the geocoding operation. + google.rpc.Status geocoder_status = 1; + + // The index of the corresponding intermediate waypoint in the request. + // Only populated if the corresponding waypoint is an intermediate + // waypoint. + optional int32 intermediate_waypoint_request_index = 2; + + // The type(s) of the result, in the form of zero or more type tags. + // Supported types: + // https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types + repeated string type = 3; + + // Indicates that the geocoder did not return an exact match for the original + // request, though it was able to match part of the requested address. You may + // wish to examine the original request for misspellings and/or an incomplete + // address. + bool partial_match = 4; + + // The place ID for this result. + string place_id = 5; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/localized_time.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/localized_time.proto new file mode 100644 index 00000000000..1f19ef196c4 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/localized_time.proto @@ -0,0 +1,40 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +import "google/type/localized_text.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "LocalizedTimeProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Localized description of time. +message LocalizedTime { + // The time specified as a string in a given time zone. + google.type.LocalizedText time = 1; + + // Contains the time zone. The value is the name of the time zone as defined + // in the [IANA Time Zone Database](http://www.iana.org/time-zones), e.g. + // "America/New_York". + string time_zone = 2; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/location.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/location.proto new file mode 100644 index 00000000000..8794169d1a1 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/location.proto @@ -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 +// +// 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.maps.routing.v2; + +import "google/protobuf/wrappers.proto"; +import "google/type/latlng.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "LocationProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Encapsulates a location (a geographic point, and an optional heading). +message Location { + // The waypoint's geographic coordinates. + google.type.LatLng lat_lng = 1; + + // The compass heading associated with the direction of the flow of traffic. + // This value specifies the side of the road for pickup and drop-off. Heading + // values can be from 0 to 360, where 0 specifies a heading of due North, 90 + // specifies a heading of due East, and so on. You can use this field only for + // `DRIVE` and `TWO_WHEELER` + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. + google.protobuf.Int32Value heading = 2; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/maneuver.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/maneuver.proto new file mode 100644 index 00000000000..dac7b8e3d35 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/maneuver.proto @@ -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 +// +// 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.maps.routing.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "ManeuverProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// A set of values that specify the navigation action to take for the current +// step (e.g., turn left, merge, straight, etc.). +enum Maneuver { + // Not used. + MANEUVER_UNSPECIFIED = 0; + + // Turn slightly to the left. + TURN_SLIGHT_LEFT = 1; + + // Turn sharply to the left. + TURN_SHARP_LEFT = 2; + + // Make a left u-turn. + UTURN_LEFT = 3; + + // Turn left. + TURN_LEFT = 4; + + // Turn slightly to the right. + TURN_SLIGHT_RIGHT = 5; + + // Turn sharply to the right. + TURN_SHARP_RIGHT = 6; + + // Make a right u-turn. + UTURN_RIGHT = 7; + + // Turn right. + TURN_RIGHT = 8; + + // Go straight. + STRAIGHT = 9; + + // Take the left ramp. + RAMP_LEFT = 10; + + // Take the right ramp. + RAMP_RIGHT = 11; + + // Merge into traffic. + MERGE = 12; + + // Take the left fork. + FORK_LEFT = 13; + + // Take the right fork. + FORK_RIGHT = 14; + + // Take the ferry. + FERRY = 15; + + // Take the train leading onto the ferry. + FERRY_TRAIN = 16; + + // Turn left at the roundabout. + ROUNDABOUT_LEFT = 17; + + // Turn right at the roundabout. + ROUNDABOUT_RIGHT = 18; + + // Initial maneuver. + DEPART = 19; + + // Used to indicate a street name change. + NAME_CHANGE = 20; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/navigation_instruction.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/navigation_instruction.proto new file mode 100644 index 00000000000..cf66832320d --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/navigation_instruction.proto @@ -0,0 +1,40 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +import "google/maps/routing/v2/maneuver.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "NavigationInstructionProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Encapsulates navigation instructions for a +// [RouteLegStep][google.maps.routing.v2.RouteLegStep] +message NavigationInstruction { + // Encapsulates the navigation instructions for the current step (e.g., turn + // left, merge, straight, etc.). This field determines which icon to display. + Maneuver maneuver = 1; + + // Instructions for navigating this step. + string instructions = 2; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/polyline.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/polyline.proto new file mode 100644 index 00000000000..ba3609b2de0 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/polyline.proto @@ -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 +// +// 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.maps.routing.v2; + +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "PolylineProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Encapsulates an encoded polyline. +message Polyline { + // Encapsulates the type of polyline. Defaults to encoded_polyline. + oneof polyline_type { + // The string encoding of the polyline using the [polyline encoding + // algorithm](https://developers.google.com/maps/documentation/utilities/polylinealgorithm) + string encoded_polyline = 1; + + // Specifies a polyline using the [GeoJSON LineString + // format](https://tools.ietf.org/html/rfc7946#section-3.1.4) + google.protobuf.Struct geo_json_linestring = 2; + } +} + +// A set of values that specify the quality of the polyline. +enum PolylineQuality { + // No polyline quality preference specified. Defaults to `OVERVIEW`. + POLYLINE_QUALITY_UNSPECIFIED = 0; + + // Specifies a high-quality polyline - which is composed using more points + // than `OVERVIEW`, at the cost of increased response size. Use this value + // when you need more precision. + HIGH_QUALITY = 1; + + // Specifies an overview polyline - which is composed using a small number of + // points. Use this value when displaying an overview of the route. Using this + // option has a lower request latency compared to using the + // `HIGH_QUALITY` option. + OVERVIEW = 2; +} + +// Specifies the preferred type of polyline to be returned. +enum PolylineEncoding { + // No polyline type preference specified. Defaults to `ENCODED_POLYLINE`. + POLYLINE_ENCODING_UNSPECIFIED = 0; + + // Specifies a polyline encoded using the [polyline encoding + // algorithm](https://developers.google.com/maps/documentation/utilities/polylinealgorithm). + ENCODED_POLYLINE = 1; + + // Specifies a polyline using the [GeoJSON LineString + // format](https://tools.ietf.org/html/rfc7946#section-3.1.4) + GEO_JSON_LINESTRING = 2; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route.proto new file mode 100644 index 00000000000..3a982db04b0 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route.proto @@ -0,0 +1,395 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +import "google/geo/type/viewport.proto"; +import "google/maps/routing/v2/localized_time.proto"; +import "google/maps/routing/v2/location.proto"; +import "google/maps/routing/v2/navigation_instruction.proto"; +import "google/maps/routing/v2/polyline.proto"; +import "google/maps/routing/v2/route_label.proto"; +import "google/maps/routing/v2/route_travel_mode.proto"; +import "google/maps/routing/v2/speed_reading_interval.proto"; +import "google/maps/routing/v2/toll_info.proto"; +import "google/maps/routing/v2/transit.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/localized_text.proto"; +import "google/type/money.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "RouteProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Contains a route, which consists of a series of connected road segments +// that join beginning, ending, and intermediate waypoints. +message Route { + // Text representations of certain properties. + message RouteLocalizedValues { + // Travel distance represented in text form. + google.type.LocalizedText distance = 1; + + // Duration taking traffic conditions into consideration, represented in + // text form. Note: If you did not request traffic information, this value + // will be the same value as static_duration. + google.type.LocalizedText duration = 2; + + // Duration without taking traffic conditions into + // consideration, represented in text form. + google.type.LocalizedText static_duration = 3; + + // Transit fare represented in text form. + google.type.LocalizedText transit_fare = 4; + } + + // Labels for the `Route` that are useful to identify specific properties + // of the route to compare against others. + repeated RouteLabel route_labels = 13; + + // A collection of legs (path segments between waypoints) that make up the + // route. Each leg corresponds to the trip between two non-`via` + // [Waypoints][google.maps.routing.v2.Waypoint]. For example, a route with no + // intermediate waypoints has only one leg. A route that includes one + // non-`via` intermediate waypoint has two legs. A route that includes one + // `via` intermediate waypoint has one leg. The order of the legs matches the + // order of waypoints from `origin` to `intermediates` to `destination`. + repeated RouteLeg legs = 1; + + // The travel distance of the route, in meters. + int32 distance_meters = 2; + + // The length of time needed to navigate the route. If you set the + // `routing_preference` to `TRAFFIC_UNAWARE`, then this value is the same as + // `static_duration`. If you set the `routing_preference` to either + // `TRAFFIC_AWARE` or `TRAFFIC_AWARE_OPTIMAL`, then this value is calculated + // taking traffic conditions into account. + google.protobuf.Duration duration = 3; + + // The duration of travel through the route without taking traffic + // conditions into consideration. + google.protobuf.Duration static_duration = 4; + + // The overall route polyline. This polyline is the combined polyline of + // all `legs`. + Polyline polyline = 5; + + // A description of the route. + string description = 6; + + // An array of warnings to show when displaying the route. + repeated string warnings = 7; + + // The viewport bounding box of the polyline. + google.geo.type.Viewport viewport = 8; + + // Additional information about the route. + RouteTravelAdvisory travel_advisory = 9; + + // If you set + // [optimize_waypoint_order][google.maps.routing.v2.ComputeRoutesRequest.optimize_waypoint_order] + // to true, this field contains the optimized ordering of intermediate + // waypoints. Otherwise, this field is empty. + // For example, if you give an input of Origin: LA; Intermediate waypoints: + // Dallas, Bangor, Phoenix; Destination: New York; and the optimized + // intermediate waypoint order is Phoenix, Dallas, Bangor, then this field + // contains the values [2, 0, 1]. The index starts with 0 for the first + // intermediate waypoint provided in the input. + repeated int32 optimized_intermediate_waypoint_index = 10; + + // Text representations of properties of the `Route`. + RouteLocalizedValues localized_values = 11; + + // A web-safe, base64-encoded route token that can be passed to the Navigation + // SDK, that allows the Navigation SDK to reconstruct the route during + // navigation, and, in the event of rerouting, honor the original intention + // when you created the route by calling ComputeRoutes. Customers should treat + // this token as an opaque blob. It is not meant for reading or mutating. + // NOTE: `Route.route_token` is only available for requests that have set + // `ComputeRoutesRequest.routing_preference` to `TRAFFIC_AWARE` or + // `TRAFFIC_AWARE_OPTIMAL`. `Route.route_token` is not supported for requests + // that have Via waypoints. + string route_token = 12; +} + +// Contains the additional information that the user should be informed +// about, such as possible traffic zone restrictions. +message RouteTravelAdvisory { + // Contains information about tolls on the route. This field is only populated + // if tolls are expected on the route. If this field is set, but the + // estimatedPrice subfield is not populated, then the route contains tolls, + // but the estimated price is unknown. If this field is not set, then there + // are no tolls expected on the route. + TollInfo toll_info = 2; + + // Speed reading intervals detailing traffic density. Applicable in case of + // `TRAFFIC_AWARE` and `TRAFFIC_AWARE_OPTIMAL` routing preferences. + // The intervals cover the entire polyline of the route without overlap. + // The start point of a specified interval is the same as the end point of the + // preceding interval. + // + // Example: + // + // polyline: A ---- B ---- C ---- D ---- E ---- F ---- G + // speed_reading_intervals: [A,C), [C,D), [D,G). + repeated SpeedReadingInterval speed_reading_intervals = 3; + + // The predicted fuel consumption in microliters. + int64 fuel_consumption_microliters = 5; + + // Returned route may have restrictions that are not suitable for requested + // travel mode or route modifiers. + bool route_restrictions_partially_ignored = 6; + + // If present, contains the total fare or ticket costs on this route + // This property is only returned for `TRANSIT` requests and only + // for routes where fare information is available for all transit steps. + google.type.Money transit_fare = 7; +} + +// Contains the additional information that the user should be informed +// about on a leg step, such as possible traffic zone restrictions. +message RouteLegTravelAdvisory { + // Contains information about tolls on the specific `RouteLeg`. + // This field is only populated if we expect there are tolls on the + // `RouteLeg`. If this field is set but the estimated_price subfield is not + // populated, we expect that road contains tolls but we do not know an + // estimated price. If this field does not exist, then there is no toll on the + // `RouteLeg`. + TollInfo toll_info = 1; + + // Speed reading intervals detailing traffic density. Applicable in case of + // `TRAFFIC_AWARE` and `TRAFFIC_AWARE_OPTIMAL` routing preferences. + // The intervals cover the entire polyline of the `RouteLeg` without overlap. + // The start point of a specified interval is the same as the end point of the + // preceding interval. + // + // Example: + // + // polyline: A ---- B ---- C ---- D ---- E ---- F ---- G + // speed_reading_intervals: [A,C), [C,D), [D,G). + repeated SpeedReadingInterval speed_reading_intervals = 2; +} + +// Contains the additional information that the user should be informed +// about, such as possible traffic zone restrictions on a leg step. +message RouteLegStepTravelAdvisory { + // NOTE: This field is not currently populated. + repeated SpeedReadingInterval speed_reading_intervals = 1; +} + +// Contains a segment between non-`via` waypoints. +message RouteLeg { + // Text representations of certain properties. + message RouteLegLocalizedValues { + // Travel distance represented in text form. + google.type.LocalizedText distance = 1; + + // Duration taking traffic conditions into consideration represented in text + // form. Note: If you did not request traffic information, this value will + // be the same value as static_duration. + google.type.LocalizedText duration = 2; + + // Duration without taking traffic conditions into + // consideration, represented in text form. + google.type.LocalizedText static_duration = 3; + } + + // Provides overview information about a list of `RouteLegStep`s. + message StepsOverview { + // Provides summarized information about different multi-modal segments of + // the `RouteLeg.steps`. A multi-modal segment is defined as one or more + // contiguous `RouteLegStep` that have the same `RouteTravelMode`. + // This field is not populated if the `RouteLeg` does not contain any + // multi-modal segments in the steps. + message MultiModalSegment { + // The corresponding `RouteLegStep` index that is the start of a + // multi-modal segment. + optional int32 step_start_index = 1; + + // The corresponding `RouteLegStep` index that is the end of a + // multi-modal segment. + optional int32 step_end_index = 2; + + // NavigationInstruction for the multi-modal segment. + NavigationInstruction navigation_instruction = 3; + + // The travel mode of the multi-modal segment. + RouteTravelMode travel_mode = 4; + } + + // Summarized information about different multi-modal segments of + // the `RouteLeg.steps`. This field is not populated if the `RouteLeg` does + // not contain any multi-modal segments in the steps. + repeated MultiModalSegment multi_modal_segments = 1; + } + + // The travel distance of the route leg, in meters. + int32 distance_meters = 1; + + // The length of time needed to navigate the leg. If the `route_preference` + // is set to `TRAFFIC_UNAWARE`, then this value is the same as + // `static_duration`. If the `route_preference` is either `TRAFFIC_AWARE` or + // `TRAFFIC_AWARE_OPTIMAL`, then this value is calculated taking traffic + // conditions into account. + google.protobuf.Duration duration = 2; + + // The duration of travel through the leg, calculated without taking + // traffic conditions into consideration. + google.protobuf.Duration static_duration = 3; + + // The overall polyline for this leg that includes each `step`'s + // polyline. + Polyline polyline = 4; + + // The start location of this leg. This location might be different from the + // provided `origin`. For example, when the provided `origin` is not near a + // road, this is a point on the road. + Location start_location = 5; + + // The end location of this leg. This location might be different from the + // provided `destination`. For example, when the provided `destination` is not + // near a road, this is a point on the road. + Location end_location = 6; + + // An array of steps denoting segments within this leg. Each step represents + // one navigation instruction. + repeated RouteLegStep steps = 7; + + // Contains the additional information that the user should be informed + // about, such as possible traffic zone restrictions, on a route leg. + RouteLegTravelAdvisory travel_advisory = 8; + + // Text representations of properties of the `RouteLeg`. + RouteLegLocalizedValues localized_values = 9; + + // Overview information about the steps in this `RouteLeg`. This field is only + // populated for TRANSIT routes. + StepsOverview steps_overview = 10; +} + +// Contains a segment of a [RouteLeg][google.maps.routing.v2.RouteLeg]. A +// step corresponds to a single navigation instruction. Route legs are made up +// of steps. +message RouteLegStep { + // Text representations of certain properties. + message RouteLegStepLocalizedValues { + // Travel distance represented in text form. + google.type.LocalizedText distance = 1; + + // Duration without taking traffic conditions into + // consideration, represented in text form. + google.type.LocalizedText static_duration = 3; + } + + // The travel distance of this step, in meters. In some circumstances, this + // field might not have a value. + int32 distance_meters = 1; + + // The duration of travel through this step without taking traffic conditions + // into consideration. In some circumstances, this field might not have a + // value. + google.protobuf.Duration static_duration = 2; + + // The polyline associated with this step. + Polyline polyline = 3; + + // The start location of this step. + Location start_location = 4; + + // The end location of this step. + Location end_location = 5; + + // Navigation instructions. + NavigationInstruction navigation_instruction = 6; + + // Contains the additional information that the user should be informed + // about, such as possible traffic zone restrictions, on a leg step. + RouteLegStepTravelAdvisory travel_advisory = 7; + + // Text representations of properties of the `RouteLegStep`. + RouteLegStepLocalizedValues localized_values = 8; + + // Details pertaining to this step if the travel mode is `TRANSIT`. + RouteLegStepTransitDetails transit_details = 9; + + // The travel mode used for this step. + RouteTravelMode travel_mode = 10; +} + +// Additional information for the `RouteLegStep` related to `TRANSIT` routes. +message RouteLegStepTransitDetails { + // Details about the transit stops for the `RouteLegStep` + message TransitStopDetails { + // Information about the arrival stop for the step. + TransitStop arrival_stop = 1; + + // The estimated time of arrival for the step. + google.protobuf.Timestamp arrival_time = 2; + + // Information about the departure stop for the step. + TransitStop departure_stop = 3; + + // The estimated time of departure for the step. + google.protobuf.Timestamp departure_time = 4; + } + + // Localized descriptions of values for RouteTransitDetails. + message TransitDetailsLocalizedValues { + // Time in its formatted text representation with a corresponding time zone. + LocalizedTime arrival_time = 1; + + // Time in its formatted text representation with a corresponding time zone. + LocalizedTime departure_time = 2; + } + + // Information about the arrival and departure stops for the step. + TransitStopDetails stop_details = 1; + + // Text representations of properties of the `RouteLegStepTransitDetails`. + TransitDetailsLocalizedValues localized_values = 2; + + // Specifies the direction in which to travel on this line as marked on + // the vehicle or at the departure stop. The direction is often the terminus + // station. + string headsign = 3; + + // Specifies the expected time as a duration between departures from the same + // stop at this time. For example, with a headway seconds value of 600, you + // would expect a ten minute wait if you should miss your bus. + google.protobuf.Duration headway = 4; + + // Information about the transit line used in this step. + TransitLine transit_line = 5; + + // The number of stops from the departure to the arrival stop. This count + // includes the arrival stop, but excludes the departure stop. For example, if + // your route leaves from Stop A, passes through stops B and C, and arrives at + // stop D, stop_count will return 3. + int32 stop_count = 6; + + // The text that appears in schedules and sign boards to identify a transit + // trip to passengers. The text should uniquely identify a trip within a + // service day. For example, "538" is the `trip_short_text` of the Amtrak + // train that leaves San Jose, CA at 15:10 on weekdays to Sacramento, CA. + string trip_short_text = 7; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_label.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_label.proto new file mode 100644 index 00000000000..ba43b0b8c24 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_label.proto @@ -0,0 +1,47 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "RouteLabelProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Labels for the [Route][google.maps.routing.v2.Route] that are useful to +// identify specific properties of the route to compare against others. +enum RouteLabel { + // Default - not used. + ROUTE_LABEL_UNSPECIFIED = 0; + + // The default "best" route returned for the route computation. + DEFAULT_ROUTE = 1; + + // An alternative to the default "best" route. Routes like this will be + // returned when + // [compute_alternative_routes][google.maps.routing.v2.ComputeRoutesRequest.compute_alternative_routes] + // is specified. + DEFAULT_ROUTE_ALTERNATE = 2; + + // Fuel efficient route. Routes labeled with this value are determined to be + // optimized for Eco parameters such as fuel consumption. + FUEL_EFFICIENT = 3; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_modifiers.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_modifiers.proto new file mode 100644 index 00000000000..33dcb7bd837 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_modifiers.proto @@ -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 +// +// 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.maps.routing.v2; + +import "google/maps/routing/v2/toll_passes.proto"; +import "google/maps/routing/v2/vehicle_info.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "RouteModifiersProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Encapsulates a set of optional conditions to satisfy when calculating the +// routes. +message RouteModifiers { + // When set to true, avoids toll roads where reasonable, giving preference to + // routes not containing toll roads. Applies only to the `DRIVE` and + // `TWO_WHEELER` [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. + bool avoid_tolls = 1; + + // When set to true, avoids highways where reasonable, giving preference to + // routes not containing highways. Applies only to the `DRIVE` and + // `TWO_WHEELER` [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. + bool avoid_highways = 2; + + // When set to true, avoids ferries where reasonable, giving preference to + // routes not containing ferries. Applies only to the `DRIVE` and`TWO_WHEELER` + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. + bool avoid_ferries = 3; + + // When set to true, avoids navigating indoors where reasonable, giving + // preference to routes not containing indoor navigation. Applies only to the + // `WALK` [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. + bool avoid_indoor = 4; + + // Specifies the vehicle information. + VehicleInfo vehicle_info = 5; + + // Encapsulates information about toll passes. + // If toll passes are provided, the API tries to return the pass price. If + // toll passes are not provided, the API treats the toll pass as unknown and + // tries to return the cash price. + // Applies only to the `DRIVE` and `TWO_WHEELER` + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. + repeated TollPass toll_passes = 6; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_travel_mode.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_travel_mode.proto new file mode 100644 index 00000000000..f6bd3e52a83 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_travel_mode.proto @@ -0,0 +1,53 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "RouteTravelModeProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// A set of values used to specify the mode of travel. +// NOTE: `WALK`, `BICYCLE`, and `TWO_WHEELER` routes are in beta and might +// sometimes be missing clear sidewalks, pedestrian paths, or bicycling paths. +// You must display this warning to the user for all walking, bicycling, and +// two-wheel routes that you display in your app. +enum RouteTravelMode { + // No travel mode specified. Defaults to `DRIVE`. + TRAVEL_MODE_UNSPECIFIED = 0; + + // Travel by passenger car. + DRIVE = 1; + + // Travel by bicycle. + BICYCLE = 2; + + // Travel by walking. + WALK = 3; + + // Two-wheeled, motorized vehicle. For example, motorcycle. Note that this + // differs from the `BICYCLE` travel mode which covers human-powered mode. + TWO_WHEELER = 4; + + // Travel by public transit routes, where available. + TRANSIT = 7; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routes_service.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routes_service.proto new file mode 100644 index 00000000000..1ef6db73468 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routes_service.proto @@ -0,0 +1,499 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/maps/routing/v2/fallback_info.proto"; +import "google/maps/routing/v2/geocoding_results.proto"; +import "google/maps/routing/v2/polyline.proto"; +import "google/maps/routing/v2/route.proto"; +import "google/maps/routing/v2/route_modifiers.proto"; +import "google/maps/routing/v2/route_travel_mode.proto"; +import "google/maps/routing/v2/routing_preference.proto"; +import "google/maps/routing/v2/traffic_model.proto"; +import "google/maps/routing/v2/transit_preferences.proto"; +import "google/maps/routing/v2/units.proto"; +import "google/maps/routing/v2/waypoint.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "google/type/localized_text.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "RoutesServiceProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// The Routes API. +service Routes { + option (google.api.default_host) = "routes.googleapis.com"; + + // Returns the primary route along with optional alternate routes, given a set + // of terminal and intermediate waypoints. + // + // **NOTE:** This method requires that you specify a response field mask in + // the input. You can provide the response field mask by using URL parameter + // `$fields` or `fields`, or by using an HTTP/gRPC header `X-Goog-FieldMask` + // (see the [available URL parameters and + // headers](https://cloud.google.com/apis/docs/system-parameters). The value + // is a comma separated list of field paths. See detailed documentation about + // [how to construct the field + // paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). + // + // For example, in this method: + // + // * Field mask of all available fields (for manual inspection): + // `X-Goog-FieldMask: *` + // * Field mask of Route-level duration, distance, and polyline (an example + // production setup): + // `X-Goog-FieldMask: + // routes.duration,routes.distanceMeters,routes.polyline.encodedPolyline` + // + // Google discourage the use of the wildcard (`*`) response field mask, or + // specifying the field mask at the top level (`routes`), because: + // + // * Selecting only the fields that you need helps our server save computation + // cycles, allowing us to return the result to you with a lower latency. + // * Selecting only the fields that you need + // in your production job ensures stable latency performance. We might add + // more response fields in the future, and those new fields might require + // extra computation time. If you select all fields, or if you select all + // fields at the top level, then you might experience performance degradation + // because any new field we add will be automatically included in the + // response. + // * Selecting only the fields that you need results in a smaller response + // size, and thus higher network throughput. + rpc ComputeRoutes(ComputeRoutesRequest) returns (ComputeRoutesResponse) { + option (google.api.http) = { + post: "/directions/v2:computeRoutes" + body: "*" + }; + } + + // Takes in a list of origins and destinations and returns a stream containing + // route information for each combination of origin and destination. + // + // **NOTE:** This method requires that you specify a response field mask in + // the input. You can provide the response field mask by using the URL + // parameter `$fields` or `fields`, or by using the HTTP/gRPC header + // `X-Goog-FieldMask` (see the [available URL parameters and + // headers](https://cloud.google.com/apis/docs/system-parameters). The value + // is a comma separated list of field paths. See this detailed documentation + // about [how to construct the field + // paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). + // + // For example, in this method: + // + // * Field mask of all available fields (for manual inspection): + // `X-Goog-FieldMask: *` + // * Field mask of route durations, distances, element status, condition, and + // element indices (an example production setup): + // `X-Goog-FieldMask: + // originIndex,destinationIndex,status,condition,distanceMeters,duration` + // + // It is critical that you include `status` in your field mask as otherwise + // all messages will appear to be OK. Google discourages the use of the + // wildcard (`*`) response field mask, because: + // + // * Selecting only the fields that you need helps our server save computation + // cycles, allowing us to return the result to you with a lower latency. + // * Selecting only the fields that you need in your production job ensures + // stable latency performance. We might add more response fields in the + // future, and those new fields might require extra computation time. If you + // select all fields, or if you select all fields at the top level, then you + // might experience performance degradation because any new field we add will + // be automatically included in the response. + // * Selecting only the fields that you need results in a smaller response + // size, and thus higher network throughput. + rpc ComputeRouteMatrix(ComputeRouteMatrixRequest) + returns (stream RouteMatrixElement) { + option (google.api.http) = { + post: "/distanceMatrix/v2:computeRouteMatrix" + body: "*" + }; + } +} + +// ComputeRoutes request message. +message ComputeRoutesRequest { + // A supported reference route on the ComputeRoutesRequest. + enum ReferenceRoute { + // Not used. Requests containing this value fail. + REFERENCE_ROUTE_UNSPECIFIED = 0; + + // Fuel efficient route. Routes labeled with this value are determined to be + // optimized for parameters such as fuel consumption. + FUEL_EFFICIENT = 1; + } + + // Extra computations to perform while completing the request. + enum ExtraComputation { + // Not used. Requests containing this value will fail. + EXTRA_COMPUTATION_UNSPECIFIED = 0; + + // Toll information for the route(s). + TOLLS = 1; + + // Estimated fuel consumption for the route(s). + FUEL_CONSUMPTION = 2; + + // Traffic aware polylines for the route(s). + TRAFFIC_ON_POLYLINE = 3; + + // [Navigation + // Instructions][google.maps.routing.v2.NavigationInstructions.instructions] + // presented as a formatted HTML text string. This content + // is meant to be read as-is. This content is for display only. + // Do not programmatically parse it. + HTML_FORMATTED_NAVIGATION_INSTRUCTIONS = 4; + } + + // Required. Origin waypoint. + Waypoint origin = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Destination waypoint. + Waypoint destination = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A set of waypoints along the route (excluding terminal points), + // for either stopping at or passing by. Up to 25 intermediate waypoints are + // supported. + repeated Waypoint intermediates = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the mode of transportation. + RouteTravelMode travel_mode = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies how to compute the route. The server + // attempts to use the selected routing preference to compute the route. If + // the routing preference results in an error or an extra long latency, then + // an error is returned. You can specify this option only when the + // `travel_mode` is `DRIVE` or `TWO_WHEELER`, otherwise the request fails. + RoutingPreference routing_preference = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies your preference for the quality of the polyline. + PolylineQuality polyline_quality = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the preferred encoding for the polyline. + PolylineEncoding polyline_encoding = 12 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The departure time. If you don't set this value, then this value + // defaults to the time that you made the request. + // NOTE: You can only specify a `departure_time` in the past when + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to + // `TRANSIT`. + google.protobuf.Timestamp departure_time = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The arrival time. + // NOTE: Can only be set when + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to + // `TRANSIT`. You can specify either departure_time or arrival_time, but not + // both. + google.protobuf.Timestamp arrival_time = 19 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies whether to calculate alternate routes in addition to + // the route. No alternative routes are returned for requests that have + // intermediate waypoints. + bool compute_alternative_routes = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A set of conditions to satisfy that affect the way routes are + // calculated. + RouteModifiers route_modifiers = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // information, see + // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See + // [Language Support](https://developers.google.com/maps/faq#languagesupport) + // for the list of supported languages. When you don't provide this value, the + // display language is inferred from the location of the route request. + string language_code = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The region code, specified as a ccTLD ("top-level domain") + // two-character value. For more information see + // https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains + string region_code = 16 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the units of measure for the display fields. These + // fields include the `instruction` field in + // [NavigationInstruction][google.maps.routing.v2.NavigationInstruction]. The + // units of measure used for the route, leg, step distance, and duration are + // not affected by this value. If you don't provide this value, then the + // display units are inferred from the location of the first origin. + Units units = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to true, the service attempts to minimize the overall cost + // of the route by re-ordering the specified intermediate waypoints. The + // request fails if any of the intermediate waypoints is a `via` waypoint. Use + // `ComputeRoutesResponse.Routes.optimized_intermediate_waypoint_index` to + // find the new ordering. + // If `ComputeRoutesResponseroutes.optimized_intermediate_waypoint_index` is + // not requested in the `X-Goog-FieldMask` header, the request fails. + // If `optimize_waypoint_order` is set to false, + // `ComputeRoutesResponse.optimized_intermediate_waypoint_index` will be + // empty. + bool optimize_waypoint_order = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies what reference routes to calculate as part of the + // request in addition to the default route. A reference route is a route with + // a different route calculation objective than the default route. For example + // a `FUEL_EFFICIENT` reference route calculation takes into account various + // parameters that would generate an optimal fuel efficient route. + repeated ReferenceRoute requested_reference_routes = 14 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A list of extra computations which may be used to complete the + // request. Note: These extra computations may return extra fields on the + // response. These extra fields must also be specified in the field mask to be + // returned in the response. + repeated ExtraComputation extra_computations = 15 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the assumptions to use when calculating time in + // traffic. This setting affects the value returned in the duration field in + // the [Route][google.maps.routing.v2.Route] and + // [RouteLeg][google.maps.routing.v2.RouteLeg] which contains the predicted + // time in traffic based on historical averages. + // `TrafficModel` is only available for requests that have set + // [RoutingPreference][google.maps.routing.v2.RoutingPreference] to + // `TRAFFIC_AWARE_OPTIMAL` and + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] to `DRIVE`. + // Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not + // specified. + TrafficModel traffic_model = 18 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies preferences that influence the route returned for + // `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to + // `TRANSIT`. + TransitPreferences transit_preferences = 20 + [(google.api.field_behavior) = OPTIONAL]; +} + +// ComputeRoutes the response message. +message ComputeRoutesResponse { + // Contains an array of computed routes (up to three) when you specify + // compute_alternatives_routes, and contains just one route when you don't. + // When this array contains multiple entries, the first one is the most + // recommended route. If the array is empty, then it means no route could be + // found. + repeated Route routes = 1; + + // In some cases when the server is not able to compute the route results with + // all of the input preferences, it may fallback to using a different way of + // computation. When fallback mode is used, this field contains detailed info + // about the fallback response. Otherwise this field is unset. + FallbackInfo fallback_info = 2; + + // Contains geocoding response info for waypoints specified as addresses. + GeocodingResults geocoding_results = 3; +} + +// ComputeRouteMatrix request message +message ComputeRouteMatrixRequest { + // Extra computations to perform while completing the request. + enum ExtraComputation { + // Not used. Requests containing this value will fail. + EXTRA_COMPUTATION_UNSPECIFIED = 0; + + // Toll information for the matrix element(s). + TOLLS = 1; + } + + // Required. Array of origins, which determines the rows of the response + // matrix. Several size restrictions apply to the cardinality of origins and + // destinations: + // + // * The number of elements (origins × destinations) must be no greater than + // 625 in any case. + // * The number of elements (origins × destinations) must be no greater than + // 100 if routing_preference is set to `TRAFFIC_AWARE_OPTIMAL`. + // * The number of waypoints (origins + destinations) specified as `place_id` + // must be no greater than 50. + repeated RouteMatrixOrigin origins = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Array of destinations, which determines the columns of the + // response matrix. + repeated RouteMatrixDestination destinations = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Specifies the mode of transportation. + RouteTravelMode travel_mode = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies how to compute the route. The server attempts to use + // the selected routing preference to compute the route. If the routing + // preference results in an error or an extra long latency, an error is + // returned. You can specify this option only when the `travel_mode` is + // `DRIVE` or `TWO_WHEELER`, otherwise the request fails. + RoutingPreference routing_preference = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The departure time. If you don't set this value, then this value + // defaults to the time that you made the request. + // NOTE: You can only specify a `departure_time` in the past when + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to + // `TRANSIT`. + google.protobuf.Timestamp departure_time = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The arrival time. + // NOTE: Can only be set when + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to + // `TRANSIT`. You can specify either departure_time or arrival_time, but not + // both. + google.protobuf.Timestamp arrival_time = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // information, see + // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See + // [Language Support](https://developers.google.com/maps/faq#languagesupport) + // for the list of supported languages. When you don't provide this value, the + // display language is inferred from the location of the first origin. + string language_code = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The region code, specified as a ccTLD ("top-level domain") + // two-character value. For more information see + // https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains + string region_code = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A list of extra computations which may be used to complete the + // request. Note: These extra computations may return extra fields on the + // response. These extra fields must also be specified in the field mask to be + // returned in the response. + repeated ExtraComputation extra_computations = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the assumptions to use when calculating time in + // traffic. This setting affects the value returned in the duration field in + // the [RouteMatrixElement][google.maps.routing.v2.RouteMatrixElement] which + // contains the predicted time in traffic based on historical averages. + // [RoutingPreference][google.maps.routing.v2.RoutingPreference] to + // `TRAFFIC_AWARE_OPTIMAL` and + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] to `DRIVE`. + // Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not + // specified. + TrafficModel traffic_model = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies preferences that influence the route returned for + // `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to + // `TRANSIT`. + TransitPreferences transit_preferences = 12 + [(google.api.field_behavior) = OPTIONAL]; +} + +// A single origin for ComputeRouteMatrixRequest +message RouteMatrixOrigin { + // Required. Origin waypoint + Waypoint waypoint = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Modifiers for every route that takes this as the origin + RouteModifiers route_modifiers = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A single destination for ComputeRouteMatrixRequest +message RouteMatrixDestination { + // Required. Destination waypoint + Waypoint waypoint = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Contains route information computed for an origin/destination pair in the +// ComputeRouteMatrix API. This proto can be streamed to the client. +message RouteMatrixElement { + // Text representations of certain properties. + message LocalizedValues { + // Travel distance represented in text form. + google.type.LocalizedText distance = 1; + + // Duration represented in text form taking traffic conditions into + // consideration. Note: If traffic information was not requested, this value + // is the same value as static_duration. + google.type.LocalizedText duration = 2; + + // Duration represented in text form without taking traffic conditions into + // consideration. + google.type.LocalizedText static_duration = 3; + + // Transit fare represented in text form. + google.type.LocalizedText transit_fare = 4; + } + + // Zero-based index of the origin in the request. + optional int32 origin_index = 1; + + // Zero-based index of the destination in the request. + optional int32 destination_index = 2; + + // Error status code for this element. + google.rpc.Status status = 3; + + // Indicates whether the route was found or not. Independent of status. + RouteMatrixElementCondition condition = 9; + + // The travel distance of the route, in meters. + int32 distance_meters = 4; + + // The length of time needed to navigate the route. If you set the + // [routing_preference][google.maps.routing.v2.ComputeRouteMatrixRequest.routing_preference] + // to `TRAFFIC_UNAWARE`, then this value is the same as `static_duration`. If + // you set the `routing_preference` to either `TRAFFIC_AWARE` or + // `TRAFFIC_AWARE_OPTIMAL`, then this value is calculated taking traffic + // conditions into account. + google.protobuf.Duration duration = 5; + + // The duration of traveling through the route without taking traffic + // conditions into consideration. + google.protobuf.Duration static_duration = 6; + + // Additional information about the route. For example: restriction + // information and toll information + RouteTravelAdvisory travel_advisory = 7; + + // In some cases when the server is not able to compute the route with the + // given preferences for this particular origin/destination pair, it may + // fall back to using a different mode of computation. When fallback mode is + // used, this field contains detailed information about the fallback response. + // Otherwise this field is unset. + FallbackInfo fallback_info = 8; + + // Text representations of properties of the `RouteMatrixElement`. + LocalizedValues localized_values = 10; +} + +// The condition of the route being returned. +enum RouteMatrixElementCondition { + // Only used when the `status` of the element is not OK. + ROUTE_MATRIX_ELEMENT_CONDITION_UNSPECIFIED = 0; + + // A route was found, and the corresponding information was filled out for the + // element. + ROUTE_EXISTS = 1; + + // No route could be found. Fields containing route information, such as + // `distance_meters` or `duration`, will not be filled out in the element. + ROUTE_NOT_FOUND = 2; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routing_preference.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routing_preference.proto new file mode 100644 index 00000000000..eaca42dcd8f --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routing_preference.proto @@ -0,0 +1,56 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "RoutingPreferenceProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// A set of values that specify factors to take into consideration when +// calculating the route. +enum RoutingPreference { + // No routing preference specified. Default to `TRAFFIC_UNAWARE`. + ROUTING_PREFERENCE_UNSPECIFIED = 0; + + // Computes routes without taking live traffic conditions into consideration. + // Suitable when traffic conditions don't matter or are not applicable. + // Using this value produces the lowest latency. + // Note: For [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] `DRIVE` + // and `TWO_WHEELER` choice of route and duration are based on road network + // and average time-independent traffic conditions. Results for a given + // request may vary over time due to changes in the road network, updated + // average traffic conditions, and the distributed nature of the service. + // Results may also vary between nearly-equivalent routes at any time or + // frequency. + TRAFFIC_UNAWARE = 1; + + // Calculates routes taking live traffic conditions into consideration. + // In contrast to `TRAFFIC_AWARE_OPTIMAL`, some optimizations are applied to + // significantly reduce latency. + TRAFFIC_AWARE = 2; + + // Calculates the routes taking live traffic conditions into consideration, + // without applying most performance optimizations. Using this value produces + // the highest latency. + TRAFFIC_AWARE_OPTIMAL = 3; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/speed_reading_interval.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/speed_reading_interval.proto new file mode 100644 index 00000000000..2ca769c9e41 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/speed_reading_interval.proto @@ -0,0 +1,59 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "SpeedReadingIntervalProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Traffic density indicator on a contiguous segment of a polyline or path. +// Given a path with points P_0, P_1, ... , P_N (zero-based index), the +// SpeedReadingInterval defines an interval and describes its traffic using the +// following categories. +message SpeedReadingInterval { + // The classification of polyline speed based on traffic data. + enum Speed { + // Default value. This value is unused. + SPEED_UNSPECIFIED = 0; + + // Normal speed, no slowdown is detected. + NORMAL = 1; + + // Slowdown detected, but no traffic jam formed. + SLOW = 2; + + // Traffic jam detected. + TRAFFIC_JAM = 3; + } + + // The starting index of this interval in the polyline. + optional int32 start_polyline_point_index = 1; + + // The ending index of this interval in the polyline. + optional int32 end_polyline_point_index = 2; + + oneof speed_type { + // Traffic speed in this interval. + Speed speed = 3; + } +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_info.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_info.proto new file mode 100644 index 00000000000..0788e5d454b --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_info.proto @@ -0,0 +1,42 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +import "google/type/money.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "TollInfoProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Encapsulates toll information on a [Route][google.maps.routing.v2.Route] or +// on a [RouteLeg][google.maps.routing.v2.RouteLeg]. +message TollInfo { + // The monetary amount of tolls for the corresponding + // [Route][google.maps.routing.v2.Route] or + // [RouteLeg][google.maps.routing.v2.RouteLeg]. This list contains a money + // amount for each currency that is expected to be charged by the toll + // stations. Typically this list will contain only one item for routes with + // tolls in one currency. For international trips, this list may contain + // multiple items to reflect tolls in different currencies. + repeated google.type.Money estimated_price = 1; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_passes.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_passes.proto new file mode 100644 index 00000000000..72598e560a3 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_passes.proto @@ -0,0 +1,334 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "TollPassesProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// List of toll passes around the world that we support. +enum TollPass { + // Not used. If this value is used, then the request fails. + TOLL_PASS_UNSPECIFIED = 0; + + // Sydney toll pass. See additional details at https://www.myetoll.com.au. + AU_ETOLL_TAG = 82; + + // Sydney toll pass. See additional details at https://www.tollpay.com.au. + AU_EWAY_TAG = 83; + + // Australia-wide toll pass. + // See additional details at https://www.linkt.com.au/. + AU_LINKT = 2; + + // Argentina toll pass. See additional details at https://telepase.com.ar + AR_TELEPASE = 3; + + // Brazil toll pass. See additional details at https://www.autoexpreso.com + BR_AUTO_EXPRESO = 81; + + // Brazil toll pass. See additional details at https://conectcar.com. + BR_CONECTCAR = 7; + + // Brazil toll pass. See additional details at https://movemais.com. + BR_MOVE_MAIS = 8; + + // Brazil toll pass. See additional details at https://pasorapido.gob.do/ + BR_PASSA_RAPIDO = 88; + + // Brazil toll pass. See additional details at https://www.semparar.com.br. + BR_SEM_PARAR = 9; + + // Brazil toll pass. See additional details at https://taggy.com.br. + BR_TAGGY = 10; + + // Brazil toll pass. See additional details at + // https://veloe.com.br/site/onde-usar. + BR_VELOE = 11; + + // Canada to United States border crossing. + CA_US_AKWASASNE_SEAWAY_CORPORATE_CARD = 84; + + // Canada to United States border crossing. + CA_US_AKWASASNE_SEAWAY_TRANSIT_CARD = 85; + + // Ontario, Canada to Michigan, United States border crossing. + CA_US_BLUE_WATER_EDGE_PASS = 18; + + // Ontario, Canada to Michigan, United States border crossing. + CA_US_CONNEXION = 19; + + // Canada to United States border crossing. + CA_US_NEXUS_CARD = 20; + + // Indonesia. + // E-card provided by multiple banks used to pay for tolls. All e-cards + // via banks are charged the same so only one enum value is needed. E.g. + // - Bank Mandiri https://www.bankmandiri.co.id/e-money + // - BCA https://www.bca.co.id/flazz + // - BNI https://www.bni.co.id/id-id/ebanking/tapcash + ID_E_TOLL = 16; + + // India. + IN_FASTAG = 78; + + // India, HP state plate exemption. + IN_LOCAL_HP_PLATE_EXEMPT = 79; + + // Mexico toll pass. + // https://iave.capufe.gob.mx/#/ + MX_IAVE = 90; + + // Mexico + // https://www.pase.com.mx + MX_PASE = 91; + + // Mexico + // https://operadoravial.com/quick-pass/ + MX_QUICKPASS = 93; + + // http://appsh.chihuahua.gob.mx/transparencia/?doc=/ingresos/TelepeajeFormato4.pdf + MX_SISTEMA_TELEPEAJE_CHIHUAHUA = 89; + + // Mexico + MX_TAG_IAVE = 12; + + // Mexico toll pass company. One of many operating in Mexico City. See + // additional details at https://www.televia.com.mx. + MX_TAG_TELEVIA = 13; + + // Mexico toll pass company. One of many operating in Mexico City. + // https://www.televia.com.mx + MX_TELEVIA = 92; + + // Mexico toll pass. See additional details at + // https://www.viapass.com.mx/viapass/web_home.aspx. + MX_VIAPASS = 14; + + // AL, USA. + US_AL_FREEDOM_PASS = 21; + + // AK, USA. + US_AK_ANTON_ANDERSON_TUNNEL_BOOK_OF_10_TICKETS = 22; + + // CA, USA. + US_CA_FASTRAK = 4; + + // Indicates driver has any FasTrak pass in addition to the DMV issued Clean + // Air Vehicle (CAV) sticker. + // https://www.bayareafastrak.org/en/guide/doINeedFlex.shtml + US_CA_FASTRAK_CAV_STICKER = 86; + + // CO, USA. + US_CO_EXPRESSTOLL = 23; + + // CO, USA. + US_CO_GO_PASS = 24; + + // DE, USA. + US_DE_EZPASSDE = 25; + + // FL, USA. + US_FL_BOB_SIKES_TOLL_BRIDGE_PASS = 65; + + // FL, USA. + US_FL_DUNES_COMMUNITY_DEVELOPMENT_DISTRICT_EXPRESSCARD = 66; + + // FL, USA. + US_FL_EPASS = 67; + + // FL, USA. + US_FL_GIBA_TOLL_PASS = 68; + + // FL, USA. + US_FL_LEEWAY = 69; + + // FL, USA. + US_FL_SUNPASS = 70; + + // FL, USA. + US_FL_SUNPASS_PRO = 71; + + // IL, USA. + US_IL_EZPASSIL = 73; + + // IL, USA. + US_IL_IPASS = 72; + + // IN, USA. + US_IN_EZPASSIN = 26; + + // KS, USA. + US_KS_BESTPASS_HORIZON = 27; + + // KS, USA. + US_KS_KTAG = 28; + + // KS, USA. + US_KS_NATIONALPASS = 29; + + // KS, USA. + US_KS_PREPASS_ELITEPASS = 30; + + // KY, USA. + US_KY_RIVERLINK = 31; + + // LA, USA. + US_LA_GEAUXPASS = 32; + + // LA, USA. + US_LA_TOLL_TAG = 33; + + // MA, USA. + US_MA_EZPASSMA = 6; + + // MD, USA. + US_MD_EZPASSMD = 34; + + // ME, USA. + US_ME_EZPASSME = 35; + + // MI, USA. + US_MI_AMBASSADOR_BRIDGE_PREMIER_COMMUTER_CARD = 36; + + // MI, USA. + US_MI_BCPASS = 94; + + // MI, USA. + US_MI_GROSSE_ILE_TOLL_BRIDGE_PASS_TAG = 37; + + // MI, USA. + // Deprecated as this pass type no longer exists. + US_MI_IQ_PROX_CARD = 38 [deprecated = true]; + + // MI, USA. + US_MI_IQ_TAG = 95; + + // MI, USA. + US_MI_MACKINAC_BRIDGE_MAC_PASS = 39; + + // MI, USA. + US_MI_NEXPRESS_TOLL = 40; + + // MN, USA. + US_MN_EZPASSMN = 41; + + // NC, USA. + US_NC_EZPASSNC = 42; + + // NC, USA. + US_NC_PEACH_PASS = 87; + + // NC, USA. + US_NC_QUICK_PASS = 43; + + // NH, USA. + US_NH_EZPASSNH = 80; + + // NJ, USA. + US_NJ_DOWNBEACH_EXPRESS_PASS = 75; + + // NJ, USA. + US_NJ_EZPASSNJ = 74; + + // NY, USA. + US_NY_EXPRESSPASS = 76; + + // NY, USA. + US_NY_EZPASSNY = 77; + + // OH, USA. + US_OH_EZPASSOH = 44; + + // PA, USA. + US_PA_EZPASSPA = 45; + + // RI, USA. + US_RI_EZPASSRI = 46; + + // SC, USA. + US_SC_PALPASS = 47; + + // TX, USA. + US_TX_AVI_TAG = 97; + + // TX, USA. + US_TX_BANCPASS = 48; + + // TX, USA. + US_TX_DEL_RIO_PASS = 49; + + // TX, USA. + US_TX_EFAST_PASS = 50; + + // TX, USA. + US_TX_EAGLE_PASS_EXPRESS_CARD = 51; + + // TX, USA. + US_TX_EPTOLL = 52; + + // TX, USA. + US_TX_EZ_CROSS = 53; + + // TX, USA. + US_TX_EZTAG = 54; + + // TX, USA. + US_TX_FUEGO_TAG = 96; + + // TX, USA. + US_TX_LAREDO_TRADE_TAG = 55; + + // TX, USA. + US_TX_PLUSPASS = 56; + + // TX, USA. + US_TX_TOLLTAG = 57; + + // TX, USA. + US_TX_TXTAG = 58; + + // TX, USA. + US_TX_XPRESS_CARD = 59; + + // UT, USA. + US_UT_ADAMS_AVE_PARKWAY_EXPRESSCARD = 60; + + // VA, USA. + US_VA_EZPASSVA = 61; + + // WA, USA. + US_WA_BREEZEBY = 17; + + // WA, USA. + US_WA_GOOD_TO_GO = 1; + + // WV, USA. + US_WV_EZPASSWV = 62; + + // WV, USA. + US_WV_MEMORIAL_BRIDGE_TICKETS = 63; + + // WV, USA. + US_WV_NEWELL_TOLL_BRIDGE_TICKET = 64; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/traffic_model.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/traffic_model.proto new file mode 100644 index 00000000000..4326b4b12f7 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/traffic_model.proto @@ -0,0 +1,52 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "TrafficModelProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Specifies the assumptions to use when calculating time in traffic. This +// setting affects the value returned in the `duration` field in the +// response, which contains the predicted time in traffic based on historical +// averages. +enum TrafficModel { + // Unused. If specified, will default to `BEST_GUESS`. + TRAFFIC_MODEL_UNSPECIFIED = 0; + + // Indicates that the returned `duration` should be the best + // estimate of travel time given what is known about both historical traffic + // conditions and live traffic. Live traffic becomes more important the closer + // the `departure_time` is to now. + BEST_GUESS = 1; + + // Indicates that the returned duration should be longer than the + // actual travel time on most days, though occasional days with particularly + // bad traffic conditions may exceed this value. + PESSIMISTIC = 2; + + // Indicates that the returned duration should be shorter than the actual + // travel time on most days, though occasional days with particularly good + // traffic conditions may be faster than this value. + OPTIMISTIC = 3; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit.proto new file mode 100644 index 00000000000..5099a4ff131 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit.proto @@ -0,0 +1,161 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +import "google/maps/routing/v2/location.proto"; +import "google/type/localized_text.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "TransitProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// A transit agency that operates a transit line. +message TransitAgency { + // The name of this transit agency. + string name = 1; + + // The transit agency's locale-specific formatted phone number. + string phone_number = 2; + + // The transit agency's URI. + string uri = 3; +} + +// Contains information about the transit line used in this step. +message TransitLine { + // The transit agency (or agencies) that operates this transit line. + repeated TransitAgency agencies = 1; + + // The full name of this transit line, For example, "8 Avenue Local". + string name = 2; + + // the URI for this transit line as provided by the transit agency. + string uri = 3; + + // The color commonly used in signage for this line. Represented in + // hexadecimal. + string color = 4; + + // The URI for the icon associated with this line. + string icon_uri = 5; + + // The short name of this transit line. This name will normally be a line + // number, such as "M7" or "355". + string name_short = 6; + + // The color commonly used in text on signage for this line. Represented in + // hexadecimal. + string text_color = 7; + + // The type of vehicle that operates on this transit line. + TransitVehicle vehicle = 8; +} + +// Information about a transit stop. +message TransitStop { + // The name of the transit stop. + string name = 1; + + // The location of the stop expressed in latitude/longitude coordinates. + Location location = 2; +} + +// Information about a vehicle used in transit routes. +message TransitVehicle { + // The type of vehicles for transit routes. + enum TransitVehicleType { + // Unused. + TRANSIT_VEHICLE_TYPE_UNSPECIFIED = 0; + + // Bus. + BUS = 1; + + // A vehicle that operates on a cable, usually on the ground. Aerial cable + // cars may be of the type `GONDOLA_LIFT`. + CABLE_CAR = 2; + + // Commuter rail. + COMMUTER_TRAIN = 3; + + // Ferry. + FERRY = 4; + + // A vehicle that is pulled up a steep incline by a cable. A Funicular + // typically consists of two cars, with each car acting as a counterweight + // for the other. + FUNICULAR = 5; + + // An aerial cable car. + GONDOLA_LIFT = 6; + + // Heavy rail. + HEAVY_RAIL = 7; + + // High speed train. + HIGH_SPEED_TRAIN = 8; + + // Intercity bus. + INTERCITY_BUS = 9; + + // Long distance train. + LONG_DISTANCE_TRAIN = 10; + + // Light rail transit. + METRO_RAIL = 11; + + // Monorail. + MONORAIL = 12; + + // All other vehicles. + OTHER = 13; + + // Rail. + RAIL = 14; + + // Share taxi is a kind of bus with the ability to drop off and pick up + // passengers anywhere on its route. + SHARE_TAXI = 15; + + // Underground light rail. + SUBWAY = 16; + + // Above ground light rail. + TRAM = 17; + + // Trolleybus. + TROLLEYBUS = 18; + } + + // The name of this vehicle, capitalized. + google.type.LocalizedText name = 1; + + // The type of vehicle used. + TransitVehicleType type = 2; + + // The URI for an icon associated with this vehicle type. + string icon_uri = 3; + + // The URI for the icon associated with this vehicle type, based on the local + // transport signage. + string local_icon_uri = 4; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit_preferences.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit_preferences.proto new file mode 100644 index 00000000000..987c062284e --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit_preferences.proto @@ -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 +// +// 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.maps.routing.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "TransitPreferencesProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Preferences for `TRANSIT` based routes that influence the route that is +// returned. +message TransitPreferences { + // A set of values used to specify the mode of transit. + enum TransitTravelMode { + // No transit travel mode specified. + TRANSIT_TRAVEL_MODE_UNSPECIFIED = 0; + + // Travel by bus. + BUS = 1; + + // Travel by subway. + SUBWAY = 2; + + // Travel by train. + TRAIN = 3; + + // Travel by light rail or tram. + LIGHT_RAIL = 4; + + // Travel by rail. This is equivalent to a combination of `SUBWAY`, `TRAIN`, + // and `LIGHT_RAIL`. + RAIL = 5; + } + + // Specifies routing preferences for transit routes. + enum TransitRoutingPreference { + // No preference specified. + TRANSIT_ROUTING_PREFERENCE_UNSPECIFIED = 0; + + // Indicates that the calculated route should prefer limited amounts of + // walking. + LESS_WALKING = 1; + + // Indicates that the calculated route should prefer a limited number of + // transfers. + FEWER_TRANSFERS = 2; + } + + // A set of travel modes to use when getting a `TRANSIT` route. Defaults to + // all supported modes of travel. + repeated TransitTravelMode allowed_travel_modes = 1; + + // A routing preference that, when specified, influences the `TRANSIT` route + // returned. + TransitRoutingPreference routing_preference = 2; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/units.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/units.proto new file mode 100644 index 00000000000..d94df6c3ea0 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/units.proto @@ -0,0 +1,40 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "UnitsProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// A set of values that specify the unit of measure used in the display. +enum Units { + // Units of measure not specified. Defaults to the unit of measure inferred + // from the request. + UNITS_UNSPECIFIED = 0; + + // Metric units of measure. + METRIC = 1; + + // Imperial (English) units of measure. + IMPERIAL = 2; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_emission_type.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_emission_type.proto new file mode 100644 index 00000000000..5109d4d30aa --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_emission_type.proto @@ -0,0 +1,47 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "VehicleEmissionTypeProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// A set of values describing the vehicle's emission type. +// Applies only to the `DRIVE` +// [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. +enum VehicleEmissionType { + // No emission type specified. Default to `GASOLINE`. + VEHICLE_EMISSION_TYPE_UNSPECIFIED = 0; + + // Gasoline/petrol fueled vehicle. + GASOLINE = 1; + + // Electricity powered vehicle. + ELECTRIC = 2; + + // Hybrid fuel (such as gasoline + electric) vehicle. + HYBRID = 3; + + // Diesel fueled vehicle. + DIESEL = 4; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_info.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_info.proto new file mode 100644 index 00000000000..574d15f5de8 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_info.proto @@ -0,0 +1,37 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.maps.routing.v2; + +import "google/maps/routing/v2/vehicle_emission_type.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "VehicleInfoProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Contains the vehicle information, such as the vehicle emission type. +message VehicleInfo { + // Describes the vehicle's emission type. + // Applies only to the `DRIVE` + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. + VehicleEmissionType emission_type = 2; +} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/waypoint.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/waypoint.proto new file mode 100644 index 00000000000..8a02d5e7d04 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/waypoint.proto @@ -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 +// +// 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.maps.routing.v2; + +import "google/maps/routing/v2/location.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Maps.Routing.V2"; +option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; +option java_multiple_files = true; +option java_outer_classname = "WaypointProto"; +option java_package = "com.google.maps.routing.v2"; +option objc_class_prefix = "GMRV2"; +option php_namespace = "Google\\Maps\\Routing\\V2"; +option ruby_package = "Google::Maps::Routing::V2"; + +// Encapsulates a waypoint. Waypoints mark both the beginning and end of a +// route, and include intermediate stops along the route. +message Waypoint { + // Different ways to represent a location. + oneof location_type { + // A point specified using geographic coordinates, including an optional + // heading. + Location location = 1; + + // The POI Place ID associated with the waypoint. + string place_id = 2; + + // Human readable address or a plus code. + // See https://plus.codes for details. + string address = 7; + } + + // Marks this waypoint as a milestone rather a stopping point. For + // each non-via waypoint in the request, the response appends an entry to the + // [legs][google.maps.routing.v2.Route.legs] + // array to provide the details for stopovers on that leg of the trip. Set + // this value to true when you want the route to pass through this waypoint + // without stopping over. Via waypoints don't cause an entry to be added to + // the `legs` array, but they do route the journey through the waypoint. You + // can only set this value on waypoints that are intermediates. The request + // fails if you set this field on terminal waypoints. If + // `ComputeRoutesRequest.optimize_waypoint_order` is set to true then this + // field cannot be set to true; otherwise, the request fails. + bool via = 3; + + // Indicates that the waypoint is meant for vehicles to stop at, where the + // intention is to either pickup or drop-off. When you set this value, the + // calculated route won't include non-`via` waypoints on roads that are + // unsuitable for pickup and drop-off. This option works only for `DRIVE` and + // `TWO_WHEELER` travel modes, and when the `location_type` is + // [Location][google.maps.routing.v2.Location]. + bool vehicle_stopover = 4; + + // Indicates that the location of this waypoint is meant to have a preference + // for the vehicle to stop at a particular side of road. When you set this + // value, the route will pass through the location so that the vehicle can + // stop at the side of road that the location is biased towards from the + // center of the road. This option works only for 'DRIVE' and 'TWO_WHEELER' + // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. + bool side_of_road = 5; +} diff --git a/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_route_matrix.js b/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_route_matrix.js new file mode 100644 index 00000000000..4615a86aa37 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_route_matrix.js @@ -0,0 +1,146 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(origins, destinations) { + // [START routes_v2_generated_Routes_ComputeRouteMatrix_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Array of origins, which determines the rows of the response + * matrix. Several size restrictions apply to the cardinality of origins and + * destinations: + * * The number of elements (origins × destinations) must be no greater than + * 625 in any case. + * * The number of elements (origins × destinations) must be no greater than + * 100 if routing_preference is set to `TRAFFIC_AWARE_OPTIMAL`. + * * The number of waypoints (origins + destinations) specified as `place_id` + * must be no greater than 50. + */ + // const origins = [1,2,3,4] + /** + * Required. Array of destinations, which determines the columns of the + * response matrix. + */ + // const destinations = [1,2,3,4] + /** + * Optional. Specifies the mode of transportation. + */ + // const travelMode = {} + /** + * Optional. Specifies how to compute the route. The server attempts to use + * the selected routing preference to compute the route. If the routing + * preference results in an error or an extra long latency, an error is + * returned. You can specify this option only when the `travel_mode` is + * `DRIVE` or `TWO_WHEELER`, otherwise the request fails. + */ + // const routingPreference = {} + /** + * Optional. The departure time. If you don't set this value, then this value + * defaults to the time that you made the request. + * NOTE: You can only specify a `departure_time` in the past when + * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to + * `TRANSIT`. + */ + // const departureTime = {} + /** + * Optional. The arrival time. + * NOTE: Can only be set when + * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to + * `TRANSIT`. You can specify either departure_time or arrival_time, but not + * both. + */ + // const arrivalTime = {} + /** + * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See + * Language Support (https://developers.google.com/maps/faq#languagesupport) + * for the list of supported languages. When you don't provide this value, the + * display language is inferred from the location of the first origin. + */ + // const languageCode = 'abc123' + /** + * Optional. The region code, specified as a ccTLD ("top-level domain") + * two-character value. For more information see + * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains + */ + // const regionCode = 'abc123' + /** + * Optional. A list of extra computations which may be used to complete the + * request. Note: These extra computations may return extra fields on the + * response. These extra fields must also be specified in the field mask to be + * returned in the response. + */ + // const extraComputations = [1,2,3,4] + /** + * Optional. Specifies the assumptions to use when calculating time in + * traffic. This setting affects the value returned in the duration field in + * the RouteMatrixElement google.maps.routing.v2.RouteMatrixElement which + * contains the predicted time in traffic based on historical averages. + * RoutingPreference google.maps.routing.v2.RoutingPreference to + * `TRAFFIC_AWARE_OPTIMAL` and + * RouteTravelMode google.maps.routing.v2.RouteTravelMode to `DRIVE`. + * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not + * specified. + */ + // const trafficModel = {} + /** + * Optional. Specifies preferences that influence the route returned for + * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when + * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to + * `TRANSIT`. + */ + // const transitPreferences = {} + + // Imports the Routing library + const {RoutesClient} = require('@googlemaps/routing').v2; + + // Instantiates a client + const routingClient = new RoutesClient(); + + async function callComputeRouteMatrix() { + // Construct request + const request = { + origins, + destinations, + }; + + // Run request + const stream = await routingClient.computeRouteMatrix(request); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + } + + callComputeRouteMatrix(); + // [END routes_v2_generated_Routes_ComputeRouteMatrix_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_routes.js b/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_routes.js new file mode 100644 index 00000000000..b4cd159c894 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_routes.js @@ -0,0 +1,192 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(origin, destination) { + // [START routes_v2_generated_Routes_ComputeRoutes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Origin waypoint. + */ + // const origin = {} + /** + * Required. Destination waypoint. + */ + // const destination = {} + /** + * Optional. A set of waypoints along the route (excluding terminal points), + * for either stopping at or passing by. Up to 25 intermediate waypoints are + * supported. + */ + // const intermediates = [1,2,3,4] + /** + * Optional. Specifies the mode of transportation. + */ + // const travelMode = {} + /** + * Optional. Specifies how to compute the route. The server + * attempts to use the selected routing preference to compute the route. If + * the routing preference results in an error or an extra long latency, then + * an error is returned. You can specify this option only when the + * `travel_mode` is `DRIVE` or `TWO_WHEELER`, otherwise the request fails. + */ + // const routingPreference = {} + /** + * Optional. Specifies your preference for the quality of the polyline. + */ + // const polylineQuality = {} + /** + * Optional. Specifies the preferred encoding for the polyline. + */ + // const polylineEncoding = {} + /** + * Optional. The departure time. If you don't set this value, then this value + * defaults to the time that you made the request. + * NOTE: You can only specify a `departure_time` in the past when + * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to + * `TRANSIT`. + */ + // const departureTime = {} + /** + * Optional. The arrival time. + * NOTE: Can only be set when + * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to + * `TRANSIT`. You can specify either departure_time or arrival_time, but not + * both. + */ + // const arrivalTime = {} + /** + * Optional. Specifies whether to calculate alternate routes in addition to + * the route. No alternative routes are returned for requests that have + * intermediate waypoints. + */ + // const computeAlternativeRoutes = true + /** + * Optional. A set of conditions to satisfy that affect the way routes are + * calculated. + */ + // const routeModifiers = {} + /** + * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See + * Language Support (https://developers.google.com/maps/faq#languagesupport) + * for the list of supported languages. When you don't provide this value, the + * display language is inferred from the location of the route request. + */ + // const languageCode = 'abc123' + /** + * Optional. The region code, specified as a ccTLD ("top-level domain") + * two-character value. For more information see + * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains + */ + // const regionCode = 'abc123' + /** + * Optional. Specifies the units of measure for the display fields. These + * fields include the `instruction` field in + * NavigationInstruction google.maps.routing.v2.NavigationInstruction. The + * units of measure used for the route, leg, step distance, and duration are + * not affected by this value. If you don't provide this value, then the + * display units are inferred from the location of the first origin. + */ + // const units = {} + /** + * Optional. If set to true, the service attempts to minimize the overall cost + * of the route by re-ordering the specified intermediate waypoints. The + * request fails if any of the intermediate waypoints is a `via` waypoint. Use + * `ComputeRoutesResponse.Routes.optimized_intermediate_waypoint_index` to + * find the new ordering. + * If `ComputeRoutesResponseroutes.optimized_intermediate_waypoint_index` is + * not requested in the `X-Goog-FieldMask` header, the request fails. + * If `optimize_waypoint_order` is set to false, + * `ComputeRoutesResponse.optimized_intermediate_waypoint_index` will be + * empty. + */ + // const optimizeWaypointOrder = true + /** + * Optional. Specifies what reference routes to calculate as part of the + * request in addition to the default route. A reference route is a route with + * a different route calculation objective than the default route. For example + * a `FUEL_EFFICIENT` reference route calculation takes into account various + * parameters that would generate an optimal fuel efficient route. + */ + // const requestedReferenceRoutes = [1,2,3,4] + /** + * Optional. A list of extra computations which may be used to complete the + * request. Note: These extra computations may return extra fields on the + * response. These extra fields must also be specified in the field mask to be + * returned in the response. + */ + // const extraComputations = [1,2,3,4] + /** + * Optional. Specifies the assumptions to use when calculating time in + * traffic. This setting affects the value returned in the duration field in + * the Route google.maps.routing.v2.Route and + * RouteLeg google.maps.routing.v2.RouteLeg which contains the predicted + * time in traffic based on historical averages. + * `TrafficModel` is only available for requests that have set + * RoutingPreference google.maps.routing.v2.RoutingPreference to + * `TRAFFIC_AWARE_OPTIMAL` and + * RouteTravelMode google.maps.routing.v2.RouteTravelMode to `DRIVE`. + * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not + * specified. + */ + // const trafficModel = {} + /** + * Optional. Specifies preferences that influence the route returned for + * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when + * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to + * `TRANSIT`. + */ + // const transitPreferences = {} + + // Imports the Routing library + const {RoutesClient} = require('@googlemaps/routing').v2; + + // Instantiates a client + const routingClient = new RoutesClient(); + + async function callComputeRoutes() { + // Construct request + const request = { + origin, + destination, + }; + + // Run request + const response = await routingClient.computeRoutes(request); + console.log(response); + } + + callComputeRoutes(); + // [END routes_v2_generated_Routes_ComputeRoutes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/snippet_metadata_google.maps.routing.v2.json b/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/snippet_metadata_google.maps.routing.v2.json new file mode 100644 index 00000000000..c31ccda31ae --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/snippet_metadata_google.maps.routing.v2.json @@ -0,0 +1,207 @@ +{ + "clientLibrary": { + "name": "nodejs-routing", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.maps.routing.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "routes_v2_generated_Routes_ComputeRoutes_async", + "title": "Routes computeRoutes Sample", + "origin": "API_DEFINITION", + "description": " Returns the primary route along with optional alternate routes, given a set of terminal and intermediate waypoints. **NOTE:** This method requires that you specify a response field mask in the input. You can provide the response field mask by using URL parameter `$fields` or `fields`, or by using an HTTP/gRPC header `X-Goog-FieldMask` (see the [available URL parameters and headers](https://cloud.google.com/apis/docs/system-parameters). The value is a comma separated list of field paths. See detailed documentation about [how to construct the field paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). For example, in this method: * Field mask of all available fields (for manual inspection): `X-Goog-FieldMask: *` * Field mask of Route-level duration, distance, and polyline (an example production setup): `X-Goog-FieldMask: routes.duration,routes.distanceMeters,routes.polyline.encodedPolyline` Google discourage the use of the wildcard (`*`) response field mask, or specifying the field mask at the top level (`routes`), because: * Selecting only the fields that you need helps our server save computation cycles, allowing us to return the result to you with a lower latency. * Selecting only the fields that you need in your production job ensures stable latency performance. We might add more response fields in the future, and those new fields might require extra computation time. If you select all fields, or if you select all fields at the top level, then you might experience performance degradation because any new field we add will be automatically included in the response. * Selecting only the fields that you need results in a smaller response size, and thus higher network throughput.", + "canonical": true, + "file": "routes.compute_routes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 184, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ComputeRoutes", + "fullName": "google.maps.routing.v2.Routes.ComputeRoutes", + "async": true, + "parameters": [ + { + "name": "origin", + "type": ".google.maps.routing.v2.Waypoint" + }, + { + "name": "destination", + "type": ".google.maps.routing.v2.Waypoint" + }, + { + "name": "intermediates", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "travel_mode", + "type": ".google.maps.routing.v2.RouteTravelMode" + }, + { + "name": "routing_preference", + "type": ".google.maps.routing.v2.RoutingPreference" + }, + { + "name": "polyline_quality", + "type": ".google.maps.routing.v2.PolylineQuality" + }, + { + "name": "polyline_encoding", + "type": ".google.maps.routing.v2.PolylineEncoding" + }, + { + "name": "departure_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "arrival_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compute_alternative_routes", + "type": "TYPE_BOOL" + }, + { + "name": "route_modifiers", + "type": ".google.maps.routing.v2.RouteModifiers" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "region_code", + "type": "TYPE_STRING" + }, + { + "name": "units", + "type": ".google.maps.routing.v2.Units" + }, + { + "name": "optimize_waypoint_order", + "type": "TYPE_BOOL" + }, + { + "name": "requested_reference_routes", + "type": "TYPE_ENUM[]" + }, + { + "name": "extra_computations", + "type": "TYPE_ENUM[]" + }, + { + "name": "traffic_model", + "type": ".google.maps.routing.v2.TrafficModel" + }, + { + "name": "transit_preferences", + "type": ".google.maps.routing.v2.TransitPreferences" + } + ], + "resultType": ".google.maps.routing.v2.ComputeRoutesResponse", + "client": { + "shortName": "RoutesClient", + "fullName": "google.maps.routing.v2.RoutesClient" + }, + "method": { + "shortName": "ComputeRoutes", + "fullName": "google.maps.routing.v2.Routes.ComputeRoutes", + "service": { + "shortName": "Routes", + "fullName": "google.maps.routing.v2.Routes" + } + } + } + }, + { + "regionTag": "routes_v2_generated_Routes_ComputeRouteMatrix_async", + "title": "Routes computeRouteMatrix Sample", + "origin": "API_DEFINITION", + "description": " Takes in a list of origins and destinations and returns a stream containing route information for each combination of origin and destination. **NOTE:** This method requires that you specify a response field mask in the input. You can provide the response field mask by using the URL parameter `$fields` or `fields`, or by using the HTTP/gRPC header `X-Goog-FieldMask` (see the [available URL parameters and headers](https://cloud.google.com/apis/docs/system-parameters). The value is a comma separated list of field paths. See this detailed documentation about [how to construct the field paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). For example, in this method: * Field mask of all available fields (for manual inspection): `X-Goog-FieldMask: *` * Field mask of route durations, distances, element status, condition, and element indices (an example production setup): `X-Goog-FieldMask: originIndex,destinationIndex,status,condition,distanceMeters,duration` It is critical that you include `status` in your field mask as otherwise all messages will appear to be OK. Google discourages the use of the wildcard (`*`) response field mask, because: * Selecting only the fields that you need helps our server save computation cycles, allowing us to return the result to you with a lower latency. * Selecting only the fields that you need in your production job ensures stable latency performance. We might add more response fields in the future, and those new fields might require extra computation time. If you select all fields, or if you select all fields at the top level, then you might experience performance degradation because any new field we add will be automatically included in the response. * Selecting only the fields that you need results in a smaller response size, and thus higher network throughput.", + "canonical": true, + "file": "routes.compute_route_matrix.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 138, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ComputeRouteMatrix", + "fullName": "google.maps.routing.v2.Routes.ComputeRouteMatrix", + "async": true, + "parameters": [ + { + "name": "origins", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "destinations", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "travel_mode", + "type": ".google.maps.routing.v2.RouteTravelMode" + }, + { + "name": "routing_preference", + "type": ".google.maps.routing.v2.RoutingPreference" + }, + { + "name": "departure_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "arrival_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "region_code", + "type": "TYPE_STRING" + }, + { + "name": "extra_computations", + "type": "TYPE_ENUM[]" + }, + { + "name": "traffic_model", + "type": ".google.maps.routing.v2.TrafficModel" + }, + { + "name": "transit_preferences", + "type": ".google.maps.routing.v2.TransitPreferences" + } + ], + "resultType": ".google.maps.routing.v2.RouteMatrixElement", + "client": { + "shortName": "RoutesClient", + "fullName": "google.maps.routing.v2.RoutesClient" + }, + "method": { + "shortName": "ComputeRouteMatrix", + "fullName": "google.maps.routing.v2.Routes.ComputeRouteMatrix", + "service": { + "shortName": "Routes", + "fullName": "google.maps.routing.v2.Routes" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-maps-routing/v2/src/index.ts b/owl-bot-staging/google-maps-routing/v2/src/index.ts new file mode 100644 index 00000000000..fd7f1a8a3c8 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/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 RoutesClient = v2.RoutesClient; +type RoutesClient = v2.RoutesClient; +export {v2, RoutesClient}; +export default {v2, RoutesClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-maps-routing/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-maps-routing/v2/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..46b4f4a8b5a --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/src/v2/gapic_metadata.json @@ -0,0 +1,38 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.maps.routing.v2", + "libraryPackage": "@googlemaps/routing", + "services": { + "Routes": { + "clients": { + "grpc": { + "libraryClient": "RoutesClient", + "rpcs": { + "ComputeRoutes": { + "methods": [ + "computeRoutes" + ] + }, + "ComputeRouteMatrix": { + "methods": [ + "computeRouteMatrix" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "RoutesClient", + "rpcs": { + "ComputeRoutes": { + "methods": [ + "computeRoutes" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-maps-routing/v2/src/v2/index.ts b/owl-bot-staging/google-maps-routing/v2/src/v2/index.ts new file mode 100644 index 00000000000..860222c098b --- /dev/null +++ b/owl-bot-staging/google-maps-routing/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 {RoutesClient} from './routes_client'; diff --git a/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client.ts b/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client.ts new file mode 100644 index 00000000000..13493866202 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client.ts @@ -0,0 +1,636 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/v2/routes_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './routes_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Routes API. + * @class + * @memberof v2 + */ +export class RoutesClient { + 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}; + routesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of RoutesClient. + * + * @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 RoutesClient({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 RoutesClient; + 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 = { + computeRouteMatrix: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.maps.routing.v2.Routes', 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.routesStub) { + return this.routesStub; + } + + // Put together the "service stub" for + // google.maps.routing.v2.Routes. + this.routesStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.maps.routing.v2.Routes') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.maps.routing.v2.Routes, + 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 routesStubMethods = + ['computeRoutes', 'computeRouteMatrix']; + for (const methodName of routesStubMethods) { + const callPromise = this.routesStub.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.routesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'routes.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 'routes.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 []; + } + + 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 the primary route along with optional alternate routes, given a set + * of terminal and intermediate waypoints. + * + * **NOTE:** This method requires that you specify a response field mask in + * the input. You can provide the response field mask by using URL parameter + * `$fields` or `fields`, or by using an HTTP/gRPC header `X-Goog-FieldMask` + * (see the [available URL parameters and + * headers](https://cloud.google.com/apis/docs/system-parameters). The value + * is a comma separated list of field paths. See detailed documentation about + * [how to construct the field + * paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). + * + * For example, in this method: + * + * * Field mask of all available fields (for manual inspection): + * `X-Goog-FieldMask: *` + * * Field mask of Route-level duration, distance, and polyline (an example + * production setup): + * `X-Goog-FieldMask: + * routes.duration,routes.distanceMeters,routes.polyline.encodedPolyline` + * + * Google discourage the use of the wildcard (`*`) response field mask, or + * specifying the field mask at the top level (`routes`), because: + * + * * Selecting only the fields that you need helps our server save computation + * cycles, allowing us to return the result to you with a lower latency. + * * Selecting only the fields that you need + * in your production job ensures stable latency performance. We might add + * more response fields in the future, and those new fields might require + * extra computation time. If you select all fields, or if you select all + * fields at the top level, then you might experience performance degradation + * because any new field we add will be automatically included in the + * response. + * * Selecting only the fields that you need results in a smaller response + * size, and thus higher network throughput. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.maps.routing.v2.Waypoint} request.origin + * Required. Origin waypoint. + * @param {google.maps.routing.v2.Waypoint} request.destination + * Required. Destination waypoint. + * @param {number[]} [request.intermediates] + * Optional. A set of waypoints along the route (excluding terminal points), + * for either stopping at or passing by. Up to 25 intermediate waypoints are + * supported. + * @param {google.maps.routing.v2.RouteTravelMode} [request.travelMode] + * Optional. Specifies the mode of transportation. + * @param {google.maps.routing.v2.RoutingPreference} [request.routingPreference] + * Optional. Specifies how to compute the route. The server + * attempts to use the selected routing preference to compute the route. If + * the routing preference results in an error or an extra long latency, then + * an error is returned. You can specify this option only when the + * `travel_mode` is `DRIVE` or `TWO_WHEELER`, otherwise the request fails. + * @param {google.maps.routing.v2.PolylineQuality} [request.polylineQuality] + * Optional. Specifies your preference for the quality of the polyline. + * @param {google.maps.routing.v2.PolylineEncoding} [request.polylineEncoding] + * Optional. Specifies the preferred encoding for the polyline. + * @param {google.protobuf.Timestamp} [request.departureTime] + * Optional. The departure time. If you don't set this value, then this value + * defaults to the time that you made the request. + * NOTE: You can only specify a `departure_time` in the past when + * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to + * `TRANSIT`. + * @param {google.protobuf.Timestamp} [request.arrivalTime] + * Optional. The arrival time. + * NOTE: Can only be set when + * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to + * `TRANSIT`. You can specify either departure_time or arrival_time, but not + * both. + * @param {boolean} [request.computeAlternativeRoutes] + * Optional. Specifies whether to calculate alternate routes in addition to + * the route. No alternative routes are returned for requests that have + * intermediate waypoints. + * @param {google.maps.routing.v2.RouteModifiers} [request.routeModifiers] + * Optional. A set of conditions to satisfy that affect the way routes are + * calculated. + * @param {string} [request.languageCode] + * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See + * [Language Support](https://developers.google.com/maps/faq#languagesupport) + * for the list of supported languages. When you don't provide this value, the + * display language is inferred from the location of the route request. + * @param {string} [request.regionCode] + * Optional. The region code, specified as a ccTLD ("top-level domain") + * two-character value. For more information see + * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains + * @param {google.maps.routing.v2.Units} [request.units] + * Optional. Specifies the units of measure for the display fields. These + * fields include the `instruction` field in + * {@link protos.google.maps.routing.v2.NavigationInstruction|NavigationInstruction}. The + * units of measure used for the route, leg, step distance, and duration are + * not affected by this value. If you don't provide this value, then the + * display units are inferred from the location of the first origin. + * @param {boolean} [request.optimizeWaypointOrder] + * Optional. If set to true, the service attempts to minimize the overall cost + * of the route by re-ordering the specified intermediate waypoints. The + * request fails if any of the intermediate waypoints is a `via` waypoint. Use + * `ComputeRoutesResponse.Routes.optimized_intermediate_waypoint_index` to + * find the new ordering. + * If `ComputeRoutesResponseroutes.optimized_intermediate_waypoint_index` is + * not requested in the `X-Goog-FieldMask` header, the request fails. + * If `optimize_waypoint_order` is set to false, + * `ComputeRoutesResponse.optimized_intermediate_waypoint_index` will be + * empty. + * @param {number[]} [request.requestedReferenceRoutes] + * Optional. Specifies what reference routes to calculate as part of the + * request in addition to the default route. A reference route is a route with + * a different route calculation objective than the default route. For example + * a `FUEL_EFFICIENT` reference route calculation takes into account various + * parameters that would generate an optimal fuel efficient route. + * @param {number[]} [request.extraComputations] + * Optional. A list of extra computations which may be used to complete the + * request. Note: These extra computations may return extra fields on the + * response. These extra fields must also be specified in the field mask to be + * returned in the response. + * @param {google.maps.routing.v2.TrafficModel} [request.trafficModel] + * Optional. Specifies the assumptions to use when calculating time in + * traffic. This setting affects the value returned in the duration field in + * the {@link protos.google.maps.routing.v2.Route|Route} and + * {@link protos.google.maps.routing.v2.RouteLeg|RouteLeg} which contains the predicted + * time in traffic based on historical averages. + * `TrafficModel` is only available for requests that have set + * {@link protos.google.maps.routing.v2.RoutingPreference|RoutingPreference} to + * `TRAFFIC_AWARE_OPTIMAL` and + * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} to `DRIVE`. + * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not + * specified. + * @param {google.maps.routing.v2.TransitPreferences} [request.transitPreferences] + * Optional. Specifies preferences that influence the route returned for + * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when + * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to + * `TRANSIT`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.maps.routing.v2.ComputeRoutesResponse|ComputeRoutesResponse}. + * Please see the {@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/routes.compute_routes.js + * region_tag:routes_v2_generated_Routes_ComputeRoutes_async + */ + computeRoutes( + request?: protos.google.maps.routing.v2.IComputeRoutesRequest, + options?: CallOptions): + Promise<[ + protos.google.maps.routing.v2.IComputeRoutesResponse, + protos.google.maps.routing.v2.IComputeRoutesRequest|undefined, {}|undefined + ]>; + computeRoutes( + request: protos.google.maps.routing.v2.IComputeRoutesRequest, + options: CallOptions, + callback: Callback< + protos.google.maps.routing.v2.IComputeRoutesResponse, + protos.google.maps.routing.v2.IComputeRoutesRequest|null|undefined, + {}|null|undefined>): void; + computeRoutes( + request: protos.google.maps.routing.v2.IComputeRoutesRequest, + callback: Callback< + protos.google.maps.routing.v2.IComputeRoutesResponse, + protos.google.maps.routing.v2.IComputeRoutesRequest|null|undefined, + {}|null|undefined>): void; + computeRoutes( + request?: protos.google.maps.routing.v2.IComputeRoutesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.maps.routing.v2.IComputeRoutesResponse, + protos.google.maps.routing.v2.IComputeRoutesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.maps.routing.v2.IComputeRoutesResponse, + protos.google.maps.routing.v2.IComputeRoutesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.maps.routing.v2.IComputeRoutesResponse, + protos.google.maps.routing.v2.IComputeRoutesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.computeRoutes(request, options, callback); + } + +/** + * Takes in a list of origins and destinations and returns a stream containing + * route information for each combination of origin and destination. + * + * **NOTE:** This method requires that you specify a response field mask in + * the input. You can provide the response field mask by using the URL + * parameter `$fields` or `fields`, or by using the HTTP/gRPC header + * `X-Goog-FieldMask` (see the [available URL parameters and + * headers](https://cloud.google.com/apis/docs/system-parameters). The value + * is a comma separated list of field paths. See this detailed documentation + * about [how to construct the field + * paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). + * + * For example, in this method: + * + * * Field mask of all available fields (for manual inspection): + * `X-Goog-FieldMask: *` + * * Field mask of route durations, distances, element status, condition, and + * element indices (an example production setup): + * `X-Goog-FieldMask: + * originIndex,destinationIndex,status,condition,distanceMeters,duration` + * + * It is critical that you include `status` in your field mask as otherwise + * all messages will appear to be OK. Google discourages the use of the + * wildcard (`*`) response field mask, because: + * + * * Selecting only the fields that you need helps our server save computation + * cycles, allowing us to return the result to you with a lower latency. + * * Selecting only the fields that you need in your production job ensures + * stable latency performance. We might add more response fields in the + * future, and those new fields might require extra computation time. If you + * select all fields, or if you select all fields at the top level, then you + * might experience performance degradation because any new field we add will + * be automatically included in the response. + * * Selecting only the fields that you need results in a smaller response + * size, and thus higher network throughput. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.origins + * Required. Array of origins, which determines the rows of the response + * matrix. Several size restrictions apply to the cardinality of origins and + * destinations: + * + * * The number of elements (origins × destinations) must be no greater than + * 625 in any case. + * * The number of elements (origins × destinations) must be no greater than + * 100 if routing_preference is set to `TRAFFIC_AWARE_OPTIMAL`. + * * The number of waypoints (origins + destinations) specified as `place_id` + * must be no greater than 50. + * @param {number[]} request.destinations + * Required. Array of destinations, which determines the columns of the + * response matrix. + * @param {google.maps.routing.v2.RouteTravelMode} [request.travelMode] + * Optional. Specifies the mode of transportation. + * @param {google.maps.routing.v2.RoutingPreference} [request.routingPreference] + * Optional. Specifies how to compute the route. The server attempts to use + * the selected routing preference to compute the route. If the routing + * preference results in an error or an extra long latency, an error is + * returned. You can specify this option only when the `travel_mode` is + * `DRIVE` or `TWO_WHEELER`, otherwise the request fails. + * @param {google.protobuf.Timestamp} [request.departureTime] + * Optional. The departure time. If you don't set this value, then this value + * defaults to the time that you made the request. + * NOTE: You can only specify a `departure_time` in the past when + * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to + * `TRANSIT`. + * @param {google.protobuf.Timestamp} [request.arrivalTime] + * Optional. The arrival time. + * NOTE: Can only be set when + * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to + * `TRANSIT`. You can specify either departure_time or arrival_time, but not + * both. + * @param {string} [request.languageCode] + * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See + * [Language Support](https://developers.google.com/maps/faq#languagesupport) + * for the list of supported languages. When you don't provide this value, the + * display language is inferred from the location of the first origin. + * @param {string} [request.regionCode] + * Optional. The region code, specified as a ccTLD ("top-level domain") + * two-character value. For more information see + * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains + * @param {number[]} [request.extraComputations] + * Optional. A list of extra computations which may be used to complete the + * request. Note: These extra computations may return extra fields on the + * response. These extra fields must also be specified in the field mask to be + * returned in the response. + * @param {google.maps.routing.v2.TrafficModel} [request.trafficModel] + * Optional. Specifies the assumptions to use when calculating time in + * traffic. This setting affects the value returned in the duration field in + * the {@link protos.google.maps.routing.v2.RouteMatrixElement|RouteMatrixElement} which + * contains the predicted time in traffic based on historical averages. + * {@link protos.google.maps.routing.v2.RoutingPreference|RoutingPreference} to + * `TRAFFIC_AWARE_OPTIMAL` and + * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} to `DRIVE`. + * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not + * specified. + * @param {google.maps.routing.v2.TransitPreferences} [request.transitPreferences] + * Optional. Specifies preferences that influence the route returned for + * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when + * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to + * `TRANSIT`. + * @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 {@link protos.google.maps.routing.v2.RouteMatrixElement|RouteMatrixElement} on 'data' event. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v2/routes.compute_route_matrix.js + * region_tag:routes_v2_generated_Routes_ComputeRouteMatrix_async + */ + computeRouteMatrix( + request?: protos.google.maps.routing.v2.IComputeRouteMatrixRequest, + options?: CallOptions): + gax.CancellableStream{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.computeRouteMatrix(request, 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.routesStub && !this._terminated) { + return this.routesStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client_config.json b/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client_config.json new file mode 100644 index 00000000000..c69ed299a73 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client_config.json @@ -0,0 +1,34 @@ +{ + "interfaces": { + "google.maps.routing.v2.Routes": { + "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": { + "ComputeRoutes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ComputeRouteMatrix": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-maps-routing/v2/src/v2/routes_proto_list.json b/owl-bot-staging/google-maps-routing/v2/src/v2/routes_proto_list.json new file mode 100644 index 00000000000..a32ecb29518 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/src/v2/routes_proto_list.json @@ -0,0 +1,26 @@ +[ + "../../protos/google/geo/type/viewport.proto", + "../../protos/google/maps/routing/v2/fallback_info.proto", + "../../protos/google/maps/routing/v2/geocoding_results.proto", + "../../protos/google/maps/routing/v2/localized_time.proto", + "../../protos/google/maps/routing/v2/location.proto", + "../../protos/google/maps/routing/v2/maneuver.proto", + "../../protos/google/maps/routing/v2/navigation_instruction.proto", + "../../protos/google/maps/routing/v2/polyline.proto", + "../../protos/google/maps/routing/v2/route.proto", + "../../protos/google/maps/routing/v2/route_label.proto", + "../../protos/google/maps/routing/v2/route_modifiers.proto", + "../../protos/google/maps/routing/v2/route_travel_mode.proto", + "../../protos/google/maps/routing/v2/routes_service.proto", + "../../protos/google/maps/routing/v2/routing_preference.proto", + "../../protos/google/maps/routing/v2/speed_reading_interval.proto", + "../../protos/google/maps/routing/v2/toll_info.proto", + "../../protos/google/maps/routing/v2/toll_passes.proto", + "../../protos/google/maps/routing/v2/traffic_model.proto", + "../../protos/google/maps/routing/v2/transit.proto", + "../../protos/google/maps/routing/v2/transit_preferences.proto", + "../../protos/google/maps/routing/v2/units.proto", + "../../protos/google/maps/routing/v2/vehicle_emission_type.proto", + "../../protos/google/maps/routing/v2/vehicle_info.proto", + "../../protos/google/maps/routing/v2/waypoint.proto" +] diff --git a/owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..5ba9f8b1512 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/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 routing = require('@googlemaps/routing'); + +function main() { + const routesClient = new routing.RoutesClient(); +} + +main(); diff --git a/owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..1c6dfd98b95 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/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 {RoutesClient} from '@googlemaps/routing'; + +// check that the client class type name can be used +function doStuffWithRoutesClient(client: RoutesClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const routesClient = new RoutesClient(); + doStuffWithRoutesClient(routesClient); +} + +main(); diff --git a/owl-bot-staging/google-maps-routing/v2/system-test/install.ts b/owl-bot-staging/google-maps-routing/v2/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/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-maps-routing/v2/test/gapic_routes_v2.ts b/owl-bot-staging/google-maps-routing/v2/test/gapic_routes_v2.ts new file mode 100644 index 00000000000..189479cad0d --- /dev/null +++ b/owl-bot-staging/google-maps-routing/v2/test/gapic_routes_v2.ts @@ -0,0 +1,313 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 routesModule 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 stubServerStreamingCall(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, + }); + // write something to the stream to trigger transformStub and send the response back to the client + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + return sinon.stub().returns(mockStream); +} + +describe('v2.RoutesClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = routesModule.v2.RoutesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = routesModule.v2.RoutesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = routesModule.v2.RoutesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new routesModule.v2.RoutesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new routesModule.v2.RoutesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new routesModule.v2.RoutesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.routesStub, undefined); + await client.initialize(); + assert(client.routesStub); + }); + + it('has close method for the initialized client', done => { + const client = new routesModule.v2.RoutesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.routesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new routesModule.v2.RoutesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.routesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new routesModule.v2.RoutesClient({ + 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 routesModule.v2.RoutesClient({ + 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('computeRoutes', () => { + it('invokes computeRoutes without error', async () => { + const client = new routesModule.v2.RoutesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.routing.v2.ComputeRoutesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.maps.routing.v2.ComputeRoutesResponse() + ); + client.innerApiCalls.computeRoutes = stubSimpleCall(expectedResponse); + const [response] = await client.computeRoutes(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes computeRoutes without error using callback', async () => { + const client = new routesModule.v2.RoutesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.routing.v2.ComputeRoutesRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.maps.routing.v2.ComputeRoutesResponse() + ); + client.innerApiCalls.computeRoutes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.computeRoutes( + request, + (err?: Error|null, result?: protos.google.maps.routing.v2.IComputeRoutesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes computeRoutes with error', async () => { + const client = new routesModule.v2.RoutesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.routing.v2.ComputeRoutesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.computeRoutes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.computeRoutes(request), expectedError); + }); + + it('invokes computeRoutes with closed client', async () => { + const client = new routesModule.v2.RoutesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.routing.v2.ComputeRoutesRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.computeRoutes(request), expectedError); + }); + }); + + describe('computeRouteMatrix', () => { + it('invokes computeRouteMatrix without error', async () => { + const client = new routesModule.v2.RoutesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.routing.v2.ComputeRouteMatrixRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.maps.routing.v2.RouteMatrixElement() + ); + client.innerApiCalls.computeRouteMatrix = stubServerStreamingCall(expectedResponse); + const stream = client.computeRouteMatrix(request); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.maps.routing.v2.RouteMatrixElement) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes computeRouteMatrix with error', async () => { + const client = new routesModule.v2.RoutesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.routing.v2.ComputeRouteMatrixRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.computeRouteMatrix = stubServerStreamingCall(undefined, expectedError); + const stream = client.computeRouteMatrix(request); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.maps.routing.v2.RouteMatrixElement) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + }); + + it('invokes computeRouteMatrix with closed client', async () => { + const client = new routesModule.v2.RoutesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.maps.routing.v2.ComputeRouteMatrixRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + const stream = client.computeRouteMatrix(request, {retryRequestOptions: {noResponseRetries: 0}}); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.maps.routing.v2.RouteMatrixElement) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-maps-routing/v2/tsconfig.json b/owl-bot-staging/google-maps-routing/v2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-maps-routing/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-maps-routing/v2/webpack.config.js b/owl-bot-staging/google-maps-routing/v2/webpack.config.js new file mode 100644 index 00000000000..311cb75c287 --- /dev/null +++ b/owl-bot-staging/google-maps-routing/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: 'Routes', + filename: './routes.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-monitoring-dashboard/v1/.eslintignore b/owl-bot-staging/google-monitoring-dashboard/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/.eslintrc.json b/owl-bot-staging/google-monitoring-dashboard/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/.gitignore b/owl-bot-staging/google-monitoring-dashboard/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/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-monitoring-dashboard/v1/.jsdoc.js b/owl-bot-staging/google-monitoring-dashboard/v1/.jsdoc.js new file mode 100644 index 00000000000..c063fb7c718 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/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/monitoring-dashboards', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/.mocharc.js b/owl-bot-staging/google-monitoring-dashboard/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/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-monitoring-dashboard/v1/.prettierrc.js b/owl-bot-staging/google-monitoring-dashboard/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/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-monitoring-dashboard/v1/README.md b/owl-bot-staging/google-monitoring-dashboard/v1/README.md new file mode 100644 index 00000000000..05b2e99d6ea --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/README.md @@ -0,0 +1 @@ +Dashboard: Nodejs Client diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/package.json b/owl-bot-staging/google-monitoring-dashboard/v1/package.json new file mode 100644 index 00000000000..c3e132b8ba2 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/monitoring-dashboards", + "version": "0.1.0", + "description": "Dashboard client for Node.js", + "repository": "googleapis/nodejs-dashboard", + "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 dashboard", + "dashboard", + "dashboards 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-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/alertchart.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/alertchart.proto new file mode 100644 index 00000000000..e0bae9bcd8f --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/alertchart.proto @@ -0,0 +1,41 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.monitoring.dashboard.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "AlertChartProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// A chart that displays alert policy data. +message AlertChart { + option (google.api.resource) = { + type: "monitoring.googleapis.com/AlertPolicy" + pattern: "projects/{project}/alertPolicies/{alert_policy}" + }; + + // Required. The resource name of the alert policy. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/collapsible_group.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/collapsible_group.proto new file mode 100644 index 00000000000..2ef705d5921 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/collapsible_group.proto @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.monitoring.dashboard.v1; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "CollapsibleGroupProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// A widget that groups the other widgets. All widgets that are within +// the area spanned by the grouping widget are considered member widgets. +message CollapsibleGroup { + // The collapsed state of the widget on first page load. + bool collapsed = 1; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/common.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/common.proto new file mode 100644 index 00000000000..1cb2b3089ec --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/common.proto @@ -0,0 +1,452 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.monitoring.dashboard.v1; + +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// Describes how to combine multiple time series to provide a different view of +// the data. Aggregation of time series is done in two steps. First, each time +// series in the set is _aligned_ to the same time interval boundaries, then the +// set of time series is optionally _reduced_ in number. +// +// Alignment consists of applying the `per_series_aligner` operation +// to each time series after its data has been divided into regular +// `alignment_period` time intervals. This process takes _all_ of the data +// points in an alignment period, applies a mathematical transformation such as +// averaging, minimum, maximum, delta, etc., and converts them into a single +// data point per period. +// +// Reduction is when the aligned and transformed time series can optionally be +// combined, reducing the number of time series through similar mathematical +// transformations. Reduction involves applying a `cross_series_reducer` to +// all the time series, optionally sorting the time series into subsets with +// `group_by_fields`, and applying the reducer to each subset. +// +// The raw time series data can contain a huge amount of information from +// multiple sources. Alignment and reduction transforms this mass of data into +// a more manageable and representative collection of data, for example "the +// 95% latency across the average of all tasks in a cluster". This +// representative data can be more easily graphed and comprehended, and the +// individual time series data is still available for later drilldown. For more +// details, see [Filtering and +// aggregation](https://cloud.google.com/monitoring/api/v3/aggregation). +message Aggregation { + // The `Aligner` specifies the operation that will be applied to the data + // points in each alignment period in a time series. Except for + // `ALIGN_NONE`, which specifies that no operation be applied, each alignment + // operation replaces the set of data values in each alignment period with + // a single value: the result of applying the operation to the data values. + // An aligned time series has a single data value at the end of each + // `alignment_period`. + // + // An alignment operation can change the data type of the values, too. For + // example, if you apply a counting operation to boolean values, the data + // `value_type` in the original time series is `BOOLEAN`, but the `value_type` + // in the aligned result is `INT64`. + enum Aligner { + // No alignment. Raw data is returned. Not valid if cross-series reduction + // is requested. The `value_type` of the result is the same as the + // `value_type` of the input. + ALIGN_NONE = 0; + + // Align and convert to + // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA]. + // The output is `delta = y1 - y0`. + // + // This alignment is valid for + // [CUMULATIVE][google.api.MetricDescriptor.MetricKind.CUMULATIVE] and + // `DELTA` metrics. If the selected alignment period results in periods + // with no data, then the aligned value for such a period is created by + // interpolation. The `value_type` of the aligned result is the same as + // the `value_type` of the input. + ALIGN_DELTA = 1; + + // Align and convert to a rate. The result is computed as + // `rate = (y1 - y0)/(t1 - t0)`, or "delta over time". + // Think of this aligner as providing the slope of the line that passes + // through the value at the start and at the end of the `alignment_period`. + // + // This aligner is valid for `CUMULATIVE` + // and `DELTA` metrics with numeric values. If the selected alignment + // period results in periods with no data, then the aligned value for + // such a period is created by interpolation. The output is a `GAUGE` + // metric with `value_type` `DOUBLE`. + // + // If, by "rate", you mean "percentage change", see the + // `ALIGN_PERCENT_CHANGE` aligner instead. + ALIGN_RATE = 2; + + // Align by interpolating between adjacent points around the alignment + // period boundary. This aligner is valid for `GAUGE` metrics with + // numeric values. The `value_type` of the aligned result is the same as the + // `value_type` of the input. + ALIGN_INTERPOLATE = 3; + + // Align by moving the most recent data point before the end of the + // alignment period to the boundary at the end of the alignment + // period. This aligner is valid for `GAUGE` metrics. The `value_type` of + // the aligned result is the same as the `value_type` of the input. + ALIGN_NEXT_OLDER = 4; + + // Align the time series by returning the minimum value in each alignment + // period. This aligner is valid for `GAUGE` and `DELTA` metrics with + // numeric values. The `value_type` of the aligned result is the same as + // the `value_type` of the input. + ALIGN_MIN = 10; + + // Align the time series by returning the maximum value in each alignment + // period. This aligner is valid for `GAUGE` and `DELTA` metrics with + // numeric values. The `value_type` of the aligned result is the same as + // the `value_type` of the input. + ALIGN_MAX = 11; + + // Align the time series by returning the mean value in each alignment + // period. This aligner is valid for `GAUGE` and `DELTA` metrics with + // numeric values. The `value_type` of the aligned result is `DOUBLE`. + ALIGN_MEAN = 12; + + // Align the time series by returning the number of values in each alignment + // period. This aligner is valid for `GAUGE` and `DELTA` metrics with + // numeric or Boolean values. The `value_type` of the aligned result is + // `INT64`. + ALIGN_COUNT = 13; + + // Align the time series by returning the sum of the values in each + // alignment period. This aligner is valid for `GAUGE` and `DELTA` + // metrics with numeric and distribution values. The `value_type` of the + // aligned result is the same as the `value_type` of the input. + ALIGN_SUM = 14; + + // Align the time series by returning the standard deviation of the values + // in each alignment period. This aligner is valid for `GAUGE` and + // `DELTA` metrics with numeric values. The `value_type` of the output is + // `DOUBLE`. + ALIGN_STDDEV = 15; + + // Align the time series by returning the number of `True` values in + // each alignment period. This aligner is valid for `GAUGE` metrics with + // Boolean values. The `value_type` of the output is `INT64`. + ALIGN_COUNT_TRUE = 16; + + // Align the time series by returning the number of `False` values in + // each alignment period. This aligner is valid for `GAUGE` metrics with + // Boolean values. The `value_type` of the output is `INT64`. + ALIGN_COUNT_FALSE = 24; + + // Align the time series by returning the ratio of the number of `True` + // values to the total number of values in each alignment period. This + // aligner is valid for `GAUGE` metrics with Boolean values. The output + // value is in the range [0.0, 1.0] and has `value_type` `DOUBLE`. + ALIGN_FRACTION_TRUE = 17; + + // Align the time series by using [percentile + // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + // data point in each alignment period is the 99th percentile of all data + // points in the period. This aligner is valid for `GAUGE` and `DELTA` + // metrics with distribution values. The output is a `GAUGE` metric with + // `value_type` `DOUBLE`. + ALIGN_PERCENTILE_99 = 18; + + // Align the time series by using [percentile + // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + // data point in each alignment period is the 95th percentile of all data + // points in the period. This aligner is valid for `GAUGE` and `DELTA` + // metrics with distribution values. The output is a `GAUGE` metric with + // `value_type` `DOUBLE`. + ALIGN_PERCENTILE_95 = 19; + + // Align the time series by using [percentile + // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + // data point in each alignment period is the 50th percentile of all data + // points in the period. This aligner is valid for `GAUGE` and `DELTA` + // metrics with distribution values. The output is a `GAUGE` metric with + // `value_type` `DOUBLE`. + ALIGN_PERCENTILE_50 = 20; + + // Align the time series by using [percentile + // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + // data point in each alignment period is the 5th percentile of all data + // points in the period. This aligner is valid for `GAUGE` and `DELTA` + // metrics with distribution values. The output is a `GAUGE` metric with + // `value_type` `DOUBLE`. + ALIGN_PERCENTILE_05 = 21; + + // Align and convert to a percentage change. This aligner is valid for + // `GAUGE` and `DELTA` metrics with numeric values. This alignment returns + // `((current - previous)/previous) * 100`, where the value of `previous` is + // determined based on the `alignment_period`. + // + // If the values of `current` and `previous` are both 0, then the returned + // value is 0. If only `previous` is 0, the returned value is infinity. + // + // A 10-minute moving mean is computed at each point of the alignment period + // prior to the above calculation to smooth the metric and prevent false + // positives from very short-lived spikes. The moving mean is only + // applicable for data whose values are `>= 0`. Any values `< 0` are + // treated as a missing datapoint, and are ignored. While `DELTA` + // metrics are accepted by this alignment, special care should be taken that + // the values for the metric will always be positive. The output is a + // `GAUGE` metric with `value_type` `DOUBLE`. + ALIGN_PERCENT_CHANGE = 23; + } + + // A Reducer operation describes how to aggregate data points from multiple + // time series into a single time series, where the value of each data point + // in the resulting series is a function of all the already aligned values in + // the input time series. + enum Reducer { + // No cross-time series reduction. The output of the `Aligner` is + // returned. + REDUCE_NONE = 0; + + // Reduce by computing the mean value across time series for each + // alignment period. This reducer is valid for + // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA] and + // [GAUGE][google.api.MetricDescriptor.MetricKind.GAUGE] metrics with + // numeric or distribution values. The `value_type` of the output is + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + REDUCE_MEAN = 1; + + // Reduce by computing the minimum value across time series for each + // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics + // with numeric values. The `value_type` of the output is the same as the + // `value_type` of the input. + REDUCE_MIN = 2; + + // Reduce by computing the maximum value across time series for each + // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics + // with numeric values. The `value_type` of the output is the same as the + // `value_type` of the input. + REDUCE_MAX = 3; + + // Reduce by computing the sum across time series for each + // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics + // with numeric and distribution values. The `value_type` of the output is + // the same as the `value_type` of the input. + REDUCE_SUM = 4; + + // Reduce by computing the standard deviation across time series + // for each alignment period. This reducer is valid for `DELTA` and + // `GAUGE` metrics with numeric or distribution values. The `value_type` + // of the output is `DOUBLE`. + REDUCE_STDDEV = 5; + + // Reduce by computing the number of data points across time series + // for each alignment period. This reducer is valid for `DELTA` and + // `GAUGE` metrics of numeric, Boolean, distribution, and string + // `value_type`. The `value_type` of the output is `INT64`. + REDUCE_COUNT = 6; + + // Reduce by computing the number of `True`-valued data points across time + // series for each alignment period. This reducer is valid for `DELTA` and + // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output + // is `INT64`. + REDUCE_COUNT_TRUE = 7; + + // Reduce by computing the number of `False`-valued data points across time + // series for each alignment period. This reducer is valid for `DELTA` and + // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output + // is `INT64`. + REDUCE_COUNT_FALSE = 15; + + // Reduce by computing the ratio of the number of `True`-valued data points + // to the total number of data points for each alignment period. This + // reducer is valid for `DELTA` and `GAUGE` metrics of Boolean `value_type`. + // The output value is in the range [0.0, 1.0] and has `value_type` + // `DOUBLE`. + REDUCE_FRACTION_TRUE = 8; + + // Reduce by computing the [99th + // percentile](https://en.wikipedia.org/wiki/Percentile) of data points + // across time series for each alignment period. This reducer is valid for + // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + // of the output is `DOUBLE`. + REDUCE_PERCENTILE_99 = 9; + + // Reduce by computing the [95th + // percentile](https://en.wikipedia.org/wiki/Percentile) of data points + // across time series for each alignment period. This reducer is valid for + // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + // of the output is `DOUBLE`. + REDUCE_PERCENTILE_95 = 10; + + // Reduce by computing the [50th + // percentile](https://en.wikipedia.org/wiki/Percentile) of data points + // across time series for each alignment period. This reducer is valid for + // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + // of the output is `DOUBLE`. + REDUCE_PERCENTILE_50 = 11; + + // Reduce by computing the [5th + // percentile](https://en.wikipedia.org/wiki/Percentile) of data points + // across time series for each alignment period. This reducer is valid for + // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + // of the output is `DOUBLE`. + REDUCE_PERCENTILE_05 = 12; + } + + // The `alignment_period` specifies a time interval, in seconds, that is used + // to divide the data in all the + // [time series][google.monitoring.v3.TimeSeries] into consistent blocks of + // time. This will be done before the per-series aligner can be applied to + // the data. + // + // The value must be at least 60 seconds. If a per-series aligner other than + // `ALIGN_NONE` is specified, this field is required or an error is returned. + // If no per-series aligner is specified, or the aligner `ALIGN_NONE` is + // specified, then this field is ignored. + // + // The maximum value of the `alignment_period` is 2 years, or 104 weeks. + google.protobuf.Duration alignment_period = 1; + + // An `Aligner` describes how to bring the data points in a single + // time series into temporal alignment. Except for `ALIGN_NONE`, all + // alignments cause all the data points in an `alignment_period` to be + // mathematically grouped together, resulting in a single data point for + // each `alignment_period` with end timestamp at the end of the period. + // + // Not all alignment operations may be applied to all time series. The valid + // choices depend on the `metric_kind` and `value_type` of the original time + // series. Alignment can change the `metric_kind` or the `value_type` of + // the time series. + // + // Time series data must be aligned in order to perform cross-time + // series reduction. If `cross_series_reducer` is specified, then + // `per_series_aligner` must be specified and not equal to `ALIGN_NONE` + // and `alignment_period` must be specified; otherwise, an error is + // returned. + Aligner per_series_aligner = 2; + + // The reduction operation to be used to combine time series into a single + // time series, where the value of each data point in the resulting series is + // a function of all the already aligned values in the input time series. + // + // Not all reducer operations can be applied to all time series. The valid + // choices depend on the `metric_kind` and the `value_type` of the original + // time series. Reduction can yield a time series with a different + // `metric_kind` or `value_type` than the input time series. + // + // Time series data must first be aligned (see `per_series_aligner`) in order + // to perform cross-time series reduction. If `cross_series_reducer` is + // specified, then `per_series_aligner` must be specified, and must not be + // `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an + // error is returned. + Reducer cross_series_reducer = 4; + + // The set of fields to preserve when `cross_series_reducer` is + // specified. The `group_by_fields` determine how the time series are + // partitioned into subsets prior to applying the aggregation + // operation. Each subset contains time series that have the same + // value for each of the grouping fields. Each individual time + // series is a member of exactly one subset. The + // `cross_series_reducer` is applied to each subset of time series. + // It is not possible to reduce across different resource types, so + // this field implicitly contains `resource.type`. Fields not + // specified in `group_by_fields` are aggregated away. If + // `group_by_fields` is not specified and all the time series have + // the same resource type, then the time series are aggregated into + // a single output time series. If `cross_series_reducer` is not + // defined, this field is ignored. + repeated string group_by_fields = 5; +} + +// Describes a ranking-based time series filter. Each input time series is +// ranked with an aligner. The filter will allow up to `num_time_series` time +// series to pass through it, selecting them based on the relative ranking. +// +// For example, if `ranking_method` is `METHOD_MEAN`,`direction` is `BOTTOM`, +// and `num_time_series` is 3, then the 3 times series with the lowest mean +// values will pass through the filter. +message PickTimeSeriesFilter { + // The value reducers that can be applied to a `PickTimeSeriesFilter`. + enum Method { + // Not allowed. You must specify a different `Method` if you specify a + // `PickTimeSeriesFilter`. + METHOD_UNSPECIFIED = 0; + + // Select the mean of all values. + METHOD_MEAN = 1; + + // Select the maximum value. + METHOD_MAX = 2; + + // Select the minimum value. + METHOD_MIN = 3; + + // Compute the sum of all values. + METHOD_SUM = 4; + + // Select the most recent value. + METHOD_LATEST = 5; + } + + // Describes the ranking directions. + enum Direction { + // Not allowed. You must specify a different `Direction` if you specify a + // `PickTimeSeriesFilter`. + DIRECTION_UNSPECIFIED = 0; + + // Pass the highest `num_time_series` ranking inputs. + TOP = 1; + + // Pass the lowest `num_time_series` ranking inputs. + BOTTOM = 2; + } + + // `ranking_method` is applied to each time series independently to produce + // the value which will be used to compare the time series to other time + // series. + Method ranking_method = 1; + + // How many time series to allow to pass through the filter. + int32 num_time_series = 2; + + // How to use the ranking to select time series that pass through the filter. + Direction direction = 3; +} + +// A filter that ranks streams based on their statistical relation to other +// streams in a request. +// Note: This field is deprecated and completely ignored by the API. +message StatisticalTimeSeriesFilter { + // The filter methods that can be applied to a stream. + enum Method { + // Not allowed in well-formed requests. + METHOD_UNSPECIFIED = 0; + + // Compute the outlier score of each stream. + METHOD_CLUSTER_OUTLIER = 1; + } + + // `rankingMethod` is applied to a set of time series, and then the produced + // value for each individual time series is used to compare a given time + // series to others. + // These are methods that cannot be applied stream-by-stream, but rather + // require the full context of a request to evaluate time series. + Method ranking_method = 1; + + // How many time series to output. + int32 num_time_series = 2; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard.proto new file mode 100644 index 00000000000..0f841093823 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard.proto @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.monitoring.dashboard.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/monitoring/dashboard/v1/dashboard_filter.proto"; +import "google/monitoring/dashboard/v1/layouts.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "DashboardsProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// A Google Stackdriver dashboard. Dashboards define the content and layout +// of pages in the Stackdriver web application. +message Dashboard { + option (google.api.resource) = { + type: "monitoring.googleapis.com/Dashboard" + pattern: "projects/{project}/dashboards/{dashboard}" + }; + + // Immutable. The resource name of the dashboard. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. The mutable, human-readable name. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // `etag` is used for optimistic concurrency control as a way to help + // prevent simultaneous updates of a policy from overwriting each other. + // An `etag` is returned in the response to `GetDashboard`, and + // users are expected to put that etag in the request to `UpdateDashboard` to + // ensure that their change will be applied to the same version of the + // Dashboard configuration. The field should not be passed during + // dashboard creation. + string etag = 4; + + // A dashboard's root container element that defines the layout style. + oneof layout { + // Content is arranged with a basic layout that re-flows a simple list of + // informational elements like widgets or tiles. + GridLayout grid_layout = 5; + + // The content is arranged as a grid of tiles, with each content widget + // occupying one or more grid blocks. + MosaicLayout mosaic_layout = 6; + + // The content is divided into equally spaced rows and the widgets are + // arranged horizontally. + RowLayout row_layout = 8; + + // The content is divided into equally spaced columns and the widgets are + // arranged vertically. + ColumnLayout column_layout = 9; + } + + // Filters to reduce the amount of data charted based on the filter criteria. + repeated DashboardFilter dashboard_filters = 11; + + // Labels applied to the dashboard + map labels = 12; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard_filter.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard_filter.proto new file mode 100644 index 00000000000..c234c3a9715 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard_filter.proto @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.monitoring.dashboard.v1; + +import "google/api/field_behavior.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "DashboardFilterProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// A filter to reduce the amount of data charted in relevant widgets. +message DashboardFilter { + // The type for the dashboard filter + enum FilterType { + // Filter type is unspecified. This is not valid in a well-formed request. + FILTER_TYPE_UNSPECIFIED = 0; + + // Filter on a resource label value + RESOURCE_LABEL = 1; + + // Filter on a metrics label value + METRIC_LABEL = 2; + + // Filter on a user metadata label value + USER_METADATA_LABEL = 3; + + // Filter on a system metadata label value + SYSTEM_METADATA_LABEL = 4; + + // Filter on a group id + GROUP = 5; + } + + // Required. The key for the label + string label_key = 1 [(google.api.field_behavior) = REQUIRED]; + + // The placeholder text that can be referenced in a filter string or MQL + // query. If omitted, the dashboard filter will be applied to all relevant + // widgets in the dashboard. + string template_variable = 3; + + // The default value used in the filter comparison + oneof default_value { + // A variable-length string value. + string string_value = 4; + } + + // The specified filter type + FilterType filter_type = 5; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboards_service.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboards_service.proto new file mode 100644 index 00000000000..9679c569fd5 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboards_service.proto @@ -0,0 +1,189 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.monitoring.dashboard.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/monitoring/dashboard/v1/dashboard.proto"; +import "google/protobuf/empty.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "DashboardsServiceProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// Manages Stackdriver dashboards. A dashboard is an arrangement of data display +// widgets in a specific layout. +service DashboardsService { + option (google.api.default_host) = "monitoring.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/monitoring," + "https://www.googleapis.com/auth/monitoring.read," + "https://www.googleapis.com/auth/monitoring.write"; + + // Creates a new custom dashboard. For examples on how you can use this API to + // create dashboards, see [Managing dashboards by + // API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This + // method requires the `monitoring.dashboards.create` permission on the + // specified project. For more information about permissions, see [Cloud + // Identity and Access Management](https://cloud.google.com/iam). + rpc CreateDashboard(CreateDashboardRequest) returns (Dashboard) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/dashboards" + body: "dashboard" + }; + } + + // Lists the existing dashboards. + // + // This method requires the `monitoring.dashboards.list` permission + // on the specified project. For more information, see + // [Cloud Identity and Access Management](https://cloud.google.com/iam). + rpc ListDashboards(ListDashboardsRequest) returns (ListDashboardsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/dashboards" + }; + } + + // Fetches a specific dashboard. + // + // This method requires the `monitoring.dashboards.get` permission + // on the specified dashboard. For more information, see + // [Cloud Identity and Access Management](https://cloud.google.com/iam). + rpc GetDashboard(GetDashboardRequest) returns (Dashboard) { + option (google.api.http) = { + get: "/v1/{name=projects/*/dashboards/*}" + }; + } + + // Deletes an existing custom dashboard. + // + // This method requires the `monitoring.dashboards.delete` permission + // on the specified dashboard. For more information, see + // [Cloud Identity and Access Management](https://cloud.google.com/iam). + rpc DeleteDashboard(DeleteDashboardRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/dashboards/*}" + }; + } + + // Replaces an existing custom dashboard with a new definition. + // + // This method requires the `monitoring.dashboards.update` permission + // on the specified dashboard. For more information, see + // [Cloud Identity and Access Management](https://cloud.google.com/iam). + rpc UpdateDashboard(UpdateDashboardRequest) returns (Dashboard) { + option (google.api.http) = { + patch: "/v1/{dashboard.name=projects/*/dashboards/*}" + body: "dashboard" + }; + } +} + +// The `CreateDashboard` request. +message CreateDashboardRequest { + // Required. The project on which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + // + // The `[PROJECT_ID_OR_NUMBER]` must match the dashboard resource name. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The initial dashboard specification. + Dashboard dashboard = 2 [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // save it. + bool validate_only = 3; +} + +// The `ListDashboards` request. +message ListDashboardsRequest { + // Required. The scope of the dashboards to list. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // A positive number that is the maximum number of results to return. + // If unspecified, a default of 1000 is used. + int32 page_size = 2; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 3; +} + +// The `ListDashboards` request. +message ListDashboardsResponse { + // The list of requested dashboards. + repeated Dashboard dashboards = 1; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `page_token` in the next call to this method. + string next_page_token = 2; +} + +// The `GetDashboard` request. +message GetDashboardRequest { + // Required. The resource name of the Dashboard. The format is one of: + // + // - `dashboards/[DASHBOARD_ID]` (for system dashboards) + // - `projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]` + // (for custom dashboards). + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/Dashboard" + } + ]; +} + +// The `DeleteDashboard` request. +message DeleteDashboardRequest { + // Required. The resource name of the Dashboard. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID] + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/Dashboard" + } + ]; +} + +// The `UpdateDashboard` request. +message UpdateDashboardRequest { + // Required. The dashboard that will replace the existing dashboard. + Dashboard dashboard = 1 [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the review, but do not actually + // save it. + bool validate_only = 3; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/drilldowns.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/drilldowns.proto new file mode 100644 index 00000000000..806ab822f40 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/drilldowns.proto @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.monitoring.dashboard.v1; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "DrilldownsProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/layouts.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/layouts.proto new file mode 100644 index 00000000000..11373088058 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/layouts.proto @@ -0,0 +1,112 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.monitoring.dashboard.v1; + +import "google/monitoring/dashboard/v1/widget.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "LayoutsProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// A basic layout divides the available space into vertical columns of equal +// width and arranges a list of widgets using a row-first strategy. +message GridLayout { + // The number of columns into which the view's width is divided. If omitted + // or set to zero, a system default will be used while rendering. + int64 columns = 1; + + // The informational elements that are arranged into the columns row-first. + repeated Widget widgets = 2; +} + +// A mosaic layout divides the available space into a grid of blocks, and +// overlays the grid with tiles. Unlike `GridLayout`, tiles may span multiple +// grid blocks and can be placed at arbitrary locations in the grid. +message MosaicLayout { + // A single tile in the mosaic. The placement and size of the tile are + // configurable. + message Tile { + // The zero-indexed position of the tile in grid blocks relative to the + // left edge of the grid. Tiles must be contained within the specified + // number of columns. `x_pos` cannot be negative. + int32 x_pos = 1; + + // The zero-indexed position of the tile in grid blocks relative to the + // top edge of the grid. `y_pos` cannot be negative. + int32 y_pos = 2; + + // The width of the tile, measured in grid blocks. Tiles must have a + // minimum width of 1. + int32 width = 3; + + // The height of the tile, measured in grid blocks. Tiles must have a + // minimum height of 1. + int32 height = 4; + + // The informational widget contained in the tile. For example an `XyChart`. + Widget widget = 5; + } + + // The number of columns in the mosaic grid. The number of columns must be + // between 1 and 12, inclusive. + int32 columns = 1; + + // The tiles to display. + repeated Tile tiles = 3; +} + +// A simplified layout that divides the available space into rows +// and arranges a set of widgets horizontally in each row. +message RowLayout { + // Defines the layout properties and content for a row. + message Row { + // The relative weight of this row. The row weight is used to adjust the + // height of rows on the screen (relative to peers). Greater the weight, + // greater the height of the row on the screen. If omitted, a value + // of 1 is used while rendering. + int64 weight = 1; + + // The display widgets arranged horizontally in this row. + repeated Widget widgets = 2; + } + + // The rows of content to display. + repeated Row rows = 1; +} + +// A simplified layout that divides the available space into vertical columns +// and arranges a set of widgets vertically in each column. +message ColumnLayout { + // Defines the layout properties and content for a column. + message Column { + // The relative weight of this column. The column weight is used to adjust + // the width of columns on the screen (relative to peers). + // Greater the weight, greater the width of the column on the screen. + // If omitted, a value of 1 is used while rendering. + int64 weight = 1; + + // The display widgets arranged vertically in this column. + repeated Widget widgets = 2; + } + + // The columns of content to display. + repeated Column columns = 1; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/logs_panel.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/logs_panel.proto new file mode 100644 index 00000000000..f7a66c57c93 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/logs_panel.proto @@ -0,0 +1,38 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.monitoring.dashboard.v1; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "LogsPanelProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// A widget that displays a stream of log. +message LogsPanel { + // A filter that chooses which log entries to return. See [Advanced Logs + // Queries](https://cloud.google.com/logging/docs/view/advanced-queries). + // Only log entries that match the filter are returned. An empty filter + // matches all log entries. + string filter = 1; + + // The names of logging resources to collect logs for. Currently only projects + // are supported. If empty, the widget will default to the host project. + repeated string resource_names = 2; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/metrics.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/metrics.proto new file mode 100644 index 00000000000..6f73f67480e --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/metrics.proto @@ -0,0 +1,198 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.monitoring.dashboard.v1; + +import "google/api/field_behavior.proto"; +import "google/monitoring/dashboard/v1/common.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "MetricsProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// TimeSeriesQuery collects the set of supported methods for querying time +// series data from the Stackdriver metrics API. +message TimeSeriesQuery { + // Parameters needed to obtain data for the chart. + oneof source { + // Filter parameters to fetch time series. + TimeSeriesFilter time_series_filter = 1; + + // Parameters to fetch a ratio between two time series filters. + TimeSeriesFilterRatio time_series_filter_ratio = 2; + + // A query used to fetch time series with MQL. + string time_series_query_language = 3; + + // A query used to fetch time series with PromQL. + string prometheus_query = 6; + } + + // The unit of data contained in fetched time series. If non-empty, this + // unit will override any unit that accompanies fetched data. The format is + // the same as the + // [`unit`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors) + // field in `MetricDescriptor`. + string unit_override = 5; +} + +// A filter that defines a subset of time series data that is displayed in a +// widget. Time series data is fetched using the +// [`ListTimeSeries`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) +// method. +message TimeSeriesFilter { + // Required. The [monitoring + // filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies + // the metric types, resources, and projects to query. + string filter = 1 [(google.api.field_behavior) = REQUIRED]; + + // By default, the raw time series data is returned. + // Use this field to combine multiple time series for different views of the + // data. + Aggregation aggregation = 2; + + // Apply a second aggregation after `aggregation` is applied. + Aggregation secondary_aggregation = 3; + + // Selects an optional time series filter. + oneof output_filter { + // Ranking based time series filter. + PickTimeSeriesFilter pick_time_series_filter = 4; + + // Statistics based time series filter. + // Note: This field is deprecated and completely ignored by the API. + StatisticalTimeSeriesFilter statistical_time_series_filter = 5 + [deprecated = true]; + } +} + +// A pair of time series filters that define a ratio computation. The output +// time series is the pair-wise division of each aligned element from the +// numerator and denominator time series. +message TimeSeriesFilterRatio { + // Describes a query to build the numerator or denominator of a + // TimeSeriesFilterRatio. + message RatioPart { + // Required. The [monitoring + // filter](https://cloud.google.com/monitoring/api/v3/filters) that + // identifies the metric types, resources, and projects to query. + string filter = 1 [(google.api.field_behavior) = REQUIRED]; + + // By default, the raw time series data is returned. + // Use this field to combine multiple time series for different views of the + // data. + Aggregation aggregation = 2; + } + + // The numerator of the ratio. + RatioPart numerator = 1; + + // The denominator of the ratio. + RatioPart denominator = 2; + + // Apply a second aggregation after the ratio is computed. + Aggregation secondary_aggregation = 3; + + // Selects an optional filter that is applied to the time series after + // computing the ratio. + oneof output_filter { + // Ranking based time series filter. + PickTimeSeriesFilter pick_time_series_filter = 4; + + // Statistics based time series filter. + // Note: This field is deprecated and completely ignored by the API. + StatisticalTimeSeriesFilter statistical_time_series_filter = 5 + [deprecated = true]; + } +} + +// Defines a threshold for categorizing time series values. +message Threshold { + // The color suggests an interpretation to the viewer when actual values cross + // the threshold. Comments on each color provide UX guidance on how users can + // be expected to interpret a given state color. + enum Color { + // Color is unspecified. Not allowed in well-formed requests. + COLOR_UNSPECIFIED = 0; + + // Crossing the threshold is "concerning" behavior. + YELLOW = 4; + + // Crossing the threshold is "emergency" behavior. + RED = 6; + } + + // Whether the threshold is considered crossed by an actual value above or + // below its threshold value. + enum Direction { + // Not allowed in well-formed requests. + DIRECTION_UNSPECIFIED = 0; + + // The threshold will be considered crossed if the actual value is above + // the threshold value. + ABOVE = 1; + + // The threshold will be considered crossed if the actual value is below + // the threshold value. + BELOW = 2; + } + + // An axis identifier. + enum TargetAxis { + // The target axis was not specified. Defaults to Y1. + TARGET_AXIS_UNSPECIFIED = 0; + + // The y_axis (the right axis of chart). + Y1 = 1; + + // The y2_axis (the left axis of chart). + Y2 = 2; + } + + // A label for the threshold. + string label = 1; + + // The value of the threshold. The value should be defined in the native scale + // of the metric. + double value = 2; + + // The state color for this threshold. Color is not allowed in a XyChart. + Color color = 3; + + // The direction for the current threshold. Direction is not allowed in a + // XyChart. + Direction direction = 4; + + // The target axis to use for plotting the threshold. Target axis is not + // allowed in a Scorecard. + TargetAxis target_axis = 5; +} + +// Defines the possible types of spark chart supported by the `Scorecard`. +enum SparkChartType { + // Not allowed in well-formed requests. + SPARK_CHART_TYPE_UNSPECIFIED = 0; + + // The sparkline will be rendered as a small line chart. + SPARK_LINE = 1; + + // The sparkbar will be rendered as a small bar chart. + SPARK_BAR = 2; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/scorecard.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/scorecard.proto new file mode 100644 index 00000000000..80c28e6e4fd --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/scorecard.proto @@ -0,0 +1,118 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.monitoring.dashboard.v1; + +import "google/api/field_behavior.proto"; +import "google/monitoring/dashboard/v1/metrics.proto"; +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "ScorecardProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// A widget showing the latest value of a metric, and how this value relates to +// one or more thresholds. +message Scorecard { + // A gauge chart shows where the current value sits within a pre-defined + // range. The upper and lower bounds should define the possible range of + // values for the scorecard's query (inclusive). + message GaugeView { + // The lower bound for this gauge chart. The value of the chart should + // always be greater than or equal to this. + double lower_bound = 1; + + // The upper bound for this gauge chart. The value of the chart should + // always be less than or equal to this. + double upper_bound = 2; + } + + // A sparkChart is a small chart suitable for inclusion in a table-cell or + // inline in text. This message contains the configuration for a sparkChart + // to show up on a Scorecard, showing recent trends of the scorecard's + // timeseries. + message SparkChartView { + // Required. The type of sparkchart to show in this chartView. + SparkChartType spark_chart_type = 1 + [(google.api.field_behavior) = REQUIRED]; + + // The lower bound on data point frequency in the chart implemented by + // specifying the minimum alignment period to use in a time series query. + // For example, if the data is published once every 10 minutes it would not + // make sense to fetch and align data at one minute intervals. This field is + // optional and exists only as a hint. + google.protobuf.Duration min_alignment_period = 2; + } + + // Required. Fields for querying time series data from the + // Stackdriver metrics API. + TimeSeriesQuery time_series_query = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Defines the optional additional chart shown on the scorecard. If + // neither is included - then a default scorecard is shown. + oneof data_view { + // Will cause the scorecard to show a gauge chart. + GaugeView gauge_view = 4; + + // Will cause the scorecard to show a spark chart. + SparkChartView spark_chart_view = 5; + } + + // The thresholds used to determine the state of the scorecard given the + // time series' current value. For an actual value x, the scorecard is in a + // danger state if x is less than or equal to a danger threshold that triggers + // below, or greater than or equal to a danger threshold that triggers above. + // Similarly, if x is above/below a warning threshold that triggers + // above/below, then the scorecard is in a warning state - unless x also puts + // it in a danger state. (Danger trumps warning.) + // + // As an example, consider a scorecard with the following four thresholds: + // + // ``` + // { + // value: 90, + // category: 'DANGER', + // trigger: 'ABOVE', + // }, + // { + // value: 70, + // category: 'WARNING', + // trigger: 'ABOVE', + // }, + // { + // value: 10, + // category: 'DANGER', + // trigger: 'BELOW', + // }, + // { + // value: 20, + // category: 'WARNING', + // trigger: 'BELOW', + // } + // ``` + // + // Then: values less than or equal to 10 would put the scorecard in a DANGER + // state, values greater than 10 but less than or equal to 20 a WARNING state, + // values strictly between 20 and 70 an OK state, values greater than or equal + // to 70 but less than 90 a WARNING state, and values greater than or equal to + // 90 a DANGER state. + repeated Threshold thresholds = 6; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/service.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/service.proto new file mode 100644 index 00000000000..b531fea0a09 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/service.proto @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.monitoring.dashboard.v1; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "ServiceMonitoringProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table.proto new file mode 100644 index 00000000000..081217b83a7 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table.proto @@ -0,0 +1,92 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.monitoring.dashboard.v1; + +import "google/api/field_behavior.proto"; +import "google/monitoring/dashboard/v1/metrics.proto"; +import "google/monitoring/dashboard/v1/table_display_options.proto"; +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "TableProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// A table that displays time series data. +message TimeSeriesTable { + // Groups a time series query definition with table options. + message TableDataSet { + // Required. Fields for querying time series data from the + // Stackdriver metrics API. + TimeSeriesQuery time_series_query = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. A template string for naming `TimeSeries` in the resulting data + // set. This should be a string with interpolations of the form + // `${label_name}`, which will resolve to the label's value i.e. + // "${resource.labels.project_id}." + string table_template = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The lower bound on data point frequency for this data set, + // implemented by specifying the minimum alignment period to use in a time + // series query For example, if the data is published once every 10 minutes, + // the `min_alignment_period` should be at least 10 minutes. It would not + // make sense to fetch and align data at one minute intervals. + google.protobuf.Duration min_alignment_period = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Table display options for configuring how the table is + // rendered. + TableDisplayOptions table_display_options = 4 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Enum for metric metric_visualization + enum MetricVisualization { + // Unspecified state + METRIC_VISUALIZATION_UNSPECIFIED = 0; + + // Default text rendering + NUMBER = 1; + + // Horizontal bar rendering + BAR = 2; + } + + // The persistent settings for a table's columns. + message ColumnSettings { + // Required. The id of the column. + string column = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Whether the column should be visible on page load. + bool visible = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. The data displayed in this table. + repeated TableDataSet data_sets = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Store rendering strategy + MetricVisualization metric_visualization = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The list of the persistent column settings for the table. + repeated ColumnSettings column_settings = 4 + [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table_display_options.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table_display_options.proto new file mode 100644 index 00000000000..38e1dea57f6 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table_display_options.proto @@ -0,0 +1,35 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.monitoring.dashboard.v1; + +import "google/api/field_behavior.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "TableDisplayOptionsProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// Table display options that can be reused. +message TableDisplayOptions { + // Optional. This field is unused and has been replaced by + // TimeSeriesTable.column_settings + repeated string shown_columns = 1 + [deprecated = true, (google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/text.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/text.proto new file mode 100644 index 00000000000..7c3c17679ac --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/text.proto @@ -0,0 +1,46 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.monitoring.dashboard.v1; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "TextProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// A widget that displays textual content. +message Text { + // The format type of the text content. + enum Format { + // Format is unspecified. Defaults to MARKDOWN. + FORMAT_UNSPECIFIED = 0; + + // The text contains Markdown formatting. + MARKDOWN = 1; + + // The text contains no special formatting. + RAW = 2; + } + + // The text content to be displayed. + string content = 1; + + // How the text content is formatted. + Format format = 2; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/widget.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/widget.proto new file mode 100644 index 00000000000..cb77c7ae4a9 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/widget.proto @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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.monitoring.dashboard.v1; + +import "google/api/field_behavior.proto"; +import "google/monitoring/dashboard/v1/alertchart.proto"; +import "google/monitoring/dashboard/v1/collapsible_group.proto"; +import "google/monitoring/dashboard/v1/logs_panel.proto"; +import "google/monitoring/dashboard/v1/scorecard.proto"; +import "google/monitoring/dashboard/v1/table.proto"; +import "google/monitoring/dashboard/v1/text.proto"; +import "google/monitoring/dashboard/v1/xychart.proto"; +import "google/protobuf/empty.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "WidgetProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// Widget contains a single dashboard component and configuration of how to +// present the component in the dashboard. +message Widget { + // Optional. The title of the widget. + string title = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Content defines the component used to populate the widget. + oneof content { + // A chart of time series data. + XyChart xy_chart = 2; + + // A scorecard summarizing time series data. + Scorecard scorecard = 3; + + // A raw string or markdown displaying textual content. + Text text = 4; + + // A blank space. + google.protobuf.Empty blank = 5; + + // A chart of alert policy data. + AlertChart alert_chart = 7; + + // A widget that displays time series data in a tabular format. + TimeSeriesTable time_series_table = 8; + + // A widget that groups the other widgets. All widgets that are within + // the area spanned by the grouping widget are considered member widgets. + CollapsibleGroup collapsible_group = 9; + + // A widget that shows a stream of logs. + LogsPanel logs_panel = 10; + } +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/xychart.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/xychart.proto new file mode 100644 index 00000000000..ae7ddc30599 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/xychart.proto @@ -0,0 +1,168 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.monitoring.dashboard.v1; + +import "google/api/field_behavior.proto"; +import "google/monitoring/dashboard/v1/metrics.proto"; +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; +option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; +option java_multiple_files = true; +option java_outer_classname = "XyChartProto"; +option java_package = "com.google.monitoring.dashboard.v1"; +option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; +option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; + +// A chart that displays data on a 2D (X and Y axes) plane. +message XyChart { + // Groups a time series query definition with charting options. + message DataSet { + // The types of plotting strategies for data sets. + enum PlotType { + // Plot type is unspecified. The view will default to `LINE`. + PLOT_TYPE_UNSPECIFIED = 0; + + // The data is plotted as a set of lines (one line per series). + LINE = 1; + + // The data is plotted as a set of filled areas (one area per series), + // with the areas stacked vertically (the base of each area is the top of + // its predecessor, and the base of the first area is the X axis). Since + // the areas do not overlap, each is filled with a different opaque color. + STACKED_AREA = 2; + + // The data is plotted as a set of rectangular boxes (one box per series), + // with the boxes stacked vertically (the base of each box is the top of + // its predecessor, and the base of the first box is the X axis). Since + // the boxes do not overlap, each is filled with a different opaque color. + STACKED_BAR = 3; + + // The data is plotted as a heatmap. The series being plotted must have a + // `DISTRIBUTION` value type. The value of each bucket in the distribution + // is displayed as a color. This type is not currently available in the + // Stackdriver Monitoring application. + HEATMAP = 4; + } + + // An axis identifier. + enum TargetAxis { + // The target axis was not specified. Defaults to Y1. + TARGET_AXIS_UNSPECIFIED = 0; + + // The y_axis (the right axis of chart). + Y1 = 1; + + // The y2_axis (the left axis of chart). + Y2 = 2; + } + + // Required. Fields for querying time series data from the + // Stackdriver metrics API. + TimeSeriesQuery time_series_query = 1 + [(google.api.field_behavior) = REQUIRED]; + + // How this data should be plotted on the chart. + PlotType plot_type = 2; + + // A template string for naming `TimeSeries` in the resulting data set. + // This should be a string with interpolations of the form `${label_name}`, + // which will resolve to the label's value. + string legend_template = 3; + + // Optional. The lower bound on data point frequency for this data set, + // implemented by specifying the minimum alignment period to use in a time + // series query For example, if the data is published once every 10 minutes, + // the `min_alignment_period` should be at least 10 minutes. It would not + // make sense to fetch and align data at one minute intervals. + google.protobuf.Duration min_alignment_period = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The target axis to use for plotting the metric. + TargetAxis target_axis = 5 [(google.api.field_behavior) = OPTIONAL]; + } + + // A chart axis. + message Axis { + // Types of scales used in axes. + enum Scale { + // Scale is unspecified. The view will default to `LINEAR`. + SCALE_UNSPECIFIED = 0; + + // Linear scale. + LINEAR = 1; + + // Logarithmic scale (base 10). + LOG10 = 2; + } + + // The label of the axis. + string label = 1; + + // The axis scale. By default, a linear scale is used. + Scale scale = 2; + } + + // Required. The data displayed in this chart. + repeated DataSet data_sets = 1 [(google.api.field_behavior) = REQUIRED]; + + // The duration used to display a comparison chart. A comparison chart + // simultaneously shows values from two similar-length time periods + // (e.g., week-over-week metrics). + // The duration must be positive, and it can only be applied to charts with + // data sets of LINE plot type. + google.protobuf.Duration timeshift_duration = 4; + + // Threshold lines drawn horizontally across the chart. + repeated Threshold thresholds = 5; + + // The properties applied to the X axis. + Axis x_axis = 6; + + // The properties applied to the Y axis. + Axis y_axis = 7; + + // The properties applied to the Y2 axis. + Axis y2_axis = 9; + + // Display options for the chart. + ChartOptions chart_options = 8; +} + +// Options to control visual rendering of a chart. +message ChartOptions { + // Chart mode options. + enum Mode { + // Mode is unspecified. The view will default to `COLOR`. + MODE_UNSPECIFIED = 0; + + // The chart distinguishes data series using different color. Line + // colors may get reused when there are many lines in the chart. + COLOR = 1; + + // The chart uses the Stackdriver x-ray mode, in which each + // data set is plotted using the same semi-transparent color. + X_RAY = 2; + + // The chart displays statistics such as average, median, 95th percentile, + // and more. + STATS = 3; + } + + // The chart mode. + Mode mode = 1; +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.create_dashboard.js b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.create_dashboard.js new file mode 100644 index 00000000000..64949d3b3e9 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.create_dashboard.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, dashboard) { + // [START monitoring_v1_generated_DashboardsService_CreateDashboard_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 on which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * The `[PROJECT_ID_OR_NUMBER]` must match the dashboard resource name. + */ + // const parent = 'abc123' + /** + * Required. The initial dashboard specification. + */ + // const dashboard = {} + /** + * If set, validate the request and preview the review, but do not actually + * save it. + */ + // const validateOnly = true + + // Imports the Dashboard library + const {DashboardsServiceClient} = require('@google-cloud/monitoring-dashboards').v1; + + // Instantiates a client + const dashboardClient = new DashboardsServiceClient(); + + async function callCreateDashboard() { + // Construct request + const request = { + parent, + dashboard, + }; + + // Run request + const response = await dashboardClient.createDashboard(request); + console.log(response); + } + + callCreateDashboard(); + // [END monitoring_v1_generated_DashboardsService_CreateDashboard_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.delete_dashboard.js b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.delete_dashboard.js new file mode 100644 index 00000000000..f64f97225b2 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.delete_dashboard.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 monitoring_v1_generated_DashboardsService_DeleteDashboard_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Dashboard. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID] + */ + // const name = 'abc123' + + // Imports the Dashboard library + const {DashboardsServiceClient} = require('@google-cloud/monitoring-dashboards').v1; + + // Instantiates a client + const dashboardClient = new DashboardsServiceClient(); + + async function callDeleteDashboard() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dashboardClient.deleteDashboard(request); + console.log(response); + } + + callDeleteDashboard(); + // [END monitoring_v1_generated_DashboardsService_DeleteDashboard_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.get_dashboard.js b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.get_dashboard.js new file mode 100644 index 00000000000..8820abd1184 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.get_dashboard.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 monitoring_v1_generated_DashboardsService_GetDashboard_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 Dashboard. The format is one of: + * - `dashboards/[DASHBOARD_ID]` (for system dashboards) + * - `projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]` + * (for custom dashboards). + */ + // const name = 'abc123' + + // Imports the Dashboard library + const {DashboardsServiceClient} = require('@google-cloud/monitoring-dashboards').v1; + + // Instantiates a client + const dashboardClient = new DashboardsServiceClient(); + + async function callGetDashboard() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dashboardClient.getDashboard(request); + console.log(response); + } + + callGetDashboard(); + // [END monitoring_v1_generated_DashboardsService_GetDashboard_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.list_dashboards.js b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.list_dashboards.js new file mode 100644 index 00000000000..1f9873de807 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.list_dashboards.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 monitoring_v1_generated_DashboardsService_ListDashboards_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The scope of the dashboards to list. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + */ + // const parent = 'abc123' + /** + * A positive number that is the maximum number of results to return. + * If unspecified, a default of 1000 is used. + */ + // const pageSize = 1234 + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + */ + // const pageToken = 'abc123' + + // Imports the Dashboard library + const {DashboardsServiceClient} = require('@google-cloud/monitoring-dashboards').v1; + + // Instantiates a client + const dashboardClient = new DashboardsServiceClient(); + + async function callListDashboards() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dashboardClient.listDashboardsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDashboards(); + // [END monitoring_v1_generated_DashboardsService_ListDashboards_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.update_dashboard.js b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.update_dashboard.js new file mode 100644 index 00000000000..1c241bab3ef --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.update_dashboard.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(dashboard) { + // [START monitoring_v1_generated_DashboardsService_UpdateDashboard_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The dashboard that will replace the existing dashboard. + */ + // const dashboard = {} + /** + * If set, validate the request and preview the review, but do not actually + * save it. + */ + // const validateOnly = true + + // Imports the Dashboard library + const {DashboardsServiceClient} = require('@google-cloud/monitoring-dashboards').v1; + + // Instantiates a client + const dashboardClient = new DashboardsServiceClient(); + + async function callUpdateDashboard() { + // Construct request + const request = { + dashboard, + }; + + // Run request + const response = await dashboardClient.updateDashboard(request); + console.log(response); + } + + callUpdateDashboard(); + // [END monitoring_v1_generated_DashboardsService_UpdateDashboard_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/snippet_metadata_google.monitoring.dashboard.v1.json b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/snippet_metadata_google.monitoring.dashboard.v1.json new file mode 100644 index 00000000000..4f2d486331b --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/snippet_metadata_google.monitoring.dashboard.v1.json @@ -0,0 +1,235 @@ +{ + "clientLibrary": { + "name": "nodejs-dashboard", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.monitoring.dashboard.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "monitoring_v1_generated_DashboardsService_CreateDashboard_async", + "title": "DashboardsService createDashboard Sample", + "origin": "API_DEFINITION", + "description": " Creates a new custom dashboard. For examples on how you can use this API to create dashboards, see [Managing dashboards by API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](https://cloud.google.com/iam).", + "canonical": true, + "file": "dashboards_service.create_dashboard.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDashboard", + "fullName": "google.monitoring.dashboard.v1.DashboardsService.CreateDashboard", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "dashboard", + "type": ".google.monitoring.dashboard.v1.Dashboard" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.monitoring.dashboard.v1.Dashboard", + "client": { + "shortName": "DashboardsServiceClient", + "fullName": "google.monitoring.dashboard.v1.DashboardsServiceClient" + }, + "method": { + "shortName": "CreateDashboard", + "fullName": "google.monitoring.dashboard.v1.DashboardsService.CreateDashboard", + "service": { + "shortName": "DashboardsService", + "fullName": "google.monitoring.dashboard.v1.DashboardsService" + } + } + } + }, + { + "regionTag": "monitoring_v1_generated_DashboardsService_ListDashboards_async", + "title": "DashboardsService listDashboards Sample", + "origin": "API_DEFINITION", + "description": " Lists the existing dashboards. This method requires the `monitoring.dashboards.list` permission on the specified project. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).", + "canonical": true, + "file": "dashboards_service.list_dashboards.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDashboards", + "fullName": "google.monitoring.dashboard.v1.DashboardsService.ListDashboards", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.monitoring.dashboard.v1.ListDashboardsResponse", + "client": { + "shortName": "DashboardsServiceClient", + "fullName": "google.monitoring.dashboard.v1.DashboardsServiceClient" + }, + "method": { + "shortName": "ListDashboards", + "fullName": "google.monitoring.dashboard.v1.DashboardsService.ListDashboards", + "service": { + "shortName": "DashboardsService", + "fullName": "google.monitoring.dashboard.v1.DashboardsService" + } + } + } + }, + { + "regionTag": "monitoring_v1_generated_DashboardsService_GetDashboard_async", + "title": "DashboardsService getDashboard Sample", + "origin": "API_DEFINITION", + "description": " Fetches a specific dashboard. This method requires the `monitoring.dashboards.get` permission on the specified dashboard. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).", + "canonical": true, + "file": "dashboards_service.get_dashboard.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDashboard", + "fullName": "google.monitoring.dashboard.v1.DashboardsService.GetDashboard", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.monitoring.dashboard.v1.Dashboard", + "client": { + "shortName": "DashboardsServiceClient", + "fullName": "google.monitoring.dashboard.v1.DashboardsServiceClient" + }, + "method": { + "shortName": "GetDashboard", + "fullName": "google.monitoring.dashboard.v1.DashboardsService.GetDashboard", + "service": { + "shortName": "DashboardsService", + "fullName": "google.monitoring.dashboard.v1.DashboardsService" + } + } + } + }, + { + "regionTag": "monitoring_v1_generated_DashboardsService_DeleteDashboard_async", + "title": "DashboardsService deleteDashboard Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing custom dashboard. This method requires the `monitoring.dashboards.delete` permission on the specified dashboard. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).", + "canonical": true, + "file": "dashboards_service.delete_dashboard.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDashboard", + "fullName": "google.monitoring.dashboard.v1.DashboardsService.DeleteDashboard", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "DashboardsServiceClient", + "fullName": "google.monitoring.dashboard.v1.DashboardsServiceClient" + }, + "method": { + "shortName": "DeleteDashboard", + "fullName": "google.monitoring.dashboard.v1.DashboardsService.DeleteDashboard", + "service": { + "shortName": "DashboardsService", + "fullName": "google.monitoring.dashboard.v1.DashboardsService" + } + } + } + }, + { + "regionTag": "monitoring_v1_generated_DashboardsService_UpdateDashboard_async", + "title": "DashboardsService updateDashboard Sample", + "origin": "API_DEFINITION", + "description": " Replaces an existing custom dashboard with a new definition. This method requires the `monitoring.dashboards.update` permission on the specified dashboard. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).", + "canonical": true, + "file": "dashboards_service.update_dashboard.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDashboard", + "fullName": "google.monitoring.dashboard.v1.DashboardsService.UpdateDashboard", + "async": true, + "parameters": [ + { + "name": "dashboard", + "type": ".google.monitoring.dashboard.v1.Dashboard" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.monitoring.dashboard.v1.Dashboard", + "client": { + "shortName": "DashboardsServiceClient", + "fullName": "google.monitoring.dashboard.v1.DashboardsServiceClient" + }, + "method": { + "shortName": "UpdateDashboard", + "fullName": "google.monitoring.dashboard.v1.DashboardsService.UpdateDashboard", + "service": { + "shortName": "DashboardsService", + "fullName": "google.monitoring.dashboard.v1.DashboardsService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/index.ts b/owl-bot-staging/google-monitoring-dashboard/v1/src/index.ts new file mode 100644 index 00000000000..c83a446c84e --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/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 DashboardsServiceClient = v1.DashboardsServiceClient; +type DashboardsServiceClient = v1.DashboardsServiceClient; +export {v1, DashboardsServiceClient}; +export default {v1, DashboardsServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client.ts b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client.ts new file mode 100644 index 00000000000..62f9e7fad67 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client.ts @@ -0,0 +1,937 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/dashboards_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dashboards_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Manages Stackdriver dashboards. A dashboard is an arrangement of data display + * widgets in a specific layout. + * @class + * @memberof v1 + */ +export class DashboardsServiceClient { + 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}; + dashboardsServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DashboardsServiceClient. + * + * @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 DashboardsServiceClient({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 DashboardsServiceClient; + 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 = { + alertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}' + ), + dashboardPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/dashboards/{dashboard}' + ), + 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 = { + listDashboards: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'dashboards') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.monitoring.dashboard.v1.DashboardsService', 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.dashboardsServiceStub) { + return this.dashboardsServiceStub; + } + + // Put together the "service stub" for + // google.monitoring.dashboard.v1.DashboardsService. + this.dashboardsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.monitoring.dashboard.v1.DashboardsService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.monitoring.dashboard.v1.DashboardsService, + 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 dashboardsServiceStubMethods = + ['createDashboard', 'listDashboards', 'getDashboard', 'deleteDashboard', 'updateDashboard']; + for (const methodName of dashboardsServiceStubMethods) { + const callPromise = this.dashboardsServiceStub.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.dashboardsServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'monitoring.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 'monitoring.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/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + 'https://www.googleapis.com/auth/monitoring.write' + ]; + } + + 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 new custom dashboard. For examples on how you can use this API to + * create dashboards, see [Managing dashboards by + * API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This + * method requires the `monitoring.dashboards.create` permission on the + * specified project. For more information about permissions, see [Cloud + * Identity and Access Management](https://cloud.google.com/iam). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * The `[PROJECT_ID_OR_NUMBER]` must match the dashboard resource name. + * @param {google.monitoring.dashboard.v1.Dashboard} request.dashboard + * Required. The initial dashboard specification. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * save it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.dashboard.v1.Dashboard|Dashboard}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dashboards_service.create_dashboard.js + * region_tag:monitoring_v1_generated_DashboardsService_CreateDashboard_async + */ + createDashboard( + request?: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest, + options?: CallOptions): + Promise<[ + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|undefined, {}|undefined + ]>; + createDashboard( + request: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|null|undefined, + {}|null|undefined>): void; + createDashboard( + request: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest, + callback: Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|null|undefined, + {}|null|undefined>): void; + createDashboard( + request?: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createDashboard(request, options, callback); + } +/** + * Fetches a specific dashboard. + * + * This method requires the `monitoring.dashboards.get` permission + * on the specified dashboard. For more information, see + * [Cloud Identity and Access Management](https://cloud.google.com/iam). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Dashboard. The format is one of: + * + * - `dashboards/[DASHBOARD_ID]` (for system dashboards) + * - `projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]` + * (for custom dashboards). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.dashboard.v1.Dashboard|Dashboard}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dashboards_service.get_dashboard.js + * region_tag:monitoring_v1_generated_DashboardsService_GetDashboard_async + */ + getDashboard( + request?: protos.google.monitoring.dashboard.v1.IGetDashboardRequest, + options?: CallOptions): + Promise<[ + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IGetDashboardRequest|undefined, {}|undefined + ]>; + getDashboard( + request: protos.google.monitoring.dashboard.v1.IGetDashboardRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IGetDashboardRequest|null|undefined, + {}|null|undefined>): void; + getDashboard( + request: protos.google.monitoring.dashboard.v1.IGetDashboardRequest, + callback: Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IGetDashboardRequest|null|undefined, + {}|null|undefined>): void; + getDashboard( + request?: protos.google.monitoring.dashboard.v1.IGetDashboardRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IGetDashboardRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IGetDashboardRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IGetDashboardRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getDashboard(request, options, callback); + } +/** + * Deletes an existing custom dashboard. + * + * This method requires the `monitoring.dashboards.delete` permission + * on the specified dashboard. For more information, see + * [Cloud Identity and Access Management](https://cloud.google.com/iam). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Dashboard. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_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/dashboards_service.delete_dashboard.js + * region_tag:monitoring_v1_generated_DashboardsService_DeleteDashboard_async + */ + deleteDashboard( + request?: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|undefined, {}|undefined + ]>; + deleteDashboard( + request: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|null|undefined, + {}|null|undefined>): void; + deleteDashboard( + request: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|null|undefined, + {}|null|undefined>): void; + deleteDashboard( + request?: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteDashboard(request, options, callback); + } +/** + * Replaces an existing custom dashboard with a new definition. + * + * This method requires the `monitoring.dashboards.update` permission + * on the specified dashboard. For more information, see + * [Cloud Identity and Access Management](https://cloud.google.com/iam). + * + * @param {Object} request + * The request object that will be sent. + * @param {google.monitoring.dashboard.v1.Dashboard} request.dashboard + * Required. The dashboard that will replace the existing dashboard. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the review, but do not actually + * save it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.dashboard.v1.Dashboard|Dashboard}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/dashboards_service.update_dashboard.js + * region_tag:monitoring_v1_generated_DashboardsService_UpdateDashboard_async + */ + updateDashboard( + request?: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest, + options?: CallOptions): + Promise<[ + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|undefined, {}|undefined + ]>; + updateDashboard( + request: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|null|undefined, + {}|null|undefined>): void; + updateDashboard( + request: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest, + callback: Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|null|undefined, + {}|null|undefined>): void; + updateDashboard( + request?: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.monitoring.dashboard.v1.IDashboard, + protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'dashboard.name': request.dashboard!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateDashboard(request, options, callback); + } + + /** + * Lists the existing dashboards. + * + * This method requires the `monitoring.dashboards.list` permission + * on the specified project. For more information, see + * [Cloud Identity and Access Management](https://cloud.google.com/iam). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The scope of the dashboards to list. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * If unspecified, a default of 1000 is used. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.monitoring.dashboard.v1.Dashboard|Dashboard}. + * 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 `listDashboardsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDashboards( + request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, + options?: CallOptions): + Promise<[ + protos.google.monitoring.dashboard.v1.IDashboard[], + protos.google.monitoring.dashboard.v1.IListDashboardsRequest|null, + protos.google.monitoring.dashboard.v1.IListDashboardsResponse + ]>; + listDashboards( + request: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.dashboard.v1.IListDashboardsRequest, + protos.google.monitoring.dashboard.v1.IListDashboardsResponse|null|undefined, + protos.google.monitoring.dashboard.v1.IDashboard>): void; + listDashboards( + request: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, + callback: PaginationCallback< + protos.google.monitoring.dashboard.v1.IListDashboardsRequest, + protos.google.monitoring.dashboard.v1.IListDashboardsResponse|null|undefined, + protos.google.monitoring.dashboard.v1.IDashboard>): void; + listDashboards( + request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.monitoring.dashboard.v1.IListDashboardsRequest, + protos.google.monitoring.dashboard.v1.IListDashboardsResponse|null|undefined, + protos.google.monitoring.dashboard.v1.IDashboard>, + callback?: PaginationCallback< + protos.google.monitoring.dashboard.v1.IListDashboardsRequest, + protos.google.monitoring.dashboard.v1.IListDashboardsResponse|null|undefined, + protos.google.monitoring.dashboard.v1.IDashboard>): + Promise<[ + protos.google.monitoring.dashboard.v1.IDashboard[], + protos.google.monitoring.dashboard.v1.IListDashboardsRequest|null, + protos.google.monitoring.dashboard.v1.IListDashboardsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listDashboards(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 scope of the dashboards to list. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * If unspecified, a default of 1000 is used. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @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.monitoring.dashboard.v1.Dashboard|Dashboard} 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 `listDashboardsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDashboardsStream( + request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, + 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['listDashboards']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDashboards.createStream( + this.innerApiCalls.listDashboards as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDashboards`, 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 scope of the dashboards to list. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * If unspecified, a default of 1000 is used. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @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.monitoring.dashboard.v1.Dashboard|Dashboard}. 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/dashboards_service.list_dashboards.js + * region_tag:monitoring_v1_generated_DashboardsService_ListDashboards_async + */ + listDashboardsAsync( + request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, + 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['listDashboards']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDashboards.asyncIterate( + this.innerApiCalls['listDashboards'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified alertPolicy resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + alertPolicyPath(project:string,alertPolicy:string) { + return this.pathTemplates.alertPolicyPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the project from AlertPolicy resource. + * + * @param {string} alertPolicyName + * A fully-qualified path representing AlertPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAlertPolicyName(alertPolicyName: string) { + return this.pathTemplates.alertPolicyPathTemplate.match(alertPolicyName).project; + } + + /** + * Parse the alert_policy from AlertPolicy resource. + * + * @param {string} alertPolicyName + * A fully-qualified path representing AlertPolicy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromAlertPolicyName(alertPolicyName: string) { + return this.pathTemplates.alertPolicyPathTemplate.match(alertPolicyName).alert_policy; + } + + /** + * Return a fully-qualified dashboard resource name string. + * + * @param {string} project + * @param {string} dashboard + * @returns {string} Resource name string. + */ + dashboardPath(project:string,dashboard:string) { + return this.pathTemplates.dashboardPathTemplate.render({ + project: project, + dashboard: dashboard, + }); + } + + /** + * Parse the project from Dashboard resource. + * + * @param {string} dashboardName + * A fully-qualified path representing Dashboard resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDashboardName(dashboardName: string) { + return this.pathTemplates.dashboardPathTemplate.match(dashboardName).project; + } + + /** + * Parse the dashboard from Dashboard resource. + * + * @param {string} dashboardName + * A fully-qualified path representing Dashboard resource. + * @returns {string} A string representing the dashboard. + */ + matchDashboardFromDashboardName(dashboardName: string) { + return this.pathTemplates.dashboardPathTemplate.match(dashboardName).dashboard; + } + + /** + * 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.dashboardsServiceStub && !this._terminated) { + return this.dashboardsServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client_config.json b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client_config.json new file mode 100644 index 00000000000..1b2f284ce9f --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.monitoring.dashboard.v1.DashboardsService": { + "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": { + "CreateDashboard": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListDashboards": { + "timeout_millis": 30000, + "retry_codes_name": "unknown_unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetDashboard": { + "timeout_millis": 30000, + "retry_codes_name": "unknown_unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteDashboard": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateDashboard": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_proto_list.json b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_proto_list.json new file mode 100644 index 00000000000..c084fbb63f9 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/monitoring/dashboard/v1/alertchart.proto", + "../../protos/google/monitoring/dashboard/v1/collapsible_group.proto", + "../../protos/google/monitoring/dashboard/v1/common.proto", + "../../protos/google/monitoring/dashboard/v1/dashboard.proto", + "../../protos/google/monitoring/dashboard/v1/dashboard_filter.proto", + "../../protos/google/monitoring/dashboard/v1/dashboards_service.proto", + "../../protos/google/monitoring/dashboard/v1/drilldowns.proto", + "../../protos/google/monitoring/dashboard/v1/layouts.proto", + "../../protos/google/monitoring/dashboard/v1/logs_panel.proto", + "../../protos/google/monitoring/dashboard/v1/metrics.proto", + "../../protos/google/monitoring/dashboard/v1/scorecard.proto", + "../../protos/google/monitoring/dashboard/v1/service.proto", + "../../protos/google/monitoring/dashboard/v1/table.proto", + "../../protos/google/monitoring/dashboard/v1/table_display_options.proto", + "../../protos/google/monitoring/dashboard/v1/text.proto", + "../../protos/google/monitoring/dashboard/v1/widget.proto", + "../../protos/google/monitoring/dashboard/v1/xychart.proto" +] diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..b310e5783de --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/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.monitoring.dashboard.v1", + "libraryPackage": "@google-cloud/monitoring-dashboards", + "services": { + "DashboardsService": { + "clients": { + "grpc": { + "libraryClient": "DashboardsServiceClient", + "rpcs": { + "CreateDashboard": { + "methods": [ + "createDashboard" + ] + }, + "GetDashboard": { + "methods": [ + "getDashboard" + ] + }, + "DeleteDashboard": { + "methods": [ + "deleteDashboard" + ] + }, + "UpdateDashboard": { + "methods": [ + "updateDashboard" + ] + }, + "ListDashboards": { + "methods": [ + "listDashboards", + "listDashboardsStream", + "listDashboardsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DashboardsServiceClient", + "rpcs": { + "CreateDashboard": { + "methods": [ + "createDashboard" + ] + }, + "GetDashboard": { + "methods": [ + "getDashboard" + ] + }, + "DeleteDashboard": { + "methods": [ + "deleteDashboard" + ] + }, + "UpdateDashboard": { + "methods": [ + "updateDashboard" + ] + }, + "ListDashboards": { + "methods": [ + "listDashboards", + "listDashboardsStream", + "listDashboardsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/index.ts b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/index.ts new file mode 100644 index 00000000000..749483a969e --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/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 {DashboardsServiceClient} from './dashboards_service_client'; diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..883a89ca8cd --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/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 dashboard = require('@google-cloud/monitoring-dashboards'); + +function main() { + const dashboardsServiceClient = new dashboard.DashboardsServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..bfd0a7a4b63 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/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 {DashboardsServiceClient} from '@google-cloud/monitoring-dashboards'; + +// check that the client class type name can be used +function doStuffWithDashboardsServiceClient(client: DashboardsServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const dashboardsServiceClient = new DashboardsServiceClient(); + doStuffWithDashboardsServiceClient(dashboardsServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/system-test/install.ts b/owl-bot-staging/google-monitoring-dashboard/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/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-monitoring-dashboard/v1/test/gapic_dashboards_service_v1.ts b/owl-bot-staging/google-monitoring-dashboard/v1/test/gapic_dashboards_service_v1.ts new file mode 100644 index 00000000000..1189781d839 --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/v1/test/gapic_dashboards_service_v1.ts @@ -0,0 +1,987 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 dashboardsserviceModule 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.DashboardsServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dashboardsserviceModule.v1.DashboardsServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dashboardsserviceModule.v1.DashboardsServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dashboardsserviceModule.v1.DashboardsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dashboardsServiceStub, undefined); + await client.initialize(); + assert(client.dashboardsServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dashboardsServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dashboardsServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + 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 dashboardsserviceModule.v1.DashboardsServiceClient({ + 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('createDashboard', () => { + it('invokes createDashboard without error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.CreateDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.CreateDashboardRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.Dashboard() + ); + client.innerApiCalls.createDashboard = stubSimpleCall(expectedResponse); + const [response] = await client.createDashboard(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDashboard without error using callback', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.CreateDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.CreateDashboardRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.Dashboard() + ); + client.innerApiCalls.createDashboard = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDashboard( + request, + (err?: Error|null, result?: protos.google.monitoring.dashboard.v1.IDashboard|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDashboard with error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.CreateDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.CreateDashboardRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDashboard = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createDashboard(request), expectedError); + const actualRequest = (client.innerApiCalls.createDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDashboard with closed client', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.CreateDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.CreateDashboardRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createDashboard(request), expectedError); + }); + }); + + describe('getDashboard', () => { + it('invokes getDashboard without error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.GetDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.GetDashboardRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.Dashboard() + ); + client.innerApiCalls.getDashboard = stubSimpleCall(expectedResponse); + const [response] = await client.getDashboard(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDashboard without error using callback', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.GetDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.GetDashboardRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.Dashboard() + ); + client.innerApiCalls.getDashboard = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDashboard( + request, + (err?: Error|null, result?: protos.google.monitoring.dashboard.v1.IDashboard|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDashboard with error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.GetDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.GetDashboardRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDashboard = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDashboard(request), expectedError); + const actualRequest = (client.innerApiCalls.getDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDashboard with closed client', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.GetDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.GetDashboardRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDashboard(request), expectedError); + }); + }); + + describe('deleteDashboard', () => { + it('invokes deleteDashboard without error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.DeleteDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.DeleteDashboardRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDashboard = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDashboard(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDashboard without error using callback', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.DeleteDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.DeleteDashboardRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDashboard = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDashboard( + 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.deleteDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDashboard with error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.DeleteDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.DeleteDashboardRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDashboard = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteDashboard(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDashboard with closed client', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.DeleteDashboardRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.DeleteDashboardRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteDashboard(request), expectedError); + }); + }); + + describe('updateDashboard', () => { + it('invokes updateDashboard without error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.UpdateDashboardRequest() + ); + request.dashboard ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.UpdateDashboardRequest', ['dashboard', 'name']); + request.dashboard.name = defaultValue1; + const expectedHeaderRequestParams = `dashboard.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.Dashboard() + ); + client.innerApiCalls.updateDashboard = stubSimpleCall(expectedResponse); + const [response] = await client.updateDashboard(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDashboard without error using callback', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.UpdateDashboardRequest() + ); + request.dashboard ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.UpdateDashboardRequest', ['dashboard', 'name']); + request.dashboard.name = defaultValue1; + const expectedHeaderRequestParams = `dashboard.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.Dashboard() + ); + client.innerApiCalls.updateDashboard = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDashboard( + request, + (err?: Error|null, result?: protos.google.monitoring.dashboard.v1.IDashboard|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDashboard with error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.UpdateDashboardRequest() + ); + request.dashboard ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.UpdateDashboardRequest', ['dashboard', 'name']); + request.dashboard.name = defaultValue1; + const expectedHeaderRequestParams = `dashboard.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDashboard = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateDashboard(request), expectedError); + const actualRequest = (client.innerApiCalls.updateDashboard as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDashboard as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDashboard with closed client', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.UpdateDashboardRequest() + ); + request.dashboard ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.UpdateDashboardRequest', ['dashboard', 'name']); + request.dashboard.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateDashboard(request), expectedError); + }); + }); + + describe('listDashboards', () => { + it('invokes listDashboards without error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + ]; + client.innerApiCalls.listDashboards = stubSimpleCall(expectedResponse); + const [response] = await client.listDashboards(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDashboards as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDashboards as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDashboards without error using callback', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + ]; + client.innerApiCalls.listDashboards = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDashboards( + request, + (err?: Error|null, result?: protos.google.monitoring.dashboard.v1.IDashboard[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDashboards as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDashboards as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDashboards with error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDashboards = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDashboards(request), expectedError); + const actualRequest = (client.innerApiCalls.listDashboards as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDashboards as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDashboardsStream without error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + ]; + client.descriptors.page.listDashboards.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDashboardsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.dashboard.v1.Dashboard[] = []; + stream.on('data', (response: protos.google.monitoring.dashboard.v1.Dashboard) => { + 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.listDashboards.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDashboards, request)); + assert( + (client.descriptors.page.listDashboards.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDashboardsStream with error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDashboards.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDashboardsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.dashboard.v1.Dashboard[] = []; + stream.on('data', (response: protos.google.monitoring.dashboard.v1.Dashboard) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDashboards.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDashboards, request)); + assert( + (client.descriptors.page.listDashboards.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDashboards without error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), + ]; + client.descriptors.page.listDashboards.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.dashboard.v1.IDashboard[] = []; + const iterable = client.listDashboardsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDashboards.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDashboards.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDashboards with error', async () => { + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDashboards.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDashboardsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.dashboard.v1.IDashboard[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDashboards.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDashboards.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('alertPolicy', () => { + const fakePath = "/rendered/path/alertPolicy"; + const expectedParameters = { + project: "projectValue", + alert_policy: "alertPolicyValue", + }; + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.alertPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.alertPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('alertPolicyPath', () => { + const result = client.alertPolicyPath("projectValue", "alertPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.alertPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAlertPolicyName', () => { + const result = client.matchProjectFromAlertPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.alertPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAlertPolicyFromAlertPolicyName', () => { + const result = client.matchAlertPolicyFromAlertPolicyName(fakePath); + assert.strictEqual(result, "alertPolicyValue"); + assert((client.pathTemplates.alertPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('dashboard', () => { + const fakePath = "/rendered/path/dashboard"; + const expectedParameters = { + project: "projectValue", + dashboard: "dashboardValue", + }; + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.dashboardPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.dashboardPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('dashboardPath', () => { + const result = client.dashboardPath("projectValue", "dashboardValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.dashboardPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDashboardName', () => { + const result = client.matchProjectFromDashboardName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.dashboardPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDashboardFromDashboardName', () => { + const result = client.matchDashboardFromDashboardName(fakePath); + assert.strictEqual(result, "dashboardValue"); + assert((client.pathTemplates.dashboardPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ + 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-monitoring-dashboard/v1/tsconfig.json b/owl-bot-staging/google-monitoring-dashboard/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/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-monitoring-dashboard/v1/webpack.config.js b/owl-bot-staging/google-monitoring-dashboard/v1/webpack.config.js new file mode 100644 index 00000000000..5b23dff4a2f --- /dev/null +++ b/owl-bot-staging/google-monitoring-dashboard/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: 'DashboardsService', + filename: './dashboards-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-privacy-dlp/v2/.eslintignore b/owl-bot-staging/google-privacy-dlp/v2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-privacy-dlp/v2/.eslintrc.json b/owl-bot-staging/google-privacy-dlp/v2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-privacy-dlp/v2/.gitignore b/owl-bot-staging/google-privacy-dlp/v2/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/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-privacy-dlp/v2/.jsdoc.js b/owl-bot-staging/google-privacy-dlp/v2/.jsdoc.js new file mode 100644 index 00000000000..dd75f52f62c --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/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/dlp', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-privacy-dlp/v2/.mocharc.js b/owl-bot-staging/google-privacy-dlp/v2/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/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-privacy-dlp/v2/.prettierrc.js b/owl-bot-staging/google-privacy-dlp/v2/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/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-privacy-dlp/v2/README.md b/owl-bot-staging/google-privacy-dlp/v2/README.md new file mode 100644 index 00000000000..cb63619c6c4 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/README.md @@ -0,0 +1 @@ +Dlp: Nodejs Client diff --git a/owl-bot-staging/google-privacy-dlp/v2/package.json b/owl-bot-staging/google-privacy-dlp/v2/package.json new file mode 100644 index 00000000000..c6d0180feac --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/package.json @@ -0,0 +1,58 @@ +{ + "name": "@google-cloud/dlp", + "version": "0.1.0", + "description": "Dlp client for Node.js", + "repository": "googleapis/nodejs-dlp", + "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 dlp", + "dlp", + "dlp 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-privacy-dlp/v2/protos/google/privacy/dlp/v2/dlp.proto b/owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/dlp.proto new file mode 100644 index 00000000000..1b185261662 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/dlp.proto @@ -0,0 +1,5400 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.privacy.dlp.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/privacy/dlp/v2/storage.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "google/type/date.proto"; +import "google/type/dayofweek.proto"; +import "google/type/timeofday.proto"; + +option csharp_namespace = "Google.Cloud.Dlp.V2"; +option go_package = "cloud.google.com/go/dlp/apiv2/dlppb;dlppb"; +option java_multiple_files = true; +option java_outer_classname = "DlpProto"; +option java_package = "com.google.privacy.dlp.v2"; +option php_namespace = "Google\\Cloud\\Dlp\\V2"; +option ruby_package = "Google::Cloud::Dlp::V2"; +option (google.api.resource_definition) = { + type: "dlp.googleapis.com/DlpContent" + pattern: "projects/{project}/dlpContent" + pattern: "projects/{project}/locations/{location}/dlpContent" +}; +option (google.api.resource_definition) = { + type: "dlp.googleapis.com/OrganizationLocation" + pattern: "organizations/{organization}/locations/{location}" +}; + +// The Cloud Data Loss Prevention (DLP) API is a service that allows clients +// to detect the presence of Personally Identifiable Information (PII) and other +// privacy-sensitive data in user-supplied, unstructured data streams, like text +// blocks or images. +// The service also includes methods for sensitive data redaction and +// scheduling of data scans on Google Cloud Platform based data sets. +// +// To learn more about concepts and find how-to guides see +// https://cloud.google.com/dlp/docs/. +service DlpService { + option (google.api.default_host) = "dlp.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Finds potentially sensitive info in content. + // This method has limits on input size, processing time, and output size. + // + // When no InfoTypes or CustomInfoTypes are specified in this request, the + // system will automatically choose what detectors to run. By default this may + // be all types, but may change over time as detectors are updated. + // + // For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images + // and https://cloud.google.com/dlp/docs/inspecting-text, + rpc InspectContent(InspectContentRequest) returns (InspectContentResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/content:inspect" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/content:inspect" + body: "*" + } + }; + } + + // Redacts potentially sensitive info from an image. + // This method has limits on input size, processing time, and output size. + // See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to + // learn more. + // + // When no InfoTypes or CustomInfoTypes are specified in this request, the + // system will automatically choose what detectors to run. By default this may + // be all types, but may change over time as detectors are updated. + rpc RedactImage(RedactImageRequest) returns (RedactImageResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/image:redact" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/image:redact" + body: "*" + } + }; + } + + // De-identifies potentially sensitive info from a ContentItem. + // This method has limits on input size and output size. + // See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to + // learn more. + // + // When no InfoTypes or CustomInfoTypes are specified in this request, the + // system will automatically choose what detectors to run. By default this may + // be all types, but may change over time as detectors are updated. + rpc DeidentifyContent(DeidentifyContentRequest) returns (DeidentifyContentResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/content:deidentify" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/content:deidentify" + body: "*" + } + }; + } + + // Re-identifies content that has been de-identified. + // See + // https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example + // to learn more. + rpc ReidentifyContent(ReidentifyContentRequest) returns (ReidentifyContentResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/content:reidentify" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/content:reidentify" + body: "*" + } + }; + } + + // Returns a list of the sensitive information types that DLP API + // supports. See https://cloud.google.com/dlp/docs/infotypes-reference to + // learn more. + rpc ListInfoTypes(ListInfoTypesRequest) returns (ListInfoTypesResponse) { + option (google.api.http) = { + get: "/v2/infoTypes" + additional_bindings { + get: "/v2/{parent=locations/*}/infoTypes" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Creates an InspectTemplate for reusing frequently used configuration + // for inspecting content, images, and storage. + // See https://cloud.google.com/dlp/docs/creating-templates to learn more. + rpc CreateInspectTemplate(CreateInspectTemplateRequest) returns (InspectTemplate) { + option (google.api.http) = { + post: "/v2/{parent=organizations/*}/inspectTemplates" + body: "*" + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*}/inspectTemplates" + body: "*" + } + additional_bindings { + post: "/v2/{parent=projects/*}/inspectTemplates" + body: "*" + } + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/inspectTemplates" + body: "*" + } + }; + option (google.api.method_signature) = "parent,inspect_template"; + } + + // Updates the InspectTemplate. + // See https://cloud.google.com/dlp/docs/creating-templates to learn more. + rpc UpdateInspectTemplate(UpdateInspectTemplateRequest) returns (InspectTemplate) { + option (google.api.http) = { + patch: "/v2/{name=organizations/*/inspectTemplates/*}" + body: "*" + additional_bindings { + patch: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" + body: "*" + } + additional_bindings { + patch: "/v2/{name=projects/*/inspectTemplates/*}" + body: "*" + } + additional_bindings { + patch: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" + body: "*" + } + }; + option (google.api.method_signature) = "name,inspect_template,update_mask"; + } + + // Gets an InspectTemplate. + // See https://cloud.google.com/dlp/docs/creating-templates to learn more. + rpc GetInspectTemplate(GetInspectTemplateRequest) returns (InspectTemplate) { + option (google.api.http) = { + get: "/v2/{name=organizations/*/inspectTemplates/*}" + additional_bindings { + get: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/inspectTemplates/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists InspectTemplates. + // See https://cloud.google.com/dlp/docs/creating-templates to learn more. + rpc ListInspectTemplates(ListInspectTemplatesRequest) returns (ListInspectTemplatesResponse) { + option (google.api.http) = { + get: "/v2/{parent=organizations/*}/inspectTemplates" + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*}/inspectTemplates" + } + additional_bindings { + get: "/v2/{parent=projects/*}/inspectTemplates" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/inspectTemplates" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes an InspectTemplate. + // See https://cloud.google.com/dlp/docs/creating-templates to learn more. + rpc DeleteInspectTemplate(DeleteInspectTemplateRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=organizations/*/inspectTemplates/*}" + additional_bindings { + delete: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/inspectTemplates/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a DeidentifyTemplate for reusing frequently used configuration + // for de-identifying content, images, and storage. + // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn + // more. + rpc CreateDeidentifyTemplate(CreateDeidentifyTemplateRequest) returns (DeidentifyTemplate) { + option (google.api.http) = { + post: "/v2/{parent=organizations/*}/deidentifyTemplates" + body: "*" + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*}/deidentifyTemplates" + body: "*" + } + additional_bindings { + post: "/v2/{parent=projects/*}/deidentifyTemplates" + body: "*" + } + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/deidentifyTemplates" + body: "*" + } + }; + option (google.api.method_signature) = "parent,deidentify_template"; + } + + // Updates the DeidentifyTemplate. + // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn + // more. + rpc UpdateDeidentifyTemplate(UpdateDeidentifyTemplateRequest) returns (DeidentifyTemplate) { + option (google.api.http) = { + patch: "/v2/{name=organizations/*/deidentifyTemplates/*}" + body: "*" + additional_bindings { + patch: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" + body: "*" + } + additional_bindings { + patch: "/v2/{name=projects/*/deidentifyTemplates/*}" + body: "*" + } + additional_bindings { + patch: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" + body: "*" + } + }; + option (google.api.method_signature) = "name,deidentify_template,update_mask"; + } + + // Gets a DeidentifyTemplate. + // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn + // more. + rpc GetDeidentifyTemplate(GetDeidentifyTemplateRequest) returns (DeidentifyTemplate) { + option (google.api.http) = { + get: "/v2/{name=organizations/*/deidentifyTemplates/*}" + additional_bindings { + get: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/deidentifyTemplates/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists DeidentifyTemplates. + // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn + // more. + rpc ListDeidentifyTemplates(ListDeidentifyTemplatesRequest) returns (ListDeidentifyTemplatesResponse) { + option (google.api.http) = { + get: "/v2/{parent=organizations/*}/deidentifyTemplates" + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*}/deidentifyTemplates" + } + additional_bindings { + get: "/v2/{parent=projects/*}/deidentifyTemplates" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/deidentifyTemplates" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a DeidentifyTemplate. + // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn + // more. + rpc DeleteDeidentifyTemplate(DeleteDeidentifyTemplateRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=organizations/*/deidentifyTemplates/*}" + additional_bindings { + delete: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/deidentifyTemplates/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a job trigger to run DLP actions such as scanning storage for + // sensitive information on a set schedule. + // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. + rpc CreateJobTrigger(CreateJobTriggerRequest) returns (JobTrigger) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/jobTriggers" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/jobTriggers" + body: "*" + } + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*}/jobTriggers" + body: "*" + } + }; + option (google.api.method_signature) = "parent,job_trigger"; + } + + // Updates a job trigger. + // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. + rpc UpdateJobTrigger(UpdateJobTriggerRequest) returns (JobTrigger) { + option (google.api.http) = { + patch: "/v2/{name=projects/*/jobTriggers/*}" + body: "*" + additional_bindings { + patch: "/v2/{name=projects/*/locations/*/jobTriggers/*}" + body: "*" + } + additional_bindings { + patch: "/v2/{name=organizations/*/locations/*/jobTriggers/*}" + body: "*" + } + }; + option (google.api.method_signature) = "name,job_trigger,update_mask"; + } + + // Inspect hybrid content and store findings to a trigger. The inspection + // will be processed asynchronously. To review the findings monitor the + // jobs within the trigger. + rpc HybridInspectJobTrigger(HybridInspectJobTriggerRequest) returns (HybridInspectResponse) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/jobTriggers/*}:hybridInspect" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a job trigger. + // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. + rpc GetJobTrigger(GetJobTriggerRequest) returns (JobTrigger) { + option (google.api.http) = { + get: "/v2/{name=projects/*/jobTriggers/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/jobTriggers/*}" + } + additional_bindings { + get: "/v2/{name=organizations/*/locations/*/jobTriggers/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists job triggers. + // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. + rpc ListJobTriggers(ListJobTriggersRequest) returns (ListJobTriggersResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/jobTriggers" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/jobTriggers" + } + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*}/jobTriggers" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a job trigger. + // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. + rpc DeleteJobTrigger(DeleteJobTriggerRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/jobTriggers/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/jobTriggers/*}" + } + additional_bindings { + delete: "/v2/{name=organizations/*/locations/*/jobTriggers/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Activate a job trigger. Causes the immediate execute of a trigger + // instead of waiting on the trigger event to occur. + rpc ActivateJobTrigger(ActivateJobTriggerRequest) returns (DlpJob) { + option (google.api.http) = { + post: "/v2/{name=projects/*/jobTriggers/*}:activate" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/jobTriggers/*}:activate" + body: "*" + } + }; + } + + // Creates a new job to inspect storage or calculate risk metrics. + // See https://cloud.google.com/dlp/docs/inspecting-storage and + // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. + // + // When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the + // system will automatically choose what detectors to run. By default this may + // be all types, but may change over time as detectors are updated. + rpc CreateDlpJob(CreateDlpJobRequest) returns (DlpJob) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/dlpJobs" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/dlpJobs" + body: "*" + } + }; + option (google.api.method_signature) = "parent,inspect_job"; + option (google.api.method_signature) = "parent,risk_job"; + } + + // Lists DlpJobs that match the specified filter in the request. + // See https://cloud.google.com/dlp/docs/inspecting-storage and + // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. + rpc ListDlpJobs(ListDlpJobsRequest) returns (ListDlpJobsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/dlpJobs" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/dlpJobs" + } + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*}/dlpJobs" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the latest state of a long-running DlpJob. + // See https://cloud.google.com/dlp/docs/inspecting-storage and + // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. + rpc GetDlpJob(GetDlpJobRequest) returns (DlpJob) { + option (google.api.http) = { + get: "/v2/{name=projects/*/dlpJobs/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/dlpJobs/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a long-running DlpJob. This method indicates that the client is + // no longer interested in the DlpJob result. The job will be canceled if + // possible. + // See https://cloud.google.com/dlp/docs/inspecting-storage and + // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. + rpc DeleteDlpJob(DeleteDlpJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/dlpJobs/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/dlpJobs/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Starts asynchronous cancellation on a long-running DlpJob. The server + // makes a best effort to cancel the DlpJob, but success is not + // guaranteed. + // See https://cloud.google.com/dlp/docs/inspecting-storage and + // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. + rpc CancelDlpJob(CancelDlpJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v2/{name=projects/*/dlpJobs/*}:cancel" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/dlpJobs/*}:cancel" + body: "*" + } + }; + } + + // Creates a pre-built stored infoType to be used for inspection. + // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + // learn more. + rpc CreateStoredInfoType(CreateStoredInfoTypeRequest) returns (StoredInfoType) { + option (google.api.http) = { + post: "/v2/{parent=organizations/*}/storedInfoTypes" + body: "*" + additional_bindings { + post: "/v2/{parent=organizations/*/locations/*}/storedInfoTypes" + body: "*" + } + additional_bindings { + post: "/v2/{parent=projects/*}/storedInfoTypes" + body: "*" + } + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/storedInfoTypes" + body: "*" + } + }; + option (google.api.method_signature) = "parent,config"; + } + + // Updates the stored infoType by creating a new version. The existing version + // will continue to be used until the new version is ready. + // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + // learn more. + rpc UpdateStoredInfoType(UpdateStoredInfoTypeRequest) returns (StoredInfoType) { + option (google.api.http) = { + patch: "/v2/{name=organizations/*/storedInfoTypes/*}" + body: "*" + additional_bindings { + patch: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" + body: "*" + } + additional_bindings { + patch: "/v2/{name=projects/*/storedInfoTypes/*}" + body: "*" + } + additional_bindings { + patch: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" + body: "*" + } + }; + option (google.api.method_signature) = "name,config,update_mask"; + } + + // Gets a stored infoType. + // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + // learn more. + rpc GetStoredInfoType(GetStoredInfoTypeRequest) returns (StoredInfoType) { + option (google.api.http) = { + get: "/v2/{name=organizations/*/storedInfoTypes/*}" + additional_bindings { + get: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/storedInfoTypes/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists stored infoTypes. + // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + // learn more. + rpc ListStoredInfoTypes(ListStoredInfoTypesRequest) returns (ListStoredInfoTypesResponse) { + option (google.api.http) = { + get: "/v2/{parent=organizations/*}/storedInfoTypes" + additional_bindings { + get: "/v2/{parent=organizations/*/locations/*}/storedInfoTypes" + } + additional_bindings { + get: "/v2/{parent=projects/*}/storedInfoTypes" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/storedInfoTypes" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a stored infoType. + // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + // learn more. + rpc DeleteStoredInfoType(DeleteStoredInfoTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=organizations/*/storedInfoTypes/*}" + additional_bindings { + delete: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/storedInfoTypes/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Inspect hybrid content and store findings to a job. + // To review the findings, inspect the job. Inspection will occur + // asynchronously. + rpc HybridInspectDlpJob(HybridInspectDlpJobRequest) returns (HybridInspectResponse) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/dlpJobs/*}:hybridInspect" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Finish a running hybrid DlpJob. Triggers the finalization steps and running + // of any enabled actions that have not yet run. + rpc FinishDlpJob(FinishDlpJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/dlpJobs/*}:finish" + body: "*" + }; + } +} + +// List of excluded infoTypes. +message ExcludeInfoTypes { + // InfoType list in ExclusionRule rule drops a finding when it overlaps or + // contained within with a finding of an infoType from this list. For + // example, for `InspectionRuleSet.info_types` containing "PHONE_NUMBER"` and + // `exclusion_rule` containing `exclude_info_types.info_types` with + // "EMAIL_ADDRESS" the phone number findings are dropped if they overlap + // with EMAIL_ADDRESS finding. + // That leads to "555-222-2222@example.org" to generate only a single + // finding, namely email address. + repeated InfoType info_types = 1; +} + +// The rule to exclude findings based on a hotword. For record inspection of +// tables, column names are considered hotwords. An example of this is to +// exclude a finding if a BigQuery column matches a specific pattern. +message ExcludeByHotword { + // Regular expression pattern defining what qualifies as a hotword. + CustomInfoType.Regex hotword_regex = 1; + + // Range of characters within which the entire hotword must reside. + // The total length of the window cannot exceed 1000 characters. + // The windowBefore property in proximity should be set to 1 if the hotword + // needs to be included in a column header. + CustomInfoType.DetectionRule.Proximity proximity = 2; +} + +// The rule that specifies conditions when findings of infoTypes specified in +// `InspectionRuleSet` are removed from results. +message ExclusionRule { + // Exclusion rule types. + oneof type { + // Dictionary which defines the rule. + CustomInfoType.Dictionary dictionary = 1; + + // Regular expression which defines the rule. + CustomInfoType.Regex regex = 2; + + // Set of infoTypes for which findings would affect this rule. + ExcludeInfoTypes exclude_info_types = 3; + + // Drop if the hotword rule is contained in the proximate context. For + // tabular data, the context includes the column name. + ExcludeByHotword exclude_by_hotword = 5; + } + + // How the rule is applied, see MatchingType documentation for details. + MatchingType matching_type = 4; +} + +// A single inspection rule to be applied to infoTypes, specified in +// `InspectionRuleSet`. +message InspectionRule { + // Inspection rule types. + oneof type { + // Hotword-based detection rule. + CustomInfoType.DetectionRule.HotwordRule hotword_rule = 1; + + // Exclusion rule. + ExclusionRule exclusion_rule = 2; + } +} + +// Rule set for modifying a set of infoTypes to alter behavior under certain +// circumstances, depending on the specific details of the rules within the set. +message InspectionRuleSet { + // List of infoTypes this rule set is applied to. + repeated InfoType info_types = 1; + + // Set of rules to be applied to infoTypes. The rules are applied in order. + repeated InspectionRule rules = 2; +} + +// Configuration description of the scanning process. +// When used with redactContent only info_types and min_likelihood are currently +// used. +message InspectConfig { + // Configuration to control the number of findings returned for inspection. + // This is not used for de-identification or data profiling. + // + // When redacting sensitive data from images, finding limits don't apply. They + // can cause unexpected or inconsistent results, where only some data is + // redacted. Don't include finding limits in + // [RedactImage][google.privacy.dlp.v2.DlpService.RedactImage] + // requests. Otherwise, Cloud DLP returns an error. + message FindingLimits { + // Max findings configuration per infoType, per content item or long + // running DlpJob. + message InfoTypeLimit { + // Type of information the findings limit applies to. Only one limit per + // info_type should be provided. If InfoTypeLimit does not have an + // info_type, the DLP API applies the limit against all info_types that + // are found but not specified in another InfoTypeLimit. + InfoType info_type = 1; + + // Max findings limit for the given infoType. + int32 max_findings = 2; + } + + // Max number of findings that will be returned for each item scanned. + // When set within `InspectJobConfig`, + // the maximum returned is 2000 regardless if this is set higher. + // When set within `InspectContentRequest`, this field is ignored. + int32 max_findings_per_item = 1; + + // Max number of findings that will be returned per request/job. + // When set within `InspectContentRequest`, the maximum returned is 2000 + // regardless if this is set higher. + int32 max_findings_per_request = 2; + + // Configuration of findings limit given for specified infoTypes. + repeated InfoTypeLimit max_findings_per_info_type = 3; + } + + // Restricts what info_types to look for. The values must correspond to + // InfoType values returned by ListInfoTypes or listed at + // https://cloud.google.com/dlp/docs/infotypes-reference. + // + // When no InfoTypes or CustomInfoTypes are specified in a request, the + // system may automatically choose what detectors to run. By default this may + // be all types, but may change over time as detectors are updated. + // + // If you need precise control and predictability as to what detectors are + // run you should specify specific InfoTypes listed in the reference, + // otherwise a default list will be used, which may change over time. + repeated InfoType info_types = 1; + + // Only returns findings equal or above this threshold. The default is + // POSSIBLE. + // See https://cloud.google.com/dlp/docs/likelihood to learn more. + Likelihood min_likelihood = 2; + + // Configuration to control the number of findings returned. + // This is not used for data profiling. + // + // When redacting sensitive data from images, finding limits don't apply. They + // can cause unexpected or inconsistent results, where only some data is + // redacted. Don't include finding limits in + // [RedactImage][google.privacy.dlp.v2.DlpService.RedactImage] + // requests. Otherwise, Cloud DLP returns an error. + FindingLimits limits = 3; + + // When true, a contextual quote from the data that triggered a finding is + // included in the response; see [Finding.quote][google.privacy.dlp.v2.Finding.quote]. + // This is not used for data profiling. + bool include_quote = 4; + + // When true, excludes type information of the findings. + // This is not used for data profiling. + bool exclude_info_types = 5; + + // CustomInfoTypes provided by the user. See + // https://cloud.google.com/dlp/docs/creating-custom-infotypes to learn more. + repeated CustomInfoType custom_info_types = 6; + + // Deprecated and unused. + repeated ContentOption content_options = 8; + + // Set of rules to apply to the findings for this InspectConfig. + // Exclusion rules, contained in the set are executed in the end, other + // rules are executed in the order they are specified for each info type. + repeated InspectionRuleSet rule_set = 10; +} + +// Container for bytes to inspect or redact. +message ByteContentItem { + // The type of data being sent for inspection. To learn more, see + // [Supported file + // types](https://cloud.google.com/dlp/docs/supported-file-types). + enum BytesType { + // Unused + BYTES_TYPE_UNSPECIFIED = 0; + + // Any image type. + IMAGE = 6; + + // jpeg + IMAGE_JPEG = 1; + + // bmp + IMAGE_BMP = 2; + + // png + IMAGE_PNG = 3; + + // svg + IMAGE_SVG = 4; + + // plain text + TEXT_UTF8 = 5; + + // docx, docm, dotx, dotm + WORD_DOCUMENT = 7; + + // pdf + PDF = 8; + + // pptx, pptm, potx, potm, pot + POWERPOINT_DOCUMENT = 9; + + // xlsx, xlsm, xltx, xltm + EXCEL_DOCUMENT = 10; + + // avro + AVRO = 11; + + // csv + CSV = 12; + + // tsv + TSV = 13; + } + + // The type of data stored in the bytes string. Default will be TEXT_UTF8. + BytesType type = 1; + + // Content data to inspect or redact. + bytes data = 2; +} + +message ContentItem { + // Data of the item either in the byte array or UTF-8 string form, or table. + oneof data_item { + // String data to inspect or redact. + string value = 3; + + // Structured content for inspection. See + // https://cloud.google.com/dlp/docs/inspecting-text#inspecting_a_table to + // learn more. + Table table = 4; + + // Content data to inspect or redact. Replaces `type` and `data`. + ByteContentItem byte_item = 5; + } +} + +// Structured content to inspect. Up to 50,000 `Value`s per request allowed. See +// https://cloud.google.com/dlp/docs/inspecting-structured-text#inspecting_a_table +// to learn more. +message Table { + // Values of the row. + message Row { + // Individual cells. + repeated Value values = 1; + } + + // Headers of the table. + repeated FieldId headers = 1; + + // Rows of the table. + repeated Row rows = 2; +} + +// All the findings for a single scanned item. +message InspectResult { + // List of findings for an item. + repeated Finding findings = 1; + + // If true, then this item might have more findings than were returned, + // and the findings returned are an arbitrary subset of all findings. + // The findings list might be truncated because the input items were too + // large, or because the server reached the maximum amount of resources + // allowed for a single API call. For best results, divide the input into + // smaller batches. + bool findings_truncated = 2; +} + +// Represents a piece of potentially sensitive content. +message Finding { + option (google.api.resource) = { + type: "dlp.googleapis.com/Finding" + pattern: "projects/{project}/locations/{location}/findings/{finding}" + }; + + // Resource name in format + // projects/{project}/locations/{location}/findings/{finding} Populated only + // when viewing persisted findings. + string name = 14; + + // The content that was found. Even if the content is not textual, it + // may be converted to a textual representation here. + // Provided if `include_quote` is true and the finding is + // less than or equal to 4096 bytes long. If the finding exceeds 4096 bytes + // in length, the quote may be omitted. + string quote = 1; + + // The type of content that might have been found. + // Provided if `excluded_types` is false. + InfoType info_type = 2; + + // Confidence of how likely it is that the `info_type` is correct. + Likelihood likelihood = 3; + + // Where the content was found. + Location location = 4; + + // Timestamp when finding was detected. + google.protobuf.Timestamp create_time = 6; + + // Contains data parsed from quotes. Only populated if include_quote was set + // to true and a supported infoType was requested. Currently supported + // infoTypes: DATE, DATE_OF_BIRTH and TIME. + QuoteInfo quote_info = 7; + + // The job that stored the finding. + string resource_name = 8 [(google.api.resource_reference) = { + type: "dlp.googleapis.com/DlpJob" + }]; + + // Job trigger name, if applicable, for this finding. + string trigger_name = 9 [(google.api.resource_reference) = { + type: "dlp.googleapis.com/JobTrigger" + }]; + + // The labels associated with this `Finding`. + // + // Label keys must be between 1 and 63 characters long and must conform + // to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + // + // Label values must be between 0 and 63 characters long and must conform + // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + // + // No more than 10 labels can be associated with a given finding. + // + // Examples: + // * `"environment" : "production"` + // * `"pipeline" : "etl"` + map labels = 10; + + // Time the job started that produced this finding. + google.protobuf.Timestamp job_create_time = 11; + + // The job that stored the finding. + string job_name = 13 [(google.api.resource_reference) = { + type: "dlp.googleapis.com/DlpJob" + }]; + + // The unique finding id. + string finding_id = 15; +} + +// Specifies the location of the finding. +message Location { + // Zero-based byte offsets delimiting the finding. + // These are relative to the finding's containing element. + // Note that when the content is not textual, this references + // the UTF-8 encoded textual representation of the content. + // Omitted if content is an image. + Range byte_range = 1; + + // Unicode character offsets delimiting the finding. + // These are relative to the finding's containing element. + // Provided when the content is text. + Range codepoint_range = 2; + + // List of nested objects pointing to the precise location of the finding + // within the file or record. + repeated ContentLocation content_locations = 7; + + // Information about the container where this finding occurred, if available. + Container container = 8; +} + +// Precise location of the finding within a document, record, image, or metadata +// container. +message ContentLocation { + // Name of the container where the finding is located. + // The top level name is the source file name or table name. Names of some + // common storage containers are formatted as follows: + // + // * BigQuery tables: `{project_id}:{dataset_id}.{table_id}` + // * Cloud Storage files: `gs://{bucket}/{path}` + // * Datastore namespace: {namespace} + // + // Nested names could be absent if the embedded object has no string + // identifier (for example, an image contained within a document). + string container_name = 1; + + // Type of the container within the file with location of the finding. + oneof location { + // Location within a row or record of a database table. + RecordLocation record_location = 2; + + // Location within an image's pixels. + ImageLocation image_location = 3; + + // Location data for document files. + DocumentLocation document_location = 5; + + // Location within the metadata for inspected content. + MetadataLocation metadata_location = 8; + } + + // Finding container modification timestamp, if applicable. For Cloud Storage, + // this field contains the last file modification timestamp. For a BigQuery + // table, this field contains the last_modified_time property. For Datastore, + // this field isn't populated. + google.protobuf.Timestamp container_timestamp = 6; + + // Finding container version, if available + // ("generation" for Cloud Storage). + string container_version = 7; +} + +// Metadata Location +message MetadataLocation { + // Type of metadata containing the finding. + MetadataType type = 1; + + // Label of the piece of metadata containing the finding, for example - + // latitude, author, caption. + oneof label { + // Storage metadata. + StorageMetadataLabel storage_label = 3; + } +} + +// Storage metadata label to indicate which metadata entry contains findings. +message StorageMetadataLabel { + string key = 1; +} + +// Location of a finding within a document. +message DocumentLocation { + // Offset of the line, from the beginning of the file, where the finding + // is located. + int64 file_offset = 1; +} + +// Location of a finding within a row or record. +message RecordLocation { + // Key of the finding. + RecordKey record_key = 1; + + // Field id of the field containing the finding. + FieldId field_id = 2; + + // Location within a `ContentItem.Table`. + TableLocation table_location = 3; +} + +// Location of a finding within a table. +message TableLocation { + // The zero-based index of the row where the finding is located. Only + // populated for resources that have a natural ordering, not BigQuery. In + // BigQuery, to identify the row a finding came from, populate + // BigQueryOptions.identifying_fields with your primary key column names and + // when you store the findings the value of those columns will be stored + // inside of Finding. + int64 row_index = 1; +} + +// Represents a container that may contain DLP findings. +// Examples of a container include a file, table, or database record. +message Container { + // Container type, for example BigQuery or Cloud Storage. + string type = 1; + + // Project where the finding was found. + // Can be different from the project that owns the finding. + string project_id = 2; + + // A string representation of the full container name. + // Examples: + // - BigQuery: 'Project:DataSetId.TableId' + // - Cloud Storage: 'gs://Bucket/folders/filename.txt' + string full_path = 3; + + // The root of the container. + // Examples: + // + // - For BigQuery table `project_id:dataset_id.table_id`, the root is + // `dataset_id` + // - For Cloud Storage file `gs://bucket/folder/filename.txt`, the root + // is `gs://bucket` + string root_path = 4; + + // The rest of the path after the root. + // Examples: + // + // - For BigQuery table `project_id:dataset_id.table_id`, the relative path is + // `table_id` + // - For Cloud Storage file `gs://bucket/folder/filename.txt`, the relative + // path is `folder/filename.txt` + string relative_path = 5; + + // Findings container modification timestamp, if applicable. For Cloud + // Storage, this field contains the last file modification timestamp. For a + // BigQuery table, this field contains the last_modified_time property. For + // Datastore, this field isn't populated. + google.protobuf.Timestamp update_time = 6; + + // Findings container version, if available + // ("generation" for Cloud Storage). + string version = 7; +} + +// Generic half-open interval [start, end) +message Range { + // Index of the first character of the range (inclusive). + int64 start = 1; + + // Index of the last character of the range (exclusive). + int64 end = 2; +} + +// Location of the finding within an image. +message ImageLocation { + // Bounding boxes locating the pixels within the image containing the finding. + repeated BoundingBox bounding_boxes = 1; +} + +// Bounding box encompassing detected text within an image. +message BoundingBox { + // Top coordinate of the bounding box. (0,0) is upper left. + int32 top = 1; + + // Left coordinate of the bounding box. (0,0) is upper left. + int32 left = 2; + + // Width of the bounding box in pixels. + int32 width = 3; + + // Height of the bounding box in pixels. + int32 height = 4; +} + +// Request to search for potentially sensitive info in an image and redact it +// by covering it with a colored rectangle. +message RedactImageRequest { + // Configuration for determining how redaction of images should occur. + message ImageRedactionConfig { + // Type of information to redact from images. + oneof target { + // Only one per info_type should be provided per request. If not + // specified, and redact_all_text is false, the DLP API will redact all + // text that it matches against all info_types that are found, but not + // specified in another ImageRedactionConfig. + InfoType info_type = 1; + + // If true, all text found in the image, regardless whether it matches an + // info_type, is redacted. Only one should be provided. + bool redact_all_text = 2; + } + + // The color to use when redacting content from an image. If not specified, + // the default is black. + Color redaction_color = 3; + } + + // Parent resource name. + // + // The format of this value varies depending on whether you have [specified a + // processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [(google.api.resource_reference) = { + child_type: "dlp.googleapis.com/DlpContent" + }]; + + // Deprecated. This field has no effect. + string location_id = 8; + + // Configuration for the inspector. + InspectConfig inspect_config = 2; + + // The configuration for specifying what content to redact from images. + repeated ImageRedactionConfig image_redaction_configs = 5; + + // Whether the response should include findings along with the redacted + // image. + bool include_findings = 6; + + // The content must be PNG, JPEG, SVG or BMP. + ByteContentItem byte_item = 7; +} + +// Represents a color in the RGB color space. +message Color { + // The amount of red in the color as a value in the interval [0, 1]. + float red = 1; + + // The amount of green in the color as a value in the interval [0, 1]. + float green = 2; + + // The amount of blue in the color as a value in the interval [0, 1]. + float blue = 3; +} + +// Results of redacting an image. +message RedactImageResponse { + // The redacted image. The type will be the same as the original image. + bytes redacted_image = 1; + + // If an image was being inspected and the InspectConfig's include_quote was + // set to true, then this field will include all text, if any, that was found + // in the image. + string extracted_text = 2; + + // The findings. Populated when include_findings in the request is true. + InspectResult inspect_result = 3; +} + +// Request to de-identify a ContentItem. +message DeidentifyContentRequest { + // Parent resource name. + // + // The format of this value varies depending on whether you have [specified a + // processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [(google.api.resource_reference) = { + child_type: "dlp.googleapis.com/DlpContent" + }]; + + // Configuration for the de-identification of the content item. + // Items specified here will override the template referenced by the + // deidentify_template_name argument. + DeidentifyConfig deidentify_config = 2; + + // Configuration for the inspector. + // Items specified here will override the template referenced by the + // inspect_template_name argument. + InspectConfig inspect_config = 3; + + // The item to de-identify. Will be treated as text. + // + // This value must be of type + // [Table][google.privacy.dlp.v2.Table] if your + // [deidentify_config][google.privacy.dlp.v2.DeidentifyContentRequest.deidentify_config] + // is a + // [RecordTransformations][google.privacy.dlp.v2.RecordTransformations] + // object. + ContentItem item = 4; + + // Template to use. Any configuration directly specified in + // inspect_config will override those set in the template. Singular fields + // that are set in this request will replace their corresponding fields in the + // template. Repeated fields are appended. Singular sub-messages and groups + // are recursively merged. + string inspect_template_name = 5; + + // Template to use. Any configuration directly specified in + // deidentify_config will override those set in the template. Singular fields + // that are set in this request will replace their corresponding fields in the + // template. Repeated fields are appended. Singular sub-messages and groups + // are recursively merged. + string deidentify_template_name = 6; + + // Deprecated. This field has no effect. + string location_id = 7; +} + +// Results of de-identifying a ContentItem. +message DeidentifyContentResponse { + // The de-identified item. + ContentItem item = 1; + + // An overview of the changes that were made on the `item`. + TransformationOverview overview = 2; +} + +// Request to re-identify an item. +message ReidentifyContentRequest { + // Required. Parent resource name. + // + // The format of this value varies depending on whether you have [specified a + // processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dlp.googleapis.com/DlpContent" + } + ]; + + // Configuration for the re-identification of the content item. + // This field shares the same proto message type that is used for + // de-identification, however its usage here is for the reversal of the + // previous de-identification. Re-identification is performed by examining + // the transformations used to de-identify the items and executing the + // reverse. This requires that only reversible transformations + // be provided here. The reversible transformations are: + // + // - `CryptoDeterministicConfig` + // - `CryptoReplaceFfxFpeConfig` + DeidentifyConfig reidentify_config = 2; + + // Configuration for the inspector. + InspectConfig inspect_config = 3; + + // The item to re-identify. Will be treated as text. + ContentItem item = 4; + + // Template to use. Any configuration directly specified in + // `inspect_config` will override those set in the template. Singular fields + // that are set in this request will replace their corresponding fields in the + // template. Repeated fields are appended. Singular sub-messages and groups + // are recursively merged. + string inspect_template_name = 5; + + // Template to use. References an instance of `DeidentifyTemplate`. + // Any configuration directly specified in `reidentify_config` or + // `inspect_config` will override those set in the template. The + // `DeidentifyTemplate` used must include only reversible transformations. + // Singular fields that are set in this request will replace their + // corresponding fields in the template. Repeated fields are appended. + // Singular sub-messages and groups are recursively merged. + string reidentify_template_name = 6; + + // Deprecated. This field has no effect. + string location_id = 7; +} + +// Results of re-identifying an item. +message ReidentifyContentResponse { + // The re-identified item. + ContentItem item = 1; + + // An overview of the changes that were made to the `item`. + TransformationOverview overview = 2; +} + +// Request to search for potentially sensitive info in a ContentItem. +message InspectContentRequest { + // Parent resource name. + // + // The format of this value varies depending on whether you have [specified a + // processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [(google.api.resource_reference) = { + child_type: "dlp.googleapis.com/DlpContent" + }]; + + // Configuration for the inspector. What specified here will override + // the template referenced by the inspect_template_name argument. + InspectConfig inspect_config = 2; + + // The item to inspect. + ContentItem item = 3; + + // Template to use. Any configuration directly specified in + // inspect_config will override those set in the template. Singular fields + // that are set in this request will replace their corresponding fields in the + // template. Repeated fields are appended. Singular sub-messages and groups + // are recursively merged. + string inspect_template_name = 4; + + // Deprecated. This field has no effect. + string location_id = 5; +} + +// Results of inspecting an item. +message InspectContentResponse { + // The findings. + InspectResult result = 1; +} + +// Cloud repository for storing output. +message OutputStorageConfig { + // Predefined schemas for storing findings. + // Only for use with external storage. + enum OutputSchema { + // Unused. + OUTPUT_SCHEMA_UNSPECIFIED = 0; + + // Basic schema including only `info_type`, `quote`, `certainty`, and + // `timestamp`. + BASIC_COLUMNS = 1; + + // Schema tailored to findings from scanning Cloud Storage. + GCS_COLUMNS = 2; + + // Schema tailored to findings from scanning Google Datastore. + DATASTORE_COLUMNS = 3; + + // Schema tailored to findings from scanning Google BigQuery. + BIG_QUERY_COLUMNS = 4; + + // Schema containing all columns. + ALL_COLUMNS = 5; + } + + // Output storage types. + oneof type { + // Store findings in an existing table or a new table in an existing + // dataset. If table_id is not set a new one will be generated + // for you with the following format: + // dlp_googleapis_yyyy_mm_dd_[dlp_job_id]. Pacific time zone will be used + // for generating the date details. + // + // For Inspect, each column in an existing output table must have the same + // name, type, and mode of a field in the `Finding` object. + // + // For Risk, an existing output table should be the output of a previous + // Risk analysis job run on the same source table, with the same privacy + // metric and quasi-identifiers. Risk jobs that analyze the same table but + // compute a different privacy metric, or use different sets of + // quasi-identifiers, cannot store their results in the same table. + BigQueryTable table = 1; + } + + // Schema used for writing the findings for Inspect jobs. This field is only + // used for Inspect and must be unspecified for Risk jobs. Columns are derived + // from the `Finding` object. If appending to an existing table, any columns + // from the predefined schema that are missing will be added. No columns in + // the existing table will be deleted. + // + // If unspecified, then all available columns will be used for a new table or + // an (existing) table with no schema, and no changes will be made to an + // existing table that has a schema. + // Only for use with external storage. + OutputSchema output_schema = 3; +} + +// Statistics regarding a specific InfoType. +message InfoTypeStats { + // The type of finding this stat is for. + InfoType info_type = 1; + + // Number of findings for this infoType. + int64 count = 2; +} + +// The results of an inspect DataSource job. +message InspectDataSourceDetails { + // Snapshot of the inspection configuration. + message RequestedOptions { + // If run with an InspectTemplate, a snapshot of its state at the time of + // this run. + InspectTemplate snapshot_inspect_template = 1; + + // Inspect config. + InspectJobConfig job_config = 3; + } + + // All result fields mentioned below are updated while the job is processing. + message Result { + // Total size in bytes that were processed. + int64 processed_bytes = 1; + + // Estimate of the number of bytes to process. + int64 total_estimated_bytes = 2; + + // Statistics of how many instances of each info type were found during + // inspect job. + repeated InfoTypeStats info_type_stats = 3; + + // Statistics related to the processing of hybrid inspect. + HybridInspectStatistics hybrid_stats = 7; + } + + // The configuration used for this job. + RequestedOptions requested_options = 2; + + // A summary of the outcome of this inspection job. + Result result = 3; +} + +// Statistics related to processing hybrid inspect requests. +message HybridInspectStatistics { + // The number of hybrid inspection requests processed within this job. + int64 processed_count = 1; + + // The number of hybrid inspection requests aborted because the job ran + // out of quota or was ended before they could be processed. + int64 aborted_count = 2; + + // The number of hybrid requests currently being processed. Only populated + // when called via method `getDlpJob`. + // A burst of traffic may cause hybrid inspect requests to be enqueued. + // Processing will take place as quickly as possible, but resource limitations + // may impact how long a request is enqueued for. + int64 pending_count = 3; +} + +// InfoType description. +message InfoTypeDescription { + // Internal name of the infoType. + string name = 1; + + // Human readable form of the infoType name. + string display_name = 2; + + // Which parts of the API supports this InfoType. + repeated InfoTypeSupportedBy supported_by = 3; + + // Description of the infotype. Translated when language is provided in the + // request. + string description = 4; + + // A list of available versions for the infotype. + repeated VersionDescription versions = 9; + + // The category of the infoType. + repeated InfoTypeCategory categories = 10; +} + +// Classification of infoTypes to organize them according to geographic +// location, industry, and data type. +message InfoTypeCategory { + // Enum of the current locations. + // We might add more locations in the future. + enum LocationCategory { + // Unused location + LOCATION_UNSPECIFIED = 0; + + // The infoType is not issued by or tied to a specific region, but is used + // almost everywhere. + GLOBAL = 1; + + // The infoType is typically used in Argentina. + ARGENTINA = 2; + + // The infoType is typically used in Australia. + AUSTRALIA = 3; + + // The infoType is typically used in Belgium. + BELGIUM = 4; + + // The infoType is typically used in Brazil. + BRAZIL = 5; + + // The infoType is typically used in Canada. + CANADA = 6; + + // The infoType is typically used in Chile. + CHILE = 7; + + // The infoType is typically used in China. + CHINA = 8; + + // The infoType is typically used in Colombia. + COLOMBIA = 9; + + // The infoType is typically used in Denmark. + DENMARK = 10; + + // The infoType is typically used in France. + FRANCE = 11; + + // The infoType is typically used in Finland. + FINLAND = 12; + + // The infoType is typically used in Germany. + GERMANY = 13; + + // The infoType is typically used in Hong Kong. + HONG_KONG = 14; + + // The infoType is typically used in India. + INDIA = 15; + + // The infoType is typically used in Indonesia. + INDONESIA = 16; + + // The infoType is typically used in Ireland. + IRELAND = 17; + + // The infoType is typically used in Israel. + ISRAEL = 18; + + // The infoType is typically used in Italy. + ITALY = 19; + + // The infoType is typically used in Japan. + JAPAN = 20; + + // The infoType is typically used in Korea. + KOREA = 21; + + // The infoType is typically used in Mexico. + MEXICO = 22; + + // The infoType is typically used in the Netherlands. + THE_NETHERLANDS = 23; + + // The infoType is typically used in Norway. + NORWAY = 24; + + // The infoType is typically used in Paraguay. + PARAGUAY = 25; + + // The infoType is typically used in Peru. + PERU = 26; + + // The infoType is typically used in Poland. + POLAND = 27; + + // The infoType is typically used in Portugal. + PORTUGAL = 28; + + // The infoType is typically used in Singapore. + SINGAPORE = 29; + + // The infoType is typically used in South Africa. + SOUTH_AFRICA = 30; + + // The infoType is typically used in Spain. + SPAIN = 31; + + // The infoType is typically used in Sweden. + SWEDEN = 32; + + // The infoType is typically used in Taiwan. + TAIWAN = 33; + + // The infoType is typically used in Thailand. + THAILAND = 34; + + // The infoType is typically used in Turkey. + TURKEY = 35; + + // The infoType is typically used in the United Kingdom. + UNITED_KINGDOM = 36; + + // The infoType is typically used in the United States. + UNITED_STATES = 37; + + // The infoType is typically used in Uruguay. + URUGUAY = 38; + + // The infoType is typically used in Venezuela. + VENEZUELA = 39; + + // The infoType is typically used in Google internally. + INTERNAL = 40; + + // The infoType is typically used in New Zealand. + NEW_ZEALAND = 41; + } + + // Enum of the current industries in the category. + // We might add more industries in the future. + enum IndustryCategory { + // Unused industry + INDUSTRY_UNSPECIFIED = 0; + + // The infoType is typically used in the finance industry. + FINANCE = 1; + + // The infoType is typically used in the health industry. + HEALTH = 2; + + // The infoType is typically used in the telecommunications industry. + TELECOMMUNICATIONS = 3; + } + + // Enum of the current types in the category. + // We might add more types in the future. + enum TypeCategory { + // Unused type + TYPE_UNSPECIFIED = 0; + + // Personally identifiable information, for example, a + // name or phone number + PII = 1; + + // Personally identifiable information that is especially sensitive, for + // example, a passport number. + SPII = 2; + + // Attributes that can partially identify someone, especially in + // combination with other attributes, like age, height, and gender. + DEMOGRAPHIC = 3; + + // Confidential or secret information, for example, a password. + CREDENTIAL = 4; + + // An identification document issued by a government. + GOVERNMENT_ID = 5; + + // A document, for example, a resume or source code. + DOCUMENT = 6; + + // Information that is not sensitive on its own, but provides details about + // the circumstances surrounding an entity or an event. + CONTEXTUAL_INFORMATION = 7; + } + + oneof category { + // The region or country that issued the ID or document represented by the + // infoType. + LocationCategory location_category = 1; + + // The group of relevant businesses where this infoType is commonly used + IndustryCategory industry_category = 2; + + // The class of identifiers where this infoType belongs + TypeCategory type_category = 3; + } +} + +// Details about each available version for an infotype. +message VersionDescription { + // Name of the version + string version = 1; + + // Description of the version. + string description = 2; +} + +// Request for the list of infoTypes. +message ListInfoTypesRequest { + // The parent resource name. + // + // The format of this value is as follows: + // + // locations/LOCATION_ID + string parent = 4; + + // BCP-47 language code for localized infoType friendly + // names. If omitted, or if localized strings are not available, + // en-US strings will be returned. + string language_code = 1; + + // filter to only return infoTypes supported by certain parts of the + // API. Defaults to supported_by=INSPECT. + string filter = 2; + + // Deprecated. This field has no effect. + string location_id = 3; +} + +// Response to the ListInfoTypes request. +message ListInfoTypesResponse { + // Set of sensitive infoTypes. + repeated InfoTypeDescription info_types = 1; +} + +// Configuration for a risk analysis job. See +// https://cloud.google.com/dlp/docs/concepts-risk-analysis to learn more. +message RiskAnalysisJobConfig { + // Privacy metric to compute. + PrivacyMetric privacy_metric = 1; + + // Input dataset to compute metrics over. + BigQueryTable source_table = 2; + + // Actions to execute at the completion of the job. Are executed in the order + // provided. + repeated Action actions = 3; +} + +// A column with a semantic tag attached. +message QuasiId { + // Required. Identifies the column. + FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; + + // Semantic tag that identifies what a column contains, to determine which + // statistical model to use to estimate the reidentifiability of each + // value. [required] + oneof tag { + // A column can be tagged with a InfoType to use the relevant public + // dataset as a statistical model of population, if available. We + // currently support US ZIP codes, region codes, ages and genders. + // To programmatically obtain the list of supported InfoTypes, use + // ListInfoTypes with the supported_by=RISK_ANALYSIS filter. + InfoType info_type = 2; + + // A column can be tagged with a custom tag. In this case, the user must + // indicate an auxiliary table that contains statistical information on + // the possible values of this column (below). + string custom_tag = 3; + + // If no semantic tag is indicated, we infer the statistical model from + // the distribution of values in the input data + google.protobuf.Empty inferred = 4; + } +} + +// An auxiliary table containing statistical information on the relative +// frequency of different quasi-identifiers values. It has one or several +// quasi-identifiers columns, and one column that indicates the relative +// frequency of each quasi-identifier tuple. +// If a tuple is present in the data but not in the auxiliary table, the +// corresponding relative frequency is assumed to be zero (and thus, the +// tuple is highly reidentifiable). +message StatisticalTable { + // A quasi-identifier column has a custom_tag, used to know which column + // in the data corresponds to which column in the statistical model. + message QuasiIdentifierField { + // Identifies the column. + FieldId field = 1; + + // A column can be tagged with a custom tag. In this case, the user must + // indicate an auxiliary table that contains statistical information on + // the possible values of this column (below). + string custom_tag = 2; + } + + // Required. Auxiliary table location. + BigQueryTable table = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Quasi-identifier columns. + repeated QuasiIdentifierField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The relative frequency column must contain a floating-point number + // between 0 and 1 (inclusive). Null values are assumed to be zero. + FieldId relative_frequency = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Privacy metric to compute for reidentification risk analysis. +message PrivacyMetric { + // Compute numerical stats over an individual column, including + // min, max, and quantiles. + message NumericalStatsConfig { + // Field to compute numerical stats on. Supported types are + // integer, float, date, datetime, timestamp, time. + FieldId field = 1; + } + + // Compute numerical stats over an individual column, including + // number of distinct values and value count distribution. + message CategoricalStatsConfig { + // Field to compute categorical stats on. All column types are + // supported except for arrays and structs. However, it may be more + // informative to use NumericalStats when the field type is supported, + // depending on the data. + FieldId field = 1; + } + + // k-anonymity metric, used for analysis of reidentification risk. + message KAnonymityConfig { + // Set of fields to compute k-anonymity over. When multiple fields are + // specified, they are considered a single composite key. Structs and + // repeated data types are not supported; however, nested fields are + // supported so long as they are not structs themselves or nested within + // a repeated field. + repeated FieldId quasi_ids = 1; + + // Message indicating that multiple rows might be associated to a + // single individual. If the same entity_id is associated to multiple + // quasi-identifier tuples over distinct rows, we consider the entire + // collection of tuples as the composite quasi-identifier. This collection + // is a multiset: the order in which the different tuples appear in the + // dataset is ignored, but their frequency is taken into account. + // + // Important note: a maximum of 1000 rows can be associated to a single + // entity ID. If more rows are associated with the same entity ID, some + // might be ignored. + EntityId entity_id = 2; + } + + // l-diversity metric, used for analysis of reidentification risk. + message LDiversityConfig { + // Set of quasi-identifiers indicating how equivalence classes are + // defined for the l-diversity computation. When multiple fields are + // specified, they are considered a single composite key. + repeated FieldId quasi_ids = 1; + + // Sensitive field for computing the l-value. + FieldId sensitive_attribute = 2; + } + + // Reidentifiability metric. This corresponds to a risk model similar to what + // is called "journalist risk" in the literature, except the attack dataset is + // statistically modeled instead of being perfectly known. This can be done + // using publicly available data (like the US Census), or using a custom + // statistical model (indicated as one or several BigQuery tables), or by + // extrapolating from the distribution of values in the input dataset. + message KMapEstimationConfig { + // A column with a semantic tag attached. + message TaggedField { + // Required. Identifies the column. + FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; + + // Semantic tag that identifies what a column contains, to determine which + // statistical model to use to estimate the reidentifiability of each + // value. [required] + oneof tag { + // A column can be tagged with a InfoType to use the relevant public + // dataset as a statistical model of population, if available. We + // currently support US ZIP codes, region codes, ages and genders. + // To programmatically obtain the list of supported InfoTypes, use + // ListInfoTypes with the supported_by=RISK_ANALYSIS filter. + InfoType info_type = 2; + + // A column can be tagged with a custom tag. In this case, the user must + // indicate an auxiliary table that contains statistical information on + // the possible values of this column (below). + string custom_tag = 3; + + // If no semantic tag is indicated, we infer the statistical model from + // the distribution of values in the input data + google.protobuf.Empty inferred = 4; + } + } + + // An auxiliary table contains statistical information on the relative + // frequency of different quasi-identifiers values. It has one or several + // quasi-identifiers columns, and one column that indicates the relative + // frequency of each quasi-identifier tuple. + // If a tuple is present in the data but not in the auxiliary table, the + // corresponding relative frequency is assumed to be zero (and thus, the + // tuple is highly reidentifiable). + message AuxiliaryTable { + // A quasi-identifier column has a custom_tag, used to know which column + // in the data corresponds to which column in the statistical model. + message QuasiIdField { + // Identifies the column. + FieldId field = 1; + + // A auxiliary field. + string custom_tag = 2; + } + + // Required. Auxiliary table location. + BigQueryTable table = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Quasi-identifier columns. + repeated QuasiIdField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The relative frequency column must contain a floating-point number + // between 0 and 1 (inclusive). Null values are assumed to be zero. + FieldId relative_frequency = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. Fields considered to be quasi-identifiers. No two columns can have the + // same tag. + repeated TaggedField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; + + // ISO 3166-1 alpha-2 region code to use in the statistical modeling. + // Set if no column is tagged with a region-specific InfoType (like + // US_ZIP_5) or a region code. + string region_code = 2; + + // Several auxiliary tables can be used in the analysis. Each custom_tag + // used to tag a quasi-identifiers column must appear in exactly one column + // of one auxiliary table. + repeated AuxiliaryTable auxiliary_tables = 3; + } + + // δ-presence metric, used to estimate how likely it is for an attacker to + // figure out that one given individual appears in a de-identified dataset. + // Similarly to the k-map metric, we cannot compute δ-presence exactly without + // knowing the attack dataset, so we use a statistical model instead. + message DeltaPresenceEstimationConfig { + // Required. Fields considered to be quasi-identifiers. No two fields can have the + // same tag. + repeated QuasiId quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; + + // ISO 3166-1 alpha-2 region code to use in the statistical modeling. + // Set if no column is tagged with a region-specific InfoType (like + // US_ZIP_5) or a region code. + string region_code = 2; + + // Several auxiliary tables can be used in the analysis. Each custom_tag + // used to tag a quasi-identifiers field must appear in exactly one + // field of one auxiliary table. + repeated StatisticalTable auxiliary_tables = 3; + } + + // Types of analysis. + oneof type { + // Numerical stats + NumericalStatsConfig numerical_stats_config = 1; + + // Categorical stats + CategoricalStatsConfig categorical_stats_config = 2; + + // K-anonymity + KAnonymityConfig k_anonymity_config = 3; + + // l-diversity + LDiversityConfig l_diversity_config = 4; + + // k-map + KMapEstimationConfig k_map_estimation_config = 5; + + // delta-presence + DeltaPresenceEstimationConfig delta_presence_estimation_config = 6; + } +} + +// Result of a risk analysis operation request. +message AnalyzeDataSourceRiskDetails { + // Result of the numerical stats computation. + message NumericalStatsResult { + // Minimum value appearing in the column. + Value min_value = 1; + + // Maximum value appearing in the column. + Value max_value = 2; + + // List of 99 values that partition the set of field values into 100 equal + // sized buckets. + repeated Value quantile_values = 4; + } + + // Result of the categorical stats computation. + message CategoricalStatsResult { + // Histogram of value frequencies in the column. + message CategoricalStatsHistogramBucket { + // Lower bound on the value frequency of the values in this bucket. + int64 value_frequency_lower_bound = 1; + + // Upper bound on the value frequency of the values in this bucket. + int64 value_frequency_upper_bound = 2; + + // Total number of values in this bucket. + int64 bucket_size = 3; + + // Sample of value frequencies in this bucket. The total number of + // values returned per bucket is capped at 20. + repeated ValueFrequency bucket_values = 4; + + // Total number of distinct values in this bucket. + int64 bucket_value_count = 5; + } + + // Histogram of value frequencies in the column. + repeated CategoricalStatsHistogramBucket value_frequency_histogram_buckets = 5; + } + + // Result of the k-anonymity computation. + message KAnonymityResult { + // The set of columns' values that share the same ldiversity value + message KAnonymityEquivalenceClass { + // Set of values defining the equivalence class. One value per + // quasi-identifier column in the original KAnonymity metric message. + // The order is always the same as the original request. + repeated Value quasi_ids_values = 1; + + // Size of the equivalence class, for example number of rows with the + // above set of values. + int64 equivalence_class_size = 2; + } + + // Histogram of k-anonymity equivalence classes. + message KAnonymityHistogramBucket { + // Lower bound on the size of the equivalence classes in this bucket. + int64 equivalence_class_size_lower_bound = 1; + + // Upper bound on the size of the equivalence classes in this bucket. + int64 equivalence_class_size_upper_bound = 2; + + // Total number of equivalence classes in this bucket. + int64 bucket_size = 3; + + // Sample of equivalence classes in this bucket. The total number of + // classes returned per bucket is capped at 20. + repeated KAnonymityEquivalenceClass bucket_values = 4; + + // Total number of distinct equivalence classes in this bucket. + int64 bucket_value_count = 5; + } + + // Histogram of k-anonymity equivalence classes. + repeated KAnonymityHistogramBucket equivalence_class_histogram_buckets = 5; + } + + // Result of the l-diversity computation. + message LDiversityResult { + // The set of columns' values that share the same ldiversity value. + message LDiversityEquivalenceClass { + // Quasi-identifier values defining the k-anonymity equivalence + // class. The order is always the same as the original request. + repeated Value quasi_ids_values = 1; + + // Size of the k-anonymity equivalence class. + int64 equivalence_class_size = 2; + + // Number of distinct sensitive values in this equivalence class. + int64 num_distinct_sensitive_values = 3; + + // Estimated frequencies of top sensitive values. + repeated ValueFrequency top_sensitive_values = 4; + } + + // Histogram of l-diversity equivalence class sensitive value frequencies. + message LDiversityHistogramBucket { + // Lower bound on the sensitive value frequencies of the equivalence + // classes in this bucket. + int64 sensitive_value_frequency_lower_bound = 1; + + // Upper bound on the sensitive value frequencies of the equivalence + // classes in this bucket. + int64 sensitive_value_frequency_upper_bound = 2; + + // Total number of equivalence classes in this bucket. + int64 bucket_size = 3; + + // Sample of equivalence classes in this bucket. The total number of + // classes returned per bucket is capped at 20. + repeated LDiversityEquivalenceClass bucket_values = 4; + + // Total number of distinct equivalence classes in this bucket. + int64 bucket_value_count = 5; + } + + // Histogram of l-diversity equivalence class sensitive value frequencies. + repeated LDiversityHistogramBucket sensitive_value_frequency_histogram_buckets = 5; + } + + // Result of the reidentifiability analysis. Note that these results are an + // estimation, not exact values. + message KMapEstimationResult { + // A tuple of values for the quasi-identifier columns. + message KMapEstimationQuasiIdValues { + // The quasi-identifier values. + repeated Value quasi_ids_values = 1; + + // The estimated anonymity for these quasi-identifier values. + int64 estimated_anonymity = 2; + } + + // A KMapEstimationHistogramBucket message with the following values: + // min_anonymity: 3 + // max_anonymity: 5 + // frequency: 42 + // means that there are 42 records whose quasi-identifier values correspond + // to 3, 4 or 5 people in the overlying population. An important particular + // case is when min_anonymity = max_anonymity = 1: the frequency field then + // corresponds to the number of uniquely identifiable records. + message KMapEstimationHistogramBucket { + // Always positive. + int64 min_anonymity = 1; + + // Always greater than or equal to min_anonymity. + int64 max_anonymity = 2; + + // Number of records within these anonymity bounds. + int64 bucket_size = 5; + + // Sample of quasi-identifier tuple values in this bucket. The total + // number of classes returned per bucket is capped at 20. + repeated KMapEstimationQuasiIdValues bucket_values = 6; + + // Total number of distinct quasi-identifier tuple values in this bucket. + int64 bucket_value_count = 7; + } + + // The intervals [min_anonymity, max_anonymity] do not overlap. If a value + // doesn't correspond to any such interval, the associated frequency is + // zero. For example, the following records: + // {min_anonymity: 1, max_anonymity: 1, frequency: 17} + // {min_anonymity: 2, max_anonymity: 3, frequency: 42} + // {min_anonymity: 5, max_anonymity: 10, frequency: 99} + // mean that there are no record with an estimated anonymity of 4, 5, or + // larger than 10. + repeated KMapEstimationHistogramBucket k_map_estimation_histogram = 1; + } + + // Result of the δ-presence computation. Note that these results are an + // estimation, not exact values. + message DeltaPresenceEstimationResult { + // A tuple of values for the quasi-identifier columns. + message DeltaPresenceEstimationQuasiIdValues { + // The quasi-identifier values. + repeated Value quasi_ids_values = 1; + + // The estimated probability that a given individual sharing these + // quasi-identifier values is in the dataset. This value, typically + // called δ, is the ratio between the number of records in the dataset + // with these quasi-identifier values, and the total number of individuals + // (inside *and* outside the dataset) with these quasi-identifier values. + // For example, if there are 15 individuals in the dataset who share the + // same quasi-identifier values, and an estimated 100 people in the entire + // population with these values, then δ is 0.15. + double estimated_probability = 2; + } + + // A DeltaPresenceEstimationHistogramBucket message with the following + // values: + // min_probability: 0.1 + // max_probability: 0.2 + // frequency: 42 + // means that there are 42 records for which δ is in [0.1, 0.2). An + // important particular case is when min_probability = max_probability = 1: + // then, every individual who shares this quasi-identifier combination is in + // the dataset. + message DeltaPresenceEstimationHistogramBucket { + // Between 0 and 1. + double min_probability = 1; + + // Always greater than or equal to min_probability. + double max_probability = 2; + + // Number of records within these probability bounds. + int64 bucket_size = 5; + + // Sample of quasi-identifier tuple values in this bucket. The total + // number of classes returned per bucket is capped at 20. + repeated DeltaPresenceEstimationQuasiIdValues bucket_values = 6; + + // Total number of distinct quasi-identifier tuple values in this bucket. + int64 bucket_value_count = 7; + } + + // The intervals [min_probability, max_probability) do not overlap. If a + // value doesn't correspond to any such interval, the associated frequency + // is zero. For example, the following records: + // {min_probability: 0, max_probability: 0.1, frequency: 17} + // {min_probability: 0.2, max_probability: 0.3, frequency: 42} + // {min_probability: 0.3, max_probability: 0.4, frequency: 99} + // mean that there are no record with an estimated probability in [0.1, 0.2) + // nor larger or equal to 0.4. + repeated DeltaPresenceEstimationHistogramBucket delta_presence_estimation_histogram = 1; + } + + // Risk analysis options. + message RequestedRiskAnalysisOptions { + // The job config for the risk job. + RiskAnalysisJobConfig job_config = 1; + } + + // Privacy metric to compute. + PrivacyMetric requested_privacy_metric = 1; + + // Input dataset to compute metrics over. + BigQueryTable requested_source_table = 2; + + // Values associated with this metric. + oneof result { + // Numerical stats result + NumericalStatsResult numerical_stats_result = 3; + + // Categorical stats result + CategoricalStatsResult categorical_stats_result = 4; + + // K-anonymity result + KAnonymityResult k_anonymity_result = 5; + + // L-divesity result + LDiversityResult l_diversity_result = 6; + + // K-map result + KMapEstimationResult k_map_estimation_result = 7; + + // Delta-presence result + DeltaPresenceEstimationResult delta_presence_estimation_result = 9; + } + + // The configuration used for this job. + RequestedRiskAnalysisOptions requested_options = 10; +} + +// A value of a field, including its frequency. +message ValueFrequency { + // A value contained in the field in question. + Value value = 1; + + // How many times the value is contained in the field. + int64 count = 2; +} + +// Set of primitive values supported by the system. +// Note that for the purposes of inspection or transformation, the number +// of bytes considered to comprise a 'Value' is based on its representation +// as a UTF-8 encoded string. For example, if 'integer_value' is set to +// 123456789, the number of bytes would be counted as 9, even though an +// int64 only holds up to 8 bytes of data. +message Value { + // Value types + oneof type { + // integer + int64 integer_value = 1; + + // float + double float_value = 2; + + // string + string string_value = 3; + + // boolean + bool boolean_value = 4; + + // timestamp + google.protobuf.Timestamp timestamp_value = 5; + + // time of day + google.type.TimeOfDay time_value = 6; + + // date + google.type.Date date_value = 7; + + // day of week + google.type.DayOfWeek day_of_week_value = 8; + } +} + +// Message for infoType-dependent details parsed from quote. +message QuoteInfo { + // Object representation of the quote. + oneof parsed_quote { + // The date time indicated by the quote. + DateTime date_time = 2; + } +} + +// Message for a date time object. +// e.g. 2018-01-01, 5th August. +message DateTime { + // Time zone of the date time object. + message TimeZone { + // Set only if the offset can be determined. Positive for time ahead of UTC. + // E.g. For "UTC-9", this value is -540. + int32 offset_minutes = 1; + } + + // One or more of the following must be set. + // Must be a valid date or time value. + google.type.Date date = 1; + + // Day of week + google.type.DayOfWeek day_of_week = 2; + + // Time of day + google.type.TimeOfDay time = 3; + + // Time zone + TimeZone time_zone = 4; +} + +// The configuration that controls how the data will change. +message DeidentifyConfig { + oneof transformation { + // Treat the dataset as free-form text and apply the same free text + // transformation everywhere. + InfoTypeTransformations info_type_transformations = 1; + + // Treat the dataset as structured. Transformations can be applied to + // specific locations within structured datasets, such as transforming + // a column within a table. + RecordTransformations record_transformations = 2; + + // Treat the dataset as an image and redact. + ImageTransformations image_transformations = 4; + } + + // Mode for handling transformation errors. If left unspecified, the default + // mode is `TransformationErrorHandling.ThrowError`. + TransformationErrorHandling transformation_error_handling = 3; +} + +// A type of transformation that is applied over images. +message ImageTransformations { + // Configuration for determining how redaction of images should occur. + message ImageTransformation { + // Apply transformation to the selected info_types. + message SelectedInfoTypes { + // Required. InfoTypes to apply the transformation to. Required. Provided InfoType + // must be unique within the ImageTransformations message. + repeated InfoType info_types = 5 [(google.api.field_behavior) = REQUIRED]; + } + + // Apply transformation to all findings. + message AllInfoTypes { + + } + + // Apply to all text. + message AllText { + + } + + oneof target { + // Apply transformation to the selected info_types. + SelectedInfoTypes selected_info_types = 4; + + // Apply transformation to all findings not specified in other + // ImageTransformation's selected_info_types. Only one instance is allowed + // within the ImageTransformations message. + AllInfoTypes all_info_types = 5; + + // Apply transformation to all text that doesn't match an infoType. Only + // one instance is allowed within the ImageTransformations message. + AllText all_text = 6; + } + + // The color to use when redacting content from an image. If not + // specified, the default is black. + Color redaction_color = 3; + } + + repeated ImageTransformation transforms = 2; +} + +// How to handle transformation errors during de-identification. A +// transformation error occurs when the requested transformation is incompatible +// with the data. For example, trying to de-identify an IP address using a +// `DateShift` transformation would result in a transformation error, since date +// info cannot be extracted from an IP address. +// Information about any incompatible transformations, and how they were +// handled, is returned in the response as part of the +// `TransformationOverviews`. +message TransformationErrorHandling { + // Throw an error and fail the request when a transformation error occurs. + message ThrowError { + + } + + // Skips the data without modifying it if the requested transformation would + // cause an error. For example, if a `DateShift` transformation were applied + // an an IP address, this mode would leave the IP address unchanged in the + // response. + message LeaveUntransformed { + + } + + // How transformation errors should be handled. + oneof mode { + // Throw an error + ThrowError throw_error = 1; + + // Ignore errors + LeaveUntransformed leave_untransformed = 2; + } +} + +// A rule for transforming a value. +message PrimitiveTransformation { + oneof transformation { + // Replace with a specified value. + ReplaceValueConfig replace_config = 1; + + // Redact + RedactConfig redact_config = 2; + + // Mask + CharacterMaskConfig character_mask_config = 3; + + // Ffx-Fpe + CryptoReplaceFfxFpeConfig crypto_replace_ffx_fpe_config = 4; + + // Fixed size bucketing + FixedSizeBucketingConfig fixed_size_bucketing_config = 5; + + // Bucketing + BucketingConfig bucketing_config = 6; + + // Replace with infotype + ReplaceWithInfoTypeConfig replace_with_info_type_config = 7; + + // Time extraction + TimePartConfig time_part_config = 8; + + // Crypto + CryptoHashConfig crypto_hash_config = 9; + + // Date Shift + DateShiftConfig date_shift_config = 11; + + // Deterministic Crypto + CryptoDeterministicConfig crypto_deterministic_config = 12; + + // Replace with a value randomly drawn (with replacement) from a dictionary. + ReplaceDictionaryConfig replace_dictionary_config = 13; + } +} + +// For use with `Date`, `Timestamp`, and `TimeOfDay`, extract or preserve a +// portion of the value. +message TimePartConfig { + // Components that make up time. + enum TimePart { + // Unused + TIME_PART_UNSPECIFIED = 0; + + // [0-9999] + YEAR = 1; + + // [1-12] + MONTH = 2; + + // [1-31] + DAY_OF_MONTH = 3; + + // [1-7] + DAY_OF_WEEK = 4; + + // [1-53] + WEEK_OF_YEAR = 5; + + // [0-23] + HOUR_OF_DAY = 6; + } + + // The part of the time to keep. + TimePart part_to_extract = 1; +} + +// Pseudonymization method that generates surrogates via cryptographic hashing. +// Uses SHA-256. +// The key size must be either 32 or 64 bytes. +// Outputs a base64 encoded representation of the hashed output +// (for example, L7k0BHmF1ha5U3NfGykjro4xWi1MPVQPjhMAZbSV9mM=). +// Currently, only string and integer values can be hashed. +// See https://cloud.google.com/dlp/docs/pseudonymization to learn more. +message CryptoHashConfig { + // The key used by the hash function. + CryptoKey crypto_key = 1; +} + +// Pseudonymization method that generates deterministic encryption for the given +// input. Outputs a base64 encoded representation of the encrypted output. +// Uses AES-SIV based on the RFC https://tools.ietf.org/html/rfc5297. +message CryptoDeterministicConfig { + // The key used by the encryption function. For deterministic encryption + // using AES-SIV, the provided key is internally expanded to 64 bytes prior to + // use. + CryptoKey crypto_key = 1; + + // The custom info type to annotate the surrogate with. + // This annotation will be applied to the surrogate by prefixing it with + // the name of the custom info type followed by the number of + // characters comprising the surrogate. The following scheme defines the + // format: {info type name}({surrogate character count}):{surrogate} + // + // For example, if the name of custom info type is 'MY_TOKEN_INFO_TYPE' and + // the surrogate is 'abc', the full replacement value + // will be: 'MY_TOKEN_INFO_TYPE(3):abc' + // + // This annotation identifies the surrogate when inspecting content using the + // custom info type 'Surrogate'. This facilitates reversal of the + // surrogate when it occurs in free text. + // + // Note: For record transformations where the entire cell in a table is being + // transformed, surrogates are not mandatory. Surrogates are used to denote + // the location of the token and are necessary for re-identification in free + // form text. + // + // In order for inspection to work properly, the name of this info type must + // not occur naturally anywhere in your data; otherwise, inspection may either + // + // - reverse a surrogate that does not correspond to an actual identifier + // - be unable to parse the surrogate and result in an error + // + // Therefore, choose your custom info type name carefully after considering + // what your data looks like. One way to select a name that has a high chance + // of yielding reliable detection is to include one or more unicode characters + // that are highly improbable to exist in your data. + // For example, assuming your data is entered from a regular ASCII keyboard, + // the symbol with the hex code point 29DD might be used like so: + // ⧝MY_TOKEN_TYPE. + InfoType surrogate_info_type = 2; + + // A context may be used for higher security and maintaining + // referential integrity such that the same identifier in two different + // contexts will be given a distinct surrogate. The context is appended to + // plaintext value being encrypted. On decryption the provided context is + // validated against the value used during encryption. If a context was + // provided during encryption, same context must be provided during decryption + // as well. + // + // If the context is not set, plaintext would be used as is for encryption. + // If the context is set but: + // + // 1. there is no record present when transforming a given value or + // 2. the field is not present when transforming a given value, + // + // plaintext would be used as is for encryption. + // + // Note that case (1) is expected when an `InfoTypeTransformation` is + // applied to both structured and unstructured `ContentItem`s. + FieldId context = 3; +} + +// Replace each input value with a given `Value`. +message ReplaceValueConfig { + // Value to replace it with. + Value new_value = 1; +} + +// Replace each input value with a value randomly selected from the dictionary. +message ReplaceDictionaryConfig { + oneof type { + // A list of words to select from for random replacement. The + // [limits](https://cloud.google.com/dlp/limits) page contains details about + // the size limits of dictionaries. + CustomInfoType.Dictionary.WordList word_list = 1; + } +} + +// Replace each matching finding with the name of the info_type. +message ReplaceWithInfoTypeConfig { + +} + +// Redact a given value. For example, if used with an `InfoTypeTransformation` +// transforming PHONE_NUMBER, and input 'My phone number is 206-555-0123', the +// output would be 'My phone number is '. +message RedactConfig { + +} + +// Characters to skip when doing deidentification of a value. These will be left +// alone and skipped. +message CharsToIgnore { + // Convenience enum for indicating common characters to not transform. + enum CommonCharsToIgnore { + // Unused. + COMMON_CHARS_TO_IGNORE_UNSPECIFIED = 0; + + // 0-9 + NUMERIC = 1; + + // A-Z + ALPHA_UPPER_CASE = 2; + + // a-z + ALPHA_LOWER_CASE = 3; + + // US Punctuation, one of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ + PUNCTUATION = 4; + + // Whitespace character, one of [ \t\n\x0B\f\r] + WHITESPACE = 5; + } + + oneof characters { + // Characters to not transform when masking. + string characters_to_skip = 1; + + // Common characters to not transform when masking. Useful to avoid removing + // punctuation. + CommonCharsToIgnore common_characters_to_ignore = 2; + } +} + +// Partially mask a string by replacing a given number of characters with a +// fixed character. Masking can start from the beginning or end of the string. +// This can be used on data of any type (numbers, longs, and so on) and when +// de-identifying structured data we'll attempt to preserve the original data's +// type. (This allows you to take a long like 123 and modify it to a string like +// **3. +message CharacterMaskConfig { + // Character to use to mask the sensitive values—for example, `*` for an + // alphabetic string such as a name, or `0` for a numeric string such as ZIP + // code or credit card number. This string must have a length of 1. If not + // supplied, this value defaults to `*` for strings, and `0` for digits. + string masking_character = 1; + + // Number of characters to mask. If not set, all matching chars will be + // masked. Skipped characters do not count towards this tally. + // + // If `number_to_mask` is negative, this denotes inverse masking. Cloud DLP + // masks all but a number of characters. + // For example, suppose you have the following values: + // + // - `masking_character` is `*` + // - `number_to_mask` is `-4` + // - `reverse_order` is `false` + // - `CharsToIgnore` includes `-` + // - Input string is `1234-5678-9012-3456` + // + // The resulting de-identified string is + // `****-****-****-3456`. Cloud DLP masks all but the last four characters. + // If `reverse_order` is `true`, all but the first four characters are masked + // as `1234-****-****-****`. + int32 number_to_mask = 2; + + // Mask characters in reverse order. For example, if `masking_character` is + // `0`, `number_to_mask` is `14`, and `reverse_order` is `false`, then the + // input string `1234-5678-9012-3456` is masked as `00000000000000-3456`. + // If `masking_character` is `*`, `number_to_mask` is `3`, and `reverse_order` + // is `true`, then the string `12345` is masked as `12***`. + bool reverse_order = 3; + + // When masking a string, items in this list will be skipped when replacing + // characters. For example, if the input string is `555-555-5555` and you + // instruct Cloud DLP to skip `-` and mask 5 characters with `*`, Cloud DLP + // returns `***-**5-5555`. + repeated CharsToIgnore characters_to_ignore = 4; +} + +// Buckets values based on fixed size ranges. The +// Bucketing transformation can provide all of this functionality, +// but requires more configuration. This message is provided as a convenience to +// the user for simple bucketing strategies. +// +// The transformed value will be a hyphenated string of +// {lower_bound}-{upper_bound}. For example, if lower_bound = 10 and upper_bound +// = 20, all values that are within this bucket will be replaced with "10-20". +// +// This can be used on data of type: double, long. +// +// If the bound Value type differs from the type of data +// being transformed, we will first attempt converting the type of the data to +// be transformed to match the type of the bound before comparing. +// +// See https://cloud.google.com/dlp/docs/concepts-bucketing to learn more. +message FixedSizeBucketingConfig { + // Required. Lower bound value of buckets. All values less than `lower_bound` are + // grouped together into a single bucket; for example if `lower_bound` = 10, + // then all values less than 10 are replaced with the value "-10". + Value lower_bound = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Upper bound value of buckets. All values greater than upper_bound are + // grouped together into a single bucket; for example if `upper_bound` = 89, + // then all values greater than 89 are replaced with the value "89+". + Value upper_bound = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Size of each bucket (except for minimum and maximum buckets). So if + // `lower_bound` = 10, `upper_bound` = 89, and `bucket_size` = 10, then the + // following buckets would be used: -10, 10-20, 20-30, 30-40, 40-50, 50-60, + // 60-70, 70-80, 80-89, 89+. Precision up to 2 decimals works. + double bucket_size = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Generalization function that buckets values based on ranges. The ranges and +// replacement values are dynamically provided by the user for custom behavior, +// such as 1-30 -> LOW 31-65 -> MEDIUM 66-100 -> HIGH +// This can be used on +// data of type: number, long, string, timestamp. +// If the bound `Value` type differs from the type of data being transformed, we +// will first attempt converting the type of the data to be transformed to match +// the type of the bound before comparing. +// See https://cloud.google.com/dlp/docs/concepts-bucketing to learn more. +message BucketingConfig { + // Bucket is represented as a range, along with replacement values. + message Bucket { + // Lower bound of the range, inclusive. Type should be the same as max if + // used. + Value min = 1; + + // Upper bound of the range, exclusive; type must match min. + Value max = 2; + + // Required. Replacement value for this bucket. + Value replacement_value = 3 [(google.api.field_behavior) = REQUIRED]; + } + + // Set of buckets. Ranges must be non-overlapping. + repeated Bucket buckets = 1; +} + +// Replaces an identifier with a surrogate using Format Preserving Encryption +// (FPE) with the FFX mode of operation; however when used in the +// `ReidentifyContent` API method, it serves the opposite function by reversing +// the surrogate back into the original identifier. The identifier must be +// encoded as ASCII. For a given crypto key and context, the same identifier +// will be replaced with the same surrogate. Identifiers must be at least two +// characters long. In the case that the identifier is the empty string, it will +// be skipped. See https://cloud.google.com/dlp/docs/pseudonymization to learn +// more. +// +// Note: We recommend using CryptoDeterministicConfig for all use cases which +// do not require preserving the input alphabet space and size, plus warrant +// referential integrity. +message CryptoReplaceFfxFpeConfig { + // These are commonly used subsets of the alphabet that the FFX mode + // natively supports. In the algorithm, the alphabet is selected using + // the "radix". Therefore each corresponds to a particular radix. + enum FfxCommonNativeAlphabet { + // Unused. + FFX_COMMON_NATIVE_ALPHABET_UNSPECIFIED = 0; + + // `[0-9]` (radix of 10) + NUMERIC = 1; + + // `[0-9A-F]` (radix of 16) + HEXADECIMAL = 2; + + // `[0-9A-Z]` (radix of 36) + UPPER_CASE_ALPHA_NUMERIC = 3; + + // `[0-9A-Za-z]` (radix of 62) + ALPHA_NUMERIC = 4; + } + + // Required. The key used by the encryption algorithm. + CryptoKey crypto_key = 1 [(google.api.field_behavior) = REQUIRED]; + + // The 'tweak', a context may be used for higher security since the same + // identifier in two different contexts won't be given the same surrogate. If + // the context is not set, a default tweak will be used. + // + // If the context is set but: + // + // 1. there is no record present when transforming a given value or + // 1. the field is not present when transforming a given value, + // + // a default tweak will be used. + // + // Note that case (1) is expected when an `InfoTypeTransformation` is + // applied to both structured and unstructured `ContentItem`s. + // Currently, the referenced field may be of value type integer or string. + // + // The tweak is constructed as a sequence of bytes in big endian byte order + // such that: + // + // - a 64 bit integer is encoded followed by a single byte of value 1 + // - a string is encoded in UTF-8 format followed by a single byte of value 2 + FieldId context = 2; + + // Choose an alphabet which the data being transformed will be made up of. + oneof alphabet { + // Common alphabets. + FfxCommonNativeAlphabet common_alphabet = 4; + + // This is supported by mapping these to the alphanumeric characters + // that the FFX mode natively supports. This happens before/after + // encryption/decryption. + // Each character listed must appear only once. + // Number of characters must be in the range [2, 95]. + // This must be encoded as ASCII. + // The order of characters does not matter. + // The full list of allowed characters is: + // 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz + // ~`!@#$%^&*()_-+={[}]|\:;"'<,>.?/ + string custom_alphabet = 5; + + // The native way to select the alphabet. Must be in the range [2, 95]. + int32 radix = 6; + } + + // The custom infoType to annotate the surrogate with. + // This annotation will be applied to the surrogate by prefixing it with + // the name of the custom infoType followed by the number of + // characters comprising the surrogate. The following scheme defines the + // format: info_type_name(surrogate_character_count):surrogate + // + // For example, if the name of custom infoType is 'MY_TOKEN_INFO_TYPE' and + // the surrogate is 'abc', the full replacement value + // will be: 'MY_TOKEN_INFO_TYPE(3):abc' + // + // This annotation identifies the surrogate when inspecting content using the + // custom infoType + // [`SurrogateType`](https://cloud.google.com/dlp/docs/reference/rest/v2/InspectConfig#surrogatetype). + // This facilitates reversal of the surrogate when it occurs in free text. + // + // In order for inspection to work properly, the name of this infoType must + // not occur naturally anywhere in your data; otherwise, inspection may + // find a surrogate that does not correspond to an actual identifier. + // Therefore, choose your custom infoType name carefully after considering + // what your data looks like. One way to select a name that has a high chance + // of yielding reliable detection is to include one or more unicode characters + // that are highly improbable to exist in your data. + // For example, assuming your data is entered from a regular ASCII keyboard, + // the symbol with the hex code point 29DD might be used like so: + // ⧝MY_TOKEN_TYPE + InfoType surrogate_info_type = 8; +} + +// This is a data encryption key (DEK) (as opposed to +// a key encryption key (KEK) stored by Cloud Key Management Service +// (Cloud KMS). +// When using Cloud KMS to wrap or unwrap a DEK, be sure to set an appropriate +// IAM policy on the KEK to ensure an attacker cannot +// unwrap the DEK. +message CryptoKey { + // Sources of crypto keys. + oneof source { + // Transient crypto key + TransientCryptoKey transient = 1; + + // Unwrapped crypto key + UnwrappedCryptoKey unwrapped = 2; + + // Key wrapped using Cloud KMS + KmsWrappedCryptoKey kms_wrapped = 3; + } +} + +// Use this to have a random data crypto key generated. +// It will be discarded after the request finishes. +message TransientCryptoKey { + // Required. Name of the key. + // This is an arbitrary string used to differentiate different keys. + // A unique key is generated per name: two separate `TransientCryptoKey` + // protos share the same generated key if their names are the same. + // When the data crypto key is generated, this name is not used in any way + // (repeating the api call will result in a different key being generated). + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Using raw keys is prone to security risks due to accidentally +// leaking the key. Choose another type of key if possible. +message UnwrappedCryptoKey { + // Required. A 128/192/256 bit key. + bytes key = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Include to use an existing data crypto key wrapped by KMS. +// The wrapped key must be a 128-, 192-, or 256-bit key. +// Authorization requires the following IAM permissions when sending a request +// to perform a crypto transformation using a KMS-wrapped crypto key: +// dlp.kms.encrypt +// +// For more information, see [Creating a wrapped key] +// (https://cloud.google.com/dlp/docs/create-wrapped-key). +// +// Note: When you use Cloud KMS for cryptographic operations, +// [charges apply](https://cloud.google.com/kms/pricing). +message KmsWrappedCryptoKey { + // Required. The wrapped data crypto key. + bytes wrapped_key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The resource name of the KMS CryptoKey to use for unwrapping. + string crypto_key_name = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Shifts dates by random number of days, with option to be consistent for the +// same context. See https://cloud.google.com/dlp/docs/concepts-date-shifting +// to learn more. +message DateShiftConfig { + // Required. Range of shift in days. Actual shift will be selected at random within this + // range (inclusive ends). Negative means shift to earlier in time. Must not + // be more than 365250 days (1000 years) each direction. + // + // For example, 3 means shift date to at most 3 days into the future. + int32 upper_bound_days = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. For example, -5 means shift date to at most 5 days back in the past. + int32 lower_bound_days = 2 [(google.api.field_behavior) = REQUIRED]; + + // Points to the field that contains the context, for example, an entity id. + // If set, must also set cryptoKey. If set, shift will be consistent for the + // given context. + FieldId context = 3; + + // Method for calculating shift that takes context into consideration. If + // set, must also set context. Can only be applied to table items. + oneof method { + // Causes the shift to be computed based on this key and the context. This + // results in the same shift for the same context and crypto_key. If + // set, must also set context. Can only be applied to table items. + CryptoKey crypto_key = 4; + } +} + +// A type of transformation that will scan unstructured text and +// apply various `PrimitiveTransformation`s to each finding, where the +// transformation is applied to only values that were identified as a specific +// info_type. +message InfoTypeTransformations { + // A transformation to apply to text that is identified as a specific + // info_type. + message InfoTypeTransformation { + // InfoTypes to apply the transformation to. An empty list will cause + // this transformation to apply to all findings that correspond to + // infoTypes that were requested in `InspectConfig`. + repeated InfoType info_types = 1; + + // Required. Primitive transformation to apply to the infoType. + PrimitiveTransformation primitive_transformation = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. Transformation for each infoType. Cannot specify more than one + // for a given infoType. + repeated InfoTypeTransformation transformations = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The transformation to apply to the field. +message FieldTransformation { + // Required. Input field(s) to apply the transformation to. + // When you have columns that reference their position within a list, + // omit the index from the FieldId. FieldId name matching ignores the index. + // For example, instead of "contact.nums[0].type", use "contact.nums.type". + repeated FieldId fields = 1 [(google.api.field_behavior) = REQUIRED]; + + // Only apply the transformation if the condition evaluates to true for the + // given `RecordCondition`. The conditions are allowed to reference fields + // that are not used in the actual transformation. + // + // Example Use Cases: + // + // - Apply a different bucket transformation to an age column if the zip code + // column for the same record is within a specific range. + // - Redact a field if the date of birth field is greater than 85. + RecordCondition condition = 3; + + // Transformation to apply. [required] + oneof transformation { + // Apply the transformation to the entire field. + PrimitiveTransformation primitive_transformation = 4; + + // Treat the contents of the field as free text, and selectively + // transform content that matches an `InfoType`. + InfoTypeTransformations info_type_transformations = 5; + } +} + +// A type of transformation that is applied over structured data such as a +// table. +message RecordTransformations { + // Transform the record by applying various field transformations. + repeated FieldTransformation field_transformations = 1; + + // Configuration defining which records get suppressed entirely. Records that + // match any suppression rule are omitted from the output. + repeated RecordSuppression record_suppressions = 2; +} + +// Configuration to suppress records whose suppression conditions evaluate to +// true. +message RecordSuppression { + // A condition that when it evaluates to true will result in the record being + // evaluated to be suppressed from the transformed content. + RecordCondition condition = 1; +} + +// A condition for determining whether a transformation should be applied to +// a field. +message RecordCondition { + // The field type of `value` and `field` do not need to match to be + // considered equal, but not all comparisons are possible. + // EQUAL_TO and NOT_EQUAL_TO attempt to compare even with incompatible types, + // but all other comparisons are invalid with incompatible types. + // A `value` of type: + // + // - `string` can be compared against all other types + // - `boolean` can only be compared against other booleans + // - `integer` can be compared against doubles or a string if the string value + // can be parsed as an integer. + // - `double` can be compared against integers or a string if the string can + // be parsed as a double. + // - `Timestamp` can be compared against strings in RFC 3339 date string + // format. + // - `TimeOfDay` can be compared against timestamps and strings in the format + // of 'HH:mm:ss'. + // + // If we fail to compare do to type mismatch, a warning will be given and + // the condition will evaluate to false. + message Condition { + // Required. Field within the record this condition is evaluated against. + FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Operator used to compare the field or infoType to the value. + RelationalOperator operator = 3 [(google.api.field_behavior) = REQUIRED]; + + // Value to compare against. [Mandatory, except for `EXISTS` tests.] + Value value = 4; + } + + // A collection of conditions. + message Conditions { + // A collection of conditions. + repeated Condition conditions = 1; + } + + // An expression, consisting of an operator and conditions. + message Expressions { + // Logical operators for conditional checks. + enum LogicalOperator { + // Unused + LOGICAL_OPERATOR_UNSPECIFIED = 0; + + // Conditional AND + AND = 1; + } + + // The operator to apply to the result of conditions. Default and currently + // only supported value is `AND`. + LogicalOperator logical_operator = 1; + + // Expression types. + oneof type { + // Conditions to apply to the expression. + Conditions conditions = 3; + } + } + + // An expression. + Expressions expressions = 3; +} + +// Overview of the modifications that occurred. +message TransformationOverview { + // Total size in bytes that were transformed in some way. + int64 transformed_bytes = 2; + + // Transformations applied to the dataset. + repeated TransformationSummary transformation_summaries = 3; +} + +// Summary of a single transformation. +// Only one of 'transformation', 'field_transformation', or 'record_suppress' +// will be set. +message TransformationSummary { + // Possible outcomes of transformations. + enum TransformationResultCode { + // Unused + TRANSFORMATION_RESULT_CODE_UNSPECIFIED = 0; + + // Transformation completed without an error. + SUCCESS = 1; + + // Transformation had an error. + ERROR = 2; + } + + // A collection that informs the user the number of times a particular + // `TransformationResultCode` and error details occurred. + message SummaryResult { + // Number of transformations counted by this result. + int64 count = 1; + + // Outcome of the transformation. + TransformationResultCode code = 2; + + // A place for warnings or errors to show up if a transformation didn't + // work as expected. + string details = 3; + } + + // Set if the transformation was limited to a specific InfoType. + InfoType info_type = 1; + + // Set if the transformation was limited to a specific FieldId. + FieldId field = 2; + + // The specific transformation these stats apply to. + PrimitiveTransformation transformation = 3; + + // The field transformation that was applied. + // If multiple field transformations are requested for a single field, + // this list will contain all of them; otherwise, only one is supplied. + repeated FieldTransformation field_transformations = 5; + + // The specific suppression option these stats apply to. + RecordSuppression record_suppress = 6; + + // Collection of all transformations that took place or had an error. + repeated SummaryResult results = 4; + + // Total size in bytes that were transformed in some way. + int64 transformed_bytes = 7; +} + +// A flattened description of a `PrimitiveTransformation` or +// `RecordSuppression`. +message TransformationDescription { + // The transformation type. + TransformationType type = 1; + + // A description of the transformation. This is empty for a + // RECORD_SUPPRESSION, or is the output of calling toString() on the + // `PrimitiveTransformation` protocol buffer message for any other type of + // transformation. + string description = 2; + + // A human-readable string representation of the `RecordCondition` + // corresponding to this transformation. Set if a `RecordCondition` was used + // to determine whether or not to apply this transformation. + // + // Examples: + // * (age_field > 85) + // * (age_field <= 18) + // * (zip_field exists) + // * (zip_field == 01234) && (city_field != "Springville") + // * (zip_field == 01234) && (age_field <= 18) && (city_field exists) + string condition = 3; + + // Set if the transformation was limited to a specific `InfoType`. + InfoType info_type = 4; +} + +// Details about a single transformation. This object contains a description of +// the transformation, information about whether the transformation was +// successfully applied, and the precise location where the transformation +// occurred. These details are stored in a user-specified BigQuery table. +message TransformationDetails { + // The name of the job that completed the transformation. + string resource_name = 1; + + // The top level name of the container where the transformation is located + // (this will be the source file name or table name). + string container_name = 2; + + // Description of transformation. This would only contain more than one + // element if there were multiple matching transformations and which one to + // apply was ambiguous. Not set for states that contain no transformation, + // currently only state that contains no transformation is + // TransformationResultStateType.METADATA_UNRETRIEVABLE. + repeated TransformationDescription transformation = 3; + + // Status of the transformation, if transformation was not successful, this + // will specify what caused it to fail, otherwise it will show that the + // transformation was successful. + TransformationResultStatus status_details = 4; + + // The number of bytes that were transformed. If transformation was + // unsuccessful or did not take place because there was no content to + // transform, this will be zero. + int64 transformed_bytes = 5; + + // The precise location of the transformed content in the original container. + TransformationLocation transformation_location = 6; +} + +// Specifies the location of a transformation. +message TransformationLocation { + oneof location_type { + // For infotype transformations, link to the corresponding findings ID so + // that location information does not need to be duplicated. Each findings + // ID correlates to an entry in the findings output table, this table only + // gets created when users specify to save findings (add the save findings + // action to the request). + string finding_id = 1; + + // For record transformations, provide a field and container information. + RecordTransformation record_transformation = 2; + } + + // Information about the functionality of the container where this finding + // occurred, if available. + TransformationContainerType container_type = 3; +} + +message RecordTransformation { + // For record transformations, provide a field. + FieldId field_id = 1; + + // Findings container modification timestamp, if applicable. + google.protobuf.Timestamp container_timestamp = 2; + + // Container version, if available ("generation" for Cloud Storage). + string container_version = 3; +} + +message TransformationResultStatus { + // Transformation result status type, this will be either SUCCESS, or it will + // be the reason for why the transformation was not completely successful. + TransformationResultStatusType result_status_type = 1; + + // Detailed error codes and messages + google.rpc.Status details = 2; +} + +// Enum of possible outcomes of transformations. SUCCESS if transformation and +// storing of transformation was successful, otherwise, reason for not +// transforming. +enum TransformationResultStatusType { + STATE_TYPE_UNSPECIFIED = 0; + + // This will be set when a finding could not be transformed (i.e. outside user + // set bucket range). + INVALID_TRANSFORM = 1; + + // This will be set when a BigQuery transformation was successful but could + // not be stored back in BigQuery because the transformed row exceeds + // BigQuery's max row size. + BIGQUERY_MAX_ROW_SIZE_EXCEEDED = 2; + + // This will be set when there is a finding in the custom metadata of a file, + // but at the write time of the transformed file, this key / value pair is + // unretrievable. + METADATA_UNRETRIEVABLE = 3; + + // This will be set when the transformation and storing of it is successful. + SUCCESS = 4; +} + +// Describes functionality of a given container in its original format. +enum TransformationContainerType { + TRANSFORM_UNKNOWN_CONTAINER = 0; + + TRANSFORM_BODY = 1; + + TRANSFORM_METADATA = 2; + + TRANSFORM_TABLE = 3; +} + +// An enum of rules that can be used to transform a value. Can be a +// record suppression, or one of the transformation rules specified under +// `PrimitiveTransformation`. +enum TransformationType { + // Unused + TRANSFORMATION_TYPE_UNSPECIFIED = 0; + + // Record suppression + RECORD_SUPPRESSION = 1; + + // Replace value + REPLACE_VALUE = 2; + + // Replace value using a dictionary. + REPLACE_DICTIONARY = 15; + + // Redact + REDACT = 3; + + // Character mask + CHARACTER_MASK = 4; + + // FFX-FPE + CRYPTO_REPLACE_FFX_FPE = 5; + + // Fixed size bucketing + FIXED_SIZE_BUCKETING = 6; + + // Bucketing + BUCKETING = 7; + + // Replace with info type + REPLACE_WITH_INFO_TYPE = 8; + + // Time part + TIME_PART = 9; + + // Crypto hash + CRYPTO_HASH = 10; + + // Date shift + DATE_SHIFT = 12; + + // Deterministic crypto + CRYPTO_DETERMINISTIC_CONFIG = 13; + + // Redact image + REDACT_IMAGE = 14; +} + +// Config for storing transformation details. +message TransformationDetailsStorageConfig { + // Location to store the transformation summary. + oneof type { + // The BigQuery table in which to store the output. This may be an existing + // table or in a new table in an existing dataset. + // If table_id is not set a new one will be generated for you with the + // following format: + // dlp_googleapis_transformation_details_yyyy_mm_dd_[dlp_job_id]. Pacific + // time zone will be used for generating the date details. + BigQueryTable table = 1; + } +} + +// Schedule for inspect job triggers. +message Schedule { + oneof option { + // With this option a job is started on a regular periodic basis. For + // example: every day (86400 seconds). + // + // A scheduled start time will be skipped if the previous + // execution has not ended when its scheduled time occurs. + // + // This value must be set to a time duration greater than or equal + // to 1 day and can be no longer than 60 days. + google.protobuf.Duration recurrence_period_duration = 1; + } +} + +// Job trigger option for hybrid jobs. Jobs must be manually created +// and finished. +message Manual { + +} + +// The inspectTemplate contains a configuration (set of types of sensitive data +// to be detected) to be used anywhere you otherwise would normally specify +// InspectConfig. See https://cloud.google.com/dlp/docs/concepts-templates +// to learn more. +message InspectTemplate { + option (google.api.resource) = { + type: "dlp.googleapis.com/InspectTemplate" + pattern: "organizations/{organization}/inspectTemplates/{inspect_template}" + pattern: "projects/{project}/inspectTemplates/{inspect_template}" + pattern: "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}" + pattern: "projects/{project}/locations/{location}/inspectTemplates/{inspect_template}" + }; + + // Output only. The template name. + // + // The template will have one of the following formats: + // `projects/PROJECT_ID/inspectTemplates/TEMPLATE_ID` OR + // `organizations/ORGANIZATION_ID/inspectTemplates/TEMPLATE_ID`; + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Display name (max 256 chars). + string display_name = 2; + + // Short description (max 256 chars). + string description = 3; + + // Output only. The creation timestamp of an inspectTemplate. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of an inspectTemplate. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The core content of the template. Configuration of the scanning process. + InspectConfig inspect_config = 6; +} + +// DeidentifyTemplates contains instructions on how to de-identify content. +// See https://cloud.google.com/dlp/docs/concepts-templates to learn more. +message DeidentifyTemplate { + option (google.api.resource) = { + type: "dlp.googleapis.com/DeidentifyTemplate" + pattern: "organizations/{organization}/deidentifyTemplates/{deidentify_template}" + pattern: "projects/{project}/deidentifyTemplates/{deidentify_template}" + pattern: "organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}" + pattern: "projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}" + }; + + // Output only. The template name. + // + // The template will have one of the following formats: + // `projects/PROJECT_ID/deidentifyTemplates/TEMPLATE_ID` OR + // `organizations/ORGANIZATION_ID/deidentifyTemplates/TEMPLATE_ID` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Display name (max 256 chars). + string display_name = 2; + + // Short description (max 256 chars). + string description = 3; + + // Output only. The creation timestamp of an inspectTemplate. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of an inspectTemplate. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The core content of the template. + DeidentifyConfig deidentify_config = 6; +} + +// Details information about an error encountered during job execution or +// the results of an unsuccessful activation of the JobTrigger. +message Error { + // Detailed error codes and messages. + google.rpc.Status details = 1; + + // The times the error occurred. + repeated google.protobuf.Timestamp timestamps = 2; +} + +// Contains a configuration to make dlp api calls on a repeating basis. +// See https://cloud.google.com/dlp/docs/concepts-job-triggers to learn more. +message JobTrigger { + option (google.api.resource) = { + type: "dlp.googleapis.com/JobTrigger" + pattern: "projects/{project}/jobTriggers/{job_trigger}" + pattern: "projects/{project}/locations/{location}/jobTriggers/{job_trigger}" + }; + + // What event needs to occur for a new job to be started. + message Trigger { + oneof trigger { + // Create a job on a repeating basis based on the elapse of time. + Schedule schedule = 1; + + // For use with hybrid jobs. Jobs must be manually created and finished. + Manual manual = 2; + } + } + + // Whether the trigger is currently active. If PAUSED or CANCELLED, no jobs + // will be created with this configuration. The service may automatically + // pause triggers experiencing frequent errors. To restart a job, set the + // status to HEALTHY after correcting user errors. + enum Status { + // Unused. + STATUS_UNSPECIFIED = 0; + + // Trigger is healthy. + HEALTHY = 1; + + // Trigger is temporarily paused. + PAUSED = 2; + + // Trigger is cancelled and can not be resumed. + CANCELLED = 3; + } + + // Unique resource name for the triggeredJob, assigned by the service when the + // triggeredJob is created, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + string name = 1; + + // Display name (max 100 chars) + string display_name = 2; + + // User provided description (max 256 chars) + string description = 3; + + // The configuration details for the specific type of job to run. + oneof job { + // For inspect jobs, a snapshot of the configuration. + InspectJobConfig inspect_job = 4; + } + + // A list of triggers which will be OR'ed together. Only one in the list + // needs to trigger for a job to be started. The list may contain only + // a single Schedule trigger and must have at least one object. + repeated Trigger triggers = 5; + + // Output only. A stream of errors encountered when the trigger was activated. Repeated + // errors may result in the JobTrigger automatically being paused. + // Will return the last 100 errors. Whenever the JobTrigger is modified + // this list will be cleared. + repeated Error errors = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation timestamp of a triggeredJob. + google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of a triggeredJob. + google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp of the last time this trigger executed. + google.protobuf.Timestamp last_run_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. A status for this trigger. + Status status = 10 [(google.api.field_behavior) = REQUIRED]; +} + +// A task to execute on the completion of a job. +// See https://cloud.google.com/dlp/docs/concepts-actions to learn more. +message Action { + // If set, the detailed findings will be persisted to the specified + // OutputStorageConfig. Only a single instance of this action can be + // specified. + // Compatible with: Inspect, Risk + message SaveFindings { + // Location to store findings outside of DLP. + OutputStorageConfig output_config = 1; + } + + // Publish a message into a given Pub/Sub topic when DlpJob has completed. The + // message contains a single field, `DlpJobName`, which is equal to the + // finished job's + // [`DlpJob.name`](https://cloud.google.com/dlp/docs/reference/rest/v2/projects.dlpJobs#DlpJob). + // Compatible with: Inspect, Risk + message PublishToPubSub { + // Cloud Pub/Sub topic to send notifications to. The topic must have given + // publishing access rights to the DLP API service account executing + // the long running DlpJob sending the notifications. + // Format is projects/{project}/topics/{topic}. + string topic = 1; + } + + // Publish the result summary of a DlpJob to the Cloud Security + // Command Center (CSCC Alpha). + // This action is only available for projects which are parts of + // an organization and whitelisted for the alpha Cloud Security Command + // Center. + // The action will publish the count of finding instances and their info + // types. The summary of findings will be persisted in CSCC and are governed + // by CSCC service-specific policy, see + // https://cloud.google.com/terms/service-terms Only a single instance of this + // action can be specified. Compatible with: Inspect + message PublishSummaryToCscc { + + } + + // Publish findings of a DlpJob to Data Catalog. In Data Catalog, tag + // templates are applied to the resource that Cloud DLP scanned. Data + // Catalog tag templates are stored in the same project and region where the + // BigQuery table exists. For Cloud DLP to create and apply the tag template, + // the Cloud DLP service agent must have the + // `roles/datacatalog.tagTemplateOwner` permission on the project. The tag + // template contains fields summarizing the results of the DlpJob. Any field + // values previously written by another DlpJob are deleted. [InfoType naming + // patterns][google.privacy.dlp.v2.InfoType] are strictly enforced when using + // this feature. + // + // Findings are persisted in Data Catalog storage and are governed by + // service-specific policies for Data Catalog. For more information, see + // [Service Specific Terms](https://cloud.google.com/terms/service-terms). + // + // Only a single instance of this action can be specified. This action is + // allowed only if all resources being scanned are BigQuery tables. + // Compatible with: Inspect + message PublishFindingsToCloudDataCatalog { + + } + + // Create a de-identified copy of the requested table or files. + // + // A TransformationDetail will be created for each transformation. + // + // If any rows in BigQuery are skipped during de-identification + // (transformation errors or row size exceeds BigQuery insert API limits) they + // are placed in the failure output table. If the original row exceeds + // the BigQuery insert API limit it will be truncated when written to the + // failure output table. The failure output table can be set in the + // action.deidentify.output.big_query_output.deidentified_failure_output_table + // field, if no table is set, a table will be automatically created in the + // same project and dataset as the original table. + // + // Compatible with: Inspect + message Deidentify { + // User specified deidentify templates and configs for structured, + // unstructured, and image files. + TransformationConfig transformation_config = 7; + + // Config for storing transformation details. This is separate from the + // de-identified content, and contains metadata about the successful + // transformations and/or failures that occurred while de-identifying. This + // needs to be set in order for users to access information about the status + // of each transformation (see + // [TransformationDetails][google.privacy.dlp.v2.TransformationDetails] + // message for more information about what is noted). + TransformationDetailsStorageConfig transformation_details_storage_config = 3; + + oneof output { + // Required. User settable Cloud Storage bucket and folders to store de-identified + // files. This field must be set for cloud storage deidentification. The + // output Cloud Storage bucket must be different from the input bucket. + // De-identified files will overwrite files in the output path. + // + // Form of: gs://bucket/folder/ or gs://bucket + string cloud_storage_output = 9 [(google.api.field_behavior) = REQUIRED]; + } + + // List of user-specified file type groups to transform. If specified, only + // the files with these filetypes will be transformed. If empty, all + // supported files will be transformed. Supported types may be automatically + // added over time. If a file type is set in this field that isn't supported + // by the Deidentify action then the job will fail and will not be + // successfully created/started. Currently the only filetypes supported are: + // IMAGES, TEXT_FILES, CSV, TSV. + repeated FileType file_types_to_transform = 8; + } + + // Sends an email when the job completes. The email goes to IAM project owners + // and technical [Essential + // Contacts](https://cloud.google.com/resource-manager/docs/managing-notification-contacts). + message JobNotificationEmails { + + } + + // Enable Stackdriver metric dlp.googleapis.com/finding_count. This + // will publish a metric to stack driver on each infotype requested and + // how many findings were found for it. CustomDetectors will be bucketed + // as 'Custom' under the Stackdriver label 'info_type'. + message PublishToStackdriver { + + } + + oneof action { + // Save resulting findings in a provided location. + SaveFindings save_findings = 1; + + // Publish a notification to a Pub/Sub topic. + PublishToPubSub pub_sub = 2; + + // Publish summary to Cloud Security Command Center (Alpha). + PublishSummaryToCscc publish_summary_to_cscc = 3; + + // Publish findings to Cloud Datahub. + PublishFindingsToCloudDataCatalog publish_findings_to_cloud_data_catalog = 5; + + // Create a de-identified copy of the input data. + Deidentify deidentify = 7; + + // Sends an email when the job completes. The email goes to IAM project + // owners and technical [Essential + // Contacts](https://cloud.google.com/resource-manager/docs/managing-notification-contacts). + JobNotificationEmails job_notification_emails = 8; + + // Enable Stackdriver metric dlp.googleapis.com/finding_count. + PublishToStackdriver publish_to_stackdriver = 9; + } +} + +// User specified templates and configs for how to deidentify structured, +// unstructures, and image files. User must provide either a unstructured +// deidentify template or at least one redact image config. +message TransformationConfig { + // De-identify template. + // If this template is specified, it will serve as the default de-identify + // template. This template cannot contain `record_transformations` since it + // can be used for unstructured content such as free-form text files. If this + // template is not set, a default `ReplaceWithInfoTypeConfig` will be used to + // de-identify unstructured content. + string deidentify_template = 1; + + // Structured de-identify template. + // If this template is specified, it will serve as the de-identify template + // for structured content such as delimited files and tables. If this template + // is not set but the `deidentify_template` is set, then `deidentify_template` + // will also apply to the structured content. If neither template is set, a + // default `ReplaceWithInfoTypeConfig` will be used to de-identify structured + // content. + string structured_deidentify_template = 2; + + // Image redact template. + // If this template is specified, it will serve as the de-identify template + // for images. If this template is not set, all findings in the image will be + // redacted with a black box. + string image_redact_template = 4; +} + +// Request message for CreateInspectTemplate. +message CreateInspectTemplateRequest { + // Required. Parent resource name. + // + // The format of this value varies depending on the scope of the request + // (project or organization) and whether you have [specified a processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + Organizations scope, location specified:
+ // `organizations/`ORG_ID`/locations/`LOCATION_ID + // + Organizations scope, no location specified (defaults to global):
+ // `organizations/`ORG_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dlp.googleapis.com/InspectTemplate" + } + ]; + + // Required. The InspectTemplate to create. + InspectTemplate inspect_template = 2 [(google.api.field_behavior) = REQUIRED]; + + // The template id can contain uppercase and lowercase letters, + // numbers, and hyphens; that is, it must match the regular + // expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + // characters. Can be empty to allow the system to generate one. + string template_id = 3; + + // Deprecated. This field has no effect. + string location_id = 4; +} + +// Request message for UpdateInspectTemplate. +message UpdateInspectTemplateRequest { + // Required. Resource name of organization and inspectTemplate to be updated, for + // example `organizations/433245324/inspectTemplates/432452342` or + // projects/project-id/inspectTemplates/432452342. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/InspectTemplate" + } + ]; + + // New InspectTemplate value. + InspectTemplate inspect_template = 2; + + // Mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3; +} + +// Request message for GetInspectTemplate. +message GetInspectTemplateRequest { + // Required. Resource name of the organization and inspectTemplate to be read, for + // example `organizations/433245324/inspectTemplates/432452342` or + // projects/project-id/inspectTemplates/432452342. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/InspectTemplate" + } + ]; +} + +// Request message for ListInspectTemplates. +message ListInspectTemplatesRequest { + // Required. Parent resource name. + // + // The format of this value varies depending on the scope of the request + // (project or organization) and whether you have [specified a processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + Organizations scope, location specified:
+ // `organizations/`ORG_ID`/locations/`LOCATION_ID + // + Organizations scope, no location specified (defaults to global):
+ // `organizations/`ORG_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dlp.googleapis.com/InspectTemplate" + } + ]; + + // Page token to continue retrieval. Comes from previous call + // to `ListInspectTemplates`. + string page_token = 2; + + // Size of the page, can be limited by the server. If zero server returns + // a page of max size 100. + int32 page_size = 3; + + // Comma separated list of fields to order by, + // followed by `asc` or `desc` postfix. This list is case-insensitive, + // default sorting order is ascending, redundant space characters are + // insignificant. + // + // Example: `name asc,update_time, create_time desc` + // + // Supported fields are: + // + // - `create_time`: corresponds to the time the template was created. + // - `update_time`: corresponds to the time the template was last updated. + // - `name`: corresponds to the template's name. + // - `display_name`: corresponds to the template's display name. + string order_by = 4; + + // Deprecated. This field has no effect. + string location_id = 5; +} + +// Response message for ListInspectTemplates. +message ListInspectTemplatesResponse { + // List of inspectTemplates, up to page_size in ListInspectTemplatesRequest. + repeated InspectTemplate inspect_templates = 1; + + // If the next page is available then the next page token to be used + // in following ListInspectTemplates request. + string next_page_token = 2; +} + +// Request message for DeleteInspectTemplate. +message DeleteInspectTemplateRequest { + // Required. Resource name of the organization and inspectTemplate to be deleted, for + // example `organizations/433245324/inspectTemplates/432452342` or + // projects/project-id/inspectTemplates/432452342. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/InspectTemplate" + } + ]; +} + +// Request message for CreateJobTrigger. +message CreateJobTriggerRequest { + // Required. Parent resource name. + // + // The format of this value varies depending on whether you have [specified a + // processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dlp.googleapis.com/JobTrigger" + } + ]; + + // Required. The JobTrigger to create. + JobTrigger job_trigger = 2 [(google.api.field_behavior) = REQUIRED]; + + // The trigger id can contain uppercase and lowercase letters, + // numbers, and hyphens; that is, it must match the regular + // expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + // characters. Can be empty to allow the system to generate one. + string trigger_id = 3; + + // Deprecated. This field has no effect. + string location_id = 4; +} + +// Request message for ActivateJobTrigger. +message ActivateJobTriggerRequest { + // Required. Resource name of the trigger to activate, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/JobTrigger" + } + ]; +} + +// Request message for UpdateJobTrigger. +message UpdateJobTriggerRequest { + // Required. Resource name of the project and the triggeredJob, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/JobTrigger" + } + ]; + + // New JobTrigger value. + JobTrigger job_trigger = 2; + + // Mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3; +} + +// Request message for GetJobTrigger. +message GetJobTriggerRequest { + // Required. Resource name of the project and the triggeredJob, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/JobTrigger" + } + ]; +} + +// Request message for CreateDlpJobRequest. Used to initiate long running +// jobs such as calculating risk metrics or inspecting Google Cloud +// Storage. +message CreateDlpJobRequest { + // Required. Parent resource name. + // + // The format of this value varies depending on whether you have [specified a + // processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dlp.googleapis.com/DlpJob" + } + ]; + + // The configuration details for the specific type of job to run. + oneof job { + // An inspection job scans a storage repository for InfoTypes. + InspectJobConfig inspect_job = 2; + + // A risk analysis job calculates re-identification risk metrics for a + // BigQuery table. + RiskAnalysisJobConfig risk_job = 3; + } + + // The job id can contain uppercase and lowercase letters, + // numbers, and hyphens; that is, it must match the regular + // expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + // characters. Can be empty to allow the system to generate one. + string job_id = 4; + + // Deprecated. This field has no effect. + string location_id = 5; +} + +// Request message for ListJobTriggers. +message ListJobTriggersRequest { + // Required. Parent resource name. + // + // The format of this value varies depending on whether you have [specified a + // processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dlp.googleapis.com/JobTrigger" + } + ]; + + // Page token to continue retrieval. Comes from previous call + // to ListJobTriggers. `order_by` field must not + // change for subsequent calls. + string page_token = 2; + + // Size of the page, can be limited by a server. + int32 page_size = 3; + + // Comma separated list of triggeredJob fields to order by, + // followed by `asc` or `desc` postfix. This list is case-insensitive, + // default sorting order is ascending, redundant space characters are + // insignificant. + // + // Example: `name asc,update_time, create_time desc` + // + // Supported fields are: + // + // - `create_time`: corresponds to the time the JobTrigger was created. + // - `update_time`: corresponds to the time the JobTrigger was last updated. + // - `last_run_time`: corresponds to the last time the JobTrigger ran. + // - `name`: corresponds to the JobTrigger's name. + // - `display_name`: corresponds to the JobTrigger's display name. + // - `status`: corresponds to JobTrigger's status. + string order_by = 4; + + // Allows filtering. + // + // Supported syntax: + // + // * Filter expressions are made up of one or more restrictions. + // * Restrictions can be combined by `AND` or `OR` logical operators. A + // sequence of restrictions implicitly uses `AND`. + // * A restriction has the form of `{field} {operator} {value}`. + // * Supported fields/values for inspect triggers: + // - `status` - HEALTHY|PAUSED|CANCELLED + // - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + // - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by + // quotation marks. Nanoseconds are ignored. + // - 'error_count' - Number of errors that have occurred while running. + // * The operator must be `=` or `!=` for status and inspected_storage. + // + // Examples: + // + // * inspected_storage = cloud_storage AND status = HEALTHY + // * inspected_storage = cloud_storage OR inspected_storage = bigquery + // * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) + // * last_run_time > \"2017-12-12T00:00:00+00:00\" + // + // The length of this field should be no more than 500 characters. + string filter = 5; + + // The type of jobs. Will use `DlpJobType.INSPECT` if not set. + DlpJobType type = 6; + + // Deprecated. This field has no effect. + string location_id = 7; +} + +// Response message for ListJobTriggers. +message ListJobTriggersResponse { + // List of triggeredJobs, up to page_size in ListJobTriggersRequest. + repeated JobTrigger job_triggers = 1; + + // If the next page is available then the next page token to be used + // in following ListJobTriggers request. + string next_page_token = 2; +} + +// Request message for DeleteJobTrigger. +message DeleteJobTriggerRequest { + // Required. Resource name of the project and the triggeredJob, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/JobTrigger" + } + ]; +} + +// Controls what and how to inspect for findings. +message InspectJobConfig { + // The data to scan. + StorageConfig storage_config = 1; + + // How and what to scan for. + InspectConfig inspect_config = 2; + + // If provided, will be used as the default for all values in InspectConfig. + // `inspect_config` will be merged into the values persisted as part of the + // template. + string inspect_template_name = 3; + + // Actions to execute at the completion of the job. + repeated Action actions = 4; +} + +// A task to execute when a data profile has been generated. +message DataProfileAction { + // If set, the detailed data profiles will be persisted to the location + // of your choice whenever updated. + message Export { + // Store all table and column profiles in an existing table or a new table + // in an existing dataset. Each re-generation will result in a new row in + // BigQuery. + BigQueryTable profile_table = 1; + } + + // Send a Pub/Sub message into the given Pub/Sub topic to connect other + // systems to data profile generation. The message payload data will + // be the byte serialization of `DataProfilePubSubMessage`. + message PubSubNotification { + // The levels of detail that can be included in the Pub/Sub message. + enum DetailLevel { + // Unused. + DETAIL_LEVEL_UNSPECIFIED = 0; + + // The full table data profile. + TABLE_PROFILE = 1; + + // The resource name of the table. + RESOURCE_NAME = 2; + } + + // Cloud Pub/Sub topic to send notifications to. + // Format is projects/{project}/topics/{topic}. + string topic = 1; + + // The type of event that triggers a Pub/Sub. At most one + // `PubSubNotification` per EventType is permitted. + EventType event = 2; + + // Conditions (e.g., data risk or sensitivity level) for triggering a + // Pub/Sub. + DataProfilePubSubCondition pubsub_condition = 3; + + // How much data to include in the Pub/Sub message. If the user wishes to + // limit the size of the message, they can use resource_name and fetch the + // profile fields they wish to. Per table profile (not per column). + DetailLevel detail_of_message = 4; + } + + // Types of event that can trigger an action. + enum EventType { + // Unused. + EVENT_TYPE_UNSPECIFIED = 0; + + // New profile (not a re-profile). + NEW_PROFILE = 1; + + // Changed one of the following profile metrics: + // * Table data risk score + // * Table sensitivity score + // * Table resource visibility + // * Table encryption type + // * Table predicted infoTypes + // * Table other infoTypes + CHANGED_PROFILE = 2; + + // Table data risk score or sensitivity score increased. + SCORE_INCREASED = 3; + + // A user (non-internal) error occurred. + ERROR_CHANGED = 4; + } + + oneof action { + // Export data profiles into a provided location. + Export export_data = 1; + + // Publish a message into the Pub/Sub topic. + PubSubNotification pub_sub_notification = 2; + } +} + +// Configuration for setting up a job to scan resources for profile generation. +// Only one data profile configuration may exist per organization, folder, +// or project. +// +// The generated data profiles are retained according to the +// [data retention policy] +// (https://cloud.google.com/dlp/docs/data-profiles#retention). +message DataProfileJobConfig { + // The data to scan. + DataProfileLocation location = 1; + + // The project that will run the scan. The DLP service + // account that exists within this project must have access to all resources + // that are profiled, and the Cloud DLP API must be enabled. + string project_id = 5; + + // Detection logic for profile generation. + // + // Not all template features are used by profiles. FindingLimits, + // include_quote and exclude_info_types have no impact on + // data profiling. + // + // Multiple templates may be provided if there is data in multiple regions. + // At most one template must be specified per-region (including "global"). + // Each region is scanned using the applicable template. If no region-specific + // template is specified, but a "global" template is specified, it will be + // copied to that region and used instead. If no global or region-specific + // template is provided for a region with data, that region's data will not be + // scanned. + // + // For more information, see + // https://cloud.google.com/dlp/docs/data-profiles#data_residency. + repeated string inspect_templates = 7; + + // Actions to execute at the completion of the job. + repeated DataProfileAction data_profile_actions = 6; +} + +// The data that will be profiled. +message DataProfileLocation { + // The location to be scanned. + oneof location { + // The ID of an organization to scan. + int64 organization_id = 1; + + // The ID of the Folder within an organization to scan. + int64 folder_id = 2; + } +} + +// Combines all of the information about a DLP job. +message DlpJob { + option (google.api.resource) = { + type: "dlp.googleapis.com/DlpJob" + pattern: "projects/{project}/dlpJobs/{dlp_job}" + pattern: "projects/{project}/locations/{location}/dlpJobs/{dlp_job}" + }; + + // Possible states of a job. New items may be added. + enum JobState { + // Unused. + JOB_STATE_UNSPECIFIED = 0; + + // The job has not yet started. + PENDING = 1; + + // The job is currently running. Once a job has finished it will transition + // to FAILED or DONE. + RUNNING = 2; + + // The job is no longer running. + DONE = 3; + + // The job was canceled before it could be completed. + CANCELED = 4; + + // The job had an error and did not complete. + FAILED = 5; + + // The job is currently accepting findings via hybridInspect. + // A hybrid job in ACTIVE state may continue to have findings added to it + // through the calling of hybridInspect. After the job has finished no more + // calls to hybridInspect may be made. ACTIVE jobs can transition to DONE. + ACTIVE = 6; + } + + // The server-assigned name. + string name = 1; + + // The type of job. + DlpJobType type = 2; + + // State of a job. + JobState state = 3; + + oneof details { + // Results from analyzing risk of a data source. + AnalyzeDataSourceRiskDetails risk_details = 4; + + // Results from inspecting a data source. + InspectDataSourceDetails inspect_details = 5; + } + + // Time when the job was created. + google.protobuf.Timestamp create_time = 6; + + // Time when the job started. + google.protobuf.Timestamp start_time = 7; + + // Time when the job finished. + google.protobuf.Timestamp end_time = 8; + + // If created by a job trigger, the resource name of the trigger that + // instantiated the job. + string job_trigger_name = 10; + + // A stream of errors encountered running the job. + repeated Error errors = 11; +} + +// The request message for [DlpJobs.GetDlpJob][]. +message GetDlpJobRequest { + // Required. The name of the DlpJob resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/DlpJob" + } + ]; +} + +// The request message for listing DLP jobs. +message ListDlpJobsRequest { + // Required. Parent resource name. + // + // The format of this value varies depending on whether you have [specified a + // processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dlp.googleapis.com/DlpJob" + } + ]; + + // Allows filtering. + // + // Supported syntax: + // + // * Filter expressions are made up of one or more restrictions. + // * Restrictions can be combined by `AND` or `OR` logical operators. A + // sequence of restrictions implicitly uses `AND`. + // * A restriction has the form of `{field} {operator} {value}`. + // * Supported fields/values for inspect jobs: + // - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED + // - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + // - `trigger_name` - The name of the trigger that created the job. + // - 'end_time` - Corresponds to the time the job finished. + // - 'start_time` - Corresponds to the time the job finished. + // * Supported fields for risk analysis jobs: + // - `state` - RUNNING|CANCELED|FINISHED|FAILED + // - 'end_time` - Corresponds to the time the job finished. + // - 'start_time` - Corresponds to the time the job finished. + // * The operator must be `=` or `!=`. + // + // Examples: + // + // * inspected_storage = cloud_storage AND state = done + // * inspected_storage = cloud_storage OR inspected_storage = bigquery + // * inspected_storage = cloud_storage AND (state = done OR state = canceled) + // * end_time > \"2017-12-12T00:00:00+00:00\" + // + // The length of this field should be no more than 500 characters. + string filter = 1; + + // The standard list page size. + int32 page_size = 2; + + // The standard list page token. + string page_token = 3; + + // The type of job. Defaults to `DlpJobType.INSPECT` + DlpJobType type = 5; + + // Comma separated list of fields to order by, + // followed by `asc` or `desc` postfix. This list is case-insensitive, + // default sorting order is ascending, redundant space characters are + // insignificant. + // + // Example: `name asc, end_time asc, create_time desc` + // + // Supported fields are: + // + // - `create_time`: corresponds to the time the job was created. + // - `end_time`: corresponds to the time the job ended. + // - `name`: corresponds to the job's name. + // - `state`: corresponds to `state` + string order_by = 6; + + // Deprecated. This field has no effect. + string location_id = 7; +} + +// The response message for listing DLP jobs. +message ListDlpJobsResponse { + // A list of DlpJobs that matches the specified filter in the request. + repeated DlpJob jobs = 1; + + // The standard List next-page token. + string next_page_token = 2; +} + +// The request message for canceling a DLP job. +message CancelDlpJobRequest { + // Required. The name of the DlpJob resource to be cancelled. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/DlpJob" + } + ]; +} + +// The request message for finishing a DLP hybrid job. +message FinishDlpJobRequest { + // Required. The name of the DlpJob resource to be cancelled. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/DlpJob" + } + ]; +} + +// The request message for deleting a DLP job. +message DeleteDlpJobRequest { + // Required. The name of the DlpJob resource to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/DlpJob" + } + ]; +} + +// Request message for CreateDeidentifyTemplate. +message CreateDeidentifyTemplateRequest { + // Required. Parent resource name. + // + // The format of this value varies depending on the scope of the request + // (project or organization) and whether you have [specified a processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + Organizations scope, location specified:
+ // `organizations/`ORG_ID`/locations/`LOCATION_ID + // + Organizations scope, no location specified (defaults to global):
+ // `organizations/`ORG_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dlp.googleapis.com/DeidentifyTemplate" + } + ]; + + // Required. The DeidentifyTemplate to create. + DeidentifyTemplate deidentify_template = 2 [(google.api.field_behavior) = REQUIRED]; + + // The template id can contain uppercase and lowercase letters, + // numbers, and hyphens; that is, it must match the regular + // expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + // characters. Can be empty to allow the system to generate one. + string template_id = 3; + + // Deprecated. This field has no effect. + string location_id = 4; +} + +// Request message for UpdateDeidentifyTemplate. +message UpdateDeidentifyTemplateRequest { + // Required. Resource name of organization and deidentify template to be updated, for + // example `organizations/433245324/deidentifyTemplates/432452342` or + // projects/project-id/deidentifyTemplates/432452342. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/DeidentifyTemplate" + } + ]; + + // New DeidentifyTemplate value. + DeidentifyTemplate deidentify_template = 2; + + // Mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3; +} + +// Request message for GetDeidentifyTemplate. +message GetDeidentifyTemplateRequest { + // Required. Resource name of the organization and deidentify template to be read, for + // example `organizations/433245324/deidentifyTemplates/432452342` or + // projects/project-id/deidentifyTemplates/432452342. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/DeidentifyTemplate" + } + ]; +} + +// Request message for ListDeidentifyTemplates. +message ListDeidentifyTemplatesRequest { + // Required. Parent resource name. + // + // The format of this value varies depending on the scope of the request + // (project or organization) and whether you have [specified a processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + Organizations scope, location specified:
+ // `organizations/`ORG_ID`/locations/`LOCATION_ID + // + Organizations scope, no location specified (defaults to global):
+ // `organizations/`ORG_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dlp.googleapis.com/DeidentifyTemplate" + } + ]; + + // Page token to continue retrieval. Comes from previous call + // to `ListDeidentifyTemplates`. + string page_token = 2; + + // Size of the page, can be limited by the server. If zero server returns + // a page of max size 100. + int32 page_size = 3; + + // Comma separated list of fields to order by, + // followed by `asc` or `desc` postfix. This list is case-insensitive, + // default sorting order is ascending, redundant space characters are + // insignificant. + // + // Example: `name asc,update_time, create_time desc` + // + // Supported fields are: + // + // - `create_time`: corresponds to the time the template was created. + // - `update_time`: corresponds to the time the template was last updated. + // - `name`: corresponds to the template's name. + // - `display_name`: corresponds to the template's display name. + string order_by = 4; + + // Deprecated. This field has no effect. + string location_id = 5; +} + +// Response message for ListDeidentifyTemplates. +message ListDeidentifyTemplatesResponse { + // List of deidentify templates, up to page_size in + // ListDeidentifyTemplatesRequest. + repeated DeidentifyTemplate deidentify_templates = 1; + + // If the next page is available then the next page token to be used + // in following ListDeidentifyTemplates request. + string next_page_token = 2; +} + +// Request message for DeleteDeidentifyTemplate. +message DeleteDeidentifyTemplateRequest { + // Required. Resource name of the organization and deidentify template to be deleted, + // for example `organizations/433245324/deidentifyTemplates/432452342` or + // projects/project-id/deidentifyTemplates/432452342. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/DeidentifyTemplate" + } + ]; +} + +// Configuration for a custom dictionary created from a data source of any size +// up to the maximum size defined in the +// [limits](https://cloud.google.com/dlp/limits) page. The artifacts of +// dictionary creation are stored in the specified Cloud Storage +// location. Consider using `CustomInfoType.Dictionary` for smaller dictionaries +// that satisfy the size requirements. +message LargeCustomDictionaryConfig { + // Location to store dictionary artifacts in Cloud Storage. These files + // will only be accessible by project owners and the DLP API. If any of these + // artifacts are modified, the dictionary is considered invalid and can no + // longer be used. + CloudStoragePath output_path = 1; + + oneof source { + // Set of files containing newline-delimited lists of dictionary phrases. + CloudStorageFileSet cloud_storage_file_set = 2; + + // Field in a BigQuery table where each cell represents a dictionary phrase. + BigQueryField big_query_field = 3; + } +} + +// Summary statistics of a custom dictionary. +message LargeCustomDictionaryStats { + // Approximate number of distinct phrases in the dictionary. + int64 approx_num_phrases = 1; +} + +// Configuration for stored infoTypes. All fields and subfield are provided +// by the user. For more information, see +// https://cloud.google.com/dlp/docs/creating-custom-infotypes. +message StoredInfoTypeConfig { + // Display name of the StoredInfoType (max 256 characters). + string display_name = 1; + + // Description of the StoredInfoType (max 256 characters). + string description = 2; + + // Stored infotype types. + oneof type { + // StoredInfoType where findings are defined by a dictionary of phrases. + LargeCustomDictionaryConfig large_custom_dictionary = 3; + + // Store dictionary-based CustomInfoType. + CustomInfoType.Dictionary dictionary = 4; + + // Store regular expression-based StoredInfoType. + CustomInfoType.Regex regex = 5; + } +} + +// Statistics for a StoredInfoType. +message StoredInfoTypeStats { + // Stat types + oneof type { + // StoredInfoType where findings are defined by a dictionary of phrases. + LargeCustomDictionaryStats large_custom_dictionary = 1; + } +} + +// Version of a StoredInfoType, including the configuration used to build it, +// create timestamp, and current state. +message StoredInfoTypeVersion { + // StoredInfoType configuration. + StoredInfoTypeConfig config = 1; + + // Create timestamp of the version. Read-only, determined by the system + // when the version is created. + google.protobuf.Timestamp create_time = 2; + + // Stored info type version state. Read-only, updated by the system + // during dictionary creation. + StoredInfoTypeState state = 3; + + // Errors that occurred when creating this storedInfoType version, or + // anomalies detected in the storedInfoType data that render it unusable. Only + // the five most recent errors will be displayed, with the most recent error + // appearing first. + // + // For example, some of the data for stored custom dictionaries is put in + // the user's Cloud Storage bucket, and if this data is modified or + // deleted by the user or another system, the dictionary becomes invalid. + // + // If any errors occur, fix the problem indicated by the error message and + // use the UpdateStoredInfoType API method to create another version of the + // storedInfoType to continue using it, reusing the same `config` if it was + // not the source of the error. + repeated Error errors = 4; + + // Statistics about this storedInfoType version. + StoredInfoTypeStats stats = 5; +} + +// StoredInfoType resource message that contains information about the current +// version and any pending updates. +message StoredInfoType { + option (google.api.resource) = { + type: "dlp.googleapis.com/StoredInfoType" + pattern: "organizations/{organization}/storedInfoTypes/{stored_info_type}" + pattern: "projects/{project}/storedInfoTypes/{stored_info_type}" + pattern: "organizations/{organization}/locations/{location}/storedInfoTypes/{stored_info_type}" + pattern: "projects/{project}/locations/{location}/storedInfoTypes/{stored_info_type}" + }; + + // Resource name. + string name = 1; + + // Current version of the stored info type. + StoredInfoTypeVersion current_version = 2; + + // Pending versions of the stored info type. Empty if no versions are + // pending. + repeated StoredInfoTypeVersion pending_versions = 3; +} + +// Request message for CreateStoredInfoType. +message CreateStoredInfoTypeRequest { + // Required. Parent resource name. + // + // The format of this value varies depending on the scope of the request + // (project or organization) and whether you have [specified a processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + Organizations scope, location specified:
+ // `organizations/`ORG_ID`/locations/`LOCATION_ID + // + Organizations scope, no location specified (defaults to global):
+ // `organizations/`ORG_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dlp.googleapis.com/StoredInfoType" + } + ]; + + // Required. Configuration of the storedInfoType to create. + StoredInfoTypeConfig config = 2 [(google.api.field_behavior) = REQUIRED]; + + // The storedInfoType ID can contain uppercase and lowercase letters, + // numbers, and hyphens; that is, it must match the regular + // expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + // characters. Can be empty to allow the system to generate one. + string stored_info_type_id = 3; + + // Deprecated. This field has no effect. + string location_id = 4; +} + +// Request message for UpdateStoredInfoType. +message UpdateStoredInfoTypeRequest { + // Required. Resource name of organization and storedInfoType to be updated, for + // example `organizations/433245324/storedInfoTypes/432452342` or + // projects/project-id/storedInfoTypes/432452342. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/StoredInfoType" + } + ]; + + // Updated configuration for the storedInfoType. If not provided, a new + // version of the storedInfoType will be created with the existing + // configuration. + StoredInfoTypeConfig config = 2; + + // Mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3; +} + +// Request message for GetStoredInfoType. +message GetStoredInfoTypeRequest { + // Required. Resource name of the organization and storedInfoType to be read, for + // example `organizations/433245324/storedInfoTypes/432452342` or + // projects/project-id/storedInfoTypes/432452342. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/StoredInfoType" + } + ]; +} + +// Request message for ListStoredInfoTypes. +message ListStoredInfoTypesRequest { + // Required. Parent resource name. + // + // The format of this value varies depending on the scope of the request + // (project or organization) and whether you have [specified a processing + // location](https://cloud.google.com/dlp/docs/specifying-location): + // + // + Projects scope, location specified:
+ // `projects/`PROJECT_ID`/locations/`LOCATION_ID + // + Projects scope, no location specified (defaults to global):
+ // `projects/`PROJECT_ID + // + // The following example `parent` string specifies a parent project with the + // identifier `example-project`, and specifies the `europe-west3` location + // for processing data: + // + // parent=projects/example-project/locations/europe-west3 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dlp.googleapis.com/StoredInfoType" + } + ]; + + // Page token to continue retrieval. Comes from previous call + // to `ListStoredInfoTypes`. + string page_token = 2; + + // Size of the page, can be limited by the server. If zero server returns + // a page of max size 100. + int32 page_size = 3; + + // Comma separated list of fields to order by, + // followed by `asc` or `desc` postfix. This list is case-insensitive, + // default sorting order is ascending, redundant space characters are + // insignificant. + // + // Example: `name asc, display_name, create_time desc` + // + // Supported fields are: + // + // - `create_time`: corresponds to the time the most recent version of the + // resource was created. + // - `state`: corresponds to the state of the resource. + // - `name`: corresponds to resource name. + // - `display_name`: corresponds to info type's display name. + string order_by = 4; + + // Deprecated. This field has no effect. + string location_id = 5; +} + +// Response message for ListStoredInfoTypes. +message ListStoredInfoTypesResponse { + // List of storedInfoTypes, up to page_size in ListStoredInfoTypesRequest. + repeated StoredInfoType stored_info_types = 1; + + // If the next page is available then the next page token to be used + // in following ListStoredInfoTypes request. + string next_page_token = 2; +} + +// Request message for DeleteStoredInfoType. +message DeleteStoredInfoTypeRequest { + // Required. Resource name of the organization and storedInfoType to be deleted, for + // example `organizations/433245324/storedInfoTypes/432452342` or + // projects/project-id/storedInfoTypes/432452342. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/StoredInfoType" + } + ]; +} + +// Request to search for potentially sensitive info in a custom location. +message HybridInspectJobTriggerRequest { + // Required. Resource name of the trigger to execute a hybrid inspect on, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/JobTrigger" + } + ]; + + // The item to inspect. + HybridContentItem hybrid_item = 3; +} + +// Request to search for potentially sensitive info in a custom location. +message HybridInspectDlpJobRequest { + // Required. Resource name of the job to execute a hybrid inspect on, for example + // `projects/dlp-test-project/dlpJob/53234423`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dlp.googleapis.com/DlpJob" + } + ]; + + // The item to inspect. + HybridContentItem hybrid_item = 3; +} + +// An individual hybrid item to inspect. Will be stored temporarily during +// processing. +message HybridContentItem { + // The item to inspect. + ContentItem item = 1; + + // Supplementary information that will be added to each finding. + HybridFindingDetails finding_details = 2; +} + +// Populate to associate additional data with each finding. +message HybridFindingDetails { + // Details about the container where the content being inspected is from. + Container container_details = 1; + + // Offset in bytes of the line, from the beginning of the file, where the + // finding is located. Populate if the item being scanned is only part of a + // bigger item, such as a shard of a file and you want to track the absolute + // position of the finding. + int64 file_offset = 2; + + // Offset of the row for tables. Populate if the row(s) being scanned are + // part of a bigger dataset and you want to keep track of their absolute + // position. + int64 row_offset = 3; + + // If the container is a table, additional information to make findings + // meaningful such as the columns that are primary keys. If not known ahead + // of time, can also be set within each inspect hybrid call and the two + // will be merged. Note that identifying_fields will only be stored to + // BigQuery, and only if the BigQuery action has been included. + TableOptions table_options = 4; + + // Labels to represent user provided metadata about the data being inspected. + // If configured by the job, some key values may be required. + // The labels associated with `Finding`'s produced by hybrid + // inspection. + // + // Label keys must be between 1 and 63 characters long and must conform + // to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + // + // Label values must be between 0 and 63 characters long and must conform + // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + // + // No more than 10 labels can be associated with a given finding. + // + // Examples: + // * `"environment" : "production"` + // * `"pipeline" : "etl"` + map labels = 5; +} + +// Quota exceeded errors will be thrown once quota has been met. +message HybridInspectResponse { + +} + +// Operators available for comparing the value of fields. +enum RelationalOperator { + // Unused + RELATIONAL_OPERATOR_UNSPECIFIED = 0; + + // Equal. Attempts to match even with incompatible types. + EQUAL_TO = 1; + + // Not equal to. Attempts to match even with incompatible types. + NOT_EQUAL_TO = 2; + + // Greater than. + GREATER_THAN = 3; + + // Less than. + LESS_THAN = 4; + + // Greater than or equals. + GREATER_THAN_OR_EQUALS = 5; + + // Less than or equals. + LESS_THAN_OR_EQUALS = 6; + + // Exists + EXISTS = 7; +} + +// Type of the match which can be applied to different ways of matching, like +// Dictionary, regular expression and intersecting with findings of another +// info type. +enum MatchingType { + // Invalid. + MATCHING_TYPE_UNSPECIFIED = 0; + + // Full match. + // + // - Dictionary: join of Dictionary results matched complete finding quote + // - Regex: all regex matches fill a finding quote start to end + // - Exclude info type: completely inside affecting info types findings + MATCHING_TYPE_FULL_MATCH = 1; + + // Partial match. + // + // - Dictionary: at least one of the tokens in the finding matches + // - Regex: substring of the finding matches + // - Exclude info type: intersects with affecting info types findings + MATCHING_TYPE_PARTIAL_MATCH = 2; + + // Inverse match. + // + // - Dictionary: no tokens in the finding match the dictionary + // - Regex: finding doesn't match the regex + // - Exclude info type: no intersection with affecting info types findings + MATCHING_TYPE_INVERSE_MATCH = 3; +} + +// Deprecated and unused. +enum ContentOption { + // Includes entire content of a file or a data stream. + CONTENT_UNSPECIFIED = 0; + + // Text content within the data, excluding any metadata. + CONTENT_TEXT = 1; + + // Images found in the data. + CONTENT_IMAGE = 2; +} + +// Type of metadata containing the finding. +enum MetadataType { + // Unused + METADATATYPE_UNSPECIFIED = 0; + + // General file metadata provided by Cloud Storage. + STORAGE_METADATA = 2; +} + +// Parts of the APIs which use certain infoTypes. +enum InfoTypeSupportedBy { + // Unused. + ENUM_TYPE_UNSPECIFIED = 0; + + // Supported by the inspect operations. + INSPECT = 1; + + // Supported by the risk analysis operations. + RISK_ANALYSIS = 2; +} + +// An enum to represent the various types of DLP jobs. +enum DlpJobType { + // Defaults to INSPECT_JOB. + DLP_JOB_TYPE_UNSPECIFIED = 0; + + // The job inspected Google Cloud for sensitive data. + INSPECT_JOB = 1; + + // The job executed a Risk Analysis computation. + RISK_ANALYSIS_JOB = 2; +} + +// State of a StoredInfoType version. +enum StoredInfoTypeState { + // Unused + STORED_INFO_TYPE_STATE_UNSPECIFIED = 0; + + // StoredInfoType version is being created. + PENDING = 1; + + // StoredInfoType version is ready for use. + READY = 2; + + // StoredInfoType creation failed. All relevant error messages are returned in + // the `StoredInfoTypeVersion` message. + FAILED = 3; + + // StoredInfoType is no longer valid because artifacts stored in + // user-controlled storage were modified. To fix an invalid StoredInfoType, + // use the `UpdateStoredInfoType` method to create a new version. + INVALID = 4; +} + +// Score is a summary of all elements in the data profile. +// A higher number means more risk. +message DataRiskLevel { + // Various score levels for resources. + enum DataRiskLevelScore { + // Unused. + RISK_SCORE_UNSPECIFIED = 0; + + // Low risk - Lower indication of sensitive data that appears to have + // additional access restrictions in place or no indication of sensitive + // data found. + RISK_LOW = 10; + + // Medium risk - Sensitive data may be present but additional access or fine + // grain access restrictions appear to be present. Consider limiting + // access even further or transform data to mask. + RISK_MODERATE = 20; + + // High risk – SPII may be present. Access controls may include public + // ACLs. Exfiltration of data may lead to user data loss. Re-identification + // of users may be possible. Consider limiting usage and or removing SPII. + RISK_HIGH = 30; + } + + // The score applied to the resource. + DataRiskLevelScore score = 1; +} + +// How broadly a resource has been shared. New items may be added over time. +// A higher number means more restricted. +enum ResourceVisibility { + // Unused. + RESOURCE_VISIBILITY_UNSPECIFIED = 0; + + // Visible to any user. + RESOURCE_VISIBILITY_PUBLIC = 10; + + // Visible only to specific users. + RESOURCE_VISIBILITY_RESTRICTED = 20; +} + +// Snapshot of the configurations used to generate the profile. +message DataProfileConfigSnapshot { + // A copy of the inspection config used to generate this profile. This + // is a copy of the inspect_template specified in `DataProfileJobConfig`. + InspectConfig inspect_config = 2; + + // A copy of the configuration used to generate this profile. + DataProfileJobConfig data_profile_job = 3; +} + +// The profile for a scanned table. +message TableDataProfile { + // Possible states of a profile. New items may be added. + enum State { + // Unused. + STATE_UNSPECIFIED = 0; + + // The profile is currently running. Once a profile has finished it will + // transition to DONE. + RUNNING = 1; + + // The profile is no longer generating. + // If profile_status.status.code is 0, the profile succeeded, otherwise, it + // failed. + DONE = 2; + } + + // The name of the profile. + string name = 1; + + // The resource name to the project data profile for this table. + string project_data_profile = 2; + + // The GCP project ID that owns the BigQuery dataset. + string dataset_project_id = 24; + + // The BigQuery location where the dataset's data is stored. + // See https://cloud.google.com/bigquery/docs/locations for supported + // locations. + string dataset_location = 29; + + // The BigQuery dataset ID. + string dataset_id = 25; + + // The BigQuery table ID. + string table_id = 26; + + // The resource name of the table. + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string full_resource = 3; + + // Success or error status from the most recent profile generation attempt. + // May be empty if the profile is still being generated. + ProfileStatus profile_status = 21; + + // State of a profile. + State state = 22; + + // The sensitivity score of this table. + SensitivityScore sensitivity_score = 5; + + // The data risk level of this table. + DataRiskLevel data_risk_level = 6; + + // The infoTypes predicted from this table's data. + repeated InfoTypeSummary predicted_info_types = 27; + + // Other infoTypes found in this table's data. + repeated OtherInfoTypeSummary other_info_types = 28; + + // The snapshot of the configurations used to generate the profile. + DataProfileConfigSnapshot config_snapshot = 7; + + // The time when this table was last modified + google.protobuf.Timestamp last_modified_time = 8; + + // Optional. The time when this table expires. + google.protobuf.Timestamp expiration_time = 9; + + // The number of columns profiled in the table. + int64 scanned_column_count = 10; + + // The number of columns skipped in the table because of an error. + int64 failed_column_count = 11; + + // The size of the table when the profile was generated. + int64 table_size_bytes = 12; + + // Number of rows in the table when the profile was generated. + // This will not be populated for BigLake tables. + int64 row_count = 13; + + // How the table is encrypted. + EncryptionStatus encryption_status = 14; + + // How broadly a resource has been shared. + ResourceVisibility resource_visibility = 15; + + // The last time the profile was generated. + google.protobuf.Timestamp profile_last_generated = 16; + + // The labels applied to the resource at the time the profile was generated. + map resource_labels = 17; + + // The time at which the table was created. + google.protobuf.Timestamp create_time = 23; +} + +message ProfileStatus { + // Profiling status code and optional message + google.rpc.Status status = 1; + + // Time when the profile generation status was updated + google.protobuf.Timestamp timestamp = 3; +} + +// How a resource is encrypted. +enum EncryptionStatus { + // Unused. + ENCRYPTION_STATUS_UNSPECIFIED = 0; + + // Google manages server-side encryption keys on your behalf. + ENCRYPTION_GOOGLE_MANAGED = 1; + + // Customer provides the key. + ENCRYPTION_CUSTOMER_MANAGED = 2; +} + +// The infoType details for this column. +message InfoTypeSummary { + // The infoType. + InfoType info_type = 1; + + // Not populated for predicted infotypes. + int32 estimated_prevalence = 2 [deprecated = true]; +} + +// Infotype details for other infoTypes found within a column. +message OtherInfoTypeSummary { + // The other infoType. + InfoType info_type = 1; + + // Approximate percentage of non-null rows that contained data detected by + // this infotype. + int32 estimated_prevalence = 2; +} + +// A condition for determining whether a Pub/Sub should be triggered. +message DataProfilePubSubCondition { + // Various score levels for resources. + enum ProfileScoreBucket { + // Unused. + PROFILE_SCORE_BUCKET_UNSPECIFIED = 0; + + // High risk/sensitivity detected. + HIGH = 1; + + // Medium or high risk/sensitivity detected. + MEDIUM_OR_HIGH = 2; + } + + // A condition consisting of a value. + message PubSubCondition { + // The value for the condition to trigger. + oneof value { + // The minimum data risk score that triggers the condition. + ProfileScoreBucket minimum_risk_score = 1; + + // The minimum sensitivity level that triggers the condition. + ProfileScoreBucket minimum_sensitivity_score = 2; + } + } + + // An expression, consisting of an operator and conditions. + message PubSubExpressions { + // Logical operators for conditional checks. + enum PubSubLogicalOperator { + // Unused. + LOGICAL_OPERATOR_UNSPECIFIED = 0; + + // Conditional OR. + OR = 1; + + // Conditional AND. + AND = 2; + } + + // The operator to apply to the collection of conditions. + PubSubLogicalOperator logical_operator = 1; + + // Conditions to apply to the expression. + repeated PubSubCondition conditions = 2; + } + + // An expression. + PubSubExpressions expressions = 1; +} + +// Pub/Sub topic message for a DataProfileAction.PubSubNotification event. +// To receive a message of protocol buffer schema type, convert the message data +// to an object of this proto class. +message DataProfilePubSubMessage { + // If `DetailLevel` is `TABLE_PROFILE` this will be fully populated. + // Otherwise, if `DetailLevel` is `RESOURCE_NAME`, then only `name` and + // `full_resource` will be populated. + TableDataProfile profile = 1; + + // The event that caused the Pub/Sub message to be sent. + DataProfileAction.EventType event = 2; +} diff --git a/owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/storage.proto b/owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/storage.proto new file mode 100644 index 00000000000..3c9661d3c79 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/storage.proto @@ -0,0 +1,808 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.privacy.dlp.v2; + +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Dlp.V2"; +option go_package = "cloud.google.com/go/dlp/apiv2/dlppb;dlppb"; +option java_multiple_files = true; +option java_outer_classname = "DlpStorage"; +option java_package = "com.google.privacy.dlp.v2"; +option php_namespace = "Google\\Cloud\\Dlp\\V2"; +option ruby_package = "Google::Cloud::Dlp::V2"; + +// Type of information detected by the API. +message InfoType { + // Name of the information type. Either a name of your choosing when + // creating a CustomInfoType, or one of the names listed + // at https://cloud.google.com/dlp/docs/infotypes-reference when specifying + // a built-in type. When sending Cloud DLP results to Data Catalog, infoType + // names should conform to the pattern `[A-Za-z0-9$_-]{1,64}`. + string name = 1; + + // Optional version name for this InfoType. + string version = 2; +} + +// Score is a summary of all elements in the data profile. +// A higher number means more sensitive. +message SensitivityScore { + // Various score levels for resources. + enum SensitivityScoreLevel { + // Unused. + SENSITIVITY_SCORE_UNSPECIFIED = 0; + + // No sensitive information detected. Limited access. + SENSITIVITY_LOW = 10; + + // Medium risk - PII, potentially sensitive data, or fields with free-text + // data that are at higher risk of having intermittent sensitive data. + // Consider limiting access. + SENSITIVITY_MODERATE = 20; + + // High risk – SPII may be present. Exfiltration of data may lead to user + // data loss. Re-identification of users may be possible. Consider limiting + // usage and or removing SPII. + SENSITIVITY_HIGH = 30; + } + + // The score applied to the resource. + SensitivityScoreLevel score = 1; +} + +// Categorization of results based on how likely they are to represent a match, +// based on the number of elements they contain which imply a match. +enum Likelihood { + // Default value; same as POSSIBLE. + LIKELIHOOD_UNSPECIFIED = 0; + + // Few matching elements. + VERY_UNLIKELY = 1; + + UNLIKELY = 2; + + // Some matching elements. + POSSIBLE = 3; + + LIKELY = 4; + + // Many matching elements. + VERY_LIKELY = 5; +} + +// A reference to a StoredInfoType to use with scanning. +message StoredType { + // Resource name of the requested `StoredInfoType`, for example + // `organizations/433245324/storedInfoTypes/432452342` or + // `projects/project-id/storedInfoTypes/432452342`. + string name = 1; + + // Timestamp indicating when the version of the `StoredInfoType` used for + // inspection was created. Output-only field, populated by the system. + google.protobuf.Timestamp create_time = 2; +} + +// Custom information type provided by the user. Used to find domain-specific +// sensitive information configurable to the data in question. +message CustomInfoType { + // Custom information type based on a dictionary of words or phrases. This can + // be used to match sensitive information specific to the data, such as a list + // of employee IDs or job titles. + // + // Dictionary words are case-insensitive and all characters other than letters + // and digits in the unicode [Basic Multilingual + // Plane](https://en.wikipedia.org/wiki/Plane_%28Unicode%29#Basic_Multilingual_Plane) + // will be replaced with whitespace when scanning for matches, so the + // dictionary phrase "Sam Johnson" will match all three phrases "sam johnson", + // "Sam, Johnson", and "Sam (Johnson)". Additionally, the characters + // surrounding any match must be of a different type than the adjacent + // characters within the word, so letters must be next to non-letters and + // digits next to non-digits. For example, the dictionary word "jen" will + // match the first three letters of the text "jen123" but will return no + // matches for "jennifer". + // + // Dictionary words containing a large number of characters that are not + // letters or digits may result in unexpected findings because such characters + // are treated as whitespace. The + // [limits](https://cloud.google.com/dlp/limits) page contains details about + // the size limits of dictionaries. For dictionaries that do not fit within + // these constraints, consider using `LargeCustomDictionaryConfig` in the + // `StoredInfoType` API. + message Dictionary { + // Message defining a list of words or phrases to search for in the data. + message WordList { + // Words or phrases defining the dictionary. The dictionary must contain + // at least one phrase and every phrase must contain at least 2 characters + // that are letters or digits. [required] + repeated string words = 1; + } + + oneof source { + // List of words or phrases to search for. + WordList word_list = 1; + + // Newline-delimited file of words in Cloud Storage. Only a single file + // is accepted. + CloudStoragePath cloud_storage_path = 3; + } + } + + // Message defining a custom regular expression. + message Regex { + // Pattern defining the regular expression. Its syntax + // (https://github.com/google/re2/wiki/Syntax) can be found under the + // google/re2 repository on GitHub. + string pattern = 1; + + // The index of the submatch to extract as findings. When not + // specified, the entire match is returned. No more than 3 may be included. + repeated int32 group_indexes = 2; + } + + // Message for detecting output from deidentification transformations + // such as + // [`CryptoReplaceFfxFpeConfig`](https://cloud.google.com/dlp/docs/reference/rest/v2/organizations.deidentifyTemplates#cryptoreplaceffxfpeconfig). + // These types of transformations are + // those that perform pseudonymization, thereby producing a "surrogate" as + // output. This should be used in conjunction with a field on the + // transformation such as `surrogate_info_type`. This CustomInfoType does + // not support the use of `detection_rules`. + message SurrogateType { + + } + + // Deprecated; use `InspectionRuleSet` instead. Rule for modifying a + // `CustomInfoType` to alter behavior under certain circumstances, depending + // on the specific details of the rule. Not supported for the `surrogate_type` + // custom infoType. + message DetectionRule { + // Message for specifying a window around a finding to apply a detection + // rule. + message Proximity { + // Number of characters before the finding to consider. For tabular data, + // if you want to modify the likelihood of an entire column of findngs, + // set this to 1. For more information, see + // [Hotword example: Set the match likelihood of a table column] + // (https://cloud.google.com/dlp/docs/creating-custom-infotypes-likelihood#match-column-values). + int32 window_before = 1; + + // Number of characters after the finding to consider. + int32 window_after = 2; + } + + // Message for specifying an adjustment to the likelihood of a finding as + // part of a detection rule. + message LikelihoodAdjustment { + oneof adjustment { + // Set the likelihood of a finding to a fixed value. + Likelihood fixed_likelihood = 1; + + // Increase or decrease the likelihood by the specified number of + // levels. For example, if a finding would be `POSSIBLE` without the + // detection rule and `relative_likelihood` is 1, then it is upgraded to + // `LIKELY`, while a value of -1 would downgrade it to `UNLIKELY`. + // Likelihood may never drop below `VERY_UNLIKELY` or exceed + // `VERY_LIKELY`, so applying an adjustment of 1 followed by an + // adjustment of -1 when base likelihood is `VERY_LIKELY` will result in + // a final likelihood of `LIKELY`. + int32 relative_likelihood = 2; + } + } + + // The rule that adjusts the likelihood of findings within a certain + // proximity of hotwords. + message HotwordRule { + // Regular expression pattern defining what qualifies as a hotword. + Regex hotword_regex = 1; + + // Range of characters within which the entire hotword must reside. + // The total length of the window cannot exceed 1000 characters. + // The finding itself will be included in the window, so that hotwords can + // be used to match substrings of the finding itself. Suppose you + // want Cloud DLP to promote the likelihood of the phone number + // regex "\(\d{3}\) \d{3}-\d{4}" if the area code is known to be the + // area code of a company's office. In this case, use the hotword regex + // "\(xxx\)", where "xxx" is the area code in question. + // + // For tabular data, if you want to modify the likelihood of an entire + // column of findngs, see + // [Hotword example: Set the match likelihood of a table column] + // (https://cloud.google.com/dlp/docs/creating-custom-infotypes-likelihood#match-column-values). + Proximity proximity = 2; + + // Likelihood adjustment to apply to all matching findings. + LikelihoodAdjustment likelihood_adjustment = 3; + } + + oneof type { + // Hotword-based detection rule. + HotwordRule hotword_rule = 1; + } + } + + enum ExclusionType { + // A finding of this custom info type will not be excluded from results. + EXCLUSION_TYPE_UNSPECIFIED = 0; + + // A finding of this custom info type will be excluded from final results, + // but can still affect rule execution. + EXCLUSION_TYPE_EXCLUDE = 1; + } + + // CustomInfoType can either be a new infoType, or an extension of built-in + // infoType, when the name matches one of existing infoTypes and that infoType + // is specified in `InspectContent.info_types` field. Specifying the latter + // adds findings to the one detected by the system. If built-in info type is + // not specified in `InspectContent.info_types` list then the name is treated + // as a custom info type. + InfoType info_type = 1; + + // Likelihood to return for this CustomInfoType. This base value can be + // altered by a detection rule if the finding meets the criteria specified by + // the rule. Defaults to `VERY_LIKELY` if not specified. + Likelihood likelihood = 6; + + oneof type { + // A list of phrases to detect as a CustomInfoType. + Dictionary dictionary = 2; + + // Regular expression based CustomInfoType. + Regex regex = 3; + + // Message for detecting output from deidentification transformations that + // support reversing. + SurrogateType surrogate_type = 4; + + // Load an existing `StoredInfoType` resource for use in + // `InspectDataSource`. Not currently supported in `InspectContent`. + StoredType stored_type = 5; + } + + // Set of detection rules to apply to all findings of this CustomInfoType. + // Rules are applied in order that they are specified. Not supported for the + // `surrogate_type` CustomInfoType. + repeated DetectionRule detection_rules = 7; + + // If set to EXCLUSION_TYPE_EXCLUDE this infoType will not cause a finding + // to be returned. It still can be used for rules matching. + ExclusionType exclusion_type = 8; +} + +// General identifier of a data field in a storage service. +message FieldId { + // Name describing the field. + string name = 1; +} + +// Datastore partition ID. +// A partition ID identifies a grouping of entities. The grouping is always +// by project and namespace, however the namespace ID may be empty. +// +// A partition ID contains several dimensions: +// project ID and namespace ID. +message PartitionId { + // The ID of the project to which the entities belong. + string project_id = 2; + + // If not empty, the ID of the namespace to which the entities belong. + string namespace_id = 4; +} + +// A representation of a Datastore kind. +message KindExpression { + // The name of the kind. + string name = 1; +} + +// Options defining a data set within Google Cloud Datastore. +message DatastoreOptions { + // A partition ID identifies a grouping of entities. The grouping is always + // by project and namespace, however the namespace ID may be empty. + PartitionId partition_id = 1; + + // The kind to process. + KindExpression kind = 2; +} + +// Definitions of file type groups to scan. New types will be added to this +// list. +enum FileType { + // Includes all files. + FILE_TYPE_UNSPECIFIED = 0; + + // Includes all file extensions not covered by another entry. Binary + // scanning attempts to convert the content of the file to utf_8 to scan + // the file. + // If you wish to avoid this fall back, specify one or more of the other + // FileType's in your storage scan. + BINARY_FILE = 1; + + // Included file extensions: + // asc,asp, aspx, brf, c, cc,cfm, cgi, cpp, csv, cxx, c++, cs, css, dart, + // dat, dot, eml,, epbub, ged, go, h, hh, hpp, hxx, h++, hs, html, htm, + // mkd, markdown, m, ml, mli, perl, pl, plist, pm, php, phtml, pht, + // properties, py, pyw, rb, rbw, rs, rss, rc, scala, sh, sql, swift, tex, + // shtml, shtm, xhtml, lhs, ics, ini, java, js, json, kix, kml, ocaml, md, + // txt, text, tsv, vb, vcard, vcs, wml, xcodeproj, xml, xsl, xsd, yml, yaml. + TEXT_FILE = 2; + + // Included file extensions: + // bmp, gif, jpg, jpeg, jpe, png. + // bytes_limit_per_file has no effect on image files. + // Image inspection is restricted to 'global', 'us', 'asia', and 'europe'. + IMAGE = 3; + + // Word files >30 MB will be scanned as binary files. + // Included file extensions: + // docx, dotx, docm, dotm + WORD = 5; + + // PDF files >30 MB will be scanned as binary files. + // Included file extensions: + // pdf + PDF = 6; + + // Included file extensions: + // avro + AVRO = 7; + + // Included file extensions: + // csv + CSV = 8; + + // Included file extensions: + // tsv + TSV = 9; + + // Powerpoint files >30 MB will be scanned as binary files. + // Included file extensions: + // pptx, pptm, potx, potm, pot + POWERPOINT = 11; + + // Excel files >30 MB will be scanned as binary files. + // Included file extensions: + // xlsx, xlsm, xltx, xltm + EXCEL = 12; +} + +// Message representing a set of files in a Cloud Storage bucket. Regular +// expressions are used to allow fine-grained control over which files in the +// bucket to include. +// +// Included files are those that match at least one item in `include_regex` and +// do not match any items in `exclude_regex`. Note that a file that matches +// items from both lists will _not_ be included. For a match to occur, the +// entire file path (i.e., everything in the url after the bucket name) must +// match the regular expression. +// +// For example, given the input `{bucket_name: "mybucket", include_regex: +// ["directory1/.*"], exclude_regex: +// ["directory1/excluded.*"]}`: +// +// * `gs://mybucket/directory1/myfile` will be included +// * `gs://mybucket/directory1/directory2/myfile` will be included (`.*` matches +// across `/`) +// * `gs://mybucket/directory0/directory1/myfile` will _not_ be included (the +// full path doesn't match any items in `include_regex`) +// * `gs://mybucket/directory1/excludedfile` will _not_ be included (the path +// matches an item in `exclude_regex`) +// +// If `include_regex` is left empty, it will match all files by default +// (this is equivalent to setting `include_regex: [".*"]`). +// +// Some other common use cases: +// +// * `{bucket_name: "mybucket", exclude_regex: [".*\.pdf"]}` will include all +// files in `mybucket` except for .pdf files +// * `{bucket_name: "mybucket", include_regex: ["directory/[^/]+"]}` will +// include all files directly under `gs://mybucket/directory/`, without matching +// across `/` +message CloudStorageRegexFileSet { + // The name of a Cloud Storage bucket. Required. + string bucket_name = 1; + + // A list of regular expressions matching file paths to include. All files in + // the bucket that match at least one of these regular expressions will be + // included in the set of files, except for those that also match an item in + // `exclude_regex`. Leaving this field empty will match all files by default + // (this is equivalent to including `.*` in the list). + // + // Regular expressions use RE2 + // [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found + // under the google/re2 repository on GitHub. + repeated string include_regex = 2; + + // A list of regular expressions matching file paths to exclude. All files in + // the bucket that match at least one of these regular expressions will be + // excluded from the scan. + // + // Regular expressions use RE2 + // [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found + // under the google/re2 repository on GitHub. + repeated string exclude_regex = 3; +} + +// Options defining a file or a set of files within a Cloud Storage +// bucket. +message CloudStorageOptions { + // Set of files to scan. + message FileSet { + // The Cloud Storage url of the file(s) to scan, in the format + // `gs:///`. Trailing wildcard in the path is allowed. + // + // If the url ends in a trailing slash, the bucket or directory represented + // by the url will be scanned non-recursively (content in sub-directories + // will not be scanned). This means that `gs://mybucket/` is equivalent to + // `gs://mybucket/*`, and `gs://mybucket/directory/` is equivalent to + // `gs://mybucket/directory/*`. + // + // Exactly one of `url` or `regex_file_set` must be set. + string url = 1; + + // The regex-filtered set of files to scan. Exactly one of `url` or + // `regex_file_set` must be set. + CloudStorageRegexFileSet regex_file_set = 2; + } + + // How to sample bytes if not all bytes are scanned. Meaningful only when used + // in conjunction with bytes_limit_per_file. If not specified, scanning would + // start from the top. + enum SampleMethod { + SAMPLE_METHOD_UNSPECIFIED = 0; + + // Scan from the top (default). + TOP = 1; + + // For each file larger than bytes_limit_per_file, randomly pick the offset + // to start scanning. The scanned bytes are contiguous. + RANDOM_START = 2; + } + + // The set of one or more files to scan. + FileSet file_set = 1; + + // Max number of bytes to scan from a file. If a scanned file's size is bigger + // than this value then the rest of the bytes are omitted. Only one + // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. + // Cannot be set if de-identification is requested. + int64 bytes_limit_per_file = 4; + + // Max percentage of bytes to scan from a file. The rest are omitted. The + // number of bytes scanned is rounded down. Must be between 0 and 100, + // inclusively. Both 0 and 100 means no limit. Defaults to 0. Only one + // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. + // Cannot be set if de-identification is requested. + int32 bytes_limit_per_file_percent = 8; + + // List of file type groups to include in the scan. + // If empty, all files are scanned and available data format processors + // are applied. In addition, the binary content of the selected files + // is always scanned as well. + // Images are scanned only as binary if the specified region + // does not support image inspection and no file_types were specified. + // Image inspection is restricted to 'global', 'us', 'asia', and 'europe'. + repeated FileType file_types = 5; + + SampleMethod sample_method = 6; + + // Limits the number of files to scan to this percentage of the input FileSet. + // Number of files scanned is rounded down. Must be between 0 and 100, + // inclusively. Both 0 and 100 means no limit. Defaults to 0. + int32 files_limit_percent = 7; +} + +// Message representing a set of files in Cloud Storage. +message CloudStorageFileSet { + // The url, in the format `gs:///`. Trailing wildcard in the + // path is allowed. + string url = 1; +} + +// Message representing a single file or path in Cloud Storage. +message CloudStoragePath { + // A url representing a file or path (no wildcards) in Cloud Storage. + // Example: gs://[BUCKET_NAME]/dictionary.txt + string path = 1; +} + +// Options defining BigQuery table and row identifiers. +message BigQueryOptions { + // How to sample rows if not all rows are scanned. Meaningful only when used + // in conjunction with either rows_limit or rows_limit_percent. If not + // specified, rows are scanned in the order BigQuery reads them. + enum SampleMethod { + SAMPLE_METHOD_UNSPECIFIED = 0; + + // Scan groups of rows in the order BigQuery provides (default). Multiple + // groups of rows may be scanned in parallel, so results may not appear in + // the same order the rows are read. + TOP = 1; + + // Randomly pick groups of rows to scan. + RANDOM_START = 2; + } + + // Complete BigQuery table reference. + BigQueryTable table_reference = 1; + + // Table fields that may uniquely identify a row within the table. When + // `actions.saveFindings.outputConfig.table` is specified, the values of + // columns specified here are available in the output table under + // `location.content_locations.record_location.record_key.id_values`. Nested + // fields such as `person.birthdate.year` are allowed. + repeated FieldId identifying_fields = 2; + + // Max number of rows to scan. If the table has more rows than this value, the + // rest of the rows are omitted. If not set, or if set to 0, all rows will be + // scanned. Only one of rows_limit and rows_limit_percent can be specified. + // Cannot be used in conjunction with TimespanConfig. + int64 rows_limit = 3; + + // Max percentage of rows to scan. The rest are omitted. The number of rows + // scanned is rounded down. Must be between 0 and 100, inclusively. Both 0 and + // 100 means no limit. Defaults to 0. Only one of rows_limit and + // rows_limit_percent can be specified. Cannot be used in conjunction with + // TimespanConfig. + int32 rows_limit_percent = 6; + + SampleMethod sample_method = 4; + + // References to fields excluded from scanning. This allows you to skip + // inspection of entire columns which you know have no findings. + repeated FieldId excluded_fields = 5; + + // Limit scanning only to these fields. + repeated FieldId included_fields = 7; +} + +// Shared message indicating Cloud storage type. +message StorageConfig { + // Configuration of the timespan of the items to include in scanning. + // Currently only supported when inspecting Cloud Storage and BigQuery. + message TimespanConfig { + // Exclude files, tables, or rows older than this value. + // If not set, no lower time limit is applied. + google.protobuf.Timestamp start_time = 1; + + // Exclude files, tables, or rows newer than this value. + // If not set, no upper time limit is applied. + google.protobuf.Timestamp end_time = 2; + + // Specification of the field containing the timestamp of scanned items. + // Used for data sources like Datastore and BigQuery. + // + // For BigQuery + // + // If this value is not specified and the table was modified between the + // given start and end times, the entire table will be scanned. If this + // value is specified, then rows are filtered based on the given start and + // end times. Rows with a `NULL` value in the provided BigQuery column are + // skipped. + // Valid data types of the provided BigQuery column are: `INTEGER`, `DATE`, + // `TIMESTAMP`, and `DATETIME`. + // + // If your BigQuery table is [partitioned at ingestion + // time](https://cloud.google.com/bigquery/docs/partitioned-tables#ingestion_time), + // you can use any of the following pseudo-columns as your timestamp field. + // When used with Cloud DLP, these pseudo-column names are case sensitive. + // + //
    + //
  • _PARTITIONTIME
  • + //
  • _PARTITIONDATE
  • + //
  • _PARTITION_LOAD_TIME
  • + //
+ // + // For Datastore + // + // If this value is specified, then entities are filtered based on the given + // start and end times. If an entity does not contain the provided timestamp + // property or contains empty or invalid values, then it is included. + // Valid data types of the provided timestamp property are: `TIMESTAMP`. + // + // See the + // [known issue](https://cloud.google.com/dlp/docs/known-issues#bq-timespan) + // related to this operation. + FieldId timestamp_field = 3; + + // When the job is started by a JobTrigger we will automatically figure out + // a valid start_time to avoid scanning files that have not been modified + // since the last time the JobTrigger executed. This will be based on the + // time of the execution of the last run of the JobTrigger or the timespan + // end_time used in the last run of the JobTrigger. + bool enable_auto_population_of_timespan_config = 4; + } + + oneof type { + // Google Cloud Datastore options. + DatastoreOptions datastore_options = 2; + + // Cloud Storage options. + CloudStorageOptions cloud_storage_options = 3; + + // BigQuery options. + BigQueryOptions big_query_options = 4; + + // Hybrid inspection options. + HybridOptions hybrid_options = 9; + } + + TimespanConfig timespan_config = 6; +} + +// Configuration to control jobs where the content being inspected is outside +// of Google Cloud Platform. +message HybridOptions { + // A short description of where the data is coming from. Will be stored once + // in the job. 256 max length. + string description = 1; + + // These are labels that each inspection request must include within their + // 'finding_labels' map. Request may contain others, but any missing one of + // these will be rejected. + // + // Label keys must be between 1 and 63 characters long and must conform + // to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + // + // No more than 10 keys can be required. + repeated string required_finding_label_keys = 2; + + // To organize findings, these labels will be added to each finding. + // + // Label keys must be between 1 and 63 characters long and must conform + // to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + // + // Label values must be between 0 and 63 characters long and must conform + // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + // + // No more than 10 labels can be associated with a given finding. + // + // Examples: + // * `"environment" : "production"` + // * `"pipeline" : "etl"` + map labels = 3; + + // If the container is a table, additional information to make findings + // meaningful such as the columns that are primary keys. + TableOptions table_options = 4; +} + +// Row key for identifying a record in BigQuery table. +message BigQueryKey { + // Complete BigQuery table reference. + BigQueryTable table_reference = 1; + + // Row number inferred at the time the table was scanned. This value is + // nondeterministic, cannot be queried, and may be null for inspection + // jobs. To locate findings within a table, specify + // `inspect_job.storage_config.big_query_options.identifying_fields` in + // `CreateDlpJobRequest`. + int64 row_number = 2; +} + +// Record key for a finding in Cloud Datastore. +message DatastoreKey { + // Datastore entity key. + Key entity_key = 1; +} + +// A unique identifier for a Datastore entity. +// If a key's partition ID or any of its path kinds or names are +// reserved/read-only, the key is reserved/read-only. +// A reserved/read-only key is forbidden in certain documented contexts. +message Key { + // A (kind, ID/name) pair used to construct a key path. + // + // If either name or ID is set, the element is complete. + // If neither is set, the element is incomplete. + message PathElement { + // The kind of the entity. + // A kind matching regex `__.*__` is reserved/read-only. + // A kind must not contain more than 1500 bytes when UTF-8 encoded. + // Cannot be `""`. + string kind = 1; + + // The type of ID. + oneof id_type { + // The auto-allocated ID of the entity. + // Never equal to zero. Values less than zero are discouraged and may not + // be supported in the future. + int64 id = 2; + + // The name of the entity. + // A name matching regex `__.*__` is reserved/read-only. + // A name must not be more than 1500 bytes when UTF-8 encoded. + // Cannot be `""`. + string name = 3; + } + } + + // Entities are partitioned into subsets, currently identified by a project + // ID and namespace ID. + // Queries are scoped to a single partition. + PartitionId partition_id = 1; + + // The entity path. + // An entity path consists of one or more elements composed of a kind and a + // string or numerical identifier, which identify entities. The first + // element identifies a _root entity_, the second element identifies + // a _child_ of the root entity, the third element identifies a child of the + // second entity, and so forth. The entities identified by all prefixes of + // the path are called the element's _ancestors_. + // + // A path can never be empty, and a path can have at most 100 elements. + repeated PathElement path = 2; +} + +// Message for a unique key indicating a record that contains a finding. +message RecordKey { + oneof type { + DatastoreKey datastore_key = 2; + + BigQueryKey big_query_key = 3; + } + + // Values of identifying columns in the given row. Order of values matches + // the order of `identifying_fields` specified in the scanning request. + repeated string id_values = 5; +} + +// Message defining the location of a BigQuery table. A table is uniquely +// identified by its project_id, dataset_id, and table_name. Within a query +// a table is often referenced with a string in the format of: +// `:.` or +// `..`. +message BigQueryTable { + // The Google Cloud Platform project ID of the project containing the table. + // If omitted, project ID is inferred from the API call. + string project_id = 1; + + // Dataset ID of the table. + string dataset_id = 2; + + // Name of the table. + string table_id = 3; +} + +// Message defining a field of a BigQuery table. +message BigQueryField { + // Source table of the field. + BigQueryTable table = 1; + + // Designated field in the BigQuery table. + FieldId field = 2; +} + +// An entity in a dataset is a field or set of fields that correspond to a +// single person. For example, in medical records the `EntityId` might be a +// patient identifier, or for financial records it might be an account +// identifier. This message is used when generalizations or analysis must take +// into account that multiple rows correspond to the same entity. +message EntityId { + // Composite key indicating which field contains the entity identifier. + FieldId field = 1; +} + +// Instructions regarding the table content being inspected. +message TableOptions { + // The columns that are the primary keys for table objects included in + // ContentItem. A copy of this cell's value will stored alongside alongside + // each finding so that the finding can be traced to the specific row it came + // from. No more than 3 may be provided. + repeated FieldId identifying_fields = 1; +} diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.activate_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.activate_job_trigger.js new file mode 100644 index 00000000000..b126e882810 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.activate_job_trigger.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 dlp_v2_generated_DlpService_ActivateJobTrigger_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 trigger to activate, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callActivateJobTrigger() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.activateJobTrigger(request); + console.log(response); + } + + callActivateJobTrigger(); + // [END dlp_v2_generated_DlpService_ActivateJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.cancel_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.cancel_dlp_job.js new file mode 100644 index 00000000000..9163ea6292d --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.cancel_dlp_job.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 dlp_v2_generated_DlpService_CancelDlpJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 DlpJob resource to be cancelled. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callCancelDlpJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.cancelDlpJob(request); + console.log(response); + } + + callCancelDlpJob(); + // [END dlp_v2_generated_DlpService_CancelDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_deidentify_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_deidentify_template.js new file mode 100644 index 00000000000..f1a86d00491 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_deidentify_template.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, deidentifyTemplate) { + // [START dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have specified a processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Required. The DeidentifyTemplate to create. + */ + // const deidentifyTemplate = {} + /** + * The template id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + */ + // const templateId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callCreateDeidentifyTemplate() { + // Construct request + const request = { + parent, + deidentifyTemplate, + }; + + // Run request + const response = await dlpClient.createDeidentifyTemplate(request); + console.log(response); + } + + callCreateDeidentifyTemplate(); + // [END dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_dlp_job.js new file mode 100644 index 00000000000..ed22fa5331e --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_dlp_job.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) { + // [START dlp_v2_generated_DlpService_CreateDlpJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + * The format of this value varies depending on whether you have specified a + * processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * An inspection job scans a storage repository for InfoTypes. + */ + // const inspectJob = {} + /** + * A risk analysis job calculates re-identification risk metrics for a + * BigQuery table. + */ + // const riskJob = {} + /** + * The job id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + */ + // const jobId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callCreateDlpJob() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dlpClient.createDlpJob(request); + console.log(response); + } + + callCreateDlpJob(); + // [END dlp_v2_generated_DlpService_CreateDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_inspect_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_inspect_template.js new file mode 100644 index 00000000000..b5e1abc9eaa --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_inspect_template.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, inspectTemplate) { + // [START dlp_v2_generated_DlpService_CreateInspectTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have specified a processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Required. The InspectTemplate to create. + */ + // const inspectTemplate = {} + /** + * The template id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + */ + // const templateId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callCreateInspectTemplate() { + // Construct request + const request = { + parent, + inspectTemplate, + }; + + // Run request + const response = await dlpClient.createInspectTemplate(request); + console.log(response); + } + + callCreateInspectTemplate(); + // [END dlp_v2_generated_DlpService_CreateInspectTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_job_trigger.js new file mode 100644 index 00000000000..52a10923012 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_job_trigger.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, jobTrigger) { + // [START dlp_v2_generated_DlpService_CreateJobTrigger_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + * The format of this value varies depending on whether you have specified a + * processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Required. The JobTrigger to create. + */ + // const jobTrigger = {} + /** + * The trigger id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + */ + // const triggerId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callCreateJobTrigger() { + // Construct request + const request = { + parent, + jobTrigger, + }; + + // Run request + const response = await dlpClient.createJobTrigger(request); + console.log(response); + } + + callCreateJobTrigger(); + // [END dlp_v2_generated_DlpService_CreateJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_stored_info_type.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_stored_info_type.js new file mode 100644 index 00000000000..fcba969fbef --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_stored_info_type.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, config) { + // [START dlp_v2_generated_DlpService_CreateStoredInfoType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have specified a processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Required. Configuration of the storedInfoType to create. + */ + // const config = {} + /** + * The storedInfoType ID can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + */ + // const storedInfoTypeId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callCreateStoredInfoType() { + // Construct request + const request = { + parent, + config, + }; + + // Run request + const response = await dlpClient.createStoredInfoType(request); + console.log(response); + } + + callCreateStoredInfoType(); + // [END dlp_v2_generated_DlpService_CreateStoredInfoType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.deidentify_content.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.deidentify_content.js new file mode 100644 index 00000000000..914636a1cf8 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.deidentify_content.js @@ -0,0 +1,109 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 dlp_v2_generated_DlpService_DeidentifyContent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Parent resource name. + * The format of this value varies depending on whether you have specified a + * processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Configuration for the de-identification of the content item. + * Items specified here will override the template referenced by the + * deidentify_template_name argument. + */ + // const deidentifyConfig = {} + /** + * Configuration for the inspector. + * Items specified here will override the template referenced by the + * inspect_template_name argument. + */ + // const inspectConfig = {} + /** + * The item to de-identify. Will be treated as text. + * This value must be of type + * Table google.privacy.dlp.v2.Table if your + * deidentify_config google.privacy.dlp.v2.DeidentifyContentRequest.deidentify_config + * is a + * RecordTransformations google.privacy.dlp.v2.RecordTransformations + * object. + */ + // const item = {} + /** + * Template to use. Any configuration directly specified in + * inspect_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + */ + // const inspectTemplateName = 'abc123' + /** + * Template to use. Any configuration directly specified in + * deidentify_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + */ + // const deidentifyTemplateName = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callDeidentifyContent() { + // Construct request + const request = { + }; + + // Run request + const response = await dlpClient.deidentifyContent(request); + console.log(response); + } + + callDeidentifyContent(); + // [END dlp_v2_generated_DlpService_DeidentifyContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_deidentify_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_deidentify_template.js new file mode 100644 index 00000000000..0c4352262fe --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_deidentify_template.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 dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 and deidentify template to be deleted, + * for example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callDeleteDeidentifyTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.deleteDeidentifyTemplate(request); + console.log(response); + } + + callDeleteDeidentifyTemplate(); + // [END dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_dlp_job.js new file mode 100644 index 00000000000..7c227fe4438 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_dlp_job.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 dlp_v2_generated_DlpService_DeleteDlpJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 DlpJob resource to be deleted. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callDeleteDlpJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.deleteDlpJob(request); + console.log(response); + } + + callDeleteDlpJob(); + // [END dlp_v2_generated_DlpService_DeleteDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_inspect_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_inspect_template.js new file mode 100644 index 00000000000..cf5d3da58e9 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_inspect_template.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 dlp_v2_generated_DlpService_DeleteInspectTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 and inspectTemplate to be deleted, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callDeleteInspectTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.deleteInspectTemplate(request); + console.log(response); + } + + callDeleteInspectTemplate(); + // [END dlp_v2_generated_DlpService_DeleteInspectTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_job_trigger.js new file mode 100644 index 00000000000..6b8c860ce36 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_job_trigger.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 dlp_v2_generated_DlpService_DeleteJobTrigger_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callDeleteJobTrigger() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.deleteJobTrigger(request); + console.log(response); + } + + callDeleteJobTrigger(); + // [END dlp_v2_generated_DlpService_DeleteJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_stored_info_type.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_stored_info_type.js new file mode 100644 index 00000000000..eb85ab85306 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_stored_info_type.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 dlp_v2_generated_DlpService_DeleteStoredInfoType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 and storedInfoType to be deleted, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callDeleteStoredInfoType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.deleteStoredInfoType(request); + console.log(response); + } + + callDeleteStoredInfoType(); + // [END dlp_v2_generated_DlpService_DeleteStoredInfoType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.finish_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.finish_dlp_job.js new file mode 100644 index 00000000000..0d84fd8ba8e --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.finish_dlp_job.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 dlp_v2_generated_DlpService_FinishDlpJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 DlpJob resource to be cancelled. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callFinishDlpJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.finishDlpJob(request); + console.log(response); + } + + callFinishDlpJob(); + // [END dlp_v2_generated_DlpService_FinishDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_deidentify_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_deidentify_template.js new file mode 100644 index 00000000000..de10069316a --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_deidentify_template.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 dlp_v2_generated_DlpService_GetDeidentifyTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 and deidentify template to be read, for + * example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callGetDeidentifyTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.getDeidentifyTemplate(request); + console.log(response); + } + + callGetDeidentifyTemplate(); + // [END dlp_v2_generated_DlpService_GetDeidentifyTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_dlp_job.js new file mode 100644 index 00000000000..bed4af7395e --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_dlp_job.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 dlp_v2_generated_DlpService_GetDlpJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require 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 DlpJob resource. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callGetDlpJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.getDlpJob(request); + console.log(response); + } + + callGetDlpJob(); + // [END dlp_v2_generated_DlpService_GetDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_inspect_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_inspect_template.js new file mode 100644 index 00000000000..63d837a3413 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_inspect_template.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 dlp_v2_generated_DlpService_GetInspectTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 and inspectTemplate to be read, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callGetInspectTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.getInspectTemplate(request); + console.log(response); + } + + callGetInspectTemplate(); + // [END dlp_v2_generated_DlpService_GetInspectTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_job_trigger.js new file mode 100644 index 00000000000..e28ad5f4b32 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_job_trigger.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 dlp_v2_generated_DlpService_GetJobTrigger_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callGetJobTrigger() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.getJobTrigger(request); + console.log(response); + } + + callGetJobTrigger(); + // [END dlp_v2_generated_DlpService_GetJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_stored_info_type.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_stored_info_type.js new file mode 100644 index 00000000000..72c4d56842f --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_stored_info_type.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 dlp_v2_generated_DlpService_GetStoredInfoType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 and storedInfoType to be read, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callGetStoredInfoType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.getStoredInfoType(request); + console.log(response); + } + + callGetStoredInfoType(); + // [END dlp_v2_generated_DlpService_GetStoredInfoType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_dlp_job.js new file mode 100644 index 00000000000..6d811586a7f --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_dlp_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 dlp_v2_generated_DlpService_HybridInspectDlpJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 job to execute a hybrid inspect on, for example + * `projects/dlp-test-project/dlpJob/53234423`. + */ + // const name = 'abc123' + /** + * The item to inspect. + */ + // const hybridItem = {} + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callHybridInspectDlpJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.hybridInspectDlpJob(request); + console.log(response); + } + + callHybridInspectDlpJob(); + // [END dlp_v2_generated_DlpService_HybridInspectDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_job_trigger.js new file mode 100644 index 00000000000..18fbecf35ba --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_job_trigger.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 dlp_v2_generated_DlpService_HybridInspectJobTrigger_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 trigger to execute a hybrid inspect on, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + */ + // const name = 'abc123' + /** + * The item to inspect. + */ + // const hybridItem = {} + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callHybridInspectJobTrigger() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.hybridInspectJobTrigger(request); + console.log(response); + } + + callHybridInspectJobTrigger(); + // [END dlp_v2_generated_DlpService_HybridInspectJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.inspect_content.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.inspect_content.js new file mode 100644 index 00000000000..08c1d913674 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.inspect_content.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() { + // [START dlp_v2_generated_DlpService_InspectContent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Parent resource name. + * The format of this value varies depending on whether you have specified a + * processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Configuration for the inspector. What specified here will override + * the template referenced by the inspect_template_name argument. + */ + // const inspectConfig = {} + /** + * The item to inspect. + */ + // const item = {} + /** + * Template to use. Any configuration directly specified in + * inspect_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + */ + // const inspectTemplateName = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callInspectContent() { + // Construct request + const request = { + }; + + // Run request + const response = await dlpClient.inspectContent(request); + console.log(response); + } + + callInspectContent(); + // [END dlp_v2_generated_DlpService_InspectContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_deidentify_templates.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_deidentify_templates.js new file mode 100644 index 00000000000..65af2f2e5db --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_deidentify_templates.js @@ -0,0 +1,101 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated 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 dlp_v2_generated_DlpService_ListDeidentifyTemplates_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have specified a processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Page token to continue retrieval. Comes from previous call + * to `ListDeidentifyTemplates`. + */ + // const pageToken = 'abc123' + /** + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + */ + // const pageSize = 1234 + /** + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * Example: `name asc,update_time, create_time desc` + * Supported fields are: + * - `create_time`: corresponds to the time the template was created. + * - `update_time`: corresponds to the time the template was last updated. + * - `name`: corresponds to the template's name. + * - `display_name`: corresponds to the template's display name. + */ + // const orderBy = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callListDeidentifyTemplates() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dlpClient.listDeidentifyTemplatesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDeidentifyTemplates(); + // [END dlp_v2_generated_DlpService_ListDeidentifyTemplates_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_dlp_jobs.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_dlp_jobs.js new file mode 100644 index 00000000000..d4cba6b16a3 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_dlp_jobs.js @@ -0,0 +1,125 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated 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 dlp_v2_generated_DlpService_ListDlpJobs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + * The format of this value varies depending on whether you have specified a + * processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Allows filtering. + * Supported syntax: + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of `{field} {operator} {value}`. + * * Supported fields/values for inspect jobs: + * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - `trigger_name` - The name of the trigger that created the job. + * - 'end_time` - Corresponds to the time the job finished. + * - 'start_time` - Corresponds to the time the job finished. + * * Supported fields for risk analysis jobs: + * - `state` - RUNNING|CANCELED|FINISHED|FAILED + * - 'end_time` - Corresponds to the time the job finished. + * - 'start_time` - Corresponds to the time the job finished. + * * The operator must be `=` or `!=`. + * Examples: + * * inspected_storage = cloud_storage AND state = done + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = done OR state = canceled) + * * end_time > \"2017-12-12T00:00:00+00:00\" + * The length of this field should be no more than 500 characters. + */ + // const filter = 'abc123' + /** + * The standard list page size. + */ + // const pageSize = 1234 + /** + * The standard list page token. + */ + // const pageToken = 'abc123' + /** + * The type of job. Defaults to `DlpJobType.INSPECT` + */ + // const type = {} + /** + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * Example: `name asc, end_time asc, create_time desc` + * Supported fields are: + * - `create_time`: corresponds to the time the job was created. + * - `end_time`: corresponds to the time the job ended. + * - `name`: corresponds to the job's name. + * - `state`: corresponds to `state` + */ + // const orderBy = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callListDlpJobs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dlpClient.listDlpJobsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDlpJobs(); + // [END dlp_v2_generated_DlpService_ListDlpJobs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_info_types.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_info_types.js new file mode 100644 index 00000000000..3e30f0c394a --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_info_types.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 dlp_v2_generated_DlpService_ListInfoTypes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It 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 resource name. + * The format of this value is as follows: + * locations/LOCATION_ID + */ + // const parent = 'abc123' + /** + * BCP-47 language code for localized infoType friendly + * names. If omitted, or if localized strings are not available, + * en-US strings will be returned. + */ + // const languageCode = 'abc123' + /** + * filter to only return infoTypes supported by certain parts of the + * API. Defaults to supported_by=INSPECT. + */ + // const filter = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callListInfoTypes() { + // Construct request + const request = { + }; + + // Run request + const response = await dlpClient.listInfoTypes(request); + console.log(response); + } + + callListInfoTypes(); + // [END dlp_v2_generated_DlpService_ListInfoTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_inspect_templates.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_inspect_templates.js new file mode 100644 index 00000000000..23830cc72d1 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_inspect_templates.js @@ -0,0 +1,101 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated 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 dlp_v2_generated_DlpService_ListInspectTemplates_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have specified a processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Page token to continue retrieval. Comes from previous call + * to `ListInspectTemplates`. + */ + // const pageToken = 'abc123' + /** + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + */ + // const pageSize = 1234 + /** + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * Example: `name asc,update_time, create_time desc` + * Supported fields are: + * - `create_time`: corresponds to the time the template was created. + * - `update_time`: corresponds to the time the template was last updated. + * - `name`: corresponds to the template's name. + * - `display_name`: corresponds to the template's display name. + */ + // const orderBy = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callListInspectTemplates() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dlpClient.listInspectTemplatesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListInspectTemplates(); + // [END dlp_v2_generated_DlpService_ListInspectTemplates_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_job_triggers.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_job_triggers.js new file mode 100644 index 00000000000..32c4f39d06b --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_job_triggers.js @@ -0,0 +1,125 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated 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 dlp_v2_generated_DlpService_ListJobTriggers_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + * The format of this value varies depending on whether you have specified a + * processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Page token to continue retrieval. Comes from previous call + * to ListJobTriggers. `order_by` field must not + * change for subsequent calls. + */ + // const pageToken = 'abc123' + /** + * Size of the page, can be limited by a server. + */ + // const pageSize = 1234 + /** + * Comma separated list of triggeredJob fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * Example: `name asc,update_time, create_time desc` + * Supported fields are: + * - `create_time`: corresponds to the time the JobTrigger was created. + * - `update_time`: corresponds to the time the JobTrigger was last updated. + * - `last_run_time`: corresponds to the last time the JobTrigger ran. + * - `name`: corresponds to the JobTrigger's name. + * - `display_name`: corresponds to the JobTrigger's display name. + * - `status`: corresponds to JobTrigger's status. + */ + // const orderBy = 'abc123' + /** + * Allows filtering. + * Supported syntax: + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of `{field} {operator} {value}`. + * * Supported fields/values for inspect triggers: + * - `status` - HEALTHY|PAUSED|CANCELLED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by + * quotation marks. Nanoseconds are ignored. + * - 'error_count' - Number of errors that have occurred while running. + * * The operator must be `=` or `!=` for status and inspected_storage. + * Examples: + * * inspected_storage = cloud_storage AND status = HEALTHY + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) + * * last_run_time > \"2017-12-12T00:00:00+00:00\" + * The length of this field should be no more than 500 characters. + */ + // const filter = 'abc123' + /** + * The type of jobs. Will use `DlpJobType.INSPECT` if not set. + */ + // const type = {} + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callListJobTriggers() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dlpClient.listJobTriggersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListJobTriggers(); + // [END dlp_v2_generated_DlpService_ListJobTriggers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_stored_info_types.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_stored_info_types.js new file mode 100644 index 00000000000..91d84fe85dd --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_stored_info_types.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 dlp_v2_generated_DlpService_ListStoredInfoTypes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have specified a processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Page token to continue retrieval. Comes from previous call + * to `ListStoredInfoTypes`. + */ + // const pageToken = 'abc123' + /** + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + */ + // const pageSize = 1234 + /** + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * Example: `name asc, display_name, create_time desc` + * Supported fields are: + * - `create_time`: corresponds to the time the most recent version of the + * resource was created. + * - `state`: corresponds to the state of the resource. + * - `name`: corresponds to resource name. + * - `display_name`: corresponds to info type's display name. + */ + // const orderBy = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callListStoredInfoTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dlpClient.listStoredInfoTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListStoredInfoTypes(); + // [END dlp_v2_generated_DlpService_ListStoredInfoTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.redact_image.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.redact_image.js new file mode 100644 index 00000000000..419fb8ab927 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.redact_image.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() { + // [START dlp_v2_generated_DlpService_RedactImage_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Parent resource name. + * The format of this value varies depending on whether you have specified a + * processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Configuration for the inspector. + */ + // const inspectConfig = {} + /** + * The configuration for specifying what content to redact from images. + */ + // const imageRedactionConfigs = [1,2,3,4] + /** + * Whether the response should include findings along with the redacted + * image. + */ + // const includeFindings = true + /** + * The content must be PNG, JPEG, SVG or BMP. + */ + // const byteItem = {} + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callRedactImage() { + // Construct request + const request = { + }; + + // Run request + const response = await dlpClient.redactImage(request); + console.log(response); + } + + callRedactImage(); + // [END dlp_v2_generated_DlpService_RedactImage_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.reidentify_content.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.reidentify_content.js new file mode 100644 index 00000000000..1db23fa5a1a --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.reidentify_content.js @@ -0,0 +1,110 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated 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 dlp_v2_generated_DlpService_ReidentifyContent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 resource name. + * The format of this value varies depending on whether you have specified a + * processing + * location (https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Configuration for the re-identification of the content item. + * This field shares the same proto message type that is used for + * de-identification, however its usage here is for the reversal of the + * previous de-identification. Re-identification is performed by examining + * the transformations used to de-identify the items and executing the + * reverse. This requires that only reversible transformations + * be provided here. The reversible transformations are: + * - `CryptoDeterministicConfig` + * - `CryptoReplaceFfxFpeConfig` + */ + // const reidentifyConfig = {} + /** + * Configuration for the inspector. + */ + // const inspectConfig = {} + /** + * The item to re-identify. Will be treated as text. + */ + // const item = {} + /** + * Template to use. Any configuration directly specified in + * `inspect_config` will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + */ + // const inspectTemplateName = 'abc123' + /** + * Template to use. References an instance of `DeidentifyTemplate`. + * Any configuration directly specified in `reidentify_config` or + * `inspect_config` will override those set in the template. The + * `DeidentifyTemplate` used must include only reversible transformations. + * Singular fields that are set in this request will replace their + * corresponding fields in the template. Repeated fields are appended. + * Singular sub-messages and groups are recursively merged. + */ + // const reidentifyTemplateName = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callReidentifyContent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dlpClient.reidentifyContent(request); + console.log(response); + } + + callReidentifyContent(); + // [END dlp_v2_generated_DlpService_ReidentifyContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_deidentify_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_deidentify_template.js new file mode 100644 index 00000000000..2a1b632f436 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_deidentify_template.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(name) { + // [START dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 organization and deidentify template to be updated, for + * example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + */ + // const name = 'abc123' + /** + * New DeidentifyTemplate value. + */ + // const deidentifyTemplate = {} + /** + * Mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callUpdateDeidentifyTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.updateDeidentifyTemplate(request); + console.log(response); + } + + callUpdateDeidentifyTemplate(); + // [END dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_inspect_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_inspect_template.js new file mode 100644 index 00000000000..69a1b2c0cb3 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_inspect_template.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(name) { + // [START dlp_v2_generated_DlpService_UpdateInspectTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 organization and inspectTemplate to be updated, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + */ + // const name = 'abc123' + /** + * New InspectTemplate value. + */ + // const inspectTemplate = {} + /** + * Mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callUpdateInspectTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.updateInspectTemplate(request); + console.log(response); + } + + callUpdateInspectTemplate(); + // [END dlp_v2_generated_DlpService_UpdateInspectTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_job_trigger.js new file mode 100644 index 00000000000..24becdb8f7f --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_job_trigger.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(name) { + // [START dlp_v2_generated_DlpService_UpdateJobTrigger_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + */ + // const name = 'abc123' + /** + * New JobTrigger value. + */ + // const jobTrigger = {} + /** + * Mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callUpdateJobTrigger() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.updateJobTrigger(request); + console.log(response); + } + + callUpdateJobTrigger(); + // [END dlp_v2_generated_DlpService_UpdateJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_stored_info_type.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_stored_info_type.js new file mode 100644 index 00000000000..bde7297da18 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_stored_info_type.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 dlp_v2_generated_DlpService_UpdateStoredInfoType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will 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 organization and storedInfoType to be updated, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + */ + // const name = 'abc123' + /** + * Updated configuration for the storedInfoType. If not provided, a new + * version of the storedInfoType will be created with the existing + * configuration. + */ + // const config = {} + /** + * Mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function callUpdateStoredInfoType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.updateStoredInfoType(request); + console.log(response); + } + + callUpdateStoredInfoType(); + // [END dlp_v2_generated_DlpService_UpdateStoredInfoType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json new file mode 100644 index 00000000000..50feadaad95 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json @@ -0,0 +1,1671 @@ +{ + "clientLibrary": { + "name": "nodejs-dlp", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.privacy.dlp.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "dlp_v2_generated_DlpService_InspectContent_async", + "title": "DlpService inspectContent Sample", + "origin": "API_DEFINITION", + "description": " Finds potentially sensitive info in content. This method has limits on input size, processing time, and output size. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated. For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images and https://cloud.google.com/dlp/docs/inspecting-text,", + "canonical": true, + "file": "dlp_service.inspect_content.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "InspectContent", + "fullName": "google.privacy.dlp.v2.DlpService.InspectContent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "inspect_config", + "type": ".google.privacy.dlp.v2.InspectConfig" + }, + { + "name": "item", + "type": ".google.privacy.dlp.v2.ContentItem" + }, + { + "name": "inspect_template_name", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.InspectContentResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "InspectContent", + "fullName": "google.privacy.dlp.v2.DlpService.InspectContent", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_RedactImage_async", + "title": "DlpService redactImage Sample", + "origin": "API_DEFINITION", + "description": " Redacts potentially sensitive info from an image. This method has limits on input size, processing time, and output size. See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to learn more. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", + "canonical": true, + "file": "dlp_service.redact_image.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RedactImage", + "fullName": "google.privacy.dlp.v2.DlpService.RedactImage", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + }, + { + "name": "inspect_config", + "type": ".google.privacy.dlp.v2.InspectConfig" + }, + { + "name": "image_redaction_configs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "include_findings", + "type": "TYPE_BOOL" + }, + { + "name": "byte_item", + "type": ".google.privacy.dlp.v2.ByteContentItem" + } + ], + "resultType": ".google.privacy.dlp.v2.RedactImageResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "RedactImage", + "fullName": "google.privacy.dlp.v2.DlpService.RedactImage", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_DeidentifyContent_async", + "title": "DlpService deidentifyContent Sample", + "origin": "API_DEFINITION", + "description": " De-identifies potentially sensitive info from a ContentItem. This method has limits on input size and output size. See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to learn more. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", + "canonical": true, + "file": "dlp_service.deidentify_content.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 101, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeidentifyContent", + "fullName": "google.privacy.dlp.v2.DlpService.DeidentifyContent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "deidentify_config", + "type": ".google.privacy.dlp.v2.DeidentifyConfig" + }, + { + "name": "inspect_config", + "type": ".google.privacy.dlp.v2.InspectConfig" + }, + { + "name": "item", + "type": ".google.privacy.dlp.v2.ContentItem" + }, + { + "name": "inspect_template_name", + "type": "TYPE_STRING" + }, + { + "name": "deidentify_template_name", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.DeidentifyContentResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "DeidentifyContent", + "fullName": "google.privacy.dlp.v2.DlpService.DeidentifyContent", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_ReidentifyContent_async", + "title": "DlpService reidentifyContent Sample", + "origin": "API_DEFINITION", + "description": " Re-identifies content that has been de-identified. See https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example to learn more.", + "canonical": true, + "file": "dlp_service.reidentify_content.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 102, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReidentifyContent", + "fullName": "google.privacy.dlp.v2.DlpService.ReidentifyContent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "reidentify_config", + "type": ".google.privacy.dlp.v2.DeidentifyConfig" + }, + { + "name": "inspect_config", + "type": ".google.privacy.dlp.v2.InspectConfig" + }, + { + "name": "item", + "type": ".google.privacy.dlp.v2.ContentItem" + }, + { + "name": "inspect_template_name", + "type": "TYPE_STRING" + }, + { + "name": "reidentify_template_name", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.ReidentifyContentResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "ReidentifyContent", + "fullName": "google.privacy.dlp.v2.DlpService.ReidentifyContent", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_ListInfoTypes_async", + "title": "DlpService listInfoTypes Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of the sensitive information types that DLP API supports. See https://cloud.google.com/dlp/docs/infotypes-reference to learn more.", + "canonical": true, + "file": "dlp_service.list_info_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListInfoTypes", + "fullName": "google.privacy.dlp.v2.DlpService.ListInfoTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.ListInfoTypesResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "ListInfoTypes", + "fullName": "google.privacy.dlp.v2.DlpService.ListInfoTypes", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_CreateInspectTemplate_async", + "title": "DlpService createInspectTemplate Sample", + "origin": "API_DEFINITION", + "description": " Creates an InspectTemplate for reusing frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", + "canonical": true, + "file": "dlp_service.create_inspect_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateInspectTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.CreateInspectTemplate", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "inspect_template", + "type": ".google.privacy.dlp.v2.InspectTemplate" + }, + { + "name": "template_id", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.InspectTemplate", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "CreateInspectTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.CreateInspectTemplate", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_UpdateInspectTemplate_async", + "title": "DlpService updateInspectTemplate Sample", + "origin": "API_DEFINITION", + "description": " Updates the InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", + "canonical": true, + "file": "dlp_service.update_inspect_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateInspectTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.UpdateInspectTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "inspect_template", + "type": ".google.privacy.dlp.v2.InspectTemplate" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.privacy.dlp.v2.InspectTemplate", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "UpdateInspectTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.UpdateInspectTemplate", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_GetInspectTemplate_async", + "title": "DlpService getInspectTemplate Sample", + "origin": "API_DEFINITION", + "description": " Gets an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", + "canonical": true, + "file": "dlp_service.get_inspect_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetInspectTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.GetInspectTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.InspectTemplate", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "GetInspectTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.GetInspectTemplate", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_ListInspectTemplates_async", + "title": "DlpService listInspectTemplates Sample", + "origin": "API_DEFINITION", + "description": " Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", + "canonical": true, + "file": "dlp_service.list_inspect_templates.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListInspectTemplates", + "fullName": "google.privacy.dlp.v2.DlpService.ListInspectTemplates", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.ListInspectTemplatesResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "ListInspectTemplates", + "fullName": "google.privacy.dlp.v2.DlpService.ListInspectTemplates", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_DeleteInspectTemplate_async", + "title": "DlpService deleteInspectTemplate Sample", + "origin": "API_DEFINITION", + "description": " Deletes an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", + "canonical": true, + "file": "dlp_service.delete_inspect_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteInspectTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.DeleteInspectTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "DeleteInspectTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.DeleteInspectTemplate", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async", + "title": "DlpService createDeidentifyTemplate Sample", + "origin": "API_DEFINITION", + "description": " Creates a DeidentifyTemplate for reusing frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", + "canonical": true, + "file": "dlp_service.create_deidentify_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDeidentifyTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.CreateDeidentifyTemplate", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "deidentify_template", + "type": ".google.privacy.dlp.v2.DeidentifyTemplate" + }, + { + "name": "template_id", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "CreateDeidentifyTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.CreateDeidentifyTemplate", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async", + "title": "DlpService updateDeidentifyTemplate Sample", + "origin": "API_DEFINITION", + "description": " Updates the DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", + "canonical": true, + "file": "dlp_service.update_deidentify_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDeidentifyTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.UpdateDeidentifyTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "deidentify_template", + "type": ".google.privacy.dlp.v2.DeidentifyTemplate" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "UpdateDeidentifyTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.UpdateDeidentifyTemplate", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_GetDeidentifyTemplate_async", + "title": "DlpService getDeidentifyTemplate Sample", + "origin": "API_DEFINITION", + "description": " Gets a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", + "canonical": true, + "file": "dlp_service.get_deidentify_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDeidentifyTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.GetDeidentifyTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "GetDeidentifyTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.GetDeidentifyTemplate", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_ListDeidentifyTemplates_async", + "title": "DlpService listDeidentifyTemplates Sample", + "origin": "API_DEFINITION", + "description": " Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", + "canonical": true, + "file": "dlp_service.list_deidentify_templates.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDeidentifyTemplates", + "fullName": "google.privacy.dlp.v2.DlpService.ListDeidentifyTemplates", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.ListDeidentifyTemplatesResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "ListDeidentifyTemplates", + "fullName": "google.privacy.dlp.v2.DlpService.ListDeidentifyTemplates", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async", + "title": "DlpService deleteDeidentifyTemplate Sample", + "origin": "API_DEFINITION", + "description": " Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", + "canonical": true, + "file": "dlp_service.delete_deidentify_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDeidentifyTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.DeleteDeidentifyTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "DeleteDeidentifyTemplate", + "fullName": "google.privacy.dlp.v2.DlpService.DeleteDeidentifyTemplate", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_CreateJobTrigger_async", + "title": "DlpService createJobTrigger Sample", + "origin": "API_DEFINITION", + "description": " Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", + "canonical": true, + "file": "dlp_service.create_job_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.CreateJobTrigger", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "job_trigger", + "type": ".google.privacy.dlp.v2.JobTrigger" + }, + { + "name": "trigger_id", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.JobTrigger", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "CreateJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.CreateJobTrigger", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_UpdateJobTrigger_async", + "title": "DlpService updateJobTrigger Sample", + "origin": "API_DEFINITION", + "description": " Updates a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", + "canonical": true, + "file": "dlp_service.update_job_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.UpdateJobTrigger", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "job_trigger", + "type": ".google.privacy.dlp.v2.JobTrigger" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.privacy.dlp.v2.JobTrigger", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "UpdateJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.UpdateJobTrigger", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_HybridInspectJobTrigger_async", + "title": "DlpService hybridInspectJobTrigger Sample", + "origin": "API_DEFINITION", + "description": " Inspect hybrid content and store findings to a trigger. The inspection will be processed asynchronously. To review the findings monitor the jobs within the trigger.", + "canonical": true, + "file": "dlp_service.hybrid_inspect_job_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "HybridInspectJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.HybridInspectJobTrigger", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "hybrid_item", + "type": ".google.privacy.dlp.v2.HybridContentItem" + } + ], + "resultType": ".google.privacy.dlp.v2.HybridInspectResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "HybridInspectJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.HybridInspectJobTrigger", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_GetJobTrigger_async", + "title": "DlpService getJobTrigger Sample", + "origin": "API_DEFINITION", + "description": " Gets a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", + "canonical": true, + "file": "dlp_service.get_job_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.GetJobTrigger", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.JobTrigger", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "GetJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.GetJobTrigger", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_ListJobTriggers_async", + "title": "DlpService listJobTriggers Sample", + "origin": "API_DEFINITION", + "description": " Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", + "canonical": true, + "file": "dlp_service.list_job_triggers.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 117, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListJobTriggers", + "fullName": "google.privacy.dlp.v2.DlpService.ListJobTriggers", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": ".google.privacy.dlp.v2.DlpJobType" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.ListJobTriggersResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "ListJobTriggers", + "fullName": "google.privacy.dlp.v2.DlpService.ListJobTriggers", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_DeleteJobTrigger_async", + "title": "DlpService deleteJobTrigger Sample", + "origin": "API_DEFINITION", + "description": " Deletes a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", + "canonical": true, + "file": "dlp_service.delete_job_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.DeleteJobTrigger", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "DeleteJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.DeleteJobTrigger", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_ActivateJobTrigger_async", + "title": "DlpService activateJobTrigger Sample", + "origin": "API_DEFINITION", + "description": " Activate a job trigger. Causes the immediate execute of a trigger instead of waiting on the trigger event to occur.", + "canonical": true, + "file": "dlp_service.activate_job_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ActivateJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.ActivateJobTrigger", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.DlpJob", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "ActivateJobTrigger", + "fullName": "google.privacy.dlp.v2.DlpService.ActivateJobTrigger", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_CreateDlpJob_async", + "title": "DlpService createDlpJob Sample", + "origin": "API_DEFINITION", + "description": " Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", + "canonical": true, + "file": "dlp_service.create_dlp_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.CreateDlpJob", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "inspect_job", + "type": ".google.privacy.dlp.v2.InspectJobConfig" + }, + { + "name": "risk_job", + "type": ".google.privacy.dlp.v2.RiskAnalysisJobConfig" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.DlpJob", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "CreateDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.CreateDlpJob", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_ListDlpJobs_async", + "title": "DlpService listDlpJobs Sample", + "origin": "API_DEFINITION", + "description": " Lists DlpJobs that match the specified filter in the request. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", + "canonical": true, + "file": "dlp_service.list_dlp_jobs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 117, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDlpJobs", + "fullName": "google.privacy.dlp.v2.DlpService.ListDlpJobs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": ".google.privacy.dlp.v2.DlpJobType" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.ListDlpJobsResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "ListDlpJobs", + "fullName": "google.privacy.dlp.v2.DlpService.ListDlpJobs", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_GetDlpJob_async", + "title": "DlpService getDlpJob Sample", + "origin": "API_DEFINITION", + "description": " Gets the latest state of a long-running DlpJob. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", + "canonical": true, + "file": "dlp_service.get_dlp_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.GetDlpJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.DlpJob", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "GetDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.GetDlpJob", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_DeleteDlpJob_async", + "title": "DlpService deleteDlpJob Sample", + "origin": "API_DEFINITION", + "description": " Deletes a long-running DlpJob. This method indicates that the client is no longer interested in the DlpJob result. The job will be canceled if possible. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", + "canonical": true, + "file": "dlp_service.delete_dlp_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.DeleteDlpJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "DeleteDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.DeleteDlpJob", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_CancelDlpJob_async", + "title": "DlpService cancelDlpJob Sample", + "origin": "API_DEFINITION", + "description": " Starts asynchronous cancellation on a long-running DlpJob. The server makes a best effort to cancel the DlpJob, but success is not guaranteed. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", + "canonical": true, + "file": "dlp_service.cancel_dlp_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CancelDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.CancelDlpJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "CancelDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.CancelDlpJob", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_CreateStoredInfoType_async", + "title": "DlpService createStoredInfoType Sample", + "origin": "API_DEFINITION", + "description": " Creates a pre-built stored infoType to be used for inspection. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", + "canonical": true, + "file": "dlp_service.create_stored_info_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateStoredInfoType", + "fullName": "google.privacy.dlp.v2.DlpService.CreateStoredInfoType", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "config", + "type": ".google.privacy.dlp.v2.StoredInfoTypeConfig" + }, + { + "name": "stored_info_type_id", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.StoredInfoType", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "CreateStoredInfoType", + "fullName": "google.privacy.dlp.v2.DlpService.CreateStoredInfoType", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_UpdateStoredInfoType_async", + "title": "DlpService updateStoredInfoType Sample", + "origin": "API_DEFINITION", + "description": " Updates the stored infoType by creating a new version. The existing version will continue to be used until the new version is ready. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", + "canonical": true, + "file": "dlp_service.update_stored_info_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateStoredInfoType", + "fullName": "google.privacy.dlp.v2.DlpService.UpdateStoredInfoType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "config", + "type": ".google.privacy.dlp.v2.StoredInfoTypeConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.privacy.dlp.v2.StoredInfoType", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "UpdateStoredInfoType", + "fullName": "google.privacy.dlp.v2.DlpService.UpdateStoredInfoType", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_GetStoredInfoType_async", + "title": "DlpService getStoredInfoType Sample", + "origin": "API_DEFINITION", + "description": " Gets a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", + "canonical": true, + "file": "dlp_service.get_stored_info_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetStoredInfoType", + "fullName": "google.privacy.dlp.v2.DlpService.GetStoredInfoType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.StoredInfoType", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "GetStoredInfoType", + "fullName": "google.privacy.dlp.v2.DlpService.GetStoredInfoType", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_ListStoredInfoTypes_async", + "title": "DlpService listStoredInfoTypes Sample", + "origin": "API_DEFINITION", + "description": " Lists stored infoTypes. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", + "canonical": true, + "file": "dlp_service.list_stored_info_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 90, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListStoredInfoTypes", + "fullName": "google.privacy.dlp.v2.DlpService.ListStoredInfoTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "location_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.privacy.dlp.v2.ListStoredInfoTypesResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "ListStoredInfoTypes", + "fullName": "google.privacy.dlp.v2.DlpService.ListStoredInfoTypes", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_DeleteStoredInfoType_async", + "title": "DlpService deleteStoredInfoType Sample", + "origin": "API_DEFINITION", + "description": " Deletes a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", + "canonical": true, + "file": "dlp_service.delete_stored_info_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteStoredInfoType", + "fullName": "google.privacy.dlp.v2.DlpService.DeleteStoredInfoType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "DeleteStoredInfoType", + "fullName": "google.privacy.dlp.v2.DlpService.DeleteStoredInfoType", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_HybridInspectDlpJob_async", + "title": "DlpService hybridInspectDlpJob Sample", + "origin": "API_DEFINITION", + "description": " Inspect hybrid content and store findings to a job. To review the findings, inspect the job. Inspection will occur asynchronously.", + "canonical": true, + "file": "dlp_service.hybrid_inspect_dlp_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "HybridInspectDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.HybridInspectDlpJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "hybrid_item", + "type": ".google.privacy.dlp.v2.HybridContentItem" + } + ], + "resultType": ".google.privacy.dlp.v2.HybridInspectResponse", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "HybridInspectDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.HybridInspectDlpJob", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + }, + { + "regionTag": "dlp_v2_generated_DlpService_FinishDlpJob_async", + "title": "DlpService finishDlpJob Sample", + "origin": "API_DEFINITION", + "description": " Finish a running hybrid DlpJob. Triggers the finalization steps and running of any enabled actions that have not yet run.", + "canonical": true, + "file": "dlp_service.finish_dlp_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FinishDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.FinishDlpJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "DlpServiceClient", + "fullName": "google.privacy.dlp.v2.DlpServiceClient" + }, + "method": { + "shortName": "FinishDlpJob", + "fullName": "google.privacy.dlp.v2.DlpService.FinishDlpJob", + "service": { + "shortName": "DlpService", + "fullName": "google.privacy.dlp.v2.DlpService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/index.ts b/owl-bot-staging/google-privacy-dlp/v2/src/index.ts new file mode 100644 index 00000000000..651447ba32a --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/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 DlpServiceClient = v2.DlpServiceClient; +type DlpServiceClient = v2.DlpServiceClient; +export {v2, DlpServiceClient}; +export default {v2, DlpServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client.ts b/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client.ts new file mode 100644 index 00000000000..6c1c00bf3d9 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client.ts @@ -0,0 +1,5285 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, 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/dlp_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dlp_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Cloud Data Loss Prevention (DLP) API is a service that allows clients + * to detect the presence of Personally Identifiable Information (PII) and other + * privacy-sensitive data in user-supplied, unstructured data streams, like text + * blocks or images. + * The service also includes methods for sensitive data redaction and + * scheduling of data scans on Google Cloud Platform based data sets. + * + * To learn more about concepts and find how-to guides see + * https://cloud.google.com/dlp/docs/. + * @class + * @memberof v2 + */ +export class DlpServiceClient { + 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}; + dlpServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DlpServiceClient. + * + * @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 DlpServiceClient({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 DlpServiceClient; + 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 = { + findingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/findings/{finding}' + ), + organizationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}' + ), + organizationDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/deidentifyTemplates/{deidentify_template}' + ), + organizationInspectTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/inspectTemplates/{inspect_template}' + ), + organizationLocationDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}' + ), + organizationLocationInspectTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}' + ), + organizationLocationStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/storedInfoTypes/{stored_info_type}' + ), + organizationStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/storedInfoTypes/{stored_info_type}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/deidentifyTemplates/{deidentify_template}' + ), + projectDlpContentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/dlpContent' + ), + projectDlpJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/dlpJobs/{dlp_job}' + ), + projectInspectTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/inspectTemplates/{inspect_template}' + ), + projectJobTriggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/jobTriggers/{job_trigger}' + ), + projectLocationDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}' + ), + projectLocationDlpJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/dlpJobs/{dlp_job}' + ), + projectLocationInspectTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/inspectTemplates/{inspect_template}' + ), + projectLocationJobTriggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/jobTriggers/{job_trigger}' + ), + projectLocationStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/storedInfoTypes/{stored_info_type}' + ), + projectStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/storedInfoTypes/{stored_info_type}' + ), + }; + + // 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 = { + listInspectTemplates: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'inspectTemplates'), + listDeidentifyTemplates: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'deidentifyTemplates'), + listJobTriggers: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobTriggers'), + listDlpJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs'), + listStoredInfoTypes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'storedInfoTypes') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.privacy.dlp.v2.DlpService', 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.dlpServiceStub) { + return this.dlpServiceStub; + } + + // Put together the "service stub" for + // google.privacy.dlp.v2.DlpService. + this.dlpServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.privacy.dlp.v2.DlpService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.privacy.dlp.v2.DlpService, + 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 dlpServiceStubMethods = + ['inspectContent', 'redactImage', 'deidentifyContent', 'reidentifyContent', 'listInfoTypes', 'createInspectTemplate', 'updateInspectTemplate', 'getInspectTemplate', 'listInspectTemplates', 'deleteInspectTemplate', 'createDeidentifyTemplate', 'updateDeidentifyTemplate', 'getDeidentifyTemplate', 'listDeidentifyTemplates', 'deleteDeidentifyTemplate', 'createJobTrigger', 'updateJobTrigger', 'hybridInspectJobTrigger', 'getJobTrigger', 'listJobTriggers', 'deleteJobTrigger', 'activateJobTrigger', 'createDlpJob', 'listDlpJobs', 'getDlpJob', 'deleteDlpJob', 'cancelDlpJob', 'createStoredInfoType', 'updateStoredInfoType', 'getStoredInfoType', 'listStoredInfoTypes', 'deleteStoredInfoType', 'hybridInspectDlpJob', 'finishDlpJob']; + for (const methodName of dlpServiceStubMethods) { + const callPromise = this.dlpServiceStub.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.dlpServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dlp.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 'dlp.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 -- + // ------------------- +/** + * Finds potentially sensitive info in content. + * This method has limits on input size, processing time, and output size. + * + * When no InfoTypes or CustomInfoTypes are specified in this request, the + * system will automatically choose what detectors to run. By default this may + * be all types, but may change over time as detectors are updated. + * + * For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images + * and https://cloud.google.com/dlp/docs/inspecting-text, + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Parent resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig + * Configuration for the inspector. What specified here will override + * the template referenced by the inspect_template_name argument. + * @param {google.privacy.dlp.v2.ContentItem} request.item + * The item to inspect. + * @param {string} request.inspectTemplateName + * Template to use. Any configuration directly specified in + * inspect_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.InspectContentResponse|InspectContentResponse}. + * Please see the {@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/dlp_service.inspect_content.js + * region_tag:dlp_v2_generated_DlpService_InspectContent_async + */ + inspectContent( + request?: protos.google.privacy.dlp.v2.IInspectContentRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IInspectContentResponse, + protos.google.privacy.dlp.v2.IInspectContentRequest|undefined, {}|undefined + ]>; + inspectContent( + request: protos.google.privacy.dlp.v2.IInspectContentRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IInspectContentResponse, + protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, + {}|null|undefined>): void; + inspectContent( + request: protos.google.privacy.dlp.v2.IInspectContentRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IInspectContentResponse, + protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, + {}|null|undefined>): void; + inspectContent( + request?: protos.google.privacy.dlp.v2.IInspectContentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IInspectContentResponse, + protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IInspectContentResponse, + protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IInspectContentResponse, + protos.google.privacy.dlp.v2.IInspectContentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.inspectContent(request, options, callback); + } +/** + * Redacts potentially sensitive info from an image. + * This method has limits on input size, processing time, and output size. + * See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to + * learn more. + * + * When no InfoTypes or CustomInfoTypes are specified in this request, the + * system will automatically choose what detectors to run. By default this may + * be all types, but may change over time as detectors are updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Parent resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig + * Configuration for the inspector. + * @param {number[]} request.imageRedactionConfigs + * The configuration for specifying what content to redact from images. + * @param {boolean} request.includeFindings + * Whether the response should include findings along with the redacted + * image. + * @param {google.privacy.dlp.v2.ByteContentItem} request.byteItem + * The content must be PNG, JPEG, SVG or BMP. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.RedactImageResponse|RedactImageResponse}. + * Please see the {@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/dlp_service.redact_image.js + * region_tag:dlp_v2_generated_DlpService_RedactImage_async + */ + redactImage( + request?: protos.google.privacy.dlp.v2.IRedactImageRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IRedactImageResponse, + protos.google.privacy.dlp.v2.IRedactImageRequest|undefined, {}|undefined + ]>; + redactImage( + request: protos.google.privacy.dlp.v2.IRedactImageRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IRedactImageResponse, + protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, + {}|null|undefined>): void; + redactImage( + request: protos.google.privacy.dlp.v2.IRedactImageRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IRedactImageResponse, + protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, + {}|null|undefined>): void; + redactImage( + request?: protos.google.privacy.dlp.v2.IRedactImageRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IRedactImageResponse, + protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IRedactImageResponse, + protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IRedactImageResponse, + protos.google.privacy.dlp.v2.IRedactImageRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.redactImage(request, options, callback); + } +/** + * De-identifies potentially sensitive info from a ContentItem. + * This method has limits on input size and output size. + * See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to + * learn more. + * + * When no InfoTypes or CustomInfoTypes are specified in this request, the + * system will automatically choose what detectors to run. By default this may + * be all types, but may change over time as detectors are updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Parent resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {google.privacy.dlp.v2.DeidentifyConfig} request.deidentifyConfig + * Configuration for the de-identification of the content item. + * Items specified here will override the template referenced by the + * deidentify_template_name argument. + * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig + * Configuration for the inspector. + * Items specified here will override the template referenced by the + * inspect_template_name argument. + * @param {google.privacy.dlp.v2.ContentItem} request.item + * The item to de-identify. Will be treated as text. + * + * This value must be of type + * {@link protos.google.privacy.dlp.v2.Table|Table} if your + * {@link protos.google.privacy.dlp.v2.DeidentifyContentRequest.deidentify_config|deidentify_config} + * is a + * {@link protos.google.privacy.dlp.v2.RecordTransformations|RecordTransformations} + * object. + * @param {string} request.inspectTemplateName + * Template to use. Any configuration directly specified in + * inspect_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * @param {string} request.deidentifyTemplateName + * Template to use. Any configuration directly specified in + * deidentify_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.DeidentifyContentResponse|DeidentifyContentResponse}. + * Please see the {@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/dlp_service.deidentify_content.js + * region_tag:dlp_v2_generated_DlpService_DeidentifyContent_async + */ + deidentifyContent( + request?: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IDeidentifyContentResponse, + protos.google.privacy.dlp.v2.IDeidentifyContentRequest|undefined, {}|undefined + ]>; + deidentifyContent( + request: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IDeidentifyContentResponse, + protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, + {}|null|undefined>): void; + deidentifyContent( + request: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IDeidentifyContentResponse, + protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, + {}|null|undefined>): void; + deidentifyContent( + request?: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IDeidentifyContentResponse, + protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IDeidentifyContentResponse, + protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IDeidentifyContentResponse, + protos.google.privacy.dlp.v2.IDeidentifyContentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.deidentifyContent(request, options, callback); + } +/** + * Re-identifies content that has been de-identified. + * See + * https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example + * to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {google.privacy.dlp.v2.DeidentifyConfig} request.reidentifyConfig + * Configuration for the re-identification of the content item. + * This field shares the same proto message type that is used for + * de-identification, however its usage here is for the reversal of the + * previous de-identification. Re-identification is performed by examining + * the transformations used to de-identify the items and executing the + * reverse. This requires that only reversible transformations + * be provided here. The reversible transformations are: + * + * - `CryptoDeterministicConfig` + * - `CryptoReplaceFfxFpeConfig` + * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig + * Configuration for the inspector. + * @param {google.privacy.dlp.v2.ContentItem} request.item + * The item to re-identify. Will be treated as text. + * @param {string} request.inspectTemplateName + * Template to use. Any configuration directly specified in + * `inspect_config` will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * @param {string} request.reidentifyTemplateName + * Template to use. References an instance of `DeidentifyTemplate`. + * Any configuration directly specified in `reidentify_config` or + * `inspect_config` will override those set in the template. The + * `DeidentifyTemplate` used must include only reversible transformations. + * Singular fields that are set in this request will replace their + * corresponding fields in the template. Repeated fields are appended. + * Singular sub-messages and groups are recursively merged. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.ReidentifyContentResponse|ReidentifyContentResponse}. + * Please see the {@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/dlp_service.reidentify_content.js + * region_tag:dlp_v2_generated_DlpService_ReidentifyContent_async + */ + reidentifyContent( + request?: protos.google.privacy.dlp.v2.IReidentifyContentRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IReidentifyContentResponse, + protos.google.privacy.dlp.v2.IReidentifyContentRequest|undefined, {}|undefined + ]>; + reidentifyContent( + request: protos.google.privacy.dlp.v2.IReidentifyContentRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IReidentifyContentResponse, + protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, + {}|null|undefined>): void; + reidentifyContent( + request: protos.google.privacy.dlp.v2.IReidentifyContentRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IReidentifyContentResponse, + protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, + {}|null|undefined>): void; + reidentifyContent( + request?: protos.google.privacy.dlp.v2.IReidentifyContentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IReidentifyContentResponse, + protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IReidentifyContentResponse, + protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IReidentifyContentResponse, + protos.google.privacy.dlp.v2.IReidentifyContentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.reidentifyContent(request, options, callback); + } +/** + * Returns a list of the sensitive information types that DLP API + * supports. See https://cloud.google.com/dlp/docs/infotypes-reference to + * learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name. + * + * The format of this value is as follows: + * + * locations/LOCATION_ID + * @param {string} request.languageCode + * BCP-47 language code for localized infoType friendly + * names. If omitted, or if localized strings are not available, + * en-US strings will be returned. + * @param {string} request.filter + * filter to only return infoTypes supported by certain parts of the + * API. Defaults to supported_by=INSPECT. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.ListInfoTypesResponse|ListInfoTypesResponse}. + * Please see the {@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/dlp_service.list_info_types.js + * region_tag:dlp_v2_generated_DlpService_ListInfoTypes_async + */ + listInfoTypes( + request?: protos.google.privacy.dlp.v2.IListInfoTypesRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IListInfoTypesResponse, + protos.google.privacy.dlp.v2.IListInfoTypesRequest|undefined, {}|undefined + ]>; + listInfoTypes( + request: protos.google.privacy.dlp.v2.IListInfoTypesRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IListInfoTypesResponse, + protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, + {}|null|undefined>): void; + listInfoTypes( + request: protos.google.privacy.dlp.v2.IListInfoTypesRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IListInfoTypesResponse, + protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, + {}|null|undefined>): void; + listInfoTypes( + request?: protos.google.privacy.dlp.v2.IListInfoTypesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IListInfoTypesResponse, + protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IListInfoTypesResponse, + protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IListInfoTypesResponse, + protos.google.privacy.dlp.v2.IListInfoTypesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listInfoTypes(request, options, callback); + } +/** + * Creates an InspectTemplate for reusing frequently used configuration + * for inspecting content, images, and storage. + * See https://cloud.google.com/dlp/docs/creating-templates to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {google.privacy.dlp.v2.InspectTemplate} request.inspectTemplate + * Required. The InspectTemplate to create. + * @param {string} request.templateId + * The template id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. + * Please see the {@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/dlp_service.create_inspect_template.js + * region_tag:dlp_v2_generated_DlpService_CreateInspectTemplate_async + */ + createInspectTemplate( + request?: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|undefined, {}|undefined + ]>; + createInspectTemplate( + request: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, + {}|null|undefined>): void; + createInspectTemplate( + request: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, + {}|null|undefined>): void; + createInspectTemplate( + request?: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createInspectTemplate(request, options, callback); + } +/** + * Updates the InspectTemplate. + * See https://cloud.google.com/dlp/docs/creating-templates to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of organization and inspectTemplate to be updated, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + * @param {google.privacy.dlp.v2.InspectTemplate} request.inspectTemplate + * New InspectTemplate value. + * @param {google.protobuf.FieldMask} request.updateMask + * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. + * Please see the {@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/dlp_service.update_inspect_template.js + * region_tag:dlp_v2_generated_DlpService_UpdateInspectTemplate_async + */ + updateInspectTemplate( + request?: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|undefined, {}|undefined + ]>; + updateInspectTemplate( + request: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, + {}|null|undefined>): void; + updateInspectTemplate( + request: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, + {}|null|undefined>): void; + updateInspectTemplate( + request?: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateInspectTemplate(request, options, callback); + } +/** + * Gets an InspectTemplate. + * See https://cloud.google.com/dlp/docs/creating-templates to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the organization and inspectTemplate to be read, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. + * Please see the {@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/dlp_service.get_inspect_template.js + * region_tag:dlp_v2_generated_DlpService_GetInspectTemplate_async + */ + getInspectTemplate( + request?: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|undefined, {}|undefined + ]>; + getInspectTemplate( + request: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, + {}|null|undefined>): void; + getInspectTemplate( + request: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, + {}|null|undefined>): void; + getInspectTemplate( + request?: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IInspectTemplate, + protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getInspectTemplate(request, options, callback); + } +/** + * Deletes an InspectTemplate. + * See https://cloud.google.com/dlp/docs/creating-templates to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the organization and inspectTemplate to be deleted, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.delete_inspect_template.js + * region_tag:dlp_v2_generated_DlpService_DeleteInspectTemplate_async + */ + deleteInspectTemplate( + request?: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|undefined, {}|undefined + ]>; + deleteInspectTemplate( + request: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, + {}|null|undefined>): void; + deleteInspectTemplate( + request: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, + {}|null|undefined>): void; + deleteInspectTemplate( + request?: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteInspectTemplate(request, options, callback); + } +/** + * Creates a DeidentifyTemplate for reusing frequently used configuration + * for de-identifying content, images, and storage. + * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn + * more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {google.privacy.dlp.v2.DeidentifyTemplate} request.deidentifyTemplate + * Required. The DeidentifyTemplate to create. + * @param {string} request.templateId + * The template id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. + * Please see the {@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/dlp_service.create_deidentify_template.js + * region_tag:dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async + */ + createDeidentifyTemplate( + request?: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|undefined, {}|undefined + ]>; + createDeidentifyTemplate( + request: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): void; + createDeidentifyTemplate( + request: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): void; + createDeidentifyTemplate( + request?: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createDeidentifyTemplate(request, options, callback); + } +/** + * Updates the DeidentifyTemplate. + * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn + * more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of organization and deidentify template to be updated, for + * example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + * @param {google.privacy.dlp.v2.DeidentifyTemplate} request.deidentifyTemplate + * New DeidentifyTemplate value. + * @param {google.protobuf.FieldMask} request.updateMask + * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. + * Please see the {@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/dlp_service.update_deidentify_template.js + * region_tag:dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async + */ + updateDeidentifyTemplate( + request?: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|undefined, {}|undefined + ]>; + updateDeidentifyTemplate( + request: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): void; + updateDeidentifyTemplate( + request: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): void; + updateDeidentifyTemplate( + request?: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateDeidentifyTemplate(request, options, callback); + } +/** + * Gets a DeidentifyTemplate. + * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn + * more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the organization and deidentify template to be read, for + * example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. + * Please see the {@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/dlp_service.get_deidentify_template.js + * region_tag:dlp_v2_generated_DlpService_GetDeidentifyTemplate_async + */ + getDeidentifyTemplate( + request?: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|undefined, {}|undefined + ]>; + getDeidentifyTemplate( + request: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): void; + getDeidentifyTemplate( + request: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): void; + getDeidentifyTemplate( + request?: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IDeidentifyTemplate, + protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getDeidentifyTemplate(request, options, callback); + } +/** + * Deletes a DeidentifyTemplate. + * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn + * more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the organization and deidentify template to be deleted, + * for example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.delete_deidentify_template.js + * region_tag:dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async + */ + deleteDeidentifyTemplate( + request?: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|undefined, {}|undefined + ]>; + deleteDeidentifyTemplate( + request: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): void; + deleteDeidentifyTemplate( + request: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): void; + deleteDeidentifyTemplate( + request?: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteDeidentifyTemplate(request, options, callback); + } +/** + * Creates a job trigger to run DLP actions such as scanning storage for + * sensitive information on a set schedule. + * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {google.privacy.dlp.v2.JobTrigger} request.jobTrigger + * Required. The JobTrigger to create. + * @param {string} request.triggerId + * The trigger id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. + * Please see the {@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/dlp_service.create_job_trigger.js + * region_tag:dlp_v2_generated_DlpService_CreateJobTrigger_async + */ + createJobTrigger( + request?: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|undefined, {}|undefined + ]>; + createJobTrigger( + request: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + createJobTrigger( + request: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + createJobTrigger( + request?: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createJobTrigger(request, options, callback); + } +/** + * Updates a job trigger. + * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + * @param {google.privacy.dlp.v2.JobTrigger} request.jobTrigger + * New JobTrigger value. + * @param {google.protobuf.FieldMask} request.updateMask + * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. + * Please see the {@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/dlp_service.update_job_trigger.js + * region_tag:dlp_v2_generated_DlpService_UpdateJobTrigger_async + */ + updateJobTrigger( + request?: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|undefined, {}|undefined + ]>; + updateJobTrigger( + request: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + updateJobTrigger( + request: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + updateJobTrigger( + request?: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateJobTrigger(request, options, callback); + } +/** + * Inspect hybrid content and store findings to a trigger. The inspection + * will be processed asynchronously. To review the findings monitor the + * jobs within the trigger. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the trigger to execute a hybrid inspect on, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + * @param {google.privacy.dlp.v2.HybridContentItem} request.hybridItem + * The item to inspect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.HybridInspectResponse|HybridInspectResponse}. + * Please see the {@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/dlp_service.hybrid_inspect_job_trigger.js + * region_tag:dlp_v2_generated_DlpService_HybridInspectJobTrigger_async + */ + hybridInspectJobTrigger( + request?: protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|undefined, {}|undefined + ]>; + hybridInspectJobTrigger( + request: protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + hybridInspectJobTrigger( + request: protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + hybridInspectJobTrigger( + request?: protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.hybridInspectJobTrigger(request, options, callback); + } +/** + * Gets a job trigger. + * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. + * Please see the {@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/dlp_service.get_job_trigger.js + * region_tag:dlp_v2_generated_DlpService_GetJobTrigger_async + */ + getJobTrigger( + request?: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IGetJobTriggerRequest|undefined, {}|undefined + ]>; + getJobTrigger( + request: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + getJobTrigger( + request: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + getJobTrigger( + request?: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IJobTrigger, + protos.google.privacy.dlp.v2.IGetJobTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getJobTrigger(request, options, callback); + } +/** + * Deletes a job trigger. + * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.delete_job_trigger.js + * region_tag:dlp_v2_generated_DlpService_DeleteJobTrigger_async + */ + deleteJobTrigger( + request?: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|undefined, {}|undefined + ]>; + deleteJobTrigger( + request: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + deleteJobTrigger( + request: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + deleteJobTrigger( + request?: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteJobTrigger(request, options, callback); + } +/** + * Activate a job trigger. Causes the immediate execute of a trigger + * instead of waiting on the trigger event to occur. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the trigger to activate, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. + * Please see the {@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/dlp_service.activate_job_trigger.js + * region_tag:dlp_v2_generated_DlpService_ActivateJobTrigger_async + */ + activateJobTrigger( + request?: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|undefined, {}|undefined + ]>; + activateJobTrigger( + request: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + activateJobTrigger( + request: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, + {}|null|undefined>): void; + activateJobTrigger( + request?: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.activateJobTrigger(request, options, callback); + } +/** + * Creates a new job to inspect storage or calculate risk metrics. + * See https://cloud.google.com/dlp/docs/inspecting-storage and + * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. + * + * When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the + * system will automatically choose what detectors to run. By default this may + * be all types, but may change over time as detectors are updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {google.privacy.dlp.v2.InspectJobConfig} request.inspectJob + * An inspection job scans a storage repository for InfoTypes. + * @param {google.privacy.dlp.v2.RiskAnalysisJobConfig} request.riskJob + * A risk analysis job calculates re-identification risk metrics for a + * BigQuery table. + * @param {string} request.jobId + * The job id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. + * Please see the {@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/dlp_service.create_dlp_job.js + * region_tag:dlp_v2_generated_DlpService_CreateDlpJob_async + */ + createDlpJob( + request?: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.ICreateDlpJobRequest|undefined, {}|undefined + ]>; + createDlpJob( + request: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, + {}|null|undefined>): void; + createDlpJob( + request: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, + {}|null|undefined>): void; + createDlpJob( + request?: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.ICreateDlpJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createDlpJob(request, options, callback); + } +/** + * Gets the latest state of a long-running DlpJob. + * See https://cloud.google.com/dlp/docs/inspecting-storage and + * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the DlpJob 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.privacy.dlp.v2.DlpJob|DlpJob}. + * Please see the {@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/dlp_service.get_dlp_job.js + * region_tag:dlp_v2_generated_DlpService_GetDlpJob_async + */ + getDlpJob( + request?: protos.google.privacy.dlp.v2.IGetDlpJobRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IGetDlpJobRequest|undefined, {}|undefined + ]>; + getDlpJob( + request: protos.google.privacy.dlp.v2.IGetDlpJobRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, + {}|null|undefined>): void; + getDlpJob( + request: protos.google.privacy.dlp.v2.IGetDlpJobRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, + {}|null|undefined>): void; + getDlpJob( + request?: protos.google.privacy.dlp.v2.IGetDlpJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IDlpJob, + protos.google.privacy.dlp.v2.IGetDlpJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getDlpJob(request, options, callback); + } +/** + * Deletes a long-running DlpJob. This method indicates that the client is + * no longer interested in the DlpJob result. The job will be canceled if + * possible. + * See https://cloud.google.com/dlp/docs/inspecting-storage and + * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the DlpJob resource to 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 {@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/v2/dlp_service.delete_dlp_job.js + * region_tag:dlp_v2_generated_DlpService_DeleteDlpJob_async + */ + deleteDlpJob( + request?: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|undefined, {}|undefined + ]>; + deleteDlpJob( + request: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, + {}|null|undefined>): void; + deleteDlpJob( + request: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, + {}|null|undefined>): void; + deleteDlpJob( + request?: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteDlpJob(request, options, callback); + } +/** + * Starts asynchronous cancellation on a long-running DlpJob. The server + * makes a best effort to cancel the DlpJob, but success is not + * guaranteed. + * See https://cloud.google.com/dlp/docs/inspecting-storage and + * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the DlpJob resource to be cancelled. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.cancel_dlp_job.js + * region_tag:dlp_v2_generated_DlpService_CancelDlpJob_async + */ + cancelDlpJob( + request?: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.ICancelDlpJobRequest|undefined, {}|undefined + ]>; + cancelDlpJob( + request: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, + {}|null|undefined>): void; + cancelDlpJob( + request: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, + {}|null|undefined>): void; + cancelDlpJob( + request?: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.ICancelDlpJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.cancelDlpJob(request, options, callback); + } +/** + * Creates a pre-built stored infoType to be used for inspection. + * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {google.privacy.dlp.v2.StoredInfoTypeConfig} request.config + * Required. Configuration of the storedInfoType to create. + * @param {string} request.storedInfoTypeId + * The storedInfoType ID can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. + * Please see the {@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/dlp_service.create_stored_info_type.js + * region_tag:dlp_v2_generated_DlpService_CreateStoredInfoType_async + */ + createStoredInfoType( + request?: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|undefined, {}|undefined + ]>; + createStoredInfoType( + request: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): void; + createStoredInfoType( + request: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): void; + createStoredInfoType( + request?: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createStoredInfoType(request, options, callback); + } +/** + * Updates the stored infoType by creating a new version. The existing version + * will continue to be used until the new version is ready. + * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of organization and storedInfoType to be updated, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + * @param {google.privacy.dlp.v2.StoredInfoTypeConfig} request.config + * Updated configuration for the storedInfoType. If not provided, a new + * version of the storedInfoType will be created with the existing + * configuration. + * @param {google.protobuf.FieldMask} request.updateMask + * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. + * Please see the {@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/dlp_service.update_stored_info_type.js + * region_tag:dlp_v2_generated_DlpService_UpdateStoredInfoType_async + */ + updateStoredInfoType( + request?: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|undefined, {}|undefined + ]>; + updateStoredInfoType( + request: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): void; + updateStoredInfoType( + request: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): void; + updateStoredInfoType( + request?: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateStoredInfoType(request, options, callback); + } +/** + * Gets a stored infoType. + * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the organization and storedInfoType to be read, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. + * Please see the {@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/dlp_service.get_stored_info_type.js + * region_tag:dlp_v2_generated_DlpService_GetStoredInfoType_async + */ + getStoredInfoType( + request?: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|undefined, {}|undefined + ]>; + getStoredInfoType( + request: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): void; + getStoredInfoType( + request: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): void; + getStoredInfoType( + request?: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IStoredInfoType, + protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getStoredInfoType(request, options, callback); + } +/** + * Deletes a stored infoType. + * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the organization and storedInfoType to be deleted, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.delete_stored_info_type.js + * region_tag:dlp_v2_generated_DlpService_DeleteStoredInfoType_async + */ + deleteStoredInfoType( + request?: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|undefined, {}|undefined + ]>; + deleteStoredInfoType( + request: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): void; + deleteStoredInfoType( + request: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): void; + deleteStoredInfoType( + request?: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteStoredInfoType(request, options, callback); + } +/** + * Inspect hybrid content and store findings to a job. + * To review the findings, inspect the job. Inspection will occur + * asynchronously. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the job to execute a hybrid inspect on, for example + * `projects/dlp-test-project/dlpJob/53234423`. + * @param {google.privacy.dlp.v2.HybridContentItem} request.hybridItem + * The item to inspect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.HybridInspectResponse|HybridInspectResponse}. + * Please see the {@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/dlp_service.hybrid_inspect_dlp_job.js + * region_tag:dlp_v2_generated_DlpService_HybridInspectDlpJob_async + */ + hybridInspectDlpJob( + request?: protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|undefined, {}|undefined + ]>; + hybridInspectDlpJob( + request: protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest, + options: CallOptions, + callback: Callback< + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|null|undefined, + {}|null|undefined>): void; + hybridInspectDlpJob( + request: protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest, + callback: Callback< + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|null|undefined, + {}|null|undefined>): void; + hybridInspectDlpJob( + request?: protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.privacy.dlp.v2.IHybridInspectResponse, + protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.hybridInspectDlpJob(request, options, callback); + } +/** + * Finish a running hybrid DlpJob. Triggers the finalization steps and running + * of any enabled actions that have not yet run. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the DlpJob resource to be cancelled. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.finish_dlp_job.js + * region_tag:dlp_v2_generated_DlpService_FinishDlpJob_async + */ + finishDlpJob( + request?: protos.google.privacy.dlp.v2.IFinishDlpJobRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IFinishDlpJobRequest|undefined, {}|undefined + ]>; + finishDlpJob( + request: protos.google.privacy.dlp.v2.IFinishDlpJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IFinishDlpJobRequest|null|undefined, + {}|null|undefined>): void; + finishDlpJob( + request: protos.google.privacy.dlp.v2.IFinishDlpJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IFinishDlpJobRequest|null|undefined, + {}|null|undefined>): void; + finishDlpJob( + request?: protos.google.privacy.dlp.v2.IFinishDlpJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IFinishDlpJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IFinishDlpJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.privacy.dlp.v2.IFinishDlpJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.finishDlpJob(request, options, callback); + } + + /** + * Lists InspectTemplates. + * See https://cloud.google.com/dlp/docs/creating-templates to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to `ListInspectTemplates`. + * @param {number} request.pageSize + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc,update_time, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the template was created. + * - `update_time`: corresponds to the time the template was last updated. + * - `name`: corresponds to the template's name. + * - `display_name`: corresponds to the template's display name. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.privacy.dlp.v2.InspectTemplate|InspectTemplate}. + * 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 `listInspectTemplatesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listInspectTemplates( + request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IInspectTemplate[], + protos.google.privacy.dlp.v2.IListInspectTemplatesRequest|null, + protos.google.privacy.dlp.v2.IListInspectTemplatesResponse + ]>; + listInspectTemplates( + request: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, + protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, + protos.google.privacy.dlp.v2.IInspectTemplate>): void; + listInspectTemplates( + request: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, + callback: PaginationCallback< + protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, + protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, + protos.google.privacy.dlp.v2.IInspectTemplate>): void; + listInspectTemplates( + request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, + protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, + protos.google.privacy.dlp.v2.IInspectTemplate>, + callback?: PaginationCallback< + protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, + protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, + protos.google.privacy.dlp.v2.IInspectTemplate>): + Promise<[ + protos.google.privacy.dlp.v2.IInspectTemplate[], + protos.google.privacy.dlp.v2.IListInspectTemplatesRequest|null, + protos.google.privacy.dlp.v2.IListInspectTemplatesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listInspectTemplates(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 resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to `ListInspectTemplates`. + * @param {number} request.pageSize + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc,update_time, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the template was created. + * - `update_time`: corresponds to the time the template was last updated. + * - `name`: corresponds to the template's name. + * - `display_name`: corresponds to the template's display name. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @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.privacy.dlp.v2.InspectTemplate|InspectTemplate} 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 `listInspectTemplatesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listInspectTemplatesStream( + request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, + 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['listInspectTemplates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listInspectTemplates.createStream( + this.innerApiCalls.listInspectTemplates as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listInspectTemplates`, 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 resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to `ListInspectTemplates`. + * @param {number} request.pageSize + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc,update_time, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the template was created. + * - `update_time`: corresponds to the time the template was last updated. + * - `name`: corresponds to the template's name. + * - `display_name`: corresponds to the template's display name. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @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.privacy.dlp.v2.InspectTemplate|InspectTemplate}. 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/dlp_service.list_inspect_templates.js + * region_tag:dlp_v2_generated_DlpService_ListInspectTemplates_async + */ + listInspectTemplatesAsync( + request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, + 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['listInspectTemplates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listInspectTemplates.asyncIterate( + this.innerApiCalls['listInspectTemplates'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists DeidentifyTemplates. + * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn + * more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to `ListDeidentifyTemplates`. + * @param {number} request.pageSize + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc,update_time, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the template was created. + * - `update_time`: corresponds to the time the template was last updated. + * - `name`: corresponds to the template's name. + * - `display_name`: corresponds to the template's display name. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. + * 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 `listDeidentifyTemplatesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDeidentifyTemplates( + request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IDeidentifyTemplate[], + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest|null, + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse + ]>; + listDeidentifyTemplates( + request: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, + protos.google.privacy.dlp.v2.IDeidentifyTemplate>): void; + listDeidentifyTemplates( + request: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, + callback: PaginationCallback< + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, + protos.google.privacy.dlp.v2.IDeidentifyTemplate>): void; + listDeidentifyTemplates( + request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, + protos.google.privacy.dlp.v2.IDeidentifyTemplate>, + callback?: PaginationCallback< + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, + protos.google.privacy.dlp.v2.IDeidentifyTemplate>): + Promise<[ + protos.google.privacy.dlp.v2.IDeidentifyTemplate[], + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest|null, + protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listDeidentifyTemplates(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 resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to `ListDeidentifyTemplates`. + * @param {number} request.pageSize + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc,update_time, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the template was created. + * - `update_time`: corresponds to the time the template was last updated. + * - `name`: corresponds to the template's name. + * - `display_name`: corresponds to the template's display name. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @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.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate} 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 `listDeidentifyTemplatesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDeidentifyTemplatesStream( + request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, + 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['listDeidentifyTemplates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDeidentifyTemplates.createStream( + this.innerApiCalls.listDeidentifyTemplates as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDeidentifyTemplates`, 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 resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to `ListDeidentifyTemplates`. + * @param {number} request.pageSize + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc,update_time, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the template was created. + * - `update_time`: corresponds to the time the template was last updated. + * - `name`: corresponds to the template's name. + * - `display_name`: corresponds to the template's display name. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @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.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. 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/dlp_service.list_deidentify_templates.js + * region_tag:dlp_v2_generated_DlpService_ListDeidentifyTemplates_async + */ + listDeidentifyTemplatesAsync( + request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, + 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['listDeidentifyTemplates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDeidentifyTemplates.asyncIterate( + this.innerApiCalls['listDeidentifyTemplates'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists job triggers. + * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to ListJobTriggers. `order_by` field must not + * change for subsequent calls. + * @param {number} request.pageSize + * Size of the page, can be limited by a server. + * @param {string} request.orderBy + * Comma separated list of triggeredJob fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc,update_time, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the JobTrigger was created. + * - `update_time`: corresponds to the time the JobTrigger was last updated. + * - `last_run_time`: corresponds to the last time the JobTrigger ran. + * - `name`: corresponds to the JobTrigger's name. + * - `display_name`: corresponds to the JobTrigger's display name. + * - `status`: corresponds to JobTrigger's status. + * @param {string} request.filter + * Allows filtering. + * + * Supported syntax: + * + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of `{field} {operator} {value}`. + * * Supported fields/values for inspect triggers: + * - `status` - HEALTHY|PAUSED|CANCELLED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by + * quotation marks. Nanoseconds are ignored. + * - 'error_count' - Number of errors that have occurred while running. + * * The operator must be `=` or `!=` for status and inspected_storage. + * + * Examples: + * + * * inspected_storage = cloud_storage AND status = HEALTHY + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) + * * last_run_time > \"2017-12-12T00:00:00+00:00\" + * + * The length of this field should be no more than 500 characters. + * @param {google.privacy.dlp.v2.DlpJobType} request.type + * The type of jobs. Will use `DlpJobType.INSPECT` if not set. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.privacy.dlp.v2.JobTrigger|JobTrigger}. + * 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 `listJobTriggersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listJobTriggers( + request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IJobTrigger[], + protos.google.privacy.dlp.v2.IListJobTriggersRequest|null, + protos.google.privacy.dlp.v2.IListJobTriggersResponse + ]>; + listJobTriggers( + request: protos.google.privacy.dlp.v2.IListJobTriggersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.privacy.dlp.v2.IListJobTriggersRequest, + protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, + protos.google.privacy.dlp.v2.IJobTrigger>): void; + listJobTriggers( + request: protos.google.privacy.dlp.v2.IListJobTriggersRequest, + callback: PaginationCallback< + protos.google.privacy.dlp.v2.IListJobTriggersRequest, + protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, + protos.google.privacy.dlp.v2.IJobTrigger>): void; + listJobTriggers( + request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.privacy.dlp.v2.IListJobTriggersRequest, + protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, + protos.google.privacy.dlp.v2.IJobTrigger>, + callback?: PaginationCallback< + protos.google.privacy.dlp.v2.IListJobTriggersRequest, + protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, + protos.google.privacy.dlp.v2.IJobTrigger>): + Promise<[ + protos.google.privacy.dlp.v2.IJobTrigger[], + protos.google.privacy.dlp.v2.IListJobTriggersRequest|null, + protos.google.privacy.dlp.v2.IListJobTriggersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listJobTriggers(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 resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to ListJobTriggers. `order_by` field must not + * change for subsequent calls. + * @param {number} request.pageSize + * Size of the page, can be limited by a server. + * @param {string} request.orderBy + * Comma separated list of triggeredJob fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc,update_time, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the JobTrigger was created. + * - `update_time`: corresponds to the time the JobTrigger was last updated. + * - `last_run_time`: corresponds to the last time the JobTrigger ran. + * - `name`: corresponds to the JobTrigger's name. + * - `display_name`: corresponds to the JobTrigger's display name. + * - `status`: corresponds to JobTrigger's status. + * @param {string} request.filter + * Allows filtering. + * + * Supported syntax: + * + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of `{field} {operator} {value}`. + * * Supported fields/values for inspect triggers: + * - `status` - HEALTHY|PAUSED|CANCELLED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by + * quotation marks. Nanoseconds are ignored. + * - 'error_count' - Number of errors that have occurred while running. + * * The operator must be `=` or `!=` for status and inspected_storage. + * + * Examples: + * + * * inspected_storage = cloud_storage AND status = HEALTHY + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) + * * last_run_time > \"2017-12-12T00:00:00+00:00\" + * + * The length of this field should be no more than 500 characters. + * @param {google.privacy.dlp.v2.DlpJobType} request.type + * The type of jobs. Will use `DlpJobType.INSPECT` if not set. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @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.privacy.dlp.v2.JobTrigger|JobTrigger} 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 `listJobTriggersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listJobTriggersStream( + request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, + 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['listJobTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobTriggers.createStream( + this.innerApiCalls.listJobTriggers as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listJobTriggers`, 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 resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to ListJobTriggers. `order_by` field must not + * change for subsequent calls. + * @param {number} request.pageSize + * Size of the page, can be limited by a server. + * @param {string} request.orderBy + * Comma separated list of triggeredJob fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc,update_time, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the JobTrigger was created. + * - `update_time`: corresponds to the time the JobTrigger was last updated. + * - `last_run_time`: corresponds to the last time the JobTrigger ran. + * - `name`: corresponds to the JobTrigger's name. + * - `display_name`: corresponds to the JobTrigger's display name. + * - `status`: corresponds to JobTrigger's status. + * @param {string} request.filter + * Allows filtering. + * + * Supported syntax: + * + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of `{field} {operator} {value}`. + * * Supported fields/values for inspect triggers: + * - `status` - HEALTHY|PAUSED|CANCELLED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by + * quotation marks. Nanoseconds are ignored. + * - 'error_count' - Number of errors that have occurred while running. + * * The operator must be `=` or `!=` for status and inspected_storage. + * + * Examples: + * + * * inspected_storage = cloud_storage AND status = HEALTHY + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) + * * last_run_time > \"2017-12-12T00:00:00+00:00\" + * + * The length of this field should be no more than 500 characters. + * @param {google.privacy.dlp.v2.DlpJobType} request.type + * The type of jobs. Will use `DlpJobType.INSPECT` if not set. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @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.privacy.dlp.v2.JobTrigger|JobTrigger}. 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/dlp_service.list_job_triggers.js + * region_tag:dlp_v2_generated_DlpService_ListJobTriggers_async + */ + listJobTriggersAsync( + request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, + 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['listJobTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobTriggers.asyncIterate( + this.innerApiCalls['listJobTriggers'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists DlpJobs that match the specified filter in the request. + * See https://cloud.google.com/dlp/docs/inspecting-storage and + * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.filter + * Allows filtering. + * + * Supported syntax: + * + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of `{field} {operator} {value}`. + * * Supported fields/values for inspect jobs: + * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - `trigger_name` - The name of the trigger that created the job. + * - 'end_time` - Corresponds to the time the job finished. + * - 'start_time` - Corresponds to the time the job finished. + * * Supported fields for risk analysis jobs: + * - `state` - RUNNING|CANCELED|FINISHED|FAILED + * - 'end_time` - Corresponds to the time the job finished. + * - 'start_time` - Corresponds to the time the job finished. + * * The operator must be `=` or `!=`. + * + * Examples: + * + * * inspected_storage = cloud_storage AND state = done + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = done OR state = canceled) + * * end_time > \"2017-12-12T00:00:00+00:00\" + * + * The length of this field should be no more than 500 characters. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {google.privacy.dlp.v2.DlpJobType} request.type + * The type of job. Defaults to `DlpJobType.INSPECT` + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc, end_time asc, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the job was created. + * - `end_time`: corresponds to the time the job ended. + * - `name`: corresponds to the job's name. + * - `state`: corresponds to `state` + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.privacy.dlp.v2.DlpJob|DlpJob}. + * 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 `listDlpJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDlpJobs( + request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IDlpJob[], + protos.google.privacy.dlp.v2.IListDlpJobsRequest|null, + protos.google.privacy.dlp.v2.IListDlpJobsResponse + ]>; + listDlpJobs( + request: protos.google.privacy.dlp.v2.IListDlpJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.privacy.dlp.v2.IListDlpJobsRequest, + protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, + protos.google.privacy.dlp.v2.IDlpJob>): void; + listDlpJobs( + request: protos.google.privacy.dlp.v2.IListDlpJobsRequest, + callback: PaginationCallback< + protos.google.privacy.dlp.v2.IListDlpJobsRequest, + protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, + protos.google.privacy.dlp.v2.IDlpJob>): void; + listDlpJobs( + request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.privacy.dlp.v2.IListDlpJobsRequest, + protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, + protos.google.privacy.dlp.v2.IDlpJob>, + callback?: PaginationCallback< + protos.google.privacy.dlp.v2.IListDlpJobsRequest, + protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, + protos.google.privacy.dlp.v2.IDlpJob>): + Promise<[ + protos.google.privacy.dlp.v2.IDlpJob[], + protos.google.privacy.dlp.v2.IListDlpJobsRequest|null, + protos.google.privacy.dlp.v2.IListDlpJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listDlpJobs(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 resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.filter + * Allows filtering. + * + * Supported syntax: + * + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of `{field} {operator} {value}`. + * * Supported fields/values for inspect jobs: + * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - `trigger_name` - The name of the trigger that created the job. + * - 'end_time` - Corresponds to the time the job finished. + * - 'start_time` - Corresponds to the time the job finished. + * * Supported fields for risk analysis jobs: + * - `state` - RUNNING|CANCELED|FINISHED|FAILED + * - 'end_time` - Corresponds to the time the job finished. + * - 'start_time` - Corresponds to the time the job finished. + * * The operator must be `=` or `!=`. + * + * Examples: + * + * * inspected_storage = cloud_storage AND state = done + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = done OR state = canceled) + * * end_time > \"2017-12-12T00:00:00+00:00\" + * + * The length of this field should be no more than 500 characters. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {google.privacy.dlp.v2.DlpJobType} request.type + * The type of job. Defaults to `DlpJobType.INSPECT` + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc, end_time asc, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the job was created. + * - `end_time`: corresponds to the time the job ended. + * - `name`: corresponds to the job's name. + * - `state`: corresponds to `state` + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @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.privacy.dlp.v2.DlpJob|DlpJob} 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 `listDlpJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDlpJobsStream( + request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, + 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['listDlpJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDlpJobs.createStream( + this.innerApiCalls.listDlpJobs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDlpJobs`, 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 resource name. + * + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.filter + * Allows filtering. + * + * Supported syntax: + * + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of `{field} {operator} {value}`. + * * Supported fields/values for inspect jobs: + * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - `trigger_name` - The name of the trigger that created the job. + * - 'end_time` - Corresponds to the time the job finished. + * - 'start_time` - Corresponds to the time the job finished. + * * Supported fields for risk analysis jobs: + * - `state` - RUNNING|CANCELED|FINISHED|FAILED + * - 'end_time` - Corresponds to the time the job finished. + * - 'start_time` - Corresponds to the time the job finished. + * * The operator must be `=` or `!=`. + * + * Examples: + * + * * inspected_storage = cloud_storage AND state = done + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = done OR state = canceled) + * * end_time > \"2017-12-12T00:00:00+00:00\" + * + * The length of this field should be no more than 500 characters. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {google.privacy.dlp.v2.DlpJobType} request.type + * The type of job. Defaults to `DlpJobType.INSPECT` + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc, end_time asc, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the job was created. + * - `end_time`: corresponds to the time the job ended. + * - `name`: corresponds to the job's name. + * - `state`: corresponds to `state` + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @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.privacy.dlp.v2.DlpJob|DlpJob}. 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/dlp_service.list_dlp_jobs.js + * region_tag:dlp_v2_generated_DlpService_ListDlpJobs_async + */ + listDlpJobsAsync( + request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, + 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['listDlpJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDlpJobs.asyncIterate( + this.innerApiCalls['listDlpJobs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists stored infoTypes. + * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to `ListStoredInfoTypes`. + * @param {number} request.pageSize + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc, display_name, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the most recent version of the + * resource was created. + * - `state`: corresponds to the state of the resource. + * - `name`: corresponds to resource name. + * - `display_name`: corresponds to info type's display name. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.privacy.dlp.v2.StoredInfoType|StoredInfoType}. + * 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 `listStoredInfoTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listStoredInfoTypes( + request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, + options?: CallOptions): + Promise<[ + protos.google.privacy.dlp.v2.IStoredInfoType[], + protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest|null, + protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse + ]>; + listStoredInfoTypes( + request: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, + protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, + protos.google.privacy.dlp.v2.IStoredInfoType>): void; + listStoredInfoTypes( + request: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, + callback: PaginationCallback< + protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, + protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, + protos.google.privacy.dlp.v2.IStoredInfoType>): void; + listStoredInfoTypes( + request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, + protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, + protos.google.privacy.dlp.v2.IStoredInfoType>, + callback?: PaginationCallback< + protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, + protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, + protos.google.privacy.dlp.v2.IStoredInfoType>): + Promise<[ + protos.google.privacy.dlp.v2.IStoredInfoType[], + protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest|null, + protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listStoredInfoTypes(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 resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to `ListStoredInfoTypes`. + * @param {number} request.pageSize + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc, display_name, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the most recent version of the + * resource was created. + * - `state`: corresponds to the state of the resource. + * - `name`: corresponds to resource name. + * - `display_name`: corresponds to info type's display name. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @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.privacy.dlp.v2.StoredInfoType|StoredInfoType} 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 `listStoredInfoTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listStoredInfoTypesStream( + request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, + 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['listStoredInfoTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listStoredInfoTypes.createStream( + this.innerApiCalls.listStoredInfoTypes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listStoredInfoTypes`, 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 resource name. + * + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * + * parent=projects/example-project/locations/europe-west3 + * @param {string} request.pageToken + * Page token to continue retrieval. Comes from previous call + * to `ListStoredInfoTypes`. + * @param {number} request.pageSize + * Size of the page, can be limited by the server. If zero server returns + * a page of max size 100. + * @param {string} request.orderBy + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * + * Example: `name asc, display_name, create_time desc` + * + * Supported fields are: + * + * - `create_time`: corresponds to the time the most recent version of the + * resource was created. + * - `state`: corresponds to the state of the resource. + * - `name`: corresponds to resource name. + * - `display_name`: corresponds to info type's display name. + * @param {string} request.locationId + * Deprecated. This field has no effect. + * @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.privacy.dlp.v2.StoredInfoType|StoredInfoType}. 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/dlp_service.list_stored_info_types.js + * region_tag:dlp_v2_generated_DlpService_ListStoredInfoTypes_async + */ + listStoredInfoTypesAsync( + request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, + 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['listStoredInfoTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listStoredInfoTypes.asyncIterate( + this.innerApiCalls['listStoredInfoTypes'] 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); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified finding resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} finding + * @returns {string} Resource name string. + */ + findingPath(project:string,location:string,finding:string) { + return this.pathTemplates.findingPathTemplate.render({ + project: project, + location: location, + finding: finding, + }); + } + + /** + * Parse the project from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).project; + } + + /** + * Parse the location from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).location; + } + + /** + * Parse the finding from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).finding; + } + + /** + * 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 organizationDeidentifyTemplate resource name string. + * + * @param {string} organization + * @param {string} deidentify_template + * @returns {string} Resource name string. + */ + organizationDeidentifyTemplatePath(organization:string,deidentifyTemplate:string) { + return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.render({ + organization: organization, + deidentify_template: deidentifyTemplate, + }); + } + + /** + * Parse the organization from OrganizationDeidentifyTemplate resource. + * + * @param {string} organizationDeidentifyTemplateName + * A fully-qualified path representing organization_deidentify_template resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationDeidentifyTemplateName(organizationDeidentifyTemplateName: string) { + return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.match(organizationDeidentifyTemplateName).organization; + } + + /** + * Parse the deidentify_template from OrganizationDeidentifyTemplate resource. + * + * @param {string} organizationDeidentifyTemplateName + * A fully-qualified path representing organization_deidentify_template resource. + * @returns {string} A string representing the deidentify_template. + */ + matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName(organizationDeidentifyTemplateName: string) { + return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.match(organizationDeidentifyTemplateName).deidentify_template; + } + + /** + * Return a fully-qualified organizationInspectTemplate resource name string. + * + * @param {string} organization + * @param {string} inspect_template + * @returns {string} Resource name string. + */ + organizationInspectTemplatePath(organization:string,inspectTemplate:string) { + return this.pathTemplates.organizationInspectTemplatePathTemplate.render({ + organization: organization, + inspect_template: inspectTemplate, + }); + } + + /** + * Parse the organization from OrganizationInspectTemplate resource. + * + * @param {string} organizationInspectTemplateName + * A fully-qualified path representing organization_inspect_template resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationInspectTemplateName(organizationInspectTemplateName: string) { + return this.pathTemplates.organizationInspectTemplatePathTemplate.match(organizationInspectTemplateName).organization; + } + + /** + * Parse the inspect_template from OrganizationInspectTemplate resource. + * + * @param {string} organizationInspectTemplateName + * A fully-qualified path representing organization_inspect_template resource. + * @returns {string} A string representing the inspect_template. + */ + matchInspectTemplateFromOrganizationInspectTemplateName(organizationInspectTemplateName: string) { + return this.pathTemplates.organizationInspectTemplatePathTemplate.match(organizationInspectTemplateName).inspect_template; + } + + /** + * Return a fully-qualified organizationLocationDeidentifyTemplate resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} deidentify_template + * @returns {string} Resource name string. + */ + organizationLocationDeidentifyTemplatePath(organization:string,location:string,deidentifyTemplate:string) { + return this.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.render({ + organization: organization, + location: location, + deidentify_template: deidentifyTemplate, + }); + } + + /** + * Parse the organization from OrganizationLocationDeidentifyTemplate resource. + * + * @param {string} organizationLocationDeidentifyTemplateName + * A fully-qualified path representing organization_location_deidentify_template resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationDeidentifyTemplateName(organizationLocationDeidentifyTemplateName: string) { + return this.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match(organizationLocationDeidentifyTemplateName).organization; + } + + /** + * Parse the location from OrganizationLocationDeidentifyTemplate resource. + * + * @param {string} organizationLocationDeidentifyTemplateName + * A fully-qualified path representing organization_location_deidentify_template resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationDeidentifyTemplateName(organizationLocationDeidentifyTemplateName: string) { + return this.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match(organizationLocationDeidentifyTemplateName).location; + } + + /** + * Parse the deidentify_template from OrganizationLocationDeidentifyTemplate resource. + * + * @param {string} organizationLocationDeidentifyTemplateName + * A fully-qualified path representing organization_location_deidentify_template resource. + * @returns {string} A string representing the deidentify_template. + */ + matchDeidentifyTemplateFromOrganizationLocationDeidentifyTemplateName(organizationLocationDeidentifyTemplateName: string) { + return this.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match(organizationLocationDeidentifyTemplateName).deidentify_template; + } + + /** + * Return a fully-qualified organizationLocationInspectTemplate resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} inspect_template + * @returns {string} Resource name string. + */ + organizationLocationInspectTemplatePath(organization:string,location:string,inspectTemplate:string) { + return this.pathTemplates.organizationLocationInspectTemplatePathTemplate.render({ + organization: organization, + location: location, + inspect_template: inspectTemplate, + }); + } + + /** + * Parse the organization from OrganizationLocationInspectTemplate resource. + * + * @param {string} organizationLocationInspectTemplateName + * A fully-qualified path representing organization_location_inspect_template resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationInspectTemplateName(organizationLocationInspectTemplateName: string) { + return this.pathTemplates.organizationLocationInspectTemplatePathTemplate.match(organizationLocationInspectTemplateName).organization; + } + + /** + * Parse the location from OrganizationLocationInspectTemplate resource. + * + * @param {string} organizationLocationInspectTemplateName + * A fully-qualified path representing organization_location_inspect_template resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationInspectTemplateName(organizationLocationInspectTemplateName: string) { + return this.pathTemplates.organizationLocationInspectTemplatePathTemplate.match(organizationLocationInspectTemplateName).location; + } + + /** + * Parse the inspect_template from OrganizationLocationInspectTemplate resource. + * + * @param {string} organizationLocationInspectTemplateName + * A fully-qualified path representing organization_location_inspect_template resource. + * @returns {string} A string representing the inspect_template. + */ + matchInspectTemplateFromOrganizationLocationInspectTemplateName(organizationLocationInspectTemplateName: string) { + return this.pathTemplates.organizationLocationInspectTemplatePathTemplate.match(organizationLocationInspectTemplateName).inspect_template; + } + + /** + * Return a fully-qualified organizationLocationStoredInfoType resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} stored_info_type + * @returns {string} Resource name string. + */ + organizationLocationStoredInfoTypePath(organization:string,location:string,storedInfoType:string) { + return this.pathTemplates.organizationLocationStoredInfoTypePathTemplate.render({ + organization: organization, + location: location, + stored_info_type: storedInfoType, + }); + } + + /** + * Parse the organization from OrganizationLocationStoredInfoType resource. + * + * @param {string} organizationLocationStoredInfoTypeName + * A fully-qualified path representing organization_location_stored_info_type resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationStoredInfoTypeName(organizationLocationStoredInfoTypeName: string) { + return this.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match(organizationLocationStoredInfoTypeName).organization; + } + + /** + * Parse the location from OrganizationLocationStoredInfoType resource. + * + * @param {string} organizationLocationStoredInfoTypeName + * A fully-qualified path representing organization_location_stored_info_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationStoredInfoTypeName(organizationLocationStoredInfoTypeName: string) { + return this.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match(organizationLocationStoredInfoTypeName).location; + } + + /** + * Parse the stored_info_type from OrganizationLocationStoredInfoType resource. + * + * @param {string} organizationLocationStoredInfoTypeName + * A fully-qualified path representing organization_location_stored_info_type resource. + * @returns {string} A string representing the stored_info_type. + */ + matchStoredInfoTypeFromOrganizationLocationStoredInfoTypeName(organizationLocationStoredInfoTypeName: string) { + return this.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match(organizationLocationStoredInfoTypeName).stored_info_type; + } + + /** + * Return a fully-qualified organizationStoredInfoType resource name string. + * + * @param {string} organization + * @param {string} stored_info_type + * @returns {string} Resource name string. + */ + organizationStoredInfoTypePath(organization:string,storedInfoType:string) { + return this.pathTemplates.organizationStoredInfoTypePathTemplate.render({ + organization: organization, + stored_info_type: storedInfoType, + }); + } + + /** + * Parse the organization from OrganizationStoredInfoType resource. + * + * @param {string} organizationStoredInfoTypeName + * A fully-qualified path representing organization_stored_info_type resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationStoredInfoTypeName(organizationStoredInfoTypeName: string) { + return this.pathTemplates.organizationStoredInfoTypePathTemplate.match(organizationStoredInfoTypeName).organization; + } + + /** + * Parse the stored_info_type from OrganizationStoredInfoType resource. + * + * @param {string} organizationStoredInfoTypeName + * A fully-qualified path representing organization_stored_info_type resource. + * @returns {string} A string representing the stored_info_type. + */ + matchStoredInfoTypeFromOrganizationStoredInfoTypeName(organizationStoredInfoTypeName: string) { + return this.pathTemplates.organizationStoredInfoTypePathTemplate.match(organizationStoredInfoTypeName).stored_info_type; + } + + /** + * 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 projectDeidentifyTemplate resource name string. + * + * @param {string} project + * @param {string} deidentify_template + * @returns {string} Resource name string. + */ + projectDeidentifyTemplatePath(project:string,deidentifyTemplate:string) { + return this.pathTemplates.projectDeidentifyTemplatePathTemplate.render({ + project: project, + deidentify_template: deidentifyTemplate, + }); + } + + /** + * Parse the project from ProjectDeidentifyTemplate resource. + * + * @param {string} projectDeidentifyTemplateName + * A fully-qualified path representing project_deidentify_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectDeidentifyTemplateName(projectDeidentifyTemplateName: string) { + return this.pathTemplates.projectDeidentifyTemplatePathTemplate.match(projectDeidentifyTemplateName).project; + } + + /** + * Parse the deidentify_template from ProjectDeidentifyTemplate resource. + * + * @param {string} projectDeidentifyTemplateName + * A fully-qualified path representing project_deidentify_template resource. + * @returns {string} A string representing the deidentify_template. + */ + matchDeidentifyTemplateFromProjectDeidentifyTemplateName(projectDeidentifyTemplateName: string) { + return this.pathTemplates.projectDeidentifyTemplatePathTemplate.match(projectDeidentifyTemplateName).deidentify_template; + } + + /** + * Return a fully-qualified projectDlpContent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectDlpContentPath(project:string) { + return this.pathTemplates.projectDlpContentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectDlpContent resource. + * + * @param {string} projectDlpContentName + * A fully-qualified path representing project_dlpContent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectDlpContentName(projectDlpContentName: string) { + return this.pathTemplates.projectDlpContentPathTemplate.match(projectDlpContentName).project; + } + + /** + * Return a fully-qualified projectDlpJob resource name string. + * + * @param {string} project + * @param {string} dlp_job + * @returns {string} Resource name string. + */ + projectDlpJobPath(project:string,dlpJob:string) { + return this.pathTemplates.projectDlpJobPathTemplate.render({ + project: project, + dlp_job: dlpJob, + }); + } + + /** + * Parse the project from ProjectDlpJob resource. + * + * @param {string} projectDlpJobName + * A fully-qualified path representing project_dlp_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectDlpJobName(projectDlpJobName: string) { + return this.pathTemplates.projectDlpJobPathTemplate.match(projectDlpJobName).project; + } + + /** + * Parse the dlp_job from ProjectDlpJob resource. + * + * @param {string} projectDlpJobName + * A fully-qualified path representing project_dlp_job resource. + * @returns {string} A string representing the dlp_job. + */ + matchDlpJobFromProjectDlpJobName(projectDlpJobName: string) { + return this.pathTemplates.projectDlpJobPathTemplate.match(projectDlpJobName).dlp_job; + } + + /** + * Return a fully-qualified projectInspectTemplate resource name string. + * + * @param {string} project + * @param {string} inspect_template + * @returns {string} Resource name string. + */ + projectInspectTemplatePath(project:string,inspectTemplate:string) { + return this.pathTemplates.projectInspectTemplatePathTemplate.render({ + project: project, + inspect_template: inspectTemplate, + }); + } + + /** + * Parse the project from ProjectInspectTemplate resource. + * + * @param {string} projectInspectTemplateName + * A fully-qualified path representing project_inspect_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectInspectTemplateName(projectInspectTemplateName: string) { + return this.pathTemplates.projectInspectTemplatePathTemplate.match(projectInspectTemplateName).project; + } + + /** + * Parse the inspect_template from ProjectInspectTemplate resource. + * + * @param {string} projectInspectTemplateName + * A fully-qualified path representing project_inspect_template resource. + * @returns {string} A string representing the inspect_template. + */ + matchInspectTemplateFromProjectInspectTemplateName(projectInspectTemplateName: string) { + return this.pathTemplates.projectInspectTemplatePathTemplate.match(projectInspectTemplateName).inspect_template; + } + + /** + * Return a fully-qualified projectJobTrigger resource name string. + * + * @param {string} project + * @param {string} job_trigger + * @returns {string} Resource name string. + */ + projectJobTriggerPath(project:string,jobTrigger:string) { + return this.pathTemplates.projectJobTriggerPathTemplate.render({ + project: project, + job_trigger: jobTrigger, + }); + } + + /** + * Parse the project from ProjectJobTrigger resource. + * + * @param {string} projectJobTriggerName + * A fully-qualified path representing project_job_trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectJobTriggerName(projectJobTriggerName: string) { + return this.pathTemplates.projectJobTriggerPathTemplate.match(projectJobTriggerName).project; + } + + /** + * Parse the job_trigger from ProjectJobTrigger resource. + * + * @param {string} projectJobTriggerName + * A fully-qualified path representing project_job_trigger resource. + * @returns {string} A string representing the job_trigger. + */ + matchJobTriggerFromProjectJobTriggerName(projectJobTriggerName: string) { + return this.pathTemplates.projectJobTriggerPathTemplate.match(projectJobTriggerName).job_trigger; + } + + /** + * Return a fully-qualified projectLocationDeidentifyTemplate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} deidentify_template + * @returns {string} Resource name string. + */ + projectLocationDeidentifyTemplatePath(project:string,location:string,deidentifyTemplate:string) { + return this.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.render({ + project: project, + location: location, + deidentify_template: deidentifyTemplate, + }); + } + + /** + * Parse the project from ProjectLocationDeidentifyTemplate resource. + * + * @param {string} projectLocationDeidentifyTemplateName + * A fully-qualified path representing project_location_deidentify_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationDeidentifyTemplateName(projectLocationDeidentifyTemplateName: string) { + return this.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match(projectLocationDeidentifyTemplateName).project; + } + + /** + * Parse the location from ProjectLocationDeidentifyTemplate resource. + * + * @param {string} projectLocationDeidentifyTemplateName + * A fully-qualified path representing project_location_deidentify_template resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationDeidentifyTemplateName(projectLocationDeidentifyTemplateName: string) { + return this.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match(projectLocationDeidentifyTemplateName).location; + } + + /** + * Parse the deidentify_template from ProjectLocationDeidentifyTemplate resource. + * + * @param {string} projectLocationDeidentifyTemplateName + * A fully-qualified path representing project_location_deidentify_template resource. + * @returns {string} A string representing the deidentify_template. + */ + matchDeidentifyTemplateFromProjectLocationDeidentifyTemplateName(projectLocationDeidentifyTemplateName: string) { + return this.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match(projectLocationDeidentifyTemplateName).deidentify_template; + } + + /** + * Return a fully-qualified projectLocationDlpJob resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} dlp_job + * @returns {string} Resource name string. + */ + projectLocationDlpJobPath(project:string,location:string,dlpJob:string) { + return this.pathTemplates.projectLocationDlpJobPathTemplate.render({ + project: project, + location: location, + dlp_job: dlpJob, + }); + } + + /** + * Parse the project from ProjectLocationDlpJob resource. + * + * @param {string} projectLocationDlpJobName + * A fully-qualified path representing project_location_dlp_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationDlpJobName(projectLocationDlpJobName: string) { + return this.pathTemplates.projectLocationDlpJobPathTemplate.match(projectLocationDlpJobName).project; + } + + /** + * Parse the location from ProjectLocationDlpJob resource. + * + * @param {string} projectLocationDlpJobName + * A fully-qualified path representing project_location_dlp_job resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationDlpJobName(projectLocationDlpJobName: string) { + return this.pathTemplates.projectLocationDlpJobPathTemplate.match(projectLocationDlpJobName).location; + } + + /** + * Parse the dlp_job from ProjectLocationDlpJob resource. + * + * @param {string} projectLocationDlpJobName + * A fully-qualified path representing project_location_dlp_job resource. + * @returns {string} A string representing the dlp_job. + */ + matchDlpJobFromProjectLocationDlpJobName(projectLocationDlpJobName: string) { + return this.pathTemplates.projectLocationDlpJobPathTemplate.match(projectLocationDlpJobName).dlp_job; + } + + /** + * Return a fully-qualified projectLocationInspectTemplate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} inspect_template + * @returns {string} Resource name string. + */ + projectLocationInspectTemplatePath(project:string,location:string,inspectTemplate:string) { + return this.pathTemplates.projectLocationInspectTemplatePathTemplate.render({ + project: project, + location: location, + inspect_template: inspectTemplate, + }); + } + + /** + * Parse the project from ProjectLocationInspectTemplate resource. + * + * @param {string} projectLocationInspectTemplateName + * A fully-qualified path representing project_location_inspect_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationInspectTemplateName(projectLocationInspectTemplateName: string) { + return this.pathTemplates.projectLocationInspectTemplatePathTemplate.match(projectLocationInspectTemplateName).project; + } + + /** + * Parse the location from ProjectLocationInspectTemplate resource. + * + * @param {string} projectLocationInspectTemplateName + * A fully-qualified path representing project_location_inspect_template resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationInspectTemplateName(projectLocationInspectTemplateName: string) { + return this.pathTemplates.projectLocationInspectTemplatePathTemplate.match(projectLocationInspectTemplateName).location; + } + + /** + * Parse the inspect_template from ProjectLocationInspectTemplate resource. + * + * @param {string} projectLocationInspectTemplateName + * A fully-qualified path representing project_location_inspect_template resource. + * @returns {string} A string representing the inspect_template. + */ + matchInspectTemplateFromProjectLocationInspectTemplateName(projectLocationInspectTemplateName: string) { + return this.pathTemplates.projectLocationInspectTemplatePathTemplate.match(projectLocationInspectTemplateName).inspect_template; + } + + /** + * Return a fully-qualified projectLocationJobTrigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} job_trigger + * @returns {string} Resource name string. + */ + projectLocationJobTriggerPath(project:string,location:string,jobTrigger:string) { + return this.pathTemplates.projectLocationJobTriggerPathTemplate.render({ + project: project, + location: location, + job_trigger: jobTrigger, + }); + } + + /** + * Parse the project from ProjectLocationJobTrigger resource. + * + * @param {string} projectLocationJobTriggerName + * A fully-qualified path representing project_location_job_trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationJobTriggerName(projectLocationJobTriggerName: string) { + return this.pathTemplates.projectLocationJobTriggerPathTemplate.match(projectLocationJobTriggerName).project; + } + + /** + * Parse the location from ProjectLocationJobTrigger resource. + * + * @param {string} projectLocationJobTriggerName + * A fully-qualified path representing project_location_job_trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationJobTriggerName(projectLocationJobTriggerName: string) { + return this.pathTemplates.projectLocationJobTriggerPathTemplate.match(projectLocationJobTriggerName).location; + } + + /** + * Parse the job_trigger from ProjectLocationJobTrigger resource. + * + * @param {string} projectLocationJobTriggerName + * A fully-qualified path representing project_location_job_trigger resource. + * @returns {string} A string representing the job_trigger. + */ + matchJobTriggerFromProjectLocationJobTriggerName(projectLocationJobTriggerName: string) { + return this.pathTemplates.projectLocationJobTriggerPathTemplate.match(projectLocationJobTriggerName).job_trigger; + } + + /** + * Return a fully-qualified projectLocationStoredInfoType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} stored_info_type + * @returns {string} Resource name string. + */ + projectLocationStoredInfoTypePath(project:string,location:string,storedInfoType:string) { + return this.pathTemplates.projectLocationStoredInfoTypePathTemplate.render({ + project: project, + location: location, + stored_info_type: storedInfoType, + }); + } + + /** + * Parse the project from ProjectLocationStoredInfoType resource. + * + * @param {string} projectLocationStoredInfoTypeName + * A fully-qualified path representing project_location_stored_info_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationStoredInfoTypeName(projectLocationStoredInfoTypeName: string) { + return this.pathTemplates.projectLocationStoredInfoTypePathTemplate.match(projectLocationStoredInfoTypeName).project; + } + + /** + * Parse the location from ProjectLocationStoredInfoType resource. + * + * @param {string} projectLocationStoredInfoTypeName + * A fully-qualified path representing project_location_stored_info_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationStoredInfoTypeName(projectLocationStoredInfoTypeName: string) { + return this.pathTemplates.projectLocationStoredInfoTypePathTemplate.match(projectLocationStoredInfoTypeName).location; + } + + /** + * Parse the stored_info_type from ProjectLocationStoredInfoType resource. + * + * @param {string} projectLocationStoredInfoTypeName + * A fully-qualified path representing project_location_stored_info_type resource. + * @returns {string} A string representing the stored_info_type. + */ + matchStoredInfoTypeFromProjectLocationStoredInfoTypeName(projectLocationStoredInfoTypeName: string) { + return this.pathTemplates.projectLocationStoredInfoTypePathTemplate.match(projectLocationStoredInfoTypeName).stored_info_type; + } + + /** + * Return a fully-qualified projectStoredInfoType resource name string. + * + * @param {string} project + * @param {string} stored_info_type + * @returns {string} Resource name string. + */ + projectStoredInfoTypePath(project:string,storedInfoType:string) { + return this.pathTemplates.projectStoredInfoTypePathTemplate.render({ + project: project, + stored_info_type: storedInfoType, + }); + } + + /** + * Parse the project from ProjectStoredInfoType resource. + * + * @param {string} projectStoredInfoTypeName + * A fully-qualified path representing project_stored_info_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectStoredInfoTypeName(projectStoredInfoTypeName: string) { + return this.pathTemplates.projectStoredInfoTypePathTemplate.match(projectStoredInfoTypeName).project; + } + + /** + * Parse the stored_info_type from ProjectStoredInfoType resource. + * + * @param {string} projectStoredInfoTypeName + * A fully-qualified path representing project_stored_info_type resource. + * @returns {string} A string representing the stored_info_type. + */ + matchStoredInfoTypeFromProjectStoredInfoTypeName(projectStoredInfoTypeName: string) { + return this.pathTemplates.projectStoredInfoTypePathTemplate.match(projectStoredInfoTypeName).stored_info_type; + } + + /** + * 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.dlpServiceStub && !this._terminated) { + return this.dlpServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client_config.json b/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client_config.json new file mode 100644 index 00000000000..bcdbe63fe82 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client_config.json @@ -0,0 +1,196 @@ +{ + "interfaces": { + "google.privacy.dlp.v2.DlpService": { + "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": { + "InspectContent": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RedactImage": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeidentifyContent": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ReidentifyContent": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListInfoTypes": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateInspectTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateInspectTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetInspectTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListInspectTemplates": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteInspectTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateDeidentifyTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateDeidentifyTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDeidentifyTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListDeidentifyTemplates": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteDeidentifyTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateJobTrigger": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateJobTrigger": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "HybridInspectJobTrigger": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetJobTrigger": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListJobTriggers": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteJobTrigger": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ActivateJobTrigger": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateDlpJob": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListDlpJobs": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetDlpJob": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteDlpJob": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CancelDlpJob": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateStoredInfoType": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateStoredInfoType": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetStoredInfoType": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListStoredInfoTypes": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteStoredInfoType": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "HybridInspectDlpJob": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "FinishDlpJob": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_proto_list.json b/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_proto_list.json new file mode 100644 index 00000000000..482924bde32 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/privacy/dlp/v2/dlp.proto", + "../../protos/google/privacy/dlp/v2/storage.proto" +] diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-privacy-dlp/v2/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..e82d006d6e9 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/src/v2/gapic_metadata.json @@ -0,0 +1,383 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.privacy.dlp.v2", + "libraryPackage": "@google-cloud/dlp", + "services": { + "DlpService": { + "clients": { + "grpc": { + "libraryClient": "DlpServiceClient", + "rpcs": { + "InspectContent": { + "methods": [ + "inspectContent" + ] + }, + "RedactImage": { + "methods": [ + "redactImage" + ] + }, + "DeidentifyContent": { + "methods": [ + "deidentifyContent" + ] + }, + "ReidentifyContent": { + "methods": [ + "reidentifyContent" + ] + }, + "ListInfoTypes": { + "methods": [ + "listInfoTypes" + ] + }, + "CreateInspectTemplate": { + "methods": [ + "createInspectTemplate" + ] + }, + "UpdateInspectTemplate": { + "methods": [ + "updateInspectTemplate" + ] + }, + "GetInspectTemplate": { + "methods": [ + "getInspectTemplate" + ] + }, + "DeleteInspectTemplate": { + "methods": [ + "deleteInspectTemplate" + ] + }, + "CreateDeidentifyTemplate": { + "methods": [ + "createDeidentifyTemplate" + ] + }, + "UpdateDeidentifyTemplate": { + "methods": [ + "updateDeidentifyTemplate" + ] + }, + "GetDeidentifyTemplate": { + "methods": [ + "getDeidentifyTemplate" + ] + }, + "DeleteDeidentifyTemplate": { + "methods": [ + "deleteDeidentifyTemplate" + ] + }, + "CreateJobTrigger": { + "methods": [ + "createJobTrigger" + ] + }, + "UpdateJobTrigger": { + "methods": [ + "updateJobTrigger" + ] + }, + "HybridInspectJobTrigger": { + "methods": [ + "hybridInspectJobTrigger" + ] + }, + "GetJobTrigger": { + "methods": [ + "getJobTrigger" + ] + }, + "DeleteJobTrigger": { + "methods": [ + "deleteJobTrigger" + ] + }, + "ActivateJobTrigger": { + "methods": [ + "activateJobTrigger" + ] + }, + "CreateDlpJob": { + "methods": [ + "createDlpJob" + ] + }, + "GetDlpJob": { + "methods": [ + "getDlpJob" + ] + }, + "DeleteDlpJob": { + "methods": [ + "deleteDlpJob" + ] + }, + "CancelDlpJob": { + "methods": [ + "cancelDlpJob" + ] + }, + "CreateStoredInfoType": { + "methods": [ + "createStoredInfoType" + ] + }, + "UpdateStoredInfoType": { + "methods": [ + "updateStoredInfoType" + ] + }, + "GetStoredInfoType": { + "methods": [ + "getStoredInfoType" + ] + }, + "DeleteStoredInfoType": { + "methods": [ + "deleteStoredInfoType" + ] + }, + "HybridInspectDlpJob": { + "methods": [ + "hybridInspectDlpJob" + ] + }, + "FinishDlpJob": { + "methods": [ + "finishDlpJob" + ] + }, + "ListInspectTemplates": { + "methods": [ + "listInspectTemplates", + "listInspectTemplatesStream", + "listInspectTemplatesAsync" + ] + }, + "ListDeidentifyTemplates": { + "methods": [ + "listDeidentifyTemplates", + "listDeidentifyTemplatesStream", + "listDeidentifyTemplatesAsync" + ] + }, + "ListJobTriggers": { + "methods": [ + "listJobTriggers", + "listJobTriggersStream", + "listJobTriggersAsync" + ] + }, + "ListDlpJobs": { + "methods": [ + "listDlpJobs", + "listDlpJobsStream", + "listDlpJobsAsync" + ] + }, + "ListStoredInfoTypes": { + "methods": [ + "listStoredInfoTypes", + "listStoredInfoTypesStream", + "listStoredInfoTypesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DlpServiceClient", + "rpcs": { + "InspectContent": { + "methods": [ + "inspectContent" + ] + }, + "RedactImage": { + "methods": [ + "redactImage" + ] + }, + "DeidentifyContent": { + "methods": [ + "deidentifyContent" + ] + }, + "ReidentifyContent": { + "methods": [ + "reidentifyContent" + ] + }, + "ListInfoTypes": { + "methods": [ + "listInfoTypes" + ] + }, + "CreateInspectTemplate": { + "methods": [ + "createInspectTemplate" + ] + }, + "UpdateInspectTemplate": { + "methods": [ + "updateInspectTemplate" + ] + }, + "GetInspectTemplate": { + "methods": [ + "getInspectTemplate" + ] + }, + "DeleteInspectTemplate": { + "methods": [ + "deleteInspectTemplate" + ] + }, + "CreateDeidentifyTemplate": { + "methods": [ + "createDeidentifyTemplate" + ] + }, + "UpdateDeidentifyTemplate": { + "methods": [ + "updateDeidentifyTemplate" + ] + }, + "GetDeidentifyTemplate": { + "methods": [ + "getDeidentifyTemplate" + ] + }, + "DeleteDeidentifyTemplate": { + "methods": [ + "deleteDeidentifyTemplate" + ] + }, + "CreateJobTrigger": { + "methods": [ + "createJobTrigger" + ] + }, + "UpdateJobTrigger": { + "methods": [ + "updateJobTrigger" + ] + }, + "HybridInspectJobTrigger": { + "methods": [ + "hybridInspectJobTrigger" + ] + }, + "GetJobTrigger": { + "methods": [ + "getJobTrigger" + ] + }, + "DeleteJobTrigger": { + "methods": [ + "deleteJobTrigger" + ] + }, + "ActivateJobTrigger": { + "methods": [ + "activateJobTrigger" + ] + }, + "CreateDlpJob": { + "methods": [ + "createDlpJob" + ] + }, + "GetDlpJob": { + "methods": [ + "getDlpJob" + ] + }, + "DeleteDlpJob": { + "methods": [ + "deleteDlpJob" + ] + }, + "CancelDlpJob": { + "methods": [ + "cancelDlpJob" + ] + }, + "CreateStoredInfoType": { + "methods": [ + "createStoredInfoType" + ] + }, + "UpdateStoredInfoType": { + "methods": [ + "updateStoredInfoType" + ] + }, + "GetStoredInfoType": { + "methods": [ + "getStoredInfoType" + ] + }, + "DeleteStoredInfoType": { + "methods": [ + "deleteStoredInfoType" + ] + }, + "HybridInspectDlpJob": { + "methods": [ + "hybridInspectDlpJob" + ] + }, + "FinishDlpJob": { + "methods": [ + "finishDlpJob" + ] + }, + "ListInspectTemplates": { + "methods": [ + "listInspectTemplates", + "listInspectTemplatesStream", + "listInspectTemplatesAsync" + ] + }, + "ListDeidentifyTemplates": { + "methods": [ + "listDeidentifyTemplates", + "listDeidentifyTemplatesStream", + "listDeidentifyTemplatesAsync" + ] + }, + "ListJobTriggers": { + "methods": [ + "listJobTriggers", + "listJobTriggersStream", + "listJobTriggersAsync" + ] + }, + "ListDlpJobs": { + "methods": [ + "listDlpJobs", + "listDlpJobsStream", + "listDlpJobsAsync" + ] + }, + "ListStoredInfoTypes": { + "methods": [ + "listStoredInfoTypes", + "listStoredInfoTypesStream", + "listStoredInfoTypesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/v2/index.ts b/owl-bot-staging/google-privacy-dlp/v2/src/v2/index.ts new file mode 100644 index 00000000000..431cf809518 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/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 {DlpServiceClient} from './dlp_service_client'; diff --git a/owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..c845b99c767 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/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 dlp = require('@google-cloud/dlp'); + +function main() { + const dlpServiceClient = new dlp.DlpServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..69f24de7ba9 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/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 {DlpServiceClient} from '@google-cloud/dlp'; + +// check that the client class type name can be used +function doStuffWithDlpServiceClient(client: DlpServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const dlpServiceClient = new DlpServiceClient(); + doStuffWithDlpServiceClient(dlpServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-privacy-dlp/v2/system-test/install.ts b/owl-bot-staging/google-privacy-dlp/v2/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/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-privacy-dlp/v2/test/gapic_dlp_service_v2.ts b/owl-bot-staging/google-privacy-dlp/v2/test/gapic_dlp_service_v2.ts new file mode 100644 index 00000000000..701172c09cc --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/v2/test/gapic_dlp_service_v2.ts @@ -0,0 +1,5531 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This 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 dlpserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, 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('v2.DlpServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dlpserviceModule.v2.DlpServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dlpserviceModule.v2.DlpServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dlpserviceModule.v2.DlpServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dlpserviceModule.v2.DlpServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dlpServiceStub, undefined); + await client.initialize(); + assert(client.dlpServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dlpServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dlpServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dlpserviceModule.v2.DlpServiceClient({ + 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 dlpserviceModule.v2.DlpServiceClient({ + 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('inspectContent', () => { + it('invokes inspectContent without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectContentResponse() + ); + client.innerApiCalls.inspectContent = stubSimpleCall(expectedResponse); + const [response] = await client.inspectContent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes inspectContent without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectContentResponse() + ); + client.innerApiCalls.inspectContent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.inspectContent( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectContentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes inspectContent with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.inspectContent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.inspectContent(request), expectedError); + const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes inspectContent with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.inspectContent(request), expectedError); + }); + }); + + describe('redactImage', () => { + it('invokes redactImage without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.RedactImageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.RedactImageResponse() + ); + client.innerApiCalls.redactImage = stubSimpleCall(expectedResponse); + const [response] = await client.redactImage(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.redactImage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes redactImage without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.RedactImageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.RedactImageResponse() + ); + client.innerApiCalls.redactImage = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.redactImage( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IRedactImageResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.redactImage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes redactImage with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.RedactImageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.redactImage = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.redactImage(request), expectedError); + const actualRequest = (client.innerApiCalls.redactImage as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes redactImage with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.RedactImageRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.redactImage(request), expectedError); + }); + }); + + describe('deidentifyContent', () => { + it('invokes deidentifyContent without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyContentResponse() + ); + client.innerApiCalls.deidentifyContent = stubSimpleCall(expectedResponse); + const [response] = await client.deidentifyContent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deidentifyContent without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyContentResponse() + ); + client.innerApiCalls.deidentifyContent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deidentifyContent( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyContentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deidentifyContent with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deidentifyContent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deidentifyContent(request), expectedError); + const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deidentifyContent with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deidentifyContent(request), expectedError); + }); + }); + + describe('reidentifyContent', () => { + it('invokes reidentifyContent without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ReidentifyContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.ReidentifyContentResponse() + ); + client.innerApiCalls.reidentifyContent = stubSimpleCall(expectedResponse); + const [response] = await client.reidentifyContent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reidentifyContent without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ReidentifyContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.ReidentifyContentResponse() + ); + client.innerApiCalls.reidentifyContent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reidentifyContent( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IReidentifyContentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reidentifyContent with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ReidentifyContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reidentifyContent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.reidentifyContent(request), expectedError); + const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reidentifyContent with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ReidentifyContentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.reidentifyContent(request), expectedError); + }); + }); + + describe('listInfoTypes', () => { + it('invokes listInfoTypes without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInfoTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInfoTypesResponse() + ); + client.innerApiCalls.listInfoTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listInfoTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInfoTypes without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInfoTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInfoTypesResponse() + ); + client.innerApiCalls.listInfoTypes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInfoTypes( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IListInfoTypesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInfoTypes with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInfoTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInfoTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listInfoTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInfoTypes with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInfoTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listInfoTypes(request), expectedError); + }); + }); + + describe('createInspectTemplate', () => { + it('invokes createInspectTemplate without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectTemplate() + ); + client.innerApiCalls.createInspectTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.createInspectTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInspectTemplate without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectTemplate() + ); + client.innerApiCalls.createInspectTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInspectTemplate( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInspectTemplate with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInspectTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createInspectTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInspectTemplate with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createInspectTemplate(request), expectedError); + }); + }); + + describe('updateInspectTemplate', () => { + it('invokes updateInspectTemplate without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectTemplate() + ); + client.innerApiCalls.updateInspectTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.updateInspectTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateInspectTemplate without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectTemplate() + ); + client.innerApiCalls.updateInspectTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInspectTemplate( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateInspectTemplate with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInspectTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateInspectTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateInspectTemplate with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateInspectTemplate(request), expectedError); + }); + }); + + describe('getInspectTemplate', () => { + it('invokes getInspectTemplate without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectTemplate() + ); + client.innerApiCalls.getInspectTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.getInspectTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInspectTemplate without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.InspectTemplate() + ); + client.innerApiCalls.getInspectTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInspectTemplate( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInspectTemplate with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInspectTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getInspectTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInspectTemplate with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getInspectTemplate(request), expectedError); + }); + }); + + describe('deleteInspectTemplate', () => { + it('invokes deleteInspectTemplate without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteInspectTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.deleteInspectTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInspectTemplate without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteInspectTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInspectTemplate( + 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.deleteInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInspectTemplate with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInspectTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteInspectTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteInspectTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInspectTemplate with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteInspectTemplate(request), expectedError); + }); + }); + + describe('createDeidentifyTemplate', () => { + it('invokes createDeidentifyTemplate without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyTemplate() + ); + client.innerApiCalls.createDeidentifyTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.createDeidentifyTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDeidentifyTemplate without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyTemplate() + ); + client.innerApiCalls.createDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDeidentifyTemplate( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDeidentifyTemplate with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDeidentifyTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createDeidentifyTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDeidentifyTemplate with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createDeidentifyTemplate(request), expectedError); + }); + }); + + describe('updateDeidentifyTemplate', () => { + it('invokes updateDeidentifyTemplate without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyTemplate() + ); + client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.updateDeidentifyTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDeidentifyTemplate without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyTemplate() + ); + client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDeidentifyTemplate( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDeidentifyTemplate with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateDeidentifyTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDeidentifyTemplate with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateDeidentifyTemplate(request), expectedError); + }); + }); + + describe('getDeidentifyTemplate', () => { + it('invokes getDeidentifyTemplate without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyTemplate() + ); + client.innerApiCalls.getDeidentifyTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.getDeidentifyTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDeidentifyTemplate without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeidentifyTemplate() + ); + client.innerApiCalls.getDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDeidentifyTemplate( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDeidentifyTemplate with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDeidentifyTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDeidentifyTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDeidentifyTemplate with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDeidentifyTemplate(request), expectedError); + }); + }); + + describe('deleteDeidentifyTemplate', () => { + it('invokes deleteDeidentifyTemplate without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDeidentifyTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDeidentifyTemplate without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDeidentifyTemplate( + 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.deleteDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDeidentifyTemplate with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteDeidentifyTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDeidentifyTemplate with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteDeidentifyTemplate(request), expectedError); + }); + }); + + describe('createJobTrigger', () => { + it('invokes createJobTrigger without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.JobTrigger() + ); + client.innerApiCalls.createJobTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.createJobTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createJobTrigger without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.JobTrigger() + ); + client.innerApiCalls.createJobTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createJobTrigger( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createJobTrigger with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createJobTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createJobTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createJobTrigger with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createJobTrigger(request), expectedError); + }); + }); + + describe('updateJobTrigger', () => { + it('invokes updateJobTrigger without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.JobTrigger() + ); + client.innerApiCalls.updateJobTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.updateJobTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateJobTrigger without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.JobTrigger() + ); + client.innerApiCalls.updateJobTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateJobTrigger( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateJobTrigger with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateJobTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateJobTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateJobTrigger with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateJobTrigger(request), expectedError); + }); + }); + + describe('hybridInspectJobTrigger', () => { + it('invokes hybridInspectJobTrigger without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectResponse() + ); + client.innerApiCalls.hybridInspectJobTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.hybridInspectJobTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes hybridInspectJobTrigger without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectResponse() + ); + client.innerApiCalls.hybridInspectJobTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.hybridInspectJobTrigger( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IHybridInspectResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes hybridInspectJobTrigger with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.hybridInspectJobTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.hybridInspectJobTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes hybridInspectJobTrigger with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.hybridInspectJobTrigger(request), expectedError); + }); + }); + + describe('getJobTrigger', () => { + it('invokes getJobTrigger without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.JobTrigger() + ); + client.innerApiCalls.getJobTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.getJobTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJobTrigger without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.JobTrigger() + ); + client.innerApiCalls.getJobTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJobTrigger( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJobTrigger with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getJobTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJobTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJobTrigger with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getJobTrigger(request), expectedError); + }); + }); + + describe('deleteJobTrigger', () => { + it('invokes deleteJobTrigger without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteJobTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.deleteJobTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteJobTrigger without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteJobTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteJobTrigger( + 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.deleteJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteJobTrigger with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteJobTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteJobTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteJobTrigger with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteJobTrigger(request), expectedError); + }); + }); + + describe('activateJobTrigger', () => { + it('invokes activateJobTrigger without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DlpJob() + ); + client.innerApiCalls.activateJobTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.activateJobTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes activateJobTrigger without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DlpJob() + ); + client.innerApiCalls.activateJobTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.activateJobTrigger( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes activateJobTrigger with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.activateJobTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.activateJobTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes activateJobTrigger with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.activateJobTrigger(request), expectedError); + }); + }); + + describe('createDlpJob', () => { + it('invokes createDlpJob without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DlpJob() + ); + client.innerApiCalls.createDlpJob = stubSimpleCall(expectedResponse); + const [response] = await client.createDlpJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDlpJob without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DlpJob() + ); + client.innerApiCalls.createDlpJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDlpJob( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDlpJob with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDlpJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createDlpJob(request), expectedError); + const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDlpJob with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createDlpJob(request), expectedError); + }); + }); + + describe('getDlpJob', () => { + it('invokes getDlpJob without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DlpJob() + ); + client.innerApiCalls.getDlpJob = stubSimpleCall(expectedResponse); + const [response] = await client.getDlpJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDlpJob without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.DlpJob() + ); + client.innerApiCalls.getDlpJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDlpJob( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDlpJob with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDlpJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDlpJob(request), expectedError); + const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDlpJob with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDlpJob(request), expectedError); + }); + }); + + describe('deleteDlpJob', () => { + it('invokes deleteDlpJob without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDlpJob = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDlpJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDlpJob without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteDlpJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDlpJob( + 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.deleteDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDlpJob with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDlpJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteDlpJob(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDlpJob with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteDlpJob(request), expectedError); + }); + }); + + describe('cancelDlpJob', () => { + it('invokes cancelDlpJob without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CancelDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.cancelDlpJob = stubSimpleCall(expectedResponse); + const [response] = await client.cancelDlpJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelDlpJob without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CancelDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.cancelDlpJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelDlpJob( + 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.cancelDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelDlpJob with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CancelDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelDlpJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelDlpJob(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelDlpJob with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CancelDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelDlpJob(request), expectedError); + }); + }); + + describe('createStoredInfoType', () => { + it('invokes createStoredInfoType without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.StoredInfoType() + ); + client.innerApiCalls.createStoredInfoType = stubSimpleCall(expectedResponse); + const [response] = await client.createStoredInfoType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createStoredInfoType without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.StoredInfoType() + ); + client.innerApiCalls.createStoredInfoType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createStoredInfoType( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createStoredInfoType with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createStoredInfoType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createStoredInfoType(request), expectedError); + const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createStoredInfoType with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createStoredInfoType(request), expectedError); + }); + }); + + describe('updateStoredInfoType', () => { + it('invokes updateStoredInfoType without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.StoredInfoType() + ); + client.innerApiCalls.updateStoredInfoType = stubSimpleCall(expectedResponse); + const [response] = await client.updateStoredInfoType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateStoredInfoType without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.StoredInfoType() + ); + client.innerApiCalls.updateStoredInfoType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateStoredInfoType( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateStoredInfoType with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateStoredInfoType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateStoredInfoType(request), expectedError); + const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateStoredInfoType with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateStoredInfoType(request), expectedError); + }); + }); + + describe('getStoredInfoType', () => { + it('invokes getStoredInfoType without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.StoredInfoType() + ); + client.innerApiCalls.getStoredInfoType = stubSimpleCall(expectedResponse); + const [response] = await client.getStoredInfoType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStoredInfoType without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.StoredInfoType() + ); + client.innerApiCalls.getStoredInfoType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getStoredInfoType( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStoredInfoType with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getStoredInfoType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getStoredInfoType(request), expectedError); + const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStoredInfoType with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getStoredInfoType(request), expectedError); + }); + }); + + describe('deleteStoredInfoType', () => { + it('invokes deleteStoredInfoType without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteStoredInfoType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteStoredInfoType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteStoredInfoType without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteStoredInfoType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteStoredInfoType( + 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.deleteStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteStoredInfoType with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteStoredInfoType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteStoredInfoType(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteStoredInfoType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteStoredInfoType with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteStoredInfoType(request), expectedError); + }); + }); + + describe('hybridInspectDlpJob', () => { + it('invokes hybridInspectDlpJob without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectResponse() + ); + client.innerApiCalls.hybridInspectDlpJob = stubSimpleCall(expectedResponse); + const [response] = await client.hybridInspectDlpJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes hybridInspectDlpJob without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectResponse() + ); + client.innerApiCalls.hybridInspectDlpJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.hybridInspectDlpJob( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IHybridInspectResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes hybridInspectDlpJob with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.hybridInspectDlpJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.hybridInspectDlpJob(request), expectedError); + const actualRequest = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes hybridInspectDlpJob with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.HybridInspectDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.hybridInspectDlpJob(request), expectedError); + }); + }); + + describe('finishDlpJob', () => { + it('invokes finishDlpJob without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.FinishDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.FinishDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.finishDlpJob = stubSimpleCall(expectedResponse); + const [response] = await client.finishDlpJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.finishDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.finishDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes finishDlpJob without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.FinishDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.FinishDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.finishDlpJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.finishDlpJob( + 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.finishDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.finishDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes finishDlpJob with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.FinishDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.FinishDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.finishDlpJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.finishDlpJob(request), expectedError); + const actualRequest = (client.innerApiCalls.finishDlpJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.finishDlpJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes finishDlpJob with closed client', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.FinishDlpJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.FinishDlpJobRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.finishDlpJob(request), expectedError); + }); + }); + + describe('listInspectTemplates', () => { + it('invokes listInspectTemplates without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + ]; + client.innerApiCalls.listInspectTemplates = stubSimpleCall(expectedResponse); + const [response] = await client.listInspectTemplates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInspectTemplates without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + ]; + client.innerApiCalls.listInspectTemplates = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInspectTemplates( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInspectTemplates with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInspectTemplates = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listInspectTemplates(request), expectedError); + const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listInspectTemplatesStream without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + ]; + client.descriptors.page.listInspectTemplates.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listInspectTemplatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.privacy.dlp.v2.InspectTemplate[] = []; + stream.on('data', (response: protos.google.privacy.dlp.v2.InspectTemplate) => { + 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.listInspectTemplates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listInspectTemplates, request)); + assert( + (client.descriptors.page.listInspectTemplates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listInspectTemplatesStream with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInspectTemplates.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listInspectTemplatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.privacy.dlp.v2.InspectTemplate[] = []; + stream.on('data', (response: protos.google.privacy.dlp.v2.InspectTemplate) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listInspectTemplates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listInspectTemplates, request)); + assert( + (client.descriptors.page.listInspectTemplates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listInspectTemplates without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), + ]; + client.descriptors.page.listInspectTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.privacy.dlp.v2.IInspectTemplate[] = []; + const iterable = client.listInspectTemplatesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listInspectTemplates with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInspectTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInspectTemplatesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.privacy.dlp.v2.IInspectTemplate[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listDeidentifyTemplates', () => { + it('invokes listDeidentifyTemplates without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + ]; + client.innerApiCalls.listDeidentifyTemplates = stubSimpleCall(expectedResponse); + const [response] = await client.listDeidentifyTemplates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeidentifyTemplates without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + ]; + client.innerApiCalls.listDeidentifyTemplates = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDeidentifyTemplates( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeidentifyTemplates with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDeidentifyTemplates = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDeidentifyTemplates(request), expectedError); + const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDeidentifyTemplatesStream without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + ]; + client.descriptors.page.listDeidentifyTemplates.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDeidentifyTemplatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.privacy.dlp.v2.DeidentifyTemplate[] = []; + stream.on('data', (response: protos.google.privacy.dlp.v2.DeidentifyTemplate) => { + 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.listDeidentifyTemplates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDeidentifyTemplates, request)); + assert( + (client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDeidentifyTemplatesStream with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDeidentifyTemplates.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDeidentifyTemplatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.privacy.dlp.v2.DeidentifyTemplate[] = []; + stream.on('data', (response: protos.google.privacy.dlp.v2.DeidentifyTemplate) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDeidentifyTemplates, request)); + assert( + (client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDeidentifyTemplates without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), + ]; + client.descriptors.page.listDeidentifyTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.privacy.dlp.v2.IDeidentifyTemplate[] = []; + const iterable = client.listDeidentifyTemplatesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDeidentifyTemplates with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDeidentifyTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDeidentifyTemplatesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.privacy.dlp.v2.IDeidentifyTemplate[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listJobTriggers', () => { + it('invokes listJobTriggers without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListJobTriggersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + ]; + client.innerApiCalls.listJobTriggers = stubSimpleCall(expectedResponse); + const [response] = await client.listJobTriggers(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobTriggers without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListJobTriggersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + ]; + client.innerApiCalls.listJobTriggers = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listJobTriggers( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobTriggers with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListJobTriggersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listJobTriggers = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listJobTriggers(request), expectedError); + const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobTriggersStream without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListJobTriggersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + ]; + client.descriptors.page.listJobTriggers.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listJobTriggersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.privacy.dlp.v2.JobTrigger[] = []; + stream.on('data', (response: protos.google.privacy.dlp.v2.JobTrigger) => { + 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.listJobTriggers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobTriggers, request)); + assert( + (client.descriptors.page.listJobTriggers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listJobTriggersStream with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListJobTriggersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listJobTriggers.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listJobTriggersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.privacy.dlp.v2.JobTrigger[] = []; + stream.on('data', (response: protos.google.privacy.dlp.v2.JobTrigger) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listJobTriggers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobTriggers, request)); + assert( + (client.descriptors.page.listJobTriggers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listJobTriggers without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListJobTriggersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), + ]; + client.descriptors.page.listJobTriggers.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.privacy.dlp.v2.IJobTrigger[] = []; + const iterable = client.listJobTriggersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listJobTriggers with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListJobTriggersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listJobTriggers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listJobTriggersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.privacy.dlp.v2.IJobTrigger[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listDlpJobs', () => { + it('invokes listDlpJobs without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDlpJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + ]; + client.innerApiCalls.listDlpJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listDlpJobs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDlpJobs without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDlpJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + ]; + client.innerApiCalls.listDlpJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDlpJobs( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDlpJobs with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDlpJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDlpJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDlpJobs(request), expectedError); + const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDlpJobsStream without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDlpJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + ]; + client.descriptors.page.listDlpJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDlpJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.privacy.dlp.v2.DlpJob[] = []; + stream.on('data', (response: protos.google.privacy.dlp.v2.DlpJob) => { + 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.listDlpJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDlpJobs, request)); + assert( + (client.descriptors.page.listDlpJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDlpJobsStream with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDlpJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDlpJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDlpJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.privacy.dlp.v2.DlpJob[] = []; + stream.on('data', (response: protos.google.privacy.dlp.v2.DlpJob) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDlpJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDlpJobs, request)); + assert( + (client.descriptors.page.listDlpJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDlpJobs without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDlpJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), + ]; + client.descriptors.page.listDlpJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.privacy.dlp.v2.IDlpJob[] = []; + const iterable = client.listDlpJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDlpJobs with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListDlpJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDlpJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDlpJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.privacy.dlp.v2.IDlpJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listStoredInfoTypes', () => { + it('invokes listStoredInfoTypes without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + ]; + client.innerApiCalls.listStoredInfoTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listStoredInfoTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStoredInfoTypes without error using callback', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + ]; + client.innerApiCalls.listStoredInfoTypes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listStoredInfoTypes( + request, + (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStoredInfoTypes with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listStoredInfoTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listStoredInfoTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStoredInfoTypesStream without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + ]; + client.descriptors.page.listStoredInfoTypes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listStoredInfoTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.privacy.dlp.v2.StoredInfoType[] = []; + stream.on('data', (response: protos.google.privacy.dlp.v2.StoredInfoType) => { + 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.listStoredInfoTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listStoredInfoTypes, request)); + assert( + (client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listStoredInfoTypesStream with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listStoredInfoTypes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listStoredInfoTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.privacy.dlp.v2.StoredInfoType[] = []; + stream.on('data', (response: protos.google.privacy.dlp.v2.StoredInfoType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listStoredInfoTypes, request)); + assert( + (client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listStoredInfoTypes without error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), + ]; + client.descriptors.page.listStoredInfoTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.privacy.dlp.v2.IStoredInfoType[] = []; + const iterable = client.listStoredInfoTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listStoredInfoTypes with error', async () => { + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listStoredInfoTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listStoredInfoTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.privacy.dlp.v2.IStoredInfoType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listStoredInfoTypes.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 dlpserviceModule.v2.DlpServiceClient({ + 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 dlpserviceModule.v2.DlpServiceClient({ + 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 dlpserviceModule.v2.DlpServiceClient({ + 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 dlpserviceModule.v2.DlpServiceClient({ + 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 dlpserviceModule.v2.DlpServiceClient({ + 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('finding', () => { + const fakePath = "/rendered/path/finding"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + finding: "findingValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.findingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.findingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('findingPath', () => { + const result = client.findingPath("projectValue", "locationValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFindingName', () => { + const result = client.matchProjectFromFindingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFindingName', () => { + const result = client.matchLocationFromFindingName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFindingName', () => { + const result = client.matchFindingFromFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organization', () => { + const fakePath = "/rendered/path/organization"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + 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('organizationDeidentifyTemplate', () => { + const fakePath = "/rendered/path/organizationDeidentifyTemplate"; + const expectedParameters = { + organization: "organizationValue", + deidentify_template: "deidentifyTemplateValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationDeidentifyTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationDeidentifyTemplatePath', () => { + const result = client.organizationDeidentifyTemplatePath("organizationValue", "deidentifyTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationDeidentifyTemplateName', () => { + const result = client.matchOrganizationFromOrganizationDeidentifyTemplateName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName', () => { + const result = client.matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName(fakePath); + assert.strictEqual(result, "deidentifyTemplateValue"); + assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationInspectTemplate', () => { + const fakePath = "/rendered/path/organizationInspectTemplate"; + const expectedParameters = { + organization: "organizationValue", + inspect_template: "inspectTemplateValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationInspectTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationInspectTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationInspectTemplatePath', () => { + const result = client.organizationInspectTemplatePath("organizationValue", "inspectTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationInspectTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationInspectTemplateName', () => { + const result = client.matchOrganizationFromOrganizationInspectTemplateName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationInspectTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInspectTemplateFromOrganizationInspectTemplateName', () => { + const result = client.matchInspectTemplateFromOrganizationInspectTemplateName(fakePath); + assert.strictEqual(result, "inspectTemplateValue"); + assert((client.pathTemplates.organizationInspectTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationDeidentifyTemplate', () => { + const fakePath = "/rendered/path/organizationLocationDeidentifyTemplate"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + deidentify_template: "deidentifyTemplateValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationDeidentifyTemplatePath', () => { + const result = client.organizationLocationDeidentifyTemplatePath("organizationValue", "locationValue", "deidentifyTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationDeidentifyTemplateName', () => { + const result = client.matchOrganizationFromOrganizationLocationDeidentifyTemplateName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationDeidentifyTemplateName', () => { + const result = client.matchLocationFromOrganizationLocationDeidentifyTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeidentifyTemplateFromOrganizationLocationDeidentifyTemplateName', () => { + const result = client.matchDeidentifyTemplateFromOrganizationLocationDeidentifyTemplateName(fakePath); + assert.strictEqual(result, "deidentifyTemplateValue"); + assert((client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationInspectTemplate', () => { + const fakePath = "/rendered/path/organizationLocationInspectTemplate"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + inspect_template: "inspectTemplateValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationInspectTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationInspectTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationInspectTemplatePath', () => { + const result = client.organizationLocationInspectTemplatePath("organizationValue", "locationValue", "inspectTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationInspectTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationInspectTemplateName', () => { + const result = client.matchOrganizationFromOrganizationLocationInspectTemplateName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationInspectTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationInspectTemplateName', () => { + const result = client.matchLocationFromOrganizationLocationInspectTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationInspectTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInspectTemplateFromOrganizationLocationInspectTemplateName', () => { + const result = client.matchInspectTemplateFromOrganizationLocationInspectTemplateName(fakePath); + assert.strictEqual(result, "inspectTemplateValue"); + assert((client.pathTemplates.organizationLocationInspectTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationLocationStoredInfoType', () => { + const fakePath = "/rendered/path/organizationLocationStoredInfoType"; + const expectedParameters = { + organization: "organizationValue", + location: "locationValue", + stored_info_type: "storedInfoTypeValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationStoredInfoTypePath', () => { + const result = client.organizationLocationStoredInfoTypePath("organizationValue", "locationValue", "storedInfoTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationLocationStoredInfoTypeName', () => { + const result = client.matchOrganizationFromOrganizationLocationStoredInfoTypeName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromOrganizationLocationStoredInfoTypeName', () => { + const result = client.matchLocationFromOrganizationLocationStoredInfoTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchStoredInfoTypeFromOrganizationLocationStoredInfoTypeName', () => { + const result = client.matchStoredInfoTypeFromOrganizationLocationStoredInfoTypeName(fakePath); + assert.strictEqual(result, "storedInfoTypeValue"); + assert((client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationStoredInfoType', () => { + const fakePath = "/rendered/path/organizationStoredInfoType"; + const expectedParameters = { + organization: "organizationValue", + stored_info_type: "storedInfoTypeValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationStoredInfoTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationStoredInfoTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationStoredInfoTypePath', () => { + const result = client.organizationStoredInfoTypePath("organizationValue", "storedInfoTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationStoredInfoTypeName', () => { + const result = client.matchOrganizationFromOrganizationStoredInfoTypeName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchStoredInfoTypeFromOrganizationStoredInfoTypeName', () => { + const result = client.matchStoredInfoTypeFromOrganizationStoredInfoTypeName(fakePath); + assert.strictEqual(result, "storedInfoTypeValue"); + assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + 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('projectDeidentifyTemplate', () => { + const fakePath = "/rendered/path/projectDeidentifyTemplate"; + const expectedParameters = { + project: "projectValue", + deidentify_template: "deidentifyTemplateValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectDeidentifyTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectDeidentifyTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectDeidentifyTemplatePath', () => { + const result = client.projectDeidentifyTemplatePath("projectValue", "deidentifyTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectDeidentifyTemplateName', () => { + const result = client.matchProjectFromProjectDeidentifyTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeidentifyTemplateFromProjectDeidentifyTemplateName', () => { + const result = client.matchDeidentifyTemplateFromProjectDeidentifyTemplateName(fakePath); + assert.strictEqual(result, "deidentifyTemplateValue"); + assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectDlpContent', () => { + const fakePath = "/rendered/path/projectDlpContent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectDlpContentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectDlpContentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectDlpContentPath', () => { + const result = client.projectDlpContentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectDlpContentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectDlpContentName', () => { + const result = client.matchProjectFromProjectDlpContentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectDlpContentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectDlpJob', () => { + const fakePath = "/rendered/path/projectDlpJob"; + const expectedParameters = { + project: "projectValue", + dlp_job: "dlpJobValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectDlpJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectDlpJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectDlpJobPath', () => { + const result = client.projectDlpJobPath("projectValue", "dlpJobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectDlpJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectDlpJobName', () => { + const result = client.matchProjectFromProjectDlpJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectDlpJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDlpJobFromProjectDlpJobName', () => { + const result = client.matchDlpJobFromProjectDlpJobName(fakePath); + assert.strictEqual(result, "dlpJobValue"); + assert((client.pathTemplates.projectDlpJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectInspectTemplate', () => { + const fakePath = "/rendered/path/projectInspectTemplate"; + const expectedParameters = { + project: "projectValue", + inspect_template: "inspectTemplateValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectInspectTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectInspectTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectInspectTemplatePath', () => { + const result = client.projectInspectTemplatePath("projectValue", "inspectTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectInspectTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectInspectTemplateName', () => { + const result = client.matchProjectFromProjectInspectTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectInspectTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInspectTemplateFromProjectInspectTemplateName', () => { + const result = client.matchInspectTemplateFromProjectInspectTemplateName(fakePath); + assert.strictEqual(result, "inspectTemplateValue"); + assert((client.pathTemplates.projectInspectTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectJobTrigger', () => { + const fakePath = "/rendered/path/projectJobTrigger"; + const expectedParameters = { + project: "projectValue", + job_trigger: "jobTriggerValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectJobTriggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectJobTriggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectJobTriggerPath', () => { + const result = client.projectJobTriggerPath("projectValue", "jobTriggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectJobTriggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectJobTriggerName', () => { + const result = client.matchProjectFromProjectJobTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectJobTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobTriggerFromProjectJobTriggerName', () => { + const result = client.matchJobTriggerFromProjectJobTriggerName(fakePath); + assert.strictEqual(result, "jobTriggerValue"); + assert((client.pathTemplates.projectJobTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationDeidentifyTemplate', () => { + const fakePath = "/rendered/path/projectLocationDeidentifyTemplate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + deidentify_template: "deidentifyTemplateValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationDeidentifyTemplatePath', () => { + const result = client.projectLocationDeidentifyTemplatePath("projectValue", "locationValue", "deidentifyTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationDeidentifyTemplateName', () => { + const result = client.matchProjectFromProjectLocationDeidentifyTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationDeidentifyTemplateName', () => { + const result = client.matchLocationFromProjectLocationDeidentifyTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeidentifyTemplateFromProjectLocationDeidentifyTemplateName', () => { + const result = client.matchDeidentifyTemplateFromProjectLocationDeidentifyTemplateName(fakePath); + assert.strictEqual(result, "deidentifyTemplateValue"); + assert((client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationDlpJob', () => { + const fakePath = "/rendered/path/projectLocationDlpJob"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + dlp_job: "dlpJobValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationDlpJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationDlpJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationDlpJobPath', () => { + const result = client.projectLocationDlpJobPath("projectValue", "locationValue", "dlpJobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationDlpJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationDlpJobName', () => { + const result = client.matchProjectFromProjectLocationDlpJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationDlpJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationDlpJobName', () => { + const result = client.matchLocationFromProjectLocationDlpJobName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationDlpJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDlpJobFromProjectLocationDlpJobName', () => { + const result = client.matchDlpJobFromProjectLocationDlpJobName(fakePath); + assert.strictEqual(result, "dlpJobValue"); + assert((client.pathTemplates.projectLocationDlpJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationInspectTemplate', () => { + const fakePath = "/rendered/path/projectLocationInspectTemplate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + inspect_template: "inspectTemplateValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationInspectTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationInspectTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationInspectTemplatePath', () => { + const result = client.projectLocationInspectTemplatePath("projectValue", "locationValue", "inspectTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationInspectTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationInspectTemplateName', () => { + const result = client.matchProjectFromProjectLocationInspectTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationInspectTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationInspectTemplateName', () => { + const result = client.matchLocationFromProjectLocationInspectTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationInspectTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInspectTemplateFromProjectLocationInspectTemplateName', () => { + const result = client.matchInspectTemplateFromProjectLocationInspectTemplateName(fakePath); + assert.strictEqual(result, "inspectTemplateValue"); + assert((client.pathTemplates.projectLocationInspectTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationJobTrigger', () => { + const fakePath = "/rendered/path/projectLocationJobTrigger"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + job_trigger: "jobTriggerValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationJobTriggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationJobTriggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationJobTriggerPath', () => { + const result = client.projectLocationJobTriggerPath("projectValue", "locationValue", "jobTriggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationJobTriggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationJobTriggerName', () => { + const result = client.matchProjectFromProjectLocationJobTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationJobTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationJobTriggerName', () => { + const result = client.matchLocationFromProjectLocationJobTriggerName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationJobTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobTriggerFromProjectLocationJobTriggerName', () => { + const result = client.matchJobTriggerFromProjectLocationJobTriggerName(fakePath); + assert.strictEqual(result, "jobTriggerValue"); + assert((client.pathTemplates.projectLocationJobTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationStoredInfoType', () => { + const fakePath = "/rendered/path/projectLocationStoredInfoType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + stored_info_type: "storedInfoTypeValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationStoredInfoTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationStoredInfoTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationStoredInfoTypePath', () => { + const result = client.projectLocationStoredInfoTypePath("projectValue", "locationValue", "storedInfoTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationStoredInfoTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationStoredInfoTypeName', () => { + const result = client.matchProjectFromProjectLocationStoredInfoTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationStoredInfoTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationStoredInfoTypeName', () => { + const result = client.matchLocationFromProjectLocationStoredInfoTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationStoredInfoTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchStoredInfoTypeFromProjectLocationStoredInfoTypeName', () => { + const result = client.matchStoredInfoTypeFromProjectLocationStoredInfoTypeName(fakePath); + assert.strictEqual(result, "storedInfoTypeValue"); + assert((client.pathTemplates.projectLocationStoredInfoTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectStoredInfoType', () => { + const fakePath = "/rendered/path/projectStoredInfoType"; + const expectedParameters = { + project: "projectValue", + stored_info_type: "storedInfoTypeValue", + }; + const client = new dlpserviceModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectStoredInfoTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectStoredInfoTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectStoredInfoTypePath', () => { + const result = client.projectStoredInfoTypePath("projectValue", "storedInfoTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectStoredInfoTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectStoredInfoTypeName', () => { + const result = client.matchProjectFromProjectStoredInfoTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectStoredInfoTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchStoredInfoTypeFromProjectStoredInfoTypeName', () => { + const result = client.matchStoredInfoTypeFromProjectStoredInfoTypeName(fakePath); + assert.strictEqual(result, "storedInfoTypeValue"); + assert((client.pathTemplates.projectStoredInfoTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-privacy-dlp/v2/tsconfig.json b/owl-bot-staging/google-privacy-dlp/v2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/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-privacy-dlp/v2/webpack.config.js b/owl-bot-staging/google-privacy-dlp/v2/webpack.config.js new file mode 100644 index 00000000000..4eaa3715661 --- /dev/null +++ b/owl-bot-staging/google-privacy-dlp/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: 'DlpService', + filename: './dlp-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 ed43f6aab2e7aa32f730243d661e7f8c72494fd2 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 24 Aug 2023 21:19:38 +0000 Subject: [PATCH 2/3] =?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 --- .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../google-cloud-vmwareengine/v1/.gitignore | 14 - .../google-cloud-vmwareengine/v1/.jsdoc.js | 55 - .../google-cloud-vmwareengine/v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../google-cloud-vmwareengine/v1/README.md | 1 - .../google-cloud-vmwareengine/v1/package.json | 58 - .../cloud/vmwareengine/v1/vmwareengine.proto | 2015 ----- .../v1/vmwareengine_resources.proto | 931 -- ...metadata_google.cloud.vmwareengine.v1.json | 1863 ---- .../v1/vmware_engine.create_cluster.js | 95 - ...vmware_engine.create_hcx_activation_key.js | 101 - .../v1/vmware_engine.create_network_policy.js | 102 - .../v1/vmware_engine.create_private_cloud.js | 95 - ...vmware_engine.create_private_connection.js | 100 - ...are_engine.create_vmware_engine_network.js | 105 - .../v1/vmware_engine.delete_cluster.js | 71 - .../v1/vmware_engine.delete_network_policy.js | 81 - .../v1/vmware_engine.delete_private_cloud.js | 90 - ...vmware_engine.delete_private_connection.js | 81 - ...are_engine.delete_vmware_engine_network.js | 88 - .../generated/v1/vmware_engine.get_cluster.js | 65 - .../vmware_engine.get_hcx_activation_key.js | 65 - .../v1/vmware_engine.get_network_policy.js | 65 - .../v1/vmware_engine.get_node_type.js | 65 - .../v1/vmware_engine.get_private_cloud.js | 65 - .../vmware_engine.get_private_connection.js | 65 - .../generated/v1/vmware_engine.get_subnet.js | 65 - ...vmware_engine.get_vmware_engine_network.js | 65 - .../v1/vmware_engine.list_clusters.js | 104 - .../vmware_engine.list_hcx_activation_keys.js | 83 - .../v1/vmware_engine.list_network_policies.js | 114 - .../v1/vmware_engine.list_node_types.js | 106 - .../v1/vmware_engine.list_private_clouds.js | 114 - ....list_private_connection_peering_routes.js | 80 - .../vmware_engine.list_private_connections.js | 113 - .../v1/vmware_engine.list_subnets.js | 82 - ...ware_engine.list_vmware_engine_networks.js | 113 - .../v1/vmware_engine.reset_nsx_credentials.js | 82 - ...vmware_engine.reset_vcenter_credentials.js | 82 - .../v1/vmware_engine.show_nsx_credentials.js | 66 - .../vmware_engine.show_vcenter_credentials.js | 66 - .../vmware_engine.undelete_private_cloud.js | 71 - .../v1/vmware_engine.update_cluster.js | 81 - .../v1/vmware_engine.update_network_policy.js | 86 - .../v1/vmware_engine.update_private_cloud.js | 76 - ...vmware_engine.update_private_connection.js | 86 - .../v1/vmware_engine.update_subnet.js | 71 - ...are_engine.update_vmware_engine_network.js | 87 - .../google-cloud-vmwareengine/v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 449 - .../v1/src/v1/index.ts | 19 - .../v1/src/v1/vmware_engine_client.ts | 6815 --------------- .../src/v1/vmware_engine_client_config.json | 233 - .../v1/src/v1/vmware_engine_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 - .../v1/test/gapic_vmware_engine_v1.ts | 7762 ----------------- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../google-cloud-vpcaccess/v1/.eslintignore | 7 - .../google-cloud-vpcaccess/v1/.eslintrc.json | 3 - .../google-cloud-vpcaccess/v1/.gitignore | 14 - .../google-cloud-vpcaccess/v1/.jsdoc.js | 55 - .../google-cloud-vpcaccess/v1/.mocharc.js | 33 - .../google-cloud-vpcaccess/v1/.prettierrc.js | 22 - .../google-cloud-vpcaccess/v1/README.md | 1 - .../google-cloud-vpcaccess/v1/package.json | 58 - .../cloud/vpcaccess/v1/vpc_access.proto | 248 - ...et_metadata_google.cloud.vpcaccess.v1.json | 191 - .../v1/vpc_access_service.create_connector.js | 73 - .../v1/vpc_access_service.delete_connector.js | 62 - .../v1/vpc_access_service.get_connector.js | 61 - .../v1/vpc_access_service.list_connectors.js | 71 - .../google-cloud-vpcaccess/v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 67 - .../google-cloud-vpcaccess/v1/src/v1/index.ts | 19 - .../v1/src/v1/vpc_access_service_client.ts | 1139 --- .../v1/vpc_access_service_client_config.json | 46 - .../src/v1/vpc_access_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_vpc_access_service_v1.ts | 1382 --- .../google-cloud-vpcaccess/v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../google-cloud-webrisk/v1/.eslintignore | 7 - .../google-cloud-webrisk/v1/.eslintrc.json | 3 - .../google-cloud-webrisk/v1/.gitignore | 14 - .../google-cloud-webrisk/v1/.jsdoc.js | 55 - .../google-cloud-webrisk/v1/.mocharc.js | 33 - .../google-cloud-webrisk/v1/.prettierrc.js | 22 - .../google-cloud-webrisk/v1/README.md | 1 - .../google-cloud-webrisk/v1/package.json | 58 - .../google/cloud/webrisk/v1/webrisk.proto | 560 -- ...ppet_metadata_google.cloud.webrisk.v1.json | 247 - ...b_risk_service.compute_threat_list_diff.js | 76 - .../v1/web_risk_service.create_submission.js | 67 - .../v1/web_risk_service.search_hashes.js | 69 - .../v1/web_risk_service.search_uris.js | 67 - .../v1/web_risk_service.submit_uri.js | 76 - .../google-cloud-webrisk/v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 73 - .../google-cloud-webrisk/v1/src/v1/index.ts | 19 - .../v1/src/v1/web_risk_service_client.ts | 957 -- .../v1/web_risk_service_client_config.json | 50 - .../src/v1/web_risk_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_web_risk_service_v1.ts | 961 -- .../google-cloud-webrisk/v1/tsconfig.json | 19 - .../google-cloud-webrisk/v1/webpack.config.js | 64 - .../v1beta1/.eslintignore | 7 - .../v1beta1/.eslintrc.json | 3 - .../google-cloud-webrisk/v1beta1/.gitignore | 14 - .../google-cloud-webrisk/v1beta1/.jsdoc.js | 55 - .../google-cloud-webrisk/v1beta1/.mocharc.js | 33 - .../v1beta1/.prettierrc.js | 22 - .../google-cloud-webrisk/v1beta1/README.md | 1 - .../google-cloud-webrisk/v1beta1/package.json | 58 - .../cloud/webrisk/v1beta1/webrisk.proto | 303 - ...metadata_google.cloud.webrisk.v1beta1.json | 151 - ...rvice_v1_beta1.compute_threat_list_diff.js | 71 - ...web_risk_service_v1_beta1.search_hashes.js | 66 - .../web_risk_service_v1_beta1.search_uris.js | 66 - .../google-cloud-webrisk/v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 53 - .../v1beta1/src/v1beta1/index.ts | 19 - .../web_risk_service_v1_beta1_client.ts | 516 -- ...b_risk_service_v1_beta1_client_config.json | 41 - .../web_risk_service_v1_beta1_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 - ...gapic_web_risk_service_v1_beta1_v1beta1.ts | 375 - .../v1beta1/tsconfig.json | 19 - .../v1beta1/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 - .../websecurityscanner/v1/crawled_url.proto | 40 - .../cloud/websecurityscanner/v1/finding.proto | 122 - .../websecurityscanner/v1/finding_addon.proto | 166 - .../v1/finding_type_stats.proto | 35 - .../websecurityscanner/v1/scan_config.proto | 193 - .../v1/scan_config_error.proto | 189 - .../websecurityscanner/v1/scan_run.proto | 110 - .../v1/scan_run_error_trace.proto | 75 - .../websecurityscanner/v1/scan_run_log.proto | 55 - .../v1/scan_run_warning_trace.proto | 61 - .../v1/web_security_scanner.proto | 337 - ...ta_google.cloud.websecurityscanner.v1.json | 579 -- ...web_security_scanner.create_scan_config.js | 65 - ...web_security_scanner.delete_scan_config.js | 61 - .../v1/web_security_scanner.get_finding.js | 62 - .../web_security_scanner.get_scan_config.js | 61 - .../v1/web_security_scanner.get_scan_run.js | 62 - .../web_security_scanner.list_crawled_urls.js | 76 - ...ecurity_scanner.list_finding_type_stats.js | 62 - .../v1/web_security_scanner.list_findings.js | 83 - .../web_security_scanner.list_scan_configs.js | 75 - .../v1/web_security_scanner.list_scan_runs.js | 75 - .../v1/web_security_scanner.start_scan_run.js | 61 - .../v1/web_security_scanner.stop_scan_run.js | 62 - ...web_security_scanner.update_scan_config.js | 68 - .../v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 169 - .../v1/src/v1/index.ts | 19 - .../v1/src/v1/web_security_scanner_client.ts | 1810 ---- .../web_security_scanner_client_config.json | 91 - .../v1/web_security_scanner_proto_list.json | 13 - .../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_web_security_scanner_v1.ts | 2210 ----- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1alpha/.eslintignore | 7 - .../v1alpha/.eslintrc.json | 3 - .../v1alpha/.gitignore | 14 - .../v1alpha/.jsdoc.js | 55 - .../v1alpha/.mocharc.js | 33 - .../v1alpha/.prettierrc.js | 22 - .../v1alpha/README.md | 1 - .../v1alpha/package.json | 58 - .../v1alpha/crawled_url.proto | 38 - .../websecurityscanner/v1alpha/finding.proto | 152 - .../v1alpha/finding_addon.proto | 78 - .../v1alpha/finding_type_stats.proto | 35 - .../v1alpha/scan_config.proto | 157 - .../websecurityscanner/v1alpha/scan_run.proto | 104 - .../v1alpha/web_security_scanner.proto | 410 - ...ogle.cloud.websecurityscanner.v1alpha.json | 579 -- ...web_security_scanner.create_scan_config.js | 67 - ...web_security_scanner.delete_scan_config.js | 62 - .../web_security_scanner.get_finding.js | 63 - .../web_security_scanner.get_scan_config.js | 62 - .../web_security_scanner.get_scan_run.js | 63 - .../web_security_scanner.list_crawled_urls.js | 77 - ...ecurity_scanner.list_finding_type_stats.js | 63 - .../web_security_scanner.list_findings.js | 85 - .../web_security_scanner.list_scan_configs.js | 76 - .../web_security_scanner.list_scan_runs.js | 76 - .../web_security_scanner.start_scan_run.js | 62 - .../web_security_scanner.stop_scan_run.js | 63 - ...web_security_scanner.update_scan_config.js | 70 - .../v1alpha/src/index.ts | 25 - .../v1alpha/src/v1alpha/gapic_metadata.json | 169 - .../v1alpha/src/v1alpha/index.ts | 19 - .../v1alpha/web_security_scanner_client.ts | 1927 ---- .../web_security_scanner_client_config.json | 91 - .../web_security_scanner_proto_list.json | 9 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1alpha/system-test/install.ts | 49 - .../gapic_web_security_scanner_v1alpha.ts | 2324 ----- .../v1alpha/tsconfig.json | 19 - .../v1alpha/webpack.config.js | 64 - .../v1beta/.eslintignore | 7 - .../v1beta/.eslintrc.json | 3 - .../v1beta/.gitignore | 14 - .../v1beta/.jsdoc.js | 55 - .../v1beta/.mocharc.js | 33 - .../v1beta/.prettierrc.js | 22 - .../v1beta/README.md | 1 - .../v1beta/package.json | 58 - .../v1beta/crawled_url.proto | 41 - .../websecurityscanner/v1beta/finding.proto | 98 - .../v1beta/finding_addon.proto | 90 - .../v1beta/finding_type_stats.proto | 36 - .../v1beta/scan_config.proto | 193 - .../v1beta/scan_config_error.proto | 190 - .../websecurityscanner/v1beta/scan_run.proto | 117 - .../v1beta/scan_run_error_trace.proto | 76 - .../v1beta/scan_run_warning_trace.proto | 59 - .../v1beta/web_security_scanner.proto | 413 - ...oogle.cloud.websecurityscanner.v1beta.json | 579 -- ...web_security_scanner.create_scan_config.js | 67 - ...web_security_scanner.delete_scan_config.js | 62 - .../web_security_scanner.get_finding.js | 63 - .../web_security_scanner.get_scan_config.js | 62 - .../web_security_scanner.get_scan_run.js | 63 - .../web_security_scanner.list_crawled_urls.js | 77 - ...ecurity_scanner.list_finding_type_stats.js | 63 - .../web_security_scanner.list_findings.js | 85 - .../web_security_scanner.list_scan_configs.js | 76 - .../web_security_scanner.list_scan_runs.js | 76 - .../web_security_scanner.start_scan_run.js | 62 - .../web_security_scanner.stop_scan_run.js | 63 - ...web_security_scanner.update_scan_config.js | 70 - .../v1beta/src/index.ts | 25 - .../v1beta/src/v1beta/gapic_metadata.json | 169 - .../v1beta/src/v1beta/index.ts | 19 - .../src/v1beta/web_security_scanner_client.ts | 1927 ---- .../web_security_scanner_client_config.json | 91 - .../web_security_scanner_proto_list.json | 12 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta/system-test/install.ts | 49 - .../test/gapic_web_security_scanner_v1beta.ts | 2324 ----- .../v1beta/tsconfig.json | 19 - .../v1beta/webpack.config.js | 64 - .../executions/v1/.eslintignore | 7 - .../executions/v1/.eslintrc.json | 3 - .../executions/v1/.gitignore | 14 - .../executions/v1/.jsdoc.js | 55 - .../executions/v1/.mocharc.js | 33 - .../executions/v1/.prettierrc.js | 22 - .../executions/v1/README.md | 1 - .../executions/v1/package.json | 58 - .../workflows/executions/v1/executions.proto | 399 - .../v1/executions.cancel_execution.js | 63 - .../v1/executions.create_execution.js | 68 - .../generated/v1/executions.get_execution.js | 68 - .../v1/executions.list_executions.js | 100 - ..._google.cloud.workflows.executions.v1.json | 203 - .../executions/v1/src/index.ts | 25 - .../executions/v1/src/v1/executions_client.ts | 909 -- .../v1/src/v1/executions_client_config.json | 42 - .../v1/src/v1/executions_proto_list.json | 3 - .../executions/v1/src/v1/gapic_metadata.json | 67 - .../executions/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../executions/v1/system-test/install.ts | 49 - .../executions/v1/test/gapic_executions_v1.ts | 869 -- .../executions/v1/tsconfig.json | 19 - .../executions/v1/webpack.config.js | 64 - .../executions/v1beta/.eslintignore | 7 - .../executions/v1beta/.eslintrc.json | 3 - .../executions/v1beta/.gitignore | 14 - .../executions/v1beta/.jsdoc.js | 55 - .../executions/v1beta/.mocharc.js | 33 - .../executions/v1beta/.prettierrc.js | 22 - .../executions/v1beta/README.md | 1 - .../executions/v1beta/package.json | 58 - .../executions/v1beta/executions.proto | 252 - .../v1beta/executions.cancel_execution.js | 63 - .../v1beta/executions.create_execution.js | 68 - .../v1beta/executions.get_execution.js | 68 - .../v1beta/executions.list_executions.js | 84 - ...gle.cloud.workflows.executions.v1beta.json | 195 - .../executions/v1beta/src/index.ts | 25 - .../v1beta/src/v1beta/executions_client.ts | 870 -- .../src/v1beta/executions_client_config.json | 42 - .../src/v1beta/executions_proto_list.json | 3 - .../v1beta/src/v1beta/gapic_metadata.json | 67 - .../executions/v1beta/src/v1beta/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../executions/v1beta/system-test/install.ts | 49 - .../v1beta/test/gapic_executions_v1beta.ts | 869 -- .../executions/v1beta/tsconfig.json | 19 - .../executions/v1beta/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 - .../workflows/executions/v1/executions.proto | 399 - .../google/cloud/workflows/v1/workflows.proto | 409 - .../v1/executions.cancel_execution.js | 63 - .../v1/executions.create_execution.js | 68 - .../generated/v1/executions.get_execution.js | 68 - .../v1/executions.list_executions.js | 100 - ..._google.cloud.workflows.executions.v1.json | 203 - ...et_metadata_google.cloud.workflows.v1.json | 247 - .../generated/v1/workflows.create_workflow.js | 79 - .../generated/v1/workflows.delete_workflow.js | 63 - .../generated/v1/workflows.get_workflow.js | 70 - .../generated/v1/workflows.list_workflows.js | 89 - .../generated/v1/workflows.update_workflow.js | 67 - .../v1/src/index.ts | 25 - .../v1/src/v1/executions_client.ts | 909 -- .../v1/src/v1/executions_client_config.json | 42 - .../v1/src/v1/executions_proto_list.json | 3 - .../v1/src/v1/gapic_metadata.json | 77 - .../v1/src/v1/index.ts | 19 - .../v1/src/v1/workflows_client.ts | 1371 --- .../v1/src/v1/workflows_client_config.json | 46 - .../v1/src/v1/workflows_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_executions_v1.ts | 869 -- .../v1/test/gapic_workflows_v1.ts | 1594 ---- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1beta/.eslintignore | 7 - .../v1beta/.eslintrc.json | 3 - .../v1beta/.gitignore | 14 - .../v1beta/.jsdoc.js | 55 - .../v1beta/.mocharc.js | 33 - .../v1beta/.prettierrc.js | 22 - .../v1beta/README.md | 1 - .../v1beta/package.json | 58 - .../executions/v1beta/executions.proto | 252 - .../cloud/workflows/v1beta/workflows.proto | 314 - .../v1beta/executions.cancel_execution.js | 63 - .../v1beta/executions.create_execution.js | 68 - .../v1beta/executions.get_execution.js | 68 - .../v1beta/executions.list_executions.js | 84 - ...gle.cloud.workflows.executions.v1beta.json | 195 - ...etadata_google.cloud.workflows.v1beta.json | 243 - .../v1beta/workflows.create_workflow.js | 79 - .../v1beta/workflows.delete_workflow.js | 63 - .../v1beta/workflows.get_workflow.js | 62 - .../v1beta/workflows.list_workflows.js | 89 - .../v1beta/workflows.update_workflow.js | 67 - .../v1beta/src/index.ts | 25 - .../v1beta/src/v1beta/executions_client.ts | 870 -- .../src/v1beta/executions_client_config.json | 42 - .../src/v1beta/executions_proto_list.json | 3 - .../v1beta/src/v1beta/gapic_metadata.json | 77 - .../v1beta/src/v1beta/index.ts | 19 - .../v1beta/src/v1beta/workflows_client.ts | 1040 --- .../src/v1beta/workflows_client_config.json | 46 - .../src/v1beta/workflows_proto_list.json | 3 - .../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_executions_v1beta.ts | 869 -- .../v1beta/test/gapic_workflows_v1beta.ts | 1119 --- .../v1beta/tsconfig.json | 19 - .../v1beta/webpack.config.js | 64 - .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../google-cloud-workstations/v1/.gitignore | 14 - .../google-cloud-workstations/v1/.jsdoc.js | 55 - .../google-cloud-workstations/v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../google-cloud-workstations/v1/README.md | 1 - .../google-cloud-workstations/v1/package.json | 58 - .../cloud/workstations/v1/workstations.proto | 1182 --- ...metadata_google.cloud.workstations.v1.json | 983 --- .../v1/workstations.create_workstation.js | 77 - ...workstations.create_workstation_cluster.js | 77 - .../workstations.create_workstation_config.js | 77 - .../v1/workstations.delete_workstation.js | 72 - ...workstations.delete_workstation_cluster.js | 77 - .../workstations.delete_workstation_config.js | 78 - .../v1/workstations.generate_access_token.js | 75 - .../v1/workstations.get_workstation.js | 61 - .../workstations.get_workstation_cluster.js | 61 - .../v1/workstations.get_workstation_config.js | 61 - ...tations.list_usable_workstation_configs.js | 71 - .../workstations.list_usable_workstations.js | 71 - .../workstations.list_workstation_clusters.js | 71 - .../workstations.list_workstation_configs.js | 71 - .../v1/workstations.list_workstations.js | 71 - .../v1/workstations.start_workstation.js | 72 - .../v1/workstations.stop_workstation.js | 72 - .../v1/workstations.update_workstation.js | 79 - ...workstations.update_workstation_cluster.js | 78 - .../workstations.update_workstation_config.js | 79 - .../google-cloud-workstations/v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 243 - .../v1/src/v1/index.ts | 19 - .../v1/src/v1/workstations_client.ts | 3315 ------- .../v1/src/v1/workstations_client_config.json | 138 - .../v1/src/v1/workstations_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_workstations_v1.ts | 4506 ---------- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1beta/.eslintignore | 7 - .../v1beta/.eslintrc.json | 3 - .../v1beta/.gitignore | 14 - .../v1beta/.jsdoc.js | 55 - .../v1beta/.mocharc.js | 33 - .../v1beta/.prettierrc.js | 22 - .../v1beta/README.md | 1 - .../v1beta/package.json | 58 - .../workstations/v1beta/workstations.proto | 1217 --- ...data_google.cloud.workstations.v1beta.json | 983 --- .../v1beta/workstations.create_workstation.js | 77 - ...workstations.create_workstation_cluster.js | 77 - .../workstations.create_workstation_config.js | 77 - .../v1beta/workstations.delete_workstation.js | 72 - ...workstations.delete_workstation_cluster.js | 77 - .../workstations.delete_workstation_config.js | 78 - .../workstations.generate_access_token.js | 75 - .../v1beta/workstations.get_workstation.js | 61 - .../workstations.get_workstation_cluster.js | 61 - .../workstations.get_workstation_config.js | 61 - ...tations.list_usable_workstation_configs.js | 71 - .../workstations.list_usable_workstations.js | 71 - .../workstations.list_workstation_clusters.js | 71 - .../workstations.list_workstation_configs.js | 71 - .../v1beta/workstations.list_workstations.js | 71 - .../v1beta/workstations.start_workstation.js | 72 - .../v1beta/workstations.stop_workstation.js | 72 - .../v1beta/workstations.update_workstation.js | 79 - ...workstations.update_workstation_cluster.js | 78 - .../workstations.update_workstation_config.js | 79 - .../v1beta/src/index.ts | 25 - .../v1beta/src/v1beta/gapic_metadata.json | 243 - .../v1beta/src/v1beta/index.ts | 19 - .../v1beta/src/v1beta/workstations_client.ts | 3315 ------- .../v1beta/workstations_client_config.json | 138 - .../src/v1beta/workstations_proto_list.json | 3 - .../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_workstations_v1beta.ts | 4506 ---------- .../v1beta/tsconfig.json | 19 - .../v1beta/webpack.config.js | 64 - .../google-container/v1/.eslintignore | 7 - .../google-container/v1/.eslintrc.json | 3 - .../google-container/v1/.gitignore | 14 - owl-bot-staging/google-container/v1/.jsdoc.js | 55 - .../google-container/v1/.mocharc.js | 33 - .../google-container/v1/.prettierrc.js | 22 - owl-bot-staging/google-container/v1/README.md | 1 - .../google-container/v1/package.json | 58 - .../google/container/v1/cluster_service.proto | 5214 ----------- .../v1/cluster_manager.cancel_operation.js | 61 - ...r_manager.check_autopilot_compatibility.js | 61 - .../cluster_manager.complete_i_p_rotation.js | 61 - ...ster_manager.complete_node_pool_upgrade.js | 62 - .../v1/cluster_manager.create_cluster.js | 67 - .../v1/cluster_manager.create_node_pool.js | 67 - .../v1/cluster_manager.delete_cluster.js | 61 - .../v1/cluster_manager.delete_node_pool.js | 62 - .../v1/cluster_manager.get_cluster.js | 61 - .../cluster_manager.get_j_s_o_n_web_keys.js | 61 - .../v1/cluster_manager.get_node_pool.js | 62 - .../v1/cluster_manager.get_operation.js | 61 - .../v1/cluster_manager.get_server_config.js | 61 - .../v1/cluster_manager.list_clusters.js | 62 - .../v1/cluster_manager.list_node_pools.js | 61 - .../v1/cluster_manager.list_operations.js | 62 - ...cluster_manager.list_usable_subnetworks.js | 82 - ...ster_manager.rollback_node_pool_upgrade.js | 67 - .../v1/cluster_manager.set_addons_config.js | 67 - .../v1/cluster_manager.set_labels.js | 76 - .../v1/cluster_manager.set_legacy_abac.js | 66 - .../v1/cluster_manager.set_locations.js | 71 - .../v1/cluster_manager.set_logging_service.js | 74 - .../cluster_manager.set_maintenance_policy.js | 86 - .../v1/cluster_manager.set_master_auth.js | 71 - .../cluster_manager.set_monitoring_service.js | 74 - .../v1/cluster_manager.set_network_policy.js | 66 - ...uster_manager.set_node_pool_autoscaling.js | 67 - ...luster_manager.set_node_pool_management.js | 67 - .../v1/cluster_manager.set_node_pool_size.js | 67 - .../v1/cluster_manager.start_i_p_rotation.js | 65 - .../v1/cluster_manager.update_cluster.js | 66 - .../v1/cluster_manager.update_master.js | 73 - .../v1/cluster_manager.update_node_pool.js | 164 - .../snippet_metadata_google.container.v1.json | 1915 ---- .../google-container/v1/src/index.ts | 25 - .../v1/src/v1/cluster_manager_client.ts | 3514 -------- .../src/v1/cluster_manager_client_config.json | 192 - .../v1/src/v1/cluster_manager_proto_list.json | 3 - .../v1/src/v1/gapic_metadata.json | 367 - .../google-container/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_cluster_manager_v1.ts | 5130 ----------- .../google-container/v1/tsconfig.json | 19 - .../google-container/v1/webpack.config.js | 64 - .../google-container/v1beta1/.eslintignore | 7 - .../google-container/v1beta1/.eslintrc.json | 3 - .../google-container/v1beta1/.gitignore | 14 - .../google-container/v1beta1/.jsdoc.js | 55 - .../google-container/v1beta1/.mocharc.js | 33 - .../google-container/v1beta1/.prettierrc.js | 22 - .../google-container/v1beta1/README.md | 1 - .../google-container/v1beta1/package.json | 58 - .../container/v1beta1/cluster_service.proto | 5733 ------------ .../cluster_manager.cancel_operation.js | 64 - ...r_manager.check_autopilot_compatibility.js | 61 - .../cluster_manager.complete_i_p_rotation.js | 64 - ...ster_manager.complete_node_pool_upgrade.js | 62 - .../v1beta1/cluster_manager.create_cluster.js | 69 - .../cluster_manager.create_node_pool.js | 70 - .../v1beta1/cluster_manager.delete_cluster.js | 64 - .../cluster_manager.delete_node_pool.js | 66 - .../v1beta1/cluster_manager.get_cluster.js | 64 - .../cluster_manager.get_j_s_o_n_web_keys.js | 61 - .../v1beta1/cluster_manager.get_node_pool.js | 66 - .../v1beta1/cluster_manager.get_operation.js | 64 - .../cluster_manager.get_server_config.js | 63 - .../v1beta1/cluster_manager.list_clusters.js | 64 - .../v1beta1/cluster_manager.list_locations.js | 62 - .../cluster_manager.list_node_pools.js | 64 - .../cluster_manager.list_operations.js | 64 - ...cluster_manager.list_usable_subnetworks.js | 83 - ...ster_manager.rollback_node_pool_upgrade.js | 71 - .../cluster_manager.set_addons_config.js | 70 - .../v1beta1/cluster_manager.set_labels.js | 79 - .../cluster_manager.set_legacy_abac.js | 69 - .../v1beta1/cluster_manager.set_locations.js | 74 - .../cluster_manager.set_logging_service.js | 77 - .../cluster_manager.set_maintenance_policy.js | 86 - .../cluster_manager.set_master_auth.js | 74 - .../cluster_manager.set_monitoring_service.js | 77 - .../cluster_manager.set_network_policy.js | 69 - ...uster_manager.set_node_pool_autoscaling.js | 71 - ...luster_manager.set_node_pool_management.js | 71 - .../cluster_manager.set_node_pool_size.js | 71 - .../cluster_manager.start_i_p_rotation.js | 68 - .../v1beta1/cluster_manager.update_cluster.js | 69 - .../v1beta1/cluster_manager.update_master.js | 76 - .../cluster_manager.update_node_pool.js | 168 - ...pet_metadata_google.container.v1beta1.json | 1955 ----- .../google-container/v1beta1/src/index.ts | 25 - .../src/v1beta1/cluster_manager_client.ts | 3585 -------- .../cluster_manager_client_config.json | 198 - .../v1beta1/cluster_manager_proto_list.json | 3 - .../v1beta1/src/v1beta1/gapic_metadata.json | 377 - .../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_cluster_manager_v1beta1.ts | 5238 ----------- .../google-container/v1beta1/tsconfig.json | 19 - .../v1beta1/webpack.config.js | 64 - .../google-dataflow/v1beta3/.eslintignore | 7 - .../google-dataflow/v1beta3/.eslintrc.json | 3 - .../google-dataflow/v1beta3/.gitignore | 14 - .../google-dataflow/v1beta3/.jsdoc.js | 55 - .../google-dataflow/v1beta3/.mocharc.js | 33 - .../google-dataflow/v1beta3/.prettierrc.js | 22 - .../google-dataflow/v1beta3/README.md | 1 - .../google-dataflow/v1beta3/package.json | 63 - .../google/dataflow/v1beta3/environment.proto | 554 -- .../protos/google/dataflow/v1beta3/jobs.proto | 926 -- .../google/dataflow/v1beta3/messages.proto | 238 - .../google/dataflow/v1beta3/metrics.proto | 369 - .../google/dataflow/v1beta3/snapshots.proto | 188 - .../google/dataflow/v1beta3/streaming.proto | 231 - .../google/dataflow/v1beta3/templates.proto | 632 -- ..._templates_service.launch_flex_template.js | 75 - .../jobs_v1_beta3.aggregated_list_jobs.js | 83 - .../jobs_v1_beta3.check_active_jobs.js | 60 - .../v1beta3/jobs_v1_beta3.create_job.js | 74 - .../v1beta3/jobs_v1_beta3.get_job.js | 74 - .../v1beta3/jobs_v1_beta3.list_jobs.js | 83 - .../v1beta3/jobs_v1_beta3.snapshot_job.js | 80 - .../v1beta3/jobs_v1_beta3.update_job.js | 75 - .../messages_v1_beta3.list_job_messages.js | 98 - ...rics_v1_beta3.get_job_execution_details.js | 84 - .../metrics_v1_beta3.get_job_metrics.js | 75 - ...cs_v1_beta3.get_stage_execution_details.js | 96 - .../snapshots_v1_beta3.delete_snapshot.js | 68 - .../snapshots_v1_beta3.get_snapshot.js | 68 - .../snapshots_v1_beta3.list_snapshots.js | 68 - ...ppet_metadata_google.dataflow.v1beta3.json | 1007 --- ...plates_service.create_job_from_template.js | 84 - .../v1beta3/templates_service.get_template.js | 76 - .../templates_service.launch_template.js | 86 - .../google-dataflow/v1beta3/src/index.ts | 35 - .../v1beta3/flex_templates_service_client.ts | 389 - .../flex_templates_service_client_config.json | 30 - .../flex_templates_service_proto_list.json | 9 - .../v1beta3/src/v1beta3/gapic_metadata.json | 293 - .../v1beta3/src/v1beta3/index.ts | 24 - .../src/v1beta3/jobs_v1_beta3_client.ts | 1150 --- .../v1beta3/jobs_v1_beta3_client_config.json | 61 - .../src/v1beta3/jobs_v1_beta3_proto_list.json | 9 - .../src/v1beta3/messages_v1_beta3_client.ts | 555 -- .../messages_v1_beta3_client_config.json | 31 - .../v1beta3/messages_v1_beta3_proto_list.json | 9 - .../src/v1beta3/metrics_v1_beta3_client.ts | 846 -- .../metrics_v1_beta3_client_config.json | 41 - .../v1beta3/metrics_v1_beta3_proto_list.json | 9 - .../src/v1beta3/snapshots_v1_beta3_client.ts | 537 -- .../snapshots_v1_beta3_client_config.json | 41 - .../snapshots_v1_beta3_proto_list.json | 9 - .../src/v1beta3/templates_service_client.ts | 562 -- .../templates_service_client_config.json | 41 - .../v1beta3/templates_service_proto_list.json | 9 - .../system-test/fixtures/sample/src/index.js | 32 - .../system-test/fixtures/sample/src/index.ts | 62 - .../v1beta3/system-test/install.ts | 49 - .../gapic_flex_templates_service_v1beta3.ts | 270 - .../test/gapic_jobs_v1_beta3_v1beta3.ts | 1299 --- .../test/gapic_messages_v1_beta3_v1beta3.ts | 484 - .../test/gapic_metrics_v1_beta3_v1beta3.ts | 924 -- .../test/gapic_snapshots_v1_beta3_v1beta3.ts | 546 -- .../test/gapic_templates_service_v1beta3.ts | 510 -- .../google-dataflow/v1beta3/tsconfig.json | 19 - .../google-dataflow/v1beta3/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 - .../artifactregistry/v1/apt_artifact.proto | 114 - .../artifactregistry/v1/artifact.proto | 355 - .../devtools/artifactregistry/v1/file.proto | 141 - .../artifactregistry/v1/package.proto | 101 - .../artifactregistry/v1/repository.proto | 201 - .../artifactregistry/v1/service.proto | 400 - .../artifactregistry/v1/settings.proto | 84 - .../devtools/artifactregistry/v1/tag.proto | 118 - .../artifactregistry/v1/version.proto | 135 - .../artifactregistry/v1/vpcsc_config.proto | 86 - .../artifactregistry/v1/yum_artifact.proto | 106 - .../v1/artifact_registry.create_repository.js | 70 - .../v1/artifact_registry.create_tag.js | 68 - .../v1/artifact_registry.delete_package.js | 62 - .../v1/artifact_registry.delete_repository.js | 62 - .../v1/artifact_registry.delete_tag.js | 60 - .../v1/artifact_registry.delete_version.js | 66 - .../v1/artifact_registry.get_docker_image.js | 61 - .../v1/artifact_registry.get_file.js | 61 - .../v1/artifact_registry.get_iam_policy.js | 67 - .../artifact_registry.get_maven_artifact.js | 61 - .../v1/artifact_registry.get_npm_package.js | 61 - .../v1/artifact_registry.get_package.js | 61 - .../artifact_registry.get_project_settings.js | 61 - .../artifact_registry.get_python_package.js | 61 - .../v1/artifact_registry.get_repository.js | 61 - .../generated/v1/artifact_registry.get_tag.js | 60 - .../artifact_registry.get_v_p_c_s_c_config.js | 61 - .../v1/artifact_registry.get_version.js | 64 - .../artifact_registry.import_apt_artifacts.js | 65 - .../artifact_registry.import_yum_artifacts.js | 65 - .../artifact_registry.list_docker_images.js | 76 - .../v1/artifact_registry.list_files.js | 88 - .../artifact_registry.list_maven_artifacts.js | 72 - .../v1/artifact_registry.list_npm_packages.js | 72 - .../v1/artifact_registry.list_packages.js | 71 - .../artifact_registry.list_python_packages.js | 72 - .../v1/artifact_registry.list_repositories.js | 71 - .../v1/artifact_registry.list_tags.js | 79 - .../v1/artifact_registry.list_versions.js | 78 - .../v1/artifact_registry.set_iam_policy.js | 77 - .../artifact_registry.test_iam_permissions.js | 70 - ...tifact_registry.update_project_settings.js | 64 - .../v1/artifact_registry.update_repository.js | 66 - .../v1/artifact_registry.update_tag.js | 66 - ...tifact_registry.update_v_p_c_s_c_config.js | 64 - ...a_google.devtools.artifactregistry.v1.json | 1575 ---- .../v1/src/index.ts | 25 - .../v1/src/v1/artifact_registry_client.ts | 5109 ----------- .../v1/artifact_registry_client_config.json | 201 - .../src/v1/artifact_registry_proto_list.json | 13 - .../v1/src/v1/gapic_metadata.json | 409 - .../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_artifact_registry_v1.ts | 6612 -------------- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1beta2/.eslintignore | 7 - .../v1beta2/.eslintrc.json | 3 - .../v1beta2/.gitignore | 14 - .../v1beta2/.jsdoc.js | 55 - .../v1beta2/.mocharc.js | 33 - .../v1beta2/.prettierrc.js | 22 - .../v1beta2/README.md | 1 - .../v1beta2/package.json | 58 - .../v1beta2/apt_artifact.proto | 115 - .../artifactregistry/v1beta2/file.proto | 120 - .../artifactregistry/v1beta2/package.proto | 79 - .../artifactregistry/v1beta2/repository.proto | 201 - .../artifactregistry/v1beta2/service.proto | 304 - .../artifactregistry/v1beta2/settings.proto | 84 - .../artifactregistry/v1beta2/tag.proto | 118 - .../artifactregistry/v1beta2/version.proto | 127 - .../v1beta2/yum_artifact.proto | 107 - .../artifact_registry.create_repository.js | 70 - .../v1beta2/artifact_registry.create_tag.js | 68 - .../artifact_registry.delete_package.js | 61 - .../artifact_registry.delete_repository.js | 62 - .../v1beta2/artifact_registry.delete_tag.js | 60 - .../artifact_registry.delete_version.js | 66 - .../v1beta2/artifact_registry.get_file.js | 60 - .../artifact_registry.get_iam_policy.js | 67 - .../v1beta2/artifact_registry.get_package.js | 60 - .../artifact_registry.get_project_settings.js | 61 - .../artifact_registry.get_repository.js | 61 - .../v1beta2/artifact_registry.get_tag.js | 60 - .../v1beta2/artifact_registry.get_version.js | 64 - .../artifact_registry.import_apt_artifacts.js | 65 - .../artifact_registry.import_yum_artifacts.js | 65 - .../v1beta2/artifact_registry.list_files.js | 83 - .../artifact_registry.list_packages.js | 71 - .../artifact_registry.list_repositories.js | 71 - .../v1beta2/artifact_registry.list_tags.js | 79 - .../artifact_registry.list_versions.js | 78 - .../artifact_registry.set_iam_policy.js | 77 - .../artifact_registry.test_iam_permissions.js | 70 - ...tifact_registry.update_project_settings.js | 64 - .../artifact_registry.update_repository.js | 66 - .../v1beta2/artifact_registry.update_tag.js | 66 - ...gle.devtools.artifactregistry.v1beta2.json | 1131 --- .../v1beta2/src/index.ts | 25 - .../src/v1beta2/artifact_registry_client.ts | 3439 -------- .../artifact_registry_client_config.json | 149 - .../v1beta2/artifact_registry_proto_list.json | 11 - .../v1beta2/src/v1beta2/gapic_metadata.json | 293 - .../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_artifact_registry_v1beta2.ts | 4417 ---------- .../v1beta2/tsconfig.json | 19 - .../v1beta2/webpack.config.js | 64 - .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../google-devtools-cloudbuild/v1/.gitignore | 14 - .../google-devtools-cloudbuild/v1/.jsdoc.js | 55 - .../google-devtools-cloudbuild/v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../google-devtools-cloudbuild/v1/README.md | 1 - .../v1/package.json | 58 - .../devtools/cloudbuild/v1/cloudbuild.proto | 2734 ------ .../generated/v1/cloud_build.approve_build.js | 67 - .../generated/v1/cloud_build.cancel_build.js | 71 - .../generated/v1/cloud_build.create_build.js | 72 - .../v1/cloud_build.create_build_trigger.js | 71 - .../v1/cloud_build.create_worker_pool.js | 81 - .../v1/cloud_build.delete_build_trigger.js | 71 - .../v1/cloud_build.delete_worker_pool.js | 79 - .../generated/v1/cloud_build.get_build.js | 71 - .../v1/cloud_build.get_build_trigger.js | 71 - .../v1/cloud_build.get_worker_pool.js | 62 - .../v1/cloud_build.list_build_triggers.js | 76 - .../generated/v1/cloud_build.list_builds.js | 85 - .../v1/cloud_build.list_worker_pools.js | 74 - .../v1/cloud_build.receive_trigger_webhook.js | 77 - .../generated/v1/cloud_build.retry_build.js | 72 - .../v1/cloud_build.run_build_trigger.js | 77 - .../v1/cloud_build.update_build_trigger.js | 77 - .../v1/cloud_build.update_worker_pool.js | 73 - ...etadata_google.devtools.cloudbuild.v1.json | 903 -- .../v1/src/index.ts | 25 - .../v1/src/v1/cloud_build_client.ts | 3300 ------- .../v1/src/v1/cloud_build_client_config.json | 114 - .../v1/src/v1/cloud_build_proto_list.json | 3 - .../v1/src/v1/gapic_metadata.json | 215 - .../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_build_v1.ts | 3520 -------- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v2/.eslintignore | 7 - .../v2/.eslintrc.json | 3 - .../google-devtools-cloudbuild/v2/.gitignore | 14 - .../google-devtools-cloudbuild/v2/.jsdoc.js | 55 - .../google-devtools-cloudbuild/v2/.mocharc.js | 33 - .../v2/.prettierrc.js | 22 - .../google-devtools-cloudbuild/v2/README.md | 1 - .../v2/package.json | 58 - .../devtools/cloudbuild/v2/cloudbuild.proto | 112 - .../devtools/cloudbuild/v2/repositories.proto | 802 -- ...itory_manager.batch_create_repositories.js | 70 - .../repository_manager.create_connection.js | 76 - .../repository_manager.create_repository.js | 77 - .../repository_manager.delete_connection.js | 73 - .../repository_manager.delete_repository.js | 73 - .../v2/repository_manager.fetch_git_refs.js | 66 - ...ory_manager.fetch_linkable_repositories.js | 72 - .../v2/repository_manager.fetch_read_token.js | 62 - ...pository_manager.fetch_read_write_token.js | 62 - .../v2/repository_manager.get_connection.js | 62 - .../v2/repository_manager.get_repository.js | 62 - .../v2/repository_manager.list_connections.js | 72 - .../repository_manager.list_repositories.js | 79 - .../repository_manager.update_connection.js | 80 - ...etadata_google.devtools.cloudbuild.v2.json | 655 -- .../v2/src/index.ts | 25 - .../v2/src/v2/gapic_metadata.json | 175 - .../v2/src/v2/index.ts | 19 - .../v2/src/v2/repository_manager_client.ts | 2572 ------ .../v2/repository_manager_client_config.json | 106 - .../src/v2/repository_manager_proto_list.json | 4 - .../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_repository_manager_v2.ts | 3384 ------- .../v2/tsconfig.json | 19 - .../v2/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 | 59 - .../v1/containeranalysis.proto | 156 - .../v1/protos/grafeas/v1/attestation.proto | 90 - .../v1/protos/grafeas/v1/build.proto | 62 - .../v1/protos/grafeas/v1/common.proto | 152 - .../v1/protos/grafeas/v1/compliance.proto | 82 - .../v1/protos/grafeas/v1/cvss.proto | 169 - .../v1/protos/grafeas/v1/deployment.proto | 66 - .../v1/protos/grafeas/v1/discovery.proto | 104 - .../protos/grafeas/v1/dsse_attestation.proto | 52 - .../v1/protos/grafeas/v1/grafeas.proto | 547 -- .../v1/protos/grafeas/v1/image.proto | 83 - .../protos/grafeas/v1/intoto_provenance.proto | 113 - .../protos/grafeas/v1/intoto_statement.proto | 52 - .../v1/protos/grafeas/v1/package.proto | 192 - .../v1/protos/grafeas/v1/provenance.proto | 265 - .../v1/protos/grafeas/v1/severity.proto | 38 - .../protos/grafeas/v1/slsa_provenance.proto | 115 - .../grafeas/v1/slsa_provenance_zero_two.proto | 82 - .../v1/protos/grafeas/v1/upgrade.proto | 114 - .../v1/protos/grafeas/v1/vex.proto | 203 - .../v1/protos/grafeas/v1/vulnerability.proto | 297 - .../v1/container_analysis.get_iam_policy.js | 67 - ...s.get_vulnerability_occurrences_summary.js | 66 - .../v1/container_analysis.set_iam_policy.js | 77 - ...container_analysis.test_iam_permissions.js | 70 - .../v1/grafeas.batch_create_notes.js | 67 - .../v1/grafeas.batch_create_occurrences.js | 67 - .../generated/v1/grafeas.create_note.js | 72 - .../generated/v1/grafeas.create_occurrence.js | 67 - .../generated/v1/grafeas.delete_note.js | 62 - .../generated/v1/grafeas.delete_occurrence.js | 62 - .../samples/generated/v1/grafeas.get_note.js | 62 - .../generated/v1/grafeas.get_occurrence.js | 62 - .../v1/grafeas.get_occurrence_note.js | 62 - .../v1/grafeas.list_note_occurrences.js | 76 - .../generated/v1/grafeas.list_notes.js | 77 - .../generated/v1/grafeas.list_occurrences.js | 77 - .../generated/v1/grafeas.update_note.js | 71 - .../generated/v1/grafeas.update_occurrence.js | 71 - ..._google.devtools.containeranalysis.v1.json | 827 -- .../v1/src/index.ts | 27 - .../v1/src/v1/container_analysis_client.ts | 757 -- .../v1/container_analysis_client_config.json | 42 - .../src/v1/container_analysis_proto_list.json | 23 - .../v1/src/v1/gapic_metadata.json | 229 - .../v1/src/v1/grafeas_client.ts | 1791 ---- .../v1/src/v1/grafeas_client_config.json | 82 - .../v1/src/v1/grafeas_proto_list.json | 23 - .../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 - .../v1/test/gapic_container_analysis_v1.ts | 691 -- .../v1/test/gapic_grafeas_v1.ts | 2229 ----- .../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 | 59 - .../v1beta1/attestation/attestation.proto | 170 - .../v1beta1/build/build.proto | 96 - .../v1beta1/common/common.proto | 101 - .../v1beta1/containeranalysis.proto | 148 - .../containeranalysis/v1beta1/cvss/cvss.proto | 85 - .../v1beta1/deployment/deployment.proto | 74 - .../v1beta1/discovery/discovery.proto | 86 - .../v1beta1/grafeas/grafeas.proto | 506 -- .../v1beta1/image/image.proto | 145 - .../v1beta1/package/package.proto | 127 - .../v1beta1/provenance/provenance.proto | 164 - .../v1beta1/source/source.proto | 134 - .../v1beta1/vulnerability/vulnerability.proto | 203 - ...ysis_v1_beta1.generate_packages_summary.js | 62 - ...tainer_analysis_v1_beta1.get_iam_policy.js | 67 - ...tainer_analysis_v1_beta1.set_iam_policy.js | 77 - ..._analysis_v1_beta1.test_iam_permissions.js | 70 - .../grafeas_v1_beta1.batch_create_notes.js | 65 - ...afeas_v1_beta1.batch_create_occurrences.js | 65 - .../v1beta1/grafeas_v1_beta1.create_note.js | 69 - .../grafeas_v1_beta1.create_occurrence.js | 65 - .../v1beta1/grafeas_v1_beta1.delete_note.js | 61 - .../grafeas_v1_beta1.delete_occurrence.js | 61 - .../v1beta1/grafeas_v1_beta1.get_note.js | 61 - .../grafeas_v1_beta1.get_occurrence.js | 61 - .../grafeas_v1_beta1.get_occurrence_note.js | 61 - ...1.get_vulnerability_occurrences_summary.js | 65 - .../grafeas_v1_beta1.list_note_occurrences.js | 75 - .../v1beta1/grafeas_v1_beta1.list_notes.js | 75 - .../grafeas_v1_beta1.list_occurrences.js | 75 - .../v1beta1/grafeas_v1_beta1.update_note.js | 69 - .../grafeas_v1_beta1.update_occurrence.js | 69 - ...le.devtools.containeranalysis.v1beta1.json | 867 -- .../v1beta1/src/index.ts | 27 - .../container_analysis_v1_beta1_client.ts | 641 -- ...ainer_analysis_v1_beta1_client_config.json | 42 - ...ontainer_analysis_v1_beta1_proto_list.json | 15 - .../v1beta1/src/v1beta1/gapic_metadata.json | 239 - .../src/v1beta1/grafeas_v1_beta1_client.ts | 1746 ---- .../grafeas_v1_beta1_client_config.json | 86 - .../v1beta1/grafeas_v1_beta1_proto_list.json | 15 - .../v1beta1/src/v1beta1/index.ts | 20 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - .../v1beta1/system-test/install.ts | 49 - ...pic_container_analysis_v1_beta1_v1beta1.ts | 582 -- .../test/gapic_grafeas_v1_beta1_v1beta1.ts | 2228 ----- .../v1beta1/tsconfig.json | 19 - .../v1beta1/webpack.config.js | 64 - .../google-iam-credentials/v1/.eslintignore | 7 - .../google-iam-credentials/v1/.eslintrc.json | 3 - .../google-iam-credentials/v1/.gitignore | 14 - .../google-iam-credentials/v1/.jsdoc.js | 55 - .../google-iam-credentials/v1/.mocharc.js | 33 - .../google-iam-credentials/v1/.prettierrc.js | 22 - .../google-iam-credentials/v1/README.md | 1 - .../google-iam-credentials/v1/package.json | 58 - .../google/iam/credentials/v1/common.proto | 190 - .../iam/credentials/v1/iamcredentials.proto | 79 - ...i_a_m_credentials.generate_access_token.js | 91 - .../v1/i_a_m_credentials.generate_id_token.js | 87 - .../v1/i_a_m_credentials.sign_blob.js | 81 - .../v1/i_a_m_credentials.sign_jwt.js | 81 - ...et_metadata_google.iam.credentials.v1.json | 215 - .../google-iam-credentials/v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 63 - .../v1/src/v1/i_a_m_credentials_client.ts | 670 -- .../v1/i_a_m_credentials_client_config.json | 46 - .../src/v1/i_a_m_credentials_proto_list.json | 4 - .../google-iam-credentials/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_a_m_credentials_v1.ts | 582 -- .../google-iam-credentials/v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - owl-bot-staging/google-iam/v2/.eslintignore | 7 - owl-bot-staging/google-iam/v2/.eslintrc.json | 3 - owl-bot-staging/google-iam/v2/.gitignore | 14 - owl-bot-staging/google-iam/v2/.jsdoc.js | 55 - owl-bot-staging/google-iam/v2/.mocharc.js | 33 - owl-bot-staging/google-iam/v2/.prettierrc.js | 22 - owl-bot-staging/google-iam/v2/README.md | 1 - owl-bot-staging/google-iam/v2/package.json | 58 - .../v2/protos/google/iam/v2/deny.proto | 109 - .../v2/protos/google/iam/v2/policy.proto | 287 - .../generated/v2/policies.create_policy.js | 81 - .../generated/v2/policies.delete_policy.js | 76 - .../generated/v2/policies.get_policy.js | 67 - .../generated/v2/policies.list_policies.js | 81 - .../generated/v2/policies.update_policy.js | 65 - .../v2/snippet_metadata_google.iam.v2.json | 235 - owl-bot-staging/google-iam/v2/src/index.ts | 25 - .../google-iam/v2/src/v2/gapic_metadata.json | 77 - owl-bot-staging/google-iam/v2/src/v2/index.ts | 19 - .../google-iam/v2/src/v2/policies_client.ts | 1140 --- .../v2/src/v2/policies_client_config.json | 63 - .../v2/src/v2/policies_proto_list.json | 4 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../google-iam/v2/system-test/install.ts | 49 - .../google-iam/v2/test/gapic_policies_v2.ts | 1287 --- owl-bot-staging/google-iam/v2/tsconfig.json | 19 - .../google-iam/v2/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 - .../type/device_resources.proto | 83 - .../v1/access_context_manager.proto | 986 --- .../v1/access_level.proto | 192 - .../v1/access_policy.proto | 81 - .../v1/gcp_user_access_binding.proto | 68 - .../v1/service_perimeter.proto | 472 - ...ntext_manager.commit_service_perimeters.js | 77 - ...ess_context_manager.create_access_level.js | 73 - ...ss_context_manager.create_access_policy.js | 104 - ..._manager.create_gcp_user_access_binding.js | 68 - ...ontext_manager.create_service_perimeter.js | 73 - ...ess_context_manager.delete_access_level.js | 65 - ...ss_context_manager.delete_access_policy.js | 63 - ..._manager.delete_gcp_user_access_binding.js | 62 - ...ontext_manager.delete_service_perimeter.js | 65 - ...access_context_manager.get_access_level.js | 75 - ...ccess_context_manager.get_access_policy.js | 62 - ...ext_manager.get_gcp_user_access_binding.js | 61 - .../access_context_manager.get_iam_policy.js | 67 - ...s_context_manager.get_service_perimeter.js | 64 - ...cess_context_manager.list_access_levels.js | 84 - ...ss_context_manager.list_access_policies.js | 75 - ...t_manager.list_gcp_user_access_bindings.js | 75 - ...context_manager.list_service_perimeters.js | 78 - ...s_context_manager.replace_access_levels.js | 85 - ...text_manager.replace_service_perimeters.js | 85 - .../access_context_manager.set_iam_policy.js | 77 - ...ss_context_manager.test_iam_permissions.js | 70 - ...ess_context_manager.update_access_level.js | 71 - ...ss_context_manager.update_access_policy.js | 67 - ..._manager.update_gcp_user_access_binding.js | 72 - ...ontext_manager.update_service_perimeter.js | 68 - ...ogle.identity.accesscontextmanager.v1.json | 1183 --- .../v1/src/index.ts | 25 - .../src/v1/access_context_manager_client.ts | 3706 -------- .../access_context_manager_client_config.json | 156 - .../v1/access_context_manager_proto_list.json | 8 - .../v1/src/v1/gapic_metadata.json | 299 - .../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_access_context_manager_v1.ts | 4597 ---------- .../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 - .../v1/protos/google/geo/type/viewport.proto | 69 - .../maps/addressvalidation/v1/address.proto | 147 - .../v1/address_validation_service.proto | 278 - .../maps/addressvalidation/v1/geocode.proto | 81 - .../maps/addressvalidation/v1/metadata.proto | 43 - .../maps/addressvalidation/v1/usps_data.proto | 221 - ..._validation.provide_validation_feedback.js | 71 - .../v1/address_validation.validate_address.js | 98 - ...data_google.maps.addressvalidation.v1.json | 107 - .../v1/src/index.ts | 25 - .../v1/src/v1/address_validation_client.ts | 484 - .../v1/address_validation_client_config.json | 48 - .../src/v1/address_validation_proto_list.json | 8 - .../v1/src/v1/gapic_metadata.json | 43 - .../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_address_validation_v1.ts | 300 - .../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 - .../mapsplatformdatasets/v1/data_source.proto | 59 - .../mapsplatformdatasets/v1/dataset.proto | 146 - .../v1/maps_platform_datasets.proto | 111 - .../v1/maps_platform_datasets_service.proto | 81 - .../maps_platform_datasets.create_dataset.js | 67 - .../maps_platform_datasets.delete_dataset.js | 61 - .../v1/maps_platform_datasets.get_dataset.js | 61 - .../maps_platform_datasets.list_datasets.js | 73 - ...atform_datasets.update_dataset_metadata.js | 68 - ...a_google.maps.mapsplatformdatasets.v1.json | 231 - .../v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 77 - .../v1/src/v1/index.ts | 19 - .../src/v1/maps_platform_datasets_client.ts | 828 -- .../maps_platform_datasets_client_config.json | 63 - .../v1/maps_platform_datasets_proto_list.json | 6 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../test/gapic_maps_platform_datasets_v1.ts | 919 -- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1alpha/.eslintignore | 7 - .../v1alpha/.eslintrc.json | 3 - .../v1alpha/.gitignore | 14 - .../v1alpha/.jsdoc.js | 55 - .../v1alpha/.mocharc.js | 33 - .../v1alpha/.prettierrc.js | 22 - .../v1alpha/README.md | 1 - .../v1alpha/package.json | 58 - .../v1alpha/data_source.proto | 64 - .../v1alpha/dataset.proto | 110 - .../v1alpha/maps_platform_datasets.proto | 167 - ...maps_platform_datasets_alpha_service.proto | 97 - ...atform_datasets_v1_alpha.create_dataset.js | 67 - ...atform_datasets_v1_alpha.delete_dataset.js | 66 - ...atasets_v1_alpha.delete_dataset_version.js | 61 - ..._platform_datasets_v1_alpha.get_dataset.js | 73 - ...datasets_v1_alpha.list_dataset_versions.js | 74 - ...latform_datasets_v1_alpha.list_datasets.js | 74 - ...tasets_v1_alpha.update_dataset_metadata.js | 68 - ...gle.maps.mapsplatformdatasets.v1alpha.json | 327 - .../v1alpha/src/index.ts | 25 - .../v1alpha/src/v1alpha/gapic_metadata.json | 101 - .../v1alpha/src/v1alpha/index.ts | 19 - .../maps_platform_datasets_v1_alpha_client.ts | 1097 --- ...tform_datasets_v1_alpha_client_config.json | 72 - ...platform_datasets_v1_alpha_proto_list.json | 6 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1alpha/system-test/install.ts | 49 - ...maps_platform_datasets_v1_alpha_v1alpha.ts | 1272 --- .../v1alpha/tsconfig.json | 19 - .../v1alpha/webpack.config.js | 64 - .../google-maps-places/v1/.eslintignore | 7 - .../google-maps-places/v1/.eslintrc.json | 3 - .../google-maps-places/v1/.gitignore | 14 - .../google-maps-places/v1/.jsdoc.js | 55 - .../google-maps-places/v1/.mocharc.js | 33 - .../google-maps-places/v1/.prettierrc.js | 22 - .../google-maps-places/v1/README.md | 1 - .../google-maps-places/v1/package.json | 58 - .../v1/protos/google/geo/type/viewport.proto | 69 - .../google/maps/places/v1/geometry.proto | 42 - .../protos/google/maps/places/v1/place.proto | 424 - .../maps/places/v1/places_service.proto | 199 - .../generated/v1/places.search_text.js | 133 - ...nippet_metadata_google.maps.places.v1.json | 107 - .../google-maps-places/v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 33 - .../google-maps-places/v1/src/v1/index.ts | 19 - .../v1/src/v1/places_client.ts | 436 - .../v1/src/v1/places_client_config.json | 30 - .../v1/src/v1/places_proto_list.json | 6 - .../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_places_v1.ts | 225 - .../google-maps-places/v1/tsconfig.json | 19 - .../google-maps-places/v1/webpack.config.js | 64 - .../google-maps-routing/v2/.eslintignore | 7 - .../google-maps-routing/v2/.eslintrc.json | 3 - .../google-maps-routing/v2/.gitignore | 14 - .../google-maps-routing/v2/.jsdoc.js | 55 - .../google-maps-routing/v2/.mocharc.js | 33 - .../google-maps-routing/v2/.prettierrc.js | 22 - .../google-maps-routing/v2/README.md | 1 - .../google-maps-routing/v2/package.json | 58 - .../v2/protos/google/geo/type/viewport.proto | 69 - .../maps/routing/v2/fallback_info.proto | 73 - .../maps/routing/v2/geocoding_results.proto | 72 - .../maps/routing/v2/localized_time.proto | 40 - .../google/maps/routing/v2/location.proto | 44 - .../google/maps/routing/v2/maneuver.proto | 94 - .../routing/v2/navigation_instruction.proto | 40 - .../google/maps/routing/v2/polyline.proto | 74 - .../protos/google/maps/routing/v2/route.proto | 395 - .../google/maps/routing/v2/route_label.proto | 47 - .../maps/routing/v2/route_modifiers.proto | 65 - .../maps/routing/v2/route_travel_mode.proto | 53 - .../maps/routing/v2/routes_service.proto | 499 -- .../maps/routing/v2/routing_preference.proto | 56 - .../routing/v2/speed_reading_interval.proto | 59 - .../google/maps/routing/v2/toll_info.proto | 42 - .../google/maps/routing/v2/toll_passes.proto | 334 - .../maps/routing/v2/traffic_model.proto | 52 - .../google/maps/routing/v2/transit.proto | 161 - .../maps/routing/v2/transit_preferences.proto | 75 - .../protos/google/maps/routing/v2/units.proto | 40 - .../routing/v2/vehicle_emission_type.proto | 47 - .../google/maps/routing/v2/vehicle_info.proto | 37 - .../google/maps/routing/v2/waypoint.proto | 76 - .../v2/routes.compute_route_matrix.js | 146 - .../generated/v2/routes.compute_routes.js | 192 - ...ippet_metadata_google.maps.routing.v2.json | 207 - .../google-maps-routing/v2/src/index.ts | 25 - .../v2/src/v2/gapic_metadata.json | 38 - .../google-maps-routing/v2/src/v2/index.ts | 19 - .../v2/src/v2/routes_client.ts | 636 -- .../v2/src/v2/routes_client_config.json | 34 - .../v2/src/v2/routes_proto_list.json | 26 - .../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_routes_v2.ts | 313 - .../google-maps-routing/v2/tsconfig.json | 19 - .../google-maps-routing/v2/webpack.config.js | 64 - .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../google-monitoring-dashboard/v1/.gitignore | 14 - .../google-monitoring-dashboard/v1/.jsdoc.js | 55 - .../v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../google-monitoring-dashboard/v1/README.md | 1 - .../v1/package.json | 58 - .../monitoring/dashboard/v1/alertchart.proto | 41 - .../dashboard/v1/collapsible_group.proto | 32 - .../monitoring/dashboard/v1/common.proto | 452 - .../monitoring/dashboard/v1/dashboard.proto | 79 - .../dashboard/v1/dashboard_filter.proto | 68 - .../dashboard/v1/dashboards_service.proto | 189 - .../monitoring/dashboard/v1/drilldowns.proto | 25 - .../monitoring/dashboard/v1/layouts.proto | 112 - .../monitoring/dashboard/v1/logs_panel.proto | 38 - .../monitoring/dashboard/v1/metrics.proto | 198 - .../monitoring/dashboard/v1/scorecard.proto | 118 - .../monitoring/dashboard/v1/service.proto | 25 - .../monitoring/dashboard/v1/table.proto | 92 - .../dashboard/v1/table_display_options.proto | 35 - .../google/monitoring/dashboard/v1/text.proto | 46 - .../monitoring/dashboard/v1/widget.proto | 70 - .../monitoring/dashboard/v1/xychart.proto | 168 - .../v1/dashboards_service.create_dashboard.js | 73 - .../v1/dashboards_service.delete_dashboard.js | 62 - .../v1/dashboards_service.get_dashboard.js | 64 - .../v1/dashboards_service.list_dashboards.js | 75 - .../v1/dashboards_service.update_dashboard.js | 66 - ...tadata_google.monitoring.dashboard.v1.json | 235 - .../v1/src/index.ts | 25 - .../v1/src/v1/dashboards_service_client.ts | 937 -- .../v1/dashboards_service_client_config.json | 64 - .../src/v1/dashboards_service_proto_list.json | 19 - .../v1/src/v1/gapic_metadata.json | 77 - .../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_dashboards_service_v1.ts | 987 --- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../google-privacy-dlp/v2/.eslintignore | 7 - .../google-privacy-dlp/v2/.eslintrc.json | 3 - .../google-privacy-dlp/v2/.gitignore | 14 - .../google-privacy-dlp/v2/.jsdoc.js | 55 - .../google-privacy-dlp/v2/.mocharc.js | 33 - .../google-privacy-dlp/v2/.prettierrc.js | 22 - .../google-privacy-dlp/v2/README.md | 1 - .../google-privacy-dlp/v2/package.json | 58 - .../v2/protos/google/privacy/dlp/v2/dlp.proto | 5400 ------------ .../google/privacy/dlp/v2/storage.proto | 808 -- .../v2/dlp_service.activate_job_trigger.js | 62 - .../v2/dlp_service.cancel_dlp_job.js | 61 - .../dlp_service.create_deidentify_template.js | 88 - .../v2/dlp_service.create_dlp_job.js | 88 - .../v2/dlp_service.create_inspect_template.js | 88 - .../v2/dlp_service.create_job_trigger.js | 84 - .../v2/dlp_service.create_stored_info_type.js | 88 - .../v2/dlp_service.deidentify_content.js | 109 - .../dlp_service.delete_deidentify_template.js | 63 - .../v2/dlp_service.delete_dlp_job.js | 61 - .../v2/dlp_service.delete_inspect_template.js | 63 - .../v2/dlp_service.delete_job_trigger.js | 62 - .../v2/dlp_service.delete_stored_info_type.js | 63 - .../v2/dlp_service.finish_dlp_job.js | 61 - .../v2/dlp_service.get_deidentify_template.js | 63 - .../generated/v2/dlp_service.get_dlp_job.js | 61 - .../v2/dlp_service.get_inspect_template.js | 63 - .../v2/dlp_service.get_job_trigger.js | 62 - .../v2/dlp_service.get_stored_info_type.js | 63 - .../v2/dlp_service.hybrid_inspect_dlp_job.js | 66 - .../dlp_service.hybrid_inspect_job_trigger.js | 66 - .../v2/dlp_service.inspect_content.js | 88 - .../dlp_service.list_deidentify_templates.js | 101 - .../generated/v2/dlp_service.list_dlp_jobs.js | 125 - .../v2/dlp_service.list_info_types.js | 73 - .../v2/dlp_service.list_inspect_templates.js | 101 - .../v2/dlp_service.list_job_triggers.js | 125 - .../v2/dlp_service.list_stored_info_types.js | 98 - .../generated/v2/dlp_service.redact_image.js | 88 - .../v2/dlp_service.reidentify_content.js | 110 - .../dlp_service.update_deidentify_template.js | 71 - .../v2/dlp_service.update_inspect_template.js | 71 - .../v2/dlp_service.update_job_trigger.js | 70 - .../v2/dlp_service.update_stored_info_type.js | 73 - ...nippet_metadata_google.privacy.dlp.v2.json | 1671 ---- .../google-privacy-dlp/v2/src/index.ts | 25 - .../v2/src/v2/dlp_service_client.ts | 5285 ----------- .../v2/src/v2/dlp_service_client_config.json | 196 - .../v2/src/v2/dlp_service_proto_list.json | 4 - .../v2/src/v2/gapic_metadata.json | 383 - .../google-privacy-dlp/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_dlp_service_v2.ts | 5531 ------------ .../google-privacy-dlp/v2/tsconfig.json | 19 - .../google-privacy-dlp/v2/webpack.config.js | 64 - packages/google-cloud-vmwareengine/README.md | 5 +- .../samples/quickstart.js | 5 +- .../src/v1/vmware_engine_client.ts | 9 +- .../test/gapic_vmware_engine_v1.ts | 5 +- .../src/v1/vpc_access_service_client.ts | 9 +- .../src/v1/web_risk_service_client.ts | 9 +- .../web_risk_service_v1_beta1_client.ts | 7 +- .../src/v1/web_security_scanner_client.ts | 7 +- .../v1alpha/web_security_scanner_client.ts | 7 +- .../src/v1beta/web_security_scanner_client.ts | 7 +- .../src/v1/executions_client.ts | 957 +- .../src/v1/workflows_client.ts | 1292 ++- .../src/v1beta/executions_client.ts | 882 +- .../src/v1beta/workflows_client.ts | 1256 ++- .../system-test/fixtures/sample/src/index.js | 1 + .../system-test/install.ts | 18 +- .../test/gapic_executions_v1.ts | 1777 ++-- .../test/gapic_executions_v1beta.ts | 1781 ++-- .../test/gapic_workflows_v1.ts | 3347 ++++--- .../test/gapic_workflows_v1beta.ts | 2330 +++-- .../webpack.config.js | 12 +- .../src/v1/workstations_client.ts | 9 +- .../src/v1beta/workstations_client.ts | 9 +- .../src/v1/cluster_manager_client.ts | 7 +- .../src/v1beta1/cluster_manager_client.ts | 7 +- .../v1beta3/flex_templates_service_client.ts | 7 +- .../src/v1beta3/jobs_v1_beta3_client.ts | 7 +- .../src/v1beta3/messages_v1_beta3_client.ts | 7 +- .../src/v1beta3/metrics_v1_beta3_client.ts | 7 +- .../src/v1beta3/snapshots_v1_beta3_client.ts | 7 +- .../src/v1beta3/templates_service_client.ts | 7 +- .../src/v1/artifact_registry_client.ts | 9 +- .../src/v1beta2/artifact_registry_client.ts | 9 +- .../src/v1/cloud_build_client.ts | 9 +- .../src/v2/repository_manager_client.ts | 9 +- .../src/v1/container_analysis_client.ts | 7 +- .../container_analysis_v1_beta1_client.ts | 7 +- .../src/v1beta1/grafeas_v1_beta1_client.ts | 7 +- .../test/gapic_container_analysis_v1.ts | 5 +- .../test/gapic_grafeas_v1_beta1_v1beta1.ts | 5 +- .../src/v1/i_a_m_credentials_client.ts | 7 +- packages/google-iam/src/v2/policies_client.ts | 9 +- .../README.md | 5 +- .../samples/quickstart.js | 5 +- .../src/v1/access_context_manager_client.ts | 9 +- .../src/v1/address_validation_client.ts | 7 +- .../README.md | 5 +- .../samples/quickstart.js | 5 +- .../src/v1/maps_platform_datasets_client.ts | 7 +- .../maps_platform_datasets_v1_alpha_client.ts | 7 +- .../src/v1/places_client.ts | 7 +- .../src/v2/routes_client.ts | 9 +- .../src/v1/dashboards_service_client.ts | 7 +- .../src/v2/dlp_service_client.ts | 7 +- 1405 files changed, 6031 insertions(+), 301264 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine.proto delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine_resources.proto delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_cluster.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_hcx_activation_key.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_network_policy.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_cloud.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_connection.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_vmware_engine_network.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_cluster.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_network_policy.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_cloud.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_connection.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_vmware_engine_network.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_cluster.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_hcx_activation_key.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_network_policy.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_node_type.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_cloud.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_connection.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_subnet.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_vmware_engine_network.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_clusters.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_hcx_activation_keys.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_network_policies.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_node_types.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_clouds.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connection_peering_routes.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connections.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_subnets.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_vmware_engine_networks.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_nsx_credentials.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_vcenter_credentials.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_nsx_credentials.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_vcenter_credentials.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.undelete_private_cloud.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_cluster.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_network_policy.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_cloud.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_connection.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_subnet.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_vmware_engine_network.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client.ts delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client_config.json delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/test/gapic_vmware_engine_v1.ts delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-vmwareengine/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/protos/google/cloud/vpcaccess/v1/vpc_access.proto delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.create_connector.js delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.delete_connector.js delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.get_connector.js delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.list_connectors.js delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/test/gapic_vpc_access_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-vpcaccess/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/protos/google/cloud/webrisk/v1/webrisk.proto delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.compute_threat_list_diff.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.create_submission.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_hashes.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_uris.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.submit_uri.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/test/gapic_web_risk_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/README.md delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/package.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/protos/google/cloud/webrisk/v1beta1/webrisk.proto delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client_config.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/test/gapic_web_risk_service_v1_beta1_v1beta1.ts delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-webrisk/v1beta1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_log.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.create_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_finding.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_run.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_findings.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_configs.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_runs.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.start_scan_run.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.update_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client_config.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/test/gapic_web_security_scanner_v1.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.gitignore delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/README.md delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/package.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/index.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client_config.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/test/gapic_web_security_scanner_v1alpha.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1alpha/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.gitignore delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/README.md delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/package.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/index.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client_config.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/test/gapic_web_security_scanner_v1beta.ts delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-websecurityscanner/v1beta/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.cancel_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.create_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.get_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.list_executions.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client_config.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/test/gapic_executions_v1.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.gitignore delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/README.md delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/package.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.create_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.get_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.list_executions.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client_config.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/test/gapic_executions_v1beta.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/v1/workflows.proto delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.cancel_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.create_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.get_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.list_executions.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.create_workflow.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.delete_workflow.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.get_workflow.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.list_workflows.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.update_workflow.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client_config.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client_config.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_executions_v1.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_workflows_v1.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.gitignore delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/README.md delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/package.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/v1beta/workflows.proto delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.create_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.get_execution.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.list_executions.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.create_workflow.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.delete_workflow.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.get_workflow.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.list_workflows.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.update_workflow.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client_config.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client_config.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_executions_v1beta.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_workflows_v1beta.ts delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-workflows-executions/v1beta/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/protos/google/cloud/workstations/v1/workstations.proto delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/snippet_metadata_google.cloud.workstations.v1.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_cluster.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_config.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_cluster.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_config.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.generate_access_token.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_cluster.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_config.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstation_configs.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstations.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_clusters.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_configs.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstations.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.start_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.stop_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_cluster.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_config.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client_config.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/test/gapic_workstations_v1.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.gitignore delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/README.md delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/package.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/protos/google/cloud/workstations/v1beta/workstations.proto delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workstations.v1beta.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_cluster.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_config.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_cluster.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_config.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.generate_access_token.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_cluster.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_config.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstation_configs.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstations.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_clusters.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_configs.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstations.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.start_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.stop_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_cluster.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_config.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/index.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client_config.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/test/gapic_workstations_v1beta.ts delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-workstations/v1beta/webpack.config.js delete mode 100644 owl-bot-staging/google-container/v1/.eslintignore delete mode 100644 owl-bot-staging/google-container/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-container/v1/.gitignore delete mode 100644 owl-bot-staging/google-container/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-container/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-container/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-container/v1/README.md delete mode 100644 owl-bot-staging/google-container/v1/package.json delete mode 100644 owl-bot-staging/google-container/v1/protos/google/container/v1/cluster_service.proto delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.cancel_operation.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.check_autopilot_compatibility.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_i_p_rotation.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_node_pool_upgrade.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_cluster.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_node_pool.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_cluster.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_node_pool.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_cluster.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_j_s_o_n_web_keys.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_node_pool.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_operation.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_server_config.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_clusters.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_node_pools.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_operations.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_usable_subnetworks.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.rollback_node_pool_upgrade.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_addons_config.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_labels.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_legacy_abac.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_locations.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_logging_service.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_maintenance_policy.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_master_auth.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_monitoring_service.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_network_policy.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_autoscaling.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_management.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_size.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.start_i_p_rotation.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_cluster.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_master.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_node_pool.js delete mode 100644 owl-bot-staging/google-container/v1/samples/generated/v1/snippet_metadata_google.container.v1.json delete mode 100644 owl-bot-staging/google-container/v1/src/index.ts delete mode 100644 owl-bot-staging/google-container/v1/src/v1/cluster_manager_client.ts delete mode 100644 owl-bot-staging/google-container/v1/src/v1/cluster_manager_client_config.json delete mode 100644 owl-bot-staging/google-container/v1/src/v1/cluster_manager_proto_list.json delete mode 100644 owl-bot-staging/google-container/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-container/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-container/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-container/v1/test/gapic_cluster_manager_v1.ts delete mode 100644 owl-bot-staging/google-container/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-container/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-container/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-container/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-container/v1beta1/.gitignore delete mode 100644 owl-bot-staging/google-container/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-container/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-container/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-container/v1beta1/README.md delete mode 100644 owl-bot-staging/google-container/v1beta1/package.json delete mode 100644 owl-bot-staging/google-container/v1beta1/protos/google/container/v1beta1/cluster_service.proto delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.cancel_operation.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.check_autopilot_compatibility.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_i_p_rotation.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_node_pool_upgrade.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_cluster.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_node_pool.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_cluster.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_node_pool.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_cluster.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_j_s_o_n_web_keys.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_node_pool.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_operation.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_server_config.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_clusters.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_locations.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_node_pools.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_operations.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_usable_subnetworks.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.rollback_node_pool_upgrade.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_addons_config.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_labels.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_legacy_abac.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_locations.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_logging_service.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_maintenance_policy.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_master_auth.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_monitoring_service.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_network_policy.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_autoscaling.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_management.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_size.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.start_i_p_rotation.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_cluster.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_master.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_node_pool.js delete mode 100644 owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/snippet_metadata_google.container.v1beta1.json delete mode 100644 owl-bot-staging/google-container/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client.ts delete mode 100644 owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client_config.json delete mode 100644 owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_proto_list.json delete mode 100644 owl-bot-staging/google-container/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-container/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-container/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-container/v1beta1/test/gapic_cluster_manager_v1beta1.ts delete mode 100644 owl-bot-staging/google-container/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-container/v1beta1/webpack.config.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/.eslintignore delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/.eslintrc.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/.gitignore delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/.jsdoc.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/.mocharc.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/.prettierrc.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/README.md delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/package.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/environment.proto delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/jobs.proto delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/messages.proto delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/metrics.proto delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/snapshots.proto delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/streaming.proto delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/templates.proto delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/flex_templates_service.launch_flex_template.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.aggregated_list_jobs.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.check_active_jobs.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.create_job.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.get_job.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.list_jobs.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.snapshot_job.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.update_job.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/messages_v1_beta3.list_job_messages.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_execution_details.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_metrics.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_stage_execution_details.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.delete_snapshot.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.get_snapshot.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.list_snapshots.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snippet_metadata_google.dataflow.v1beta3.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.create_job_from_template.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.get_template.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.launch_template.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/index.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client_config.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_proto_list.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/gapic_metadata.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/index.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client_config.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_proto_list.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client_config.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_proto_list.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client_config.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_proto_list.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client_config.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_proto_list.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client_config.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_proto_list.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/system-test/install.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_flex_templates_service_v1beta3.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_jobs_v1_beta3_v1beta3.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_messages_v1_beta3_v1beta3.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_metrics_v1_beta3_v1beta3.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_snapshots_v1_beta3_v1beta3.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/test/gapic_templates_service_v1beta3.ts delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/tsconfig.json delete mode 100644 owl-bot-staging/google-dataflow/v1beta3/webpack.config.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.eslintignore delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.gitignore delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/README.md delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/package.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/apt_artifact.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/artifact.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/file.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/package.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/repository.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/service.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/settings.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/tag.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/version.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/vpcsc_config.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/yum_artifact.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_repository.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_tag.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_package.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_repository.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_tag.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_version.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_docker_image.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_file.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_iam_policy.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_maven_artifact.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_npm_package.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_package.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_project_settings.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_python_package.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_repository.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_tag.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_v_p_c_s_c_config.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_version.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_apt_artifacts.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_yum_artifacts.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_docker_images.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_files.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_maven_artifacts.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_npm_packages.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_packages.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_python_packages.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_repositories.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_tags.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_versions.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.set_iam_policy.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_project_settings.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_repository.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_tag.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_v_p_c_s_c_config.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/snippet_metadata_google.devtools.artifactregistry.v1.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client_config.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_proto_list.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/test/gapic_artifact_registry_v1.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintignore delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintrc.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.gitignore delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.jsdoc.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.mocharc.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/.prettierrc.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/README.md delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/package.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/apt_artifact.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/file.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/package.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/repository.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/service.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/settings.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/tag.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/version.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/yum_artifact.proto delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_repository.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_tag.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_package.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_repository.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_tag.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_version.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_file.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_iam_policy.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_package.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_project_settings.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_repository.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_tag.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_version.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_apt_artifacts.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_yum_artifacts.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_files.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_packages.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_repositories.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_tags.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_versions.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.set_iam_policy.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_project_settings.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_repository.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_tag.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/snippet_metadata_google.devtools.artifactregistry.v1beta2.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client_config.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_proto_list.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/index.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/install.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/test/gapic_artifact_registry_v1beta2.ts delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/tsconfig.json delete mode 100644 owl-bot-staging/google-devtools-artifactregistry/v1beta2/webpack.config.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/README.md delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/package.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata_google.devtools.cloudbuild.v1.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.jsdoc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.prettierrc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/README.md delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/package.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata_google.devtools.cloudbuild.v2.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/tsconfig.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/webpack.config.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.eslintignore delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.gitignore delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/README.md delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/package.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/google/devtools/containeranalysis/v1/containeranalysis.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/attestation.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/build.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/common.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/compliance.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/cvss.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/deployment.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/discovery.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/dsse_attestation.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/grafeas.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/image.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_provenance.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_statement.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/package.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/provenance.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/severity.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance_zero_two.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/upgrade.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vex.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vulnerability.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_iam_policy.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_vulnerability_occurrences_summary.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.set_iam_policy.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_notes.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_occurrences.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_note.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_occurrence.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_note.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_occurrence.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_note.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence_note.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_note_occurrences.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_notes.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_occurrences.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_note.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_occurrence.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/snippet_metadata_google.devtools.containeranalysis.v1.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client_config.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_proto_list.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client_config.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_proto_list.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_container_analysis_v1.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_grafeas_v1.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.gitignore delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/README.md delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/package.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/build/build.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/common/common.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/image/image.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/package/package.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/source/source.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.get_iam_policy.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.set_iam_policy.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_notes.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_occurrences.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_note.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_occurrence.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_note.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_occurrence.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_note.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence_note.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_vulnerability_occurrences_summary.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_note_occurrences.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_notes.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_occurrences.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_note.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_occurrence.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/snippet_metadata_google.devtools.containeranalysis.v1beta1.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client_config.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_proto_list.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client_config.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_proto_list.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_container_analysis_v1_beta1_v1beta1.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_grafeas_v1_beta1_v1beta1.ts delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-devtools-containeranalysis/v1beta1/webpack.config.js delete mode 100644 owl-bot-staging/google-iam-credentials/v1/.eslintignore delete mode 100644 owl-bot-staging/google-iam-credentials/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-iam-credentials/v1/.gitignore delete mode 100644 owl-bot-staging/google-iam-credentials/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-iam-credentials/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-iam-credentials/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-iam-credentials/v1/README.md delete mode 100644 owl-bot-staging/google-iam-credentials/v1/package.json delete mode 100644 owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/common.proto delete mode 100644 owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/iamcredentials.proto delete mode 100644 owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_access_token.js delete mode 100644 owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_id_token.js delete mode 100644 owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_blob.js delete mode 100644 owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_jwt.js delete mode 100644 owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/snippet_metadata_google.iam.credentials.v1.json delete mode 100644 owl-bot-staging/google-iam-credentials/v1/src/index.ts delete mode 100644 owl-bot-staging/google-iam-credentials/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client.ts delete mode 100644 owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client_config.json delete mode 100644 owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_proto_list.json delete mode 100644 owl-bot-staging/google-iam-credentials/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-iam-credentials/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-iam-credentials/v1/test/gapic_i_a_m_credentials_v1.ts delete mode 100644 owl-bot-staging/google-iam-credentials/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-iam-credentials/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-iam/v2/.eslintignore delete mode 100644 owl-bot-staging/google-iam/v2/.eslintrc.json delete mode 100644 owl-bot-staging/google-iam/v2/.gitignore delete mode 100644 owl-bot-staging/google-iam/v2/.jsdoc.js delete mode 100644 owl-bot-staging/google-iam/v2/.mocharc.js delete mode 100644 owl-bot-staging/google-iam/v2/.prettierrc.js delete mode 100644 owl-bot-staging/google-iam/v2/README.md delete mode 100644 owl-bot-staging/google-iam/v2/package.json delete mode 100644 owl-bot-staging/google-iam/v2/protos/google/iam/v2/deny.proto delete mode 100644 owl-bot-staging/google-iam/v2/protos/google/iam/v2/policy.proto delete mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/policies.create_policy.js delete mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/policies.delete_policy.js delete mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/policies.get_policy.js delete mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/policies.list_policies.js delete mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/policies.update_policy.js delete mode 100644 owl-bot-staging/google-iam/v2/samples/generated/v2/snippet_metadata_google.iam.v2.json delete mode 100644 owl-bot-staging/google-iam/v2/src/index.ts delete mode 100644 owl-bot-staging/google-iam/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-iam/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/google-iam/v2/src/v2/policies_client.ts delete mode 100644 owl-bot-staging/google-iam/v2/src/v2/policies_client_config.json delete mode 100644 owl-bot-staging/google-iam/v2/src/v2/policies_proto_list.json delete mode 100644 owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-iam/v2/system-test/install.ts delete mode 100644 owl-bot-staging/google-iam/v2/test/gapic_policies_v2.ts delete mode 100644 owl-bot-staging/google-iam/v2/tsconfig.json delete mode 100644 owl-bot-staging/google-iam/v2/webpack.config.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintignore delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.gitignore delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/README.md delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/package.json delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/type/device_resources.proto delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_context_manager.proto delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_level.proto delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_policy.proto delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.commit_service_perimeters.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_level.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_policy.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_gcp_user_access_binding.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_service_perimeter.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_level.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_policy.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_service_perimeter.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_level.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_policy.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_gcp_user_access_binding.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_iam_policy.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_service_perimeter.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_levels.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_policies.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_gcp_user_access_bindings.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_service_perimeters.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_access_levels.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_service_perimeters.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.set_iam_policy.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_level.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_policy.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_gcp_user_access_binding.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_service_perimeter.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/snippet_metadata_google.identity.accesscontextmanager.v1.json delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/index.ts delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client.ts delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client_config.json delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_proto_list.json delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/test/gapic_access_context_manager_v1.ts delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-identity-accesscontextmanager/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.eslintignore delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.gitignore delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/README.md delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/package.json delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/geo/type/viewport.proto delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address.proto delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address_validation_service.proto delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/geocode.proto delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/metadata.proto delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/usps_data.proto delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.provide_validation_feedback.js delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.validate_address.js delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/snippet_metadata_google.maps.addressvalidation.v1.json delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/index.ts delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client.ts delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client_config.json delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_proto_list.json delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/test/gapic_address_validation_v1.ts delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-maps-addressvalidation/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintignore delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.gitignore delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/README.md delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/package.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/data_source.proto delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/dataset.proto delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets_service.proto delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.create_dataset.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.delete_dataset.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.get_dataset.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.list_datasets.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.update_dataset_metadata.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/snippet_metadata_google.maps.mapsplatformdatasets.v1.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/index.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client_config.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_proto_list.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/test/gapic_maps_platform_datasets_v1.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintignore delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintrc.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.gitignore delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.jsdoc.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.mocharc.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.prettierrc.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/README.md delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/package.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/data_source.proto delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/dataset.proto delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets_alpha_service.proto delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.create_dataset.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset_version.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.get_dataset.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_dataset_versions.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_datasets.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.update_dataset_metadata.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/snippet_metadata_google.maps.mapsplatformdatasets.v1alpha.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/index.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/gapic_metadata.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/index.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client_config.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_proto_list.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/install.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/test/gapic_maps_platform_datasets_v1_alpha_v1alpha.ts delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/tsconfig.json delete mode 100644 owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/webpack.config.js delete mode 100644 owl-bot-staging/google-maps-places/v1/.eslintignore delete mode 100644 owl-bot-staging/google-maps-places/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-maps-places/v1/.gitignore delete mode 100644 owl-bot-staging/google-maps-places/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-maps-places/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-maps-places/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-maps-places/v1/README.md delete mode 100644 owl-bot-staging/google-maps-places/v1/package.json delete mode 100644 owl-bot-staging/google-maps-places/v1/protos/google/geo/type/viewport.proto delete mode 100644 owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/geometry.proto delete mode 100644 owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/place.proto delete mode 100644 owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/places_service.proto delete mode 100644 owl-bot-staging/google-maps-places/v1/samples/generated/v1/places.search_text.js delete mode 100644 owl-bot-staging/google-maps-places/v1/samples/generated/v1/snippet_metadata_google.maps.places.v1.json delete mode 100644 owl-bot-staging/google-maps-places/v1/src/index.ts delete mode 100644 owl-bot-staging/google-maps-places/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-maps-places/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-maps-places/v1/src/v1/places_client.ts delete mode 100644 owl-bot-staging/google-maps-places/v1/src/v1/places_client_config.json delete mode 100644 owl-bot-staging/google-maps-places/v1/src/v1/places_proto_list.json delete mode 100644 owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-maps-places/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-maps-places/v1/test/gapic_places_v1.ts delete mode 100644 owl-bot-staging/google-maps-places/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-maps-places/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-maps-routing/v2/.eslintignore delete mode 100644 owl-bot-staging/google-maps-routing/v2/.eslintrc.json delete mode 100644 owl-bot-staging/google-maps-routing/v2/.gitignore delete mode 100644 owl-bot-staging/google-maps-routing/v2/.jsdoc.js delete mode 100644 owl-bot-staging/google-maps-routing/v2/.mocharc.js delete mode 100644 owl-bot-staging/google-maps-routing/v2/.prettierrc.js delete mode 100644 owl-bot-staging/google-maps-routing/v2/README.md delete mode 100644 owl-bot-staging/google-maps-routing/v2/package.json delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/geo/type/viewport.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/fallback_info.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/geocoding_results.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/localized_time.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/location.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/maneuver.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/navigation_instruction.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/polyline.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_label.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_modifiers.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_travel_mode.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routes_service.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routing_preference.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/speed_reading_interval.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_info.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_passes.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/traffic_model.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit_preferences.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/units.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_emission_type.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_info.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/waypoint.proto delete mode 100644 owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_route_matrix.js delete mode 100644 owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_routes.js delete mode 100644 owl-bot-staging/google-maps-routing/v2/samples/generated/v2/snippet_metadata_google.maps.routing.v2.json delete mode 100644 owl-bot-staging/google-maps-routing/v2/src/index.ts delete mode 100644 owl-bot-staging/google-maps-routing/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-maps-routing/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/google-maps-routing/v2/src/v2/routes_client.ts delete mode 100644 owl-bot-staging/google-maps-routing/v2/src/v2/routes_client_config.json delete mode 100644 owl-bot-staging/google-maps-routing/v2/src/v2/routes_proto_list.json delete mode 100644 owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-maps-routing/v2/system-test/install.ts delete mode 100644 owl-bot-staging/google-maps-routing/v2/test/gapic_routes_v2.ts delete mode 100644 owl-bot-staging/google-maps-routing/v2/tsconfig.json delete mode 100644 owl-bot-staging/google-maps-routing/v2/webpack.config.js delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.eslintignore delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.gitignore delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/README.md delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/package.json delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/alertchart.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/collapsible_group.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/common.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard_filter.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboards_service.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/drilldowns.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/layouts.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/logs_panel.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/metrics.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/scorecard.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/service.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table_display_options.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/text.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/widget.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/xychart.proto delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.create_dashboard.js delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.delete_dashboard.js delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.get_dashboard.js delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.list_dashboards.js delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.update_dashboard.js delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/snippet_metadata_google.monitoring.dashboard.v1.json delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/index.ts delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client.ts delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client_config.json delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_proto_list.json delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/test/gapic_dashboards_service_v1.ts delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-monitoring-dashboard/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/.eslintignore delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/.eslintrc.json delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/.gitignore delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/.jsdoc.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/.mocharc.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/.prettierrc.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/README.md delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/package.json delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/dlp.proto delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/storage.proto delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.activate_job_trigger.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.cancel_dlp_job.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_deidentify_template.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_dlp_job.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_inspect_template.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_job_trigger.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_stored_info_type.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.deidentify_content.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_deidentify_template.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_dlp_job.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_inspect_template.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_job_trigger.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_stored_info_type.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.finish_dlp_job.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_deidentify_template.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_dlp_job.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_inspect_template.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_job_trigger.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_stored_info_type.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_dlp_job.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_job_trigger.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.inspect_content.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_deidentify_templates.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_dlp_jobs.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_info_types.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_inspect_templates.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_job_triggers.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_stored_info_types.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.redact_image.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.reidentify_content.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_deidentify_template.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_inspect_template.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_job_trigger.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_stored_info_type.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/index.ts delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client.ts delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client_config.json delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_proto_list.json delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/system-test/install.ts delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/test/gapic_dlp_service_v2.ts delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/tsconfig.json delete mode 100644 owl-bot-staging/google-privacy-dlp/v2/webpack.config.js diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/.eslintignore b/owl-bot-staging/google-cloud-vmwareengine/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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-vmwareengine/v1/.eslintrc.json b/owl-bot-staging/google-cloud-vmwareengine/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/.gitignore b/owl-bot-staging/google-cloud-vmwareengine/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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-vmwareengine/v1/.jsdoc.js b/owl-bot-staging/google-cloud-vmwareengine/v1/.jsdoc.js deleted file mode 100644 index eb1f6fb78c2..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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/vmwareengine', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/.mocharc.js b/owl-bot-staging/google-cloud-vmwareengine/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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-vmwareengine/v1/.prettierrc.js b/owl-bot-staging/google-cloud-vmwareengine/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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-vmwareengine/v1/README.md b/owl-bot-staging/google-cloud-vmwareengine/v1/README.md deleted file mode 100644 index 0bf3ffc6467..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Vmwareengine: Nodejs Client diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/package.json b/owl-bot-staging/google-cloud-vmwareengine/v1/package.json deleted file mode 100644 index 7799de13ad4..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/vmwareengine", - "version": "0.1.0", - "description": "Vmwareengine client for Node.js", - "repository": "googleapis/nodejs-vmwareengine", - "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 vmwareengine", - "vmwareengine", - "vmware engine" - ], - "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-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine.proto b/owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine.proto deleted file mode 100644 index eef4dcd7da4..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine.proto +++ /dev/null @@ -1,2015 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.vmwareengine.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/vmwareengine/v1/vmwareengine_resources.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.VmwareEngine.V1"; -option go_package = "cloud.google.com/go/vmwareengine/apiv1/vmwareenginepb;vmwareenginepb"; -option java_multiple_files = true; -option java_outer_classname = "VmwareengineProto"; -option java_package = "com.google.cloud.vmwareengine.v1"; -option php_namespace = "Google\\Cloud\\VmwareEngine\\V1"; -option ruby_package = "Google::Cloud::VmwareEngine::V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; - -// VMwareEngine manages VMware's private clusters in the Cloud. -service VmwareEngine { - option (google.api.default_host) = "vmwareengine.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists `PrivateCloud` resources in a given project and location. - rpc ListPrivateClouds(ListPrivateCloudsRequest) - returns (ListPrivateCloudsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/privateClouds" - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves a `PrivateCloud` resource by its resource name. - rpc GetPrivateCloud(GetPrivateCloudRequest) returns (PrivateCloud) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/privateClouds/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new `PrivateCloud` resource in a given project and location. - // Private clouds can only be created in zones, regional private clouds are - // not supported. - // - // Creating a private cloud also creates a [management - // cluster](https://cloud.google.com/vmware-engine/docs/concepts-vmware-components) - // for that private cloud. - rpc CreatePrivateCloud(CreatePrivateCloudRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/privateClouds" - body: "private_cloud" - }; - option (google.api.method_signature) = - "parent,private_cloud,private_cloud_id"; - option (google.longrunning.operation_info) = { - response_type: "PrivateCloud" - metadata_type: "OperationMetadata" - }; - } - - // Modifies a `PrivateCloud` resource. Only the following fields can be - // updated: `description`. - // Only fields specified in `updateMask` are applied. - // - // During operation processing, the resource is temporarily in the `ACTIVE` - // state before the operation fully completes. For that period of time, you - // can't update the resource. Use the operation status to determine when the - // processing fully completes. - rpc UpdatePrivateCloud(UpdatePrivateCloudRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{private_cloud.name=projects/*/locations/*/privateClouds/*}" - body: "private_cloud" - }; - option (google.api.method_signature) = "private_cloud,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "PrivateCloud" - metadata_type: "OperationMetadata" - }; - } - - // Schedules a `PrivateCloud` resource for deletion. - // - // A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` - // set to `DELETED` and `expireTime` set to the time when deletion is final - // and can no longer be reversed. The delete operation is marked as done - // as soon as the `PrivateCloud` is successfully scheduled for deletion - // (this also applies when `delayHours` is set to zero), and the operation is - // not kept in pending state until `PrivateCloud` is purged. - // `PrivateCloud` can be restored using `UndeletePrivateCloud` method before - // the `expireTime` elapses. When `expireTime` is reached, deletion is final - // and all private cloud resources are irreversibly removed and billing stops. - // During the final removal process, `PrivateCloud.state` is set to `PURGING`. - // `PrivateCloud` can be polled using standard `GET` method for the whole - // period of deletion and purging. It will not be returned only - // when it is completely purged. - rpc DeletePrivateCloud(DeletePrivateCloudRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/privateClouds/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "PrivateCloud" - metadata_type: "OperationMetadata" - }; - } - - // Restores a private cloud that was previously scheduled for deletion by - // `DeletePrivateCloud`. A `PrivateCloud` resource scheduled for deletion has - // `PrivateCloud.state` set to `DELETED` and `PrivateCloud.expireTime` set to - // the time when deletion can no longer be reversed. - rpc UndeletePrivateCloud(UndeletePrivateCloudRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/privateClouds/*}:undelete" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "PrivateCloud" - metadata_type: "OperationMetadata" - }; - } - - // Lists `Cluster` resources in a given private cloud. - rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/privateClouds/*}/clusters" - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves a `Cluster` resource by its resource name. - rpc GetCluster(GetClusterRequest) returns (Cluster) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/privateClouds/*/clusters/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new cluster in a given private cloud. - // Creating a new cluster provides additional nodes for - // use in the parent private cloud and requires sufficient [node - // quota](https://cloud.google.com/vmware-engine/quotas). - rpc CreateCluster(CreateClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/privateClouds/*}/clusters" - body: "cluster" - }; - option (google.api.method_signature) = "parent,cluster,cluster_id"; - option (google.longrunning.operation_info) = { - response_type: "Cluster" - metadata_type: "OperationMetadata" - }; - } - - // Modifies a `Cluster` resource. Only the following fields can be updated: - // `node_type_configs.*.node_count`. Only fields specified in `updateMask` are - // applied. - // - // During operation processing, the resource is temporarily in the `ACTIVE` - // state before the operation fully completes. For that period of time, you - // can't update the resource. Use the operation status to determine when the - // processing fully completes. - rpc UpdateCluster(UpdateClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{cluster.name=projects/*/locations/*/privateClouds/*/clusters/*}" - body: "cluster" - }; - option (google.api.method_signature) = "cluster,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Cluster" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a `Cluster` resource. To avoid unintended data loss, migrate or - // gracefully shut down any workloads running on the cluster before deletion. - // You cannot delete the management cluster of a private cloud using this - // method. - rpc DeleteCluster(DeleteClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/privateClouds/*/clusters/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Lists subnets in a given private cloud. - rpc ListSubnets(ListSubnetsRequest) returns (ListSubnetsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/privateClouds/*}/subnets" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single subnet. - rpc GetSubnet(GetSubnetRequest) returns (Subnet) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/privateClouds/*/subnets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the parameters of a single subnet. Only fields specified in - // `update_mask` are applied. - // - // *Note*: This API is synchronous and always returns a successful - // `google.longrunning.Operation` (LRO). The returned LRO will only have - // `done` and `response` fields. - rpc UpdateSubnet(UpdateSubnetRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{subnet.name=projects/*/locations/*/privateClouds/*/subnets/*}" - body: "subnet" - }; - option (google.api.method_signature) = "subnet,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Subnet" - metadata_type: "OperationMetadata" - }; - } - - // Lists node types - rpc ListNodeTypes(ListNodeTypesRequest) returns (ListNodeTypesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/nodeTypes" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single `NodeType`. - rpc GetNodeType(GetNodeTypeRequest) returns (NodeType) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/nodeTypes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets details of credentials for NSX appliance. - rpc ShowNsxCredentials(ShowNsxCredentialsRequest) returns (Credentials) { - option (google.api.http) = { - get: "/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:showNsxCredentials" - }; - option (google.api.method_signature) = "private_cloud"; - } - - // Gets details of credentials for Vcenter appliance. - rpc ShowVcenterCredentials(ShowVcenterCredentialsRequest) - returns (Credentials) { - option (google.api.http) = { - get: "/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:showVcenterCredentials" - }; - option (google.api.method_signature) = "private_cloud"; - } - - // Resets credentials of the NSX appliance. - rpc ResetNsxCredentials(ResetNsxCredentialsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:resetNsxCredentials" - body: "*" - }; - option (google.api.method_signature) = "private_cloud"; - option (google.longrunning.operation_info) = { - response_type: "PrivateCloud" - metadata_type: "OperationMetadata" - }; - } - - // Resets credentials of the Vcenter appliance. - rpc ResetVcenterCredentials(ResetVcenterCredentialsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:resetVcenterCredentials" - body: "*" - }; - option (google.api.method_signature) = "private_cloud"; - option (google.longrunning.operation_info) = { - response_type: "PrivateCloud" - metadata_type: "OperationMetadata" - }; - } - - // Creates a new HCX activation key in a given private cloud. - rpc CreateHcxActivationKey(CreateHcxActivationKeyRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/privateClouds/*}/hcxActivationKeys" - body: "hcx_activation_key" - }; - option (google.api.method_signature) = - "parent,hcx_activation_key,hcx_activation_key_id"; - option (google.longrunning.operation_info) = { - response_type: "HcxActivationKey" - metadata_type: "OperationMetadata" - }; - } - - // Lists `HcxActivationKey` resources in a given private cloud. - rpc ListHcxActivationKeys(ListHcxActivationKeysRequest) - returns (ListHcxActivationKeysResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/privateClouds/*}/hcxActivationKeys" - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves a `HcxActivationKey` resource by its resource name. - rpc GetHcxActivationKey(GetHcxActivationKeyRequest) - returns (HcxActivationKey) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Retrieves a `NetworkPolicy` resource by its resource name. - rpc GetNetworkPolicy(GetNetworkPolicyRequest) returns (NetworkPolicy) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/networkPolicies/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists `NetworkPolicy` resources in a specified project and location. - rpc ListNetworkPolicies(ListNetworkPoliciesRequest) - returns (ListNetworkPoliciesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/networkPolicies" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new network policy in a given VMware Engine network of a - // project and location (region). A new network policy cannot be created if - // another network policy already exists in the same scope. - rpc CreateNetworkPolicy(CreateNetworkPolicyRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/networkPolicies" - body: "network_policy" - }; - option (google.api.method_signature) = - "parent,network_policy,network_policy_id"; - option (google.longrunning.operation_info) = { - response_type: "NetworkPolicy" - metadata_type: "OperationMetadata" - }; - } - - // Modifies a `NetworkPolicy` resource. Only the following fields can be - // updated: `internet_access`, `external_ip`, `edge_services_cidr`. - // Only fields specified in `updateMask` are applied. When updating a network - // policy, the external IP network service can only be disabled if there are - // no external IP addresses present in the scope of the policy. Also, a - // `NetworkService` cannot be updated when `NetworkService.state` is set - // to `RECONCILING`. - // - // During operation processing, the resource is temporarily in the `ACTIVE` - // state before the operation fully completes. For that period of time, you - // can't update the resource. Use the operation status to determine when the - // processing fully completes. - rpc UpdateNetworkPolicy(UpdateNetworkPolicyRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{network_policy.name=projects/*/locations/*/networkPolicies/*}" - body: "network_policy" - }; - option (google.api.method_signature) = "network_policy,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "NetworkPolicy" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a `NetworkPolicy` resource. A network policy cannot be deleted - // when `NetworkService.state` is set to `RECONCILING` for either its external - // IP or internet access service. - rpc DeleteNetworkPolicy(DeleteNetworkPolicyRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/networkPolicies/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Creates a new VMware Engine network that can be used by a private cloud. - rpc CreateVmwareEngineNetwork(CreateVmwareEngineNetworkRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/vmwareEngineNetworks" - body: "vmware_engine_network" - }; - option (google.api.method_signature) = - "parent,vmware_engine_network,vmware_engine_network_id"; - option (google.longrunning.operation_info) = { - response_type: "VmwareEngineNetwork" - metadata_type: "OperationMetadata" - }; - } - - // Modifies a VMware Engine network resource. Only the following fields can be - // updated: `description`. Only fields specified in `updateMask` are - // applied. - rpc UpdateVmwareEngineNetwork(UpdateVmwareEngineNetworkRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{vmware_engine_network.name=projects/*/locations/*/vmwareEngineNetworks/*}" - body: "vmware_engine_network" - }; - option (google.api.method_signature) = "vmware_engine_network,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "VmwareEngineNetwork" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a `VmwareEngineNetwork` resource. You can only delete a VMware - // Engine network after all resources that refer to it are deleted. For - // example, a private cloud, a network peering, and a network policy can all - // refer to the same VMware Engine network. - rpc DeleteVmwareEngineNetwork(DeleteVmwareEngineNetworkRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/vmwareEngineNetworks/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Retrieves a `VmwareEngineNetwork` resource by its resource name. The - // resource contains details of the VMware Engine network, such as its VMware - // Engine network type, peered networks in a service project, and state - // (for example, `CREATING`, `ACTIVE`, `DELETING`). - rpc GetVmwareEngineNetwork(GetVmwareEngineNetworkRequest) - returns (VmwareEngineNetwork) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/vmwareEngineNetworks/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists `VmwareEngineNetwork` resources in a given project and location. - rpc ListVmwareEngineNetworks(ListVmwareEngineNetworksRequest) - returns (ListVmwareEngineNetworksResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/vmwareEngineNetworks" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new private connection that can be used for accessing private - // Clouds. - rpc CreatePrivateConnection(CreatePrivateConnectionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/privateConnections" - body: "private_connection" - }; - option (google.api.method_signature) = - "parent,private_connection,private_connection_id"; - option (google.longrunning.operation_info) = { - response_type: "PrivateConnection" - metadata_type: "OperationMetadata" - }; - } - - // Retrieves a `PrivateConnection` resource by its resource name. The resource - // contains details of the private connection, such as connected - // network, routing mode and state. - rpc GetPrivateConnection(GetPrivateConnectionRequest) - returns (PrivateConnection) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/privateConnections/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists `PrivateConnection` resources in a given project and location. - rpc ListPrivateConnections(ListPrivateConnectionsRequest) - returns (ListPrivateConnectionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/privateConnections" - }; - option (google.api.method_signature) = "parent"; - } - - // Modifies a `PrivateConnection` resource. Only `description` and - // `routing_mode` fields can be updated. Only fields specified in `updateMask` - // are applied. - rpc UpdatePrivateConnection(UpdatePrivateConnectionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{private_connection.name=projects/*/locations/*/privateConnections/*}" - body: "private_connection" - }; - option (google.api.method_signature) = "private_connection,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "PrivateConnection" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a `PrivateConnection` resource. When a private connection is - // deleted for a VMware Engine network, the connected network becomes - // inaccessible to that VMware Engine network. - rpc DeletePrivateConnection(DeletePrivateConnectionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/privateConnections/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Lists the private connection routes exchanged over a peering connection. - rpc ListPrivateConnectionPeeringRoutes( - ListPrivateConnectionPeeringRoutesRequest) - returns (ListPrivateConnectionPeeringRoutesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/privateConnections/*}/peeringRoutes" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request message for -// [VmwareEngine.ListPrivateClouds][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateClouds] -message ListPrivateCloudsRequest { - // Required. The resource name of the private cloud to be queried for - // clusters. Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of private clouds to return in one page. - // The service may return fewer than this value. - // The maximum value is coerced to 1000. - // The default value of this field is 500. - int32 page_size = 2; - - // A page token, received from a previous `ListPrivateClouds` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListPrivateClouds` must - // match the call that provided the page token. - string page_token = 3; - - // A filter expression that matches resources returned in the response. - // The expression must specify the field name, a comparison operator, and the - // value that you want to use for filtering. The value must be a string, a - // number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or - // `<`. - // - // For example, if you are filtering a list of private clouds, you can exclude - // the ones named `example-pc` by specifying `name != "example-pc"`. - // - // You can also filter nested fields. For example, you could specify - // `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds - // only if they have a matching address in their network configuration. - // - // To filter on multiple expressions, provide each separate expression within - // parentheses. For example: - // ``` - // (name = "example-pc") - // (createTime > "2021-04-12T08:15:10.40Z") - // ``` - // - // By default, each expression is an `AND` expression. However, you can - // include `AND` and `OR` expressions explicitly. For example: - // ``` - // (name = "private-cloud-1") AND - // (createTime > "2021-04-12T08:15:10.40Z") OR - // (name = "private-cloud-2") - // ``` - string filter = 4; - - // Sorts list results by a certain order. By default, returned results are - // ordered by `name` in ascending order. You can also sort results in - // descending order based on the `name` value using `orderBy="name desc"`. - // Currently, only ordering by `name` is supported. - string order_by = 5; -} - -// Response message for -// [VmwareEngine.ListPrivateClouds][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateClouds] -message ListPrivateCloudsResponse { - // A list of private clouds. - repeated PrivateCloud private_clouds = 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 when making an aggregated query using - // wildcards. - repeated string unreachable = 3; -} - -// Request message for -// [VmwareEngine.GetPrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateCloud] -message GetPrivateCloudRequest { - // Required. The resource name of the private cloud to retrieve. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; -} - -// Request message for -// [VmwareEngine.CreatePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateCloud] -message CreatePrivateCloudRequest { - // Required. The resource name of the location to create the new - // private cloud in. Resource names are schemeless URIs that follow the - // conventions in https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The user-provided identifier of the private cloud to be created. - // This identifier must be unique among each `PrivateCloud` within the parent - // and becomes the final token in the name URI. - // The identifier must meet the following requirements: - // - // * Only contains 1-63 alphanumeric characters and hyphens - // * Begins with an alphabetical character - // * Ends with a non-hyphen character - // * Not formatted as a UUID - // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - // (section 3.5) - string private_cloud_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The initial description of the new private cloud. - PrivateCloud private_cloud = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. 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. True if you want the request to be validated and not executed; - // false otherwise. - bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [VmwareEngine.UpdatePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateCloud] -message UpdatePrivateCloudRequest { - // Required. Private cloud description. - PrivateCloud private_cloud = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Field mask is used to specify the fields to be overwritten in the - // `PrivateCloud` resource by the update. The fields specified in `updateMask` - // 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 = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. 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 -// [VmwareEngine.DeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateCloud] -message DeletePrivateCloudRequest { - // Required. The resource name of the private cloud to delete. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; - - // Optional. 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, cascade delete is enabled and all children of - // this private cloud resource are also deleted. When this flag is set to - // false, the private cloud will not be deleted if there are any children - // other than the management cluster. The management cluster is always - // deleted. - bool force = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Time delay of the deletion specified in hours. The default value - // is `3`. Specifying a non-zero value for this field changes the value of - // `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned - // deletion time. Deletion can be cancelled before `expire_time` elapses using - // [VmwareEngine.UndeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud]. - // Specifying a value of `0` for this field instead begins the deletion - // process and ceases billing immediately. During the final deletion process, - // the value of `PrivateCloud.state` becomes `PURGING`. - optional int32 delay_hours = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [VmwareEngine.UndeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud] -message UndeletePrivateCloudRequest { - // Required. The resource name of the private cloud scheduled for deletion. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; - - // Optional. The request ID must be a valid UUID with the exception that zero - // UUID is not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [VmwareEngine.ListClusters][google.cloud.vmwareengine.v1.VmwareEngine.ListClusters] -message ListClustersRequest { - // Required. The resource name of the private cloud to query for clusters. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; - - // The maximum number of clusters to return in one page. - // The service may return fewer than this value. - // The maximum value is coerced to 1000. - // The default value of this field is 500. - int32 page_size = 2; - - // A page token, received from a previous `ListClusters` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListClusters` - // must match the call that provided the page token. - string page_token = 3; - - // - // To filter on multiple expressions, provide each separate expression within - // parentheses. For example: - // ``` - // (name = "example-cluster") - // (nodeCount = "3") - // ``` - // - // By default, each expression is an `AND` expression. However, you can - // include `AND` and `OR` expressions explicitly. For example: - // ``` - // (name = "example-cluster-1") AND - // (createTime > "2021-04-12T08:15:10.40Z") OR - // (name = "example-cluster-2") - // ``` - string filter = 4; - - // Sorts list results by a certain order. By default, returned results are - // ordered by `name` in ascending order. You can also sort results in - // descending order based on the `name` value using `orderBy="name desc"`. - // Currently, only ordering by `name` is supported. - string order_by = 5; -} - -// Response message for -// [VmwareEngine.ListClusters][google.cloud.vmwareengine.v1.VmwareEngine.ListClusters] -message ListClustersResponse { - // A list of private cloud clusters. - repeated Cluster clusters = 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 when making an aggregated query using - // wildcards. - repeated string unreachable = 3; -} - -// Request message for -// [VmwareEngine.GetCluster][google.cloud.vmwareengine.v1.VmwareEngine.GetCluster] -message GetClusterRequest { - // Required. The cluster resource name to retrieve. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/Cluster" - } - ]; -} - -// Request message for -// [VmwareEngine.CreateCluster][google.cloud.vmwareengine.v1.VmwareEngine.CreateCluster] -message CreateClusterRequest { - // Required. The resource name of the private cloud to create a new cluster - // in. Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; - - // Required. The user-provided identifier of the new `Cluster`. - // This identifier must be unique among clusters within the parent and becomes - // the final token in the name URI. - // The identifier must meet the following requirements: - // - // * Only contains 1-63 alphanumeric characters and hyphens - // * Begins with an alphabetical character - // * Ends with a non-hyphen character - // * Not formatted as a UUID - // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - // (section 3.5) - string cluster_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The initial description of the new cluster. - Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. 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. True if you want the request to be validated and not executed; - // false otherwise. - bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [VmwareEngine.UpdateCluster][google.cloud.vmwareengine.v1.VmwareEngine.UpdateCluster] -message UpdateClusterRequest { - // Required. Field mask is used to specify the fields to be overwritten in the - // `Cluster` resource by the update. The fields specified in the `updateMask` - // 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) = REQUIRED]; - - // Required. The description of the cluster. - Cluster cluster = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. 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]; - - // Optional. True if you want the request to be validated and not executed; - // false otherwise. - bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [VmwareEngine.DeleteCluster][google.cloud.vmwareengine.v1.VmwareEngine.DeleteCluster] -message DeleteClusterRequest { - // Required. The resource name of the cluster to delete. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/Cluster" - } - ]; - - // Optional. The request ID must be a valid UUID with the exception that zero - // UUID is not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [VmwareEngine.ListSubnets][google.cloud.vmwareengine.v1.VmwareEngine.ListSubnets] -message ListSubnetsRequest { - // Required. The resource name of the private cloud to be queried for - // subnets. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; - - // The maximum number of subnets to return in one page. - // The service may return fewer than this value. - // The maximum value is coerced to 1000. - // The default value of this field is 500. - int32 page_size = 2; - - // A page token, received from a previous `ListSubnetsRequest` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListSubnetsRequest` must match the call that provided the page token. - string page_token = 3; -} - -// Response message for -// [VmwareEngine.ListSubnets][google.cloud.vmwareengine.v1.VmwareEngine.ListSubnets] -message ListSubnetsResponse { - // A list of subnets. - repeated Subnet subnets = 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 when making an aggregated query using - // wildcards. - repeated string unreachable = 3; -} - -// Request message for -// [VmwareEngine.GetSubnet][google.cloud.vmwareengine.v1.VmwareEngine.GetSubnet] -message GetSubnetRequest { - // Required. The resource name of the subnet to retrieve. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/Subnet" - } - ]; -} - -// Request message for -// [VmwareEngine.UpdateSubnet][google.cloud.vmwareengine.v1.VmwareEngine.UpdateSubnet] -message UpdateSubnetRequest { - // Required. Field mask is used to specify the fields to be overwritten in the - // `Subnet` 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) = REQUIRED]; - - // Required. Subnet description. - Subnet subnet = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// 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. True if the user has requested cancellation - // of the operation; false otherwise. - // 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 -// [VmwareEngine.ListNodeTypes][google.cloud.vmwareengine.v1.VmwareEngine.ListNodeTypes] -message ListNodeTypesRequest { - // Required. The resource name of the location to be queried for node types. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of node types to return in one page. - // The service may return fewer than this value. - // The maximum value is coerced to 1000. - // The default value of this field is 500. - int32 page_size = 2; - - // A page token, received from a previous `ListNodeTypes` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListNodeTypes` must match the call that provided the page token. - string page_token = 3; - - // A filter expression that matches resources returned in the response. - // The expression must specify the field name, a comparison - // operator, and the value that you want to use for filtering. The value - // must be a string, a number, or a boolean. The comparison operator - // must be `=`, `!=`, `>`, or `<`. - // - // For example, if you are filtering a list of node types, you can - // exclude the ones named `standard-72` by specifying - // `name != "standard-72"`. - // - // To filter on multiple expressions, provide each separate expression within - // parentheses. For example: - // ``` - // (name = "standard-72") - // (virtual_cpu_count > 2) - // ``` - // - // By default, each expression is an `AND` expression. However, you - // can include `AND` and `OR` expressions explicitly. - // For example: - // ``` - // (name = "standard-96") AND - // (virtual_cpu_count > 2) OR - // (name = "standard-72") - // ``` - string filter = 4; -} - -// Response message for -// [VmwareEngine.ListNodeTypes][google.cloud.vmwareengine.v1.VmwareEngine.ListNodeTypes] -message ListNodeTypesResponse { - // A list of Node Types. - repeated NodeType node_types = 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 when making an aggregated query using - // wildcards. - repeated string unreachable = 3; -} - -// Request message for -// [VmwareEngine.GetNodeType][google.cloud.vmwareengine.v1.VmwareEngine.GetNodeType] -message GetNodeTypeRequest { - // Required. The resource name of the node type to retrieve. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/NodeType" - } - ]; -} - -// Request message for -// [VmwareEngine.ShowNsxCredentials][google.cloud.vmwareengine.v1.VmwareEngine.ShowNsxCredentials] -message ShowNsxCredentialsRequest { - // Required. The resource name of the private cloud - // to be queried for credentials. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - string private_cloud = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; -} - -// Request message for -// [VmwareEngine.ShowVcenterCredentials][google.cloud.vmwareengine.v1.VmwareEngine.ShowVcenterCredentials] -message ShowVcenterCredentialsRequest { - // Required. The resource name of the private cloud - // to be queried for credentials. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - string private_cloud = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; -} - -// Request message for -// [VmwareEngine.ResetNsxCredentials][google.cloud.vmwareengine.v1.VmwareEngine.ResetNsxCredentials] -message ResetNsxCredentialsRequest { - // Required. The resource name of the private cloud - // to reset credentials for. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - string private_cloud = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; - - // 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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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 message for -// [VmwareEngine.ResetVcenterCredentials][google.cloud.vmwareengine.v1.VmwareEngine.ResetVcenterCredentials] -message ResetVcenterCredentialsRequest { - // Required. The resource name of the private cloud - // to reset credentials for. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - string private_cloud = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; - - // 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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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]; -} - -// Response message for -// [VmwareEngine.ListHcxActivationKeys][google.cloud.vmwareengine.v1.VmwareEngine.ListHcxActivationKeys] -message ListHcxActivationKeysResponse { - // List of HCX activation keys. - repeated HcxActivationKey hcx_activation_keys = 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 when making an aggregated query using - // wildcards. - repeated string unreachable = 3; -} - -// Request message for -// [VmwareEngine.ListHcxActivationKeys][google.cloud.vmwareengine.v1.VmwareEngine.ListHcxActivationKeys] -message ListHcxActivationKeysRequest { - // Required. The resource name of the private cloud - // to be queried for HCX activation keys. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1/privateClouds/my-cloud` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; - - // The maximum number of HCX activation keys to return in one page. - // The service may return fewer than this value. - // The maximum value is coerced to 1000. - // The default value of this field is 500. - int32 page_size = 2; - - // A page token, received from a previous `ListHcxActivationKeys` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListHcxActivationKeys` must match the call that provided the page - // token. - string page_token = 3; -} - -// Request message for [VmwareEngine.GetHcxActivationKeys][] -message GetHcxActivationKeyRequest { - // Required. The resource name of the HCX activation key to retrieve. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/HcxActivationKey" - } - ]; -} - -// Request message for -// [VmwareEngine.CreateHcxActivationKey][google.cloud.vmwareengine.v1.VmwareEngine.CreateHcxActivationKey] -message CreateHcxActivationKeyRequest { - // Required. The resource name of the private cloud to create the key for. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1/privateClouds/my-cloud` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - } - ]; - - // Required. The initial description of a new HCX activation key. When - // creating a new key, this field must be an empty object. - HcxActivationKey hcx_activation_key = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The user-provided identifier of the `HcxActivationKey` to be - // created. This identifier must be unique among `HcxActivationKey` resources - // within the parent and becomes the final token in the name URI. - // The identifier must meet the following requirements: - // - // * Only contains 1-63 alphanumeric characters and hyphens - // * Begins with an alphabetical character - // * Ends with a non-hyphen character - // * Not formatted as a UUID - // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - // (section 3.5) - string hcx_activation_key_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // 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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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 -// [VmwareEngine.ListNetworkPolicies][google.cloud.vmwareengine.v1.VmwareEngine.ListNetworkPolicies] -message ListNetworkPoliciesRequest { - // Required. The resource name of the location (region) to query for - // network policies. Resource names are schemeless URIs that follow the - // conventions in https://cloud.google.com/apis/design/resource_names. For - // example: `projects/my-project/locations/us-central1` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "vmwareengine.googleapis.com/NetworkPolicy" - } - ]; - - // The maximum number of network policies to return in one page. - // The service may return fewer than this value. - // The maximum value is coerced to 1000. - // The default value of this field is 500. - int32 page_size = 2; - - // A page token, received from a previous `ListNetworkPolicies` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListNetworkPolicies` must match the call that provided the page - // token. - string page_token = 3; - - // A filter expression that matches resources returned in the response. - // The expression must specify the field name, a comparison - // operator, and the value that you want to use for filtering. The value - // must be a string, a number, or a boolean. The comparison operator - // must be `=`, `!=`, `>`, or `<`. - // - // For example, if you are filtering a list of network policies, you can - // exclude the ones named `example-policy` by specifying - // `name != "example-policy"`. - // - // To filter on multiple expressions, provide each separate expression within - // parentheses. For example: - // ``` - // (name = "example-policy") - // (createTime > "2021-04-12T08:15:10.40Z") - // ``` - // - // By default, each expression is an `AND` expression. However, you - // can include `AND` and `OR` expressions explicitly. - // For example: - // ``` - // (name = "example-policy-1") AND - // (createTime > "2021-04-12T08:15:10.40Z") OR - // (name = "example-policy-2") - // ``` - string filter = 4; - - // Sorts list results by a certain order. By default, returned results - // are ordered by `name` in ascending order. - // You can also sort results in descending order based on the `name` value - // using `orderBy="name desc"`. - // Currently, only ordering by `name` is supported. - string order_by = 5; -} - -// Response message for -// [VmwareEngine.ListNetworkPolicies][google.cloud.vmwareengine.v1.VmwareEngine.ListNetworkPolicies] -message ListNetworkPoliciesResponse { - // A list of network policies. - repeated NetworkPolicy network_policies = 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; - - // Locations that could not be reached when making an aggregated query using - // wildcards. - repeated string unreachable = 3; -} - -// Request message for -// [VmwareEngine.GetNetworkPolicy][google.cloud.vmwareengine.v1.VmwareEngine.GetNetworkPolicy] -message GetNetworkPolicyRequest { - // Required. The resource name of the network policy to retrieve. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/NetworkPolicy" - } - ]; -} - -// Request message for -// [VmwareEngine.UpdateNetworkPolicy][google.cloud.vmwareengine.v1.VmwareEngine.UpdateNetworkPolicy] -message UpdateNetworkPolicyRequest { - // Required. Network policy description. - NetworkPolicy network_policy = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Field mask is used to specify the fields to be overwritten in the - // `NetworkPolicy` 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 = 2 - [(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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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 -// [VmwareEngine.CreateNetworkPolicy][google.cloud.vmwareengine.v1.VmwareEngine.CreateNetworkPolicy] -message CreateNetworkPolicyRequest { - // Required. The resource name of the location (region) - // to create the new network policy in. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "vmwareengine.googleapis.com/NetworkPolicy" - } - ]; - - // Required. The user-provided identifier of the network policy to be created. - // This identifier must be unique within parent - // `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes - // the final token in the name URI. - // The identifier must meet the following requirements: - // - // * Only contains 1-63 alphanumeric characters and hyphens - // * Begins with an alphabetical character - // * Ends with a non-hyphen character - // * Not formatted as a UUID - // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - // (section 3.5) - string network_policy_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The network policy configuration to use in the request. - NetworkPolicy network_policy = 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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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 -// [VmwareEngine.DeleteNetworkPolicy][google.cloud.vmwareengine.v1.VmwareEngine.DeleteNetworkPolicy] -message DeleteNetworkPolicyRequest { - // Required. The resource name of the network policy to delete. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/NetworkPolicy" - } - ]; - - // 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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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 message for -// [VmwareEngine.CreateVmwareEngineNetwork][google.cloud.vmwareengine.v1.VmwareEngine.CreateVmwareEngineNetwork] -message CreateVmwareEngineNetworkRequest { - // Required. The resource name of the location to create the new VMware Engine - // network in. A VMware Engine network of type - // `LEGACY` is a regional resource, and a VMware - // Engine network of type `STANDARD` is a global resource. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. For example: - // `projects/my-project/locations/global` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "vmwareengine.googleapis.com/VmwareEngineNetwork" - } - ]; - - // Required. The user-provided identifier of the new VMware Engine network. - // This identifier must be unique among VMware Engine network resources - // within the parent and becomes the final token in the name URI. The - // identifier must meet the following requirements: - // - // * For networks of type LEGACY, adheres to the format: - // `{region-id}-default`. Replace `{region-id}` with the region where you want - // to create the VMware Engine network. For example, "us-central1-default". - // * Only contains 1-63 alphanumeric characters and hyphens - // * Begins with an alphabetical character - // * Ends with a non-hyphen character - // * Not formatted as a UUID - // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - // (section 3.5) - string vmware_engine_network_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The initial description of the new VMware Engine network. - VmwareEngineNetwork vmware_engine_network = 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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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 -// [VmwareEngine.UpdateVmwareEngineNetwork][google.cloud.vmwareengine.v1.VmwareEngine.UpdateVmwareEngineNetwork] -message UpdateVmwareEngineNetworkRequest { - // Required. VMware Engine network description. - VmwareEngineNetwork vmware_engine_network = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Field mask is used to specify the fields to be overwritten in the - // VMware Engine network 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. Only the - // following fields can be updated: `description`. - google.protobuf.FieldMask update_mask = 2 - [(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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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 -// [VmwareEngine.DeleteVmwareEngineNetwork][google.cloud.vmwareengine.v1.VmwareEngine.DeleteVmwareEngineNetwork] -message DeleteVmwareEngineNetworkRequest { - // Required. The resource name of the VMware Engine network to be deleted. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/global/vmwareEngineNetworks/my-network` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/VmwareEngineNetwork" - } - ]; - - // 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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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. Checksum used to ensure that the user-provided value is up to - // date before the server processes the request. The server compares provided - // checksum with the current checksum of the resource. If the user-provided - // value is out of date, this request returns an `ABORTED` error. - string etag = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [VmwareEngine.GetVmwareEngineNetwork][google.cloud.vmwareengine.v1.VmwareEngine.GetVmwareEngineNetwork] -message GetVmwareEngineNetworkRequest { - // Required. The resource name of the VMware Engine network to retrieve. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/global/vmwareEngineNetworks/my-network` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/VmwareEngineNetwork" - } - ]; -} - -// Request message for -// [VmwareEngine.ListVmwareEngineNetworks][google.cloud.vmwareengine.v1.VmwareEngine.ListVmwareEngineNetworks] -message ListVmwareEngineNetworksRequest { - // Required. The resource name of the location to query for - // VMware Engine networks. Resource names are schemeless URIs that follow the - // conventions in https://cloud.google.com/apis/design/resource_names. For - // example: `projects/my-project/locations/global` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of results to return in one page. - // The maximum value is coerced to 1000. - // The default value of this field is 500. - int32 page_size = 2; - - // A page token, received from a previous `ListVmwareEngineNetworks` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListVmwareEngineNetworks` must match the call that provided the page - // token. - string page_token = 3; - - // A filter expression that matches resources returned in the response. - // The expression must specify the field name, a comparison - // operator, and the value that you want to use for filtering. The value - // must be a string, a number, or a boolean. The comparison operator - // must be `=`, `!=`, `>`, or `<`. - // - // For example, if you are filtering a list of network peerings, you can - // exclude the ones named `example-network` by specifying - // `name != "example-network"`. - // - // To filter on multiple expressions, provide each separate expression within - // parentheses. For example: - // ``` - // (name = "example-network") - // (createTime > "2021-04-12T08:15:10.40Z") - // ``` - // - // By default, each expression is an `AND` expression. However, you - // can include `AND` and `OR` expressions explicitly. - // For example: - // ``` - // (name = "example-network-1") AND - // (createTime > "2021-04-12T08:15:10.40Z") OR - // (name = "example-network-2") - // ``` - string filter = 4; - - // Sorts list results by a certain order. By default, returned results - // are ordered by `name` in ascending order. - // You can also sort results in descending order based on the `name` value - // using `orderBy="name desc"`. - // Currently, only ordering by `name` is supported. - string order_by = 5; -} - -// Response message for -// [VmwareEngine.ListVmwareEngineNetworks][google.cloud.vmwareengine.v1.VmwareEngine.ListVmwareEngineNetworks] -message ListVmwareEngineNetworksResponse { - // A list of VMware Engine networks. - repeated VmwareEngineNetwork vmware_engine_networks = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Request message for -// [VmwareEngine.CreatePrivateConnection][google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateConnection] -message CreatePrivateConnectionRequest { - // Required. The resource name of the location to create the new private - // connection in. Private connection is a regional resource. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. For example: - // `projects/my-project/locations/us-central1` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "vmwareengine.googleapis.com/PrivateConnection" - } - ]; - - // Required. The user-provided identifier of the new private connection. - // This identifier must be unique among private connection resources - // within the parent and becomes the final token in the name URI. The - // identifier must meet the following requirements: - // - // * Only contains 1-63 alphanumeric characters and hyphens - // * Begins with an alphabetical character - // * Ends with a non-hyphen character - // * Not formatted as a UUID - // * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - // (section 3.5) - string private_connection_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The initial description of the new private connection. - PrivateConnection private_connection = 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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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 -// [VmwareEngine.GetPrivateConnection][google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateConnection] -message GetPrivateConnectionRequest { - // Required. The resource name of the private connection to retrieve. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1/privateConnections/my-connection` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateConnection" - } - ]; -} - -// Request message for -// [VmwareEngine.ListPrivateConnections][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnections] -message ListPrivateConnectionsRequest { - // Required. The resource name of the location to query for - // private connections. Resource names are schemeless URIs that follow the - // conventions in https://cloud.google.com/apis/design/resource_names. For - // example: `projects/my-project/locations/us-central1` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "vmwareengine.googleapis.com/PrivateConnection" - } - ]; - - // The maximum number of private connections to return in one page. - // The maximum value is coerced to 1000. - // The default value of this field is 500. - int32 page_size = 2; - - // A page token, received from a previous `ListPrivateConnections` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListPrivateConnections` must match the call that provided the page - // token. - string page_token = 3; - - // A filter expression that matches resources returned in the response. - // The expression must specify the field name, a comparison - // operator, and the value that you want to use for filtering. The value - // must be a string, a number, or a boolean. The comparison operator - // must be `=`, `!=`, `>`, or `<`. - // - // For example, if you are filtering a list of private connections, you can - // exclude the ones named `example-connection` by specifying - // `name != "example-connection"`. - // - // To filter on multiple expressions, provide each separate expression within - // parentheses. For example: - // ``` - // (name = "example-connection") - // (createTime > "2022-09-22T08:15:10.40Z") - // ``` - // - // By default, each expression is an `AND` expression. However, you - // can include `AND` and `OR` expressions explicitly. - // For example: - // ``` - // (name = "example-connection-1") AND - // (createTime > "2021-04-12T08:15:10.40Z") OR - // (name = "example-connection-2") - // ``` - string filter = 4; - - // Sorts list results by a certain order. By default, returned results - // are ordered by `name` in ascending order. - // You can also sort results in descending order based on the `name` value - // using `orderBy="name desc"`. - // Currently, only ordering by `name` is supported. - string order_by = 5; -} - -// Response message for -// [VmwareEngine.ListPrivateConnections][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnections] -message ListPrivateConnectionsResponse { - // A list of private connections. - repeated PrivateConnection private_connections = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Request message for -// [VmwareEngine.UpdatePrivateConnection][google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateConnection] -message UpdatePrivateConnectionRequest { - // Required. Private connection description. - PrivateConnection private_connection = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Field mask is used to specify the fields to be overwritten in the - // `PrivateConnection` 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 = 2 - [(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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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 -// [VmwareEngine.DeletePrivateConnection][google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateConnection] -message DeletePrivateConnectionRequest { - // Required. The resource name of the private connection to be deleted. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1/privateConnections/my-connection` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateConnection" - } - ]; - - // 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 guarantees that a - // request doesn't result in creation of duplicate commitments for at least 60 - // minutes. - // - // For example, consider a situation where you 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 message for -// [VmwareEngine.ListPrivateConnectionPeeringRoutes][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnectionPeeringRoutes] -message ListPrivateConnectionPeeringRoutesRequest { - // Required. The resource name of the private connection to retrieve peering - // routes from. Resource names are schemeless URIs that follow the conventions - // in https://cloud.google.com/apis/design/resource_names. For example: - // `projects/my-project/locations/us-west1/privateConnections/my-connection` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/PrivateConnection" - } - ]; - - // The maximum number of peering routes to return in one page. - // The service may return fewer than this value. - // The maximum value is coerced to 1000. - // The default value of this field is 500. - int32 page_size = 2; - - // A page token, received from a previous `ListPrivateConnectionPeeringRoutes` - // call. Provide this to retrieve the subsequent page. When paginating, all - // other parameters provided to `ListPrivateConnectionPeeringRoutes` must - // match the call that provided the page token. - string page_token = 3; -} - -// Response message for -// [VmwareEngine.ListPrivateConnectionPeeringRoutes][google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnectionPeeringRoutes] -message ListPrivateConnectionPeeringRoutesResponse { - // A list of peering routes. - repeated PeeringRoute peering_routes = 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; -} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine_resources.proto b/owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine_resources.proto deleted file mode 100644 index 273a833719e..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/protos/google/cloud/vmwareengine/v1/vmwareengine_resources.proto +++ /dev/null @@ -1,931 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.vmwareengine.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.VmwareEngine.V1"; -option go_package = "cloud.google.com/go/vmwareengine/apiv1/vmwareenginepb;vmwareenginepb"; -option java_multiple_files = true; -option java_outer_classname = "VmwareengineResourcesProto"; -option java_package = "com.google.cloud.vmwareengine.v1"; -option php_namespace = "Google\\Cloud\\VmwareEngine\\V1"; -option ruby_package = "Google::Cloud::VmwareEngine::V1"; - -// Network configuration in the consumer project -// with which the peering has to be done. -message NetworkConfig { - // Required. Management CIDR used by VMware management appliances. - string management_cidr = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The relative resource name of the VMware Engine network attached - // to the private cloud. Specify the name in the following form: - // `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` - // where `{project}` can either be a project number or a project ID. - string vmware_engine_network = 5 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/VmwareEngineNetwork" - } - ]; - - // Output only. The canonical name of the VMware Engine network in the form: - // `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` - string vmware_engine_network_canonical = 6 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/VmwareEngineNetwork" - } - ]; - - // Output only. The IP address layout version of the management IP address - // range. Possible versions include: - // * `managementIpAddressLayoutVersion=1`: Indicates the legacy IP address - // layout used by some existing private clouds. This is no longer supported - // for new private clouds as it does not support all features. - // * `managementIpAddressLayoutVersion=2`: Indicates the latest IP address - // layout used by all newly created private clouds. This version supports all - // current features. - int32 management_ip_address_layout_version = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Information about the type and number of nodes associated with the cluster. -message NodeTypeConfig { - // Required. The number of nodes of this type in the cluster - int32 node_count = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Customized number of cores available to each node of the type. - // This number must always be one of `nodeType.availableCustomCoreCounts`. - // If zero is provided max value from `nodeType.availableCustomCoreCounts` - // will be used. - int32 custom_core_count = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents a private cloud resource. Private clouds are zonal resources. -message PrivateCloud { - option (google.api.resource) = { - type: "vmwareengine.googleapis.com/PrivateCloud" - pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}" - }; - - // Enum State defines possible states of private clouds. - enum State { - // The default value. This value should never be used. - STATE_UNSPECIFIED = 0; - - // The private cloud is ready. - ACTIVE = 1; - - // The private cloud is being created. - CREATING = 2; - - // The private cloud is being updated. - UPDATING = 3; - - // The private cloud is in failed state. - FAILED = 5; - - // The private cloud is scheduled for deletion. The deletion process can be - // cancelled by using the corresponding undelete method. - DELETED = 6; - - // The private cloud is irreversibly deleted and is being removed from the - // system. - PURGING = 7; - } - - // Management cluster configuration. - message ManagementCluster { - // Required. The user-provided identifier of the new `Cluster`. - // The identifier must meet the following requirements: - // - // * Only contains 1-63 alphanumeric characters and hyphens - // * Begins with an alphabetical character - // * Ends with a non-hyphen character - // * Not formatted as a UUID - // * Complies with [RFC - // 1034](https://datatracker.ietf.org/doc/html/rfc1034) (section 3.5) - string cluster_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The map of cluster node types in this cluster, where the key is - // canonical identifier of the node type (corresponds to the `NodeType`). - map node_type_configs = 7 - [(google.api.field_behavior) = REQUIRED]; - } - - // Enum Type defines private cloud type. - enum Type { - // Standard private is a zonal resource, with 3+ nodes. Default type. - STANDARD = 0; - - // Time limited private cloud is a zonal resource, can have only 1 node and - // has limited life span. Will be deleted after defined period of time, - // can be converted into standard private cloud by expanding it up to 3 - // or more nodes. - TIME_LIMITED = 1; - } - - // Output only. The resource name of this private cloud. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Creation time of this resource. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update time of this resource. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when the resource was scheduled for deletion. - google.protobuf.Timestamp delete_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when the resource will be irreversibly deleted. - google.protobuf.Timestamp expire_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. State of the resource. New values may be added to this enum - // when appropriate. - State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Network configuration of the private cloud. - NetworkConfig network_config = 9 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. The management cluster for this private cloud. - // This field is required during creation of the private cloud to provide - // details for the default cluster. - // - // The following fields can't be changed after private cloud creation: - // `ManagementCluster.clusterId`, `ManagementCluster.nodeTypeId`. - ManagementCluster management_cluster = 10 [ - (google.api.field_behavior) = INPUT_ONLY, - (google.api.field_behavior) = REQUIRED - ]; - - // User-provided description for this private cloud. - string description = 11; - - // Output only. HCX appliance. - Hcx hcx = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. NSX appliance. - Nsx nsx = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Vcenter appliance. - Vcenter vcenter = 19 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. System-generated unique identifier for the resource. - string uid = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Type of the private cloud. Defaults to STANDARD. - Type type = 22 [(google.api.field_behavior) = OPTIONAL]; -} - -// A cluster in a private cloud. -message Cluster { - option (google.api.resource) = { - type: "vmwareengine.googleapis.com/Cluster" - pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}" - }; - - // Enum State defines possible states of private cloud clusters. - enum State { - // The default value. This value should never be used. - STATE_UNSPECIFIED = 0; - - // The Cluster is operational and can be used by the user. - ACTIVE = 1; - - // The Cluster is being deployed. - CREATING = 2; - - // Adding or removing of a node to the cluster, any other cluster specific - // updates. - UPDATING = 3; - - // The Cluster is being deleted. - DELETING = 4; - - // The Cluster is undergoing maintenance, for example: a failed node is - // getting replaced. - REPAIRING = 5; - } - - // Output only. The resource name of this cluster. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Creation time of this resource. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update time of this resource. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. State of the resource. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. True if the cluster is a management cluster; false otherwise. - // There can only be one management cluster in a private cloud - // and it has to be the first one. - bool management = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. System-generated unique identifier for the resource. - string uid = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The map of cluster node types in this cluster, where the key is - // canonical identifier of the node type (corresponds to the `NodeType`). - map node_type_configs = 16 - [(google.api.field_behavior) = REQUIRED]; -} - -// Subnet in a private cloud. Either `management` subnets (such as vMotion) that -// are read-only, or `userDefined`, which can also be updated. -message Subnet { - option (google.api.resource) = { - type: "vmwareengine.googleapis.com/Subnet" - pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet}" - }; - - // Defines possible states of subnets. - enum State { - // The default value. This value should never be used. - STATE_UNSPECIFIED = 0; - - // The subnet is ready. - ACTIVE = 1; - - // The subnet is being created. - CREATING = 2; - - // The subnet is being updated. - UPDATING = 3; - - // The subnet is being deleted. - DELETING = 4; - - // Changes requested in the last operation are being propagated. - RECONCILING = 5; - - // Last operation on the subnet did not succeed. Subnet's payload is - // reverted back to its most recent working state. - FAILED = 6; - } - - // Output only. The resource name of this subnet. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The IP address range of the subnet in CIDR format '10.0.0.0/24'. - string ip_cidr_range = 7; - - // The IP address of the gateway of this subnet. - // Must fall within the IP prefix defined above. - string gateway_ip = 8; - - // Output only. The type of the subnet. For example "management" or - // "userDefined". - string type = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The state of the resource. - State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Describes node type. -message NodeType { - option (google.api.resource) = { - type: "vmwareengine.googleapis.com/NodeType" - pattern: "projects/{project}/locations/{location}/nodeTypes/{node_type}" - }; - - // Output only. The resource name of this node type. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The canonical identifier of the node type - // (corresponds to the `NodeType`). For example: standard-72. - string node_type_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The friendly name for this node type. - // For example: ve1-standard-72 - string display_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The total number of virtual CPUs in a single node. - int32 virtual_cpu_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The total number of CPU cores in a single node. - int32 total_core_count = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The amount of physical memory available, defined in GB. - int32 memory_gb = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The amount of storage available, defined in GB. - int32 disk_size_gb = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. List of possible values of custom core count. - repeated int32 available_custom_core_counts = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Credentials for a private cloud. -message Credentials { - // Initial username. - string username = 1; - - // Initial password. - string password = 2; -} - -// HCX activation key. A default key is created during -// private cloud provisioning, but this behavior is subject to change -// and you should always verify active keys. -// Use -// [VmwareEngine.ListHcxActivationKeys][google.cloud.vmwareengine.v1.VmwareEngine.ListHcxActivationKeys] -// to retrieve existing keys and -// [VmwareEngine.CreateHcxActivationKey][google.cloud.vmwareengine.v1.VmwareEngine.CreateHcxActivationKey] -// to create new ones. -message HcxActivationKey { - option (google.api.resource) = { - type: "vmwareengine.googleapis.com/HcxActivationKey" - pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key}" - }; - - // State of HCX activation key - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // State of a newly generated activation key. - AVAILABLE = 1; - - // State of key when it has been used to activate HCX appliance. - CONSUMED = 2; - - // State of key when it is being created. - CREATING = 3; - } - - // Output only. The resource name of this HcxActivationKey. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Creation time of HCX activation key. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. State of HCX activation key. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. HCX activation key. - string activation_key = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. System-generated unique identifier for the resource. - string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Details about a HCX Cloud Manager appliance. -message Hcx { - // State of the appliance - enum State { - // Unspecified appliance state. This is the default value. - STATE_UNSPECIFIED = 0; - - // The appliance is operational and can be used. - ACTIVE = 1; - - // The appliance is being deployed. - CREATING = 2; - } - - // Internal IP address of the appliance. - string internal_ip = 2; - - // Version of the appliance. - string version = 4; - - // Output only. The state of the appliance. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Fully qualified domain name of the appliance. - string fqdn = 6; -} - -// Details about a NSX Manager appliance. -message Nsx { - // State of the appliance - enum State { - // Unspecified appliance state. This is the default value. - STATE_UNSPECIFIED = 0; - - // The appliance is operational and can be used. - ACTIVE = 1; - - // The appliance is being deployed. - CREATING = 2; - } - - // Internal IP address of the appliance. - string internal_ip = 2; - - // Version of the appliance. - string version = 4; - - // Output only. The state of the appliance. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Fully qualified domain name of the appliance. - string fqdn = 6; -} - -// Details about a vCenter Server management appliance. -message Vcenter { - // State of the appliance - enum State { - // Unspecified appliance state. This is the default value. - STATE_UNSPECIFIED = 0; - - // The appliance is operational and can be used. - ACTIVE = 1; - - // The appliance is being deployed. - CREATING = 2; - } - - // Internal IP address of the appliance. - string internal_ip = 2; - - // Version of the appliance. - string version = 4; - - // Output only. The state of the appliance. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Fully qualified domain name of the appliance. - string fqdn = 6; -} - -// Exchanged network peering route. -message PeeringRoute { - // The type of the peering route. - enum Type { - // Unspecified peering route type. This is the default value. - TYPE_UNSPECIFIED = 0; - - // Dynamic routes in the peer network. - DYNAMIC_PEERING_ROUTE = 1; - - // Static routes in the peer network. - STATIC_PEERING_ROUTE = 2; - - // Created, updated, and removed automatically by Google Cloud when subnets - // are created, modified, or deleted in the peer network. - SUBNET_PEERING_ROUTE = 3; - } - - // The direction of the exchanged routes. - enum Direction { - // Unspecified exchanged routes direction. This is default. - DIRECTION_UNSPECIFIED = 0; - - // Routes imported from the peer network. - INCOMING = 1; - - // Routes exported to the peer network. - OUTGOING = 2; - } - - // Output only. Destination range of the peering route in CIDR notation. - string dest_range = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Type of the route in the peer VPC network. - Type type = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Region containing the next hop of the peering route. This - // field only applies to dynamic routes in the peer VPC network. - string next_hop_region = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The priority of the peering route. - int64 priority = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. True if the peering route has been imported from a peered - // VPC network; false otherwise. The import happens if the field - // `NetworkPeering.importCustomRoutes` is true for this network, - // `NetworkPeering.exportCustomRoutes` is true for the peer VPC network, and - // the import does not result in a route conflict. - bool imported = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Direction of the routes exchanged with the peer network, from - // the VMware Engine network perspective: - // - // * Routes of direction `INCOMING` are imported from the peer network. - // * Routes of direction `OUTGOING` are exported from the intranet VPC network - // of the VMware Engine network. - Direction direction = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a network policy resource. Network policies are regional -// resources. You can use a network policy to enable or disable internet access -// and external IP access. Network policies are associated with a VMware Engine -// network, which might span across regions. For a given region, a network -// policy applies to all private clouds in the VMware Engine network associated -// with the policy. -message NetworkPolicy { - option (google.api.resource) = { - type: "vmwareengine.googleapis.com/NetworkPolicy" - pattern: "projects/{project}/locations/{location}/networkPolicies/{network_policy}" - }; - - // Represents a network service that is managed by a `NetworkPolicy` resource. - // A network service provides a way to control an aspect of external access to - // VMware workloads. For example, whether the VMware workloads in the - // private clouds governed by a network policy can access or be accessed from - // the internet. - message NetworkService { - // Enum State defines possible states of a network policy controlled - // service. - enum State { - // Unspecified service state. This is the default value. - STATE_UNSPECIFIED = 0; - - // Service is not provisioned. - UNPROVISIONED = 1; - - // Service is in the process of being provisioned/deprovisioned. - RECONCILING = 2; - - // Service is active. - ACTIVE = 3; - } - - // True if the service is enabled; false otherwise. - bool enabled = 1; - - // Output only. State of the service. New values may be added to this enum - // when appropriate. - State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. The resource name of this network policy. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Creation time of this resource. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update time of this resource. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Network service that allows VMware workloads to access the internet. - NetworkService internet_access = 6; - - // Network service that allows External IP addresses to be assigned to VMware - // workloads. This service can only be enabled when `internet_access` is also - // enabled. - NetworkService external_ip = 7; - - // Required. IP address range in CIDR notation used to create internet access - // and external IP access. An RFC 1918 CIDR block, with a "/26" prefix, is - // required. The range cannot overlap with any prefixes either in the consumer - // VPC network or in use by the private clouds attached to that VPC network. - string edge_services_cidr = 9 [(google.api.field_behavior) = REQUIRED]; - - // Output only. System-generated unique identifier for the resource. - string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The relative resource name of the VMware Engine network. - // Specify the name in the following form: - // `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` - // where `{project}` can either be a project number or a project ID. - string vmware_engine_network = 12 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/VmwareEngineNetwork" - } - ]; - - // Optional. User-provided description for this network policy. - string description = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The canonical name of the VMware Engine network in the form: - // `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` - string vmware_engine_network_canonical = 14 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/VmwareEngineNetwork" - } - ]; -} - -// VMware Engine network resource that provides connectivity for VMware Engine -// private clouds. -message VmwareEngineNetwork { - option (google.api.resource) = { - type: "vmwareengine.googleapis.com/VmwareEngineNetwork" - pattern: "projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network}" - }; - - // Represents a VMware Engine VPC network that is managed by a - // VMware Engine network resource. - message VpcNetwork { - // Enum Type defines possible types of a VMware Engine network controlled - // service. - enum Type { - // The default value. This value should never be used. - TYPE_UNSPECIFIED = 0; - - // VPC network that will be peered with a consumer VPC network or the - // intranet VPC of another VMware Engine network. Access a private cloud - // through Compute Engine VMs on a peered VPC network or an on-premises - // resource connected to a peered consumer VPC network. - INTRANET = 1; - - // VPC network used for internet access to and from a private cloud. - INTERNET = 2; - - // VPC network used for access to Google Cloud services like - // Cloud Storage. - GOOGLE_CLOUD = 3; - } - - // Output only. Type of VPC network (INTRANET, INTERNET, or - // GOOGLE_CLOUD) - Type type = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The relative resource name of the service VPC network this - // VMware Engine network is attached to. For example: - // `projects/123123/global/networks/my-network` - string network = 2 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Network" - } - ]; - } - - // Enum State defines possible states of VMware Engine network. - enum State { - // The default value. This value is used if the state is omitted. - STATE_UNSPECIFIED = 0; - - // The VMware Engine network is being created. - CREATING = 1; - - // The VMware Engine network is ready. - ACTIVE = 2; - - // The VMware Engine network is being updated. - UPDATING = 3; - - // The VMware Engine network is being deleted. - DELETING = 4; - } - - // Enum Type defines possible types of VMware Engine network. - enum Type { - // The default value. This value should never be used. - TYPE_UNSPECIFIED = 0; - - // Network type used by private clouds created in projects without a network - // of type `STANDARD`. This network type is no longer used for new VMware - // Engine private cloud deployments. - LEGACY = 1; - } - - // Output only. The resource name of the VMware Engine network. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/global/vmwareEngineNetworks/my-network` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Creation time of this resource. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update time of this resource. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-provided description for this VMware Engine network. - string description = 5; - - // Output only. VMware Engine service VPC networks that provide connectivity - // from a private cloud to customer projects, the internet, and other Google - // Cloud services. - repeated VpcNetwork vpc_networks = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. State of the VMware Engine network. - State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. VMware Engine network type. - Type type = 8 [(google.api.field_behavior) = REQUIRED]; - - // Output only. System-generated unique identifier for the resource. - string uid = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Checksum that may be sent on update and delete requests to ensure that the - // user-provided value is up to date before the server processes a request. - // The server computes checksums based on the value of other fields in the - // request. - string etag = 10; -} - -// Private connection resource that provides connectivity for VMware Engine -// private clouds. -message PrivateConnection { - option (google.api.resource) = { - type: "vmwareengine.googleapis.com/PrivateConnection" - pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}" - }; - - // Enum State defines possible states of private connection. - enum State { - // The default value. This value is used if the state is omitted. - STATE_UNSPECIFIED = 0; - - // The private connection is being created. - CREATING = 1; - - // The private connection is ready. - ACTIVE = 2; - - // The private connection is being updated. - UPDATING = 3; - - // The private connection is being deleted. - DELETING = 4; - - // The private connection is not provisioned, since no private cloud is - // present for which this private connection is needed. - UNPROVISIONED = 5; - - // The private connection is in failed state. - FAILED = 6; - } - - // Enum Type defines possible types of private connection. - enum Type { - // The default value. This value should never be used. - TYPE_UNSPECIFIED = 0; - - // Connection used for establishing [private services - // access](https://cloud.google.com/vpc/docs/private-services-access). - PRIVATE_SERVICE_ACCESS = 1; - - // Connection used for connecting to NetApp Cloud Volumes. - NETAPP_CLOUD_VOLUMES = 2; - - // Connection used for connecting to Dell PowerScale. - DELL_POWERSCALE = 3; - - // Connection used for connecting to third-party services. - THIRD_PARTY_SERVICE = 4; - } - - // Possible types for RoutingMode - enum RoutingMode { - // The default value. This value should never be used. - ROUTING_MODE_UNSPECIFIED = 0; - - // Global Routing Mode - GLOBAL = 1; - - // Regional Routing Mode - REGIONAL = 2; - } - - // Enum PeeringState defines the possible states of peering between service - // network and the vpc network peered to service network - enum PeeringState { - // The default value. This value is used if the peering state is omitted or - // unknown. - PEERING_STATE_UNSPECIFIED = 0; - - // The peering is in active state. - PEERING_ACTIVE = 1; - - // The peering is in inactive state. - PEERING_INACTIVE = 2; - } - - // Output only. The resource name of the private connection. - // Resource names are schemeless URIs that follow the conventions in - // https://cloud.google.com/apis/design/resource_names. - // For example: - // `projects/my-project/locations/us-central1/privateConnections/my-connection` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Creation time of this resource. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update time of this resource. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. User-provided description for this private connection. - string description = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. State of the private connection. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The relative resource name of Legacy VMware Engine network. - // Specify the name in the following form: - // `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` - // where `{project}`, `{location}` will be same as specified in private - // connection resource name and `{vmware_engine_network_id}` will be in the - // form of `{location}`-default e.g. - // projects/project/locations/us-central1/vmwareEngineNetworks/us-central1-default. - string vmware_engine_network = 8 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/VmwareEngineNetwork" - } - ]; - - // Output only. The canonical name of the VMware Engine network in the form: - // `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` - string vmware_engine_network_canonical = 9 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "vmwareengine.googleapis.com/VmwareEngineNetwork" - } - ]; - - // Required. Private connection type. - Type type = 10 [(google.api.field_behavior) = REQUIRED]; - - // Output only. VPC network peering id between given network VPC and - // VMwareEngineNetwork. - string peering_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Routing Mode. - // Default value is set to GLOBAL. - // For type = PRIVATE_SERVICE_ACCESS, this field can be set to GLOBAL or - // REGIONAL, for other types only GLOBAL is supported. - RoutingMode routing_mode = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. System-generated unique identifier for the resource. - string uid = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Service network to create private connection. - // Specify the name in the following form: - // `projects/{project}/global/networks/{network_id}` - // For type = PRIVATE_SERVICE_ACCESS, this field represents servicenetworking - // VPC, e.g. projects/project-tp/global/networks/servicenetworking. - // For type = NETAPP_CLOUD_VOLUME, this field represents NetApp service VPC, - // e.g. projects/project-tp/global/networks/netapp-tenant-vpc. - // For type = DELL_POWERSCALE, this field represent Dell service VPC, e.g. - // projects/project-tp/global/networks/dell-tenant-vpc. - // For type= THIRD_PARTY_SERVICE, this field could represent a consumer VPC or - // any other producer VPC to which the VMware Engine Network needs to be - // connected, e.g. projects/project/global/networks/vpc. - string service_network = 16 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; - - // Output only. Peering state between service network and VMware Engine - // network. - PeeringState peering_state = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json deleted file mode 100644 index 91cd2c8d4e2..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json +++ /dev/null @@ -1,1863 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-vmwareengine", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.vmwareengine.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListPrivateClouds_async", - "title": "VmwareEngine listPrivateClouds Sample", - "origin": "API_DEFINITION", - "description": " Lists `PrivateCloud` resources in a given project and location.", - "canonical": true, - "file": "vmware_engine.list_private_clouds.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 106, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListPrivateClouds", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateClouds", - "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.vmwareengine.v1.ListPrivateCloudsResponse", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ListPrivateClouds", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateClouds", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetPrivateCloud_async", - "title": "VmwareEngine getPrivateCloud Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a `PrivateCloud` resource by its resource name.", - "canonical": true, - "file": "vmware_engine.get_private_cloud.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPrivateCloud", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateCloud", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.PrivateCloud", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "GetPrivateCloud", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateCloud", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async", - "title": "VmwareEngine createPrivateCloud Sample", - "origin": "API_DEFINITION", - "description": " Creates a new `PrivateCloud` resource in a given project and location. Private clouds can only be created in zones, regional private clouds are not supported. Creating a private cloud also creates a [management cluster](https://cloud.google.com/vmware-engine/docs/concepts-vmware-components) for that private cloud.", - "canonical": true, - "file": "vmware_engine.create_private_cloud.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreatePrivateCloud", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateCloud", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "private_cloud_id", - "type": "TYPE_STRING" - }, - { - "name": "private_cloud", - "type": ".google.cloud.vmwareengine.v1.PrivateCloud" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "CreatePrivateCloud", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateCloud", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async", - "title": "VmwareEngine updatePrivateCloud Sample", - "origin": "API_DEFINITION", - "description": " Modifies a `PrivateCloud` resource. Only the following fields can be updated: `description`. Only fields specified in `updateMask` are applied. During operation processing, the resource is temporarily in the `ACTIVE` state before the operation fully completes. For that period of time, you can't update the resource. Use the operation status to determine when the processing fully completes.", - "canonical": true, - "file": "vmware_engine.update_private_cloud.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdatePrivateCloud", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateCloud", - "async": true, - "parameters": [ - { - "name": "private_cloud", - "type": ".google.cloud.vmwareengine.v1.PrivateCloud" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "UpdatePrivateCloud", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateCloud", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async", - "title": "VmwareEngine deletePrivateCloud Sample", - "origin": "API_DEFINITION", - "description": " Schedules a `PrivateCloud` resource for deletion. A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` set to `DELETED` and `expireTime` set to the time when deletion is final and can no longer be reversed. The delete operation is marked as done as soon as the `PrivateCloud` is successfully scheduled for deletion (this also applies when `delayHours` is set to zero), and the operation is not kept in pending state until `PrivateCloud` is purged. `PrivateCloud` can be restored using `UndeletePrivateCloud` method before the `expireTime` elapses. When `expireTime` is reached, deletion is final and all private cloud resources are irreversibly removed and billing stops. During the final removal process, `PrivateCloud.state` is set to `PURGING`. `PrivateCloud` can be polled using standard `GET` method for the whole period of deletion and purging. It will not be returned only when it is completely purged.", - "canonical": true, - "file": "vmware_engine.delete_private_cloud.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeletePrivateCloud", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateCloud", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - }, - { - "name": "delay_hours", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "DeletePrivateCloud", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateCloud", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async", - "title": "VmwareEngine undeletePrivateCloud Sample", - "origin": "API_DEFINITION", - "description": " Restores a private cloud that was previously scheduled for deletion by `DeletePrivateCloud`. A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` set to `DELETED` and `PrivateCloud.expireTime` set to the time when deletion can no longer be reversed.", - "canonical": true, - "file": "vmware_engine.undelete_private_cloud.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UndeletePrivateCloud", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "UndeletePrivateCloud", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListClusters_async", - "title": "VmwareEngine listClusters Sample", - "origin": "API_DEFINITION", - "description": " Lists `Cluster` resources in a given private cloud.", - "canonical": true, - "file": "vmware_engine.list_clusters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 96, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListClusters", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListClusters", - "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.vmwareengine.v1.ListClustersResponse", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ListClusters", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListClusters", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetCluster_async", - "title": "VmwareEngine getCluster Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a `Cluster` resource by its resource name.", - "canonical": true, - "file": "vmware_engine.get_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCluster", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.Cluster", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "GetCluster", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetCluster", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreateCluster_async", - "title": "VmwareEngine createCluster Sample", - "origin": "API_DEFINITION", - "description": " Creates a new cluster in a given private cloud. Creating a new cluster provides additional nodes for use in the parent private cloud and requires sufficient [node quota](https://cloud.google.com/vmware-engine/quotas).", - "canonical": true, - "file": "vmware_engine.create_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCluster", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateCluster", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "cluster", - "type": ".google.cloud.vmwareengine.v1.Cluster" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "CreateCluster", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateCluster", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async", - "title": "VmwareEngine updateCluster Sample", - "origin": "API_DEFINITION", - "description": " Modifies a `Cluster` resource. Only the following fields can be updated: `node_type_configs.*.node_count`. Only fields specified in `updateMask` are applied. During operation processing, the resource is temporarily in the `ACTIVE` state before the operation fully completes. For that period of time, you can't update the resource. Use the operation status to determine when the processing fully completes.", - "canonical": true, - "file": "vmware_engine.update_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCluster", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateCluster", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "cluster", - "type": ".google.cloud.vmwareengine.v1.Cluster" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "UpdateCluster", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateCluster", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async", - "title": "VmwareEngine deleteCluster Sample", - "origin": "API_DEFINITION", - "description": " Deletes a `Cluster` resource. To avoid unintended data loss, migrate or gracefully shut down any workloads running on the cluster before deletion. You cannot delete the management cluster of a private cloud using this method.", - "canonical": true, - "file": "vmware_engine.delete_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteCluster", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "DeleteCluster", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteCluster", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListSubnets_async", - "title": "VmwareEngine listSubnets Sample", - "origin": "API_DEFINITION", - "description": " Lists subnets in a given private cloud.", - "canonical": true, - "file": "vmware_engine.list_subnets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSubnets", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListSubnets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.ListSubnetsResponse", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ListSubnets", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListSubnets", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetSubnet_async", - "title": "VmwareEngine getSubnet Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single subnet.", - "canonical": true, - "file": "vmware_engine.get_subnet.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSubnet", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetSubnet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.Subnet", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "GetSubnet", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetSubnet", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async", - "title": "VmwareEngine updateSubnet Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a single subnet. Only fields specified in `update_mask` are applied. *Note*: This API is synchronous and always returns a successful `google.longrunning.Operation` (LRO). The returned LRO will only have `done` and `response` fields.", - "canonical": true, - "file": "vmware_engine.update_subnet.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSubnet", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateSubnet", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "subnet", - "type": ".google.cloud.vmwareengine.v1.Subnet" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "UpdateSubnet", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateSubnet", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListNodeTypes_async", - "title": "VmwareEngine listNodeTypes Sample", - "origin": "API_DEFINITION", - "description": " Lists node types", - "canonical": true, - "file": "vmware_engine.list_node_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 98, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNodeTypes", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListNodeTypes", - "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" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.ListNodeTypesResponse", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ListNodeTypes", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListNodeTypes", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetNodeType_async", - "title": "VmwareEngine getNodeType Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single `NodeType`.", - "canonical": true, - "file": "vmware_engine.get_node_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNodeType", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetNodeType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.NodeType", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "GetNodeType", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetNodeType", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ShowNsxCredentials_async", - "title": "VmwareEngine showNsxCredentials Sample", - "origin": "API_DEFINITION", - "description": " Gets details of credentials for NSX appliance.", - "canonical": true, - "file": "vmware_engine.show_nsx_credentials.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ShowNsxCredentials", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ShowNsxCredentials", - "async": true, - "parameters": [ - { - "name": "private_cloud", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.Credentials", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ShowNsxCredentials", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ShowNsxCredentials", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ShowVcenterCredentials_async", - "title": "VmwareEngine showVcenterCredentials Sample", - "origin": "API_DEFINITION", - "description": " Gets details of credentials for Vcenter appliance.", - "canonical": true, - "file": "vmware_engine.show_vcenter_credentials.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ShowVcenterCredentials", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ShowVcenterCredentials", - "async": true, - "parameters": [ - { - "name": "private_cloud", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.Credentials", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ShowVcenterCredentials", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ShowVcenterCredentials", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async", - "title": "VmwareEngine resetNsxCredentials Sample", - "origin": "API_DEFINITION", - "description": " Resets credentials of the NSX appliance.", - "canonical": true, - "file": "vmware_engine.reset_nsx_credentials.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResetNsxCredentials", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ResetNsxCredentials", - "async": true, - "parameters": [ - { - "name": "private_cloud", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ResetNsxCredentials", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ResetNsxCredentials", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async", - "title": "VmwareEngine resetVcenterCredentials Sample", - "origin": "API_DEFINITION", - "description": " Resets credentials of the Vcenter appliance.", - "canonical": true, - "file": "vmware_engine.reset_vcenter_credentials.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResetVcenterCredentials", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ResetVcenterCredentials", - "async": true, - "parameters": [ - { - "name": "private_cloud", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ResetVcenterCredentials", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ResetVcenterCredentials", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async", - "title": "VmwareEngine createHcxActivationKey Sample", - "origin": "API_DEFINITION", - "description": " Creates a new HCX activation key in a given private cloud.", - "canonical": true, - "file": "vmware_engine.create_hcx_activation_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 93, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateHcxActivationKey", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateHcxActivationKey", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "hcx_activation_key", - "type": ".google.cloud.vmwareengine.v1.HcxActivationKey" - }, - { - "name": "hcx_activation_key_id", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "CreateHcxActivationKey", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateHcxActivationKey", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListHcxActivationKeys_async", - "title": "VmwareEngine listHcxActivationKeys Sample", - "origin": "API_DEFINITION", - "description": " Lists `HcxActivationKey` resources in a given private cloud.", - "canonical": true, - "file": "vmware_engine.list_hcx_activation_keys.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListHcxActivationKeys", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListHcxActivationKeys", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.ListHcxActivationKeysResponse", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ListHcxActivationKeys", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListHcxActivationKeys", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetHcxActivationKey_async", - "title": "VmwareEngine getHcxActivationKey Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a `HcxActivationKey` resource by its resource name.", - "canonical": true, - "file": "vmware_engine.get_hcx_activation_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetHcxActivationKey", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetHcxActivationKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.HcxActivationKey", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "GetHcxActivationKey", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetHcxActivationKey", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetNetworkPolicy_async", - "title": "VmwareEngine getNetworkPolicy Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a `NetworkPolicy` resource by its resource name.", - "canonical": true, - "file": "vmware_engine.get_network_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNetworkPolicy", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetNetworkPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.NetworkPolicy", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "GetNetworkPolicy", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetNetworkPolicy", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListNetworkPolicies_async", - "title": "VmwareEngine listNetworkPolicies Sample", - "origin": "API_DEFINITION", - "description": " Lists `NetworkPolicy` resources in a specified project and location.", - "canonical": true, - "file": "vmware_engine.list_network_policies.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 106, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNetworkPolicies", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListNetworkPolicies", - "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.vmwareengine.v1.ListNetworkPoliciesResponse", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ListNetworkPolicies", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListNetworkPolicies", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async", - "title": "VmwareEngine createNetworkPolicy Sample", - "origin": "API_DEFINITION", - "description": " Creates a new network policy in a given VMware Engine network of a project and location (region). A new network policy cannot be created if another network policy already exists in the same scope.", - "canonical": true, - "file": "vmware_engine.create_network_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 94, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNetworkPolicy", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateNetworkPolicy", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "network_policy_id", - "type": "TYPE_STRING" - }, - { - "name": "network_policy", - "type": ".google.cloud.vmwareengine.v1.NetworkPolicy" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "CreateNetworkPolicy", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateNetworkPolicy", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async", - "title": "VmwareEngine updateNetworkPolicy Sample", - "origin": "API_DEFINITION", - "description": " Modifies a `NetworkPolicy` resource. Only the following fields can be updated: `internet_access`, `external_ip`, `edge_services_cidr`. Only fields specified in `updateMask` are applied. When updating a network policy, the external IP network service can only be disabled if there are no external IP addresses present in the scope of the policy. Also, a `NetworkService` cannot be updated when `NetworkService.state` is set to `RECONCILING`. During operation processing, the resource is temporarily in the `ACTIVE` state before the operation fully completes. For that period of time, you can't update the resource. Use the operation status to determine when the processing fully completes.", - "canonical": true, - "file": "vmware_engine.update_network_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNetworkPolicy", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateNetworkPolicy", - "async": true, - "parameters": [ - { - "name": "network_policy", - "type": ".google.cloud.vmwareengine.v1.NetworkPolicy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "UpdateNetworkPolicy", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateNetworkPolicy", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async", - "title": "VmwareEngine deleteNetworkPolicy Sample", - "origin": "API_DEFINITION", - "description": " Deletes a `NetworkPolicy` resource. A network policy cannot be deleted when `NetworkService.state` is set to `RECONCILING` for either its external IP or internet access service.", - "canonical": true, - "file": "vmware_engine.delete_network_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNetworkPolicy", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteNetworkPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "DeleteNetworkPolicy", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteNetworkPolicy", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async", - "title": "VmwareEngine createVmwareEngineNetwork Sample", - "origin": "API_DEFINITION", - "description": " Creates a new VMware Engine network that can be used by a private cloud.", - "canonical": true, - "file": "vmware_engine.create_vmware_engine_network.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 97, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateVmwareEngineNetwork", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateVmwareEngineNetwork", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "vmware_engine_network_id", - "type": "TYPE_STRING" - }, - { - "name": "vmware_engine_network", - "type": ".google.cloud.vmwareengine.v1.VmwareEngineNetwork" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "CreateVmwareEngineNetwork", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreateVmwareEngineNetwork", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async", - "title": "VmwareEngine updateVmwareEngineNetwork Sample", - "origin": "API_DEFINITION", - "description": " Modifies a VMware Engine network resource. Only the following fields can be updated: `description`. Only fields specified in `updateMask` are applied.", - "canonical": true, - "file": "vmware_engine.update_vmware_engine_network.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateVmwareEngineNetwork", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateVmwareEngineNetwork", - "async": true, - "parameters": [ - { - "name": "vmware_engine_network", - "type": ".google.cloud.vmwareengine.v1.VmwareEngineNetwork" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "UpdateVmwareEngineNetwork", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdateVmwareEngineNetwork", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async", - "title": "VmwareEngine deleteVmwareEngineNetwork Sample", - "origin": "API_DEFINITION", - "description": " Deletes a `VmwareEngineNetwork` resource. You can only delete a VMware Engine network after all resources that refer to it are deleted. For example, a private cloud, a network peering, and a network policy can all refer to the same VMware Engine network.", - "canonical": true, - "file": "vmware_engine.delete_vmware_engine_network.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteVmwareEngineNetwork", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteVmwareEngineNetwork", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "DeleteVmwareEngineNetwork", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeleteVmwareEngineNetwork", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetVmwareEngineNetwork_async", - "title": "VmwareEngine getVmwareEngineNetwork Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a `VmwareEngineNetwork` resource by its resource name. The resource contains details of the VMware Engine network, such as its VMware Engine network type, peered networks in a service project, and state (for example, `CREATING`, `ACTIVE`, `DELETING`).", - "canonical": true, - "file": "vmware_engine.get_vmware_engine_network.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetVmwareEngineNetwork", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetVmwareEngineNetwork", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.VmwareEngineNetwork", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "GetVmwareEngineNetwork", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetVmwareEngineNetwork", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListVmwareEngineNetworks_async", - "title": "VmwareEngine listVmwareEngineNetworks Sample", - "origin": "API_DEFINITION", - "description": " Lists `VmwareEngineNetwork` resources in a given project and location.", - "canonical": true, - "file": "vmware_engine.list_vmware_engine_networks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 105, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListVmwareEngineNetworks", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListVmwareEngineNetworks", - "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.vmwareengine.v1.ListVmwareEngineNetworksResponse", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ListVmwareEngineNetworks", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListVmwareEngineNetworks", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async", - "title": "VmwareEngine createPrivateConnection Sample", - "origin": "API_DEFINITION", - "description": " Creates a new private connection that can be used for accessing private Clouds.", - "canonical": true, - "file": "vmware_engine.create_private_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 92, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreatePrivateConnection", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateConnection", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "private_connection_id", - "type": "TYPE_STRING" - }, - { - "name": "private_connection", - "type": ".google.cloud.vmwareengine.v1.PrivateConnection" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "CreatePrivateConnection", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.CreatePrivateConnection", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_GetPrivateConnection_async", - "title": "VmwareEngine getPrivateConnection Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a `PrivateConnection` resource by its resource name. The resource contains details of the private connection, such as connected network, routing mode and state.", - "canonical": true, - "file": "vmware_engine.get_private_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPrivateConnection", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateConnection", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.PrivateConnection", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "GetPrivateConnection", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.GetPrivateConnection", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListPrivateConnections_async", - "title": "VmwareEngine listPrivateConnections Sample", - "origin": "API_DEFINITION", - "description": " Lists `PrivateConnection` resources in a given project and location.", - "canonical": true, - "file": "vmware_engine.list_private_connections.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 105, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListPrivateConnections", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnections", - "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.vmwareengine.v1.ListPrivateConnectionsResponse", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ListPrivateConnections", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnections", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async", - "title": "VmwareEngine updatePrivateConnection Sample", - "origin": "API_DEFINITION", - "description": " Modifies a `PrivateConnection` resource. Only `description` and `routing_mode` fields can be updated. Only fields specified in `updateMask` are applied.", - "canonical": true, - "file": "vmware_engine.update_private_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdatePrivateConnection", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateConnection", - "async": true, - "parameters": [ - { - "name": "private_connection", - "type": ".google.cloud.vmwareengine.v1.PrivateConnection" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "UpdatePrivateConnection", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.UpdatePrivateConnection", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async", - "title": "VmwareEngine deletePrivateConnection Sample", - "origin": "API_DEFINITION", - "description": " Deletes a `PrivateConnection` resource. When a private connection is deleted for a VMware Engine network, the connected network becomes inaccessible to that VMware Engine network.", - "canonical": true, - "file": "vmware_engine.delete_private_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeletePrivateConnection", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateConnection", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "DeletePrivateConnection", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.DeletePrivateConnection", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - }, - { - "regionTag": "vmwareengine_v1_generated_VmwareEngine_ListPrivateConnectionPeeringRoutes_async", - "title": "VmwareEngine listPrivateConnectionPeeringRoutes Sample", - "origin": "API_DEFINITION", - "description": " Lists the private connection routes exchanged over a peering connection.", - "canonical": true, - "file": "vmware_engine.list_private_connection_peering_routes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListPrivateConnectionPeeringRoutes", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnectionPeeringRoutes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesResponse", - "client": { - "shortName": "VmwareEngineClient", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngineClient" - }, - "method": { - "shortName": "ListPrivateConnectionPeeringRoutes", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine.ListPrivateConnectionPeeringRoutes", - "service": { - "shortName": "VmwareEngine", - "fullName": "google.cloud.vmwareengine.v1.VmwareEngine" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_cluster.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_cluster.js deleted file mode 100644 index fdb7708f2ca..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_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(parent, clusterId, cluster) { - // [START vmwareengine_v1_generated_VmwareEngine_CreateCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud to create a new cluster - * in. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - */ - // const parent = 'abc123' - /** - * Required. The user-provided identifier of the new `Cluster`. - * This identifier must be unique among clusters within the parent and becomes - * the final token in the name URI. - * The identifier must meet the following requirements: - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - */ - // const clusterId = 'abc123' - /** - * Required. The initial description of the new cluster. - */ - // const cluster = {} - /** - * Optional. 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. True if you want the request to be validated and not executed; - * false otherwise. - */ - // const validateOnly = true - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callCreateCluster() { - // Construct request - const request = { - parent, - clusterId, - cluster, - }; - - // Run request - const [operation] = await vmwareengineClient.createCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateCluster(); - // [END vmwareengine_v1_generated_VmwareEngine_CreateCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_hcx_activation_key.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_hcx_activation_key.js deleted file mode 100644 index 764dd4ab4ab..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_hcx_activation_key.js +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, hcxActivationKey, hcxActivationKeyId) { - // [START vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud to create the key for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - */ - // const parent = 'abc123' - /** - * Required. The initial description of a new HCX activation key. When - * creating a new key, this field must be an empty object. - */ - // const hcxActivationKey = {} - /** - * Required. The user-provided identifier of the `HcxActivationKey` to be - * created. This identifier must be unique among `HcxActivationKey` resources - * within the parent and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - */ - // const hcxActivationKeyId = 'abc123' - /** - * 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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callCreateHcxActivationKey() { - // Construct request - const request = { - parent, - hcxActivationKey, - hcxActivationKeyId, - }; - - // Run request - const [operation] = await vmwareengineClient.createHcxActivationKey(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateHcxActivationKey(); - // [END vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_network_policy.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_network_policy.js deleted file mode 100644 index fd9792850ce..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_network_policy.js +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, networkPolicyId, networkPolicy) { - // [START vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 (region) - * to create the new network policy in. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1` - */ - // const parent = 'abc123' - /** - * Required. The user-provided identifier of the network policy to be created. - * This identifier must be unique within parent - * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes - * the final token in the name URI. - * The identifier must meet the following requirements: - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - */ - // const networkPolicyId = 'abc123' - /** - * Required. The network policy configuration to use in the request. - */ - // const networkPolicy = {} - /** - * 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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callCreateNetworkPolicy() { - // Construct request - const request = { - parent, - networkPolicyId, - networkPolicy, - }; - - // Run request - const [operation] = await vmwareengineClient.createNetworkPolicy(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateNetworkPolicy(); - // [END vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_cloud.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_cloud.js deleted file mode 100644 index 77d7eea4e0f..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_cloud.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, privateCloudId, privateCloud) { - // [START vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 to create the new - * private cloud in. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - */ - // const parent = 'abc123' - /** - * Required. The user-provided identifier of the private cloud to be created. - * This identifier must be unique among each `PrivateCloud` within the parent - * and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - */ - // const privateCloudId = 'abc123' - /** - * Required. The initial description of the new private cloud. - */ - // const privateCloud = {} - /** - * Optional. 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. True if you want the request to be validated and not executed; - * false otherwise. - */ - // const validateOnly = true - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callCreatePrivateCloud() { - // Construct request - const request = { - parent, - privateCloudId, - privateCloud, - }; - - // Run request - const [operation] = await vmwareengineClient.createPrivateCloud(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreatePrivateCloud(); - // [END vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_connection.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_connection.js deleted file mode 100644 index 03084fd79cf..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_private_connection.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(parent, privateConnectionId, privateConnection) { - // [START vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 to create the new private - * connection in. Private connection is a regional resource. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-central1` - */ - // const parent = 'abc123' - /** - * Required. The user-provided identifier of the new private connection. - * This identifier must be unique among private connection resources - * within the parent and becomes the final token in the name URI. The - * identifier must meet the following requirements: - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - */ - // const privateConnectionId = 'abc123' - /** - * Required. The initial description of the new private connection. - */ - // const privateConnection = {} - /** - * 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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callCreatePrivateConnection() { - // Construct request - const request = { - parent, - privateConnectionId, - privateConnection, - }; - - // Run request - const [operation] = await vmwareengineClient.createPrivateConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreatePrivateConnection(); - // [END vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_vmware_engine_network.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_vmware_engine_network.js deleted file mode 100644 index 53977beabaa..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.create_vmware_engine_network.js +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, vmwareEngineNetworkId, vmwareEngineNetwork) { - // [START vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 to create the new VMware Engine - * network in. A VMware Engine network of type - * `LEGACY` is a regional resource, and a VMware - * Engine network of type `STANDARD` is a global resource. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global` - */ - // const parent = 'abc123' - /** - * Required. The user-provided identifier of the new VMware Engine network. - * This identifier must be unique among VMware Engine network resources - * within the parent and becomes the final token in the name URI. The - * identifier must meet the following requirements: - * * For networks of type LEGACY, adheres to the format: - * `{region-id}-default`. Replace `{region-id}` with the region where you want - * to create the VMware Engine network. For example, "us-central1-default". - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with RFC 1034 (https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - */ - // const vmwareEngineNetworkId = 'abc123' - /** - * Required. The initial description of the new VMware Engine network. - */ - // const vmwareEngineNetwork = {} - /** - * 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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callCreateVmwareEngineNetwork() { - // Construct request - const request = { - parent, - vmwareEngineNetworkId, - vmwareEngineNetwork, - }; - - // Run request - const [operation] = await vmwareengineClient.createVmwareEngineNetwork(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateVmwareEngineNetwork(); - // [END vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_cluster.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_cluster.js deleted file mode 100644 index cb5a2264cdc..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_cluster.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(name) { - // [START vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 cluster to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - */ - // const name = 'abc123' - /** - * Optional. 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callDeleteCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await vmwareengineClient.deleteCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteCluster(); - // [END vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_network_policy.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_network_policy.js deleted file mode 100644 index a284bda09b5..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_network_policy.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(name) { - // [START vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 network policy to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` - */ - // 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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callDeleteNetworkPolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await vmwareengineClient.deleteNetworkPolicy(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteNetworkPolicy(); - // [END vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_cloud.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_cloud.js deleted file mode 100644 index 742532dfe62..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_cloud.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(name) { - // [START vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - */ - // const name = 'abc123' - /** - * Optional. 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, cascade delete is enabled and all children of - * this private cloud resource are also deleted. When this flag is set to - * false, the private cloud will not be deleted if there are any children - * other than the management cluster. The management cluster is always - * deleted. - */ - // const force = true - /** - * Optional. Time delay of the deletion specified in hours. The default value - * is `3`. Specifying a non-zero value for this field changes the value of - * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned - * deletion time. Deletion can be cancelled before `expire_time` elapses using - * VmwareEngine.UndeletePrivateCloud google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud. - * Specifying a value of `0` for this field instead begins the deletion - * process and ceases billing immediately. During the final deletion process, - * the value of `PrivateCloud.state` becomes `PURGING`. - */ - // const delayHours = 1234 - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callDeletePrivateCloud() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await vmwareengineClient.deletePrivateCloud(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeletePrivateCloud(); - // [END vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_connection.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_connection.js deleted file mode 100644 index f382c3bb5a6..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_private_connection.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(name) { - // [START vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private connection to be deleted. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateConnections/my-connection` - */ - // 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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callDeletePrivateConnection() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await vmwareengineClient.deletePrivateConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeletePrivateConnection(); - // [END vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_vmware_engine_network.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_vmware_engine_network.js deleted file mode 100644 index 29d1d3eace4..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.delete_vmware_engine_network.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 vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 VMware Engine network to be deleted. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` - */ - // 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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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. Checksum used to ensure that the user-provided value is up to - * date before the server processes the request. The server compares provided - * checksum with the current checksum of the resource. If the user-provided - * value is out of date, this request returns an `ABORTED` error. - */ - // const etag = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callDeleteVmwareEngineNetwork() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await vmwareengineClient.deleteVmwareEngineNetwork(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteVmwareEngineNetwork(); - // [END vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_cluster.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_cluster.js deleted file mode 100644 index 5706ac8001e..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_cluster.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 vmwareengine_v1_generated_VmwareEngine_GetCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The cluster resource name to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - */ - // const name = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callGetCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await vmwareengineClient.getCluster(request); - console.log(response); - } - - callGetCluster(); - // [END vmwareengine_v1_generated_VmwareEngine_GetCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_hcx_activation_key.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_hcx_activation_key.js deleted file mode 100644 index a8e524ac7e2..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_hcx_activation_key.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 vmwareengine_v1_generated_VmwareEngine_GetHcxActivationKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 HCX activation key to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` - */ - // const name = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callGetHcxActivationKey() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await vmwareengineClient.getHcxActivationKey(request); - console.log(response); - } - - callGetHcxActivationKey(); - // [END vmwareengine_v1_generated_VmwareEngine_GetHcxActivationKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_network_policy.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_network_policy.js deleted file mode 100644 index 06b3cf69916..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_network_policy.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 vmwareengine_v1_generated_VmwareEngine_GetNetworkPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 network policy to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` - */ - // const name = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callGetNetworkPolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await vmwareengineClient.getNetworkPolicy(request); - console.log(response); - } - - callGetNetworkPolicy(); - // [END vmwareengine_v1_generated_VmwareEngine_GetNetworkPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_node_type.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_node_type.js deleted file mode 100644 index dcd807ebcbd..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_node_type.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 vmwareengine_v1_generated_VmwareEngine_GetNodeType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 node type to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` - */ - // const name = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callGetNodeType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await vmwareengineClient.getNodeType(request); - console.log(response); - } - - callGetNodeType(); - // [END vmwareengine_v1_generated_VmwareEngine_GetNodeType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_cloud.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_cloud.js deleted file mode 100644 index 884fbc8e66f..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_cloud.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 vmwareengine_v1_generated_VmwareEngine_GetPrivateCloud_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - */ - // const name = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callGetPrivateCloud() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await vmwareengineClient.getPrivateCloud(request); - console.log(response); - } - - callGetPrivateCloud(); - // [END vmwareengine_v1_generated_VmwareEngine_GetPrivateCloud_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_connection.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_connection.js deleted file mode 100644 index 1b9a8f615d9..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_private_connection.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 vmwareengine_v1_generated_VmwareEngine_GetPrivateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private connection to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateConnections/my-connection` - */ - // const name = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callGetPrivateConnection() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await vmwareengineClient.getPrivateConnection(request); - console.log(response); - } - - callGetPrivateConnection(); - // [END vmwareengine_v1_generated_VmwareEngine_GetPrivateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_subnet.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_subnet.js deleted file mode 100644 index 31e78f12553..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_subnet.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 vmwareengine_v1_generated_VmwareEngine_GetSubnet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 subnet to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` - */ - // const name = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callGetSubnet() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await vmwareengineClient.getSubnet(request); - console.log(response); - } - - callGetSubnet(); - // [END vmwareengine_v1_generated_VmwareEngine_GetSubnet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_vmware_engine_network.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_vmware_engine_network.js deleted file mode 100644 index 87517b5d900..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.get_vmware_engine_network.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 vmwareengine_v1_generated_VmwareEngine_GetVmwareEngineNetwork_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 VMware Engine network to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` - */ - // const name = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callGetVmwareEngineNetwork() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await vmwareengineClient.getVmwareEngineNetwork(request); - console.log(response); - } - - callGetVmwareEngineNetwork(); - // [END vmwareengine_v1_generated_VmwareEngine_GetVmwareEngineNetwork_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_clusters.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_clusters.js deleted file mode 100644 index 3964f8ef84f..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_clusters.js +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListClusters_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud to query for clusters. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - */ - // const parent = 'abc123' - /** - * The maximum number of clusters to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListClusters` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListClusters` - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-cluster") - * (nodeCount = "3") - * ``` - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "example-cluster-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-cluster-2") - * ``` - */ - // const filter = 'abc123' - /** - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - */ - // const orderBy = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callListClusters() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await vmwareengineClient.listClustersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListClusters(); - // [END vmwareengine_v1_generated_VmwareEngine_ListClusters_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_hcx_activation_keys.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_hcx_activation_keys.js deleted file mode 100644 index 50aa1252a10..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_hcx_activation_keys.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 vmwareengine_v1_generated_VmwareEngine_ListHcxActivationKeys_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud - * to be queried for HCX activation keys. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - */ - // const parent = 'abc123' - /** - * The maximum number of HCX activation keys to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListHcxActivationKeys` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListHcxActivationKeys` must match the call that provided the page - * token. - */ - // const pageToken = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callListHcxActivationKeys() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await vmwareengineClient.listHcxActivationKeysAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListHcxActivationKeys(); - // [END vmwareengine_v1_generated_VmwareEngine_ListHcxActivationKeys_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_network_policies.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_network_policies.js deleted file mode 100644 index 680d90a215b..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_network_policies.js +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListNetworkPolicies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 (region) to query for - * network policies. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - */ - // const parent = 'abc123' - /** - * The maximum number of network policies to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListNetworkPolicies` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListNetworkPolicies` must match the call that provided the page - * token. - */ - // const pageToken = 'abc123' - /** - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * For example, if you are filtering a list of network policies, you can - * exclude the ones named `example-policy` by specifying - * `name != "example-policy"`. - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-policy") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-policy-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-policy-2") - * ``` - */ - // const filter = 'abc123' - /** - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - */ - // const orderBy = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callListNetworkPolicies() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await vmwareengineClient.listNetworkPoliciesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNetworkPolicies(); - // [END vmwareengine_v1_generated_VmwareEngine_ListNetworkPolicies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_node_types.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_node_types.js deleted file mode 100644 index e3433877c06..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_node_types.js +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListNodeTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 to be queried for node types. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - */ - // const parent = 'abc123' - /** - * The maximum number of node types to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListNodeTypes` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListNodeTypes` must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * For example, if you are filtering a list of node types, you can - * exclude the ones named `standard-72` by specifying - * `name != "standard-72"`. - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "standard-72") - * (virtual_cpu_count > 2) - * ``` - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "standard-96") AND - * (virtual_cpu_count > 2) OR - * (name = "standard-72") - * ``` - */ - // const filter = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callListNodeTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await vmwareengineClient.listNodeTypesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNodeTypes(); - // [END vmwareengine_v1_generated_VmwareEngine_ListNodeTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_clouds.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_clouds.js deleted file mode 100644 index a4a40e6a293..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_clouds.js +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListPrivateClouds_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud to be queried for - * clusters. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - */ - // const parent = 'abc123' - /** - * The maximum number of private clouds to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListPrivateClouds` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListPrivateClouds` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison operator, and the - * value that you want to use for filtering. The value must be a string, a - * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or - * `<`. - * For example, if you are filtering a list of private clouds, you can exclude - * the ones named `example-pc` by specifying `name != "example-pc"`. - * You can also filter nested fields. For example, you could specify - * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds - * only if they have a matching address in their network configuration. - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-pc") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "private-cloud-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "private-cloud-2") - * ``` - */ - // const filter = 'abc123' - /** - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - */ - // const orderBy = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callListPrivateClouds() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await vmwareengineClient.listPrivateCloudsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListPrivateClouds(); - // [END vmwareengine_v1_generated_VmwareEngine_ListPrivateClouds_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connection_peering_routes.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connection_peering_routes.js deleted file mode 100644 index a4b7bf2779c..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connection_peering_routes.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 vmwareengine_v1_generated_VmwareEngine_ListPrivateConnectionPeeringRoutes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private connection to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-west1/privateConnections/my-connection` - */ - // const parent = 'abc123' - /** - * The maximum number of peering routes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListPrivateConnectionPeeringRoutes` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callListPrivateConnectionPeeringRoutes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await vmwareengineClient.listPrivateConnectionPeeringRoutesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListPrivateConnectionPeeringRoutes(); - // [END vmwareengine_v1_generated_VmwareEngine_ListPrivateConnectionPeeringRoutes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connections.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connections.js deleted file mode 100644 index 75381fad0aa..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_private_connections.js +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListPrivateConnections_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 to query for - * private connections. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - */ - // const parent = 'abc123' - /** - * The maximum number of private connections to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - */ - // const pageToken = 'abc123' - /** - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * For example, if you are filtering a list of private connections, you can - * exclude the ones named `example-connection` by specifying - * `name != "example-connection"`. - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-connection") - * (createTime > "2022-09-22T08:15:10.40Z") - * ``` - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-connection-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-connection-2") - * ``` - */ - // const filter = 'abc123' - /** - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - */ - // const orderBy = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callListPrivateConnections() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await vmwareengineClient.listPrivateConnectionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListPrivateConnections(); - // [END vmwareengine_v1_generated_VmwareEngine_ListPrivateConnections_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_subnets.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_subnets.js deleted file mode 100644 index 4c0f173dfcb..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_subnets.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 vmwareengine_v1_generated_VmwareEngine_ListSubnets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud to be queried for - * subnets. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - */ - // const parent = 'abc123' - /** - * The maximum number of subnets to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListSubnetsRequest` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListSubnetsRequest` must match the call that provided the page token. - */ - // const pageToken = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callListSubnets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await vmwareengineClient.listSubnetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSubnets(); - // [END vmwareengine_v1_generated_VmwareEngine_ListSubnets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_vmware_engine_networks.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_vmware_engine_networks.js deleted file mode 100644 index 4629b490ec6..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.list_vmware_engine_networks.js +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated 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 vmwareengine_v1_generated_VmwareEngine_ListVmwareEngineNetworks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 to query for - * VMware Engine networks. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - */ - // const parent = 'abc123' - /** - * The maximum number of results to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListVmwareEngineNetworks` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListVmwareEngineNetworks` must match the call that provided the page - * token. - */ - // const pageToken = 'abc123' - /** - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-network` by specifying - * `name != "example-network"`. - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-network") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-network-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-network-2") - * ``` - */ - // const filter = 'abc123' - /** - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - */ - // const orderBy = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callListVmwareEngineNetworks() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await vmwareengineClient.listVmwareEngineNetworksAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListVmwareEngineNetworks(); - // [END vmwareengine_v1_generated_VmwareEngine_ListVmwareEngineNetworks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_nsx_credentials.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_nsx_credentials.js deleted file mode 100644 index 0b8500bbf4b..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_nsx_credentials.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(privateCloud) { - // [START vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud - * to reset credentials for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - */ - // const privateCloud = '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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callResetNsxCredentials() { - // Construct request - const request = { - privateCloud, - }; - - // Run request - const [operation] = await vmwareengineClient.resetNsxCredentials(request); - const [response] = await operation.promise(); - console.log(response); - } - - callResetNsxCredentials(); - // [END vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_vcenter_credentials.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_vcenter_credentials.js deleted file mode 100644 index 458b41f086d..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.reset_vcenter_credentials.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(privateCloud) { - // [START vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud - * to reset credentials for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - */ - // const privateCloud = '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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callResetVcenterCredentials() { - // Construct request - const request = { - privateCloud, - }; - - // Run request - const [operation] = await vmwareengineClient.resetVcenterCredentials(request); - const [response] = await operation.promise(); - console.log(response); - } - - callResetVcenterCredentials(); - // [END vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_nsx_credentials.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_nsx_credentials.js deleted file mode 100644 index 300ee77edfb..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_nsx_credentials.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(privateCloud) { - // [START vmwareengine_v1_generated_VmwareEngine_ShowNsxCredentials_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud - * to be queried for credentials. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - */ - // const privateCloud = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callShowNsxCredentials() { - // Construct request - const request = { - privateCloud, - }; - - // Run request - const response = await vmwareengineClient.showNsxCredentials(request); - console.log(response); - } - - callShowNsxCredentials(); - // [END vmwareengine_v1_generated_VmwareEngine_ShowNsxCredentials_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_vcenter_credentials.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_vcenter_credentials.js deleted file mode 100644 index 3e437a96d07..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.show_vcenter_credentials.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(privateCloud) { - // [START vmwareengine_v1_generated_VmwareEngine_ShowVcenterCredentials_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud - * to be queried for credentials. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - */ - // const privateCloud = 'abc123' - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callShowVcenterCredentials() { - // Construct request - const request = { - privateCloud, - }; - - // Run request - const response = await vmwareengineClient.showVcenterCredentials(request); - console.log(response); - } - - callShowVcenterCredentials(); - // [END vmwareengine_v1_generated_VmwareEngine_ShowVcenterCredentials_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.undelete_private_cloud.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.undelete_private_cloud.js deleted file mode 100644 index 53a99168aa4..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.undelete_private_cloud.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(name) { - // [START vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 private cloud scheduled for deletion. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - */ - // const name = 'abc123' - /** - * Optional. 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callUndeletePrivateCloud() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await vmwareengineClient.undeletePrivateCloud(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUndeletePrivateCloud(); - // [END vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_cluster.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_cluster.js deleted file mode 100644 index 001367822f4..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_cluster.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(updateMask, cluster) { - // [START vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 - * `Cluster` resource by the update. The fields specified in the `updateMask` - * 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 description of the cluster. - */ - // const cluster = {} - /** - * Optional. 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. True if you want the request to be validated and not executed; - * false otherwise. - */ - // const validateOnly = true - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callUpdateCluster() { - // Construct request - const request = { - updateMask, - cluster, - }; - - // Run request - const [operation] = await vmwareengineClient.updateCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateCluster(); - // [END vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_network_policy.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_network_policy.js deleted file mode 100644 index caddb9be46a..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_network_policy.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(networkPolicy, updateMask) { - // [START vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Network policy description. - */ - // const networkPolicy = {} - /** - * Required. Field mask is used to specify the fields to be overwritten in the - * `NetworkPolicy` 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 = {} - /** - * 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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callUpdateNetworkPolicy() { - // Construct request - const request = { - networkPolicy, - updateMask, - }; - - // Run request - const [operation] = await vmwareengineClient.updateNetworkPolicy(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateNetworkPolicy(); - // [END vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_cloud.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_cloud.js deleted file mode 100644 index 2eb6ba953ac..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_cloud.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(privateCloud, updateMask) { - // [START vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Private cloud description. - */ - // const privateCloud = {} - /** - * Required. Field mask is used to specify the fields to be overwritten in the - * `PrivateCloud` resource by the update. The fields specified in `updateMask` - * 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 = {} - /** - * Optional. 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callUpdatePrivateCloud() { - // Construct request - const request = { - privateCloud, - updateMask, - }; - - // Run request - const [operation] = await vmwareengineClient.updatePrivateCloud(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdatePrivateCloud(); - // [END vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_connection.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_connection.js deleted file mode 100644 index a77762077f9..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_private_connection.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(privateConnection, updateMask) { - // [START vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Private connection description. - */ - // const privateConnection = {} - /** - * Required. Field mask is used to specify the fields to be overwritten in the - * `PrivateConnection` 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 = {} - /** - * 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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callUpdatePrivateConnection() { - // Construct request - const request = { - privateConnection, - updateMask, - }; - - // Run request - const [operation] = await vmwareengineClient.updatePrivateConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdatePrivateConnection(); - // [END vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_subnet.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_subnet.js deleted file mode 100644 index 058161eb533..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_subnet.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(updateMask, subnet) { - // [START vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 - * `Subnet` 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. Subnet description. - */ - // const subnet = {} - - // Imports the Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callUpdateSubnet() { - // Construct request - const request = { - updateMask, - subnet, - }; - - // Run request - const [operation] = await vmwareengineClient.updateSubnet(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateSubnet(); - // [END vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_vmware_engine_network.js b/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_vmware_engine_network.js deleted file mode 100644 index bb3e3858fba..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/samples/generated/v1/vmware_engine.update_vmware_engine_network.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(vmwareEngineNetwork, updateMask) { - // [START vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. VMware Engine network description. - */ - // const vmwareEngineNetwork = {} - /** - * Required. Field mask is used to specify the fields to be overwritten in the - * VMware Engine network 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. Only the - * following fields can be updated: `description`. - */ - // const updateMask = {} - /** - * 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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * For example, consider a situation where you 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 Vmwareengine library - const {VmwareEngineClient} = require('@google-cloud/vmwareengine').v1; - - // Instantiates a client - const vmwareengineClient = new VmwareEngineClient(); - - async function callUpdateVmwareEngineNetwork() { - // Construct request - const request = { - vmwareEngineNetwork, - updateMask, - }; - - // Run request - const [operation] = await vmwareengineClient.updateVmwareEngineNetwork(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateVmwareEngineNetwork(); - // [END vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/src/index.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/src/index.ts deleted file mode 100644 index df9903da7c6..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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 VmwareEngineClient = v1.VmwareEngineClient; -type VmwareEngineClient = v1.VmwareEngineClient; -export {v1, VmwareEngineClient}; -export default {v1, VmwareEngineClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 0e003e70da7..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,449 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.vmwareengine.v1", - "libraryPackage": "@google-cloud/vmwareengine", - "services": { - "VmwareEngine": { - "clients": { - "grpc": { - "libraryClient": "VmwareEngineClient", - "rpcs": { - "GetPrivateCloud": { - "methods": [ - "getPrivateCloud" - ] - }, - "GetCluster": { - "methods": [ - "getCluster" - ] - }, - "GetSubnet": { - "methods": [ - "getSubnet" - ] - }, - "GetNodeType": { - "methods": [ - "getNodeType" - ] - }, - "ShowNsxCredentials": { - "methods": [ - "showNsxCredentials" - ] - }, - "ShowVcenterCredentials": { - "methods": [ - "showVcenterCredentials" - ] - }, - "GetHcxActivationKey": { - "methods": [ - "getHcxActivationKey" - ] - }, - "GetNetworkPolicy": { - "methods": [ - "getNetworkPolicy" - ] - }, - "GetVmwareEngineNetwork": { - "methods": [ - "getVmwareEngineNetwork" - ] - }, - "GetPrivateConnection": { - "methods": [ - "getPrivateConnection" - ] - }, - "CreatePrivateCloud": { - "methods": [ - "createPrivateCloud" - ] - }, - "UpdatePrivateCloud": { - "methods": [ - "updatePrivateCloud" - ] - }, - "DeletePrivateCloud": { - "methods": [ - "deletePrivateCloud" - ] - }, - "UndeletePrivateCloud": { - "methods": [ - "undeletePrivateCloud" - ] - }, - "CreateCluster": { - "methods": [ - "createCluster" - ] - }, - "UpdateCluster": { - "methods": [ - "updateCluster" - ] - }, - "DeleteCluster": { - "methods": [ - "deleteCluster" - ] - }, - "UpdateSubnet": { - "methods": [ - "updateSubnet" - ] - }, - "ResetNsxCredentials": { - "methods": [ - "resetNsxCredentials" - ] - }, - "ResetVcenterCredentials": { - "methods": [ - "resetVcenterCredentials" - ] - }, - "CreateHcxActivationKey": { - "methods": [ - "createHcxActivationKey" - ] - }, - "CreateNetworkPolicy": { - "methods": [ - "createNetworkPolicy" - ] - }, - "UpdateNetworkPolicy": { - "methods": [ - "updateNetworkPolicy" - ] - }, - "DeleteNetworkPolicy": { - "methods": [ - "deleteNetworkPolicy" - ] - }, - "CreateVmwareEngineNetwork": { - "methods": [ - "createVmwareEngineNetwork" - ] - }, - "UpdateVmwareEngineNetwork": { - "methods": [ - "updateVmwareEngineNetwork" - ] - }, - "DeleteVmwareEngineNetwork": { - "methods": [ - "deleteVmwareEngineNetwork" - ] - }, - "CreatePrivateConnection": { - "methods": [ - "createPrivateConnection" - ] - }, - "UpdatePrivateConnection": { - "methods": [ - "updatePrivateConnection" - ] - }, - "DeletePrivateConnection": { - "methods": [ - "deletePrivateConnection" - ] - }, - "ListPrivateClouds": { - "methods": [ - "listPrivateClouds", - "listPrivateCloudsStream", - "listPrivateCloudsAsync" - ] - }, - "ListClusters": { - "methods": [ - "listClusters", - "listClustersStream", - "listClustersAsync" - ] - }, - "ListSubnets": { - "methods": [ - "listSubnets", - "listSubnetsStream", - "listSubnetsAsync" - ] - }, - "ListNodeTypes": { - "methods": [ - "listNodeTypes", - "listNodeTypesStream", - "listNodeTypesAsync" - ] - }, - "ListHcxActivationKeys": { - "methods": [ - "listHcxActivationKeys", - "listHcxActivationKeysStream", - "listHcxActivationKeysAsync" - ] - }, - "ListNetworkPolicies": { - "methods": [ - "listNetworkPolicies", - "listNetworkPoliciesStream", - "listNetworkPoliciesAsync" - ] - }, - "ListVmwareEngineNetworks": { - "methods": [ - "listVmwareEngineNetworks", - "listVmwareEngineNetworksStream", - "listVmwareEngineNetworksAsync" - ] - }, - "ListPrivateConnections": { - "methods": [ - "listPrivateConnections", - "listPrivateConnectionsStream", - "listPrivateConnectionsAsync" - ] - }, - "ListPrivateConnectionPeeringRoutes": { - "methods": [ - "listPrivateConnectionPeeringRoutes", - "listPrivateConnectionPeeringRoutesStream", - "listPrivateConnectionPeeringRoutesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "VmwareEngineClient", - "rpcs": { - "GetPrivateCloud": { - "methods": [ - "getPrivateCloud" - ] - }, - "GetCluster": { - "methods": [ - "getCluster" - ] - }, - "GetSubnet": { - "methods": [ - "getSubnet" - ] - }, - "GetNodeType": { - "methods": [ - "getNodeType" - ] - }, - "ShowNsxCredentials": { - "methods": [ - "showNsxCredentials" - ] - }, - "ShowVcenterCredentials": { - "methods": [ - "showVcenterCredentials" - ] - }, - "GetHcxActivationKey": { - "methods": [ - "getHcxActivationKey" - ] - }, - "GetNetworkPolicy": { - "methods": [ - "getNetworkPolicy" - ] - }, - "GetVmwareEngineNetwork": { - "methods": [ - "getVmwareEngineNetwork" - ] - }, - "GetPrivateConnection": { - "methods": [ - "getPrivateConnection" - ] - }, - "CreatePrivateCloud": { - "methods": [ - "createPrivateCloud" - ] - }, - "UpdatePrivateCloud": { - "methods": [ - "updatePrivateCloud" - ] - }, - "DeletePrivateCloud": { - "methods": [ - "deletePrivateCloud" - ] - }, - "UndeletePrivateCloud": { - "methods": [ - "undeletePrivateCloud" - ] - }, - "CreateCluster": { - "methods": [ - "createCluster" - ] - }, - "UpdateCluster": { - "methods": [ - "updateCluster" - ] - }, - "DeleteCluster": { - "methods": [ - "deleteCluster" - ] - }, - "UpdateSubnet": { - "methods": [ - "updateSubnet" - ] - }, - "ResetNsxCredentials": { - "methods": [ - "resetNsxCredentials" - ] - }, - "ResetVcenterCredentials": { - "methods": [ - "resetVcenterCredentials" - ] - }, - "CreateHcxActivationKey": { - "methods": [ - "createHcxActivationKey" - ] - }, - "CreateNetworkPolicy": { - "methods": [ - "createNetworkPolicy" - ] - }, - "UpdateNetworkPolicy": { - "methods": [ - "updateNetworkPolicy" - ] - }, - "DeleteNetworkPolicy": { - "methods": [ - "deleteNetworkPolicy" - ] - }, - "CreateVmwareEngineNetwork": { - "methods": [ - "createVmwareEngineNetwork" - ] - }, - "UpdateVmwareEngineNetwork": { - "methods": [ - "updateVmwareEngineNetwork" - ] - }, - "DeleteVmwareEngineNetwork": { - "methods": [ - "deleteVmwareEngineNetwork" - ] - }, - "CreatePrivateConnection": { - "methods": [ - "createPrivateConnection" - ] - }, - "UpdatePrivateConnection": { - "methods": [ - "updatePrivateConnection" - ] - }, - "DeletePrivateConnection": { - "methods": [ - "deletePrivateConnection" - ] - }, - "ListPrivateClouds": { - "methods": [ - "listPrivateClouds", - "listPrivateCloudsStream", - "listPrivateCloudsAsync" - ] - }, - "ListClusters": { - "methods": [ - "listClusters", - "listClustersStream", - "listClustersAsync" - ] - }, - "ListSubnets": { - "methods": [ - "listSubnets", - "listSubnetsStream", - "listSubnetsAsync" - ] - }, - "ListNodeTypes": { - "methods": [ - "listNodeTypes", - "listNodeTypesStream", - "listNodeTypesAsync" - ] - }, - "ListHcxActivationKeys": { - "methods": [ - "listHcxActivationKeys", - "listHcxActivationKeysStream", - "listHcxActivationKeysAsync" - ] - }, - "ListNetworkPolicies": { - "methods": [ - "listNetworkPolicies", - "listNetworkPoliciesStream", - "listNetworkPoliciesAsync" - ] - }, - "ListVmwareEngineNetworks": { - "methods": [ - "listVmwareEngineNetworks", - "listVmwareEngineNetworksStream", - "listVmwareEngineNetworksAsync" - ] - }, - "ListPrivateConnections": { - "methods": [ - "listPrivateConnections", - "listPrivateConnectionsStream", - "listPrivateConnectionsAsync" - ] - }, - "ListPrivateConnectionPeeringRoutes": { - "methods": [ - "listPrivateConnectionPeeringRoutes", - "listPrivateConnectionPeeringRoutesStream", - "listPrivateConnectionPeeringRoutesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/index.ts deleted file mode 100644 index b4f28be5fac..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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 {VmwareEngineClient} from './vmware_engine_client'; diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client.ts deleted file mode 100644 index 7af01aa1fd0..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client.ts +++ /dev/null @@ -1,6815 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/vmware_engine_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './vmware_engine_client_config.json'; -const version = require('../../../package.json').version; - -/** - * VMwareEngine manages VMware's private clusters in the Cloud. - * @class - * @memberof v1 - */ -export class VmwareEngineClient { - 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; - vmwareEngineStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of VmwareEngineClient. - * - * @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 VmwareEngineClient({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 VmwareEngineClient; - 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 = { - clusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}' - ), - hcxActivationKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - networkPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/networkPolicies/{network_policy}' - ), - nodeTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/nodeTypes/{node_type}' - ), - privateCloudPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}' - ), - privateConnectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateConnections/{private_connection}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - subnetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet}' - ), - vmwareEngineNetworkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network}' - ), - }; - - // 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 = { - listPrivateClouds: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'privateClouds'), - listClusters: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'clusters'), - listSubnets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'subnets'), - listNodeTypes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'nodeTypes'), - listHcxActivationKeys: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hcxActivationKeys'), - listNetworkPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'networkPolicies'), - listVmwareEngineNetworks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'vmwareEngineNetworks'), - listPrivateConnections: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'privateConnections'), - listPrivateConnectionPeeringRoutes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'peeringRoutes') - }; - - 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/*/privateClouds/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/privateClouds/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/privateClouds/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:testIamPermissions',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 createPrivateCloudResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; - const createPrivateCloudMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const updatePrivateCloudResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; - const updatePrivateCloudMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const deletePrivateCloudResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; - const deletePrivateCloudMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const undeletePrivateCloudResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; - const undeletePrivateCloudMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const createClusterResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.Cluster') as gax.protobuf.Type; - const createClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const updateClusterResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.Cluster') as gax.protobuf.Type; - const updateClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const deleteClusterResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const updateSubnetResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.Subnet') as gax.protobuf.Type; - const updateSubnetMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const resetNsxCredentialsResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; - const resetNsxCredentialsMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const resetVcenterCredentialsResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; - const resetVcenterCredentialsMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const createHcxActivationKeyResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.HcxActivationKey') as gax.protobuf.Type; - const createHcxActivationKeyMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const createNetworkPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.NetworkPolicy') as gax.protobuf.Type; - const createNetworkPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const updateNetworkPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.NetworkPolicy') as gax.protobuf.Type; - const updateNetworkPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const deleteNetworkPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteNetworkPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const createVmwareEngineNetworkResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.VmwareEngineNetwork') as gax.protobuf.Type; - const createVmwareEngineNetworkMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const updateVmwareEngineNetworkResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.VmwareEngineNetwork') as gax.protobuf.Type; - const updateVmwareEngineNetworkMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const deleteVmwareEngineNetworkResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteVmwareEngineNetworkMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const createPrivateConnectionResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateConnection') as gax.protobuf.Type; - const createPrivateConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const updatePrivateConnectionResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateConnection') as gax.protobuf.Type; - const updatePrivateConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - const deletePrivateConnectionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deletePrivateConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createPrivateCloud: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createPrivateCloudResponse.decode.bind(createPrivateCloudResponse), - createPrivateCloudMetadata.decode.bind(createPrivateCloudMetadata)), - updatePrivateCloud: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updatePrivateCloudResponse.decode.bind(updatePrivateCloudResponse), - updatePrivateCloudMetadata.decode.bind(updatePrivateCloudMetadata)), - deletePrivateCloud: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deletePrivateCloudResponse.decode.bind(deletePrivateCloudResponse), - deletePrivateCloudMetadata.decode.bind(deletePrivateCloudMetadata)), - undeletePrivateCloud: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - undeletePrivateCloudResponse.decode.bind(undeletePrivateCloudResponse), - undeletePrivateCloudMetadata.decode.bind(undeletePrivateCloudMetadata)), - createCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createClusterResponse.decode.bind(createClusterResponse), - createClusterMetadata.decode.bind(createClusterMetadata)), - updateCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateClusterResponse.decode.bind(updateClusterResponse), - updateClusterMetadata.decode.bind(updateClusterMetadata)), - deleteCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteClusterResponse.decode.bind(deleteClusterResponse), - deleteClusterMetadata.decode.bind(deleteClusterMetadata)), - updateSubnet: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateSubnetResponse.decode.bind(updateSubnetResponse), - updateSubnetMetadata.decode.bind(updateSubnetMetadata)), - resetNsxCredentials: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - resetNsxCredentialsResponse.decode.bind(resetNsxCredentialsResponse), - resetNsxCredentialsMetadata.decode.bind(resetNsxCredentialsMetadata)), - resetVcenterCredentials: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - resetVcenterCredentialsResponse.decode.bind(resetVcenterCredentialsResponse), - resetVcenterCredentialsMetadata.decode.bind(resetVcenterCredentialsMetadata)), - createHcxActivationKey: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createHcxActivationKeyResponse.decode.bind(createHcxActivationKeyResponse), - createHcxActivationKeyMetadata.decode.bind(createHcxActivationKeyMetadata)), - createNetworkPolicy: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createNetworkPolicyResponse.decode.bind(createNetworkPolicyResponse), - createNetworkPolicyMetadata.decode.bind(createNetworkPolicyMetadata)), - updateNetworkPolicy: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateNetworkPolicyResponse.decode.bind(updateNetworkPolicyResponse), - updateNetworkPolicyMetadata.decode.bind(updateNetworkPolicyMetadata)), - deleteNetworkPolicy: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteNetworkPolicyResponse.decode.bind(deleteNetworkPolicyResponse), - deleteNetworkPolicyMetadata.decode.bind(deleteNetworkPolicyMetadata)), - createVmwareEngineNetwork: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createVmwareEngineNetworkResponse.decode.bind(createVmwareEngineNetworkResponse), - createVmwareEngineNetworkMetadata.decode.bind(createVmwareEngineNetworkMetadata)), - updateVmwareEngineNetwork: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateVmwareEngineNetworkResponse.decode.bind(updateVmwareEngineNetworkResponse), - updateVmwareEngineNetworkMetadata.decode.bind(updateVmwareEngineNetworkMetadata)), - deleteVmwareEngineNetwork: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteVmwareEngineNetworkResponse.decode.bind(deleteVmwareEngineNetworkResponse), - deleteVmwareEngineNetworkMetadata.decode.bind(deleteVmwareEngineNetworkMetadata)), - createPrivateConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createPrivateConnectionResponse.decode.bind(createPrivateConnectionResponse), - createPrivateConnectionMetadata.decode.bind(createPrivateConnectionMetadata)), - updatePrivateConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updatePrivateConnectionResponse.decode.bind(updatePrivateConnectionResponse), - updatePrivateConnectionMetadata.decode.bind(updatePrivateConnectionMetadata)), - deletePrivateConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deletePrivateConnectionResponse.decode.bind(deletePrivateConnectionResponse), - deletePrivateConnectionMetadata.decode.bind(deletePrivateConnectionMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.vmwareengine.v1.VmwareEngine', 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.vmwareEngineStub) { - return this.vmwareEngineStub; - } - - // Put together the "service stub" for - // google.cloud.vmwareengine.v1.VmwareEngine. - this.vmwareEngineStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.vmwareengine.v1.VmwareEngine') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.vmwareengine.v1.VmwareEngine, - 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 vmwareEngineStubMethods = - ['listPrivateClouds', 'getPrivateCloud', 'createPrivateCloud', 'updatePrivateCloud', 'deletePrivateCloud', 'undeletePrivateCloud', 'listClusters', 'getCluster', 'createCluster', 'updateCluster', 'deleteCluster', 'listSubnets', 'getSubnet', 'updateSubnet', 'listNodeTypes', 'getNodeType', 'showNsxCredentials', 'showVcenterCredentials', 'resetNsxCredentials', 'resetVcenterCredentials', 'createHcxActivationKey', 'listHcxActivationKeys', 'getHcxActivationKey', 'getNetworkPolicy', 'listNetworkPolicies', 'createNetworkPolicy', 'updateNetworkPolicy', 'deleteNetworkPolicy', 'createVmwareEngineNetwork', 'updateVmwareEngineNetwork', 'deleteVmwareEngineNetwork', 'getVmwareEngineNetwork', 'listVmwareEngineNetworks', 'createPrivateConnection', 'getPrivateConnection', 'listPrivateConnections', 'updatePrivateConnection', 'deletePrivateConnection', 'listPrivateConnectionPeeringRoutes']; - for (const methodName of vmwareEngineStubMethods) { - const callPromise = this.vmwareEngineStub.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.vmwareEngineStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'vmwareengine.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 'vmwareengine.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 -- - // ------------------- -/** - * Retrieves a `PrivateCloud` resource by its resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the private cloud to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetPrivateCloud_async - */ - getPrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|undefined, {}|undefined - ]>; - getPrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, - {}|null|undefined>): void; - getPrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, - {}|null|undefined>): void; - getPrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getPrivateCloud(request, options, callback); - } -/** - * Retrieves a `Cluster` resource by its resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The cluster resource name to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-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 {@link protos.google.cloud.vmwareengine.v1.Cluster|Cluster}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetCluster_async - */ - getCluster( - request?: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|undefined, {}|undefined - ]>; - getCluster( - request: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; - getCluster( - request: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; - getCluster( - request?: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getCluster(request, options, callback); - } -/** - * Gets details of a single subnet. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the subnet to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.Subnet|Subnet}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_subnet.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetSubnet_async - */ - getSubnet( - request?: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|undefined, {}|undefined - ]>; - getSubnet( - request: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, - {}|null|undefined>): void; - getSubnet( - request: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, - {}|null|undefined>): void; - getSubnet( - request?: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSubnet(request, options, callback); - } -/** - * Gets details of a single `NodeType`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the node type to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.NodeType|NodeType}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_node_type.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNodeType_async - */ - getNodeType( - request?: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|undefined, {}|undefined - ]>; - getNodeType( - request: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, - {}|null|undefined>): void; - getNodeType( - request: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, - {}|null|undefined>): void; - getNodeType( - request?: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getNodeType(request, options, callback); - } -/** - * Gets details of credentials for NSX appliance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.privateCloud - * Required. The resource name of the private cloud - * to be queried for credentials. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.Credentials|Credentials}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.show_nsx_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ShowNsxCredentials_async - */ - showNsxCredentials( - request?: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|undefined, {}|undefined - ]>; - showNsxCredentials( - request: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, - {}|null|undefined>): void; - showNsxCredentials( - request: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, - {}|null|undefined>): void; - showNsxCredentials( - request?: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_cloud': request.privateCloud ?? '', - }); - this.initialize(); - return this.innerApiCalls.showNsxCredentials(request, options, callback); - } -/** - * Gets details of credentials for Vcenter appliance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.privateCloud - * Required. The resource name of the private cloud - * to be queried for credentials. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.Credentials|Credentials}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.show_vcenter_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ShowVcenterCredentials_async - */ - showVcenterCredentials( - request?: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|undefined, {}|undefined - ]>; - showVcenterCredentials( - request: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, - {}|null|undefined>): void; - showVcenterCredentials( - request: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, - {}|null|undefined>): void; - showVcenterCredentials( - request?: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_cloud': request.privateCloud ?? '', - }); - this.initialize(); - return this.innerApiCalls.showVcenterCredentials(request, options, callback); - } -/** - * Retrieves a `HcxActivationKey` resource by its resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the HCX activation key to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-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 {@link protos.google.cloud.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_hcx_activation_key.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetHcxActivationKey_async - */ - getHcxActivationKey( - request?: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|undefined, {}|undefined - ]>; - getHcxActivationKey( - request: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, - {}|null|undefined>): void; - getHcxActivationKey( - request: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, - {}|null|undefined>): void; - getHcxActivationKey( - request?: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getHcxActivationKey(request, options, callback); - } -/** - * Retrieves a `NetworkPolicy` resource by its resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the network policy to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNetworkPolicy_async - */ - getNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|undefined, {}|undefined - ]>; - getNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): void; - getNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): void; - getNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getNetworkPolicy(request, options, callback); - } -/** - * Retrieves a `VmwareEngineNetwork` resource by its resource name. The - * resource contains details of the VMware Engine network, such as its VMware - * Engine network type, peered networks in a service project, and state - * (for example, `CREATING`, `ACTIVE`, `DELETING`). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the VMware Engine network to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetVmwareEngineNetwork_async - */ - getVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|undefined, {}|undefined - ]>; - getVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, - {}|null|undefined>): void; - getVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, - {}|null|undefined>): void; - getVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getVmwareEngineNetwork(request, options, callback); - } -/** - * Retrieves a `PrivateConnection` resource by its resource name. The resource - * contains details of the private connection, such as connected - * network, routing mode and state. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the private connection to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateConnections/my-connection` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetPrivateConnection_async - */ - getPrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|undefined, {}|undefined - ]>; - getPrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): void; - getPrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): void; - getPrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getPrivateConnection(request, options, callback); - } - -/** - * Creates a new `PrivateCloud` resource in a given project and location. - * Private clouds can only be created in zones, regional private clouds are - * not supported. - * - * Creating a private cloud also creates a [management - * cluster](https://cloud.google.com/vmware-engine/docs/concepts-vmware-components) - * for that private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to create the new - * private cloud in. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {string} request.privateCloudId - * Required. The user-provided identifier of the private cloud to be created. - * This identifier must be unique among each `PrivateCloud` within the parent - * and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {google.cloud.vmwareengine.v1.PrivateCloud} request.privateCloud - * Required. The initial description of the new private cloud. - * @param {string} [request.requestId] - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. True if you want the request to be validated and not executed; - * false otherwise. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async - */ - createPrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createPrivateCloud( - request: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPrivateCloud( - request: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createPrivateCloud(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createPrivateCloud()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async - */ - async checkCreatePrivateCloudProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPrivateCloud, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Modifies a `PrivateCloud` resource. Only the following fields can be - * updated: `description`. - * Only fields specified in `updateMask` are applied. - * - * During operation processing, the resource is temporarily in the `ACTIVE` - * state before the operation fully completes. For that period of time, you - * can't update the resource. Use the operation status to determine when the - * processing fully completes. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.vmwareengine.v1.PrivateCloud} request.privateCloud - * Required. Private cloud description. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `PrivateCloud` resource by the update. The fields specified in `updateMask` - * 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 {string} [request.requestId] - * Optional. 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/vmware_engine.update_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async - */ - updatePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updatePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updatePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updatePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_cloud.name': request.privateCloud!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updatePrivateCloud(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updatePrivateCloud()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async - */ - async checkUpdatePrivateCloudProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updatePrivateCloud, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Schedules a `PrivateCloud` resource for deletion. - * - * A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` - * set to `DELETED` and `expireTime` set to the time when deletion is final - * and can no longer be reversed. The delete operation is marked as done - * as soon as the `PrivateCloud` is successfully scheduled for deletion - * (this also applies when `delayHours` is set to zero), and the operation is - * not kept in pending state until `PrivateCloud` is purged. - * `PrivateCloud` can be restored using `UndeletePrivateCloud` method before - * the `expireTime` elapses. When `expireTime` is reached, deletion is final - * and all private cloud resources are irreversibly removed and billing stops. - * During the final removal process, `PrivateCloud.state` is set to `PURGING`. - * `PrivateCloud` can be polled using standard `GET` method for the whole - * period of deletion and purging. It will not be returned only - * when it is completely purged. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the private cloud to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {string} [request.requestId] - * Optional. 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, cascade delete is enabled and all children of - * this private cloud resource are also deleted. When this flag is set to - * false, the private cloud will not be deleted if there are any children - * other than the management cluster. The management cluster is always - * deleted. - * @param {number} [request.delayHours] - * Optional. Time delay of the deletion specified in hours. The default value - * is `3`. Specifying a non-zero value for this field changes the value of - * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned - * deletion time. Deletion can be cancelled before `expire_time` elapses using - * {@link protos.google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud|VmwareEngine.UndeletePrivateCloud}. - * Specifying a value of `0` for this field instead begins the deletion - * process and ceases billing immediately. During the final deletion process, - * the value of `PrivateCloud.state` becomes `PURGING`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async - */ - deletePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deletePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deletePrivateCloud(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deletePrivateCloud()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async - */ - async checkDeletePrivateCloudProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePrivateCloud, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Restores a private cloud that was previously scheduled for deletion by - * `DeletePrivateCloud`. A `PrivateCloud` resource scheduled for deletion has - * `PrivateCloud.state` set to `DELETED` and `PrivateCloud.expireTime` set to - * the time when deletion can no longer be reversed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the private cloud scheduled for deletion. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {string} [request.requestId] - * Optional. 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/vmware_engine.undelete_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async - */ - undeletePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - undeletePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - undeletePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - undeletePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.undeletePrivateCloud(request, options, callback); - } -/** - * Check the status of the long running operation returned by `undeletePrivateCloud()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.undelete_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async - */ - async checkUndeletePrivateCloudProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.undeletePrivateCloud, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new cluster in a given private cloud. - * Creating a new cluster provides additional nodes for - * use in the parent private cloud and requires sufficient [node - * quota](https://cloud.google.com/vmware-engine/quotas). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to create a new cluster - * in. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {string} request.clusterId - * Required. The user-provided identifier of the new `Cluster`. - * This identifier must be unique among clusters within the parent and becomes - * the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {google.cloud.vmwareengine.v1.Cluster} request.cluster - * Required. The initial description of the new cluster. - * @param {string} [request.requestId] - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. True if you want the request to be validated and not executed; - * false otherwise. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateCluster_async - */ - createCluster( - request?: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createCluster( - request: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCluster( - request: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCluster( - request?: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateCluster_async - */ - async checkCreateClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Modifies a `Cluster` resource. Only the following fields can be updated: - * `node_type_configs.*.node_count`. Only fields specified in `updateMask` are - * applied. - * - * During operation processing, the resource is temporarily in the `ACTIVE` - * state before the operation fully completes. For that period of time, you - * can't update the resource. Use the operation status to determine when the - * processing fully completes. - * - * @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 - * `Cluster` resource by the update. The fields specified in the `updateMask` - * 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.vmwareengine.v1.Cluster} request.cluster - * Required. The description of the cluster. - * @param {string} [request.requestId] - * Optional. The request ID must be a valid UUID with the exception that - * zero UUID is not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. True if you want the request to be validated and not executed; - * false otherwise. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async - */ - updateCluster( - request?: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateCluster( - request: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCluster( - request: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCluster( - request?: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'cluster.name': request.cluster!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async - */ - async checkUpdateClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a `Cluster` resource. To avoid unintended data loss, migrate or - * gracefully shut down any workloads running on the cluster before deletion. - * You cannot delete the management cluster of a private cloud using this - * method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the cluster to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - * @param {string} [request.requestId] - * Optional. 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/vmware_engine.delete_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async - */ - deleteCluster( - request?: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteCluster( - request: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteCluster( - request: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteCluster( - request?: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async - */ - async checkDeleteClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a single subnet. Only fields specified in - * `update_mask` are applied. - * - * *Note*: This API is synchronous and always returns a successful - * `google.longrunning.Operation` (LRO). The returned LRO will only have - * `done` and `response` fields. - * - * @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 - * `Subnet` 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.vmwareengine.v1.Subnet} request.subnet - * Required. Subnet description. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_subnet.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async - */ - updateSubnet( - request?: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateSubnet( - request: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSubnet( - request: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSubnet( - request?: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'subnet.name': request.subnet!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSubnet(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateSubnet()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_subnet.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async - */ - async checkUpdateSubnetProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSubnet, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Resets credentials of the NSX appliance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.privateCloud - * Required. The resource name of the private cloud - * to reset credentials for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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/vmware_engine.reset_nsx_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async - */ - resetNsxCredentials( - request?: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - resetNsxCredentials( - request: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - resetNsxCredentials( - request: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - resetNsxCredentials( - request?: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_cloud': request.privateCloud ?? '', - }); - this.initialize(); - return this.innerApiCalls.resetNsxCredentials(request, options, callback); - } -/** - * Check the status of the long running operation returned by `resetNsxCredentials()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.reset_nsx_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async - */ - async checkResetNsxCredentialsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.resetNsxCredentials, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Resets credentials of the Vcenter appliance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.privateCloud - * Required. The resource name of the private cloud - * to reset credentials for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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/vmware_engine.reset_vcenter_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async - */ - resetVcenterCredentials( - request?: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - resetVcenterCredentials( - request: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - resetVcenterCredentials( - request: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - resetVcenterCredentials( - request?: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_cloud': request.privateCloud ?? '', - }); - this.initialize(); - return this.innerApiCalls.resetVcenterCredentials(request, options, callback); - } -/** - * Check the status of the long running operation returned by `resetVcenterCredentials()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.reset_vcenter_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async - */ - async checkResetVcenterCredentialsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.resetVcenterCredentials, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new HCX activation key in a given private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to create the key for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - * @param {google.cloud.vmwareengine.v1.HcxActivationKey} request.hcxActivationKey - * Required. The initial description of a new HCX activation key. When - * creating a new key, this field must be an empty object. - * @param {string} request.hcxActivationKeyId - * Required. The user-provided identifier of the `HcxActivationKey` to be - * created. This identifier must be unique among `HcxActivationKey` resources - * within the parent and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {string} request.requestId - * 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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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/vmware_engine.create_hcx_activation_key.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async - */ - createHcxActivationKey( - request?: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createHcxActivationKey( - request: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createHcxActivationKey( - request: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createHcxActivationKey( - request?: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createHcxActivationKey(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createHcxActivationKey()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_hcx_activation_key.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async - */ - async checkCreateHcxActivationKeyProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createHcxActivationKey, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new network policy in a given VMware Engine network of a - * project and location (region). A new network policy cannot be created if - * another network policy already exists in the same scope. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location (region) - * to create the new network policy in. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1` - * @param {string} request.networkPolicyId - * Required. The user-provided identifier of the network policy to be created. - * This identifier must be unique within parent - * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes - * the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {google.cloud.vmwareengine.v1.NetworkPolicy} request.networkPolicy - * Required. The network policy configuration to use in the request. - * @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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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/vmware_engine.create_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async - */ - createNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createNetworkPolicy(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createNetworkPolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async - */ - async checkCreateNetworkPolicyProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createNetworkPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Modifies a `NetworkPolicy` resource. Only the following fields can be - * updated: `internet_access`, `external_ip`, `edge_services_cidr`. - * Only fields specified in `updateMask` are applied. When updating a network - * policy, the external IP network service can only be disabled if there are - * no external IP addresses present in the scope of the policy. Also, a - * `NetworkService` cannot be updated when `NetworkService.state` is set - * to `RECONCILING`. - * - * During operation processing, the resource is temporarily in the `ACTIVE` - * state before the operation fully completes. For that period of time, you - * can't update the resource. Use the operation status to determine when the - * processing fully completes. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.vmwareengine.v1.NetworkPolicy} request.networkPolicy - * Required. Network policy description. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `NetworkPolicy` 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 {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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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/vmware_engine.update_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async - */ - updateNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'network_policy.name': request.networkPolicy!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateNetworkPolicy(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateNetworkPolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async - */ - async checkUpdateNetworkPolicyProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateNetworkPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a `NetworkPolicy` resource. A network policy cannot be deleted - * when `NetworkService.state` is set to `RECONCILING` for either its external - * IP or internet access service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the network policy to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` - * @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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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/vmware_engine.delete_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async - */ - deleteNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteNetworkPolicy(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteNetworkPolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async - */ - async checkDeleteNetworkPolicyProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteNetworkPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new VMware Engine network that can be used by a private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to create the new VMware Engine - * network in. A VMware Engine network of type - * `LEGACY` is a regional resource, and a VMware - * Engine network of type `STANDARD` is a global resource. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global` - * @param {string} request.vmwareEngineNetworkId - * Required. The user-provided identifier of the new VMware Engine network. - * This identifier must be unique among VMware Engine network resources - * within the parent and becomes the final token in the name URI. The - * identifier must meet the following requirements: - * - * * For networks of type LEGACY, adheres to the format: - * `{region-id}-default`. Replace `{region-id}` with the region where you want - * to create the VMware Engine network. For example, "us-central1-default". - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {google.cloud.vmwareengine.v1.VmwareEngineNetwork} request.vmwareEngineNetwork - * Required. The initial description of the new VMware Engine network. - * @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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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/vmware_engine.create_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async - */ - createVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createVmwareEngineNetwork(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createVmwareEngineNetwork()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async - */ - async checkCreateVmwareEngineNetworkProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createVmwareEngineNetwork, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Modifies a VMware Engine network resource. Only the following fields can be - * updated: `description`. Only fields specified in `updateMask` are - * applied. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.vmwareengine.v1.VmwareEngineNetwork} request.vmwareEngineNetwork - * Required. VMware Engine network description. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * VMware Engine network 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. Only the - * following fields can be updated: `description`. - * @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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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/vmware_engine.update_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async - */ - updateVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'vmware_engine_network.name': request.vmwareEngineNetwork!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateVmwareEngineNetwork(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateVmwareEngineNetwork()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async - */ - async checkUpdateVmwareEngineNetworkProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateVmwareEngineNetwork, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a `VmwareEngineNetwork` resource. You can only delete a VMware - * Engine network after all resources that refer to it are deleted. For - * example, a private cloud, a network peering, and a network policy can all - * refer to the same VMware Engine network. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the VMware Engine network to be deleted. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` - * @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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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 {string} [request.etag] - * Optional. Checksum used to ensure that the user-provided value is up to - * date before the server processes the request. The server compares provided - * checksum with the current checksum of the resource. If the user-provided - * value is out of date, this request returns an `ABORTED` error. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async - */ - deleteVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteVmwareEngineNetwork(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteVmwareEngineNetwork()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async - */ - async checkDeleteVmwareEngineNetworkProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteVmwareEngineNetwork, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new private connection that can be used for accessing private - * Clouds. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to create the new private - * connection in. Private connection is a regional resource. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-central1` - * @param {string} request.privateConnectionId - * Required. The user-provided identifier of the new private connection. - * This identifier must be unique among private connection resources - * within the parent and becomes the final token in the name URI. The - * identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {google.cloud.vmwareengine.v1.PrivateConnection} request.privateConnection - * Required. The initial description of the new private connection. - * @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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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/vmware_engine.create_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async - */ - createPrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createPrivateConnection( - request: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPrivateConnection( - request: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createPrivateConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createPrivateConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async - */ - async checkCreatePrivateConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPrivateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Modifies a `PrivateConnection` resource. Only `description` and - * `routing_mode` fields can be updated. Only fields specified in `updateMask` - * are applied. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.vmwareengine.v1.PrivateConnection} request.privateConnection - * Required. Private connection description. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `PrivateConnection` 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 {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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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/vmware_engine.update_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async - */ - updatePrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updatePrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updatePrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updatePrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_connection.name': request.privateConnection!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updatePrivateConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updatePrivateConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async - */ - async checkUpdatePrivateConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updatePrivateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a `PrivateConnection` resource. When a private connection is - * deleted for a VMware Engine network, the connected network becomes - * inaccessible to that VMware Engine network. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the private connection to be deleted. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateConnections/my-connection` - * @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 guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you 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/vmware_engine.delete_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async - */ - deletePrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deletePrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deletePrivateConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deletePrivateConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async - */ - async checkDeletePrivateConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePrivateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists `PrivateCloud` resources 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 private cloud to be queried for - * clusters. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of private clouds to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateClouds` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListPrivateClouds` must - * match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison operator, and the - * value that you want to use for filtering. The value must be a string, a - * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or - * `<`. - * - * For example, if you are filtering a list of private clouds, you can exclude - * the ones named `example-pc` by specifying `name != "example-pc"`. - * - * You can also filter nested fields. For example, you could specify - * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds - * only if they have a matching address in their network configuration. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-pc") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "private-cloud-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "private-cloud-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` 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 Array of {@link protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud}. - * 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 `listPrivateCloudsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPrivateClouds( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateCloud[], - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse - ]>; - listPrivateClouds( - request: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateCloud>): void; - listPrivateClouds( - request: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateCloud>): void; - listPrivateClouds( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateCloud>, - callback?: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateCloud>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateCloud[], - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listPrivateClouds(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 private cloud to be queried for - * clusters. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of private clouds to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateClouds` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListPrivateClouds` must - * match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison operator, and the - * value that you want to use for filtering. The value must be a string, a - * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or - * `<`. - * - * For example, if you are filtering a list of private clouds, you can exclude - * the ones named `example-pc` by specifying `name != "example-pc"`. - * - * You can also filter nested fields. For example, you could specify - * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds - * only if they have a matching address in their network configuration. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-pc") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "private-cloud-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "private-cloud-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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.vmwareengine.v1.PrivateCloud|PrivateCloud} 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 `listPrivateCloudsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPrivateCloudsStream( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - 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['listPrivateClouds']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPrivateClouds.createStream( - this.innerApiCalls.listPrivateClouds as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listPrivateClouds`, 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 private cloud to be queried for - * clusters. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of private clouds to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateClouds` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListPrivateClouds` must - * match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison operator, and the - * value that you want to use for filtering. The value must be a string, a - * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or - * `<`. - * - * For example, if you are filtering a list of private clouds, you can exclude - * the ones named `example-pc` by specifying `name != "example-pc"`. - * - * You can also filter nested fields. For example, you could specify - * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds - * only if they have a matching address in their network configuration. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-pc") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "private-cloud-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "private-cloud-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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.vmwareengine.v1.PrivateCloud|PrivateCloud}. 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/vmware_engine.list_private_clouds.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateClouds_async - */ - listPrivateCloudsAsync( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - 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['listPrivateClouds']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPrivateClouds.asyncIterate( - this.innerApiCalls['listPrivateClouds'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists `Cluster` resources in a given private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to query for clusters. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of clusters to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListClusters` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListClusters` - * must match the call that provided the page token. - * @param {string} request.filter - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-cluster") - * (nodeCount = "3") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "example-cluster-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-cluster-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` 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 Array of {@link protos.google.cloud.vmwareengine.v1.Cluster|Cluster}. - * 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 `listClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listClusters( - request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICluster[], - protos.google.cloud.vmwareengine.v1.IListClustersRequest|null, - protos.google.cloud.vmwareengine.v1.IListClustersResponse - ]>; - listClusters( - request: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListClustersRequest, - protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ICluster>): void; - listClusters( - request: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListClustersRequest, - protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ICluster>): void; - listClusters( - request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListClustersRequest, - protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ICluster>, - callback?: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListClustersRequest, - protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ICluster>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICluster[], - protos.google.cloud.vmwareengine.v1.IListClustersRequest|null, - protos.google.cloud.vmwareengine.v1.IListClustersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listClusters(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 private cloud to query for clusters. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of clusters to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListClusters` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListClusters` - * must match the call that provided the page token. - * @param {string} request.filter - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-cluster") - * (nodeCount = "3") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "example-cluster-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-cluster-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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.vmwareengine.v1.Cluster|Cluster} 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 `listClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listClustersStream( - request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - 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['listClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listClusters.createStream( - this.innerApiCalls.listClusters as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listClusters`, 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 private cloud to query for clusters. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of clusters to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListClusters` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListClusters` - * must match the call that provided the page token. - * @param {string} request.filter - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-cluster") - * (nodeCount = "3") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "example-cluster-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-cluster-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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.vmwareengine.v1.Cluster|Cluster}. 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/vmware_engine.list_clusters.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListClusters_async - */ - listClustersAsync( - request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - 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['listClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listClusters.asyncIterate( - this.innerApiCalls['listClusters'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists subnets in a given private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * subnets. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of subnets to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListSubnetsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListSubnetsRequest` 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.vmwareengine.v1.Subnet|Subnet}. - * 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 `listSubnetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSubnets( - request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ISubnet[], - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest|null, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse - ]>; - listSubnets( - request: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ISubnet>): void; - listSubnets( - request: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ISubnet>): void; - listSubnets( - request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ISubnet>, - callback?: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ISubnet>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ISubnet[], - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest|null, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listSubnets(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 private cloud to be queried for - * subnets. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of subnets to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListSubnetsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListSubnetsRequest` 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.vmwareengine.v1.Subnet|Subnet} 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 `listSubnetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSubnetsStream( - request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - 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['listSubnets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSubnets.createStream( - this.innerApiCalls.listSubnets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSubnets`, 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 private cloud to be queried for - * subnets. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of subnets to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListSubnetsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListSubnetsRequest` 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.vmwareengine.v1.Subnet|Subnet}. 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/vmware_engine.list_subnets.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListSubnets_async - */ - listSubnetsAsync( - request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - 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['listSubnets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSubnets.asyncIterate( - this.innerApiCalls['listSubnets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists node types - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to be queried for node types. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of node types to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNodeTypes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNodeTypes` must match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of node types, you can - * exclude the ones named `standard-72` by specifying - * `name != "standard-72"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "standard-72") - * (virtual_cpu_count > 2) - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "standard-96") AND - * (virtual_cpu_count > 2) OR - * (name = "standard-72") - * ``` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.vmwareengine.v1.NodeType|NodeType}. - * 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 `listNodeTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNodeTypes( - request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INodeType[], - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse - ]>; - listNodeTypes( - request: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INodeType>): void; - listNodeTypes( - request: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INodeType>): void; - listNodeTypes( - request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INodeType>, - callback?: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INodeType>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INodeType[], - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listNodeTypes(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 to be queried for node types. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of node types to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNodeTypes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNodeTypes` must match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of node types, you can - * exclude the ones named `standard-72` by specifying - * `name != "standard-72"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "standard-72") - * (virtual_cpu_count > 2) - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "standard-96") AND - * (virtual_cpu_count > 2) OR - * (name = "standard-72") - * ``` - * @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.vmwareengine.v1.NodeType|NodeType} 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 `listNodeTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNodeTypesStream( - request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - 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['listNodeTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNodeTypes.createStream( - this.innerApiCalls.listNodeTypes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNodeTypes`, 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 to be queried for node types. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of node types to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNodeTypes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNodeTypes` must match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of node types, you can - * exclude the ones named `standard-72` by specifying - * `name != "standard-72"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "standard-72") - * (virtual_cpu_count > 2) - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "standard-96") AND - * (virtual_cpu_count > 2) OR - * (name = "standard-72") - * ``` - * @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.vmwareengine.v1.NodeType|NodeType}. 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/vmware_engine.list_node_types.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNodeTypes_async - */ - listNodeTypesAsync( - request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - 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['listNodeTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNodeTypes.asyncIterate( - this.innerApiCalls['listNodeTypes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists `HcxActivationKey` resources in a given private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud - * to be queried for HCX activation keys. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of HCX activation keys to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListHcxActivationKeys` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListHcxActivationKeys` 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.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. - * 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 `listHcxActivationKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listHcxActivationKeys( - request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IHcxActivationKey[], - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest|null, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse - ]>; - listHcxActivationKeys( - request: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IHcxActivationKey>): void; - listHcxActivationKeys( - request: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IHcxActivationKey>): void; - listHcxActivationKeys( - request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IHcxActivationKey>, - callback?: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IHcxActivationKey>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IHcxActivationKey[], - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest|null, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listHcxActivationKeys(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 private cloud - * to be queried for HCX activation keys. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of HCX activation keys to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListHcxActivationKeys` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListHcxActivationKeys` 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.vmwareengine.v1.HcxActivationKey|HcxActivationKey} 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 `listHcxActivationKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listHcxActivationKeysStream( - request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - 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['listHcxActivationKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHcxActivationKeys.createStream( - this.innerApiCalls.listHcxActivationKeys as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listHcxActivationKeys`, 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 private cloud - * to be queried for HCX activation keys. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of HCX activation keys to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListHcxActivationKeys` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListHcxActivationKeys` 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.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. 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/vmware_engine.list_hcx_activation_keys.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListHcxActivationKeys_async - */ - listHcxActivationKeysAsync( - request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - 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['listHcxActivationKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHcxActivationKeys.asyncIterate( - this.innerApiCalls['listHcxActivationKeys'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists `NetworkPolicy` resources in a specified project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location (region) to query for - * network policies. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of network policies to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNetworkPolicies` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNetworkPolicies` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network policies, you can - * exclude the ones named `example-policy` by specifying - * `name != "example-policy"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-policy") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-policy-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-policy-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` 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 Array of {@link protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. - * 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 `listNetworkPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNetworkPolicies( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPolicy[], - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse - ]>; - listNetworkPolicies( - request: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPolicy>): void; - listNetworkPolicies( - request: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPolicy>): void; - listNetworkPolicies( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPolicy>, - callback?: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPolicy>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPolicy[], - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listNetworkPolicies(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 (region) to query for - * network policies. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of network policies to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNetworkPolicies` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNetworkPolicies` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network policies, you can - * exclude the ones named `example-policy` by specifying - * `name != "example-policy"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-policy") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-policy-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-policy-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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.vmwareengine.v1.NetworkPolicy|NetworkPolicy} 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 `listNetworkPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNetworkPoliciesStream( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - 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['listNetworkPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNetworkPolicies.createStream( - this.innerApiCalls.listNetworkPolicies as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNetworkPolicies`, 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 (region) to query for - * network policies. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of network policies to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNetworkPolicies` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNetworkPolicies` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network policies, you can - * exclude the ones named `example-policy` by specifying - * `name != "example-policy"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-policy") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-policy-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-policy-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. 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/vmware_engine.list_network_policies.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNetworkPolicies_async - */ - listNetworkPoliciesAsync( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - 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['listNetworkPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNetworkPolicies.asyncIterate( - this.innerApiCalls['listNetworkPolicies'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists `VmwareEngineNetwork` resources 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 to query for - * VMware Engine networks. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @param {number} request.pageSize - * The maximum number of results to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListVmwareEngineNetworks` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListVmwareEngineNetworks` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-network` by specifying - * `name != "example-network"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-network") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-network-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-network-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` 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 Array of {@link protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. - * 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 `listVmwareEngineNetworksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listVmwareEngineNetworks( - request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[], - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest|null, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse - ]>; - listVmwareEngineNetworks( - request: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>): void; - listVmwareEngineNetworks( - request: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>): void; - listVmwareEngineNetworks( - request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>, - callback?: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[], - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest|null, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listVmwareEngineNetworks(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 to query for - * VMware Engine networks. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @param {number} request.pageSize - * The maximum number of results to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListVmwareEngineNetworks` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListVmwareEngineNetworks` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-network` by specifying - * `name != "example-network"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-network") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-network-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-network-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork} 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 `listVmwareEngineNetworksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listVmwareEngineNetworksStream( - request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - 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['listVmwareEngineNetworks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVmwareEngineNetworks.createStream( - this.innerApiCalls.listVmwareEngineNetworks as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listVmwareEngineNetworks`, 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 to query for - * VMware Engine networks. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @param {number} request.pageSize - * The maximum number of results to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListVmwareEngineNetworks` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListVmwareEngineNetworks` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-network` by specifying - * `name != "example-network"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-network") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-network-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-network-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. 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/vmware_engine.list_vmware_engine_networks.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListVmwareEngineNetworks_async - */ - listVmwareEngineNetworksAsync( - request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - 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['listVmwareEngineNetworks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVmwareEngineNetworks.asyncIterate( - this.innerApiCalls['listVmwareEngineNetworks'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists `PrivateConnection` resources 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 to query for - * private connections. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of private connections to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of private connections, you can - * exclude the ones named `example-connection` by specifying - * `name != "example-connection"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-connection") - * (createTime > "2022-09-22T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-connection-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-connection-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` 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 Array of {@link protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection}. - * 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 `listPrivateConnectionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPrivateConnections( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateConnection[], - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse - ]>; - listPrivateConnections( - request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateConnection>): void; - listPrivateConnections( - request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateConnection>): void; - listPrivateConnections( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateConnection>, - callback?: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateConnection>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateConnection[], - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listPrivateConnections(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 to query for - * private connections. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of private connections to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of private connections, you can - * exclude the ones named `example-connection` by specifying - * `name != "example-connection"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-connection") - * (createTime > "2022-09-22T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-connection-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-connection-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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.vmwareengine.v1.PrivateConnection|PrivateConnection} 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 `listPrivateConnectionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPrivateConnectionsStream( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - 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['listPrivateConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPrivateConnections.createStream( - this.innerApiCalls.listPrivateConnections as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listPrivateConnections`, 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 to query for - * private connections. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of private connections to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of private connections, you can - * exclude the ones named `example-connection` by specifying - * `name != "example-connection"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-connection") - * (createTime > "2022-09-22T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-connection-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-connection-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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.vmwareengine.v1.PrivateConnection|PrivateConnection}. 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/vmware_engine.list_private_connections.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateConnections_async - */ - listPrivateConnectionsAsync( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - 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['listPrivateConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPrivateConnections.asyncIterate( - this.innerApiCalls['listPrivateConnections'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the private connection routes exchanged over a peering connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private connection to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-west1/privateConnections/my-connection` - * @param {number} request.pageSize - * The maximum number of peering routes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListPrivateConnectionPeeringRoutes` 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.vmwareengine.v1.PeeringRoute|PeeringRoute}. - * 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 `listPrivateConnectionPeeringRoutesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPrivateConnectionPeeringRoutes( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPeeringRoute[], - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse - ]>; - listPrivateConnectionPeeringRoutes( - request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>): void; - listPrivateConnectionPeeringRoutes( - request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>): void; - listPrivateConnectionPeeringRoutes( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>, - callback?: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPeeringRoute[], - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listPrivateConnectionPeeringRoutes(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 private connection to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-west1/privateConnections/my-connection` - * @param {number} request.pageSize - * The maximum number of peering routes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListPrivateConnectionPeeringRoutes` 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.vmwareengine.v1.PeeringRoute|PeeringRoute} 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 `listPrivateConnectionPeeringRoutesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPrivateConnectionPeeringRoutesStream( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - 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['listPrivateConnectionPeeringRoutes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPrivateConnectionPeeringRoutes.createStream( - this.innerApiCalls.listPrivateConnectionPeeringRoutes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listPrivateConnectionPeeringRoutes`, 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 private connection to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-west1/privateConnections/my-connection` - * @param {number} request.pageSize - * The maximum number of peering routes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListPrivateConnectionPeeringRoutes` 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.vmwareengine.v1.PeeringRoute|PeeringRoute}. 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/vmware_engine.list_private_connection_peering_routes.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateConnectionPeeringRoutes_async - */ - listPrivateConnectionPeeringRoutesAsync( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - 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['listPrivateConnectionPeeringRoutes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate( - this.innerApiCalls['listPrivateConnectionPeeringRoutes'] 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 cluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} private_cloud - * @param {string} cluster - * @returns {string} Resource name string. - */ - clusterPath(project:string,location:string,privateCloud:string,cluster:string) { - return this.pathTemplates.clusterPathTemplate.render({ - project: project, - location: location, - private_cloud: privateCloud, - cluster: cluster, - }); - } - - /** - * Parse the project from Cluster resource. - * - * @param {string} clusterName - * A fully-qualified path representing Cluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromClusterName(clusterName: string) { - return this.pathTemplates.clusterPathTemplate.match(clusterName).project; - } - - /** - * Parse the location from Cluster resource. - * - * @param {string} clusterName - * A fully-qualified path representing Cluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromClusterName(clusterName: string) { - return this.pathTemplates.clusterPathTemplate.match(clusterName).location; - } - - /** - * Parse the private_cloud from Cluster resource. - * - * @param {string} clusterName - * A fully-qualified path representing Cluster resource. - * @returns {string} A string representing the private_cloud. - */ - matchPrivateCloudFromClusterName(clusterName: string) { - return this.pathTemplates.clusterPathTemplate.match(clusterName).private_cloud; - } - - /** - * Parse the cluster from Cluster resource. - * - * @param {string} clusterName - * A fully-qualified path representing Cluster resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromClusterName(clusterName: string) { - return this.pathTemplates.clusterPathTemplate.match(clusterName).cluster; - } - - /** - * Return a fully-qualified hcxActivationKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} private_cloud - * @param {string} hcx_activation_key - * @returns {string} Resource name string. - */ - hcxActivationKeyPath(project:string,location:string,privateCloud:string,hcxActivationKey:string) { - return this.pathTemplates.hcxActivationKeyPathTemplate.render({ - project: project, - location: location, - private_cloud: privateCloud, - hcx_activation_key: hcxActivationKey, - }); - } - - /** - * Parse the project from HcxActivationKey resource. - * - * @param {string} hcxActivationKeyName - * A fully-qualified path representing HcxActivationKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromHcxActivationKeyName(hcxActivationKeyName: string) { - return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).project; - } - - /** - * Parse the location from HcxActivationKey resource. - * - * @param {string} hcxActivationKeyName - * A fully-qualified path representing HcxActivationKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromHcxActivationKeyName(hcxActivationKeyName: string) { - return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).location; - } - - /** - * Parse the private_cloud from HcxActivationKey resource. - * - * @param {string} hcxActivationKeyName - * A fully-qualified path representing HcxActivationKey resource. - * @returns {string} A string representing the private_cloud. - */ - matchPrivateCloudFromHcxActivationKeyName(hcxActivationKeyName: string) { - return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).private_cloud; - } - - /** - * Parse the hcx_activation_key from HcxActivationKey resource. - * - * @param {string} hcxActivationKeyName - * A fully-qualified path representing HcxActivationKey resource. - * @returns {string} A string representing the hcx_activation_key. - */ - matchHcxActivationKeyFromHcxActivationKeyName(hcxActivationKeyName: string) { - return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).hcx_activation_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 networkPolicy resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} network_policy - * @returns {string} Resource name string. - */ - networkPolicyPath(project:string,location:string,networkPolicy:string) { - return this.pathTemplates.networkPolicyPathTemplate.render({ - project: project, - location: location, - network_policy: networkPolicy, - }); - } - - /** - * Parse the project from NetworkPolicy resource. - * - * @param {string} networkPolicyName - * A fully-qualified path representing NetworkPolicy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkPolicyName(networkPolicyName: string) { - return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName).project; - } - - /** - * Parse the location from NetworkPolicy resource. - * - * @param {string} networkPolicyName - * A fully-qualified path representing NetworkPolicy resource. - * @returns {string} A string representing the location. - */ - matchLocationFromNetworkPolicyName(networkPolicyName: string) { - return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName).location; - } - - /** - * Parse the network_policy from NetworkPolicy resource. - * - * @param {string} networkPolicyName - * A fully-qualified path representing NetworkPolicy resource. - * @returns {string} A string representing the network_policy. - */ - matchNetworkPolicyFromNetworkPolicyName(networkPolicyName: string) { - return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName).network_policy; - } - - /** - * Return a fully-qualified nodeType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} node_type - * @returns {string} Resource name string. - */ - nodeTypePath(project:string,location:string,nodeType:string) { - return this.pathTemplates.nodeTypePathTemplate.render({ - project: project, - location: location, - node_type: nodeType, - }); - } - - /** - * Parse the project from NodeType resource. - * - * @param {string} nodeTypeName - * A fully-qualified path representing NodeType resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNodeTypeName(nodeTypeName: string) { - return this.pathTemplates.nodeTypePathTemplate.match(nodeTypeName).project; - } - - /** - * Parse the location from NodeType resource. - * - * @param {string} nodeTypeName - * A fully-qualified path representing NodeType resource. - * @returns {string} A string representing the location. - */ - matchLocationFromNodeTypeName(nodeTypeName: string) { - return this.pathTemplates.nodeTypePathTemplate.match(nodeTypeName).location; - } - - /** - * Parse the node_type from NodeType resource. - * - * @param {string} nodeTypeName - * A fully-qualified path representing NodeType resource. - * @returns {string} A string representing the node_type. - */ - matchNodeTypeFromNodeTypeName(nodeTypeName: string) { - return this.pathTemplates.nodeTypePathTemplate.match(nodeTypeName).node_type; - } - - /** - * Return a fully-qualified privateCloud resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} private_cloud - * @returns {string} Resource name string. - */ - privateCloudPath(project:string,location:string,privateCloud:string) { - return this.pathTemplates.privateCloudPathTemplate.render({ - project: project, - location: location, - private_cloud: privateCloud, - }); - } - - /** - * Parse the project from PrivateCloud resource. - * - * @param {string} privateCloudName - * A fully-qualified path representing PrivateCloud resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPrivateCloudName(privateCloudName: string) { - return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName).project; - } - - /** - * Parse the location from PrivateCloud resource. - * - * @param {string} privateCloudName - * A fully-qualified path representing PrivateCloud resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPrivateCloudName(privateCloudName: string) { - return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName).location; - } - - /** - * Parse the private_cloud from PrivateCloud resource. - * - * @param {string} privateCloudName - * A fully-qualified path representing PrivateCloud resource. - * @returns {string} A string representing the private_cloud. - */ - matchPrivateCloudFromPrivateCloudName(privateCloudName: string) { - return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName).private_cloud; - } - - /** - * Return a fully-qualified privateConnection resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} private_connection - * @returns {string} Resource name string. - */ - privateConnectionPath(project:string,location:string,privateConnection:string) { - return this.pathTemplates.privateConnectionPathTemplate.render({ - project: project, - location: location, - private_connection: privateConnection, - }); - } - - /** - * Parse the project from PrivateConnection resource. - * - * @param {string} privateConnectionName - * A fully-qualified path representing PrivateConnection resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).project; - } - - /** - * Parse the location from PrivateConnection resource. - * - * @param {string} privateConnectionName - * A fully-qualified path representing PrivateConnection resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).location; - } - - /** - * Parse the private_connection from PrivateConnection resource. - * - * @param {string} privateConnectionName - * A fully-qualified path representing PrivateConnection resource. - * @returns {string} A string representing the private_connection. - */ - matchPrivateConnectionFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).private_connection; - } - - /** - * 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 subnet resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} private_cloud - * @param {string} subnet - * @returns {string} Resource name string. - */ - subnetPath(project:string,location:string,privateCloud:string,subnet:string) { - return this.pathTemplates.subnetPathTemplate.render({ - project: project, - location: location, - private_cloud: privateCloud, - subnet: subnet, - }); - } - - /** - * Parse the project from Subnet resource. - * - * @param {string} subnetName - * A fully-qualified path representing Subnet resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSubnetName(subnetName: string) { - return this.pathTemplates.subnetPathTemplate.match(subnetName).project; - } - - /** - * Parse the location from Subnet resource. - * - * @param {string} subnetName - * A fully-qualified path representing Subnet resource. - * @returns {string} A string representing the location. - */ - matchLocationFromSubnetName(subnetName: string) { - return this.pathTemplates.subnetPathTemplate.match(subnetName).location; - } - - /** - * Parse the private_cloud from Subnet resource. - * - * @param {string} subnetName - * A fully-qualified path representing Subnet resource. - * @returns {string} A string representing the private_cloud. - */ - matchPrivateCloudFromSubnetName(subnetName: string) { - return this.pathTemplates.subnetPathTemplate.match(subnetName).private_cloud; - } - - /** - * Parse the subnet from Subnet resource. - * - * @param {string} subnetName - * A fully-qualified path representing Subnet resource. - * @returns {string} A string representing the subnet. - */ - matchSubnetFromSubnetName(subnetName: string) { - return this.pathTemplates.subnetPathTemplate.match(subnetName).subnet; - } - - /** - * Return a fully-qualified vmwareEngineNetwork resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} vmware_engine_network - * @returns {string} Resource name string. - */ - vmwareEngineNetworkPath(project:string,location:string,vmwareEngineNetwork:string) { - return this.pathTemplates.vmwareEngineNetworkPathTemplate.render({ - project: project, - location: location, - vmware_engine_network: vmwareEngineNetwork, - }); - } - - /** - * Parse the project from VmwareEngineNetwork resource. - * - * @param {string} vmwareEngineNetworkName - * A fully-qualified path representing VmwareEngineNetwork resource. - * @returns {string} A string representing the project. - */ - matchProjectFromVmwareEngineNetworkName(vmwareEngineNetworkName: string) { - return this.pathTemplates.vmwareEngineNetworkPathTemplate.match(vmwareEngineNetworkName).project; - } - - /** - * Parse the location from VmwareEngineNetwork resource. - * - * @param {string} vmwareEngineNetworkName - * A fully-qualified path representing VmwareEngineNetwork resource. - * @returns {string} A string representing the location. - */ - matchLocationFromVmwareEngineNetworkName(vmwareEngineNetworkName: string) { - return this.pathTemplates.vmwareEngineNetworkPathTemplate.match(vmwareEngineNetworkName).location; - } - - /** - * Parse the vmware_engine_network from VmwareEngineNetwork resource. - * - * @param {string} vmwareEngineNetworkName - * A fully-qualified path representing VmwareEngineNetwork resource. - * @returns {string} A string representing the vmware_engine_network. - */ - matchVmwareEngineNetworkFromVmwareEngineNetworkName(vmwareEngineNetworkName: string) { - return this.pathTemplates.vmwareEngineNetworkPathTemplate.match(vmwareEngineNetworkName).vmware_engine_network; - } - - /** - * 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.vmwareEngineStub && !this._terminated) { - return this.vmwareEngineStub.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-vmwareengine/v1/src/v1/vmware_engine_client_config.json b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client_config.json deleted file mode 100644 index 6dbb458e7b2..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_client_config.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "interfaces": { - "google.cloud.vmwareengine.v1.VmwareEngine": { - "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": { - "ListPrivateClouds": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetPrivateCloud": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreatePrivateCloud": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdatePrivateCloud": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeletePrivateCloud": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UndeletePrivateCloud": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListClusters": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetCluster": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateCluster": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCluster": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteCluster": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSubnets": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetSubnet": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateSubnet": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListNodeTypes": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetNodeType": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ShowNsxCredentials": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ShowVcenterCredentials": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ResetNsxCredentials": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResetVcenterCredentials": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateHcxActivationKey": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListHcxActivationKeys": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetHcxActivationKey": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetNetworkPolicy": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListNetworkPolicies": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateNetworkPolicy": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNetworkPolicy": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNetworkPolicy": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateVmwareEngineNetwork": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateVmwareEngineNetwork": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteVmwareEngineNetwork": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetVmwareEngineNetwork": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListVmwareEngineNetworks": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreatePrivateConnection": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetPrivateConnection": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListPrivateConnections": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdatePrivateConnection": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeletePrivateConnection": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListPrivateConnectionPeeringRoutes": { - "timeout_millis": 120000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_proto_list.json b/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_proto_list.json deleted file mode 100644 index 72fd1db8924..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/src/v1/vmware_engine_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/vmwareengine/v1/vmwareengine.proto", - "../../protos/google/cloud/vmwareengine/v1/vmwareengine_resources.proto" -] diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 6615bf40c08..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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 vmwareengine = require('@google-cloud/vmwareengine'); - -function main() { - const vmwareEngineClient = new vmwareengine.VmwareEngineClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index ef6613306b6..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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 {VmwareEngineClient} from '@google-cloud/vmwareengine'; - -// check that the client class type name can be used -function doStuffWithVmwareEngineClient(client: VmwareEngineClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const vmwareEngineClient = new VmwareEngineClient(); - doStuffWithVmwareEngineClient(vmwareEngineClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/install.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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-vmwareengine/v1/test/gapic_vmware_engine_v1.ts b/owl-bot-staging/google-cloud-vmwareengine/v1/test/gapic_vmware_engine_v1.ts deleted file mode 100644 index c01c520841c..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/v1/test/gapic_vmware_engine_v1.ts +++ /dev/null @@ -1,7762 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 vmwareengineModule 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.VmwareEngineClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = vmwareengineModule.v1.VmwareEngineClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = vmwareengineModule.v1.VmwareEngineClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = vmwareengineModule.v1.VmwareEngineClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new vmwareengineModule.v1.VmwareEngineClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.vmwareEngineStub, undefined); - await client.initialize(); - assert(client.vmwareEngineStub); - }); - - it('has close method for the initialized client', done => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.vmwareEngineStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.vmwareEngineStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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('getPrivateCloud', () => { - it('invokes getPrivateCloud without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.PrivateCloud() - ); - client.innerApiCalls.getPrivateCloud = stubSimpleCall(expectedResponse); - const [response] = await client.getPrivateCloud(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateCloud without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.PrivateCloud() - ); - client.innerApiCalls.getPrivateCloud = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPrivateCloud( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateCloud|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateCloud with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPrivateCloud = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPrivateCloud(request), expectedError); - const actualRequest = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateCloud with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getPrivateCloud(request), expectedError); - }); - }); - - describe('getCluster', () => { - it('invokes getCluster without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCluster( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCluster(request), expectedError); - }); - }); - - describe('getSubnet', () => { - it('invokes getSubnet without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Subnet() - ); - client.innerApiCalls.getSubnet = stubSimpleCall(expectedResponse); - const [response] = await client.getSubnet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSubnet without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Subnet() - ); - client.innerApiCalls.getSubnet = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSubnet( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ISubnet|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSubnet with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSubnet = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSubnet(request), expectedError); - const actualRequest = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSubnet with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSubnet(request), expectedError); - }); - }); - - describe('getNodeType', () => { - it('invokes getNodeType without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.NodeType() - ); - client.innerApiCalls.getNodeType = stubSimpleCall(expectedResponse); - const [response] = await client.getNodeType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodeType without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.NodeType() - ); - client.innerApiCalls.getNodeType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNodeType( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INodeType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodeType with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNodeType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNodeType(request), expectedError); - const actualRequest = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodeType with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNodeType(request), expectedError); - }); - }); - - describe('showNsxCredentials', () => { - it('invokes showNsxCredentials without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Credentials() - ); - client.innerApiCalls.showNsxCredentials = stubSimpleCall(expectedResponse); - const [response] = await client.showNsxCredentials(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes showNsxCredentials without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Credentials() - ); - client.innerApiCalls.showNsxCredentials = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.showNsxCredentials( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICredentials|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes showNsxCredentials with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.showNsxCredentials = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.showNsxCredentials(request), expectedError); - const actualRequest = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes showNsxCredentials with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.showNsxCredentials(request), expectedError); - }); - }); - - describe('showVcenterCredentials', () => { - it('invokes showVcenterCredentials without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Credentials() - ); - client.innerApiCalls.showVcenterCredentials = stubSimpleCall(expectedResponse); - const [response] = await client.showVcenterCredentials(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes showVcenterCredentials without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Credentials() - ); - client.innerApiCalls.showVcenterCredentials = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.showVcenterCredentials( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICredentials|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes showVcenterCredentials with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.showVcenterCredentials = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.showVcenterCredentials(request), expectedError); - const actualRequest = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes showVcenterCredentials with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.showVcenterCredentials(request), expectedError); - }); - }); - - describe('getHcxActivationKey', () => { - it('invokes getHcxActivationKey without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.HcxActivationKey() - ); - client.innerApiCalls.getHcxActivationKey = stubSimpleCall(expectedResponse); - const [response] = await client.getHcxActivationKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getHcxActivationKey without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.HcxActivationKey() - ); - client.innerApiCalls.getHcxActivationKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getHcxActivationKey( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IHcxActivationKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getHcxActivationKey with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getHcxActivationKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getHcxActivationKey(request), expectedError); - const actualRequest = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getHcxActivationKey with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getHcxActivationKey(request), expectedError); - }); - }); - - describe('getNetworkPolicy', () => { - it('invokes getNetworkPolicy without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.NetworkPolicy() - ); - client.innerApiCalls.getNetworkPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getNetworkPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNetworkPolicy without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.NetworkPolicy() - ); - client.innerApiCalls.getNetworkPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNetworkPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INetworkPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNetworkPolicy with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNetworkPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNetworkPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNetworkPolicy with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNetworkPolicy(request), expectedError); - }); - }); - - describe('getVmwareEngineNetwork', () => { - it('invokes getVmwareEngineNetwork without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork() - ); - client.innerApiCalls.getVmwareEngineNetwork = stubSimpleCall(expectedResponse); - const [response] = await client.getVmwareEngineNetwork(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVmwareEngineNetwork without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork() - ); - client.innerApiCalls.getVmwareEngineNetwork = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getVmwareEngineNetwork( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVmwareEngineNetwork with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getVmwareEngineNetwork = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVmwareEngineNetwork(request), expectedError); - const actualRequest = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVmwareEngineNetwork with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getVmwareEngineNetwork(request), expectedError); - }); - }); - - describe('getPrivateConnection', () => { - it('invokes getPrivateConnection without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.PrivateConnection() - ); - client.innerApiCalls.getPrivateConnection = stubSimpleCall(expectedResponse); - const [response] = await client.getPrivateConnection(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateConnection without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.PrivateConnection() - ); - client.innerApiCalls.getPrivateConnection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPrivateConnection( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateConnection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateConnection with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPrivateConnection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateConnection with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getPrivateConnection(request), expectedError); - }); - }); - - describe('createPrivateCloud', () => { - it('invokes createPrivateCloud without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateCloud = stubLongRunningCall(expectedResponse); - const [operation] = await client.createPrivateCloud(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateCloud without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateCloud = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPrivateCloud( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateCloud with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateCloud = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createPrivateCloud(request), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateCloud with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createPrivateCloud(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreatePrivateCloudProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreatePrivateCloudProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreatePrivateCloudProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreatePrivateCloudProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updatePrivateCloud', () => { - it('invokes updatePrivateCloud without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() - ); - request.privateCloud ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); - request.privateCloud.name = defaultValue1; - const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePrivateCloud = stubLongRunningCall(expectedResponse); - const [operation] = await client.updatePrivateCloud(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePrivateCloud without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() - ); - request.privateCloud ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); - request.privateCloud.name = defaultValue1; - const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePrivateCloud = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updatePrivateCloud( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePrivateCloud with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() - ); - request.privateCloud ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); - request.privateCloud.name = defaultValue1; - const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePrivateCloud = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updatePrivateCloud(request), expectedError); - const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePrivateCloud with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() - ); - request.privateCloud ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); - request.privateCloud.name = defaultValue1; - const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updatePrivateCloud(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdatePrivateCloudProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdatePrivateCloudProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdatePrivateCloudProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdatePrivateCloudProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deletePrivateCloud', () => { - it('invokes deletePrivateCloud without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateCloud = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePrivateCloud(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateCloud without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateCloud = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePrivateCloud( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateCloud with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateCloud = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePrivateCloud(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateCloud with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePrivateCloud(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeletePrivateCloudProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeletePrivateCloudProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeletePrivateCloudProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeletePrivateCloudProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('undeletePrivateCloud', () => { - it('invokes undeletePrivateCloud without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.undeletePrivateCloud = stubLongRunningCall(expectedResponse); - const [operation] = await client.undeletePrivateCloud(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeletePrivateCloud without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.undeletePrivateCloud = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeletePrivateCloud( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeletePrivateCloud with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeletePrivateCloud = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.undeletePrivateCloud(request), expectedError); - const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeletePrivateCloud with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeletePrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.undeletePrivateCloud(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUndeletePrivateCloudProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUndeletePrivateCloudProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUndeletePrivateCloudProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUndeletePrivateCloudProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createCluster', () => { - it('invokes createCluster without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateClusterProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateClusterProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateCluster', () => { - it('invokes updateCluster without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateClusterProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateClusterProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteCluster', () => { - it('invokes deleteCluster without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteClusterProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteClusterProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateSubnet', () => { - it('invokes updateSubnet without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() - ); - request.subnet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); - request.subnet.name = defaultValue1; - const expectedHeaderRequestParams = `subnet.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSubnet = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSubnet(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSubnet without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() - ); - request.subnet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); - request.subnet.name = defaultValue1; - const expectedHeaderRequestParams = `subnet.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSubnet = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSubnet( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSubnet with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() - ); - request.subnet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); - request.subnet.name = defaultValue1; - const expectedHeaderRequestParams = `subnet.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSubnet = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSubnet(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSubnet with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() - ); - request.subnet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); - request.subnet.name = defaultValue1; - const expectedHeaderRequestParams = `subnet.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSubnet = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSubnet(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateSubnetProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateSubnetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateSubnetProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSubnetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('resetNsxCredentials', () => { - it('invokes resetNsxCredentials without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resetNsxCredentials = stubLongRunningCall(expectedResponse); - const [operation] = await client.resetNsxCredentials(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetNsxCredentials without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resetNsxCredentials = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetNsxCredentials( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetNsxCredentials with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetNsxCredentials = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.resetNsxCredentials(request), expectedError); - const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetNsxCredentials with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetNsxCredentials = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.resetNsxCredentials(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkResetNsxCredentialsProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkResetNsxCredentialsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkResetNsxCredentialsProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkResetNsxCredentialsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('resetVcenterCredentials', () => { - it('invokes resetVcenterCredentials without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resetVcenterCredentials = stubLongRunningCall(expectedResponse); - const [operation] = await client.resetVcenterCredentials(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetVcenterCredentials without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resetVcenterCredentials = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetVcenterCredentials( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetVcenterCredentials with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetVcenterCredentials = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.resetVcenterCredentials(request), expectedError); - const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetVcenterCredentials with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetVcenterCredentials = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.resetVcenterCredentials(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkResetVcenterCredentialsProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkResetVcenterCredentialsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkResetVcenterCredentialsProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkResetVcenterCredentialsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createHcxActivationKey', () => { - it('invokes createHcxActivationKey without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createHcxActivationKey = stubLongRunningCall(expectedResponse); - const [operation] = await client.createHcxActivationKey(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createHcxActivationKey without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createHcxActivationKey = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createHcxActivationKey( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createHcxActivationKey with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createHcxActivationKey = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createHcxActivationKey(request), expectedError); - const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createHcxActivationKey with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createHcxActivationKey = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createHcxActivationKey(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateHcxActivationKeyProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateHcxActivationKeyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateHcxActivationKeyProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateHcxActivationKeyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createNetworkPolicy', () => { - it('invokes createNetworkPolicy without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNetworkPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createNetworkPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNetworkPolicy without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNetworkPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNetworkPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNetworkPolicy with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNetworkPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createNetworkPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNetworkPolicy with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNetworkPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createNetworkPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateNetworkPolicyProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateNetworkPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateNetworkPolicyProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateNetworkPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateNetworkPolicy', () => { - it('invokes updateNetworkPolicy without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() - ); - request.networkPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); - request.networkPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `network_policy.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateNetworkPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateNetworkPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNetworkPolicy without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() - ); - request.networkPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); - request.networkPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `network_policy.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateNetworkPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNetworkPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNetworkPolicy with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() - ); - request.networkPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); - request.networkPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `network_policy.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNetworkPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateNetworkPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNetworkPolicy with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() - ); - request.networkPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); - request.networkPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `network_policy.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNetworkPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateNetworkPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateNetworkPolicyProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateNetworkPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateNetworkPolicyProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateNetworkPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteNetworkPolicy', () => { - it('invokes deleteNetworkPolicy without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteNetworkPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNetworkPolicy without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNetworkPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNetworkPolicy with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteNetworkPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNetworkPolicy with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteNetworkPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteNetworkPolicyProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteNetworkPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteNetworkPolicyProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteNetworkPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createVmwareEngineNetwork', () => { - it('invokes createVmwareEngineNetwork without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCall(expectedResponse); - const [operation] = await client.createVmwareEngineNetwork(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createVmwareEngineNetwork without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createVmwareEngineNetwork( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createVmwareEngineNetwork with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createVmwareEngineNetwork(request), expectedError); - const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createVmwareEngineNetwork with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createVmwareEngineNetwork(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateVmwareEngineNetworkProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateVmwareEngineNetworkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateVmwareEngineNetworkProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateVmwareEngineNetworkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateVmwareEngineNetwork', () => { - it('invokes updateVmwareEngineNetwork without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() - ); - request.vmwareEngineNetwork ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); - request.vmwareEngineNetwork.name = defaultValue1; - const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateVmwareEngineNetwork(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateVmwareEngineNetwork without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() - ); - request.vmwareEngineNetwork ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); - request.vmwareEngineNetwork.name = defaultValue1; - const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateVmwareEngineNetwork( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateVmwareEngineNetwork with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() - ); - request.vmwareEngineNetwork ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); - request.vmwareEngineNetwork.name = defaultValue1; - const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateVmwareEngineNetwork(request), expectedError); - const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateVmwareEngineNetwork with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() - ); - request.vmwareEngineNetwork ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); - request.vmwareEngineNetwork.name = defaultValue1; - const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateVmwareEngineNetwork(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateVmwareEngineNetworkProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateVmwareEngineNetworkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateVmwareEngineNetworkProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateVmwareEngineNetworkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteVmwareEngineNetwork', () => { - it('invokes deleteVmwareEngineNetwork without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteVmwareEngineNetwork(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteVmwareEngineNetwork without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteVmwareEngineNetwork( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteVmwareEngineNetwork with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteVmwareEngineNetwork(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteVmwareEngineNetwork with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteVmwareEngineNetwork(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteVmwareEngineNetworkProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteVmwareEngineNetworkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteVmwareEngineNetworkProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteVmwareEngineNetworkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createPrivateConnection', () => { - it('invokes createPrivateConnection without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.createPrivateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateConnection without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPrivateConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateConnection with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createPrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateConnection with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createPrivateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreatePrivateConnectionProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreatePrivateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreatePrivateConnectionProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreatePrivateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updatePrivateConnection', () => { - it('invokes updatePrivateConnection without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() - ); - request.privateConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); - request.privateConnection.name = defaultValue1; - const expectedHeaderRequestParams = `private_connection.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePrivateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.updatePrivateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePrivateConnection without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() - ); - request.privateConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); - request.privateConnection.name = defaultValue1; - const expectedHeaderRequestParams = `private_connection.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePrivateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updatePrivateConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePrivateConnection with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() - ); - request.privateConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); - request.privateConnection.name = defaultValue1; - const expectedHeaderRequestParams = `private_connection.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePrivateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updatePrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePrivateConnection with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() - ); - request.privateConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); - request.privateConnection.name = defaultValue1; - const expectedHeaderRequestParams = `private_connection.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updatePrivateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdatePrivateConnectionProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdatePrivateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdatePrivateConnectionProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdatePrivateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deletePrivateConnection', () => { - it('invokes deletePrivateConnection without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePrivateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateConnection without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePrivateConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateConnection with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateConnection with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePrivateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeletePrivateConnectionProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeletePrivateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeletePrivateConnectionProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeletePrivateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listPrivateClouds', () => { - it('invokes listPrivateClouds without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - ]; - client.innerApiCalls.listPrivateClouds = stubSimpleCall(expectedResponse); - const [response] = await client.listPrivateClouds(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateClouds without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - ]; - client.innerApiCalls.listPrivateClouds = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPrivateClouds( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateCloud[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateClouds with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPrivateClouds = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPrivateClouds(request), expectedError); - const actualRequest = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateCloudsStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - ]; - client.descriptors.page.listPrivateClouds.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPrivateCloudsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PrivateCloud[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateCloud) => { - 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.listPrivateClouds.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateClouds, request)); - assert( - (client.descriptors.page.listPrivateClouds.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPrivateCloudsStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateClouds.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPrivateCloudsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PrivateCloud[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateCloud) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPrivateClouds.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateClouds, request)); - assert( - (client.descriptors.page.listPrivateClouds.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPrivateClouds without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - ]; - client.descriptors.page.listPrivateClouds.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IPrivateCloud[] = []; - const iterable = client.listPrivateCloudsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPrivateClouds with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateClouds.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPrivateCloudsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IPrivateCloud[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listClusters', () => { - it('invokes listClusters without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - ]; - client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listClusters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClusters without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - ]; - client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listClusters( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICluster[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClusters with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listClusters(request), expectedError); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClustersStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - ]; - client.descriptors.page.listClusters.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.Cluster[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Cluster) => { - 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.listClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); - assert( - (client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listClustersStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listClusters.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.Cluster[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Cluster) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); - assert( - (client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listClusters without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - ]; - client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.ICluster[] = []; - const iterable = client.listClustersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listClusters with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listClustersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.ICluster[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSubnets', () => { - it('invokes listSubnets without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - ]; - client.innerApiCalls.listSubnets = stubSimpleCall(expectedResponse); - const [response] = await client.listSubnets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSubnets without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - ]; - client.innerApiCalls.listSubnets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSubnets( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ISubnet[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSubnets with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSubnets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSubnets(request), expectedError); - const actualRequest = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSubnetsStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - ]; - client.descriptors.page.listSubnets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSubnetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.Subnet[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Subnet) => { - 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.listSubnets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSubnets, request)); - assert( - (client.descriptors.page.listSubnets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSubnetsStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSubnets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSubnetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.Subnet[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Subnet) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSubnets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSubnets, request)); - assert( - (client.descriptors.page.listSubnets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSubnets without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - ]; - client.descriptors.page.listSubnets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.ISubnet[] = []; - const iterable = client.listSubnetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSubnets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSubnets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSubnets with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSubnets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSubnetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.ISubnet[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSubnets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSubnets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listNodeTypes', () => { - it('invokes listNodeTypes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - ]; - client.innerApiCalls.listNodeTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listNodeTypes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodeTypes without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - ]; - client.innerApiCalls.listNodeTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNodeTypes( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INodeType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodeTypes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNodeTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNodeTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodeTypesStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - ]; - client.descriptors.page.listNodeTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNodeTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.NodeType[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NodeType) => { - 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.listNodeTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodeTypes, request)); - assert( - (client.descriptors.page.listNodeTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNodeTypesStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodeTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNodeTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.NodeType[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NodeType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNodeTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodeTypes, request)); - assert( - (client.descriptors.page.listNodeTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodeTypes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - ]; - client.descriptors.page.listNodeTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.INodeType[] = []; - const iterable = client.listNodeTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodeTypes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodeTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNodeTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.INodeType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listHcxActivationKeys', () => { - it('invokes listHcxActivationKeys without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - ]; - client.innerApiCalls.listHcxActivationKeys = stubSimpleCall(expectedResponse); - const [response] = await client.listHcxActivationKeys(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHcxActivationKeys without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - ]; - client.innerApiCalls.listHcxActivationKeys = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listHcxActivationKeys( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IHcxActivationKey[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHcxActivationKeys with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listHcxActivationKeys = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listHcxActivationKeys(request), expectedError); - const actualRequest = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHcxActivationKeysStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - ]; - client.descriptors.page.listHcxActivationKeys.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listHcxActivationKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.HcxActivationKey[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.HcxActivationKey) => { - 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.listHcxActivationKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHcxActivationKeys, request)); - assert( - (client.descriptors.page.listHcxActivationKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listHcxActivationKeysStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listHcxActivationKeys.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listHcxActivationKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.HcxActivationKey[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.HcxActivationKey) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listHcxActivationKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHcxActivationKeys, request)); - assert( - (client.descriptors.page.listHcxActivationKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listHcxActivationKeys without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - ]; - client.descriptors.page.listHcxActivationKeys.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IHcxActivationKey[] = []; - const iterable = client.listHcxActivationKeysAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listHcxActivationKeys with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listHcxActivationKeys.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listHcxActivationKeysAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IHcxActivationKey[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listNetworkPolicies', () => { - it('invokes listNetworkPolicies without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - ]; - client.innerApiCalls.listNetworkPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listNetworkPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNetworkPolicies without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - ]; - client.innerApiCalls.listNetworkPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNetworkPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INetworkPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNetworkPolicies with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNetworkPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNetworkPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNetworkPoliciesStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - ]; - client.descriptors.page.listNetworkPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNetworkPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.NetworkPolicy[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NetworkPolicy) => { - 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.listNetworkPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNetworkPolicies, request)); - assert( - (client.descriptors.page.listNetworkPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNetworkPoliciesStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNetworkPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNetworkPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.NetworkPolicy[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NetworkPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNetworkPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNetworkPolicies, request)); - assert( - (client.descriptors.page.listNetworkPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNetworkPolicies without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - ]; - client.descriptors.page.listNetworkPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.INetworkPolicy[] = []; - const iterable = client.listNetworkPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNetworkPolicies with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNetworkPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNetworkPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.INetworkPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listVmwareEngineNetworks', () => { - it('invokes listVmwareEngineNetworks without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - ]; - client.innerApiCalls.listVmwareEngineNetworks = stubSimpleCall(expectedResponse); - const [response] = await client.listVmwareEngineNetworks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVmwareEngineNetworks without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - ]; - client.innerApiCalls.listVmwareEngineNetworks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listVmwareEngineNetworks( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVmwareEngineNetworks with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listVmwareEngineNetworks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVmwareEngineNetworks(request), expectedError); - const actualRequest = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVmwareEngineNetworksStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - ]; - client.descriptors.page.listVmwareEngineNetworks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listVmwareEngineNetworksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork) => { - 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.listVmwareEngineNetworks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVmwareEngineNetworks, request)); - assert( - (client.descriptors.page.listVmwareEngineNetworks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listVmwareEngineNetworksStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listVmwareEngineNetworks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listVmwareEngineNetworksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listVmwareEngineNetworks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVmwareEngineNetworks, request)); - assert( - (client.descriptors.page.listVmwareEngineNetworks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listVmwareEngineNetworks without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - ]; - client.descriptors.page.listVmwareEngineNetworks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[] = []; - const iterable = client.listVmwareEngineNetworksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listVmwareEngineNetworks with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listVmwareEngineNetworks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listVmwareEngineNetworksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listPrivateConnections', () => { - it('invokes listPrivateConnections without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - ]; - client.innerApiCalls.listPrivateConnections = stubSimpleCall(expectedResponse); - const [response] = await client.listPrivateConnections(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnections without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - ]; - client.innerApiCalls.listPrivateConnections = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPrivateConnections( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateConnection[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnections with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPrivateConnections = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPrivateConnections(request), expectedError); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnectionsStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - ]; - client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPrivateConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PrivateConnection[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateConnection) => { - 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.listPrivateConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); - assert( - (client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPrivateConnectionsStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPrivateConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PrivateConnection[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateConnection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); - assert( - (client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPrivateConnections without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - ]; - client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IPrivateConnection[] = []; - const iterable = client.listPrivateConnectionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPrivateConnections with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPrivateConnectionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IPrivateConnection[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listPrivateConnectionPeeringRoutes', () => { - it('invokes listPrivateConnectionPeeringRoutes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.innerApiCalls.listPrivateConnectionPeeringRoutes = stubSimpleCall(expectedResponse); - const [response] = await client.listPrivateConnectionPeeringRoutes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnectionPeeringRoutes without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.innerApiCalls.listPrivateConnectionPeeringRoutes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPrivateConnectionPeeringRoutes( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPeeringRoute[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnectionPeeringRoutes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPrivateConnectionPeeringRoutes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPrivateConnectionPeeringRoutes(request), expectedError); - const actualRequest = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnectionPeeringRoutesStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPrivateConnectionPeeringRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { - 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.listPrivateConnectionPeeringRoutes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnectionPeeringRoutes, request)); - assert( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPrivateConnectionPeeringRoutesStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPrivateConnectionPeeringRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnectionPeeringRoutes, request)); - assert( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPrivateConnectionPeeringRoutes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = []; - const iterable = client.listPrivateConnectionPeeringRoutesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPrivateConnectionPeeringRoutes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPrivateConnectionPeeringRoutesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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 vmwareengineModule.v1.VmwareEngineClient({ - 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('cluster', () => { - const fakePath = "/rendered/path/cluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - cluster: "clusterValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.clusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath("projectValue", "locationValue", "privateCloudValue", "clusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClusterName', () => { - const result = client.matchLocationFromClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromClusterName', () => { - const result = client.matchPrivateCloudFromClusterName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('hcxActivationKey', () => { - const fakePath = "/rendered/path/hcxActivationKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - hcx_activation_key: "hcxActivationKeyValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.hcxActivationKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.hcxActivationKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('hcxActivationKeyPath', () => { - const result = client.hcxActivationKeyPath("projectValue", "locationValue", "privateCloudValue", "hcxActivationKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.hcxActivationKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromHcxActivationKeyName', () => { - const result = client.matchProjectFromHcxActivationKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromHcxActivationKeyName', () => { - const result = client.matchLocationFromHcxActivationKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromHcxActivationKeyName', () => { - const result = client.matchPrivateCloudFromHcxActivationKeyName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchHcxActivationKeyFromHcxActivationKeyName', () => { - const result = client.matchHcxActivationKeyFromHcxActivationKeyName(fakePath); - assert.strictEqual(result, "hcxActivationKeyValue"); - assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - 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('networkPolicy', () => { - const fakePath = "/rendered/path/networkPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - network_policy: "networkPolicyValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.networkPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPolicyPath', () => { - const result = client.networkPolicyPath("projectValue", "locationValue", "networkPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkPolicyName', () => { - const result = client.matchProjectFromNetworkPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromNetworkPolicyName', () => { - const result = client.matchLocationFromNetworkPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkPolicyFromNetworkPolicyName', () => { - const result = client.matchNetworkPolicyFromNetworkPolicyName(fakePath); - assert.strictEqual(result, "networkPolicyValue"); - assert((client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('nodeType', () => { - const fakePath = "/rendered/path/nodeType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - node_type: "nodeTypeValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.nodeTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodeTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodeTypePath', () => { - const result = client.nodeTypePath("projectValue", "locationValue", "nodeTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodeTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeTypeName', () => { - const result = client.matchProjectFromNodeTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodeTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromNodeTypeName', () => { - const result = client.matchLocationFromNodeTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.nodeTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeTypeFromNodeTypeName', () => { - const result = client.matchNodeTypeFromNodeTypeName(fakePath); - assert.strictEqual(result, "nodeTypeValue"); - assert((client.pathTemplates.nodeTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('privateCloud', () => { - const fakePath = "/rendered/path/privateCloud"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.privateCloudPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.privateCloudPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('privateCloudPath', () => { - const result = client.privateCloudPath("projectValue", "locationValue", "privateCloudValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.privateCloudPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPrivateCloudName', () => { - const result = client.matchProjectFromPrivateCloudName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.privateCloudPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPrivateCloudName', () => { - const result = client.matchLocationFromPrivateCloudName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.privateCloudPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromPrivateCloudName', () => { - const result = client.matchPrivateCloudFromPrivateCloudName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.privateCloudPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('privateConnection', () => { - const fakePath = "/rendered/path/privateConnection"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_connection: "privateConnectionValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.privateConnectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.privateConnectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('privateConnectionPath', () => { - const result = client.privateConnectionPath("projectValue", "locationValue", "privateConnectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.privateConnectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPrivateConnectionName', () => { - const result = client.matchProjectFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPrivateConnectionName', () => { - const result = client.matchLocationFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateConnectionFromPrivateConnectionName', () => { - const result = client.matchPrivateConnectionFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "privateConnectionValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - 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('subnet', () => { - const fakePath = "/rendered/path/subnet"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - subnet: "subnetValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.subnetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.subnetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('subnetPath', () => { - const result = client.subnetPath("projectValue", "locationValue", "privateCloudValue", "subnetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.subnetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSubnetName', () => { - const result = client.matchProjectFromSubnetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSubnetName', () => { - const result = client.matchLocationFromSubnetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromSubnetName', () => { - const result = client.matchPrivateCloudFromSubnetName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSubnetFromSubnetName', () => { - const result = client.matchSubnetFromSubnetName(fakePath); - assert.strictEqual(result, "subnetValue"); - assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('vmwareEngineNetwork', () => { - const fakePath = "/rendered/path/vmwareEngineNetwork"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - vmware_engine_network: "vmwareEngineNetworkValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.vmwareEngineNetworkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.vmwareEngineNetworkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('vmwareEngineNetworkPath', () => { - const result = client.vmwareEngineNetworkPath("projectValue", "locationValue", "vmwareEngineNetworkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromVmwareEngineNetworkName', () => { - const result = client.matchProjectFromVmwareEngineNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromVmwareEngineNetworkName', () => { - const result = client.matchLocationFromVmwareEngineNetworkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVmwareEngineNetworkFromVmwareEngineNetworkName', () => { - const result = client.matchVmwareEngineNetworkFromVmwareEngineNetworkName(fakePath); - assert.strictEqual(result, "vmwareEngineNetworkValue"); - assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-vmwareengine/v1/tsconfig.json b/owl-bot-staging/google-cloud-vmwareengine/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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-vmwareengine/v1/webpack.config.js b/owl-bot-staging/google-cloud-vmwareengine/v1/webpack.config.js deleted file mode 100644 index d5271c69e90..00000000000 --- a/owl-bot-staging/google-cloud-vmwareengine/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: 'VmwareEngine', - filename: './vmware-engine.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-vpcaccess/v1/.eslintignore b/owl-bot-staging/google-cloud-vpcaccess/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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-vpcaccess/v1/.eslintrc.json b/owl-bot-staging/google-cloud-vpcaccess/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/.gitignore b/owl-bot-staging/google-cloud-vpcaccess/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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-vpcaccess/v1/.jsdoc.js b/owl-bot-staging/google-cloud-vpcaccess/v1/.jsdoc.js deleted file mode 100644 index 4f1be78d773..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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/vpc-access', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/.mocharc.js b/owl-bot-staging/google-cloud-vpcaccess/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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-vpcaccess/v1/.prettierrc.js b/owl-bot-staging/google-cloud-vpcaccess/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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-vpcaccess/v1/README.md b/owl-bot-staging/google-cloud-vpcaccess/v1/README.md deleted file mode 100644 index d070a08b5c9..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Vpcaccess: Nodejs Client diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/package.json b/owl-bot-staging/google-cloud-vpcaccess/v1/package.json deleted file mode 100644 index 050c4474863..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/vpc-access", - "version": "0.1.0", - "description": "Vpcaccess client for Node.js", - "repository": "googleapis/nodejs-vpcaccess", - "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 vpcaccess", - "vpcaccess", - "vpc access 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-vpcaccess/v1/protos/google/cloud/vpcaccess/v1/vpc_access.proto b/owl-bot-staging/google-cloud-vpcaccess/v1/protos/google/cloud/vpcaccess/v1/vpc_access.proto deleted file mode 100644 index 21bf77757e6..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/protos/google/cloud/vpcaccess/v1/vpc_access.proto +++ /dev/null @@ -1,248 +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.vpcaccess.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 csharp_namespace = "Google.Cloud.VpcAccess.V1"; -option go_package = "cloud.google.com/go/vpcaccess/apiv1/vpcaccesspb;vpcaccesspb"; -option java_multiple_files = true; -option java_outer_classname = "VpcAccessProto"; -option java_package = "com.google.cloud.vpcaccess.v1"; -option php_namespace = "Google\\Cloud\\VpcAccess\\V1"; -option ruby_package = "Google::Cloud::VpcAccess::V1"; - -// Serverless VPC Access API allows users to create and manage connectors for -// App Engine, Cloud Functions and Cloud Run to have internal connections to -// Virtual Private Cloud networks. -service VpcAccessService { - option (google.api.default_host) = "vpcaccess.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a Serverless VPC Access connector, returns an operation. - rpc CreateConnector(CreateConnectorRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/connectors" - body: "connector" - }; - option (google.api.method_signature) = "parent,connector_id,connector"; - option (google.longrunning.operation_info) = { - response_type: "Connector" - metadata_type: "OperationMetadata" - }; - } - - // Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource - // does not exist. - rpc GetConnector(GetConnectorRequest) returns (Connector) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/connectors/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists Serverless VPC Access connectors. - rpc ListConnectors(ListConnectorsRequest) returns (ListConnectorsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/connectors" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the - // resource does not exist. - rpc DeleteConnector(DeleteConnectorRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/connectors/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// Definition of a Serverless VPC Access connector. -message Connector { - option (google.api.resource) = { - type: "vpcaccess.googleapis.com/Connector" - pattern: "projects/{project}/locations/{location}/connectors/{connector}" - }; - - // State of a connector. - enum State { - // Invalid state. - STATE_UNSPECIFIED = 0; - - // Connector is deployed and ready to receive traffic. - READY = 1; - - // An Insert operation is in progress. Transient condition. - CREATING = 2; - - // A Delete operation is in progress. Transient condition. - DELETING = 3; - - // Connector is in a bad state, manual deletion recommended. - ERROR = 4; - - // The connector is being updated. - UPDATING = 5; - } - - // The subnet in which to house the connector - message Subnet { - // Subnet name (relative, not fully qualified). - // E.g. if the full subnet selfLink is - // https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetName} - // the correct input for this field would be {subnetName} - string name = 1; - - // Project in which the subnet exists. - // If not set, this project is assumed to be the project for which - // the connector create request was issued. - string project_id = 2; - } - - // The resource name in the format `projects/*/locations/*/connectors/*`. - string name = 1; - - // Name of a VPC network. - string network = 2; - - // The range of internal addresses that follows RFC 4632 notation. - // Example: `10.132.0.0/28`. - string ip_cidr_range = 3; - - // Output only. State of the VPC access connector. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Minimum throughput of the connector in Mbps. Default and min is 200. - int32 min_throughput = 5; - - // Maximum throughput of the connector in Mbps. Default is 300, max is 1000. - int32 max_throughput = 6; - - // Output only. List of projects using the connector. - repeated string connected_projects = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The subnet in which to house the VPC Access Connector. - Subnet subnet = 8; - - // Machine type of VM Instance underlying connector. Default is e2-micro - string machine_type = 10; - - // Minimum value of instances in autoscaling group underlying the connector. - int32 min_instances = 11; - - // Maximum value of instances in autoscaling group underlying the connector. - int32 max_instances = 12; -} - -// Request for creating a Serverless VPC Access connector. -message CreateConnectorRequest { - // Required. The project and location in which the configuration 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. The ID to use for this connector. - string connector_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Resource to create. - Connector connector = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for getting a Serverless VPC Access connector. -message GetConnectorRequest { - // Required. Name of a Serverless VPC Access connector to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vpcaccess.googleapis.com/Connector" - } - ]; -} - -// Request for listing Serverless VPC Access connectors in a location. -message ListConnectorsRequest { - // Required. The project and location from which the routes should be listed. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Maximum number of functions to return per call. - int32 page_size = 2; - - // Continuation token. - string page_token = 3; -} - -// Response for listing Serverless VPC Access connectors. -message ListConnectorsResponse { - // List of Serverless VPC Access connectors. - repeated Connector connectors = 1; - - // Continuation token. - string next_page_token = 2; -} - -// Request for deleting a Serverless VPC Access connector. -message DeleteConnectorRequest { - // Required. Name of a Serverless VPC Access connector to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vpcaccess.googleapis.com/Connector" - } - ]; -} - -// Metadata for google.longrunning.Operation. -message OperationMetadata { - // Output only. Method that initiated the operation e.g. - // google.cloud.vpcaccess.v1.Connectors.CreateConnector. - string method = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when the operation was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when the operation completed. - google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the resource that this operation is acting on e.g. - // projects/my-project/locations/us-central1/connectors/v1. - string target = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "vpcaccess.googleapis.com/Connector" - } - ]; -} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json deleted file mode 100644 index 577467cc1b3..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-vpcaccess", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.vpcaccess.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "vpcaccess_v1_generated_VpcAccessService_CreateConnector_async", - "title": "VpcAccessService createConnector Sample", - "origin": "API_DEFINITION", - "description": " Creates a Serverless VPC Access connector, returns an operation.", - "canonical": true, - "file": "vpc_access_service.create_connector.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConnector", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.CreateConnector", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "connector_id", - "type": "TYPE_STRING" - }, - { - "name": "connector", - "type": ".google.cloud.vpcaccess.v1.Connector" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VpcAccessServiceClient", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessServiceClient" - }, - "method": { - "shortName": "CreateConnector", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.CreateConnector", - "service": { - "shortName": "VpcAccessService", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService" - } - } - } - }, - { - "regionTag": "vpcaccess_v1_generated_VpcAccessService_GetConnector_async", - "title": "VpcAccessService getConnector Sample", - "origin": "API_DEFINITION", - "description": " Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.", - "canonical": true, - "file": "vpc_access_service.get_connector.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConnector", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.GetConnector", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vpcaccess.v1.Connector", - "client": { - "shortName": "VpcAccessServiceClient", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessServiceClient" - }, - "method": { - "shortName": "GetConnector", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.GetConnector", - "service": { - "shortName": "VpcAccessService", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService" - } - } - } - }, - { - "regionTag": "vpcaccess_v1_generated_VpcAccessService_ListConnectors_async", - "title": "VpcAccessService listConnectors Sample", - "origin": "API_DEFINITION", - "description": " Lists Serverless VPC Access connectors.", - "canonical": true, - "file": "vpc_access_service.list_connectors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConnectors", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.ListConnectors", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vpcaccess.v1.ListConnectorsResponse", - "client": { - "shortName": "VpcAccessServiceClient", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessServiceClient" - }, - "method": { - "shortName": "ListConnectors", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.ListConnectors", - "service": { - "shortName": "VpcAccessService", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService" - } - } - } - }, - { - "regionTag": "vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async", - "title": "VpcAccessService deleteConnector Sample", - "origin": "API_DEFINITION", - "description": " Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.", - "canonical": true, - "file": "vpc_access_service.delete_connector.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteConnector", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.DeleteConnector", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VpcAccessServiceClient", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessServiceClient" - }, - "method": { - "shortName": "DeleteConnector", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService.DeleteConnector", - "service": { - "shortName": "VpcAccessService", - "fullName": "google.cloud.vpcaccess.v1.VpcAccessService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.create_connector.js b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.create_connector.js deleted file mode 100644 index 8d029f6dafd..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.create_connector.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, connectorId, connector) { - // [START vpcaccess_v1_generated_VpcAccessService_CreateConnector_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 configuration should be created, - * specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Required. The ID to use for this connector. - */ - // const connectorId = 'abc123' - /** - * Required. Resource to create. - */ - // const connector = {} - - // Imports the Vpcaccess library - const {VpcAccessServiceClient} = require('@google-cloud/vpc-access').v1; - - // Instantiates a client - const vpcaccessClient = new VpcAccessServiceClient(); - - async function callCreateConnector() { - // Construct request - const request = { - parent, - connectorId, - connector, - }; - - // Run request - const [operation] = await vpcaccessClient.createConnector(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateConnector(); - // [END vpcaccess_v1_generated_VpcAccessService_CreateConnector_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.delete_connector.js b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.delete_connector.js deleted file mode 100644 index 2c45649a79c..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.delete_connector.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 vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 a Serverless VPC Access connector to delete. - */ - // const name = 'abc123' - - // Imports the Vpcaccess library - const {VpcAccessServiceClient} = require('@google-cloud/vpc-access').v1; - - // Instantiates a client - const vpcaccessClient = new VpcAccessServiceClient(); - - async function callDeleteConnector() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await vpcaccessClient.deleteConnector(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteConnector(); - // [END vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.get_connector.js b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.get_connector.js deleted file mode 100644 index 95900bed613..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.get_connector.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 vpcaccess_v1_generated_VpcAccessService_GetConnector_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 a Serverless VPC Access connector to get. - */ - // const name = 'abc123' - - // Imports the Vpcaccess library - const {VpcAccessServiceClient} = require('@google-cloud/vpc-access').v1; - - // Instantiates a client - const vpcaccessClient = new VpcAccessServiceClient(); - - async function callGetConnector() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await vpcaccessClient.getConnector(request); - console.log(response); - } - - callGetConnector(); - // [END vpcaccess_v1_generated_VpcAccessService_GetConnector_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.list_connectors.js b/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.list_connectors.js deleted file mode 100644 index f72f81d331a..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/samples/generated/v1/vpc_access_service.list_connectors.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(parent) { - // [START vpcaccess_v1_generated_VpcAccessService_ListConnectors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 routes should be listed. - */ - // const parent = 'abc123' - /** - * Maximum number of functions to return per call. - */ - // const pageSize = 1234 - /** - * Continuation token. - */ - // const pageToken = 'abc123' - - // Imports the Vpcaccess library - const {VpcAccessServiceClient} = require('@google-cloud/vpc-access').v1; - - // Instantiates a client - const vpcaccessClient = new VpcAccessServiceClient(); - - async function callListConnectors() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await vpcaccessClient.listConnectorsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConnectors(); - // [END vpcaccess_v1_generated_VpcAccessService_ListConnectors_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/index.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/src/index.ts deleted file mode 100644 index 3212970a66d..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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 VpcAccessServiceClient = v1.VpcAccessServiceClient; -type VpcAccessServiceClient = v1.VpcAccessServiceClient; -export {v1, VpcAccessServiceClient}; -export default {v1, VpcAccessServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 66ad79ef471..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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.vpcaccess.v1", - "libraryPackage": "@google-cloud/vpc-access", - "services": { - "VpcAccessService": { - "clients": { - "grpc": { - "libraryClient": "VpcAccessServiceClient", - "rpcs": { - "GetConnector": { - "methods": [ - "getConnector" - ] - }, - "CreateConnector": { - "methods": [ - "createConnector" - ] - }, - "DeleteConnector": { - "methods": [ - "deleteConnector" - ] - }, - "ListConnectors": { - "methods": [ - "listConnectors", - "listConnectorsStream", - "listConnectorsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "VpcAccessServiceClient", - "rpcs": { - "GetConnector": { - "methods": [ - "getConnector" - ] - }, - "CreateConnector": { - "methods": [ - "createConnector" - ] - }, - "DeleteConnector": { - "methods": [ - "deleteConnector" - ] - }, - "ListConnectors": { - "methods": [ - "listConnectors", - "listConnectorsStream", - "listConnectorsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/index.ts deleted file mode 100644 index 233301ed42d..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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 {VpcAccessServiceClient} from './vpc_access_service_client'; diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client.ts deleted file mode 100644 index 9ca2f0253ca..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_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, 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/vpc_access_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './vpc_access_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Serverless VPC Access API allows users to create and manage connectors for - * App Engine, Cloud Functions and Cloud Run to have internal connections to - * Virtual Private Cloud networks. - * @class - * @memberof v1 - */ -export class VpcAccessServiceClient { - 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; - vpcAccessServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of VpcAccessServiceClient. - * - * @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 VpcAccessServiceClient({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 VpcAccessServiceClient; - 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 = { - connectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connectors/{connector}' - ), - 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 = { - listConnectors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'connectors') - }; - - 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=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createConnectorResponse = protoFilesRoot.lookup( - '.google.cloud.vpcaccess.v1.Connector') as gax.protobuf.Type; - const createConnectorMetadata = protoFilesRoot.lookup( - '.google.cloud.vpcaccess.v1.OperationMetadata') as gax.protobuf.Type; - const deleteConnectorResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteConnectorMetadata = protoFilesRoot.lookup( - '.google.cloud.vpcaccess.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createConnector: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createConnectorResponse.decode.bind(createConnectorResponse), - createConnectorMetadata.decode.bind(createConnectorMetadata)), - deleteConnector: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteConnectorResponse.decode.bind(deleteConnectorResponse), - deleteConnectorMetadata.decode.bind(deleteConnectorMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.vpcaccess.v1.VpcAccessService', 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.vpcAccessServiceStub) { - return this.vpcAccessServiceStub; - } - - // Put together the "service stub" for - // google.cloud.vpcaccess.v1.VpcAccessService. - this.vpcAccessServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.vpcaccess.v1.VpcAccessService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.vpcaccess.v1.VpcAccessService, - 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 vpcAccessServiceStubMethods = - ['createConnector', 'getConnector', 'listConnectors', 'deleteConnector']; - for (const methodName of vpcAccessServiceStubMethods) { - const callPromise = this.vpcAccessServiceStub.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.vpcAccessServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'vpcaccess.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 'vpcaccess.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 a Serverless VPC Access connector. Returns NOT_FOUND if the resource - * does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of a Serverless VPC Access connector 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.vpcaccess.v1.Connector|Connector}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vpc_access_service.get_connector.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_GetConnector_async - */ - getConnector( - request?: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|undefined, {}|undefined - ]>; - getConnector( - request: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, - {}|null|undefined>): void; - getConnector( - request: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, - callback: Callback< - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, - {}|null|undefined>): void; - getConnector( - request?: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConnector(request, options, callback); - } - -/** - * Creates a Serverless VPC Access connector, returns an operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location in which the configuration should be created, - * specified in the format `projects/* /locations/*`. - * @param {string} request.connectorId - * Required. The ID to use for this connector. - * @param {google.cloud.vpcaccess.v1.Connector} request.connector - * Required. Resource 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/v1/vpc_access_service.create_connector.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_CreateConnector_async - */ - createConnector( - request?: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createConnector( - request: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnector( - request: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnector( - request?: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConnector(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createConnector()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vpc_access_service.create_connector.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_CreateConnector_async - */ - async checkCreateConnectorProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnector, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the - * resource does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of a Serverless VPC Access connector to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vpc_access_service.delete_connector.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async - */ - deleteConnector( - request?: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteConnector( - request: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnector( - request: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnector( - request?: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteConnector(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteConnector()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vpc_access_service.delete_connector.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async - */ - async checkDeleteConnectorProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnector, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Serverless VPC Access connectors. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the routes should be listed. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * Continuation 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.vpcaccess.v1.Connector|Connector}. - * 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 `listConnectorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listConnectors( - request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vpcaccess.v1.IConnector[], - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest|null, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse - ]>; - listConnectors( - request: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, - protos.google.cloud.vpcaccess.v1.IConnector>): void; - listConnectors( - request: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - callback: PaginationCallback< - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, - protos.google.cloud.vpcaccess.v1.IConnector>): void; - listConnectors( - request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, - protos.google.cloud.vpcaccess.v1.IConnector>, - callback?: PaginationCallback< - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, - protos.google.cloud.vpcaccess.v1.IConnector>): - Promise<[ - protos.google.cloud.vpcaccess.v1.IConnector[], - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest|null, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listConnectors(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 routes should be listed. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * Continuation 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.vpcaccess.v1.Connector|Connector} 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 `listConnectorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listConnectorsStream( - request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - 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['listConnectors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnectors.createStream( - this.innerApiCalls.listConnectors as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConnectors`, 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 routes should be listed. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * Continuation 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.vpcaccess.v1.Connector|Connector}. 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/vpc_access_service.list_connectors.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_ListConnectors_async - */ - listConnectorsAsync( - request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - 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['listConnectors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnectors.asyncIterate( - this.innerApiCalls['listConnectors'] 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 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 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.vpcAccessServiceStub && !this._terminated) { - return this.vpcAccessServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client_config.json b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client_config.json deleted file mode 100644 index b6d6c408011..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.vpcaccess.v1.VpcAccessService": { - "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": { - "CreateConnector": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetConnector": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListConnectors": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteConnector": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_proto_list.json b/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_proto_list.json deleted file mode 100644 index cb787ecaff2..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/src/v1/vpc_access_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/vpcaccess/v1/vpc_access.proto" -] diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 7e3e77efc71..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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 vpcaccess = require('@google-cloud/vpc-access'); - -function main() { - const vpcAccessServiceClient = new vpcaccess.VpcAccessServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index ab087650f45..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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 {VpcAccessServiceClient} from '@google-cloud/vpc-access'; - -// check that the client class type name can be used -function doStuffWithVpcAccessServiceClient(client: VpcAccessServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const vpcAccessServiceClient = new VpcAccessServiceClient(); - doStuffWithVpcAccessServiceClient(vpcAccessServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/install.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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-vpcaccess/v1/test/gapic_vpc_access_service_v1.ts b/owl-bot-staging/google-cloud-vpcaccess/v1/test/gapic_vpc_access_service_v1.ts deleted file mode 100644 index 93302739eed..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/v1/test/gapic_vpc_access_service_v1.ts +++ /dev/null @@ -1,1382 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 vpcaccessserviceModule 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.VpcAccessServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = vpcaccessserviceModule.v1.VpcAccessServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = vpcaccessserviceModule.v1.VpcAccessServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = vpcaccessserviceModule.v1.VpcAccessServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.vpcAccessServiceStub, undefined); - await client.initialize(); - assert(client.vpcAccessServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.vpcAccessServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.vpcAccessServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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('getConnector', () => { - it('invokes getConnector without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.Connector() - ); - client.innerApiCalls.getConnector = stubSimpleCall(expectedResponse); - const [response] = await client.getConnector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnector without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.Connector() - ); - client.innerApiCalls.getConnector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnector( - request, - (err?: Error|null, result?: protos.google.cloud.vpcaccess.v1.IConnector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnector with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConnector(request), expectedError); - const actualRequest = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnector with closed client', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConnector(request), expectedError); - }); - }); - - describe('createConnector', () => { - it('invokes createConnector without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnector = stubLongRunningCall(expectedResponse); - const [operation] = await client.createConnector(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnector without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnector = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConnector( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnector with call error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnector = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createConnector(request), expectedError); - const actualRequest = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnector with LRO error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnector = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createConnector(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateConnectorProgress without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateConnectorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateConnectorProgress with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateConnectorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteConnector', () => { - it('invokes deleteConnector without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnector = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteConnector(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnector without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnector = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConnector( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnector with call error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnector = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteConnector(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnector with LRO error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnector = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteConnector(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteConnectorProgress without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteConnectorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteConnectorProgress with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteConnectorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listConnectors', () => { - it('invokes listConnectors without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - ]; - client.innerApiCalls.listConnectors = stubSimpleCall(expectedResponse); - const [response] = await client.listConnectors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectors without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - ]; - client.innerApiCalls.listConnectors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConnectors( - request, - (err?: Error|null, result?: protos.google.cloud.vpcaccess.v1.IConnector[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectors with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConnectors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConnectors(request), expectedError); - const actualRequest = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectorsStream without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - ]; - client.descriptors.page.listConnectors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConnectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vpcaccess.v1.Connector[] = []; - stream.on('data', (response: protos.google.cloud.vpcaccess.v1.Connector) => { - 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.listConnectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectors, request)); - assert( - (client.descriptors.page.listConnectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listConnectorsStream with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConnectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vpcaccess.v1.Connector[] = []; - stream.on('data', (response: protos.google.cloud.vpcaccess.v1.Connector) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConnectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectors, request)); - assert( - (client.descriptors.page.listConnectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnectors without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - ]; - client.descriptors.page.listConnectors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vpcaccess.v1.IConnector[] = []; - const iterable = client.listConnectorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConnectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnectors with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConnectorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vpcaccess.v1.IConnector[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConnectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectors.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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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 vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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('connector', () => { - const fakePath = "/rendered/path/connector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connector: "connectorValue", - }; - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - 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-vpcaccess/v1/tsconfig.json b/owl-bot-staging/google-cloud-vpcaccess/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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-vpcaccess/v1/webpack.config.js b/owl-bot-staging/google-cloud-vpcaccess/v1/webpack.config.js deleted file mode 100644 index 5f9bfc1ebff..00000000000 --- a/owl-bot-staging/google-cloud-vpcaccess/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: 'VpcAccessService', - filename: './vpc-access-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-webrisk/v1/.eslintignore b/owl-bot-staging/google-cloud-webrisk/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1/.eslintrc.json b/owl-bot-staging/google-cloud-webrisk/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/.gitignore b/owl-bot-staging/google-cloud-webrisk/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1/.jsdoc.js b/owl-bot-staging/google-cloud-webrisk/v1/.jsdoc.js deleted file mode 100644 index ef4492b8ebb..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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/web-risk', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-webrisk/v1/.mocharc.js b/owl-bot-staging/google-cloud-webrisk/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1/.prettierrc.js b/owl-bot-staging/google-cloud-webrisk/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1/README.md b/owl-bot-staging/google-cloud-webrisk/v1/README.md deleted file mode 100644 index 55d440eecb3..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Webrisk: Nodejs Client diff --git a/owl-bot-staging/google-cloud-webrisk/v1/package.json b/owl-bot-staging/google-cloud-webrisk/v1/package.json deleted file mode 100644 index eab639fcf2d..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/web-risk", - "version": "0.1.0", - "description": "Webrisk client for Node.js", - "repository": "googleapis/nodejs-webrisk", - "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 webrisk", - "webrisk", - "web risk 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-webrisk/v1/protos/google/cloud/webrisk/v1/webrisk.proto b/owl-bot-staging/google-cloud-webrisk/v1/protos/google/cloud/webrisk/v1/webrisk.proto deleted file mode 100644 index 5c5f63929d6..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/protos/google/cloud/webrisk/v1/webrisk.proto +++ /dev/null @@ -1,560 +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.webrisk.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 csharp_namespace = "Google.Cloud.WebRisk.V1"; -option go_package = "cloud.google.com/go/webrisk/apiv1/webriskpb;webriskpb"; -option java_multiple_files = true; -option java_outer_classname = "WebRiskProto"; -option java_package = "com.google.webrisk.v1"; -option objc_class_prefix = "GCWR"; -option php_namespace = "Google\\Cloud\\WebRisk\\V1"; -option ruby_package = "Google::Cloud::WebRisk::V1"; - -// Web Risk API defines an interface to detect malicious URLs on your -// website and in client applications. -service WebRiskService { - option (google.api.default_host) = "webrisk.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Gets the most recent threat list diffs. These diffs should be applied to - // a local database of hashes to keep it up-to-date. If the local database is - // empty or excessively out-of-date, a complete snapshot of the database will - // be returned. This Method only updates a single ThreatList at a time. To - // update multiple ThreatList databases, this method needs to be called once - // for each list. - rpc ComputeThreatListDiff(ComputeThreatListDiffRequest) - returns (ComputeThreatListDiffResponse) { - option (google.api.http) = { - get: "/v1/threatLists:computeDiff" - }; - option (google.api.method_signature) = - "threat_type,version_token,constraints"; - } - - // This method is used to check whether a URI is on a given threatList. - // Multiple threatLists may be searched in a single query. - // The response will list all requested threatLists the URI was found to - // match. If the URI is not found on any of the requested ThreatList an - // empty response will be returned. - rpc SearchUris(SearchUrisRequest) returns (SearchUrisResponse) { - option (google.api.http) = { - get: "/v1/uris:search" - }; - option (google.api.method_signature) = "uri,threat_types"; - } - - // Gets the full hashes that match the requested hash prefix. - // This is used after a hash prefix is looked up in a threatList - // and there is a match. The client side threatList only holds partial hashes - // so the client must query this method to determine if there is a full - // hash match of a threat. - rpc SearchHashes(SearchHashesRequest) returns (SearchHashesResponse) { - option (google.api.http) = { - get: "/v1/hashes:search" - }; - option (google.api.method_signature) = "hash_prefix,threat_types"; - } - - // Creates a Submission of a URI suspected of containing phishing content to - // be reviewed. If the result verifies the existence of malicious phishing - // content, the site will be added to the [Google's Social Engineering - // lists](https://support.google.com/webmasters/answer/6350487/) in order to - // protect users that could get exposed to this threat in the future. Only - // allowlisted projects can use this method during Early Access. Please reach - // out to Sales or your customer engineer to obtain access. - rpc CreateSubmission(CreateSubmissionRequest) returns (Submission) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/submissions" - body: "submission" - }; - option (google.api.method_signature) = "parent,submission"; - } - - // Submits a URI suspected of containing malicious content to be reviewed. - // Returns a google.longrunning.Operation which, once the review is complete, - // is updated with its result. You can use the [Pub/Sub API] - // (https://cloud.google.com/pubsub) to receive notifications for the returned - // Operation. If the result verifies the existence of malicious content, the - // site will be added to the [Google's Social Engineering lists] - // (https://support.google.com/webmasters/answer/6350487/) in order to - // protect users that could get exposed to this threat in the future. Only - // allowlisted projects can use this method during Early Access. Please reach - // out to Sales or your customer engineer to obtain access. - rpc SubmitUri(SubmitUriRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/uris:submit" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Submission" - metadata_type: "SubmitUriMetadata" - }; - } -} - -// Describes an API diff request. -message ComputeThreatListDiffRequest { - // The constraints for this diff. - message Constraints { - // The maximum size in number of entries. The diff will not contain more - // entries than this value. This should be a power of 2 between 2**10 and - // 2**20. If zero, no diff size limit is set. - int32 max_diff_entries = 1; - - // Sets the maximum number of entries that the client is willing to have - // in the local database. This should be a power of 2 between 2**10 and - // 2**20. If zero, no database size limit is set. - int32 max_database_entries = 2; - - // The compression types supported by the client. - repeated CompressionType supported_compressions = 3; - } - - // Required. The threat list to update. Only a single ThreatType should be - // specified per request. If you want to handle multiple ThreatTypes, you must - // make one request per ThreatType. - ThreatType threat_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // The current version token of the client for the requested list (the - // client version that was received from the last successful diff). - // If the client does not have a version token (this is the first time calling - // ComputeThreatListDiff), this may be left empty and a full database - // snapshot will be returned. - bytes version_token = 2; - - // Required. The constraints associated with this request. - Constraints constraints = 3 [(google.api.field_behavior) = REQUIRED]; -} - -message ComputeThreatListDiffResponse { - // The type of response sent to the client. - enum ResponseType { - // Unknown. - RESPONSE_TYPE_UNSPECIFIED = 0; - - // Partial updates are applied to the client's existing local database. - DIFF = 1; - - // Full updates resets the client's entire local database. This means - // that either the client had no state, was seriously out-of-date, - // or the client is believed to be corrupt. - RESET = 2; - } - - // The expected state of a client's local database. - message Checksum { - // The SHA256 hash of the client state; that is, of the sorted list of all - // hashes present in the database. - bytes sha256 = 1; - } - - // The type of response. This may indicate that an action must be taken by the - // client when the response is received. - ResponseType response_type = 4; - - // A set of entries to add to a local threat type's list. - ThreatEntryAdditions additions = 5; - - // A set of entries to remove from a local threat type's list. - // This field may be empty. - ThreatEntryRemovals removals = 6; - - // The new opaque client version token. This should be retained by the client - // and passed into the next call of ComputeThreatListDiff as 'version_token'. - // A separate version token should be stored and used for each threatList. - bytes new_version_token = 7; - - // The expected SHA256 hash of the client state; that is, of the sorted list - // of all hashes present in the database after applying the provided diff. - // If the client state doesn't match the expected state, the client must - // discard this diff and retry later. - Checksum checksum = 8; - - // The soonest the client should wait before issuing any diff - // request. Querying sooner is unlikely to produce a meaningful diff. - // Waiting longer is acceptable considering the use case. - // If this field is not set clients may update as soon as they want. - google.protobuf.Timestamp recommended_next_diff = 2; -} - -// Request to check URI entries against threatLists. -message SearchUrisRequest { - // Required. The URI to be checked for matches. - string uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ThreatLists to search in. Multiple ThreatLists may be - // specified. - repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message SearchUrisResponse { - // Contains threat information on a matching uri. - message ThreatUri { - // The ThreatList this threat belongs to. - repeated ThreatType threat_types = 1; - - // The cache lifetime for the returned match. Clients must not cache this - // response past this timestamp to avoid false positives. - google.protobuf.Timestamp expire_time = 2; - } - - // The threat list matches. This might be empty if the URI is on no list. - ThreatUri threat = 1; -} - -// Request to return full hashes matched by the provided hash prefixes. -message SearchHashesRequest { - // A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 - // hash. For JSON requests, this field is base64-encoded. - // Note that if this parameter is provided by a URI, it must be encoded using - // the web safe base64 variant (RFC 4648). - bytes hash_prefix = 1; - - // Required. The ThreatLists to search in. Multiple ThreatLists may be - // specified. - repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message SearchHashesResponse { - // Contains threat information on a matching hash. - message ThreatHash { - // The ThreatList this threat belongs to. - // This must contain at least one entry. - repeated ThreatType threat_types = 1; - - // A 32 byte SHA256 hash. This field is in binary format. For JSON - // requests, hashes are base64-encoded. - bytes hash = 2; - - // The cache lifetime for the returned match. Clients must not cache this - // response past this timestamp to avoid false positives. - google.protobuf.Timestamp expire_time = 3; - } - - // The full hashes that matched the requested prefixes. - // The hash will be populated in the key. - repeated ThreatHash threats = 1; - - // For requested entities that did not match the threat list, how long to - // cache the response until. - google.protobuf.Timestamp negative_expire_time = 2; -} - -// The type of threat. This maps directly to the threat list a threat may -// belong to. -enum ThreatType { - // No entries should match this threat type. This threat type is unused. - THREAT_TYPE_UNSPECIFIED = 0; - - // Malware targeting any platform. - MALWARE = 1; - - // Social engineering targeting any platform. - SOCIAL_ENGINEERING = 2; - - // Unwanted software targeting any platform. - UNWANTED_SOFTWARE = 3; - - // A list of extended coverage social engineering URIs targeting any - // platform. - SOCIAL_ENGINEERING_EXTENDED_COVERAGE = 4; -} - -// The ways in which threat entry sets can be compressed. -enum CompressionType { - // Unknown. - COMPRESSION_TYPE_UNSPECIFIED = 0; - - // Raw, uncompressed data. - RAW = 1; - - // Rice-Golomb encoded data. - RICE = 2; -} - -// Contains the set of entries to add to a local database. -// May contain a combination of compressed and raw data in a single response. -message ThreatEntryAdditions { - // The raw SHA256-formatted entries. - // Repeated to allow returning sets of hashes with different prefix sizes. - repeated RawHashes raw_hashes = 1; - - // The encoded 4-byte prefixes of SHA256-formatted entries, using a - // Golomb-Rice encoding. The hashes are converted to uint32, sorted in - // ascending order, then delta encoded and stored as encoded_data. - RiceDeltaEncoding rice_hashes = 2; -} - -// Contains the set of entries to remove from a local database. -message ThreatEntryRemovals { - // The raw removal indices for a local list. - RawIndices raw_indices = 1; - - // The encoded local, lexicographically-sorted list indices, using a - // Golomb-Rice encoding. Used for sending compressed removal indices. The - // removal indices (uint32) are sorted in ascending order, then delta encoded - // and stored as encoded_data. - RiceDeltaEncoding rice_indices = 2; -} - -// A set of raw indices to remove from a local list. -message RawIndices { - // The indices to remove from a lexicographically-sorted local list. - repeated int32 indices = 1; -} - -// The uncompressed threat entries in hash format. -// Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4 -// bytes, but some hashes are lengthened if they collide with the hash of a -// popular URI. -// -// Used for sending ThreatEntryAdditons to clients that do not support -// compression, or when sending non-4-byte hashes to clients that do support -// compression. -message RawHashes { - // The number of bytes for each prefix encoded below. This field can be - // anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). - // In practice this is almost always 4, except in exceptional circumstances. - int32 prefix_size = 1; - - // The hashes, in binary format, concatenated into one long string. Hashes are - // sorted in lexicographic order. For JSON API users, hashes are - // base64-encoded. - bytes raw_hashes = 2; -} - -// The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or -// compressed removal indices. -message RiceDeltaEncoding { - // The offset of the first entry in the encoded data, or, if only a single - // integer was encoded, that single integer's value. If the field is empty or - // missing, assume zero. - int64 first_value = 1; - - // The Golomb-Rice parameter, which is a number between 2 and 28. This field - // is missing (that is, zero) if `num_entries` is zero. - int32 rice_parameter = 2; - - // The number of entries that are delta encoded in the encoded data. If only a - // single integer was encoded, this will be zero and the single value will be - // stored in `first_value`. - int32 entry_count = 3; - - // The encoded deltas that are encoded using the Golomb-Rice coder. - bytes encoded_data = 4; -} - -// Wraps a URI that might be displaying malicious content. -message Submission { - // Required. The URI that is being reported for malicious content to be - // analyzed. - string uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Output only. ThreatTypes found to be associated with the submitted URI - // after reviewing it. This might be empty if the URI was not added to any - // list. - repeated ThreatType threat_types = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Context about the submission including the type of abuse found on the URI and -// supporting details. -// option (google.api.message_visibility).restriction = "TRUSTED_TESTER"; -message ThreatInfo { - // The abuse type found on the URI. - enum AbuseType { - // Default. - ABUSE_TYPE_UNSPECIFIED = 0; - - // The URI contains malware. - MALWARE = 1; - - // The URI contains social engineering. - SOCIAL_ENGINEERING = 2; - - // The URI contains unwanted software. - UNWANTED_SOFTWARE = 3; - } - - // Confidence that a URI is unsafe. - message Confidence { - // Enum representation of confidence. - enum ConfidenceLevel { - // Default. - CONFIDENCE_LEVEL_UNSPECIFIED = 0; - - // Less than 60% confidence that the URI is unsafe. - LOW = 1; - - // Between 60% and 80% confidence that the URI is unsafe. - MEDIUM = 2; - - // Greater than 80% confidence that the URI is unsafe. - HIGH = 3; - } - - oneof value { - // A decimal representation of confidence in the range of 0 - // to 1 where 0 indicates no confidence and 1 indicates - // complete confidence. - float score = 1; - - // Enum representation of confidence. - ConfidenceLevel level = 2; - } - } - - // Context about why the URI is unsafe. - message ThreatJustification { - // Labels that explain how the URI was classified. - enum JustificationLabel { - // Default. - JUSTIFICATION_LABEL_UNSPECIFIED = 0; - - // The submitter manually verified that the submission is unsafe. - MANUAL_VERIFICATION = 1; - - // The submitter received the submission from an end user. - USER_REPORT = 2; - - // The submitter received the submission from an automated system. - AUTOMATED_REPORT = 3; - } - - // Labels associated with this URI that explain how it was classified. - repeated JustificationLabel labels = 1; - - // Free-form context on why this URI is unsafe. - repeated string comments = 2; - } - - // The type of abuse. - AbuseType abuse_type = 1; - - // Confidence that the URI is unsafe. - Confidence threat_confidence = 2; - - // Context about why the URI is unsafe. - ThreatJustification threat_justification = 3; -} - -// Details about how the threat was discovered. -message ThreatDiscovery { - // Platform types. - enum Platform { - // Default. - PLATFORM_UNSPECIFIED = 0; - - // General Android platform. - ANDROID = 1; - - // General iOS platform. - IOS = 2; - - // General macOS platform. - MACOS = 3; - - // General Windows platform. - WINDOWS = 4; - } - - // Platform on which the threat was discovered. - Platform platform = 1; - - // CLDR region code of the countries/regions the URI poses a threat ordered - // from most impact to least impact. Example: "US" for United States. - repeated string region_codes = 2; -} - -// Request to send a potentially phishy URI to WebRisk. -message CreateSubmissionRequest { - // Required. The name of the project that is making the submission. This - // string is in the format "projects/{project_number}". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The submission that contains the content of the phishing report. - Submission submission = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to send a potentially malicious URI to WebRisk. -message SubmitUriRequest { - // Required. The name of the project that is making the submission. This - // string is in the format "projects/{project_number}". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The submission that contains the URI to be scanned. - Submission submission = 2 [(google.api.field_behavior) = REQUIRED]; - - // Provides additional information about the submission. - ThreatInfo threat_info = 3; - - // Provides additional information about how the submission was discovered. - ThreatDiscovery threat_discovery = 4; -} - -// Metadata for the Submit URI long-running operation. -// option (google.api.message_visibility).restriction = "TRUSTED_TESTER"; -message SubmitUriMetadata { - // Enum that represents the state of the long-running operation. - enum State { - // Default unspecified state. - STATE_UNSPECIFIED = 0; - - // The operation is currently running. - RUNNING = 1; - - // The operation finished with a success status. - SUCCEEDED = 2; - - // The operation was cancelled. - CANCELLED = 3; - - // The operation finished with a failure status. - FAILED = 4; - - // The operation was closed with no action taken. - CLOSED = 5; - } - - // The state of the operation. - State state = 1; - - // Creation time of the operation. - google.protobuf.Timestamp create_time = 2; - - // Latest update time of the operation. - google.protobuf.Timestamp update_time = 3; -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json deleted file mode 100644 index 8c24e94fdab..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json +++ /dev/null @@ -1,247 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-webrisk", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.webrisk.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_async", - "title": "WebRiskService computeThreatListDiff Sample", - "origin": "API_DEFINITION", - "description": " Gets the most recent threat list diffs. These diffs should be applied to a local database of hashes to keep it up-to-date. If the local database is empty or excessively out-of-date, a complete snapshot of the database will be returned. This Method only updates a single ThreatList at a time. To update multiple ThreatList databases, this method needs to be called once for each list.", - "canonical": true, - "file": "web_risk_service.compute_threat_list_diff.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ComputeThreatListDiff", - "fullName": "google.cloud.webrisk.v1.WebRiskService.ComputeThreatListDiff", - "async": true, - "parameters": [ - { - "name": "threat_type", - "type": ".google.cloud.webrisk.v1.ThreatType" - }, - { - "name": "version_token", - "type": "TYPE_BYTES" - }, - { - "name": "constraints", - "type": ".google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints" - } - ], - "resultType": ".google.cloud.webrisk.v1.ComputeThreatListDiffResponse", - "client": { - "shortName": "WebRiskServiceClient", - "fullName": "google.cloud.webrisk.v1.WebRiskServiceClient" - }, - "method": { - "shortName": "ComputeThreatListDiff", - "fullName": "google.cloud.webrisk.v1.WebRiskService.ComputeThreatListDiff", - "service": { - "shortName": "WebRiskService", - "fullName": "google.cloud.webrisk.v1.WebRiskService" - } - } - } - }, - { - "regionTag": "webrisk_v1_generated_WebRiskService_SearchUris_async", - "title": "WebRiskService searchUris Sample", - "origin": "API_DEFINITION", - "description": " This method is used to check whether a URI is on a given threatList. Multiple threatLists may be searched in a single query. The response will list all requested threatLists the URI was found to match. If the URI is not found on any of the requested ThreatList an empty response will be returned.", - "canonical": true, - "file": "web_risk_service.search_uris.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SearchUris", - "fullName": "google.cloud.webrisk.v1.WebRiskService.SearchUris", - "async": true, - "parameters": [ - { - "name": "uri", - "type": "TYPE_STRING" - }, - { - "name": "threat_types", - "type": "TYPE_ENUM[]" - } - ], - "resultType": ".google.cloud.webrisk.v1.SearchUrisResponse", - "client": { - "shortName": "WebRiskServiceClient", - "fullName": "google.cloud.webrisk.v1.WebRiskServiceClient" - }, - "method": { - "shortName": "SearchUris", - "fullName": "google.cloud.webrisk.v1.WebRiskService.SearchUris", - "service": { - "shortName": "WebRiskService", - "fullName": "google.cloud.webrisk.v1.WebRiskService" - } - } - } - }, - { - "regionTag": "webrisk_v1_generated_WebRiskService_SearchHashes_async", - "title": "WebRiskService searchHashes Sample", - "origin": "API_DEFINITION", - "description": " Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is looked up in a threatList and there is a match. The client side threatList only holds partial hashes so the client must query this method to determine if there is a full hash match of a threat.", - "canonical": true, - "file": "web_risk_service.search_hashes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SearchHashes", - "fullName": "google.cloud.webrisk.v1.WebRiskService.SearchHashes", - "async": true, - "parameters": [ - { - "name": "hash_prefix", - "type": "TYPE_BYTES" - }, - { - "name": "threat_types", - "type": "TYPE_ENUM[]" - } - ], - "resultType": ".google.cloud.webrisk.v1.SearchHashesResponse", - "client": { - "shortName": "WebRiskServiceClient", - "fullName": "google.cloud.webrisk.v1.WebRiskServiceClient" - }, - "method": { - "shortName": "SearchHashes", - "fullName": "google.cloud.webrisk.v1.WebRiskService.SearchHashes", - "service": { - "shortName": "WebRiskService", - "fullName": "google.cloud.webrisk.v1.WebRiskService" - } - } - } - }, - { - "regionTag": "webrisk_v1_generated_WebRiskService_CreateSubmission_async", - "title": "WebRiskService createSubmission Sample", - "origin": "API_DEFINITION", - "description": " Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the [Google's Social Engineering lists](https://support.google.com/webmasters/answer/6350487/) in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.", - "canonical": true, - "file": "web_risk_service.create_submission.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSubmission", - "fullName": "google.cloud.webrisk.v1.WebRiskService.CreateSubmission", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "submission", - "type": ".google.cloud.webrisk.v1.Submission" - } - ], - "resultType": ".google.cloud.webrisk.v1.Submission", - "client": { - "shortName": "WebRiskServiceClient", - "fullName": "google.cloud.webrisk.v1.WebRiskServiceClient" - }, - "method": { - "shortName": "CreateSubmission", - "fullName": "google.cloud.webrisk.v1.WebRiskService.CreateSubmission", - "service": { - "shortName": "WebRiskService", - "fullName": "google.cloud.webrisk.v1.WebRiskService" - } - } - } - }, - { - "regionTag": "webrisk_v1_generated_WebRiskService_SubmitUri_async", - "title": "WebRiskService submitUri Sample", - "origin": "API_DEFINITION", - "description": " Submits a URI suspected of containing malicious content to be reviewed. Returns a google.longrunning.Operation which, once the review is complete, is updated with its result. You can use the [Pub/Sub API] (https://cloud.google.com/pubsub) to receive notifications for the returned Operation. If the result verifies the existence of malicious content, the site will be added to the [Google's Social Engineering lists] (https://support.google.com/webmasters/answer/6350487/) in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.", - "canonical": true, - "file": "web_risk_service.submit_uri.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SubmitUri", - "fullName": "google.cloud.webrisk.v1.WebRiskService.SubmitUri", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "submission", - "type": ".google.cloud.webrisk.v1.Submission" - }, - { - "name": "threat_info", - "type": ".google.cloud.webrisk.v1.ThreatInfo" - }, - { - "name": "threat_discovery", - "type": ".google.cloud.webrisk.v1.ThreatDiscovery" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WebRiskServiceClient", - "fullName": "google.cloud.webrisk.v1.WebRiskServiceClient" - }, - "method": { - "shortName": "SubmitUri", - "fullName": "google.cloud.webrisk.v1.WebRiskService.SubmitUri", - "service": { - "shortName": "WebRiskService", - "fullName": "google.cloud.webrisk.v1.WebRiskService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.compute_threat_list_diff.js b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.compute_threat_list_diff.js deleted file mode 100644 index 0e1c627ada9..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.compute_threat_list_diff.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(threatType, constraints) { - // [START webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The threat list to update. Only a single ThreatType should be - * specified per request. If you want to handle multiple ThreatTypes, you must - * make one request per ThreatType. - */ - // const threatType = {} - /** - * The current version token of the client for the requested list (the - * client version that was received from the last successful diff). - * If the client does not have a version token (this is the first time calling - * ComputeThreatListDiff), this may be left empty and a full database - * snapshot will be returned. - */ - // const versionToken = Buffer.from('string') - /** - * Required. The constraints associated with this request. - */ - // const constraints = {} - - // Imports the Webrisk library - const {WebRiskServiceClient} = require('@google-cloud/web-risk').v1; - - // Instantiates a client - const webriskClient = new WebRiskServiceClient(); - - async function callComputeThreatListDiff() { - // Construct request - const request = { - threatType, - constraints, - }; - - // Run request - const response = await webriskClient.computeThreatListDiff(request); - console.log(response); - } - - callComputeThreatListDiff(); - // [END webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.create_submission.js b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.create_submission.js deleted file mode 100644 index 92b83b34b77..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.create_submission.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, submission) { - // [START webrisk_v1_generated_WebRiskService_CreateSubmission_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 project that is making the submission. This - * string is in the format "projects/{project_number}". - */ - // const parent = 'abc123' - /** - * Required. The submission that contains the content of the phishing report. - */ - // const submission = {} - - // Imports the Webrisk library - const {WebRiskServiceClient} = require('@google-cloud/web-risk').v1; - - // Instantiates a client - const webriskClient = new WebRiskServiceClient(); - - async function callCreateSubmission() { - // Construct request - const request = { - parent, - submission, - }; - - // Run request - const response = await webriskClient.createSubmission(request); - console.log(response); - } - - callCreateSubmission(); - // [END webrisk_v1_generated_WebRiskService_CreateSubmission_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_hashes.js b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_hashes.js deleted file mode 100644 index 245e6424f66..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_hashes.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(threatTypes) { - // [START webrisk_v1_generated_WebRiskService_SearchHashes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 hash prefix, consisting of the most significant 4-32 bytes of a SHA256 - * hash. For JSON requests, this field is base64-encoded. - * Note that if this parameter is provided by a URI, it must be encoded using - * the web safe base64 variant (RFC 4648). - */ - // const hashPrefix = Buffer.from('string') - /** - * Required. The ThreatLists to search in. Multiple ThreatLists may be - * specified. - */ - // const threatTypes = [1,2,3,4] - - // Imports the Webrisk library - const {WebRiskServiceClient} = require('@google-cloud/web-risk').v1; - - // Instantiates a client - const webriskClient = new WebRiskServiceClient(); - - async function callSearchHashes() { - // Construct request - const request = { - threatTypes, - }; - - // Run request - const response = await webriskClient.searchHashes(request); - console.log(response); - } - - callSearchHashes(); - // [END webrisk_v1_generated_WebRiskService_SearchHashes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_uris.js b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_uris.js deleted file mode 100644 index a1896647bdd..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.search_uris.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(uri, threatTypes) { - // [START webrisk_v1_generated_WebRiskService_SearchUris_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The URI to be checked for matches. - */ - // const uri = 'abc123' - /** - * Required. The ThreatLists to search in. Multiple ThreatLists may be - * specified. - */ - // const threatTypes = [1,2,3,4] - - // Imports the Webrisk library - const {WebRiskServiceClient} = require('@google-cloud/web-risk').v1; - - // Instantiates a client - const webriskClient = new WebRiskServiceClient(); - - async function callSearchUris() { - // Construct request - const request = { - uri, - threatTypes, - }; - - // Run request - const response = await webriskClient.searchUris(request); - console.log(response); - } - - callSearchUris(); - // [END webrisk_v1_generated_WebRiskService_SearchUris_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.submit_uri.js b/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.submit_uri.js deleted file mode 100644 index b1ed9459f4f..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/samples/generated/v1/web_risk_service.submit_uri.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, submission) { - // [START webrisk_v1_generated_WebRiskService_SubmitUri_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 project that is making the submission. This - * string is in the format "projects/{project_number}". - */ - // const parent = 'abc123' - /** - * Required. The submission that contains the URI to be scanned. - */ - // const submission = {} - /** - * Provides additional information about the submission. - */ - // const threatInfo = {} - /** - * Provides additional information about how the submission was discovered. - */ - // const threatDiscovery = {} - - // Imports the Webrisk library - const {WebRiskServiceClient} = require('@google-cloud/web-risk').v1; - - // Instantiates a client - const webriskClient = new WebRiskServiceClient(); - - async function callSubmitUri() { - // Construct request - const request = { - parent, - submission, - }; - - // Run request - const [operation] = await webriskClient.submitUri(request); - const [response] = await operation.promise(); - console.log(response); - } - - callSubmitUri(); - // [END webrisk_v1_generated_WebRiskService_SubmitUri_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/index.ts b/owl-bot-staging/google-cloud-webrisk/v1/src/index.ts deleted file mode 100644 index 51a4ce32a7b..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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 WebRiskServiceClient = v1.WebRiskServiceClient; -type WebRiskServiceClient = v1.WebRiskServiceClient; -export {v1, WebRiskServiceClient}; -export default {v1, WebRiskServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 8b6c58413fd..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/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.webrisk.v1", - "libraryPackage": "@google-cloud/web-risk", - "services": { - "WebRiskService": { - "clients": { - "grpc": { - "libraryClient": "WebRiskServiceClient", - "rpcs": { - "ComputeThreatListDiff": { - "methods": [ - "computeThreatListDiff" - ] - }, - "SearchUris": { - "methods": [ - "searchUris" - ] - }, - "SearchHashes": { - "methods": [ - "searchHashes" - ] - }, - "CreateSubmission": { - "methods": [ - "createSubmission" - ] - }, - "SubmitUri": { - "methods": [ - "submitUri" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WebRiskServiceClient", - "rpcs": { - "ComputeThreatListDiff": { - "methods": [ - "computeThreatListDiff" - ] - }, - "SearchUris": { - "methods": [ - "searchUris" - ] - }, - "SearchHashes": { - "methods": [ - "searchHashes" - ] - }, - "CreateSubmission": { - "methods": [ - "createSubmission" - ] - }, - "SubmitUri": { - "methods": [ - "submitUri" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/index.ts deleted file mode 100644 index 6841fbac5ae..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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 {WebRiskServiceClient} from './web_risk_service_client'; diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client.ts b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client.ts deleted file mode 100644 index 64ae4bf44d9..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client.ts +++ /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 -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/web_risk_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './web_risk_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Web Risk API defines an interface to detect malicious URLs on your - * website and in client applications. - * @class - * @memberof v1 - */ -export class WebRiskServiceClient { - 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; - webRiskServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WebRiskServiceClient. - * - * @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 WebRiskServiceClient({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 WebRiskServiceClient; - 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}' - ), - }; - - 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/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const submitUriResponse = protoFilesRoot.lookup( - '.google.cloud.webrisk.v1.Submission') as gax.protobuf.Type; - const submitUriMetadata = protoFilesRoot.lookup( - '.google.cloud.webrisk.v1.SubmitUriMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - submitUri: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - submitUriResponse.decode.bind(submitUriResponse), - submitUriMetadata.decode.bind(submitUriMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.webrisk.v1.WebRiskService', 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.webRiskServiceStub) { - return this.webRiskServiceStub; - } - - // Put together the "service stub" for - // google.cloud.webrisk.v1.WebRiskService. - this.webRiskServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.webrisk.v1.WebRiskService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.webrisk.v1.WebRiskService, - 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 webRiskServiceStubMethods = - ['computeThreatListDiff', 'searchUris', 'searchHashes', 'createSubmission', 'submitUri']; - for (const methodName of webRiskServiceStubMethods) { - const callPromise = this.webRiskServiceStub.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.webRiskServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'webrisk.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 'webrisk.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 most recent threat list diffs. These diffs should be applied to - * a local database of hashes to keep it up-to-date. If the local database is - * empty or excessively out-of-date, a complete snapshot of the database will - * be returned. This Method only updates a single ThreatList at a time. To - * update multiple ThreatList databases, this method needs to be called once - * for each list. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.webrisk.v1.ThreatType} request.threatType - * Required. The threat list to update. Only a single ThreatType should be - * specified per request. If you want to handle multiple ThreatTypes, you must - * make one request per ThreatType. - * @param {Buffer} request.versionToken - * The current version token of the client for the requested list (the - * client version that was received from the last successful diff). - * If the client does not have a version token (this is the first time calling - * ComputeThreatListDiff), this may be left empty and a full database - * snapshot will be returned. - * @param {google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints} request.constraints - * Required. The constraints associated with 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.webrisk.v1.ComputeThreatListDiffResponse|ComputeThreatListDiffResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.compute_threat_list_diff.js - * region_tag:webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_async - */ - computeThreatListDiff( - request?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|undefined, {}|undefined - ]>; - computeThreatListDiff( - request: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): void; - computeThreatListDiff( - request: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, - callback: Callback< - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): void; - computeThreatListDiff( - request?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.computeThreatListDiff(request, options, callback); - } -/** - * This method is used to check whether a URI is on a given threatList. - * Multiple threatLists may be searched in a single query. - * The response will list all requested threatLists the URI was found to - * match. If the URI is not found on any of the requested ThreatList an - * empty response will be returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.uri - * Required. The URI to be checked for matches. - * @param {number[]} request.threatTypes - * Required. The ThreatLists to search in. Multiple ThreatLists may 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.webrisk.v1.SearchUrisResponse|SearchUrisResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.search_uris.js - * region_tag:webrisk_v1_generated_WebRiskService_SearchUris_async - */ - searchUris( - request?: protos.google.cloud.webrisk.v1.ISearchUrisRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|undefined, {}|undefined - ]>; - searchUris( - request: protos.google.cloud.webrisk.v1.ISearchUrisRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): void; - searchUris( - request: protos.google.cloud.webrisk.v1.ISearchUrisRequest, - callback: Callback< - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): void; - searchUris( - request?: protos.google.cloud.webrisk.v1.ISearchUrisRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.searchUris(request, options, callback); - } -/** - * Gets the full hashes that match the requested hash prefix. - * This is used after a hash prefix is looked up in a threatList - * and there is a match. The client side threatList only holds partial hashes - * so the client must query this method to determine if there is a full - * hash match of a threat. - * - * @param {Object} request - * The request object that will be sent. - * @param {Buffer} request.hashPrefix - * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 - * hash. For JSON requests, this field is base64-encoded. - * Note that if this parameter is provided by a URI, it must be encoded using - * the web safe base64 variant (RFC 4648). - * @param {number[]} request.threatTypes - * Required. The ThreatLists to search in. Multiple ThreatLists may 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.webrisk.v1.SearchHashesResponse|SearchHashesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.search_hashes.js - * region_tag:webrisk_v1_generated_WebRiskService_SearchHashes_async - */ - searchHashes( - request?: protos.google.cloud.webrisk.v1.ISearchHashesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|undefined, {}|undefined - ]>; - searchHashes( - request: protos.google.cloud.webrisk.v1.ISearchHashesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): void; - searchHashes( - request: protos.google.cloud.webrisk.v1.ISearchHashesRequest, - callback: Callback< - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): void; - searchHashes( - request?: protos.google.cloud.webrisk.v1.ISearchHashesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.searchHashes(request, options, callback); - } -/** - * Creates a Submission of a URI suspected of containing phishing content to - * be reviewed. If the result verifies the existence of malicious phishing - * content, the site will be added to the [Google's Social Engineering - * lists](https://support.google.com/webmasters/answer/6350487/) in order to - * protect users that could get exposed to this threat in the future. Only - * allowlisted projects can use this method during Early Access. Please reach - * out to Sales or your customer engineer to obtain access. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project that is making the submission. This - * string is in the format "projects/{project_number}". - * @param {google.cloud.webrisk.v1.Submission} request.submission - * Required. The submission that contains the content of the phishing 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.webrisk.v1.Submission|Submission}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.create_submission.js - * region_tag:webrisk_v1_generated_WebRiskService_CreateSubmission_async - */ - createSubmission( - request?: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|undefined, {}|undefined - ]>; - createSubmission( - request: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, - {}|null|undefined>): void; - createSubmission( - request: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, - callback: Callback< - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, - {}|null|undefined>): void; - createSubmission( - request?: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSubmission(request, options, callback); - } - -/** - * Submits a URI suspected of containing malicious content to be reviewed. - * Returns a google.longrunning.Operation which, once the review is complete, - * is updated with its result. You can use the [Pub/Sub API] - * (https://cloud.google.com/pubsub) to receive notifications for the returned - * Operation. If the result verifies the existence of malicious content, the - * site will be added to the [Google's Social Engineering lists] - * (https://support.google.com/webmasters/answer/6350487/) in order to - * protect users that could get exposed to this threat in the future. Only - * allowlisted projects can use this method during Early Access. Please reach - * out to Sales or your customer engineer to obtain access. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project that is making the submission. This - * string is in the format "projects/{project_number}". - * @param {google.cloud.webrisk.v1.Submission} request.submission - * Required. The submission that contains the URI to be scanned. - * @param {google.cloud.webrisk.v1.ThreatInfo} request.threatInfo - * Provides additional information about the submission. - * @param {google.cloud.webrisk.v1.ThreatDiscovery} request.threatDiscovery - * Provides additional information about how the submission was discovered. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.submit_uri.js - * region_tag:webrisk_v1_generated_WebRiskService_SubmitUri_async - */ - submitUri( - request?: protos.google.cloud.webrisk.v1.ISubmitUriRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - submitUri( - request: protos.google.cloud.webrisk.v1.ISubmitUriRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - submitUri( - request: protos.google.cloud.webrisk.v1.ISubmitUriRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - submitUri( - request?: protos.google.cloud.webrisk.v1.ISubmitUriRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.submitUri(request, options, callback); - } -/** - * Check the status of the long running operation returned by `submitUri()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.submit_uri.js - * region_tag:webrisk_v1_generated_WebRiskService_SubmitUri_async - */ - async checkSubmitUriProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.submitUri, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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 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.webRiskServiceStub && !this._terminated) { - return this.webRiskServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client_config.json b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client_config.json deleted file mode 100644 index dc341cc185b..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_client_config.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "interfaces": { - "google.cloud.webrisk.v1.WebRiskService": { - "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": { - "ComputeThreatListDiff": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SearchUris": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SearchHashes": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateSubmission": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SubmitUri": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_proto_list.json b/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_proto_list.json deleted file mode 100644 index beac97653c6..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/src/v1/web_risk_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/webrisk/v1/webrisk.proto" -] diff --git a/owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index d1cd13a173e..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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 webrisk = require('@google-cloud/web-risk'); - -function main() { - const webRiskServiceClient = new webrisk.WebRiskServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-webrisk/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index ea217a23ddd..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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 {WebRiskServiceClient} from '@google-cloud/web-risk'; - -// check that the client class type name can be used -function doStuffWithWebRiskServiceClient(client: WebRiskServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const webRiskServiceClient = new WebRiskServiceClient(); - doStuffWithWebRiskServiceClient(webRiskServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-webrisk/v1/system-test/install.ts b/owl-bot-staging/google-cloud-webrisk/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1/test/gapic_web_risk_service_v1.ts b/owl-bot-staging/google-cloud-webrisk/v1/test/gapic_web_risk_service_v1.ts deleted file mode 100644 index b829e2a674a..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1/test/gapic_web_risk_service_v1.ts +++ /dev/null @@ -1,961 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 webriskserviceModule from '../src'; - -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 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.WebRiskServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = webriskserviceModule.v1.WebRiskServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = webriskserviceModule.v1.WebRiskServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = webriskserviceModule.v1.WebRiskServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webRiskServiceStub, undefined); - await client.initialize(); - assert(client.webRiskServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.webRiskServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webRiskServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - 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 webriskserviceModule.v1.WebRiskServiceClient({ - 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('computeThreatListDiff', () => { - it('invokes computeThreatListDiff without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffResponse() - ); - client.innerApiCalls.computeThreatListDiff = stubSimpleCall(expectedResponse); - const [response] = await client.computeThreatListDiff(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes computeThreatListDiff without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffResponse() - ); - client.innerApiCalls.computeThreatListDiff = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.computeThreatListDiff( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes computeThreatListDiff with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.computeThreatListDiff = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.computeThreatListDiff(request), expectedError); - }); - - it('invokes computeThreatListDiff with closed client', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.computeThreatListDiff(request), expectedError); - }); - }); - - describe('searchUris', () => { - it('invokes searchUris without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisResponse() - ); - client.innerApiCalls.searchUris = stubSimpleCall(expectedResponse); - const [response] = await client.searchUris(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes searchUris without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisResponse() - ); - client.innerApiCalls.searchUris = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchUris( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1.ISearchUrisResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes searchUris with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.searchUris = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchUris(request), expectedError); - }); - - it('invokes searchUris with closed client', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.searchUris(request), expectedError); - }); - }); - - describe('searchHashes', () => { - it('invokes searchHashes without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesResponse() - ); - client.innerApiCalls.searchHashes = stubSimpleCall(expectedResponse); - const [response] = await client.searchHashes(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes searchHashes without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesResponse() - ); - client.innerApiCalls.searchHashes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchHashes( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1.ISearchHashesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes searchHashes with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.searchHashes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchHashes(request), expectedError); - }); - - it('invokes searchHashes with closed client', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.searchHashes(request), expectedError); - }); - }); - - describe('createSubmission', () => { - it('invokes createSubmission without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.Submission() - ); - client.innerApiCalls.createSubmission = stubSimpleCall(expectedResponse); - const [response] = await client.createSubmission(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSubmission without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.Submission() - ); - client.innerApiCalls.createSubmission = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSubmission( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1.ISubmission|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSubmission with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSubmission = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSubmission(request), expectedError); - const actualRequest = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSubmission with closed client', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSubmission(request), expectedError); - }); - }); - - describe('submitUri', () => { - it('invokes submitUri without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SubmitUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.submitUri = stubLongRunningCall(expectedResponse); - const [operation] = await client.submitUri(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes submitUri without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SubmitUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.submitUri = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.submitUri( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes submitUri with call error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SubmitUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.submitUri = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.submitUri(request), expectedError); - const actualRequest = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes submitUri with LRO error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SubmitUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.submitUri = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.submitUri(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkSubmitUriProgress without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkSubmitUriProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSubmitUriProgress with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkSubmitUriProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - 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 webriskserviceModule.v1.WebRiskServiceClient({ - 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 webriskserviceModule.v1.WebRiskServiceClient({ - 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 webriskserviceModule.v1.WebRiskServiceClient({ - 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 webriskserviceModule.v1.WebRiskServiceClient({ - 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 webriskserviceModule.v1.WebRiskServiceClient({ - 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 webriskserviceModule.v1.WebRiskServiceClient({ - 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 webriskserviceModule.v1.WebRiskServiceClient({ - 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 webriskserviceModule.v1.WebRiskServiceClient({ - 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 webriskserviceModule.v1.WebRiskServiceClient({ - 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 webriskserviceModule.v1.WebRiskServiceClient({ - 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('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - 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-webrisk/v1/tsconfig.json b/owl-bot-staging/google-cloud-webrisk/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1/webpack.config.js b/owl-bot-staging/google-cloud-webrisk/v1/webpack.config.js deleted file mode 100644 index c45917670d0..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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: 'WebRiskService', - filename: './web-risk-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-webrisk/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/.gitignore b/owl-bot-staging/google-cloud-webrisk/v1beta1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/.jsdoc.js deleted file mode 100644 index ef4492b8ebb..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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/web-risk', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1beta1/README.md b/owl-bot-staging/google-cloud-webrisk/v1beta1/README.md deleted file mode 100644 index 55d440eecb3..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Webrisk: Nodejs Client diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/package.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/package.json deleted file mode 100644 index a1d7fd0bc74..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/web-risk", - "version": "0.1.0", - "description": "Webrisk client for Node.js", - "repository": "googleapis/nodejs-webrisk", - "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 webrisk", - "webrisk", - "web risk service 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-webrisk/v1beta1/protos/google/cloud/webrisk/v1beta1/webrisk.proto b/owl-bot-staging/google-cloud-webrisk/v1beta1/protos/google/cloud/webrisk/v1beta1/webrisk.proto deleted file mode 100644 index 6fcdb3aec61..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/protos/google/cloud/webrisk/v1beta1/webrisk.proto +++ /dev/null @@ -1,303 +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.webrisk.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.WebRisk.V1Beta1"; -option go_package = "cloud.google.com/go/webrisk/apiv1beta1/webriskpb;webriskpb"; -option java_multiple_files = true; -option java_outer_classname = "WebRiskProto"; -option java_package = "com.google.webrisk.v1beta1"; -option objc_class_prefix = "GCWR"; -option php_namespace = "Google\\Cloud\\WebRisk\\V1beta1"; -option ruby_package = "Google::Cloud::WebRisk::V1beta1"; - -// Web Risk v1beta1 API defines an interface to detect malicious URLs on your -// website and in client applications. -service WebRiskServiceV1Beta1 { - option (google.api.default_host) = "webrisk.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Gets the most recent threat list diffs. - rpc ComputeThreatListDiff(ComputeThreatListDiffRequest) returns (ComputeThreatListDiffResponse) { - option (google.api.http) = { - get: "/v1beta1/threatLists:computeDiff" - }; - option (google.api.method_signature) = "threat_type,version_token,constraints"; - } - - // This method is used to check whether a URI is on a given threatList. - rpc SearchUris(SearchUrisRequest) returns (SearchUrisResponse) { - option (google.api.http) = { - get: "/v1beta1/uris:search" - }; - option (google.api.method_signature) = "uri,threat_types"; - } - - // Gets the full hashes that match the requested hash prefix. - // This is used after a hash prefix is looked up in a threatList - // and there is a match. The client side threatList only holds partial hashes - // so the client must query this method to determine if there is a full - // hash match of a threat. - rpc SearchHashes(SearchHashesRequest) returns (SearchHashesResponse) { - option (google.api.http) = { - get: "/v1beta1/hashes:search" - }; - option (google.api.method_signature) = "hash_prefix,threat_types"; - } -} - -// Describes an API diff request. -message ComputeThreatListDiffRequest { - // The constraints for this diff. - message Constraints { - // The maximum size in number of entries. The diff will not contain more - // entries than this value. This should be a power of 2 between 2**10 and - // 2**20. If zero, no diff size limit is set. - int32 max_diff_entries = 1; - - // Sets the maximum number of entries that the client is willing to have - // in the local database. This should be a power of 2 between 2**10 and - // 2**20. If zero, no database size limit is set. - int32 max_database_entries = 2; - - // The compression types supported by the client. - repeated CompressionType supported_compressions = 3; - } - - // The ThreatList to update. - ThreatType threat_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // The current version token of the client for the requested list (the - // client version that was received from the last successful diff). - bytes version_token = 2; - - // Required. The constraints associated with this request. - Constraints constraints = 3 [(google.api.field_behavior) = REQUIRED]; -} - -message ComputeThreatListDiffResponse { - // The expected state of a client's local database. - message Checksum { - // The SHA256 hash of the client state; that is, of the sorted list of all - // hashes present in the database. - bytes sha256 = 1; - } - - // The type of response sent to the client. - enum ResponseType { - // Unknown. - RESPONSE_TYPE_UNSPECIFIED = 0; - - // Partial updates are applied to the client's existing local database. - DIFF = 1; - - // Full updates resets the client's entire local database. This means - // that either the client had no state, was seriously out-of-date, - // or the client is believed to be corrupt. - RESET = 2; - } - - // The type of response. This may indicate that an action must be taken by the - // client when the response is received. - ResponseType response_type = 4; - - // A set of entries to add to a local threat type's list. - ThreatEntryAdditions additions = 5; - - // A set of entries to remove from a local threat type's list. - // This field may be empty. - ThreatEntryRemovals removals = 6; - - // The new opaque client version token. - bytes new_version_token = 7; - - // The expected SHA256 hash of the client state; that is, of the sorted list - // of all hashes present in the database after applying the provided diff. - // If the client state doesn't match the expected state, the client must - // disregard this diff and retry later. - Checksum checksum = 8; - - // The soonest the client should wait before issuing any diff - // request. Querying sooner is unlikely to produce a meaningful diff. - // Waiting longer is acceptable considering the use case. - // If this field is not set clients may update as soon as they want. - google.protobuf.Timestamp recommended_next_diff = 2; -} - -// Request to check URI entries against threatLists. -message SearchUrisRequest { - // Required. The URI to be checked for matches. - string uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ThreatLists to search in. - repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message SearchUrisResponse { - // Contains threat information on a matching uri. - message ThreatUri { - // The ThreatList this threat belongs to. - repeated ThreatType threat_types = 1; - - // The cache lifetime for the returned match. Clients must not cache this - // response past this timestamp to avoid false positives. - google.protobuf.Timestamp expire_time = 2; - } - - // The threat list matches. This may be empty if the URI is on no list. - ThreatUri threat = 1; -} - -// Request to return full hashes matched by the provided hash prefixes. -message SearchHashesRequest { - // A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 - // hash. For JSON requests, this field is base64-encoded. - bytes hash_prefix = 1; - - // Required. The ThreatLists to search in. - repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message SearchHashesResponse { - // Contains threat information on a matching hash. - message ThreatHash { - // The ThreatList this threat belongs to. - // This must contain at least one entry. - repeated ThreatType threat_types = 1; - - // A 32 byte SHA256 hash. This field is in binary format. For JSON - // requests, hashes are base64-encoded. - bytes hash = 2; - - // The cache lifetime for the returned match. Clients must not cache this - // response past this timestamp to avoid false positives. - google.protobuf.Timestamp expire_time = 3; - } - - // The full hashes that matched the requested prefixes. - // The hash will be populated in the key. - repeated ThreatHash threats = 1; - - // For requested entities that did not match the threat list, how long to - // cache the response until. - google.protobuf.Timestamp negative_expire_time = 2; -} - -// Contains the set of entries to add to a local database. -// May contain a combination of compressed and raw data in a single response. -message ThreatEntryAdditions { - // The raw SHA256-formatted entries. - // Repeated to allow returning sets of hashes with different prefix sizes. - repeated RawHashes raw_hashes = 1; - - // The encoded 4-byte prefixes of SHA256-formatted entries, using a - // Golomb-Rice encoding. The hashes are converted to uint32, sorted in - // ascending order, then delta encoded and stored as encoded_data. - RiceDeltaEncoding rice_hashes = 2; -} - -// Contains the set of entries to remove from a local database. -message ThreatEntryRemovals { - // The raw removal indices for a local list. - RawIndices raw_indices = 1; - - // The encoded local, lexicographically-sorted list indices, using a - // Golomb-Rice encoding. Used for sending compressed removal indices. The - // removal indices (uint32) are sorted in ascending order, then delta encoded - // and stored as encoded_data. - RiceDeltaEncoding rice_indices = 2; -} - -// The type of threat. This maps dirrectly to the threat list a threat may -// belong to. -enum ThreatType { - // Unknown. - THREAT_TYPE_UNSPECIFIED = 0; - - // Malware targeting any platform. - MALWARE = 1; - - // Social engineering targeting any platform. - SOCIAL_ENGINEERING = 2; - - // Unwanted software targeting any platform. - UNWANTED_SOFTWARE = 3; -} - -// The ways in which threat entry sets can be compressed. -enum CompressionType { - // Unknown. - COMPRESSION_TYPE_UNSPECIFIED = 0; - - // Raw, uncompressed data. - RAW = 1; - - // Rice-Golomb encoded data. - RICE = 2; -} - -// A set of raw indices to remove from a local list. -message RawIndices { - // The indices to remove from a lexicographically-sorted local list. - repeated int32 indices = 1; -} - -// The uncompressed threat entries in hash format. -// Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4 -// bytes, but some hashes are lengthened if they collide with the hash of a -// popular URI. -// -// Used for sending ThreatEntryAdditons to clients that do not support -// compression, or when sending non-4-byte hashes to clients that do support -// compression. -message RawHashes { - // The number of bytes for each prefix encoded below. This field can be - // anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). - int32 prefix_size = 1; - - // The hashes, in binary format, concatenated into one long string. Hashes are - // sorted in lexicographic order. For JSON API users, hashes are - // base64-encoded. - bytes raw_hashes = 2; -} - -// The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or -// compressed removal indices. -message RiceDeltaEncoding { - // The offset of the first entry in the encoded data, or, if only a single - // integer was encoded, that single integer's value. If the field is empty or - // missing, assume zero. - int64 first_value = 1; - - // The Golomb-Rice parameter, which is a number between 2 and 28. This field - // is missing (that is, zero) if `num_entries` is zero. - int32 rice_parameter = 2; - - // The number of entries that are delta encoded in the encoded data. If only a - // single integer was encoded, this will be zero and the single value will be - // stored in `first_value`. - int32 entry_count = 3; - - // The encoded deltas that are encoded using the Golomb-Rice coder. - bytes encoded_data = 4; -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json deleted file mode 100644 index 50a7a60596f..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-webrisk", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.webrisk.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_async", - "title": "WebRiskServiceV1Beta1 computeThreatListDiff Sample", - "origin": "API_DEFINITION", - "description": " Gets the most recent threat list diffs.", - "canonical": true, - "file": "web_risk_service_v1_beta1.compute_threat_list_diff.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ComputeThreatListDiff", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.ComputeThreatListDiff", - "async": true, - "parameters": [ - { - "name": "threat_type", - "type": ".google.cloud.webrisk.v1beta1.ThreatType" - }, - { - "name": "version_token", - "type": "TYPE_BYTES" - }, - { - "name": "constraints", - "type": ".google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints" - } - ], - "resultType": ".google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse", - "client": { - "shortName": "WebRiskServiceV1Beta1Client", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client" - }, - "method": { - "shortName": "ComputeThreatListDiff", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.ComputeThreatListDiff", - "service": { - "shortName": "WebRiskServiceV1Beta1", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1" - } - } - } - }, - { - "regionTag": "webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_async", - "title": "WebRiskServiceV1Beta1 searchUris Sample", - "origin": "API_DEFINITION", - "description": " This method is used to check whether a URI is on a given threatList.", - "canonical": true, - "file": "web_risk_service_v1_beta1.search_uris.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SearchUris", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.SearchUris", - "async": true, - "parameters": [ - { - "name": "uri", - "type": "TYPE_STRING" - }, - { - "name": "threat_types", - "type": "TYPE_ENUM[]" - } - ], - "resultType": ".google.cloud.webrisk.v1beta1.SearchUrisResponse", - "client": { - "shortName": "WebRiskServiceV1Beta1Client", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client" - }, - "method": { - "shortName": "SearchUris", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.SearchUris", - "service": { - "shortName": "WebRiskServiceV1Beta1", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1" - } - } - } - }, - { - "regionTag": "webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_async", - "title": "WebRiskServiceV1Beta1 searchHashes Sample", - "origin": "API_DEFINITION", - "description": " Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is looked up in a threatList and there is a match. The client side threatList only holds partial hashes so the client must query this method to determine if there is a full hash match of a threat.", - "canonical": true, - "file": "web_risk_service_v1_beta1.search_hashes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SearchHashes", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.SearchHashes", - "async": true, - "parameters": [ - { - "name": "hash_prefix", - "type": "TYPE_BYTES" - }, - { - "name": "threat_types", - "type": "TYPE_ENUM[]" - } - ], - "resultType": ".google.cloud.webrisk.v1beta1.SearchHashesResponse", - "client": { - "shortName": "WebRiskServiceV1Beta1Client", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client" - }, - "method": { - "shortName": "SearchHashes", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1.SearchHashes", - "service": { - "shortName": "WebRiskServiceV1Beta1", - "fullName": "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js deleted file mode 100644 index 3f06b796af0..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.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(threatType, constraints) { - // [START webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 ThreatList to update. - */ - // const threatType = {} - /** - * The current version token of the client for the requested list (the - * client version that was received from the last successful diff). - */ - // const versionToken = Buffer.from('string') - /** - * Required. The constraints associated with this request. - */ - // const constraints = {} - - // Imports the Webrisk library - const {WebRiskServiceV1Beta1Client} = require('@google-cloud/web-risk').v1beta1; - - // Instantiates a client - const webriskClient = new WebRiskServiceV1Beta1Client(); - - async function callComputeThreatListDiff() { - // Construct request - const request = { - threatType, - constraints, - }; - - // Run request - const response = await webriskClient.computeThreatListDiff(request); - console.log(response); - } - - callComputeThreatListDiff(); - // [END webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js deleted file mode 100644 index a6dbc74336d..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.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(threatTypes) { - // [START webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 hash prefix, consisting of the most significant 4-32 bytes of a SHA256 - * hash. For JSON requests, this field is base64-encoded. - */ - // const hashPrefix = Buffer.from('string') - /** - * Required. The ThreatLists to search in. - */ - // const threatTypes = [1,2,3,4] - - // Imports the Webrisk library - const {WebRiskServiceV1Beta1Client} = require('@google-cloud/web-risk').v1beta1; - - // Instantiates a client - const webriskClient = new WebRiskServiceV1Beta1Client(); - - async function callSearchHashes() { - // Construct request - const request = { - threatTypes, - }; - - // Run request - const response = await webriskClient.searchHashes(request); - console.log(response); - } - - callSearchHashes(); - // [END webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js deleted file mode 100644 index 8a379be79fc..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.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(uri, threatTypes) { - // [START webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The URI to be checked for matches. - */ - // const uri = 'abc123' - /** - * Required. The ThreatLists to search in. - */ - // const threatTypes = [1,2,3,4] - - // Imports the Webrisk library - const {WebRiskServiceV1Beta1Client} = require('@google-cloud/web-risk').v1beta1; - - // Instantiates a client - const webriskClient = new WebRiskServiceV1Beta1Client(); - - async function callSearchUris() { - // Construct request - const request = { - uri, - threatTypes, - }; - - // Run request - const response = await webriskClient.searchUris(request); - console.log(response); - } - - callSearchUris(); - // [END webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/index.ts deleted file mode 100644 index cf99cbbf92c..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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 WebRiskServiceV1Beta1Client = v1beta1.WebRiskServiceV1Beta1Client; -type WebRiskServiceV1Beta1Client = v1beta1.WebRiskServiceV1Beta1Client; -export {v1beta1, WebRiskServiceV1Beta1Client}; -export default {v1beta1, WebRiskServiceV1Beta1Client}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 9ed88dddb8c..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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.webrisk.v1beta1", - "libraryPackage": "@google-cloud/web-risk", - "services": { - "WebRiskServiceV1Beta1": { - "clients": { - "grpc": { - "libraryClient": "WebRiskServiceV1Beta1Client", - "rpcs": { - "ComputeThreatListDiff": { - "methods": [ - "computeThreatListDiff" - ] - }, - "SearchUris": { - "methods": [ - "searchUris" - ] - }, - "SearchHashes": { - "methods": [ - "searchHashes" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WebRiskServiceV1Beta1Client", - "rpcs": { - "ComputeThreatListDiff": { - "methods": [ - "computeThreatListDiff" - ] - }, - "SearchUris": { - "methods": [ - "searchUris" - ] - }, - "SearchHashes": { - "methods": [ - "searchHashes" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index a2578d92a56..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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 {WebRiskServiceV1Beta1Client} from './web_risk_service_v1_beta1_client'; diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client.ts deleted file mode 100644 index 2f3308225fe..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client.ts +++ /dev/null @@ -1,516 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/web_risk_service_v1_beta1_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './web_risk_service_v1_beta1_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Web Risk v1beta1 API defines an interface to detect malicious URLs on your - * website and in client applications. - * @class - * @memberof v1beta1 - */ -export class WebRiskServiceV1Beta1Client { - 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}; - webRiskServiceV1Beta1Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WebRiskServiceV1Beta1Client. - * - * @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 WebRiskServiceV1Beta1Client({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 WebRiskServiceV1Beta1Client; - 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.webrisk.v1beta1.WebRiskServiceV1Beta1', 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.webRiskServiceV1Beta1Stub) { - return this.webRiskServiceV1Beta1Stub; - } - - // Put together the "service stub" for - // google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1. - this.webRiskServiceV1Beta1Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1, - 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 webRiskServiceV1Beta1StubMethods = - ['computeThreatListDiff', 'searchUris', 'searchHashes']; - for (const methodName of webRiskServiceV1Beta1StubMethods) { - const callPromise = this.webRiskServiceV1Beta1Stub.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.webRiskServiceV1Beta1Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'webrisk.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 'webrisk.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 most recent threat list diffs. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.webrisk.v1beta1.ThreatType} request.threatType - * The ThreatList to update. - * @param {Buffer} request.versionToken - * The current version token of the client for the requested list (the - * client version that was received from the last successful diff). - * @param {google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints} request.constraints - * Required. The constraints associated with 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.webrisk.v1beta1.ComputeThreatListDiffResponse|ComputeThreatListDiffResponse}. - * Please see the {@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/web_risk_service_v1_beta1.compute_threat_list_diff.js - * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_async - */ - computeThreatListDiff( - request?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|undefined, {}|undefined - ]>; - computeThreatListDiff( - request: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): void; - computeThreatListDiff( - request: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): void; - computeThreatListDiff( - request?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.computeThreatListDiff(request, options, callback); - } -/** - * This method is used to check whether a URI is on a given threatList. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.uri - * Required. The URI to be checked for matches. - * @param {number[]} request.threatTypes - * Required. The ThreatLists to search in. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.webrisk.v1beta1.SearchUrisResponse|SearchUrisResponse}. - * Please see the {@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/web_risk_service_v1_beta1.search_uris.js - * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_async - */ - searchUris( - request?: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|undefined, {}|undefined - ]>; - searchUris( - request: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): void; - searchUris( - request: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): void; - searchUris( - request?: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.searchUris(request, options, callback); - } -/** - * Gets the full hashes that match the requested hash prefix. - * This is used after a hash prefix is looked up in a threatList - * and there is a match. The client side threatList only holds partial hashes - * so the client must query this method to determine if there is a full - * hash match of a threat. - * - * @param {Object} request - * The request object that will be sent. - * @param {Buffer} request.hashPrefix - * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 - * hash. For JSON requests, this field is base64-encoded. - * @param {number[]} request.threatTypes - * Required. The ThreatLists to search in. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.webrisk.v1beta1.SearchHashesResponse|SearchHashesResponse}. - * Please see the {@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/web_risk_service_v1_beta1.search_hashes.js - * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_async - */ - searchHashes( - request?: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|undefined, {}|undefined - ]>; - searchHashes( - request: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): void; - searchHashes( - request: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): void; - searchHashes( - request?: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.searchHashes(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.webRiskServiceV1Beta1Stub && !this._terminated) { - return this.webRiskServiceV1Beta1Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client_config.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client_config.json deleted file mode 100644 index 669c2233b29..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_client_config.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "interfaces": { - "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1": { - "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": { - "ComputeThreatListDiff": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SearchUris": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SearchHashes": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_proto_list.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_proto_list.json deleted file mode 100644 index 9b9d46584be..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/src/v1beta1/web_risk_service_v1_beta1_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/webrisk/v1beta1/webrisk.proto" -] diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 4655e7378ed..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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 webrisk = require('@google-cloud/web-risk'); - -function main() { - const webRiskServiceV1Beta1Client = new webrisk.WebRiskServiceV1Beta1Client(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 35c735b60e9..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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 {WebRiskServiceV1Beta1Client} from '@google-cloud/web-risk'; - -// check that the client class type name can be used -function doStuffWithWebRiskServiceV1Beta1Client(client: WebRiskServiceV1Beta1Client) { - client.close(); -} - -function main() { - // check that the client instance can be created - const webRiskServiceV1Beta1Client = new WebRiskServiceV1Beta1Client(); - doStuffWithWebRiskServiceV1Beta1Client(webRiskServiceV1Beta1Client); -} - -main(); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1beta1/test/gapic_web_risk_service_v1_beta1_v1beta1.ts b/owl-bot-staging/google-cloud-webrisk/v1beta1/test/gapic_web_risk_service_v1_beta1_v1beta1.ts deleted file mode 100644 index f23b77476ab..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/v1beta1/test/gapic_web_risk_service_v1_beta1_v1beta1.ts +++ /dev/null @@ -1,375 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 webriskservicev1beta1Module 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.WebRiskServiceV1Beta1Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); - await client.initialize(); - assert(client.webRiskServiceV1Beta1Stub); - }); - - it('has close method for the initialized client', done => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.webRiskServiceV1Beta1Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - 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 webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - 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('computeThreatListDiff', () => { - it('invokes computeThreatListDiff without error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse() - ); - client.innerApiCalls.computeThreatListDiff = stubSimpleCall(expectedResponse); - const [response] = await client.computeThreatListDiff(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes computeThreatListDiff without error using callback', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse() - ); - client.innerApiCalls.computeThreatListDiff = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.computeThreatListDiff( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes computeThreatListDiff with error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.computeThreatListDiff = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.computeThreatListDiff(request), expectedError); - }); - - it('invokes computeThreatListDiff with closed client', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.computeThreatListDiff(request), expectedError); - }); - }); - - describe('searchUris', () => { - it('invokes searchUris without error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisResponse() - ); - client.innerApiCalls.searchUris = stubSimpleCall(expectedResponse); - const [response] = await client.searchUris(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes searchUris without error using callback', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisResponse() - ); - client.innerApiCalls.searchUris = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchUris( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes searchUris with error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.searchUris = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchUris(request), expectedError); - }); - - it('invokes searchUris with closed client', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.searchUris(request), expectedError); - }); - }); - - describe('searchHashes', () => { - it('invokes searchHashes without error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesResponse() - ); - client.innerApiCalls.searchHashes = stubSimpleCall(expectedResponse); - const [response] = await client.searchHashes(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes searchHashes without error using callback', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesResponse() - ); - client.innerApiCalls.searchHashes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchHashes( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes searchHashes with error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.searchHashes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchHashes(request), expectedError); - }); - - it('invokes searchHashes with closed client', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.searchHashes(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-webrisk/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-webrisk/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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-webrisk/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-webrisk/v1beta1/webpack.config.js deleted file mode 100644 index 9179bba0e0a..00000000000 --- a/owl-bot-staging/google-cloud-webrisk/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: 'WebRiskServiceV1Beta1', - filename: './web-risk-service-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-websecurityscanner/v1/.eslintignore b/owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1/.eslintrc.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/.gitignore b/owl-bot-staging/google-cloud-websecurityscanner/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1/.jsdoc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/.jsdoc.js deleted file mode 100644 index efbbc504438..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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/web-security-scanner', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/.mocharc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1/.prettierrc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1/README.md b/owl-bot-staging/google-cloud-websecurityscanner/v1/README.md deleted file mode 100644 index 727d3b68aef..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Websecurityscanner: Nodejs Client diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/package.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/package.json deleted file mode 100644 index e7d7667cbd2..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/web-security-scanner", - "version": "0.1.0", - "description": "Websecurityscanner client for Node.js", - "repository": "googleapis/nodejs-websecurityscanner", - "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 websecurityscanner", - "websecurityscanner", - "web security scanner" - ], - "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-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto deleted file mode 100644 index 6b8f8df3b62..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto +++ /dev/null @@ -1,40 +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.websecurityscanner.v1; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "CrawledUrlProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web -// Security Scanner Service crawls the web applications, following all links -// within the scope of sites, to find the URLs to test against. -message CrawledUrl { - // Output only. The http method of the request that was used to visit the URL, in - // uppercase. - string http_method = 1; - - // Output only. The URL that was crawled. - string url = 2; - - // Output only. The body of the request that was used to visit the URL. - string body = 3; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding.proto deleted file mode 100644 index 0226bbf54c0..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding.proto +++ /dev/null @@ -1,122 +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.websecurityscanner.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1/finding_addon.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "FindingProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// A Finding resource represents a vulnerability instance identified during a -// ScanRun. -message Finding { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/Finding" - pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" - }; - - // The severity level of a vulnerability. - enum Severity { - // No severity specified. The default value. - SEVERITY_UNSPECIFIED = 0; - - // Critical severity. - CRITICAL = 1; - - // High severity. - HIGH = 2; - - // Medium severity. - MEDIUM = 3; - - // Low severity. - LOW = 4; - } - - // Output only. The resource name of the Finding. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. - // The finding IDs are generated by the system. - string name = 1; - - // Output only. The type of the Finding. - // Detailed and up-to-date information on findings can be found here: - // https://cloud.google.com/security-command-center/docs/how-to-remediate-web-security-scanner-findings - string finding_type = 2; - - // Output only. The severity level of the reported vulnerability. - Severity severity = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The http method of the request that triggered the vulnerability, in - // uppercase. - string http_method = 3; - - // Output only. The URL produced by the server-side fuzzer and used in the request that - // triggered the vulnerability. - string fuzzed_url = 4; - - // Output only. The body of the request that triggered the vulnerability. - string body = 5; - - // Output only. The description of the vulnerability. - string description = 6; - - // Output only. The URL containing human-readable payload that user can leverage to - // reproduce the vulnerability. - string reproduction_url = 7; - - // Output only. If the vulnerability was originated from nested IFrame, the immediate - // parent IFrame is reported. - string frame_url = 8; - - // Output only. The URL where the browser lands when the vulnerability is detected. - string final_url = 9; - - // Output only. The tracking ID uniquely identifies a vulnerability instance across - // multiple ScanRuns. - string tracking_id = 10; - - // Output only. An addon containing information reported for a vulnerability with an HTML - // form, if any. - Form form = 16; - - // Output only. An addon containing information about outdated libraries. - OutdatedLibrary outdated_library = 11; - - // Output only. An addon containing detailed information regarding any resource causing the - // vulnerability such as JavaScript sources, image, audio files, etc. - ViolatingResource violating_resource = 12; - - // Output only. An addon containing information about vulnerable or missing HTTP headers. - VulnerableHeaders vulnerable_headers = 15; - - // Output only. An addon containing information about request parameters which were found - // to be vulnerable. - VulnerableParameters vulnerable_parameters = 13; - - // Output only. An addon containing information reported for an XSS, if any. - Xss xss = 14; - - // Output only. An addon containing information reported for an XXE, if any. - Xxe xxe = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto deleted file mode 100644 index 409a7db542e..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto +++ /dev/null @@ -1,166 +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.websecurityscanner.v1; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "FindingAddonProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// ! Information about a vulnerability with an HTML. -message Form { - // ! The URI where to send the form when it's submitted. - string action_uri = 1; - - // ! The names of form fields related to the vulnerability. - repeated string fields = 2; -} - -// Information reported for an outdated library. -message OutdatedLibrary { - // The name of the outdated library. - string library_name = 1; - - // The version number. - string version = 2; - - // URLs to learn more information about the vulnerabilities in the library. - repeated string learn_more_urls = 3; -} - -// Information regarding any resource causing the vulnerability such -// as JavaScript sources, image, audio files, etc. -message ViolatingResource { - // The MIME type of this resource. - string content_type = 1; - - // URL of this violating resource. - string resource_url = 2; -} - -// Information about vulnerable request parameters. -message VulnerableParameters { - // The vulnerable parameter names. - repeated string parameter_names = 1; -} - -// Information about vulnerable or missing HTTP Headers. -message VulnerableHeaders { - // Describes a HTTP Header. - message Header { - // Header name. - string name = 1; - - // Header value. - string value = 2; - } - - // List of vulnerable headers. - repeated Header headers = 1; - - // List of missing headers. - repeated Header missing_headers = 2; -} - -// Information reported for an XSS. -message Xss { - // Types of XSS attack vector. - enum AttackVector { - // Unknown attack vector. - ATTACK_VECTOR_UNSPECIFIED = 0; - - // The attack comes from fuzzing the browser's localStorage. - LOCAL_STORAGE = 1; - - // The attack comes from fuzzing the browser's sessionStorage. - SESSION_STORAGE = 2; - - // The attack comes from fuzzing the window's name property. - WINDOW_NAME = 3; - - // The attack comes from fuzzing the referrer property. - REFERRER = 4; - - // The attack comes from fuzzing an input element. - FORM_INPUT = 5; - - // The attack comes from fuzzing the browser's cookies. - COOKIE = 6; - - // The attack comes from hijacking the post messaging mechanism. - POST_MESSAGE = 7; - - // The attack comes from fuzzing parameters in the url. - GET_PARAMETERS = 8; - - // The attack comes from fuzzing the fragment in the url. - URL_FRAGMENT = 9; - - // The attack comes from fuzzing the HTML comments. - HTML_COMMENT = 10; - - // The attack comes from fuzzing the POST parameters. - POST_PARAMETERS = 11; - - // The attack comes from fuzzing the protocol. - PROTOCOL = 12; - - // The attack comes from the server side and is stored. - STORED_XSS = 13; - - // The attack is a Same-Origin Method Execution attack via a GET parameter. - SAME_ORIGIN = 14; - - // The attack payload is received from a third-party host via a URL that is - // user-controllable - USER_CONTROLLABLE_URL = 15; - } - - // Stack traces leading to the point where the XSS occurred. - repeated string stack_traces = 1; - - // An error message generated by a javascript breakage. - string error_message = 2; - - // The attack vector of the payload triggering this XSS. - AttackVector attack_vector = 3; - - // The reproduction url for the seeding POST request of a Stored XSS. - string stored_xss_seeding_url = 4; -} - -// Information reported for an XXE. -message Xxe { - // Locations within a request where XML was substituted. - enum Location { - // Unknown Location. - LOCATION_UNSPECIFIED = 0; - - // The XML payload replaced the complete request body. - COMPLETE_REQUEST_BODY = 1; - } - - // The XML string that triggered the XXE vulnerability. Non-payload values - // might be redacted. - string payload_value = 1; - - // Location within the request where the payload was placed. - Location payload_location = 2; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto deleted file mode 100644 index 94a5e7ea6ce..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto +++ /dev/null @@ -1,35 +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.websecurityscanner.v1; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "FindingTypeStatsProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// A FindingTypeStats resource represents stats regarding a specific FindingType -// of Findings under a given ScanRun. -message FindingTypeStats { - // Output only. The finding type associated with the stats. - string finding_type = 1; - - // Output only. The count of findings belonging to this finding type. - int32 finding_count = 2; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto deleted file mode 100644 index 12f3ece5848..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto +++ /dev/null @@ -1,193 +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.websecurityscanner.v1; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanConfigProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// A ScanConfig resource contains the configurations to launch a scan. -message ScanConfig { - // Scan authentication configuration. - message Authentication { - // Describes authentication configuration that uses a Google account. - message GoogleAccount { - option deprecated = true; - - // Required. The user name of the Google account. - string username = 1; - - // Required. Input only. The password of the Google account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2; - } - - // Describes authentication configuration that uses a custom account. - message CustomAccount { - // Required. The user name of the custom account. - string username = 1; - - // Required. Input only. The password of the custom account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2; - - // Required. The login form URL of the website. - string login_url = 3; - } - - // Describes authentication configuration for Identity-Aware-Proxy (IAP). - message IapCredential { - // Describes authentication configuration when Web-Security-Scanner - // service account is added in Identity-Aware-Proxy (IAP) access policies. - message IapTestServiceAccountInfo { - // Required. Describes OAuth2 client id of resources protected by - // Identity-Aware-Proxy (IAP). - string target_audience_client_id = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // Identity-Aware-Proxy (IAP) Authentication Configuration - oneof iap_credentials { - // Authentication configuration when Web-Security-Scanner service - // account is added in Identity-Aware-Proxy (IAP) access policies. - IapTestServiceAccountInfo iap_test_service_account_info = 1; - } - } - - // Required. - // Authentication configuration - oneof authentication { - // Authentication using a Google account. - GoogleAccount google_account = 1 [deprecated = true]; - - // Authentication using a custom account. - CustomAccount custom_account = 2; - - // Authentication using Identity-Aware-Proxy (IAP). - IapCredential iap_credential = 4; - } - } - - // Scan schedule configuration. - message Schedule { - // A timestamp indicates when the next run will be scheduled. The value is - // refreshed by the server after each run. If unspecified, it will default - // to current server time, which means the scan will be scheduled to start - // immediately. - google.protobuf.Timestamp schedule_time = 1; - - // Required. The duration of time between executions in days. - int32 interval_duration_days = 2; - } - - // Type of user agents used for scanning. - enum UserAgent { - // The user agent is unknown. Service will default to CHROME_LINUX. - USER_AGENT_UNSPECIFIED = 0; - - // Chrome on Linux. This is the service default if unspecified. - CHROME_LINUX = 1; - - // Chrome on Android. - CHROME_ANDROID = 2; - - // Safari on IPhone. - SAFARI_IPHONE = 3; - } - - // Scan risk levels supported by Web Security Scanner. LOW impact - // scanning will minimize requests with the potential to modify data. To - // achieve the maximum scan coverage, NORMAL risk level is recommended. - enum RiskLevel { - // Use default, which is NORMAL. - RISK_LEVEL_UNSPECIFIED = 0; - - // Normal scanning (Recommended) - NORMAL = 1; - - // Lower impact scanning - LOW = 2; - } - - // Controls export of scan configurations and results to Security - // Command Center. - enum ExportToSecurityCommandCenter { - // Use default, which is ENABLED. - EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; - - // Export results of this scan to Security Command Center. - ENABLED = 1; - - // Do not export results of this scan to Security Command Center. - DISABLED = 2; - } - - // The resource name of the ScanConfig. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are - // generated by the system. - string name = 1; - - // Required. The user provided display name of the ScanConfig. - string display_name = 2; - - // The maximum QPS during scanning. A valid value ranges from 5 to 20 - // inclusively. If the field is unspecified or its value is set 0, server will - // default to 15. Other values outside of [5, 20] range will be rejected with - // INVALID_ARGUMENT error. - int32 max_qps = 3; - - // Required. The starting URLs from which the scanner finds site pages. - repeated string starting_urls = 4; - - // The authentication configuration. If specified, service will use the - // authentication configuration during scanning. - Authentication authentication = 5; - - // The user agent used during scanning. - UserAgent user_agent = 6; - - // The excluded URL patterns as described in - // https://cloud.google.com/security-command-center/docs/how-to-use-web-security-scanner#excluding_urls - repeated string blacklist_patterns = 7; - - // The schedule of the ScanConfig. - Schedule schedule = 8; - - // Controls export of scan configurations and results to Security - // Command Center. - ExportToSecurityCommandCenter export_to_security_command_center = 10; - - // The risk level selected for the scan - RiskLevel risk_level = 12; - - // Whether the scan config is managed by Web Security Scanner, output - // only. - bool managed_scan = 13; - - // Whether the scan configuration has enabled static IP address scan feature. - // If enabled, the scanner will access applications from static IP addresses. - bool static_ip_scan = 14; - - // Whether to keep scanning even if most requests return HTTP error codes. - bool ignore_http_status_errors = 15; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto deleted file mode 100644 index 96fe523b677..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto +++ /dev/null @@ -1,189 +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.websecurityscanner.v1; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanConfigErrorProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// Defines a custom error message used by CreateScanConfig and UpdateScanConfig -// APIs when scan configuration validation fails. It is also reported as part of -// a ScanRunErrorTrace message if scan validation fails due to a scan -// configuration error. -message ScanConfigError { - // Output only. - // Defines an error reason code. - // Next id: 44 - enum Code { - option allow_alias = true; - - // There is no error. - CODE_UNSPECIFIED = 0; - - // There is no error. - OK = 0; - - // Indicates an internal server error. - // Please DO NOT USE THIS ERROR CODE unless the root cause is truly unknown. - INTERNAL_ERROR = 1; - - // One of the seed URLs is an App Engine URL but we cannot validate the scan - // settings due to an App Engine API backend error. - APPENGINE_API_BACKEND_ERROR = 2; - - // One of the seed URLs is an App Engine URL but we cannot access the - // App Engine API to validate scan settings. - APPENGINE_API_NOT_ACCESSIBLE = 3; - - // One of the seed URLs is an App Engine URL but the Default Host of the - // App Engine is not set. - APPENGINE_DEFAULT_HOST_MISSING = 4; - - // Google corporate accounts can not be used for scanning. - CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; - - // The account of the scan creator can not be used for scanning. - CANNOT_USE_OWNER_ACCOUNT = 7; - - // This scan targets Compute Engine, but we cannot validate scan settings - // due to a Compute Engine API backend error. - COMPUTE_API_BACKEND_ERROR = 8; - - // This scan targets Compute Engine, but we cannot access the Compute Engine - // API to validate the scan settings. - COMPUTE_API_NOT_ACCESSIBLE = 9; - - // The Custom Login URL does not belong to the current project. - CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; - - // The Custom Login URL is malformed (can not be parsed). - CUSTOM_LOGIN_URL_MALFORMED = 11; - - // The Custom Login URL is mapped to a non-routable IP address in DNS. - CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; - - // The Custom Login URL is mapped to an IP address which is not reserved for - // the current project. - CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; - - // The Custom Login URL has a non-routable IP address. - CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; - - // The Custom Login URL has an IP address which is not reserved for the - // current project. - CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; - - // Another scan with the same name (case-sensitive) already exists. - DUPLICATE_SCAN_NAME = 16; - - // A field is set to an invalid value. - INVALID_FIELD_VALUE = 18; - - // There was an error trying to authenticate to the scan target. - FAILED_TO_AUTHENTICATE_TO_TARGET = 19; - - // Finding type value is not specified in the list findings request. - FINDING_TYPE_UNSPECIFIED = 20; - - // Scan targets Compute Engine, yet current project was not whitelisted for - // Google Compute Engine Scanning Alpha access. - FORBIDDEN_TO_SCAN_COMPUTE = 21; - - // User tries to update managed scan - FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; - - // The supplied filter is malformed. For example, it can not be parsed, does - // not have a filter type in expression, or the same filter type appears - // more than once. - MALFORMED_FILTER = 22; - - // The supplied resource name is malformed (can not be parsed). - MALFORMED_RESOURCE_NAME = 23; - - // The current project is not in an active state. - PROJECT_INACTIVE = 24; - - // A required field is not set. - REQUIRED_FIELD = 25; - - // Project id, scanconfig id, scanrun id, or finding id are not consistent - // with each other in resource name. - RESOURCE_NAME_INCONSISTENT = 26; - - // The scan being requested to start is already running. - SCAN_ALREADY_RUNNING = 27; - - // The scan that was requested to be stopped is not running. - SCAN_NOT_RUNNING = 28; - - // One of the seed URLs does not belong to the current project. - SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; - - // One of the seed URLs is malformed (can not be parsed). - SEED_URL_MALFORMED = 30; - - // One of the seed URLs is mapped to a non-routable IP address in DNS. - SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; - - // One of the seed URLs is mapped to an IP address which is not reserved - // for the current project. - SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; - - // One of the seed URLs has on-routable IP address. - SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; - - // One of the seed URLs has an IP address that is not reserved - // for the current project. - SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; - - // The Web Security Scanner service account is not configured under the - // project. - SERVICE_ACCOUNT_NOT_CONFIGURED = 36; - - // A project has reached the maximum number of scans. - TOO_MANY_SCANS = 37; - - // Resolving the details of the current project fails. - UNABLE_TO_RESOLVE_PROJECT_INFO = 38; - - // One or more blacklist patterns were in the wrong format. - UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; - - // The supplied filter is not supported. - UNSUPPORTED_FILTER = 40; - - // The supplied finding type is not supported. For example, we do not - // provide findings of the given finding type. - UNSUPPORTED_FINDING_TYPE = 41; - - // The URL scheme of one or more of the supplied URLs is not supported. - UNSUPPORTED_URL_SCHEME = 42; - } - - // Output only. Indicates the reason code for a configuration failure. - Code code = 1; - - // Output only. Indicates the full name of the ScanConfig field that triggers this error, - // for example "scan_config.max_qps". This field is provided for - // troubleshooting purposes only and its actual value can change in the - // future. - string field_name = 2; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto deleted file mode 100644 index 70f5b452316..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto +++ /dev/null @@ -1,110 +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.websecurityscanner.v1; - -import "google/cloud/websecurityscanner/v1/scan_run_error_trace.proto"; -import "google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// A ScanRun is a output-only resource representing an actual run of the scan. -// Next id: 12 -message ScanRun { - // Types of ScanRun execution state. - enum ExecutionState { - // Represents an invalid state caused by internal server error. This value - // should never be returned. - EXECUTION_STATE_UNSPECIFIED = 0; - - // The scan is waiting in the queue. - QUEUED = 1; - - // The scan is in progress. - SCANNING = 2; - - // The scan is either finished or stopped by user. - FINISHED = 3; - } - - // Types of ScanRun result state. - enum ResultState { - // Default value. This value is returned when the ScanRun is not yet - // finished. - RESULT_STATE_UNSPECIFIED = 0; - - // The scan finished without errors. - SUCCESS = 1; - - // The scan finished with errors. - ERROR = 2; - - // The scan was terminated by user. - KILLED = 3; - } - - // Output only. The resource name of the ScanRun. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - // The ScanRun IDs are generated by the system. - string name = 1; - - // Output only. The execution state of the ScanRun. - ExecutionState execution_state = 2; - - // Output only. The result state of the ScanRun. This field is only available after the - // execution state reaches "FINISHED". - ResultState result_state = 3; - - // Output only. The time at which the ScanRun started. - google.protobuf.Timestamp start_time = 4; - - // Output only. The time at which the ScanRun reached termination state - that the ScanRun - // is either finished or stopped by user. - google.protobuf.Timestamp end_time = 5; - - // Output only. The number of URLs crawled during this ScanRun. If the scan is in progress, - // the value represents the number of URLs crawled up to now. - int64 urls_crawled_count = 6; - - // Output only. The number of URLs tested during this ScanRun. If the scan is in progress, - // the value represents the number of URLs tested up to now. The number of - // URLs tested is usually larger than the number URLS crawled because - // typically a crawled URL is tested with multiple test payloads. - int64 urls_tested_count = 7; - - // Output only. Whether the scan run has found any vulnerabilities. - bool has_vulnerabilities = 8; - - // Output only. The percentage of total completion ranging from 0 to 100. - // If the scan is in queue, the value is 0. - // If the scan is running, the value ranges from 0 to 100. - // If the scan is finished, the value is 100. - int32 progress_percent = 9; - - // Output only. If result_state is an ERROR, this field provides the primary reason for - // scan's termination and more details, if such are available. - ScanRunErrorTrace error_trace = 10; - - // Output only. A list of warnings, if such are encountered during this scan run. - repeated ScanRunWarningTrace warning_traces = 11; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto deleted file mode 100644 index 8f906a57f0d..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto +++ /dev/null @@ -1,75 +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.websecurityscanner.v1; - -import "google/cloud/websecurityscanner/v1/scan_config_error.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunErrorTraceProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// Output only. -// Defines an error trace message for a ScanRun. -message ScanRunErrorTrace { - // Output only. - // Defines an error reason code. - // Next id: 8 - enum Code { - // Default value is never used. - CODE_UNSPECIFIED = 0; - - // Indicates that the scan run failed due to an internal server error. - INTERNAL_ERROR = 1; - - // Indicates a scan configuration error, usually due to outdated ScanConfig - // settings, such as starting_urls or the DNS configuration. - SCAN_CONFIG_ISSUE = 2; - - // Indicates an authentication error, usually due to outdated ScanConfig - // authentication settings. - AUTHENTICATION_CONFIG_ISSUE = 3; - - // Indicates a scan operation timeout, usually caused by a very large site. - TIMED_OUT_WHILE_SCANNING = 4; - - // Indicates that a scan encountered excessive redirects, either to - // authentication or some other page outside of the scan scope. - TOO_MANY_REDIRECTS = 5; - - // Indicates that a scan encountered numerous errors from the web site - // pages. When available, most_common_http_error_code field indicates the - // most common HTTP error code encountered during the scan. - TOO_MANY_HTTP_ERRORS = 6; - } - - // Output only. Indicates the error reason code. - Code code = 1; - - // Output only. If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error - // message encountered during scan configuration validation that is performed - // before each scan run. - ScanConfigError scan_config_error = 2; - - // Output only. If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most - // common HTTP error code, if such is available. For example, if this code is - // 404, the scan has encountered too many NOT_FOUND responses. - int32 most_common_http_error_code = 3; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_log.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_log.proto deleted file mode 100644 index c1692674de1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_log.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.websecurityscanner.v1; - -import "google/cloud/websecurityscanner/v1/scan_run.proto"; -import "google/cloud/websecurityscanner/v1/scan_run_error_trace.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunLogProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// A ScanRunLog is an output-only proto used for Stackdriver customer logging. -// It is used for logs covering the start and end of scan pipelines. -// Other than an added summary, this is a subset of the ScanRun. -// Representation in logs is either a proto Struct, or converted to JSON. -// Next id: 9 -message ScanRunLog { - // Human friendly message about the event. - string summary = 1; - - // The resource name of the ScanRun being logged. - string name = 2; - - // The execution state of the ScanRun. - google.cloud.websecurityscanner.v1.ScanRun.ExecutionState execution_state = 3; - - // The result state of the ScanRun. - google.cloud.websecurityscanner.v1.ScanRun.ResultState result_state = 4; - - int64 urls_crawled_count = 5; - - int64 urls_tested_count = 6; - - bool has_findings = 7; - - google.cloud.websecurityscanner.v1.ScanRunErrorTrace error_trace = 8; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto deleted file mode 100644 index db9d9330055..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto +++ /dev/null @@ -1,61 +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.websecurityscanner.v1; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunWarningTraceProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// Output only. -// Defines a warning trace message for ScanRun. Warning traces provide customers -// with useful information that helps make the scanning process more effective. -message ScanRunWarningTrace { - // Output only. - // Defines a warning message code. - // Next id: 6 - enum Code { - // Default value is never used. - CODE_UNSPECIFIED = 0; - - // Indicates that a scan discovered an unexpectedly low number of URLs. This - // is sometimes caused by complex navigation features or by using a single - // URL for numerous pages. - INSUFFICIENT_CRAWL_RESULTS = 1; - - // Indicates that a scan discovered too many URLs to test, or excessive - // redundant URLs. - TOO_MANY_CRAWL_RESULTS = 2; - - // Indicates that too many tests have been generated for the scan. Customer - // should try reducing the number of starting URLs, increasing the QPS rate, - // or narrowing down the scope of the scan using the excluded patterns. - TOO_MANY_FUZZ_TASKS = 3; - - // Indicates that a scan is blocked by IAP. - BLOCKED_BY_IAP = 4; - - // Indicates that no seeds is found for a scan - NO_STARTING_URL_FOUND_FOR_MANAGED_SCAN = 5; - } - - // Output only. Indicates the warning code. - Code code = 1; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto deleted file mode 100644 index 141f432c190..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto +++ /dev/null @@ -1,337 +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.websecurityscanner.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/cloud/websecurityscanner/v1/crawled_url.proto"; -import "google/cloud/websecurityscanner/v1/finding.proto"; -import "google/cloud/websecurityscanner/v1/finding_type_stats.proto"; -import "google/cloud/websecurityscanner/v1/scan_config.proto"; -import "google/cloud/websecurityscanner/v1/scan_run.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "WebSecurityScannerProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// Web Security Scanner Service identifies security vulnerabilities in web -// applications hosted on Google Cloud. It crawls your application, and -// attempts to exercise as many user inputs and event handlers as possible. -service WebSecurityScanner { - option (google.api.default_host) = "websecurityscanner.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new ScanConfig. - rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/scanConfigs" - body: "scan_config" - }; - } - - // Deletes an existing ScanConfig and its child resources. - rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/scanConfigs/*}" - }; - } - - // Gets a ScanConfig. - rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - get: "/v1/{name=projects/*/scanConfigs/*}" - }; - } - - // Lists ScanConfigs under a given project. - rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/scanConfigs" - }; - } - - // Updates a ScanConfig. This method support partial update of a ScanConfig. - rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - patch: "/v1/{scan_config.name=projects/*/scanConfigs/*}" - body: "scan_config" - }; - } - - // Start a ScanRun according to the given ScanConfig. - rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1/{name=projects/*/scanConfigs/*}:start" - body: "*" - }; - } - - // Gets a ScanRun. - rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - get: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*}" - }; - } - - // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - // stop time. - rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/scanConfigs/*}/scanRuns" - }; - } - - // Stops a ScanRun. The stopped ScanRun is returned. - rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" - body: "*" - }; - } - - // List CrawledUrls under a given ScanRun. - rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" - }; - } - - // Gets a Finding. - rpc GetFinding(GetFindingRequest) returns (Finding) { - option (google.api.http) = { - get: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" - }; - } - - // List Findings under a given ScanRun. - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" - }; - } - - // List all FindingTypeStats under a given ScanRun. - rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" - }; - } -} - -// Request for the `CreateScanConfig` method. -message CreateScanConfigRequest { - // Required. The parent resource name where the scan is created, which should be a - // project resource name in the format 'projects/{projectId}'. - string parent = 1; - - // Required. The ScanConfig to be created. - ScanConfig scan_config = 2; -} - -// Request for the `DeleteScanConfig` method. -message DeleteScanConfigRequest { - // Required. The resource name of the ScanConfig to be deleted. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1; -} - -// Request for the `GetScanConfig` method. -message GetScanConfigRequest { - // Required. The resource name of the ScanConfig to be returned. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1; -} - -// Request for the `ListScanConfigs` method. -message ListScanConfigsRequest { - // Required. The parent resource name, which should be a project resource name in the - // format 'projects/{projectId}'. - string parent = 1; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanConfigs to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Request for the `UpdateScanConfigRequest` method. -message UpdateScanConfigRequest { - // Required. The ScanConfig to be updated. The name field must be set to identify the - // resource to be updated. The values of fields not covered by the mask - // will be ignored. - ScanConfig scan_config = 2; - - // Required. The update mask applies to the resource. For the `FieldMask` definition, - // see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 3; -} - -// Response for the `ListScanConfigs` method. -message ListScanConfigsResponse { - // The list of ScanConfigs returned. - repeated ScanConfig scan_configs = 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 for the `StartScanRun` method. -message StartScanRunRequest { - // Required. The resource name of the ScanConfig to be used. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1; -} - -// Request for the `GetScanRun` method. -message GetScanRunRequest { - // Required. The resource name of the ScanRun to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1; -} - -// Request for the `ListScanRuns` method. -message ListScanRunsRequest { - // Required. The parent resource name, which should be a scan resource name in the - // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string parent = 1; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanRuns to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListScanRuns` method. -message ListScanRunsResponse { - // The list of ScanRuns returned. - repeated ScanRun scan_runs = 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 for the `StopScanRun` method. -message StopScanRunRequest { - // Required. The resource name of the ScanRun to be stopped. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1; -} - -// Request for the `ListCrawledUrls` method. -message ListCrawledUrlsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of CrawledUrls to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListCrawledUrls` method. -message ListCrawledUrlsResponse { - // The list of CrawledUrls returned. - repeated CrawledUrl crawled_urls = 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 for the `GetFinding` method. -message GetFindingRequest { - // Required. The resource name of the Finding to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - string name = 1; -} - -// Request for the `ListFindings` method. -message ListFindingsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1; - - // The filter expression. The expression must be in the format: - // . - // Supported field: 'finding_type'. - // Supported operator: '='. - string filter = 2; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 3; - - // The maximum number of Findings to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 4; -} - -// Response for the `ListFindings` method. -message ListFindingsResponse { - // The list of Findings returned. - repeated Finding findings = 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 for the `ListFindingTypeStats` method. -message ListFindingTypeStatsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1; -} - -// Response for the `ListFindingTypeStats` method. -message ListFindingTypeStatsResponse { - // The list of FindingTypeStats returned. - repeated FindingTypeStats finding_type_stats = 1; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json deleted file mode 100644 index 340564e435c..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json +++ /dev/null @@ -1,579 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-websecurityscanner", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.websecurityscanner.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async", - "title": "WebSecurityScanner createScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a new ScanConfig.", - "canonical": true, - "file": "web_security_scanner.create_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.CreateScanConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1.ScanConfig" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.CreateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async", - "title": "WebSecurityScanner deleteScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing ScanConfig and its child resources.", - "canonical": true, - "file": "web_security_scanner.delete_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.DeleteScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.DeleteScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async", - "title": "WebSecurityScanner getScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.get_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async", - "title": "WebSecurityScanner listScanConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanConfigs under a given project.", - "canonical": true, - "file": "web_security_scanner.list_scan_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ListScanConfigsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanConfigs", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async", - "title": "WebSecurityScanner updateScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.update_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.UpdateScanConfig", - "async": true, - "parameters": [ - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1.ScanConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.UpdateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async", - "title": "WebSecurityScanner startScanRun Sample", - "origin": "API_DEFINITION", - "description": " Start a ScanRun according to the given ScanConfig.", - "canonical": true, - "file": "web_security_scanner.start_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StartScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StartScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async", - "title": "WebSecurityScanner getScanRun Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanRun.", - "canonical": true, - "file": "web_security_scanner.get_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async", - "title": "WebSecurityScanner listScanRuns Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", - "canonical": true, - "file": "web_security_scanner.list_scan_runs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanRuns", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ListScanRunsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanRuns", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async", - "title": "WebSecurityScanner stopScanRun Sample", - "origin": "API_DEFINITION", - "description": " Stops a ScanRun. The stopped ScanRun is returned.", - "canonical": true, - "file": "web_security_scanner.stop_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StopScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StopScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async", - "title": "WebSecurityScanner listCrawledUrls Sample", - "origin": "API_DEFINITION", - "description": " List CrawledUrls under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_crawled_urls.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListCrawledUrls", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ListCrawledUrlsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListCrawledUrls", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async", - "title": "WebSecurityScanner getFinding Sample", - "origin": "API_DEFINITION", - "description": " Gets a Finding.", - "canonical": true, - "file": "web_security_scanner.get_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetFinding", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.Finding", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetFinding", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async", - "title": "WebSecurityScanner listFindings Sample", - "origin": "API_DEFINITION", - "description": " List Findings under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ListFindingsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindings", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async", - "title": "WebSecurityScanner listFindingTypeStats Sample", - "origin": "API_DEFINITION", - "description": " List all FindingTypeStats under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_finding_type_stats.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindingTypeStats", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindingTypeStats", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.create_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.create_scan_config.js deleted file mode 100644 index 2291e68e828..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.create_scan_config.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * Required. The ScanConfig to be created. - */ - // const scanConfig = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callCreateScanConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.createScanConfig(request); - console.log(response); - } - - callCreateScanConfig(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js deleted file mode 100644 index abf67d7997a..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.delete_scan_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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callDeleteScanConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.deleteScanConfig(request); - console.log(response); - } - - callDeleteScanConfig(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_finding.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_finding.js deleted file mode 100644 index 61b49e6b8ea..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_finding.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetFinding() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.getFinding(request); - console.log(response); - } - - callGetFinding(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_config.js deleted file mode 100644 index 343e7fe913b..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.getScanConfig(request); - console.log(response); - } - - callGetScanConfig(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_run.js deleted file mode 100644 index 1679bce94a2..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.get_scan_run.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanRun() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.getScanRun(request); - console.log(response); - } - - callGetScanRun(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js deleted file mode 100644 index a0fd84bfde6..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListCrawledUrls() { - // Construct request - const request = { - }; - - // Run request - const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCrawledUrls(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js deleted file mode 100644 index 904991555ff..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindingTypeStats() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.listFindingTypeStats(request); - console.log(response); - } - - callListFindingTypeStats(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_findings.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_findings.js deleted file mode 100644 index 49de41eb658..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_findings.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - */ - // const filter = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindings() { - // Construct request - const request = { - }; - - // Run request - const iterable = await websecurityscannerClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_configs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_configs.js deleted file mode 100644 index b3964c340c1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_configs.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a project resource name in the - * format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanConfigs() { - // Construct request - const request = { - }; - - // Run request - const iterable = await websecurityscannerClient.listScanConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanConfigs(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_runs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_runs.js deleted file mode 100644 index 1687f03082a..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.list_scan_runs.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanRuns() { - // Construct request - const request = { - }; - - // Run request - const iterable = await websecurityscannerClient.listScanRunsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanRuns(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.start_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.start_scan_run.js deleted file mode 100644 index 09e58a9b8e7..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.start_scan_run.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 websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStartScanRun() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.startScanRun(request); - console.log(response); - } - - callStartScanRun(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js deleted file mode 100644 index a68f02893b8..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.stop_scan_run.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStopScanRun() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.stopScanRun(request); - console.log(response); - } - - callStopScanRun(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.update_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.update_scan_config.js deleted file mode 100644 index 7db724c3216..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/samples/generated/v1/web_security_scanner.update_scan_config.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - */ - // const scanConfig = {} - /** - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callUpdateScanConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.updateScanConfig(request); - console.log(response); - } - - callUpdateScanConfig(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/index.ts deleted file mode 100644 index f20f26e652e..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 WebSecurityScannerClient = v1.WebSecurityScannerClient; -type WebSecurityScannerClient = v1.WebSecurityScannerClient; -export {v1, WebSecurityScannerClient}; -export default {v1, WebSecurityScannerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 6c589c52cb4..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.websecurityscanner.v1", - "libraryPackage": "@google-cloud/web-security-scanner", - "services": { - "WebSecurityScanner": { - "clients": { - "grpc": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/index.ts deleted file mode 100644 index c4b9ebe89d1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client.ts deleted file mode 100644 index a77369d182b..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client.ts +++ /dev/null @@ -1,1810 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/web_security_scanner_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './web_security_scanner_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Web Security Scanner Service identifies security vulnerabilities in web - * applications hosted on Google Cloud. It crawls your application, and - * attempts to exercise as many user inputs and event handlers as possible. - * @class - * @memberof v1 - */ -export class WebSecurityScannerClient { - 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}; - webSecurityScannerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WebSecurityScannerClient. - * - * @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 WebSecurityScannerClient({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 WebSecurityScannerClient; - 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 = { - findingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' - ), - }; - - // 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 = { - listScanConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), - listScanRuns: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), - listCrawledUrls: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.websecurityscanner.v1.WebSecurityScanner', 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.webSecurityScannerStub) { - return this.webSecurityScannerStub; - } - - // Put together the "service stub" for - // google.cloud.websecurityscanner.v1.WebSecurityScanner. - this.webSecurityScannerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1.WebSecurityScanner') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.websecurityscanner.v1.WebSecurityScanner, - 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 webSecurityScannerStubMethods = - ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; - for (const methodName of webSecurityScannerStubMethods) { - const callPromise = this.webSecurityScannerStub.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.webSecurityScannerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'websecurityscanner.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 'websecurityscanner.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 -- - // ------------------- -/** - * Creates a new ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig - * Required. The ScanConfig 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.websecurityscanner.v1.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.create_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async - */ - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|undefined, {}|undefined - ]>; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createScanConfig(request, options, callback); - } -/** - * Deletes an existing ScanConfig and its child resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/web_security_scanner.delete_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async - */ - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|undefined, {}|undefined - ]>; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteScanConfig(request, options, callback); - } -/** - * Gets a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.get_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async - */ - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|undefined, {}|undefined - ]>; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getScanConfig(request, options, callback); - } -/** - * Updates a ScanConfig. This method support partial update of a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * 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.websecurityscanner.v1.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.update_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async - */ - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|undefined, {}|undefined - ]>; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scan_config.name': request.scanConfig!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateScanConfig(request, options, callback); - } -/** - * Start a ScanRun according to the given ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.start_scan_run.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async - */ - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|undefined, {}|undefined - ]>; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.startScanRun(request, options, callback); - } -/** - * Gets a ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.get_scan_run.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async - */ - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|undefined, {}|undefined - ]>; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getScanRun(request, options, callback); - } -/** - * Stops a ScanRun. The stopped ScanRun is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.stop_scan_run.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async - */ - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|undefined, {}|undefined - ]>; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.stopScanRun(request, options, callback); - } -/** - * Gets a Finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.Finding|Finding}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.get_finding.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async - */ - getFinding( - request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|undefined, {}|undefined - ]>; - getFinding( - request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFinding(request, options, callback); - } -/** - * List all FindingTypeStats under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.list_finding_type_stats.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async - */ - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFindingTypeStats(request, options, callback); - } - - /** - * Lists ScanConfigs under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1.ScanConfig|ScanConfig}. - * 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 `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig[], - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse - ]>; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>): void; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>): void; - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig[], - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listScanConfigs(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 name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1.ScanConfig|ScanConfig} 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 `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanConfigsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - 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['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.createStream( - this.innerApiCalls.listScanConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanConfigs`, 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 name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1.ScanConfig|ScanConfig}. 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/web_security_scanner.list_scan_configs.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async - */ - listScanConfigsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - 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['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.asyncIterate( - this.innerApiCalls['listScanConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - * stop time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1.ScanRun|ScanRun}. - * 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 `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun[], - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse - ]>; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>): void; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>): void; - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun[], - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listScanRuns(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 name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1.ScanRun|ScanRun} 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 `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanRunsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - 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['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.createStream( - this.innerApiCalls.listScanRuns as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanRuns`, 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 name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1.ScanRun|ScanRun}. 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/web_security_scanner.list_scan_runs.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async - */ - listScanRunsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - 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['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.asyncIterate( - this.innerApiCalls['listScanRuns'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List CrawledUrls under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1.CrawledUrl|CrawledUrl}. - * 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 `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse - ]>; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): void; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): void; - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listCrawledUrls(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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1.CrawledUrl|CrawledUrl} 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 `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCrawledUrlsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - 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['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.createStream( - this.innerApiCalls.listCrawledUrls as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCrawledUrls`, 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1.CrawledUrl|CrawledUrl}. 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/web_security_scanner.list_crawled_urls.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async - */ - listCrawledUrlsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - 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['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.asyncIterate( - this.innerApiCalls['listCrawledUrls'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List Findings under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1.Finding|Finding}. - * 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 `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFindings( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding[], - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>): void; - listFindings( - request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>): void; - listFindings( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding[], - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFindings(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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1.Finding|Finding} 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 `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFindingsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - 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['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.createStream( - this.innerApiCalls.listFindings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFindings`, 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1.Finding|Finding}. 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/web_security_scanner.list_findings.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - 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['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.asyncIterate( - this.innerApiCalls['listFindings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified finding resource name string. - * - * @param {string} project - * @param {string} scan_config - * @param {string} scan_run - * @param {string} finding - * @returns {string} Resource name string. - */ - findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { - return this.pathTemplates.findingPathTemplate.render({ - project: project, - scan_config: scanConfig, - scan_run: scanRun, - finding: finding, - }); - } - - /** - * Parse the project from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).project; - } - - /** - * Parse the scan_config from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; - } - - /** - * Parse the scan_run from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_run. - */ - matchScanRunFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; - } - - /** - * Parse the finding from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).finding; - } - - /** - * 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.webSecurityScannerStub && !this._terminated) { - return this.webSecurityScannerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client_config.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client_config.json deleted file mode 100644 index 2e226cb1ff0..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_client_config.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "interfaces": { - "google.cloud.websecurityscanner.v1.WebSecurityScanner": { - "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": { - "CreateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanConfigs": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanRuns": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "StopScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListCrawledUrls": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetFinding": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindingTypeStats": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_proto_list.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_proto_list.json deleted file mode 100644 index 627b52eed99..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/src/v1/web_security_scanner_proto_list.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - "../../protos/google/cloud/websecurityscanner/v1/crawled_url.proto", - "../../protos/google/cloud/websecurityscanner/v1/finding.proto", - "../../protos/google/cloud/websecurityscanner/v1/finding_addon.proto", - "../../protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto", - "../../protos/google/cloud/websecurityscanner/v1/scan_config.proto", - "../../protos/google/cloud/websecurityscanner/v1/scan_config_error.proto", - "../../protos/google/cloud/websecurityscanner/v1/scan_run.proto", - "../../protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto", - "../../protos/google/cloud/websecurityscanner/v1/scan_run_log.proto", - "../../protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto", - "../../protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto" -] diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 54b6f3aa5e5..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 websecurityscanner = require('@google-cloud/web-security-scanner'); - -function main() { - const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 3bd84309184..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; - -// check that the client class type name can be used -function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const webSecurityScannerClient = new WebSecurityScannerClient(); - doStuffWithWebSecurityScannerClient(webSecurityScannerClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/install.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1/test/gapic_web_security_scanner_v1.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1/test/gapic_web_security_scanner_v1.ts deleted file mode 100644 index cec6a4650c4..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1/test/gapic_web_security_scanner_v1.ts +++ /dev/null @@ -1,2210 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 websecurityscannerModule 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.WebSecurityScannerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = websecurityscannerModule.v1.WebSecurityScannerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = websecurityscannerModule.v1.WebSecurityScannerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = websecurityscannerModule.v1.WebSecurityScannerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - await client.initialize(); - assert(client.webSecurityScannerStub); - }); - - it('has close method for the initialized client', done => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.webSecurityScannerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - 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 websecurityscannerModule.v1.WebSecurityScannerClient({ - 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('createScanConfig', () => { - it('invokes createScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createScanConfig(request), expectedError); - }); - }); - - describe('deleteScanConfig', () => { - it('invokes deleteScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteScanConfig( - 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.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteScanConfig(request), expectedError); - }); - }); - - describe('getScanConfig', () => { - it('invokes getScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanConfig(request), expectedError); - }); - }); - - describe('updateScanConfig', () => { - it('invokes updateScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateScanConfig(request), expectedError); - }); - }); - - describe('startScanRun', () => { - it('invokes startScanRun without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.startScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.startScanRun(request), expectedError); - }); - }); - - describe('getScanRun', () => { - it('invokes getScanRun without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.getScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanRun(request), expectedError); - }); - }); - - describe('stopScanRun', () => { - it('invokes stopScanRun without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.stopScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.stopScanRun(request), expectedError); - }); - }); - - describe('getFinding', () => { - it('invokes getFinding without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); - const [response] = await client.getFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFinding( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFinding(request), expectedError); - }); - }); - - describe('listFindingTypeStats', () => { - it('invokes listFindingTypeStats without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); - const [response] = await client.listFindingTypeStats(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindingTypeStats( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - }); - }); - - describe('listScanConfigs', () => { - it('invokes listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listScanConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigs without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { - 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.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listScanConfigsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = []; - const iterable = client.listScanConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listScanRuns', () => { - it('invokes listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); - const [response] = await client.listScanRuns(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRuns without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanRuns( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanRuns(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRunsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { - 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.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listScanRunsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = []; - const iterable = client.listScanRunsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanRunsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCrawledUrls', () => { - it('invokes listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); - const [response] = await client.listCrawledUrls(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrls without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCrawledUrls( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCrawledUrls(request), expectedError); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrlsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { - 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.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCrawledUrlsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = []; - const iterable = client.listCrawledUrlsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCrawledUrlsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IFinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.Finding) => { - 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.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFindingsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('finding', () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - finding: "findingValue", - }; - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.findingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.findingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('findingPath', () => { - const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFindingName', () => { - const result = client.matchProjectFromFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromFindingName', () => { - const result = client.matchScanConfigFromFindingName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanRunFromFindingName', () => { - const result = client.matchScanRunFromFindingName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFindingName', () => { - const result = client.matchFindingFromFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1/tsconfig.json b/owl-bot-staging/google-cloud-websecurityscanner/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1/webpack.config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1/webpack.config.js deleted file mode 100644 index ad3467d60d6..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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: 'WebSecurityScanner', - filename: './web-security-scanner.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-websecurityscanner/v1alpha/.eslintignore b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1alpha/.eslintrc.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.gitignore b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1alpha/.jsdoc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.jsdoc.js deleted file mode 100644 index efbbc504438..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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/web-security-scanner', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.mocharc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1alpha/.prettierrc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1alpha/README.md b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/README.md deleted file mode 100644 index 727d3b68aef..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/README.md +++ /dev/null @@ -1 +0,0 @@ -Websecurityscanner: Nodejs Client diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/package.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/package.json deleted file mode 100644 index e7d7667cbd2..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/web-security-scanner", - "version": "0.1.0", - "description": "Websecurityscanner client for Node.js", - "repository": "googleapis/nodejs-websecurityscanner", - "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 websecurityscanner", - "websecurityscanner", - "web security scanner" - ], - "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-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto deleted file mode 100644 index 57d53c9ef53..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto +++ /dev/null @@ -1,38 +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.websecurityscanner.v1alpha; - -option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "CrawledUrlProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web -// Security Scanner Service crawls the web applications, following all links -// within the scope of sites, to find the URLs to test against. -message CrawledUrl { - // Output only. The http method of the request that was used to visit the URL, in - // uppercase. - string http_method = 1; - - // Output only. The URL that was crawled. - string url = 2; - - // Output only. The body of the request that was used to visit the URL. - string body = 3; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto deleted file mode 100644 index 55987fe0950..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto +++ /dev/null @@ -1,152 +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.websecurityscanner.v1alpha; - -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1alpha/finding_addon.proto"; - -option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "FindingProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// A Finding resource represents a vulnerability instance identified during a -// ScanRun. -message Finding { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/Finding" - pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" - }; - - // Types of Findings. - enum FindingType { - // The invalid finding type. - FINDING_TYPE_UNSPECIFIED = 0; - - // A page that was served over HTTPS also resources over HTTP. A - // man-in-the-middle attacker could tamper with the HTTP resource and gain - // full access to the website that loads the resource or to monitor the - // actions taken by the user. - MIXED_CONTENT = 1; - - // The version of an included library is known to contain a security issue. - // The scanner checks the version of library in use against a known list of - // vulnerable libraries. False positives are possible if the version - // detection fails or if the library has been manually patched. - OUTDATED_LIBRARY = 2; - - // This type of vulnerability occurs when the value of a request parameter - // is reflected at the beginning of the response, for example, in requests - // using JSONP. Under certain circumstances, an attacker may be able to - // supply an alphanumeric-only Flash file in the vulnerable parameter - // causing the browser to execute the Flash file as if it originated on the - // vulnerable server. - ROSETTA_FLASH = 5; - - // A cross-site scripting (XSS) bug is found via JavaScript callback. For - // detailed explanations on XSS, see - // https://www.google.com/about/appsecurity/learning/xss/. - XSS_CALLBACK = 3; - - // A potential cross-site scripting (XSS) bug due to JavaScript breakage. - // In some circumstances, the application under test might modify the test - // string before it is parsed by the browser. When the browser attempts to - // runs this modified test string, it will likely break and throw a - // JavaScript execution error, thus an injection issue is occurring. - // However, it may not be exploitable. Manual verification is needed to see - // if the test string modifications can be evaded and confirm that the issue - // is in fact an XSS vulnerability. For detailed explanations on XSS, see - // https://www.google.com/about/appsecurity/learning/xss/. - XSS_ERROR = 4; - - // An application appears to be transmitting a password field in clear text. - // An attacker can eavesdrop network traffic and sniff the password field. - CLEAR_TEXT_PASSWORD = 6; - - // An application returns sensitive content with an invalid content type, - // or without an 'X-Content-Type-Options: nosniff' header. - INVALID_CONTENT_TYPE = 7; - - // A cross-site scripting (XSS) vulnerability in AngularJS module that - // occurs when a user-provided string is interpolated by Angular. - XSS_ANGULAR_CALLBACK = 8; - - // A malformed or invalid valued header. - INVALID_HEADER = 9; - - // Misspelled security header name. - MISSPELLED_SECURITY_HEADER_NAME = 10; - - // Mismatching values in a duplicate security header. - MISMATCHING_SECURITY_HEADER_VALUES = 11; - } - - // The resource name of the Finding. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. - // The finding IDs are generated by the system. - string name = 1; - - // The type of the Finding. - FindingType finding_type = 2; - - // The http method of the request that triggered the vulnerability, in - // uppercase. - string http_method = 3; - - // The URL produced by the server-side fuzzer and used in the request that - // triggered the vulnerability. - string fuzzed_url = 4; - - // The body of the request that triggered the vulnerability. - string body = 5; - - // The description of the vulnerability. - string description = 6; - - // The URL containing human-readable payload that user can leverage to - // reproduce the vulnerability. - string reproduction_url = 7; - - // If the vulnerability was originated from nested IFrame, the immediate - // parent IFrame is reported. - string frame_url = 8; - - // The URL where the browser lands when the vulnerability is detected. - string final_url = 9; - - // The tracking ID uniquely identifies a vulnerability instance across - // multiple ScanRuns. - string tracking_id = 10; - - // An addon containing information about outdated libraries. - OutdatedLibrary outdated_library = 11; - - // An addon containing detailed information regarding any resource causing the - // vulnerability such as JavaScript sources, image, audio files, etc. - ViolatingResource violating_resource = 12; - - // An addon containing information about vulnerable or missing HTTP headers. - VulnerableHeaders vulnerable_headers = 15; - - // An addon containing information about request parameters which were found - // to be vulnerable. - VulnerableParameters vulnerable_parameters = 13; - - // An addon containing information reported for an XSS, if any. - Xss xss = 14; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto deleted file mode 100644 index f16b53ccf79..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto +++ /dev/null @@ -1,78 +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.websecurityscanner.v1alpha; - -option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "FindingAddonProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// Information reported for an outdated library. -message OutdatedLibrary { - // The name of the outdated library. - string library_name = 1; - - // The version number. - string version = 2; - - // URLs to learn more information about the vulnerabilities in the library. - repeated string learn_more_urls = 3; -} - -// Information regarding any resource causing the vulnerability such -// as JavaScript sources, image, audio files, etc. -message ViolatingResource { - // The MIME type of this resource. - string content_type = 1; - - // URL of this violating resource. - string resource_url = 2; -} - -// Information about vulnerable request parameters. -message VulnerableParameters { - // The vulnerable parameter names. - repeated string parameter_names = 1; -} - -// Information about vulnerable or missing HTTP Headers. -message VulnerableHeaders { - // Describes a HTTP Header. - message Header { - // Header name. - string name = 1; - - // Header value. - string value = 2; - } - - // List of vulnerable headers. - repeated Header headers = 1; - - // List of missing headers. - repeated Header missing_headers = 2; -} - -// Information reported for an XSS. -message Xss { - // Stack traces leading to the point where the XSS occurred. - repeated string stack_traces = 1; - - // An error message generated by a javascript breakage. - string error_message = 2; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto deleted file mode 100644 index 4b8545a75c1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto +++ /dev/null @@ -1,35 +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.websecurityscanner.v1alpha; - -import "google/cloud/websecurityscanner/v1alpha/finding.proto"; - -option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "FindingTypeStatsProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// A FindingTypeStats resource represents stats regarding a specific FindingType -// of Findings under a given ScanRun. -message FindingTypeStats { - // The finding type associated with the stats. - Finding.FindingType finding_type = 1; - - // The count of findings belonging to this finding type. - int32 finding_count = 2; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto deleted file mode 100644 index e2cd7fe7135..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto +++ /dev/null @@ -1,157 +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.websecurityscanner.v1alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1alpha/scan_run.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanConfigProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// A ScanConfig resource contains the configurations to launch a scan. -// next id: 12 -message ScanConfig { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - pattern: "projects/{project}/scanConfigs/{scan_config}" - }; - - // Scan authentication configuration. - message Authentication { - // Describes authentication configuration that uses a Google account. - message GoogleAccount { - // Required. The user name of the Google account. - string username = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. The password of the Google account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - } - - // Describes authentication configuration that uses a custom account. - message CustomAccount { - // Required. The user name of the custom account. - string username = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. The password of the custom account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - - // Required. The login form URL of the website. - string login_url = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. - // Authentication configuration - oneof authentication { - // Authentication using a Google account. - GoogleAccount google_account = 1; - - // Authentication using a custom account. - CustomAccount custom_account = 2; - } - } - - // Scan schedule configuration. - message Schedule { - // A timestamp indicates when the next run will be scheduled. The value is - // refreshed by the server after each run. If unspecified, it will default - // to current server time, which means the scan will be scheduled to start - // immediately. - google.protobuf.Timestamp schedule_time = 1; - - // Required. The duration of time between executions in days. - int32 interval_duration_days = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Type of user agents used for scanning. - enum UserAgent { - // The user agent is unknown. Service will default to CHROME_LINUX. - USER_AGENT_UNSPECIFIED = 0; - - // Chrome on Linux. This is the service default if unspecified. - CHROME_LINUX = 1; - - // Chrome on Android. - CHROME_ANDROID = 2; - - // Safari on IPhone. - SAFARI_IPHONE = 3; - } - - // Cloud platforms supported by Cloud Web Security Scanner. - enum TargetPlatform { - // The target platform is unknown. Requests with this enum value will be - // rejected with INVALID_ARGUMENT error. - TARGET_PLATFORM_UNSPECIFIED = 0; - - // Google App Engine service. - APP_ENGINE = 1; - - // Google Compute Engine service. - COMPUTE = 2; - } - - // The resource name of the ScanConfig. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are - // generated by the system. - string name = 1; - - // Required. The user provided display name of the ScanConfig. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The maximum QPS during scanning. A valid value ranges from 5 to 20 - // inclusively. If the field is unspecified or its value is set 0, server will - // default to 15. Other values outside of [5, 20] range will be rejected with - // INVALID_ARGUMENT error. - int32 max_qps = 3; - - // Required. The starting URLs from which the scanner finds site pages. - repeated string starting_urls = 4 [(google.api.field_behavior) = REQUIRED]; - - // The authentication configuration. If specified, service will use the - // authentication configuration during scanning. - Authentication authentication = 5; - - // The user agent used during scanning. - UserAgent user_agent = 6; - - // The blacklist URL patterns as described in - // https://cloud.google.com/security-scanner/docs/excluded-urls - repeated string blacklist_patterns = 7; - - // The schedule of the ScanConfig. - Schedule schedule = 8; - - // Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be - // used as a default. - repeated TargetPlatform target_platforms = 9; - - // Latest ScanRun if available. - ScanRun latest_run = 11; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto deleted file mode 100644 index 72d281a7d42..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto +++ /dev/null @@ -1,104 +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.websecurityscanner.v1alpha; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// A ScanRun is a output-only resource representing an actual run of the scan. -message ScanRun { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/ScanRun" - pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}" - }; - - // Types of ScanRun execution state. - enum ExecutionState { - // Represents an invalid state caused by internal server error. This value - // should never be returned. - EXECUTION_STATE_UNSPECIFIED = 0; - - // The scan is waiting in the queue. - QUEUED = 1; - - // The scan is in progress. - SCANNING = 2; - - // The scan is either finished or stopped by user. - FINISHED = 3; - } - - // Types of ScanRun result state. - enum ResultState { - // Default value. This value is returned when the ScanRun is not yet - // finished. - RESULT_STATE_UNSPECIFIED = 0; - - // The scan finished without errors. - SUCCESS = 1; - - // The scan finished with errors. - ERROR = 2; - - // The scan was terminated by user. - KILLED = 3; - } - - // The resource name of the ScanRun. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - // The ScanRun IDs are generated by the system. - string name = 1; - - // The execution state of the ScanRun. - ExecutionState execution_state = 2; - - // The result state of the ScanRun. This field is only available after the - // execution state reaches "FINISHED". - ResultState result_state = 3; - - // The time at which the ScanRun started. - google.protobuf.Timestamp start_time = 4; - - // The time at which the ScanRun reached termination state - that the ScanRun - // is either finished or stopped by user. - google.protobuf.Timestamp end_time = 5; - - // The number of URLs crawled during this ScanRun. If the scan is in progress, - // the value represents the number of URLs crawled up to now. - int64 urls_crawled_count = 6; - - // The number of URLs tested during this ScanRun. If the scan is in progress, - // the value represents the number of URLs tested up to now. The number of - // URLs tested is usually larger than the number URLS crawled because - // typically a crawled URL is tested with multiple test payloads. - int64 urls_tested_count = 7; - - // Whether the scan run has found any vulnerabilities. - bool has_vulnerabilities = 8; - - // The percentage of total completion ranging from 0 to 100. - // If the scan is in queue, the value is 0. - // If the scan is running, the value ranges from 0 to 100. - // If the scan is finished, the value is 100. - int32 progress_percent = 9; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto deleted file mode 100644 index 13ed469e7dc..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto +++ /dev/null @@ -1,410 +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.websecurityscanner.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/websecurityscanner/v1alpha/crawled_url.proto"; -import "google/cloud/websecurityscanner/v1alpha/finding.proto"; -import "google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto"; -import "google/cloud/websecurityscanner/v1alpha/scan_config.proto"; -import "google/cloud/websecurityscanner/v1alpha/scan_run.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option go_package = "cloud.google.com/go/websecurityscanner/apiv1alpha/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "WebSecurityScannerProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// Cloud Web Security Scanner Service identifies security vulnerabilities in web -// applications hosted on Google Cloud Platform. It crawls your application, and -// attempts to exercise as many user inputs and event handlers as possible. -service WebSecurityScanner { - option (google.api.default_host) = "websecurityscanner.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new ScanConfig. - rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*}/scanConfigs" - body: "scan_config" - }; - option (google.api.method_signature) = "parent,scan_config"; - } - - // Deletes an existing ScanConfig and its child resources. - rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1alpha/{name=projects/*/scanConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a ScanConfig. - rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/scanConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists ScanConfigs under a given project. - rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*}/scanConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates a ScanConfig. This method support partial update of a ScanConfig. - rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - patch: "/v1alpha/{scan_config.name=projects/*/scanConfigs/*}" - body: "scan_config" - }; - option (google.api.method_signature) = "scan_config,update_mask"; - } - - // Start a ScanRun according to the given ScanConfig. - rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1alpha/{name=projects/*/scanConfigs/*}:start" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a ScanRun. - rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - // stop time. - rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/scanConfigs/*}/scanRuns" - }; - option (google.api.method_signature) = "parent"; - } - - // Stops a ScanRun. The stopped ScanRun is returned. - rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // List CrawledUrls under a given ScanRun. - rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a Finding. - rpc GetFinding(GetFindingRequest) returns (Finding) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List Findings under a given ScanRun. - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" - }; - option (google.api.method_signature) = "parent,filter"; - } - - // List all FindingTypeStats under a given ScanRun. - rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request for the `CreateScanConfig` method. -message CreateScanConfigRequest { - // Required. The parent resource name where the scan is created, which should be a - // project resource name in the format 'projects/{projectId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The ScanConfig to be created. - ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `DeleteScanConfig` method. -message DeleteScanConfigRequest { - // Required. The resource name of the ScanConfig to be deleted. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `GetScanConfig` method. -message GetScanConfigRequest { - // Required. The resource name of the ScanConfig to be returned. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `ListScanConfigs` method. -message ListScanConfigsRequest { - // Required. The parent resource name, which should be a project resource name in the - // format 'projects/{projectId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanConfigs to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Request for the `UpdateScanConfigRequest` method. -message UpdateScanConfigRequest { - // Required. The ScanConfig to be updated. The name field must be set to identify the - // resource to be updated. The values of fields not covered by the mask - // will be ignored. - ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The update mask applies to the resource. For the `FieldMask` definition, - // see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the `ListScanConfigs` method. -message ListScanConfigsResponse { - // The list of ScanConfigs returned. - repeated ScanConfig scan_configs = 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 for the `StartScanRun` method. -message StartScanRunRequest { - // Required. The resource name of the ScanConfig to be used. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `GetScanRun` method. -message GetScanRunRequest { - // Required. The resource name of the ScanRun to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Request for the `ListScanRuns` method. -message ListScanRunsRequest { - // Required. The parent resource name, which should be a scan resource name in the - // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanRuns to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListScanRuns` method. -message ListScanRunsResponse { - // The list of ScanRuns returned. - repeated ScanRun scan_runs = 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 for the `StopScanRun` method. -message StopScanRunRequest { - // Required. The resource name of the ScanRun to be stopped. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Request for the `ListCrawledUrls` method. -message ListCrawledUrlsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of CrawledUrls to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListCrawledUrls` method. -message ListCrawledUrlsResponse { - // The list of CrawledUrls returned. - repeated CrawledUrl crawled_urls = 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 for the `GetFinding` method. -message GetFindingRequest { - // Required. The resource name of the Finding to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/Finding" - } - ]; -} - -// Request for the `ListFindings` method. -message ListFindingsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; - - // Required. The filter expression. The expression must be in the format: - // . - // Supported field: 'finding_type'. - // Supported operator: '='. - string filter = 2 [(google.api.field_behavior) = REQUIRED]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 3; - - // The maximum number of Findings to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 4; -} - -// Response for the `ListFindings` method. -message ListFindingsResponse { - // The list of Findings returned. - repeated Finding findings = 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 for the `ListFindingTypeStats` method. -message ListFindingTypeStatsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Response for the `ListFindingTypeStats` method. -message ListFindingTypeStatsResponse { - // The list of FindingTypeStats returned. - repeated FindingTypeStats finding_type_stats = 1; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json deleted file mode 100644 index c0c051282be..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json +++ /dev/null @@ -1,579 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-websecurityscanner", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.websecurityscanner.v1alpha", - "version": "v1alpha" - } - ] - }, - "snippets": [ - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async", - "title": "WebSecurityScanner createScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a new ScanConfig.", - "canonical": true, - "file": "web_security_scanner.create_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.CreateScanConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1alpha.ScanConfig" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.CreateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async", - "title": "WebSecurityScanner deleteScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing ScanConfig and its child resources.", - "canonical": true, - "file": "web_security_scanner.delete_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.DeleteScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.DeleteScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async", - "title": "WebSecurityScanner getScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.get_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async", - "title": "WebSecurityScanner listScanConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanConfigs under a given project.", - "canonical": true, - "file": "web_security_scanner.list_scan_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ListScanConfigsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanConfigs", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async", - "title": "WebSecurityScanner updateScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.update_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.UpdateScanConfig", - "async": true, - "parameters": [ - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1alpha.ScanConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.UpdateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async", - "title": "WebSecurityScanner startScanRun Sample", - "origin": "API_DEFINITION", - "description": " Start a ScanRun according to the given ScanConfig.", - "canonical": true, - "file": "web_security_scanner.start_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StartScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StartScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async", - "title": "WebSecurityScanner getScanRun Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanRun.", - "canonical": true, - "file": "web_security_scanner.get_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async", - "title": "WebSecurityScanner listScanRuns Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", - "canonical": true, - "file": "web_security_scanner.list_scan_runs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanRuns", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ListScanRunsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanRuns", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async", - "title": "WebSecurityScanner stopScanRun Sample", - "origin": "API_DEFINITION", - "description": " Stops a ScanRun. The stopped ScanRun is returned.", - "canonical": true, - "file": "web_security_scanner.stop_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StopScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StopScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async", - "title": "WebSecurityScanner listCrawledUrls Sample", - "origin": "API_DEFINITION", - "description": " List CrawledUrls under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_crawled_urls.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListCrawledUrls", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListCrawledUrls", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async", - "title": "WebSecurityScanner getFinding Sample", - "origin": "API_DEFINITION", - "description": " Gets a Finding.", - "canonical": true, - "file": "web_security_scanner.get_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetFinding", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.Finding", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetFinding", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async", - "title": "WebSecurityScanner listFindings Sample", - "origin": "API_DEFINITION", - "description": " List Findings under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ListFindingsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindings", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async", - "title": "WebSecurityScanner listFindingTypeStats Sample", - "origin": "API_DEFINITION", - "description": " List all FindingTypeStats under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_finding_type_stats.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindingTypeStats", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindingTypeStats", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js deleted file mode 100644 index 178f60414d9..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_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(parent, scanConfig) { - // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * Required. The ScanConfig to be created. - */ - // const scanConfig = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callCreateScanConfig() { - // Construct request - const request = { - parent, - scanConfig, - }; - - // Run request - const response = await websecurityscannerClient.createScanConfig(request); - console.log(response); - } - - callCreateScanConfig(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js deleted file mode 100644 index de78e80f4f8..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_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 websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callDeleteScanConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.deleteScanConfig(request); - console.log(response); - } - - callDeleteScanConfig(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js deleted file mode 100644 index dab3d184220..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetFinding() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getFinding(request); - console.log(response); - } - - callGetFinding(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js deleted file mode 100644 index 44a624e911b..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getScanConfig(request); - console.log(response); - } - - callGetScanConfig(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js deleted file mode 100644 index d434cf5c561..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getScanRun(request); - console.log(response); - } - - callGetScanRun(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js deleted file mode 100644 index ef54718cc0d..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.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 websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListCrawledUrls() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCrawledUrls(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js deleted file mode 100644 index fc1996b0a8d..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.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(parent) { - // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindingTypeStats() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await websecurityscannerClient.listFindingTypeStats(request); - console.log(response); - } - - callListFindingTypeStats(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js deleted file mode 100644 index cd95431ff4e..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.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, filter) { - // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - */ - // const filter = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindings() { - // Construct request - const request = { - parent, - filter, - }; - - // Run request - const iterable = await websecurityscannerClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js deleted file mode 100644 index 1a3477fc70d..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.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) { - // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a project resource name in the - * format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listScanConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanConfigs(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js deleted file mode 100644 index b3393f41df2..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.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) { - // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanRuns() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listScanRunsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanRuns(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js deleted file mode 100644 index 4b89d6318e1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.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 websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStartScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.startScanRun(request); - console.log(response); - } - - callStartScanRun(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js deleted file mode 100644 index 3239232bcf4..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.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 websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStopScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.stopScanRun(request); - console.log(response); - } - - callStopScanRun(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js deleted file mode 100644 index 3fa9f1b4fa3..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.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(scanConfig, updateMask) { - // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - */ - // const scanConfig = {} - /** - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callUpdateScanConfig() { - // Construct request - const request = { - scanConfig, - updateMask, - }; - - // Run request - const response = await websecurityscannerClient.updateScanConfig(request); - console.log(response); - } - - callUpdateScanConfig(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/index.ts deleted file mode 100644 index 5584b1fbb22..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 WebSecurityScannerClient = v1alpha.WebSecurityScannerClient; -type WebSecurityScannerClient = v1alpha.WebSecurityScannerClient; -export {v1alpha, WebSecurityScannerClient}; -export default {v1alpha, WebSecurityScannerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/gapic_metadata.json deleted file mode 100644 index 72e2c6b7bde..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/gapic_metadata.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.websecurityscanner.v1alpha", - "libraryPackage": "@google-cloud/web-security-scanner", - "services": { - "WebSecurityScanner": { - "clients": { - "grpc": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/index.ts deleted file mode 100644 index c4b9ebe89d1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client.ts deleted file mode 100644 index 38aed2a115b..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client.ts +++ /dev/null @@ -1,1927 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1alpha/web_security_scanner_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './web_security_scanner_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Cloud Web Security Scanner Service identifies security vulnerabilities in web - * applications hosted on Google Cloud Platform. It crawls your application, and - * attempts to exercise as many user inputs and event handlers as possible. - * @class - * @memberof v1alpha - */ -export class WebSecurityScannerClient { - 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}; - webSecurityScannerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WebSecurityScannerClient. - * - * @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 WebSecurityScannerClient({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 WebSecurityScannerClient; - 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 = { - findingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - scanConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}' - ), - scanRunPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}' - ), - }; - - // 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 = { - listScanConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), - listScanRuns: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), - listCrawledUrls: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.websecurityscanner.v1alpha.WebSecurityScanner', 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.webSecurityScannerStub) { - return this.webSecurityScannerStub; - } - - // Put together the "service stub" for - // google.cloud.websecurityscanner.v1alpha.WebSecurityScanner. - this.webSecurityScannerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1alpha.WebSecurityScanner') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.websecurityscanner.v1alpha.WebSecurityScanner, - 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 webSecurityScannerStubMethods = - ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; - for (const methodName of webSecurityScannerStubMethods) { - const callPromise = this.webSecurityScannerStub.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.webSecurityScannerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'websecurityscanner.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 'websecurityscanner.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 -- - // ------------------- -/** - * Creates a new ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig - * Required. The ScanConfig 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.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. - * Please see the {@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/web_security_scanner.create_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async - */ - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|undefined, {}|undefined - ]>; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createScanConfig(request, options, callback); - } -/** - * Deletes an existing ScanConfig and its child resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1alpha/web_security_scanner.delete_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async - */ - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|undefined, {}|undefined - ]>; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteScanConfig(request, options, callback); - } -/** - * Gets a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. - * Please see the {@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/web_security_scanner.get_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async - */ - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|undefined, {}|undefined - ]>; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getScanConfig(request, options, callback); - } -/** - * Updates a ScanConfig. This method support partial update of a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * 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.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. - * Please see the {@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/web_security_scanner.update_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async - */ - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|undefined, {}|undefined - ]>; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scan_config.name': request.scanConfig!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateScanConfig(request, options, callback); - } -/** - * Start a ScanRun according to the given ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. - * Please see the {@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/web_security_scanner.start_scan_run.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async - */ - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|undefined, {}|undefined - ]>; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.startScanRun(request, options, callback); - } -/** - * Gets a ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. - * Please see the {@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/web_security_scanner.get_scan_run.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async - */ - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|undefined, {}|undefined - ]>; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getScanRun(request, options, callback); - } -/** - * Stops a ScanRun. The stopped ScanRun is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. - * Please see the {@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/web_security_scanner.stop_scan_run.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async - */ - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|undefined, {}|undefined - ]>; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.stopScanRun(request, options, callback); - } -/** - * Gets a Finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.Finding|Finding}. - * Please see the {@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/web_security_scanner.get_finding.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async - */ - getFinding( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|undefined, {}|undefined - ]>; - getFinding( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFinding(request, options, callback); - } -/** - * List all FindingTypeStats under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. - * Please see the {@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/web_security_scanner.list_finding_type_stats.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async - */ - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFindingTypeStats(request, options, callback); - } - - /** - * Lists ScanConfigs under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. - * 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 `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse - ]>; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): void; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): void; - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listScanConfigs(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 name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1alpha.ScanConfig|ScanConfig} 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 `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanConfigsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - 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['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.createStream( - this.innerApiCalls.listScanConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanConfigs`, 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 name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. 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/web_security_scanner.list_scan_configs.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async - */ - listScanConfigsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - 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['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.asyncIterate( - this.innerApiCalls['listScanConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - * stop time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1alpha.ScanRun|ScanRun}. - * 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 `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse - ]>; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): void; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): void; - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listScanRuns(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 name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1alpha.ScanRun|ScanRun} 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 `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanRunsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - 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['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.createStream( - this.innerApiCalls.listScanRuns as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanRuns`, 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 name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1alpha.ScanRun|ScanRun}. 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/web_security_scanner.list_scan_runs.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async - */ - listScanRunsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - 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['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.asyncIterate( - this.innerApiCalls['listScanRuns'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List CrawledUrls under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl}. - * 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 `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse - ]>; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): void; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): void; - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listCrawledUrls(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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl} 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 `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCrawledUrlsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - 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['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.createStream( - this.innerApiCalls.listCrawledUrls as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCrawledUrls`, 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl}. 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/web_security_scanner.list_crawled_urls.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async - */ - listCrawledUrlsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - 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['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.asyncIterate( - this.innerApiCalls['listCrawledUrls'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List Findings under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1alpha.Finding|Finding}. - * 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 `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFindings( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding[], - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>): void; - listFindings( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>): void; - listFindings( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding[], - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFindings(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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1alpha.Finding|Finding} 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 `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFindingsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - 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['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.createStream( - this.innerApiCalls.listFindings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFindings`, 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1alpha.Finding|Finding}. 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/web_security_scanner.list_findings.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - 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['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.asyncIterate( - this.innerApiCalls['listFindings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified finding resource name string. - * - * @param {string} project - * @param {string} scan_config - * @param {string} scan_run - * @param {string} finding - * @returns {string} Resource name string. - */ - findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { - return this.pathTemplates.findingPathTemplate.render({ - project: project, - scan_config: scanConfig, - scan_run: scanRun, - finding: finding, - }); - } - - /** - * Parse the project from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).project; - } - - /** - * Parse the scan_config from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; - } - - /** - * Parse the scan_run from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_run. - */ - matchScanRunFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; - } - - /** - * Parse the finding from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).finding; - } - - /** - * 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 scanConfig resource name string. - * - * @param {string} project - * @param {string} scan_config - * @returns {string} Resource name string. - */ - scanConfigPath(project:string,scanConfig:string) { - return this.pathTemplates.scanConfigPathTemplate.render({ - project: project, - scan_config: scanConfig, - }); - } - - /** - * Parse the project from ScanConfig resource. - * - * @param {string} scanConfigName - * A fully-qualified path representing ScanConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).project; - } - - /** - * Parse the scan_config from ScanConfig resource. - * - * @param {string} scanConfigName - * A fully-qualified path representing ScanConfig resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).scan_config; - } - - /** - * Return a fully-qualified scanRun resource name string. - * - * @param {string} project - * @param {string} scan_config - * @param {string} scan_run - * @returns {string} Resource name string. - */ - scanRunPath(project:string,scanConfig:string,scanRun:string) { - return this.pathTemplates.scanRunPathTemplate.render({ - project: project, - scan_config: scanConfig, - scan_run: scanRun, - }); - } - - /** - * Parse the project from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the project. - */ - matchProjectFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).project; - } - - /** - * Parse the scan_config from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_config; - } - - /** - * Parse the scan_run from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the scan_run. - */ - matchScanRunFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_run; - } - - /** - * 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.webSecurityScannerStub && !this._terminated) { - return this.webSecurityScannerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client_config.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client_config.json deleted file mode 100644 index 288b9b02400..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_client_config.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "interfaces": { - "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner": { - "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": { - "CreateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanConfigs": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanRuns": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "StopScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListCrawledUrls": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetFinding": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindingTypeStats": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_proto_list.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_proto_list.json deleted file mode 100644 index 1696775c642..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/src/v1alpha/web_security_scanner_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/finding.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto" -] diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 54b6f3aa5e5..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 websecurityscanner = require('@google-cloud/web-security-scanner'); - -function main() { - const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 3bd84309184..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; - -// check that the client class type name can be used -function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const webSecurityScannerClient = new WebSecurityScannerClient(); - doStuffWithWebSecurityScannerClient(webSecurityScannerClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/install.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1alpha/test/gapic_web_security_scanner_v1alpha.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/test/gapic_web_security_scanner_v1alpha.ts deleted file mode 100644 index a22ad5b370d..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/test/gapic_web_security_scanner_v1alpha.ts +++ /dev/null @@ -1,2324 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 websecurityscannerModule 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('v1alpha.WebSecurityScannerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = websecurityscannerModule.v1alpha.WebSecurityScannerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = websecurityscannerModule.v1alpha.WebSecurityScannerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = websecurityscannerModule.v1alpha.WebSecurityScannerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - await client.initialize(); - assert(client.webSecurityScannerStub); - }); - - it('has close method for the initialized client', done => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.webSecurityScannerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - 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 websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - 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('createScanConfig', () => { - it('invokes createScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createScanConfig(request), expectedError); - }); - }); - - describe('deleteScanConfig', () => { - it('invokes deleteScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteScanConfig( - 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.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteScanConfig(request), expectedError); - }); - }); - - describe('getScanConfig', () => { - it('invokes getScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanConfig(request), expectedError); - }); - }); - - describe('updateScanConfig', () => { - it('invokes updateScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateScanConfig(request), expectedError); - }); - }); - - describe('startScanRun', () => { - it('invokes startScanRun without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.startScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.startScanRun(request), expectedError); - }); - }); - - describe('getScanRun', () => { - it('invokes getScanRun without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.getScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanRun(request), expectedError); - }); - }); - - describe('stopScanRun', () => { - it('invokes stopScanRun without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.stopScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.stopScanRun(request), expectedError); - }); - }); - - describe('getFinding', () => { - it('invokes getFinding without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); - const [response] = await client.getFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFinding( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFinding(request), expectedError); - }); - }); - - describe('listFindingTypeStats', () => { - it('invokes listFindingTypeStats without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); - const [response] = await client.listFindingTypeStats(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindingTypeStats( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - }); - }); - - describe('listScanConfigs', () => { - it('invokes listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listScanConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigs without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig) => { - 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.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listScanConfigsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = []; - const iterable = client.listScanConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listScanRuns', () => { - it('invokes listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); - const [response] = await client.listScanRuns(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRuns without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanRuns( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanRuns(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRunsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun) => { - 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.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listScanRunsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = []; - const iterable = client.listScanRunsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanRunsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCrawledUrls', () => { - it('invokes listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); - const [response] = await client.listCrawledUrls(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrls without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCrawledUrls( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCrawledUrls(request), expectedError); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrlsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl) => { - 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.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCrawledUrlsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = []; - const iterable = client.listCrawledUrlsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCrawledUrlsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IFinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.Finding) => { - 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.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFindingsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('finding', () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - finding: "findingValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.findingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.findingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('findingPath', () => { - const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFindingName', () => { - const result = client.matchProjectFromFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromFindingName', () => { - const result = client.matchScanConfigFromFindingName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanRunFromFindingName', () => { - const result = client.matchScanRunFromFindingName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFindingName', () => { - const result = client.matchFindingFromFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - 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('scanConfig', () => { - const fakePath = "/rendered/path/scanConfig"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.scanConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanConfigPath', () => { - const result = client.scanConfigPath("projectValue", "scanConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromScanConfigName', () => { - const result = client.matchProjectFromScanConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromScanConfigName', () => { - const result = client.matchScanConfigFromScanConfigName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('scanRun', () => { - const fakePath = "/rendered/path/scanRun"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.scanRunPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanRunPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanRunPath', () => { - const result = client.scanRunPath("projectValue", "scanConfigValue", "scanRunValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanRunPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromScanRunName', () => { - const result = client.matchProjectFromScanRunName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromScanRunName', () => { - const result = client.matchScanConfigFromScanRunName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanRunFromScanRunName', () => { - const result = client.matchScanRunFromScanRunName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/tsconfig.json b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1alpha/webpack.config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1alpha/webpack.config.js deleted file mode 100644 index ad3467d60d6..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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: 'WebSecurityScanner', - filename: './web-security-scanner.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-websecurityscanner/v1beta/.eslintignore b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.gitignore b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.jsdoc.js deleted file mode 100644 index efbbc504438..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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/web-security-scanner', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1beta/README.md b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/README.md deleted file mode 100644 index 727d3b68aef..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Websecurityscanner: Nodejs Client diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/package.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/package.json deleted file mode 100644 index e7d7667cbd2..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/web-security-scanner", - "version": "0.1.0", - "description": "Websecurityscanner client for Node.js", - "repository": "googleapis/nodejs-websecurityscanner", - "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 websecurityscanner", - "websecurityscanner", - "web security scanner" - ], - "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-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto deleted file mode 100644 index 235f8126469..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto +++ /dev/null @@ -1,41 +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.websecurityscanner.v1beta; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "CrawledUrlProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web -// Security Scanner Service crawls the web applications, following all links -// within the scope of sites, to find the URLs to test against. -message CrawledUrl { - // The http method of the request that was used to visit the URL, in - // uppercase. - string http_method = 1; - - // The URL that was crawled. - string url = 2; - - // The body of the request that was used to visit the URL. - string body = 3; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto deleted file mode 100644 index ca07cafd902..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto +++ /dev/null @@ -1,98 +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.websecurityscanner.v1beta; - -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1beta/finding_addon.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "FindingProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// A Finding resource represents a vulnerability instance identified during a -// ScanRun. -message Finding { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/Finding" - pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" - }; - - // The resource name of the Finding. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. - // The finding IDs are generated by the system. - string name = 1; - - // The type of the Finding. - // Detailed and up-to-date information on findings can be found here: - // https://cloud.google.com/security-scanner/docs/scan-result-details - string finding_type = 2; - - // The http method of the request that triggered the vulnerability, in - // uppercase. - string http_method = 3; - - // The URL produced by the server-side fuzzer and used in the request that - // triggered the vulnerability. - string fuzzed_url = 4; - - // The body of the request that triggered the vulnerability. - string body = 5; - - // The description of the vulnerability. - string description = 6; - - // The URL containing human-readable payload that user can leverage to - // reproduce the vulnerability. - string reproduction_url = 7; - - // If the vulnerability was originated from nested IFrame, the immediate - // parent IFrame is reported. - string frame_url = 8; - - // The URL where the browser lands when the vulnerability is detected. - string final_url = 9; - - // The tracking ID uniquely identifies a vulnerability instance across - // multiple ScanRuns. - string tracking_id = 10; - - // An addon containing information reported for a vulnerability with an HTML - // form, if any. - Form form = 16; - - // An addon containing information about outdated libraries. - OutdatedLibrary outdated_library = 11; - - // An addon containing detailed information regarding any resource causing the - // vulnerability such as JavaScript sources, image, audio files, etc. - ViolatingResource violating_resource = 12; - - // An addon containing information about vulnerable or missing HTTP headers. - VulnerableHeaders vulnerable_headers = 15; - - // An addon containing information about request parameters which were found - // to be vulnerable. - VulnerableParameters vulnerable_parameters = 13; - - // An addon containing information reported for an XSS, if any. - Xss xss = 14; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto deleted file mode 100644 index a64fbf8e1df..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto +++ /dev/null @@ -1,90 +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.websecurityscanner.v1beta; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "FindingAddonProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// ! Information about a vulnerability with an HTML. -message Form { - // ! The URI where to send the form when it's submitted. - string action_uri = 1; - - // ! The names of form fields related to the vulnerability. - repeated string fields = 2; -} - -// Information reported for an outdated library. -message OutdatedLibrary { - // The name of the outdated library. - string library_name = 1; - - // The version number. - string version = 2; - - // URLs to learn more information about the vulnerabilities in the library. - repeated string learn_more_urls = 3; -} - -// Information regarding any resource causing the vulnerability such -// as JavaScript sources, image, audio files, etc. -message ViolatingResource { - // The MIME type of this resource. - string content_type = 1; - - // URL of this violating resource. - string resource_url = 2; -} - -// Information about vulnerable request parameters. -message VulnerableParameters { - // The vulnerable parameter names. - repeated string parameter_names = 1; -} - -// Information about vulnerable or missing HTTP Headers. -message VulnerableHeaders { - // Describes a HTTP Header. - message Header { - // Header name. - string name = 1; - - // Header value. - string value = 2; - } - - // List of vulnerable headers. - repeated Header headers = 1; - - // List of missing headers. - repeated Header missing_headers = 2; -} - -// Information reported for an XSS. -message Xss { - // Stack traces leading to the point where the XSS occurred. - repeated string stack_traces = 1; - - // An error message generated by a javascript breakage. - string error_message = 2; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto deleted file mode 100644 index 842a9f359e1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto +++ /dev/null @@ -1,36 +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.websecurityscanner.v1beta; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "FindingTypeStatsProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// A FindingTypeStats resource represents stats regarding a specific FindingType -// of Findings under a given ScanRun. -message FindingTypeStats { - // The finding type associated with the stats. - string finding_type = 1; - - // The count of findings belonging to this finding type. - int32 finding_count = 2; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto deleted file mode 100644 index 550e2e736a8..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto +++ /dev/null @@ -1,193 +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.websecurityscanner.v1beta; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1beta/scan_run.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanConfigProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// A ScanConfig resource contains the configurations to launch a scan. -message ScanConfig { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - pattern: "projects/{project}/scanConfigs/{scan_config}" - }; - - // Scan authentication configuration. - message Authentication { - // Describes authentication configuration that uses a Google account. - message GoogleAccount { - // Required. The user name of the Google account. - string username = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. The password of the Google account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - } - - // Describes authentication configuration that uses a custom account. - message CustomAccount { - // Required. The user name of the custom account. - string username = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. The password of the custom account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - - // Required. The login form URL of the website. - string login_url = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. - // Authentication configuration - oneof authentication { - // Authentication using a Google account. - GoogleAccount google_account = 1; - - // Authentication using a custom account. - CustomAccount custom_account = 2; - } - } - - // Scan schedule configuration. - message Schedule { - // A timestamp indicates when the next run will be scheduled. The value is - // refreshed by the server after each run. If unspecified, it will default - // to current server time, which means the scan will be scheduled to start - // immediately. - google.protobuf.Timestamp schedule_time = 1; - - // Required. The duration of time between executions in days. - int32 interval_duration_days = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Type of user agents used for scanning. - enum UserAgent { - // The user agent is unknown. Service will default to CHROME_LINUX. - USER_AGENT_UNSPECIFIED = 0; - - // Chrome on Linux. This is the service default if unspecified. - CHROME_LINUX = 1; - - // Chrome on Android. - CHROME_ANDROID = 2; - - // Safari on IPhone. - SAFARI_IPHONE = 3; - } - - // Cloud platforms supported by Cloud Web Security Scanner. - enum TargetPlatform { - // The target platform is unknown. Requests with this enum value will be - // rejected with INVALID_ARGUMENT error. - TARGET_PLATFORM_UNSPECIFIED = 0; - - // Google App Engine service. - APP_ENGINE = 1; - - // Google Compute Engine service. - COMPUTE = 2; - } - - // Scan risk levels supported by Cloud Web Security Scanner. LOW impact - // scanning will minimize requests with the potential to modify data. To - // achieve the maximum scan coverage, NORMAL risk level is recommended. - enum RiskLevel { - // Use default, which is NORMAL. - RISK_LEVEL_UNSPECIFIED = 0; - - // Normal scanning (Recommended) - NORMAL = 1; - - // Lower impact scanning - LOW = 2; - } - - // Controls export of scan configurations and results to Cloud Security - // Command Center. - enum ExportToSecurityCommandCenter { - // Use default, which is ENABLED. - EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; - - // Export results of this scan to Cloud Security Command Center. - ENABLED = 1; - - // Do not export results of this scan to Cloud Security Command Center. - DISABLED = 2; - } - - // The resource name of the ScanConfig. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are - // generated by the system. - string name = 1; - - // Required. The user provided display name of the ScanConfig. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The maximum QPS during scanning. A valid value ranges from 5 to 20 - // inclusively. If the field is unspecified or its value is set 0, server will - // default to 15. Other values outside of [5, 20] range will be rejected with - // INVALID_ARGUMENT error. - int32 max_qps = 3; - - // Required. The starting URLs from which the scanner finds site pages. - repeated string starting_urls = 4 [(google.api.field_behavior) = REQUIRED]; - - // The authentication configuration. If specified, service will use the - // authentication configuration during scanning. - Authentication authentication = 5; - - // The user agent used during scanning. - UserAgent user_agent = 6; - - // The blacklist URL patterns as described in - // https://cloud.google.com/security-scanner/docs/excluded-urls - repeated string blacklist_patterns = 7; - - // The schedule of the ScanConfig. - Schedule schedule = 8; - - // Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be - // used as a default. - repeated TargetPlatform target_platforms = 9; - - // Controls export of scan configurations and results to Cloud Security - // Command Center. - ExportToSecurityCommandCenter export_to_security_command_center = 10; - - // Latest ScanRun if available. - ScanRun latest_run = 11; - - // The risk level selected for the scan - RiskLevel risk_level = 12; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto deleted file mode 100644 index 3030f9f264f..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto +++ /dev/null @@ -1,190 +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.websecurityscanner.v1beta; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanConfigErrorProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// Defines a custom error message used by CreateScanConfig and UpdateScanConfig -// APIs when scan configuration validation fails. It is also reported as part of -// a ScanRunErrorTrace message if scan validation fails due to a scan -// configuration error. -message ScanConfigError { - // Output only. - // Defines an error reason code. - // Next id: 44 - enum Code { - option allow_alias = true; - - // There is no error. - CODE_UNSPECIFIED = 0; - - // There is no error. - OK = 0; - - // Indicates an internal server error. - // Please DO NOT USE THIS ERROR CODE unless the root cause is truly unknown. - INTERNAL_ERROR = 1; - - // One of the seed URLs is an App Engine URL but we cannot validate the scan - // settings due to an App Engine API backend error. - APPENGINE_API_BACKEND_ERROR = 2; - - // One of the seed URLs is an App Engine URL but we cannot access the - // App Engine API to validate scan settings. - APPENGINE_API_NOT_ACCESSIBLE = 3; - - // One of the seed URLs is an App Engine URL but the Default Host of the - // App Engine is not set. - APPENGINE_DEFAULT_HOST_MISSING = 4; - - // Google corporate accounts can not be used for scanning. - CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; - - // The account of the scan creator can not be used for scanning. - CANNOT_USE_OWNER_ACCOUNT = 7; - - // This scan targets Compute Engine, but we cannot validate scan settings - // due to a Compute Engine API backend error. - COMPUTE_API_BACKEND_ERROR = 8; - - // This scan targets Compute Engine, but we cannot access the Compute Engine - // API to validate the scan settings. - COMPUTE_API_NOT_ACCESSIBLE = 9; - - // The Custom Login URL does not belong to the current project. - CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; - - // The Custom Login URL is malformed (can not be parsed). - CUSTOM_LOGIN_URL_MALFORMED = 11; - - // The Custom Login URL is mapped to a non-routable IP address in DNS. - CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; - - // The Custom Login URL is mapped to an IP address which is not reserved for - // the current project. - CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; - - // The Custom Login URL has a non-routable IP address. - CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; - - // The Custom Login URL has an IP address which is not reserved for the - // current project. - CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; - - // Another scan with the same name (case-sensitive) already exists. - DUPLICATE_SCAN_NAME = 16; - - // A field is set to an invalid value. - INVALID_FIELD_VALUE = 18; - - // There was an error trying to authenticate to the scan target. - FAILED_TO_AUTHENTICATE_TO_TARGET = 19; - - // Finding type value is not specified in the list findings request. - FINDING_TYPE_UNSPECIFIED = 20; - - // Scan targets Compute Engine, yet current project was not whitelisted for - // Google Compute Engine Scanning Alpha access. - FORBIDDEN_TO_SCAN_COMPUTE = 21; - - // User tries to update managed scan - FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; - - // The supplied filter is malformed. For example, it can not be parsed, does - // not have a filter type in expression, or the same filter type appears - // more than once. - MALFORMED_FILTER = 22; - - // The supplied resource name is malformed (can not be parsed). - MALFORMED_RESOURCE_NAME = 23; - - // The current project is not in an active state. - PROJECT_INACTIVE = 24; - - // A required field is not set. - REQUIRED_FIELD = 25; - - // Project id, scanconfig id, scanrun id, or finding id are not consistent - // with each other in resource name. - RESOURCE_NAME_INCONSISTENT = 26; - - // The scan being requested to start is already running. - SCAN_ALREADY_RUNNING = 27; - - // The scan that was requested to be stopped is not running. - SCAN_NOT_RUNNING = 28; - - // One of the seed URLs does not belong to the current project. - SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; - - // One of the seed URLs is malformed (can not be parsed). - SEED_URL_MALFORMED = 30; - - // One of the seed URLs is mapped to a non-routable IP address in DNS. - SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; - - // One of the seed URLs is mapped to an IP address which is not reserved - // for the current project. - SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; - - // One of the seed URLs has on-routable IP address. - SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; - - // One of the seed URLs has an IP address that is not reserved - // for the current project. - SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; - - // The Cloud Security Scanner service account is not configured under the - // project. - SERVICE_ACCOUNT_NOT_CONFIGURED = 36; - - // A project has reached the maximum number of scans. - TOO_MANY_SCANS = 37; - - // Resolving the details of the current project fails. - UNABLE_TO_RESOLVE_PROJECT_INFO = 38; - - // One or more blacklist patterns were in the wrong format. - UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; - - // The supplied filter is not supported. - UNSUPPORTED_FILTER = 40; - - // The supplied finding type is not supported. For example, we do not - // provide findings of the given finding type. - UNSUPPORTED_FINDING_TYPE = 41; - - // The URL scheme of one or more of the supplied URLs is not supported. - UNSUPPORTED_URL_SCHEME = 42; - } - - // Indicates the reason code for a configuration failure. - Code code = 1; - - // Indicates the full name of the ScanConfig field that triggers this error, - // for example "scan_config.max_qps". This field is provided for - // troubleshooting purposes only and its actual value can change in the - // future. - string field_name = 2; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto deleted file mode 100644 index da45e0a681e..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto +++ /dev/null @@ -1,117 +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.websecurityscanner.v1beta; - -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto"; -import "google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// A ScanRun is a output-only resource representing an actual run of the scan. -// Next id: 12 -message ScanRun { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/ScanRun" - pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}" - }; - - // Types of ScanRun execution state. - enum ExecutionState { - // Represents an invalid state caused by internal server error. This value - // should never be returned. - EXECUTION_STATE_UNSPECIFIED = 0; - - // The scan is waiting in the queue. - QUEUED = 1; - - // The scan is in progress. - SCANNING = 2; - - // The scan is either finished or stopped by user. - FINISHED = 3; - } - - // Types of ScanRun result state. - enum ResultState { - // Default value. This value is returned when the ScanRun is not yet - // finished. - RESULT_STATE_UNSPECIFIED = 0; - - // The scan finished without errors. - SUCCESS = 1; - - // The scan finished with errors. - ERROR = 2; - - // The scan was terminated by user. - KILLED = 3; - } - - // The resource name of the ScanRun. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - // The ScanRun IDs are generated by the system. - string name = 1; - - // The execution state of the ScanRun. - ExecutionState execution_state = 2; - - // The result state of the ScanRun. This field is only available after the - // execution state reaches "FINISHED". - ResultState result_state = 3; - - // The time at which the ScanRun started. - google.protobuf.Timestamp start_time = 4; - - // The time at which the ScanRun reached termination state - that the ScanRun - // is either finished or stopped by user. - google.protobuf.Timestamp end_time = 5; - - // The number of URLs crawled during this ScanRun. If the scan is in progress, - // the value represents the number of URLs crawled up to now. - int64 urls_crawled_count = 6; - - // The number of URLs tested during this ScanRun. If the scan is in progress, - // the value represents the number of URLs tested up to now. The number of - // URLs tested is usually larger than the number URLS crawled because - // typically a crawled URL is tested with multiple test payloads. - int64 urls_tested_count = 7; - - // Whether the scan run has found any vulnerabilities. - bool has_vulnerabilities = 8; - - // The percentage of total completion ranging from 0 to 100. - // If the scan is in queue, the value is 0. - // If the scan is running, the value ranges from 0 to 100. - // If the scan is finished, the value is 100. - int32 progress_percent = 9; - - // If result_state is an ERROR, this field provides the primary reason for - // scan's termination and more details, if such are available. - ScanRunErrorTrace error_trace = 10; - - // A list of warnings, if such are encountered during this scan run. - repeated ScanRunWarningTrace warning_traces = 11; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto deleted file mode 100644 index 5eedd11503d..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto +++ /dev/null @@ -1,76 +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.websecurityscanner.v1beta; - -import "google/cloud/websecurityscanner/v1beta/scan_config_error.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunErrorTraceProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// Output only. -// Defines an error trace message for a ScanRun. -message ScanRunErrorTrace { - // Output only. - // Defines an error reason code. - // Next id: 7 - enum Code { - // Default value is never used. - CODE_UNSPECIFIED = 0; - - // Indicates that the scan run failed due to an internal server error. - INTERNAL_ERROR = 1; - - // Indicates a scan configuration error, usually due to outdated ScanConfig - // settings, such as starting_urls or the DNS configuration. - SCAN_CONFIG_ISSUE = 2; - - // Indicates an authentication error, usually due to outdated ScanConfig - // authentication settings. - AUTHENTICATION_CONFIG_ISSUE = 3; - - // Indicates a scan operation timeout, usually caused by a very large site. - TIMED_OUT_WHILE_SCANNING = 4; - - // Indicates that a scan encountered excessive redirects, either to - // authentication or some other page outside of the scan scope. - TOO_MANY_REDIRECTS = 5; - - // Indicates that a scan encountered numerous errors from the web site - // pages. When available, most_common_http_error_code field indicates the - // most common HTTP error code encountered during the scan. - TOO_MANY_HTTP_ERRORS = 6; - } - - // Indicates the error reason code. - Code code = 1; - - // If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error - // message encountered during scan configuration validation that is performed - // before each scan run. - ScanConfigError scan_config_error = 2; - - // If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most - // common HTTP error code, if such is available. For example, if this code is - // 404, the scan has encountered too many NOT_FOUND responses. - int32 most_common_http_error_code = 3; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto deleted file mode 100644 index 0786e94d160..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto +++ /dev/null @@ -1,59 +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.websecurityscanner.v1beta; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunWarningTraceProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// Output only. -// Defines a warning trace message for ScanRun. Warning traces provide customers -// with useful information that helps make the scanning process more effective. -message ScanRunWarningTrace { - // Output only. - // Defines a warning message code. - // Next id: 6 - enum Code { - // Default value is never used. - CODE_UNSPECIFIED = 0; - - // Indicates that a scan discovered an unexpectedly low number of URLs. This - // is sometimes caused by complex navigation features or by using a single - // URL for numerous pages. - INSUFFICIENT_CRAWL_RESULTS = 1; - - // Indicates that a scan discovered too many URLs to test, or excessive - // redundant URLs. - TOO_MANY_CRAWL_RESULTS = 2; - - // Indicates that too many tests have been generated for the scan. Customer - // should try reducing the number of starting URLs, increasing the QPS rate, - // or narrowing down the scope of the scan using the excluded patterns. - TOO_MANY_FUZZ_TASKS = 3; - - // Indicates that a scan is blocked by IAP. - BLOCKED_BY_IAP = 4; - } - - // Indicates the warning code. - Code code = 1; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto deleted file mode 100644 index 211affc4cc2..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto +++ /dev/null @@ -1,413 +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.websecurityscanner.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/websecurityscanner/v1beta/crawled_url.proto"; -import "google/cloud/websecurityscanner/v1beta/finding.proto"; -import "google/cloud/websecurityscanner/v1beta/finding_type_stats.proto"; -import "google/cloud/websecurityscanner/v1beta/scan_config.proto"; -import "google/cloud/websecurityscanner/v1beta/scan_run.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "cloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb"; -option java_multiple_files = true; -option java_outer_classname = "WebSecurityScannerProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// Cloud Web Security Scanner Service identifies security vulnerabilities in web -// applications hosted on Google Cloud Platform. It crawls your application, and -// attempts to exercise as many user inputs and event handlers as possible. -service WebSecurityScanner { - option (google.api.default_host) = "websecurityscanner.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new ScanConfig. - rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*}/scanConfigs" - body: "scan_config" - }; - option (google.api.method_signature) = "parent,scan_config"; - } - - // Deletes an existing ScanConfig and its child resources. - rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/scanConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a ScanConfig. - rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/scanConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists ScanConfigs under a given project. - rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*}/scanConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates a ScanConfig. This method support partial update of a ScanConfig. - rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - patch: "/v1beta/{scan_config.name=projects/*/scanConfigs/*}" - body: "scan_config" - }; - option (google.api.method_signature) = "scan_config,update_mask"; - } - - // Start a ScanRun according to the given ScanConfig. - rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1beta/{name=projects/*/scanConfigs/*}:start" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a ScanRun. - rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - // stop time. - rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/scanConfigs/*}/scanRuns" - }; - option (google.api.method_signature) = "parent"; - } - - // Stops a ScanRun. The stopped ScanRun is returned. - rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // List CrawledUrls under a given ScanRun. - rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a Finding. - rpc GetFinding(GetFindingRequest) returns (Finding) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List Findings under a given ScanRun. - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" - }; - option (google.api.method_signature) = "parent,filter"; - } - - // List all FindingTypeStats under a given ScanRun. - rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request for the `CreateScanConfig` method. -message CreateScanConfigRequest { - // Required. The parent resource name where the scan is created, which should be a - // project resource name in the format 'projects/{projectId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The ScanConfig to be created. - ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `DeleteScanConfig` method. -message DeleteScanConfigRequest { - // Required. The resource name of the ScanConfig to be deleted. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `GetScanConfig` method. -message GetScanConfigRequest { - // Required. The resource name of the ScanConfig to be returned. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `ListScanConfigs` method. -message ListScanConfigsRequest { - // Required. The parent resource name, which should be a project resource name in the - // format 'projects/{projectId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanConfigs to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Request for the `UpdateScanConfigRequest` method. -message UpdateScanConfigRequest { - // Required. The ScanConfig to be updated. The name field must be set to identify the - // resource to be updated. The values of fields not covered by the mask - // will be ignored. - ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The update mask applies to the resource. For the `FieldMask` definition, - // see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the `ListScanConfigs` method. -message ListScanConfigsResponse { - // The list of ScanConfigs returned. - repeated ScanConfig scan_configs = 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 for the `StartScanRun` method. -message StartScanRunRequest { - // Required. The resource name of the ScanConfig to be used. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `GetScanRun` method. -message GetScanRunRequest { - // Required. The resource name of the ScanRun to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Request for the `ListScanRuns` method. -message ListScanRunsRequest { - // Required. The parent resource name, which should be a scan resource name in the - // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanRuns to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListScanRuns` method. -message ListScanRunsResponse { - // The list of ScanRuns returned. - repeated ScanRun scan_runs = 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 for the `StopScanRun` method. -message StopScanRunRequest { - // Required. The resource name of the ScanRun to be stopped. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Request for the `ListCrawledUrls` method. -message ListCrawledUrlsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of CrawledUrls to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListCrawledUrls` method. -message ListCrawledUrlsResponse { - // The list of CrawledUrls returned. - repeated CrawledUrl crawled_urls = 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 for the `GetFinding` method. -message GetFindingRequest { - // Required. The resource name of the Finding to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/Finding" - } - ]; -} - -// Request for the `ListFindings` method. -message ListFindingsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; - - // Required. The filter expression. The expression must be in the format: - // . - // Supported field: 'finding_type'. - // Supported operator: '='. - string filter = 2 [(google.api.field_behavior) = REQUIRED]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 3; - - // The maximum number of Findings to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 4; -} - -// Response for the `ListFindings` method. -message ListFindingsResponse { - // The list of Findings returned. - repeated Finding findings = 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 for the `ListFindingTypeStats` method. -message ListFindingTypeStatsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Response for the `ListFindingTypeStats` method. -message ListFindingTypeStatsResponse { - // The list of FindingTypeStats returned. - repeated FindingTypeStats finding_type_stats = 1; -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json deleted file mode 100644 index 88fc2b3b4de..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json +++ /dev/null @@ -1,579 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-websecurityscanner", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.websecurityscanner.v1beta", - "version": "v1beta" - } - ] - }, - "snippets": [ - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async", - "title": "WebSecurityScanner createScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a new ScanConfig.", - "canonical": true, - "file": "web_security_scanner.create_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.CreateScanConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1beta.ScanConfig" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.CreateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async", - "title": "WebSecurityScanner deleteScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing ScanConfig and its child resources.", - "canonical": true, - "file": "web_security_scanner.delete_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.DeleteScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.DeleteScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async", - "title": "WebSecurityScanner getScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.get_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async", - "title": "WebSecurityScanner listScanConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanConfigs under a given project.", - "canonical": true, - "file": "web_security_scanner.list_scan_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ListScanConfigsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanConfigs", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async", - "title": "WebSecurityScanner updateScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.update_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.UpdateScanConfig", - "async": true, - "parameters": [ - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1beta.ScanConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.UpdateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async", - "title": "WebSecurityScanner startScanRun Sample", - "origin": "API_DEFINITION", - "description": " Start a ScanRun according to the given ScanConfig.", - "canonical": true, - "file": "web_security_scanner.start_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StartScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StartScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async", - "title": "WebSecurityScanner getScanRun Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanRun.", - "canonical": true, - "file": "web_security_scanner.get_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async", - "title": "WebSecurityScanner listScanRuns Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", - "canonical": true, - "file": "web_security_scanner.list_scan_runs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanRuns", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ListScanRunsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanRuns", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async", - "title": "WebSecurityScanner stopScanRun Sample", - "origin": "API_DEFINITION", - "description": " Stops a ScanRun. The stopped ScanRun is returned.", - "canonical": true, - "file": "web_security_scanner.stop_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StopScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StopScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async", - "title": "WebSecurityScanner listCrawledUrls Sample", - "origin": "API_DEFINITION", - "description": " List CrawledUrls under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_crawled_urls.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListCrawledUrls", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ListCrawledUrlsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListCrawledUrls", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async", - "title": "WebSecurityScanner getFinding Sample", - "origin": "API_DEFINITION", - "description": " Gets a Finding.", - "canonical": true, - "file": "web_security_scanner.get_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetFinding", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.Finding", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetFinding", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async", - "title": "WebSecurityScanner listFindings Sample", - "origin": "API_DEFINITION", - "description": " List Findings under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ListFindingsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindings", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async", - "title": "WebSecurityScanner listFindingTypeStats Sample", - "origin": "API_DEFINITION", - "description": " List all FindingTypeStats under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_finding_type_stats.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindingTypeStats", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindingTypeStats", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js deleted file mode 100644 index e4467b5df85..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_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(parent, scanConfig) { - // [START websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * Required. The ScanConfig to be created. - */ - // const scanConfig = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callCreateScanConfig() { - // Construct request - const request = { - parent, - scanConfig, - }; - - // Run request - const response = await websecurityscannerClient.createScanConfig(request); - console.log(response); - } - - callCreateScanConfig(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js deleted file mode 100644 index 9da6d0f71f2..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_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 websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callDeleteScanConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.deleteScanConfig(request); - console.log(response); - } - - callDeleteScanConfig(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js deleted file mode 100644 index 4f1654f5b1e..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetFinding() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getFinding(request); - console.log(response); - } - - callGetFinding(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js deleted file mode 100644 index bd8361ad4e1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getScanConfig(request); - console.log(response); - } - - callGetScanConfig(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js deleted file mode 100644 index 09f165b14e2..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getScanRun(request); - console.log(response); - } - - callGetScanRun(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js deleted file mode 100644 index 80a10d20dda..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.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 websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListCrawledUrls() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCrawledUrls(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js deleted file mode 100644 index 1e3e18c1ae4..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.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(parent) { - // [START websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindingTypeStats() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await websecurityscannerClient.listFindingTypeStats(request); - console.log(response); - } - - callListFindingTypeStats(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js deleted file mode 100644 index 91eb930b6f8..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.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, filter) { - // [START websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - */ - // const filter = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindings() { - // Construct request - const request = { - parent, - filter, - }; - - // Run request - const iterable = await websecurityscannerClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js deleted file mode 100644 index b0e43fc1ffe..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.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) { - // [START websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a project resource name in the - * format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listScanConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanConfigs(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js deleted file mode 100644 index aa7864be349..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.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) { - // [START websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanRuns() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listScanRunsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanRuns(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js deleted file mode 100644 index 9a77e49f494..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.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 websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStartScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.startScanRun(request); - console.log(response); - } - - callStartScanRun(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js deleted file mode 100644 index f9484ca36ab..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.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 websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStopScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.stopScanRun(request); - console.log(response); - } - - callStopScanRun(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js deleted file mode 100644 index 243e4ef4686..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.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(scanConfig, updateMask) { - // [START websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - */ - // const scanConfig = {} - /** - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callUpdateScanConfig() { - // Construct request - const request = { - scanConfig, - updateMask, - }; - - // Run request - const response = await websecurityscannerClient.updateScanConfig(request); - console.log(response); - } - - callUpdateScanConfig(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/index.ts deleted file mode 100644 index e31a247796d..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 WebSecurityScannerClient = v1beta.WebSecurityScannerClient; -type WebSecurityScannerClient = v1beta.WebSecurityScannerClient; -export {v1beta, WebSecurityScannerClient}; -export default {v1beta, WebSecurityScannerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/gapic_metadata.json deleted file mode 100644 index c531caa029b..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/gapic_metadata.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.websecurityscanner.v1beta", - "libraryPackage": "@google-cloud/web-security-scanner", - "services": { - "WebSecurityScanner": { - "clients": { - "grpc": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/index.ts deleted file mode 100644 index c4b9ebe89d1..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client.ts deleted file mode 100644 index 51d2f80dd97..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client.ts +++ /dev/null @@ -1,1927 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1beta/web_security_scanner_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './web_security_scanner_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Cloud Web Security Scanner Service identifies security vulnerabilities in web - * applications hosted on Google Cloud Platform. It crawls your application, and - * attempts to exercise as many user inputs and event handlers as possible. - * @class - * @memberof v1beta - */ -export class WebSecurityScannerClient { - 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}; - webSecurityScannerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WebSecurityScannerClient. - * - * @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 WebSecurityScannerClient({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 WebSecurityScannerClient; - 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 = { - findingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - scanConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}' - ), - scanRunPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}' - ), - }; - - // 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 = { - listScanConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), - listScanRuns: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), - listCrawledUrls: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.websecurityscanner.v1beta.WebSecurityScanner', 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.webSecurityScannerStub) { - return this.webSecurityScannerStub; - } - - // Put together the "service stub" for - // google.cloud.websecurityscanner.v1beta.WebSecurityScanner. - this.webSecurityScannerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1beta.WebSecurityScanner') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.websecurityscanner.v1beta.WebSecurityScanner, - 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 webSecurityScannerStubMethods = - ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; - for (const methodName of webSecurityScannerStubMethods) { - const callPromise = this.webSecurityScannerStub.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.webSecurityScannerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'websecurityscanner.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 'websecurityscanner.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 -- - // ------------------- -/** - * Creates a new ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig - * Required. The ScanConfig 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.websecurityscanner.v1beta.ScanConfig|ScanConfig}. - * Please see the {@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/web_security_scanner.create_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async - */ - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|undefined, {}|undefined - ]>; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createScanConfig(request, options, callback); - } -/** - * Deletes an existing ScanConfig and its child resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1beta/web_security_scanner.delete_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async - */ - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|undefined, {}|undefined - ]>; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteScanConfig(request, options, callback); - } -/** - * Gets a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. - * Please see the {@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/web_security_scanner.get_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async - */ - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|undefined, {}|undefined - ]>; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getScanConfig(request, options, callback); - } -/** - * Updates a ScanConfig. This method support partial update of a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * 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.websecurityscanner.v1beta.ScanConfig|ScanConfig}. - * Please see the {@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/web_security_scanner.update_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async - */ - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|undefined, {}|undefined - ]>; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scan_config.name': request.scanConfig!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateScanConfig(request, options, callback); - } -/** - * Start a ScanRun according to the given ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. - * Please see the {@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/web_security_scanner.start_scan_run.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async - */ - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|undefined, {}|undefined - ]>; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.startScanRun(request, options, callback); - } -/** - * Gets a ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. - * Please see the {@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/web_security_scanner.get_scan_run.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async - */ - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|undefined, {}|undefined - ]>; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getScanRun(request, options, callback); - } -/** - * Stops a ScanRun. The stopped ScanRun is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. - * Please see the {@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/web_security_scanner.stop_scan_run.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async - */ - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|undefined, {}|undefined - ]>; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.stopScanRun(request, options, callback); - } -/** - * Gets a Finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.Finding|Finding}. - * Please see the {@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/web_security_scanner.get_finding.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async - */ - getFinding( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|undefined, {}|undefined - ]>; - getFinding( - request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFinding(request, options, callback); - } -/** - * List all FindingTypeStats under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. - * Please see the {@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/web_security_scanner.list_finding_type_stats.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async - */ - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFindingTypeStats(request, options, callback); - } - - /** - * Lists ScanConfigs under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1beta.ScanConfig|ScanConfig}. - * 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 `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse - ]>; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): void; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): void; - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listScanConfigs(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 name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1beta.ScanConfig|ScanConfig} 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 `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanConfigsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - 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['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.createStream( - this.innerApiCalls.listScanConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanConfigs`, 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 name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1beta.ScanConfig|ScanConfig}. 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/web_security_scanner.list_scan_configs.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async - */ - listScanConfigsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - 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['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.asyncIterate( - this.innerApiCalls['listScanConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - * stop time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1beta.ScanRun|ScanRun}. - * 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 `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun[], - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse - ]>; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>): void; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>): void; - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun[], - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listScanRuns(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 name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1beta.ScanRun|ScanRun} 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 `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listScanRunsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - 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['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.createStream( - this.innerApiCalls.listScanRuns as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanRuns`, 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 name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1beta.ScanRun|ScanRun}. 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/web_security_scanner.list_scan_runs.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async - */ - listScanRunsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - 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['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.asyncIterate( - this.innerApiCalls['listScanRuns'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List CrawledUrls under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1beta.CrawledUrl|CrawledUrl}. - * 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 `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse - ]>; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): void; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): void; - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listCrawledUrls(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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1beta.CrawledUrl|CrawledUrl} 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 `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listCrawledUrlsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - 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['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.createStream( - this.innerApiCalls.listCrawledUrls as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCrawledUrls`, 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1beta.CrawledUrl|CrawledUrl}. 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/web_security_scanner.list_crawled_urls.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async - */ - listCrawledUrlsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - 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['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.asyncIterate( - this.innerApiCalls['listCrawledUrls'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List Findings under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.websecurityscanner.v1beta.Finding|Finding}. - * 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 `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFindings( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding[], - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>): void; - listFindings( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>): void; - listFindings( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding[], - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFindings(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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1beta.Finding|Finding} 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 `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFindingsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - 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['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.createStream( - this.innerApiCalls.listFindings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFindings`, 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 name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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.websecurityscanner.v1beta.Finding|Finding}. 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/web_security_scanner.list_findings.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - 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['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.asyncIterate( - this.innerApiCalls['listFindings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified finding resource name string. - * - * @param {string} project - * @param {string} scan_config - * @param {string} scan_run - * @param {string} finding - * @returns {string} Resource name string. - */ - findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { - return this.pathTemplates.findingPathTemplate.render({ - project: project, - scan_config: scanConfig, - scan_run: scanRun, - finding: finding, - }); - } - - /** - * Parse the project from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).project; - } - - /** - * Parse the scan_config from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; - } - - /** - * Parse the scan_run from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_run. - */ - matchScanRunFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; - } - - /** - * Parse the finding from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).finding; - } - - /** - * 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 scanConfig resource name string. - * - * @param {string} project - * @param {string} scan_config - * @returns {string} Resource name string. - */ - scanConfigPath(project:string,scanConfig:string) { - return this.pathTemplates.scanConfigPathTemplate.render({ - project: project, - scan_config: scanConfig, - }); - } - - /** - * Parse the project from ScanConfig resource. - * - * @param {string} scanConfigName - * A fully-qualified path representing ScanConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).project; - } - - /** - * Parse the scan_config from ScanConfig resource. - * - * @param {string} scanConfigName - * A fully-qualified path representing ScanConfig resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).scan_config; - } - - /** - * Return a fully-qualified scanRun resource name string. - * - * @param {string} project - * @param {string} scan_config - * @param {string} scan_run - * @returns {string} Resource name string. - */ - scanRunPath(project:string,scanConfig:string,scanRun:string) { - return this.pathTemplates.scanRunPathTemplate.render({ - project: project, - scan_config: scanConfig, - scan_run: scanRun, - }); - } - - /** - * Parse the project from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the project. - */ - matchProjectFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).project; - } - - /** - * Parse the scan_config from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_config; - } - - /** - * Parse the scan_run from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the scan_run. - */ - matchScanRunFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_run; - } - - /** - * 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.webSecurityScannerStub && !this._terminated) { - return this.webSecurityScannerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client_config.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client_config.json deleted file mode 100644 index ecb06a1b541..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_client_config.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "interfaces": { - "google.cloud.websecurityscanner.v1beta.WebSecurityScanner": { - "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": { - "CreateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanConfigs": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanRuns": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "StopScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListCrawledUrls": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetFinding": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindingTypeStats": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_proto_list.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_proto_list.json deleted file mode 100644 index abb184881d5..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/src/v1beta/web_security_scanner_proto_list.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - "../../protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/finding.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/scan_config.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/scan_run.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto" -] diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 54b6f3aa5e5..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 websecurityscanner = require('@google-cloud/web-security-scanner'); - -function main() { - const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 3bd84309184..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; - -// check that the client class type name can be used -function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const webSecurityScannerClient = new WebSecurityScannerClient(); - doStuffWithWebSecurityScannerClient(webSecurityScannerClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1beta/test/gapic_web_security_scanner_v1beta.ts b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/test/gapic_web_security_scanner_v1beta.ts deleted file mode 100644 index 00fc295313a..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/test/gapic_web_security_scanner_v1beta.ts +++ /dev/null @@ -1,2324 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 websecurityscannerModule 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('v1beta.WebSecurityScannerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = websecurityscannerModule.v1beta.WebSecurityScannerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = websecurityscannerModule.v1beta.WebSecurityScannerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = websecurityscannerModule.v1beta.WebSecurityScannerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - await client.initialize(); - assert(client.webSecurityScannerStub); - }); - - it('has close method for the initialized client', done => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.webSecurityScannerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - 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 websecurityscannerModule.v1beta.WebSecurityScannerClient({ - 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('createScanConfig', () => { - it('invokes createScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createScanConfig(request), expectedError); - }); - }); - - describe('deleteScanConfig', () => { - it('invokes deleteScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteScanConfig( - 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.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteScanConfig(request), expectedError); - }); - }); - - describe('getScanConfig', () => { - it('invokes getScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanConfig(request), expectedError); - }); - }); - - describe('updateScanConfig', () => { - it('invokes updateScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateScanConfig(request), expectedError); - }); - }); - - describe('startScanRun', () => { - it('invokes startScanRun without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.startScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.startScanRun(request), expectedError); - }); - }); - - describe('getScanRun', () => { - it('invokes getScanRun without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.getScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanRun(request), expectedError); - }); - }); - - describe('stopScanRun', () => { - it('invokes stopScanRun without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.stopScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.stopScanRun(request), expectedError); - }); - }); - - describe('getFinding', () => { - it('invokes getFinding without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); - const [response] = await client.getFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFinding( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFinding(request), expectedError); - }); - }); - - describe('listFindingTypeStats', () => { - it('invokes listFindingTypeStats without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); - const [response] = await client.listFindingTypeStats(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindingTypeStats( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - }); - }); - - describe('listScanConfigs', () => { - it('invokes listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listScanConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigs without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig) => { - 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.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listScanConfigsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = []; - const iterable = client.listScanConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listScanRuns', () => { - it('invokes listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); - const [response] = await client.listScanRuns(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRuns without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanRuns( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanRuns(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRunsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { - 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.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listScanRunsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = []; - const iterable = client.listScanRunsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanRunsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCrawledUrls', () => { - it('invokes listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); - const [response] = await client.listCrawledUrls(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrls without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCrawledUrls( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCrawledUrls(request), expectedError); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrlsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl) => { - 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.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCrawledUrlsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = []; - const iterable = client.listCrawledUrlsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCrawledUrlsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IFinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { - 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.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFindingsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('finding', () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - finding: "findingValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.findingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.findingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('findingPath', () => { - const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFindingName', () => { - const result = client.matchProjectFromFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromFindingName', () => { - const result = client.matchScanConfigFromFindingName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanRunFromFindingName', () => { - const result = client.matchScanRunFromFindingName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFindingName', () => { - const result = client.matchFindingFromFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - 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('scanConfig', () => { - const fakePath = "/rendered/path/scanConfig"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.scanConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanConfigPath', () => { - const result = client.scanConfigPath("projectValue", "scanConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromScanConfigName', () => { - const result = client.matchProjectFromScanConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromScanConfigName', () => { - const result = client.matchScanConfigFromScanConfigName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('scanRun', () => { - const fakePath = "/rendered/path/scanRun"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.scanRunPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanRunPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanRunPath', () => { - const result = client.scanRunPath("projectValue", "scanConfigValue", "scanRunValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanRunPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromScanRunName', () => { - const result = client.matchProjectFromScanRunName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromScanRunName', () => { - const result = client.matchScanConfigFromScanRunName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanRunFromScanRunName', () => { - const result = client.matchScanRunFromScanRunName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-websecurityscanner/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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-websecurityscanner/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-websecurityscanner/v1beta/webpack.config.js deleted file mode 100644 index ad3467d60d6..00000000000 --- a/owl-bot-staging/google-cloud-websecurityscanner/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: 'WebSecurityScanner', - filename: './web-security-scanner.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-workflows-executions/executions/v1/.eslintignore b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1/.eslintrc.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.gitignore b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1/.jsdoc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.jsdoc.js deleted file mode 100644 index b828ae8128e..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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/workflow-executions', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.mocharc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1/.prettierrc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1/README.md b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/README.md deleted file mode 100644 index 79032bbed45..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Executions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/package.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/package.json deleted file mode 100644 index e8d6c4f5a1c..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/workflow-executions", - "version": "0.1.0", - "description": "Executions client for Node.js", - "repository": "googleapis/nodejs-executions", - "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 executions", - "executions", - "executions" - ], - "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-workflows-executions/executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto deleted file mode 100644 index 0c6bc12cbed..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto +++ /dev/null @@ -1,399 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.workflows.executions.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/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/workflows/executions/apiv1/executionspb;executionspb"; -option java_multiple_files = true; -option java_outer_classname = "ExecutionsProto"; -option java_package = "com.google.cloud.workflows.executions.v1"; -option (google.api.resource_definition) = { - type: "workflows.googleapis.com/Workflow" - pattern: "projects/{project}/locations/{location}/workflows/{workflow}" -}; - -// Executions is used to start and manage running instances of -// [Workflows][google.cloud.workflows.v1.Workflow] called executions. -service Executions { - option (google.api.default_host) = "workflowexecutions.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Returns a list of executions which belong to the workflow with - // the given name. The method returns executions of all workflow - // revisions. Returned executions are ordered by their start time (newest - // first). - rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/workflows/*}/executions" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new execution using the latest revision of the given workflow. - rpc CreateExecution(CreateExecutionRequest) returns (Execution) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/workflows/*}/executions" - body: "execution" - }; - option (google.api.method_signature) = "parent,execution"; - } - - // Returns an execution of the given name. - rpc GetExecution(GetExecutionRequest) returns (Execution) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Cancels an execution of the given name. - rpc CancelExecution(CancelExecutionRequest) returns (Execution) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}:cancel" - body: "*" - }; - option (google.api.method_signature) = "name"; - } -} - -// A running instance of a -// [Workflow](/workflows/docs/reference/rest/v1/projects.locations.workflows). -message Execution { - option (google.api.resource) = { - type: "workflowexecutions.googleapis.com/Execution" - pattern: "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}" - }; - - // Describes the current state of the execution. More states might be added - // in the future. - enum State { - // Invalid state. - STATE_UNSPECIFIED = 0; - - // The execution is in progress. - ACTIVE = 1; - - // The execution finished successfully. - SUCCEEDED = 2; - - // The execution failed with an error. - FAILED = 3; - - // The execution was stopped intentionally. - CANCELLED = 4; - - // Execution data is unavailable. See the `state_error` field. - UNAVAILABLE = 5; - - // Request has been placed in the backlog for processing at a later time. - QUEUED = 6; - } - - // A single stack element (frame) where an error occurred. - message StackTraceElement { - // Position contains source position information about the stack trace - // element such as line number, column number and length of the code block - // in bytes. - message Position { - // The source code line number the current instruction was generated from. - int64 line = 1; - - // The source code column position (of the line) the current instruction - // was generated from. - int64 column = 2; - - // The number of bytes of source code making up this stack trace element. - int64 length = 3; - } - - // The step the error occurred at. - string step = 1; - - // The routine where the error occurred. - string routine = 2; - - // The source position information of the stack trace element. - Position position = 3; - } - - // A collection of stack elements (frames) where an error occurred. - message StackTrace { - // An array of stack elements. - repeated StackTraceElement elements = 1; - } - - // Error describes why the execution was abnormally terminated. - message Error { - // Error message and data returned represented as a JSON string. - string payload = 1; - - // Human-readable stack trace string. - string context = 2; - - // Stack trace with detailed information of where error was generated. - StackTrace stack_trace = 3; - } - - // Describes the level of platform logging to apply to calls and call - // responses during workflow executions. - enum CallLogLevel { - // No call logging level specified. - CALL_LOG_LEVEL_UNSPECIFIED = 0; - - // Log all call steps within workflows, all call returns, and all exceptions - // raised. - LOG_ALL_CALLS = 1; - - // Log only exceptions that are raised from call steps within workflows. - LOG_ERRORS_ONLY = 2; - - // Explicitly log nothing. - LOG_NONE = 3; - } - - // Represents the current status of this execution. - message Status { - // Represents a step of the workflow this execution is running. - message Step { - // Name of a routine within the workflow. - string routine = 1; - - // Name of a step within the routine. - string step = 2; - } - - // A list of currently executing or last executed step names for the - // workflow execution currently running. If the workflow has succeeded or - // failed, this is the last attempted or executed step. Presently, if the - // current step is inside a subworkflow, the list only includes that step. - // In the future, the list will contain items for each step in the call - // stack, starting with the outermost step in the `main` subworkflow, and - // ending with the most deeply nested step. - repeated Step current_steps = 1; - } - - // Describes an error related to the current state of the Execution resource. - message StateError { - // Describes the possible types of a state error. - enum Type { - // No type specified. - TYPE_UNSPECIFIED = 0; - - // Caused by an issue with KMS. - KMS_ERROR = 1; - } - - // Provides specifics about the error. - string details = 1; - - // The type of this state error. - Type type = 2; - } - - // Output only. The resource name of the execution. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Marks the beginning of execution. - google.protobuf.Timestamp start_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Marks the end of execution, successful or not. - google.protobuf.Timestamp end_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Measures the duration of the execution. - google.protobuf.Duration duration = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Current state of the execution. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input parameters of the execution represented as a JSON string. - // The size limit is 32KB. - // - // *Note*: If you are using the REST API directly to run your workflow, you - // must escape any JSON string value of `argument`. Example: - // `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'` - string argument = 5; - - // Output only. Output of the execution represented as a JSON string. The - // value can only be present if the execution's state is `SUCCEEDED`. - string result = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The error which caused the execution to finish prematurely. - // The value is only present if the execution's state is `FAILED` - // or `CANCELLED`. - Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Revision of the workflow this execution is using. - string workflow_revision_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The call logging level associated to this execution. - CallLogLevel call_log_level = 9; - - // Output only. Status tracks the current steps and progress data of this - // execution. - Status status = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels associated with this execution. - // Labels can contain at most 64 entries. Keys and values can be no longer - // than 63 characters and can only contain lowercase letters, numeric - // characters, underscores, and dashes. Label keys must start with a letter. - // International characters are allowed. - // By default, labels are inherited from the workflow but are overridden by - // any labels associated with the execution. - map labels = 11; - - // Output only. Error regarding the state of the Execution resource. For - // example, this field will have error details if the execution data is - // unavailable due to revoked KMS key permissions. - StateError state_error = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for the -// [ListExecutions][] -// method. -message ListExecutionsRequest { - // Required. Name of the workflow for which the executions should be listed. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; - - // Maximum number of executions to return per call. - // Max supported value depends on the selected Execution view: it's 1000 for - // BASIC and 100 for FULL. The default value used if the field is not - // specified is 100, regardless of the selected view. Values greater than - // the max value will be coerced down to it. - int32 page_size = 2; - - // A page token, received from a previous `ListExecutions` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListExecutions` must - // match the call that provided the page token. - // - // Note that pagination is applied to dynamic data. The list of executions - // returned can change between page requests. - string page_token = 3; - - // Optional. A view defining which fields should be filled in the returned - // executions. The API will default to the BASIC view. - ExecutionView view = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Filters applied to the [Executions.ListExecutions] results. - // The following fields are supported for filtering: - // executionID, state, startTime, endTime, duration, workflowRevisionID, - // stepName, and label. - string filter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The ordering applied to the [Executions.ListExecutions] results. - // By default the ordering is based on descending start time. - // The following fields are supported for order by: - // executionID, startTime, endTime, duration, state, and workflowRevisionID. - string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response for the -// [ListExecutions][google.cloud.workflows.executions.v1.Executions.ListExecutions] -// method. -message ListExecutionsResponse { - // The executions which match the request. - repeated Execution executions = 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 for the -// [CreateExecution][google.cloud.workflows.executions.v1.Executions.CreateExecution] -// method. -message CreateExecutionRequest { - // Required. Name of the workflow for which an execution should be created. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - // The latest revision of the workflow will be used. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; - - // Required. Execution to be created. - Execution execution = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the -// [GetExecution][google.cloud.workflows.executions.v1.Executions.GetExecution] -// method. -message GetExecutionRequest { - // Required. Name of the execution to be retrieved. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflowexecutions.googleapis.com/Execution" - } - ]; - - // Optional. A view defining which fields should be filled in the returned - // execution. The API will default to the FULL view. - ExecutionView view = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for the -// [CancelExecution][google.cloud.workflows.executions.v1.Executions.CancelExecution] -// method. -message CancelExecutionRequest { - // Required. Name of the execution to be cancelled. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflowexecutions.googleapis.com/Execution" - } - ]; -} - -// Defines possible views for execution resource. -enum ExecutionView { - // The default / unset value. - EXECUTION_VIEW_UNSPECIFIED = 0; - - // Includes only basic metadata about the execution. - // The following fields are returned: name, start_time, end_time, duration, - // state, and workflow_revision_id. - BASIC = 1; - - // Includes all data. - FULL = 2; -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.cancel_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.cancel_execution.js deleted file mode 100644 index b8a19229162..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.cancel_execution.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 workflowexecutions_v1_generated_Executions_CancelExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - */ - // const name = 'abc123' - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callCancelExecution() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await executionsClient.cancelExecution(request); - console.log(response); - } - - callCancelExecution(); - // [END workflowexecutions_v1_generated_Executions_CancelExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.create_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.create_execution.js deleted file mode 100644 index bf837b7d241..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.create_execution.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(parent, execution) { - // [START workflowexecutions_v1_generated_Executions_CreateExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - */ - // const parent = 'abc123' - /** - * Required. Execution to be created. - */ - // const execution = {} - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callCreateExecution() { - // Construct request - const request = { - parent, - execution, - }; - - // Run request - const response = await executionsClient.createExecution(request); - console.log(response); - } - - callCreateExecution(); - // [END workflowexecutions_v1_generated_Executions_CreateExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.get_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.get_execution.js deleted file mode 100644 index ffd888596ee..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.get_execution.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 workflowexecutions_v1_generated_Executions_GetExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - */ - // const name = 'abc123' - /** - * Optional. A view defining which fields should be filled in the returned - * execution. The API will default to the FULL view. - */ - // const view = {} - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callGetExecution() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await executionsClient.getExecution(request); - console.log(response); - } - - callGetExecution(); - // [END workflowexecutions_v1_generated_Executions_GetExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.list_executions.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.list_executions.js deleted file mode 100644 index ac929e06a2f..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/executions.list_executions.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(parent) { - // [START workflowexecutions_v1_generated_Executions_ListExecutions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - */ - // const parent = 'abc123' - /** - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - */ - // const pageToken = 'abc123' - /** - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - */ - // const view = {} - /** - * Optional. Filters applied to the Executions.ListExecutions results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - */ - // const filter = 'abc123' - /** - * Optional. The ordering applied to the Executions.ListExecutions results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - */ - // const orderBy = 'abc123' - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callListExecutions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await executionsClient.listExecutionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListExecutions(); - // [END workflowexecutions_v1_generated_Executions_ListExecutions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json deleted file mode 100644 index f17cc1ffd26..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json +++ /dev/null @@ -1,203 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-executions", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.workflows.executions.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "workflowexecutions_v1_generated_Executions_ListExecutions_async", - "title": "Executions listExecutions Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).", - "canonical": true, - "file": "executions.list_executions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 92, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListExecutions", - "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", - "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.workflows.executions.v1.ExecutionView" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.executions.v1.ListExecutionsResponse", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" - }, - "method": { - "shortName": "ListExecutions", - "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1_generated_Executions_CreateExecution_async", - "title": "Executions createExecution Sample", - "origin": "API_DEFINITION", - "description": " Creates a new execution using the latest revision of the given workflow.", - "canonical": true, - "file": "executions.create_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "execution", - "type": ".google.cloud.workflows.executions.v1.Execution" - } - ], - "resultType": ".google.cloud.workflows.executions.v1.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" - }, - "method": { - "shortName": "CreateExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1_generated_Executions_GetExecution_async", - "title": "Executions getExecution Sample", - "origin": "API_DEFINITION", - "description": " Returns an execution of the given name.", - "canonical": true, - "file": "executions.get_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.workflows.executions.v1.ExecutionView" - } - ], - "resultType": ".google.cloud.workflows.executions.v1.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" - }, - "method": { - "shortName": "GetExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1_generated_Executions_CancelExecution_async", - "title": "Executions cancelExecution Sample", - "origin": "API_DEFINITION", - "description": " Cancels an execution of the given name.", - "canonical": true, - "file": "executions.cancel_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.executions.v1.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" - }, - "method": { - "shortName": "CancelExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1.Executions" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/index.ts deleted file mode 100644 index ff3697c6287..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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 ExecutionsClient = v1.ExecutionsClient; -type ExecutionsClient = v1.ExecutionsClient; -export {v1, ExecutionsClient}; -export default {v1, ExecutionsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client.ts deleted file mode 100644 index 4ad0a31c467..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client.ts +++ /dev/null @@ -1,909 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/executions_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './executions_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Executions is used to start and manage running instances of - * {@link protos.google.cloud.workflows.v1.Workflow|Workflows} called executions. - * @class - * @memberof v1 - */ -export class ExecutionsClient { - 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}; - executionsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ExecutionsClient. - * - * @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 ExecutionsClient({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 ExecutionsClient; - 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 = { - executionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}' - ), - workflowPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}' - ), - }; - - // 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 = { - listExecutions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.executions.v1.Executions', 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.executionsStub) { - return this.executionsStub; - } - - // Put together the "service stub" for - // google.cloud.workflows.executions.v1.Executions. - this.executionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1.Executions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.workflows.executions.v1.Executions, - 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 executionsStubMethods = - ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; - for (const methodName of executionsStubMethods) { - const callPromise = this.executionsStub.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.executionsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'workflowexecutions.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 'workflowexecutions.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 -- - // ------------------- -/** - * Creates a new execution using the latest revision of the given workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @param {google.cloud.workflows.executions.v1.Execution} request.execution - * Required. Execution 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.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.create_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_CreateExecution_async - */ - createExecution( - request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined - ]>; - createExecution( - request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; - createExecution( - request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; - createExecution( - request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createExecution(request, options, callback); - } -/** - * Returns an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * execution. The API will default to the FULL 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.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.get_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_GetExecution_async - */ - getExecution( - request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined - ]>; - getExecution( - request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; - getExecution( - request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; - getExecution( - request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getExecution(request, options, callback); - } -/** - * Cancels an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.cancel_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_CancelExecution_async - */ - cancelExecution( - request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined - ]>; - cancelExecution( - request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; - cancelExecution( - request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; - cancelExecution( - request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.cancelExecution(request, options, callback); - } - - /** - * Returns a list of executions which belong to the workflow with - * the given name. The method returns executions of all workflow - * revisions. Returned executions are ordered by their start time (newest - * first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.workflows.executions.v1.Execution|Execution}. - * 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExecutions( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution[], - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - ]>; - listExecutions( - request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): void; - listExecutions( - request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): void; - listExecutions( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>, - callback?: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution[], - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @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.workflows.executions.v1.Execution|Execution} 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExecutionsStream( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - 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['listExecutions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExecutions.createStream( - this.innerApiCalls.listExecutions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @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.workflows.executions.v1.Execution|Execution}. 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/executions.list_executions.js - * region_tag:workflowexecutions_v1_generated_Executions_ListExecutions_async - */ - listExecutionsAsync( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - 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['listExecutions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExecutions.asyncIterate( - this.innerApiCalls['listExecutions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified execution resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow - * @param {string} execution - * @returns {string} Resource name string. - */ - executionPath(project:string,location:string,workflow:string,execution:string) { - return this.pathTemplates.executionPathTemplate.render({ - project: project, - location: location, - workflow: workflow, - execution: execution, - }); - } - - /** - * Parse the project from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the project. - */ - matchProjectFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).project; - } - - /** - * Parse the location from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the location. - */ - matchLocationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).location; - } - - /** - * Parse the workflow from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the workflow. - */ - matchWorkflowFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).workflow; - } - - /** - * Parse the execution from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the execution. - */ - matchExecutionFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).execution; - } - - /** - * Return a fully-qualified workflow resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow - * @returns {string} Resource name string. - */ - workflowPath(project:string,location:string,workflow:string) { - return this.pathTemplates.workflowPathTemplate.render({ - project: project, - location: location, - workflow: workflow, - }); - } - - /** - * Parse the project from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).project; - } - - /** - * Parse the location from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).location; - } - - /** - * Parse the workflow from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the workflow. - */ - matchWorkflowFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; - } - - /** - * 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.executionsStub && !this._terminated) { - return this.executionsStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client_config.json deleted file mode 100644 index ea2d78fc822..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_client_config.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "interfaces": { - "google.cloud.workflows.executions.v1.Executions": { - "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": { - "ListExecutions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CancelExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_proto_list.json deleted file mode 100644 index 3cffd5df199..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/executions_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/workflows/executions/v1/executions.proto" -] diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/gapic_metadata.json deleted file mode 100644 index aea61267fec..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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.workflows.executions.v1", - "libraryPackage": "@google-cloud/workflow-executions", - "services": { - "Executions": { - "clients": { - "grpc": { - "libraryClient": "ExecutionsClient", - "rpcs": { - "CreateExecution": { - "methods": [ - "createExecution" - ] - }, - "GetExecution": { - "methods": [ - "getExecution" - ] - }, - "CancelExecution": { - "methods": [ - "cancelExecution" - ] - }, - "ListExecutions": { - "methods": [ - "listExecutions", - "listExecutionsStream", - "listExecutionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ExecutionsClient", - "rpcs": { - "CreateExecution": { - "methods": [ - "createExecution" - ] - }, - "GetExecution": { - "methods": [ - "getExecution" - ] - }, - "CancelExecution": { - "methods": [ - "cancelExecution" - ] - }, - "ListExecutions": { - "methods": [ - "listExecutions", - "listExecutionsStream", - "listExecutionsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/src/v1/index.ts deleted file mode 100644 index a89e8389c4c..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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 {ExecutionsClient} from './executions_client'; diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index bc1d8c8fefe..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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 executions = require('@google-cloud/workflow-executions'); - -function main() { - const executionsClient = new executions.ExecutionsClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 74314a42866..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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 {ExecutionsClient} from '@google-cloud/workflow-executions'; - -// check that the client class type name can be used -function doStuffWithExecutionsClient(client: ExecutionsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const executionsClient = new ExecutionsClient(); - doStuffWithExecutionsClient(executionsClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/install.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1/test/gapic_executions_v1.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/test/gapic_executions_v1.ts deleted file mode 100644 index b971ac138bd..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/test/gapic_executions_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 executionsModule 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.ExecutionsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = executionsModule.v1.ExecutionsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = executionsModule.v1.ExecutionsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = executionsModule.v1.ExecutionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new executionsModule.v1.ExecutionsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new executionsModule.v1.ExecutionsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - await client.initialize(); - assert(client.executionsStub); - }); - - it('has close method for the initialized client', done => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.executionsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1.ExecutionsClient({ - 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 executionsModule.v1.ExecutionsClient({ - 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('createExecution', () => { - it('invokes createExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); - const [response] = await client.createExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createExecution(request), expectedError); - }); - }); - - describe('getExecution', () => { - it('invokes getExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); - const [response] = await client.getExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getExecution(request), expectedError); - }); - }); - - describe('cancelExecution', () => { - it('invokes cancelExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); - const [response] = await client.cancelExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelExecution(request), expectedError); - }); - }); - - describe('listExecutions', () => { - it('invokes listExecutions without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutions without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutions( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutions with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExecutions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutionsStream without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { - 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.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listExecutionsStream with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExecutions without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; - const iterable = client.listExecutionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExecutions with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('execution', () => { - const fakePath = "/rendered/path/execution"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - execution: "executionValue", - }; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.executionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.executionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('executionPath', () => { - const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.executionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExecutionName', () => { - const result = client.matchProjectFromExecutionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExecutionName', () => { - const result = client.matchLocationFromExecutionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromExecutionName', () => { - const result = client.matchWorkflowFromExecutionName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExecutionFromExecutionName', () => { - const result = client.matchExecutionFromExecutionName(fakePath); - assert.strictEqual(result, "executionValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workflow', () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1/tsconfig.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1/webpack.config.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1/webpack.config.js deleted file mode 100644 index 7de187a074a..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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: 'Executions', - filename: './executions.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-workflows-executions/executions/v1beta/.eslintignore b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.gitignore b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.jsdoc.js deleted file mode 100644 index beb79aa941b..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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/workflows-executions', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1beta/README.md b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/README.md deleted file mode 100644 index 79032bbed45..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Executions: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/package.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/package.json deleted file mode 100644 index 403d72cb7c3..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/workflows-executions", - "version": "0.1.0", - "description": "Executions client for Node.js", - "repository": "googleapis/nodejs-executions", - "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 executions", - "executions", - "executions" - ], - "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-workflows-executions/executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto deleted file mode 100644 index dd37f3b88b5..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto +++ /dev/null @@ -1,252 +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.workflows.executions.v1beta; - -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 go_package = "cloud.google.com/go/workflows/executions/apiv1beta/executionspb;executionspb"; -option java_multiple_files = true; -option java_outer_classname = "ExecutionsProto"; -option java_package = "com.google.cloud.workflows.executions.v1beta"; -option (google.api.resource_definition) = { - type: "workflows.googleapis.com/Workflow" - pattern: "projects/{project}/locations/{location}/workflows/{workflow}" -}; - -// Executions is used to start and manage running instances of -// [Workflows][google.cloud.workflows.v1beta.Workflow] called executions. -service Executions { - option (google.api.default_host) = "workflowexecutions.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Returns a list of executions which belong to the workflow with - // the given name. The method returns executions of all workflow - // revisions. Returned executions are ordered by their start time (newest - // first). - rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*/workflows/*}/executions" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new execution using the latest revision of the given workflow. - rpc CreateExecution(CreateExecutionRequest) returns (Execution) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*/workflows/*}/executions" - body: "execution" - }; - option (google.api.method_signature) = "parent,execution"; - } - - // Returns an execution of the given name. - rpc GetExecution(GetExecutionRequest) returns (Execution) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Cancels an execution of the given name. - rpc CancelExecution(CancelExecutionRequest) returns (Execution) { - option (google.api.http) = { - post: "/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}:cancel" - body: "*" - }; - option (google.api.method_signature) = "name"; - } -} - -// A running instance of a [Workflow][google.cloud.workflows.v1beta.Workflow]. -message Execution { - option (google.api.resource) = { - type: "workflowexecutions.googleapis.com/Execution" - pattern: "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}" - }; - - // Error describes why the execution was abnormally terminated. - message Error { - // Error payload returned by the execution, represented as a JSON string. - string payload = 1; - - // Human readable error context, helpful for debugging purposes. - string context = 2; - } - - // Describes the current state of the execution. More states may be added - // in the future. - enum State { - // Invalid state. - STATE_UNSPECIFIED = 0; - - // The execution is in progress. - ACTIVE = 1; - - // The execution finished successfully. - SUCCEEDED = 2; - - // The execution failed with an error. - FAILED = 3; - - // The execution was stopped intentionally. - CANCELLED = 4; - } - - // Output only. The resource name of the execution. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Marks the beginning of execution. - google.protobuf.Timestamp start_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Marks the end of execution, successful or not. - google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Current state of the execution. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input parameters of the execution represented as a JSON string. - // The size limit is 32KB. - string argument = 5; - - // Output only. Output of the execution represented as a JSON string. The - // value can only be present if the execution's state is `SUCCEEDED`. - string result = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The error which caused the execution to finish prematurely. - // The value is only present if the execution's state is `FAILED` - // or `CANCELLED`. - Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Revision of the workflow this execution is using. - string workflow_revision_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for the -// [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] -// method. -message ListExecutionsRequest { - // Required. Name of the workflow for which the executions should be listed. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; - - // Maximum number of executions to return per call. - // Max supported value depends on the selected Execution view: it's 10000 for - // BASIC and 100 for FULL. The default value used if the field is not - // specified is 100, regardless of the selected view. Values greater than - // the max value will be coerced down to it. - int32 page_size = 2; - - // A page token, received from a previous `ListExecutions` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListExecutions` must - // match the call that provided the page token. - string page_token = 3; - - // Optional. A view defining which fields should be filled in the returned executions. - // The API will default to the BASIC view. - ExecutionView view = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response for the -// [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] -// method. -message ListExecutionsResponse { - // The executions which match the request. - repeated Execution executions = 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 for the -// [CreateExecution][google.cloud.workflows.executions.v1beta.Executions.CreateExecution] -// method. -message CreateExecutionRequest { - // Required. Name of the workflow for which an execution should be created. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - // The latest revision of the workflow will be used. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; - - // Required. Execution to be created. - Execution execution = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the -// [GetExecution][google.cloud.workflows.executions.v1beta.Executions.GetExecution] -// method. -message GetExecutionRequest { - // Required. Name of the execution to be retrieved. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflowexecutions.googleapis.com/Execution" - } - ]; - - // Optional. A view defining which fields should be filled in the returned execution. - // The API will default to the FULL view. - ExecutionView view = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for the -// [CancelExecution][google.cloud.workflows.executions.v1beta.Executions.CancelExecution] -// method. -message CancelExecutionRequest { - // Required. Name of the execution to be cancelled. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflowexecutions.googleapis.com/Execution" - } - ]; -} - -// Defines possible views for execution resource. -enum ExecutionView { - // The default / unset value. - EXECUTION_VIEW_UNSPECIFIED = 0; - - // Includes only basic metadata about the execution. - // Following fields are returned: name, start_time, end_time, state - // and workflow_revision_id. - BASIC = 1; - - // Includes all data. - FULL = 2; -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js deleted file mode 100644 index 3767b5aabea..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.cancel_execution.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 workflowexecutions_v1beta_generated_Executions_CancelExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - */ - // const name = 'abc123' - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callCancelExecution() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await executionsClient.cancelExecution(request); - console.log(response); - } - - callCancelExecution(); - // [END workflowexecutions_v1beta_generated_Executions_CancelExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.create_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.create_execution.js deleted file mode 100644 index ff47d779839..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.create_execution.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(parent, execution) { - // [START workflowexecutions_v1beta_generated_Executions_CreateExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - */ - // const parent = 'abc123' - /** - * Required. Execution to be created. - */ - // const execution = {} - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callCreateExecution() { - // Construct request - const request = { - parent, - execution, - }; - - // Run request - const response = await executionsClient.createExecution(request); - console.log(response); - } - - callCreateExecution(); - // [END workflowexecutions_v1beta_generated_Executions_CreateExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.get_execution.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.get_execution.js deleted file mode 100644 index 1bcfe963326..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.get_execution.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 workflowexecutions_v1beta_generated_Executions_GetExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - */ - // const name = 'abc123' - /** - * Optional. A view defining which fields should be filled in the returned execution. - * The API will default to the FULL view. - */ - // const view = {} - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callGetExecution() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await executionsClient.getExecution(request); - console.log(response); - } - - callGetExecution(); - // [END workflowexecutions_v1beta_generated_Executions_GetExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.list_executions.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.list_executions.js deleted file mode 100644 index 8edec13e293..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/executions.list_executions.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 workflowexecutions_v1beta_generated_Executions_ListExecutions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - */ - // const parent = 'abc123' - /** - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC view. - */ - // const view = {} - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callListExecutions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await executionsClient.listExecutionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListExecutions(); - // [END workflowexecutions_v1beta_generated_Executions_ListExecutions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json deleted file mode 100644 index 388d6848833..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-executions", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.workflows.executions.v1beta", - "version": "v1beta" - } - ] - }, - "snippets": [ - { - "regionTag": "workflowexecutions_v1beta_generated_Executions_ListExecutions_async", - "title": "Executions listExecutions Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).", - "canonical": true, - "file": "executions.list_executions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListExecutions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", - "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.workflows.executions.v1beta.ExecutionView" - } - ], - "resultType": ".google.cloud.workflows.executions.v1beta.ListExecutionsResponse", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" - }, - "method": { - "shortName": "ListExecutions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1beta_generated_Executions_CreateExecution_async", - "title": "Executions createExecution Sample", - "origin": "API_DEFINITION", - "description": " Creates a new execution using the latest revision of the given workflow.", - "canonical": true, - "file": "executions.create_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "execution", - "type": ".google.cloud.workflows.executions.v1beta.Execution" - } - ], - "resultType": ".google.cloud.workflows.executions.v1beta.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" - }, - "method": { - "shortName": "CreateExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1beta_generated_Executions_GetExecution_async", - "title": "Executions getExecution Sample", - "origin": "API_DEFINITION", - "description": " Returns an execution of the given name.", - "canonical": true, - "file": "executions.get_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.workflows.executions.v1beta.ExecutionView" - } - ], - "resultType": ".google.cloud.workflows.executions.v1beta.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" - }, - "method": { - "shortName": "GetExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1beta_generated_Executions_CancelExecution_async", - "title": "Executions cancelExecution Sample", - "origin": "API_DEFINITION", - "description": " Cancels an execution of the given name.", - "canonical": true, - "file": "executions.cancel_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.executions.v1beta.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" - }, - "method": { - "shortName": "CancelExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/index.ts deleted file mode 100644 index bd02df6447c..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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 ExecutionsClient = v1beta.ExecutionsClient; -type ExecutionsClient = v1beta.ExecutionsClient; -export {v1beta, ExecutionsClient}; -export default {v1beta, ExecutionsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client.ts deleted file mode 100644 index d9acaa01415..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client.ts +++ /dev/null @@ -1,870 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1beta/executions_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './executions_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Executions is used to start and manage running instances of - * {@link protos.google.cloud.workflows.v1beta.Workflow|Workflows} called executions. - * @class - * @memberof v1beta - */ -export class ExecutionsClient { - 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}; - executionsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ExecutionsClient. - * - * @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 ExecutionsClient({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 ExecutionsClient; - 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 = { - executionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}' - ), - workflowPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}' - ), - }; - - // 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 = { - listExecutions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.executions.v1beta.Executions', 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.executionsStub) { - return this.executionsStub; - } - - // Put together the "service stub" for - // google.cloud.workflows.executions.v1beta.Executions. - this.executionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1beta.Executions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.workflows.executions.v1beta.Executions, - 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 executionsStubMethods = - ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; - for (const methodName of executionsStubMethods) { - const callPromise = this.executionsStub.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.executionsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'workflowexecutions.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 'workflowexecutions.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 -- - // ------------------- -/** - * Creates a new execution using the latest revision of the given workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @param {google.cloud.workflows.executions.v1beta.Execution} request.execution - * Required. Execution 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.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.create_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_CreateExecution_async - */ - createExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined - ]>; - createExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; - createExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; - createExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createExecution(request, options, callback); - } -/** - * Returns an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned execution. - * The API will default to the FULL 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.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.get_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_GetExecution_async - */ - getExecution( - request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined - ]>; - getExecution( - request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; - getExecution( - request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; - getExecution( - request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getExecution(request, options, callback); - } -/** - * Cancels an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.cancel_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_CancelExecution_async - */ - cancelExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined - ]>; - cancelExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; - cancelExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; - cancelExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.cancelExecution(request, options, callback); - } - - /** - * Returns a list of executions which belong to the workflow with - * the given name. The method returns executions of all workflow - * revisions. Returned executions are ordered by their start time (newest - * first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. - * 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExecutions( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution[], - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - ]>; - listExecutions( - request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): void; - listExecutions( - request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): void; - listExecutions( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>, - callback?: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution[], - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution} 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExecutionsStream( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - 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['listExecutions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExecutions.createStream( - this.innerApiCalls.listExecutions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. 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/executions.list_executions.js - * region_tag:workflowexecutions_v1beta_generated_Executions_ListExecutions_async - */ - listExecutionsAsync( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - 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['listExecutions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExecutions.asyncIterate( - this.innerApiCalls['listExecutions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified execution resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow - * @param {string} execution - * @returns {string} Resource name string. - */ - executionPath(project:string,location:string,workflow:string,execution:string) { - return this.pathTemplates.executionPathTemplate.render({ - project: project, - location: location, - workflow: workflow, - execution: execution, - }); - } - - /** - * Parse the project from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the project. - */ - matchProjectFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).project; - } - - /** - * Parse the location from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the location. - */ - matchLocationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).location; - } - - /** - * Parse the workflow from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the workflow. - */ - matchWorkflowFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).workflow; - } - - /** - * Parse the execution from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the execution. - */ - matchExecutionFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).execution; - } - - /** - * Return a fully-qualified workflow resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow - * @returns {string} Resource name string. - */ - workflowPath(project:string,location:string,workflow:string) { - return this.pathTemplates.workflowPathTemplate.render({ - project: project, - location: location, - workflow: workflow, - }); - } - - /** - * Parse the project from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).project; - } - - /** - * Parse the location from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).location; - } - - /** - * Parse the workflow from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the workflow. - */ - matchWorkflowFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; - } - - /** - * 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.executionsStub && !this._terminated) { - return this.executionsStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client_config.json deleted file mode 100644 index bf2692e9a8d..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_client_config.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "interfaces": { - "google.cloud.workflows.executions.v1beta.Executions": { - "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": { - "ListExecutions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CancelExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_proto_list.json deleted file mode 100644 index 245066757b4..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/executions_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/workflows/executions/v1beta/executions.proto" -] diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/gapic_metadata.json deleted file mode 100644 index 254e6e294a7..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/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.workflows.executions.v1beta", - "libraryPackage": "@google-cloud/workflows-executions", - "services": { - "Executions": { - "clients": { - "grpc": { - "libraryClient": "ExecutionsClient", - "rpcs": { - "CreateExecution": { - "methods": [ - "createExecution" - ] - }, - "GetExecution": { - "methods": [ - "getExecution" - ] - }, - "CancelExecution": { - "methods": [ - "cancelExecution" - ] - }, - "ListExecutions": { - "methods": [ - "listExecutions", - "listExecutionsStream", - "listExecutionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ExecutionsClient", - "rpcs": { - "CreateExecution": { - "methods": [ - "createExecution" - ] - }, - "GetExecution": { - "methods": [ - "getExecution" - ] - }, - "CancelExecution": { - "methods": [ - "cancelExecution" - ] - }, - "ListExecutions": { - "methods": [ - "listExecutions", - "listExecutionsStream", - "listExecutionsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/src/v1beta/index.ts deleted file mode 100644 index a89e8389c4c..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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 {ExecutionsClient} from './executions_client'; diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 1a0275d5916..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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 executions = require('@google-cloud/workflows-executions'); - -function main() { - const executionsClient = new executions.ExecutionsClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 04bf0d25710..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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 {ExecutionsClient} from '@google-cloud/workflows-executions'; - -// check that the client class type name can be used -function doStuffWithExecutionsClient(client: ExecutionsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const executionsClient = new ExecutionsClient(); - doStuffWithExecutionsClient(executionsClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1beta/test/gapic_executions_v1beta.ts b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/test/gapic_executions_v1beta.ts deleted file mode 100644 index aabf52f4cda..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/test/gapic_executions_v1beta.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 executionsModule 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('v1beta.ExecutionsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = executionsModule.v1beta.ExecutionsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = executionsModule.v1beta.ExecutionsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = executionsModule.v1beta.ExecutionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new executionsModule.v1beta.ExecutionsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - await client.initialize(); - assert(client.executionsStub); - }); - - it('has close method for the initialized client', done => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.executionsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1beta.ExecutionsClient({ - 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 executionsModule.v1beta.ExecutionsClient({ - 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('createExecution', () => { - it('invokes createExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); - const [response] = await client.createExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createExecution(request), expectedError); - }); - }); - - describe('getExecution', () => { - it('invokes getExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); - const [response] = await client.getExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getExecution(request), expectedError); - }); - }); - - describe('cancelExecution', () => { - it('invokes cancelExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); - const [response] = await client.cancelExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelExecution(request), expectedError); - }); - }); - - describe('listExecutions', () => { - it('invokes listExecutions without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutions without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutions( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutions with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExecutions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutionsStream without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { - 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.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listExecutionsStream with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExecutions without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; - const iterable = client.listExecutionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExecutions with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('execution', () => { - const fakePath = "/rendered/path/execution"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - execution: "executionValue", - }; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.executionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.executionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('executionPath', () => { - const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.executionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExecutionName', () => { - const result = client.matchProjectFromExecutionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExecutionName', () => { - const result = client.matchLocationFromExecutionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromExecutionName', () => { - const result = client.matchWorkflowFromExecutionName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExecutionFromExecutionName', () => { - const result = client.matchExecutionFromExecutionName(fakePath); - assert.strictEqual(result, "executionValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workflow', () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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-workflows-executions/executions/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-workflows-executions/executions/v1beta/webpack.config.js deleted file mode 100644 index 7de187a074a..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/executions/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: 'Executions', - filename: './executions.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-workflows-executions/v1/.eslintignore b/owl-bot-staging/google-cloud-workflows-executions/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1/.eslintrc.json b/owl-bot-staging/google-cloud-workflows-executions/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/.gitignore b/owl-bot-staging/google-cloud-workflows-executions/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1/.jsdoc.js b/owl-bot-staging/google-cloud-workflows-executions/v1/.jsdoc.js deleted file mode 100644 index e7b50866513..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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/workflows', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/.mocharc.js b/owl-bot-staging/google-cloud-workflows-executions/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1/.prettierrc.js b/owl-bot-staging/google-cloud-workflows-executions/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1/README.md b/owl-bot-staging/google-cloud-workflows-executions/v1/README.md deleted file mode 100644 index 50496d9d5fb..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Workflows: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/package.json b/owl-bot-staging/google-cloud-workflows-executions/v1/package.json deleted file mode 100644 index b0fb2328d81..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/workflows", - "version": "0.1.0", - "description": "Workflows client for Node.js", - "repository": "googleapis/nodejs-workflows", - "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 workflows", - "workflows", - "workflows" - ], - "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-workflows-executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto b/owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto deleted file mode 100644 index 0c6bc12cbed..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/executions/v1/executions.proto +++ /dev/null @@ -1,399 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.workflows.executions.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/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/workflows/executions/apiv1/executionspb;executionspb"; -option java_multiple_files = true; -option java_outer_classname = "ExecutionsProto"; -option java_package = "com.google.cloud.workflows.executions.v1"; -option (google.api.resource_definition) = { - type: "workflows.googleapis.com/Workflow" - pattern: "projects/{project}/locations/{location}/workflows/{workflow}" -}; - -// Executions is used to start and manage running instances of -// [Workflows][google.cloud.workflows.v1.Workflow] called executions. -service Executions { - option (google.api.default_host) = "workflowexecutions.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Returns a list of executions which belong to the workflow with - // the given name. The method returns executions of all workflow - // revisions. Returned executions are ordered by their start time (newest - // first). - rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/workflows/*}/executions" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new execution using the latest revision of the given workflow. - rpc CreateExecution(CreateExecutionRequest) returns (Execution) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/workflows/*}/executions" - body: "execution" - }; - option (google.api.method_signature) = "parent,execution"; - } - - // Returns an execution of the given name. - rpc GetExecution(GetExecutionRequest) returns (Execution) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Cancels an execution of the given name. - rpc CancelExecution(CancelExecutionRequest) returns (Execution) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}:cancel" - body: "*" - }; - option (google.api.method_signature) = "name"; - } -} - -// A running instance of a -// [Workflow](/workflows/docs/reference/rest/v1/projects.locations.workflows). -message Execution { - option (google.api.resource) = { - type: "workflowexecutions.googleapis.com/Execution" - pattern: "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}" - }; - - // Describes the current state of the execution. More states might be added - // in the future. - enum State { - // Invalid state. - STATE_UNSPECIFIED = 0; - - // The execution is in progress. - ACTIVE = 1; - - // The execution finished successfully. - SUCCEEDED = 2; - - // The execution failed with an error. - FAILED = 3; - - // The execution was stopped intentionally. - CANCELLED = 4; - - // Execution data is unavailable. See the `state_error` field. - UNAVAILABLE = 5; - - // Request has been placed in the backlog for processing at a later time. - QUEUED = 6; - } - - // A single stack element (frame) where an error occurred. - message StackTraceElement { - // Position contains source position information about the stack trace - // element such as line number, column number and length of the code block - // in bytes. - message Position { - // The source code line number the current instruction was generated from. - int64 line = 1; - - // The source code column position (of the line) the current instruction - // was generated from. - int64 column = 2; - - // The number of bytes of source code making up this stack trace element. - int64 length = 3; - } - - // The step the error occurred at. - string step = 1; - - // The routine where the error occurred. - string routine = 2; - - // The source position information of the stack trace element. - Position position = 3; - } - - // A collection of stack elements (frames) where an error occurred. - message StackTrace { - // An array of stack elements. - repeated StackTraceElement elements = 1; - } - - // Error describes why the execution was abnormally terminated. - message Error { - // Error message and data returned represented as a JSON string. - string payload = 1; - - // Human-readable stack trace string. - string context = 2; - - // Stack trace with detailed information of where error was generated. - StackTrace stack_trace = 3; - } - - // Describes the level of platform logging to apply to calls and call - // responses during workflow executions. - enum CallLogLevel { - // No call logging level specified. - CALL_LOG_LEVEL_UNSPECIFIED = 0; - - // Log all call steps within workflows, all call returns, and all exceptions - // raised. - LOG_ALL_CALLS = 1; - - // Log only exceptions that are raised from call steps within workflows. - LOG_ERRORS_ONLY = 2; - - // Explicitly log nothing. - LOG_NONE = 3; - } - - // Represents the current status of this execution. - message Status { - // Represents a step of the workflow this execution is running. - message Step { - // Name of a routine within the workflow. - string routine = 1; - - // Name of a step within the routine. - string step = 2; - } - - // A list of currently executing or last executed step names for the - // workflow execution currently running. If the workflow has succeeded or - // failed, this is the last attempted or executed step. Presently, if the - // current step is inside a subworkflow, the list only includes that step. - // In the future, the list will contain items for each step in the call - // stack, starting with the outermost step in the `main` subworkflow, and - // ending with the most deeply nested step. - repeated Step current_steps = 1; - } - - // Describes an error related to the current state of the Execution resource. - message StateError { - // Describes the possible types of a state error. - enum Type { - // No type specified. - TYPE_UNSPECIFIED = 0; - - // Caused by an issue with KMS. - KMS_ERROR = 1; - } - - // Provides specifics about the error. - string details = 1; - - // The type of this state error. - Type type = 2; - } - - // Output only. The resource name of the execution. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Marks the beginning of execution. - google.protobuf.Timestamp start_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Marks the end of execution, successful or not. - google.protobuf.Timestamp end_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Measures the duration of the execution. - google.protobuf.Duration duration = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Current state of the execution. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input parameters of the execution represented as a JSON string. - // The size limit is 32KB. - // - // *Note*: If you are using the REST API directly to run your workflow, you - // must escape any JSON string value of `argument`. Example: - // `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'` - string argument = 5; - - // Output only. Output of the execution represented as a JSON string. The - // value can only be present if the execution's state is `SUCCEEDED`. - string result = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The error which caused the execution to finish prematurely. - // The value is only present if the execution's state is `FAILED` - // or `CANCELLED`. - Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Revision of the workflow this execution is using. - string workflow_revision_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The call logging level associated to this execution. - CallLogLevel call_log_level = 9; - - // Output only. Status tracks the current steps and progress data of this - // execution. - Status status = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels associated with this execution. - // Labels can contain at most 64 entries. Keys and values can be no longer - // than 63 characters and can only contain lowercase letters, numeric - // characters, underscores, and dashes. Label keys must start with a letter. - // International characters are allowed. - // By default, labels are inherited from the workflow but are overridden by - // any labels associated with the execution. - map labels = 11; - - // Output only. Error regarding the state of the Execution resource. For - // example, this field will have error details if the execution data is - // unavailable due to revoked KMS key permissions. - StateError state_error = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for the -// [ListExecutions][] -// method. -message ListExecutionsRequest { - // Required. Name of the workflow for which the executions should be listed. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; - - // Maximum number of executions to return per call. - // Max supported value depends on the selected Execution view: it's 1000 for - // BASIC and 100 for FULL. The default value used if the field is not - // specified is 100, regardless of the selected view. Values greater than - // the max value will be coerced down to it. - int32 page_size = 2; - - // A page token, received from a previous `ListExecutions` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListExecutions` must - // match the call that provided the page token. - // - // Note that pagination is applied to dynamic data. The list of executions - // returned can change between page requests. - string page_token = 3; - - // Optional. A view defining which fields should be filled in the returned - // executions. The API will default to the BASIC view. - ExecutionView view = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Filters applied to the [Executions.ListExecutions] results. - // The following fields are supported for filtering: - // executionID, state, startTime, endTime, duration, workflowRevisionID, - // stepName, and label. - string filter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The ordering applied to the [Executions.ListExecutions] results. - // By default the ordering is based on descending start time. - // The following fields are supported for order by: - // executionID, startTime, endTime, duration, state, and workflowRevisionID. - string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response for the -// [ListExecutions][google.cloud.workflows.executions.v1.Executions.ListExecutions] -// method. -message ListExecutionsResponse { - // The executions which match the request. - repeated Execution executions = 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 for the -// [CreateExecution][google.cloud.workflows.executions.v1.Executions.CreateExecution] -// method. -message CreateExecutionRequest { - // Required. Name of the workflow for which an execution should be created. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - // The latest revision of the workflow will be used. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; - - // Required. Execution to be created. - Execution execution = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the -// [GetExecution][google.cloud.workflows.executions.v1.Executions.GetExecution] -// method. -message GetExecutionRequest { - // Required. Name of the execution to be retrieved. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflowexecutions.googleapis.com/Execution" - } - ]; - - // Optional. A view defining which fields should be filled in the returned - // execution. The API will default to the FULL view. - ExecutionView view = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for the -// [CancelExecution][google.cloud.workflows.executions.v1.Executions.CancelExecution] -// method. -message CancelExecutionRequest { - // Required. Name of the execution to be cancelled. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflowexecutions.googleapis.com/Execution" - } - ]; -} - -// Defines possible views for execution resource. -enum ExecutionView { - // The default / unset value. - EXECUTION_VIEW_UNSPECIFIED = 0; - - // Includes only basic metadata about the execution. - // The following fields are returned: name, start_time, end_time, duration, - // state, and workflow_revision_id. - BASIC = 1; - - // Includes all data. - FULL = 2; -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/v1/workflows.proto b/owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/v1/workflows.proto deleted file mode 100644 index 772ca653789..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/protos/google/cloud/workflows/v1/workflows.proto +++ /dev/null @@ -1,409 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.workflows.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"; - -option go_package = "cloud.google.com/go/workflows/apiv1/workflowspb;workflowspb"; -option java_multiple_files = true; -option java_outer_classname = "WorkflowsProto"; -option java_package = "com.google.cloud.workflows.v1"; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}" -}; - -// Workflows is used to deploy and execute workflow programs. -// Workflows makes sure the program executes reliably, despite hardware and -// networking interruptions. -service Workflows { - option (google.api.default_host) = "workflows.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists workflows in a given project and location. - // The default order is not specified. - rpc ListWorkflows(ListWorkflowsRequest) returns (ListWorkflowsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/workflows" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single workflow. - rpc GetWorkflow(GetWorkflowRequest) returns (Workflow) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/workflows/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new workflow. If a workflow with the specified name already - // exists in the specified project and location, the long running operation - // returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. - rpc CreateWorkflow(CreateWorkflowRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/workflows" - body: "workflow" - }; - option (google.api.method_signature) = "parent,workflow,workflow_id"; - option (google.longrunning.operation_info) = { - response_type: "Workflow" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a workflow with the specified name. - // This method also cancels and deletes all running executions of the - // workflow. - rpc DeleteWorkflow(DeleteWorkflowRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/workflows/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing workflow. - // Running this method has no impact on already running executions of the - // workflow. A new revision of the workflow might be created as a result of a - // successful update operation. In that case, the new revision is used - // in new workflow executions. - rpc UpdateWorkflow(UpdateWorkflowRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{workflow.name=projects/*/locations/*/workflows/*}" - body: "workflow" - }; - option (google.api.method_signature) = "workflow,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Workflow" - metadata_type: "OperationMetadata" - }; - } -} - -// Workflow program to be executed by Workflows. -message Workflow { - option (google.api.resource) = { - type: "workflows.googleapis.com/Workflow" - pattern: "projects/{project}/locations/{location}/workflows/{workflow}" - }; - - // Describes the current state of workflow deployment. - enum State { - // Invalid state. - STATE_UNSPECIFIED = 0; - - // The workflow has been deployed successfully and is serving. - ACTIVE = 1; - - // Workflow data is unavailable. See the `state_error` field. - UNAVAILABLE = 2; - } - - // Describes an error related to the current state of the workflow. - message StateError { - // Describes the possibled types of a state error. - enum Type { - // No type specified. - TYPE_UNSPECIFIED = 0; - - // Caused by an issue with KMS. - KMS_ERROR = 1; - } - - // Provides specifics about the error. - string details = 1; - - // The type of this state error. - Type type = 2; - } - - // Describes the level of platform logging to apply to calls and call - // responses during workflow executions. - enum CallLogLevel { - // No call logging level specified. - CALL_LOG_LEVEL_UNSPECIFIED = 0; - - // Log all call steps within workflows, all call returns, and all exceptions - // raised. - LOG_ALL_CALLS = 1; - - // Log only exceptions that are raised from call steps within workflows. - LOG_ERRORS_ONLY = 2; - - // Explicitly log nothing. - LOG_NONE = 3; - } - - // The resource name of the workflow. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - string name = 1; - - // Description of the workflow provided by the user. - // Must be at most 1000 unicode characters long. - string description = 2; - - // Output only. State of the workflow deployment. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The revision of the workflow. - // A new revision of a workflow is created as a result of updating the - // following properties of a workflow: - // - // - [Service account][google.cloud.workflows.v1.Workflow.service_account] - // - [Workflow code to be - // executed][google.cloud.workflows.v1.Workflow.source_contents] - // - // The format is "000001-a4d", where the first six characters define - // the zero-padded revision ordinal number. They are followed by a hyphen and - // three hexadecimal random characters. - string revision_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp for when the workflow was created. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp for when the workflow was last updated. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp for the latest revision of the workflow's - // creation. - google.protobuf.Timestamp revision_create_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels associated with this workflow. - // Labels can contain at most 64 entries. Keys and values can be no longer - // than 63 characters and can only contain lowercase letters, numeric - // characters, underscores, and dashes. Label keys must start with a letter. - // International characters are allowed. - map labels = 8; - - // The service account associated with the latest workflow version. - // This service account represents the identity of the workflow and determines - // what permissions the workflow has. - // Format: projects/{project}/serviceAccounts/{account} or {account} - // - // Using `-` as a wildcard for the `{project}` or not providing one at all - // will infer the project from the account. The `{account}` value can be the - // `email` address or the `unique_id` of the service account. - // - // If not provided, workflow will use the project's default service account. - // Modifying this field for an existing workflow results in a new workflow - // revision. - string service_account = 9; - - // Required. Location of the workflow source code. - // Modifying this field for an existing workflow results in a new workflow - // revision. - oneof source_code { - // Workflow code to be executed. The size limit is 128KB. - string source_contents = 10; - } - - // Optional. The resource name of a KMS crypto key used to encrypt or decrypt - // the data associated with the workflow. - // - // Format: - // projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey} - // - // Using `-` as a wildcard for the `{project}` or not providing one at all - // will infer the project from the account. - // - // If not provided, data associated with the workflow will not be - // CMEK-encrypted. - string crypto_key_name = 11 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - } - ]; - - // Output only. Error regarding the state of the workflow. For example, this - // field will have error details if the execution data is unavailable due to - // revoked KMS key permissions. - StateError state_error = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Describes the level of platform logging to apply to calls and - // call responses during executions of this workflow. If both the workflow and - // the execution specify a logging level, the execution level takes - // precedence. - CallLogLevel call_log_level = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. User-defined environment variables associated with this workflow - // revision. This map has a maximum length of 20. Each string can take up to - // 40KiB. Keys cannot be empty strings and cannot start with “GOOGLE” or - // “WORKFLOWS". - map user_env_vars = 14 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for the -// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows] -// method. -message ListWorkflowsRequest { - // Required. Project and location from which the workflows should be listed. - // Format: projects/{project}/locations/{location} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Maximum number of workflows to return per call. The service might return - // fewer than this value even if not at the end of the collection. If a value - // is not specified, a default value of 500 is used. The maximum permitted - // value is 1000 and values greater than 1000 are coerced down to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListWorkflows` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListWorkflows` must - // match the call that provided the page token. - string page_token = 3; - - // Filter to restrict results to specific workflows. - string filter = 4; - - // Comma-separated list of fields that specify the order of the results. - // Default sorting order for a field is ascending. To specify descending order - // for a field, append a "desc" suffix. - // If not specified, the results are returned in an unspecified order. - string order_by = 5; -} - -// Response for the -// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows] -// method. -message ListWorkflowsResponse { - // The workflows that match the request. - repeated Workflow workflows = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Request for the -// [GetWorkflow][google.cloud.workflows.v1.Workflows.GetWorkflow] method. -message GetWorkflowRequest { - // Required. Name of the workflow for which information should be retrieved. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; - - // Optional. The revision of the workflow to retrieve. If the revision_id is - // empty, the latest revision is retrieved. - // The format is "000001-a4d", where the first six characters define - // the zero-padded decimal revision number. They are followed by a hyphen and - // three hexadecimal characters. - string revision_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for the -// [CreateWorkflow][google.cloud.workflows.v1.Workflows.CreateWorkflow] -// method. -message CreateWorkflowRequest { - // Required. Project and location in which the workflow should be created. - // Format: projects/{project}/locations/{location} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Workflow to be created. - Workflow workflow = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the workflow to be created. It has to fulfill the - // following requirements: - // - // * Must contain only letters, numbers, underscores and hyphens. - // * Must start with a letter. - // * Must be between 1-64 characters. - // * Must end with a number or a letter. - // * Must be unique within the customer project and location. - string workflow_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the -// [DeleteWorkflow][google.cloud.workflows.v1.Workflows.DeleteWorkflow] -// method. -message DeleteWorkflowRequest { - // Required. Name of the workflow to be deleted. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; -} - -// Request for the -// [UpdateWorkflow][google.cloud.workflows.v1.Workflows.UpdateWorkflow] -// method. -message UpdateWorkflowRequest { - // Required. Workflow to be updated. - Workflow workflow = 1 [(google.api.field_behavior) = REQUIRED]; - - // List of fields to be updated. If not present, the entire workflow - // will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// 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; - - // API version used to start the operation. - string api_version = 5; -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.cancel_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.cancel_execution.js deleted file mode 100644 index b8a19229162..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.cancel_execution.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 workflowexecutions_v1_generated_Executions_CancelExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - */ - // const name = 'abc123' - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callCancelExecution() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await executionsClient.cancelExecution(request); - console.log(response); - } - - callCancelExecution(); - // [END workflowexecutions_v1_generated_Executions_CancelExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.create_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.create_execution.js deleted file mode 100644 index bf837b7d241..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.create_execution.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(parent, execution) { - // [START workflowexecutions_v1_generated_Executions_CreateExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - */ - // const parent = 'abc123' - /** - * Required. Execution to be created. - */ - // const execution = {} - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callCreateExecution() { - // Construct request - const request = { - parent, - execution, - }; - - // Run request - const response = await executionsClient.createExecution(request); - console.log(response); - } - - callCreateExecution(); - // [END workflowexecutions_v1_generated_Executions_CreateExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.get_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.get_execution.js deleted file mode 100644 index ffd888596ee..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.get_execution.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 workflowexecutions_v1_generated_Executions_GetExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - */ - // const name = 'abc123' - /** - * Optional. A view defining which fields should be filled in the returned - * execution. The API will default to the FULL view. - */ - // const view = {} - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callGetExecution() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await executionsClient.getExecution(request); - console.log(response); - } - - callGetExecution(); - // [END workflowexecutions_v1_generated_Executions_GetExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.list_executions.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.list_executions.js deleted file mode 100644 index ac929e06a2f..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/executions.list_executions.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(parent) { - // [START workflowexecutions_v1_generated_Executions_ListExecutions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - */ - // const parent = 'abc123' - /** - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - */ - // const pageToken = 'abc123' - /** - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - */ - // const view = {} - /** - * Optional. Filters applied to the Executions.ListExecutions results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - */ - // const filter = 'abc123' - /** - * Optional. The ordering applied to the Executions.ListExecutions results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - */ - // const orderBy = 'abc123' - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflow-executions').v1; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callListExecutions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await executionsClient.listExecutionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListExecutions(); - // [END workflowexecutions_v1_generated_Executions_ListExecutions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json deleted file mode 100644 index f17cc1ffd26..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json +++ /dev/null @@ -1,203 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-executions", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.workflows.executions.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "workflowexecutions_v1_generated_Executions_ListExecutions_async", - "title": "Executions listExecutions Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).", - "canonical": true, - "file": "executions.list_executions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 92, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListExecutions", - "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", - "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.workflows.executions.v1.ExecutionView" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.executions.v1.ListExecutionsResponse", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" - }, - "method": { - "shortName": "ListExecutions", - "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1_generated_Executions_CreateExecution_async", - "title": "Executions createExecution Sample", - "origin": "API_DEFINITION", - "description": " Creates a new execution using the latest revision of the given workflow.", - "canonical": true, - "file": "executions.create_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "execution", - "type": ".google.cloud.workflows.executions.v1.Execution" - } - ], - "resultType": ".google.cloud.workflows.executions.v1.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" - }, - "method": { - "shortName": "CreateExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1_generated_Executions_GetExecution_async", - "title": "Executions getExecution Sample", - "origin": "API_DEFINITION", - "description": " Returns an execution of the given name.", - "canonical": true, - "file": "executions.get_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.workflows.executions.v1.ExecutionView" - } - ], - "resultType": ".google.cloud.workflows.executions.v1.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" - }, - "method": { - "shortName": "GetExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1_generated_Executions_CancelExecution_async", - "title": "Executions cancelExecution Sample", - "origin": "API_DEFINITION", - "description": " Cancels an execution of the given name.", - "canonical": true, - "file": "executions.cancel_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.executions.v1.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1.ExecutionsClient" - }, - "method": { - "shortName": "CancelExecution", - "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1.Executions" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json deleted file mode 100644 index 085a08022e8..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json +++ /dev/null @@ -1,247 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-workflows", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.workflows.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "workflows_v1_generated_Workflows_ListWorkflows_async", - "title": "Workflows listWorkflows Sample", - "origin": "API_DEFINITION", - "description": " Lists workflows in a given project and location. The default order is not specified.", - "canonical": true, - "file": "workflows.list_workflows.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkflows", - "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflows", - "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.workflows.v1.ListWorkflowsResponse", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1.WorkflowsClient" - }, - "method": { - "shortName": "ListWorkflows", - "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflows", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1.Workflows" - } - } - } - }, - { - "regionTag": "workflows_v1_generated_Workflows_GetWorkflow_async", - "title": "Workflows getWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single workflow.", - "canonical": true, - "file": "workflows.get_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.GetWorkflow", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "revision_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.v1.Workflow", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1.WorkflowsClient" - }, - "method": { - "shortName": "GetWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.GetWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1.Workflows" - } - } - } - }, - { - "regionTag": "workflows_v1_generated_Workflows_CreateWorkflow_async", - "title": "Workflows createWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.", - "canonical": true, - "file": "workflows.create_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.CreateWorkflow", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "workflow", - "type": ".google.cloud.workflows.v1.Workflow" - }, - { - "name": "workflow_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1.WorkflowsClient" - }, - "method": { - "shortName": "CreateWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.CreateWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1.Workflows" - } - } - } - }, - { - "regionTag": "workflows_v1_generated_Workflows_DeleteWorkflow_async", - "title": "Workflows deleteWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.", - "canonical": true, - "file": "workflows.delete_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.DeleteWorkflow", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1.WorkflowsClient" - }, - "method": { - "shortName": "DeleteWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.DeleteWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1.Workflows" - } - } - } - }, - { - "regionTag": "workflows_v1_generated_Workflows_UpdateWorkflow_async", - "title": "Workflows updateWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.", - "canonical": true, - "file": "workflows.update_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.UpdateWorkflow", - "async": true, - "parameters": [ - { - "name": "workflow", - "type": ".google.cloud.workflows.v1.Workflow" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1.WorkflowsClient" - }, - "method": { - "shortName": "UpdateWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.UpdateWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1.Workflows" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.create_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.create_workflow.js deleted file mode 100644 index 47480e9abd0..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.create_workflow.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, workflow, workflowId) { - // [START workflows_v1_generated_Workflows_CreateWorkflow_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - */ - // const parent = 'abc123' - /** - * Required. Workflow to be created. - */ - // const workflow = {} - /** - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and location. - */ - // const workflowId = 'abc123' - - // Imports the Workflows library - const {WorkflowsClient} = require('@google-cloud/workflows').v1; - - // Instantiates a client - const workflowsClient = new WorkflowsClient(); - - async function callCreateWorkflow() { - // Construct request - const request = { - parent, - workflow, - workflowId, - }; - - // Run request - const [operation] = await workflowsClient.createWorkflow(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateWorkflow(); - // [END workflows_v1_generated_Workflows_CreateWorkflow_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.delete_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.delete_workflow.js deleted file mode 100644 index a0ea6310c25..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.delete_workflow.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 workflows_v1_generated_Workflows_DeleteWorkflow_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - */ - // const name = 'abc123' - - // Imports the Workflows library - const {WorkflowsClient} = require('@google-cloud/workflows').v1; - - // Instantiates a client - const workflowsClient = new WorkflowsClient(); - - async function callDeleteWorkflow() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workflowsClient.deleteWorkflow(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteWorkflow(); - // [END workflows_v1_generated_Workflows_DeleteWorkflow_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.get_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.get_workflow.js deleted file mode 100644 index 517ec375d36..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.get_workflow.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(name) { - // [START workflows_v1_generated_Workflows_GetWorkflow_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow for which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - */ - // const name = 'abc123' - /** - * Optional. The revision of the workflow to retrieve. If the revision_id is - * empty, the latest revision is retrieved. - * The format is "000001-a4d", where the first six characters define - * the zero-padded decimal revision number. They are followed by a hyphen and - * three hexadecimal characters. - */ - // const revisionId = 'abc123' - - // Imports the Workflows library - const {WorkflowsClient} = require('@google-cloud/workflows').v1; - - // Instantiates a client - const workflowsClient = new WorkflowsClient(); - - async function callGetWorkflow() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await workflowsClient.getWorkflow(request); - console.log(response); - } - - callGetWorkflow(); - // [END workflows_v1_generated_Workflows_GetWorkflow_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.list_workflows.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.list_workflows.js deleted file mode 100644 index be6dfd9fbdb..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.list_workflows.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) { - // [START workflows_v1_generated_Workflows_ListWorkflows_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - */ - // const parent = 'abc123' - /** - * Maximum number of workflows to return per call. The service might return - * fewer than this value even if not at the end of the collection. If a value - * is not specified, a default value of 500 is used. The maximum permitted - * value is 1000 and values greater than 1000 are coerced down to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Filter to restrict results to specific workflows. - */ - // const filter = 'abc123' - /** - * Comma-separated list of fields that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a "desc" suffix. - * If not specified, the results are returned in an unspecified order. - */ - // const orderBy = 'abc123' - - // Imports the Workflows library - const {WorkflowsClient} = require('@google-cloud/workflows').v1; - - // Instantiates a client - const workflowsClient = new WorkflowsClient(); - - async function callListWorkflows() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workflowsClient.listWorkflowsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListWorkflows(); - // [END workflows_v1_generated_Workflows_ListWorkflows_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.update_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.update_workflow.js deleted file mode 100644 index 09b8e0198ea..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/samples/generated/v1/workflows.update_workflow.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(workflow) { - // [START workflows_v1_generated_Workflows_UpdateWorkflow_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Workflow to be updated. - */ - // const workflow = {} - /** - * List of fields to be updated. If not present, the entire workflow - * will be updated. - */ - // const updateMask = {} - - // Imports the Workflows library - const {WorkflowsClient} = require('@google-cloud/workflows').v1; - - // Instantiates a client - const workflowsClient = new WorkflowsClient(); - - async function callUpdateWorkflow() { - // Construct request - const request = { - workflow, - }; - - // Run request - const [operation] = await workflowsClient.updateWorkflow(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateWorkflow(); - // [END workflows_v1_generated_Workflows_UpdateWorkflow_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/src/index.ts deleted file mode 100644 index b4c9dd81035..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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 WorkflowsClient = v1.WorkflowsClient; -type WorkflowsClient = v1.WorkflowsClient; -export {v1, WorkflowsClient}; -export default {v1, WorkflowsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client.ts deleted file mode 100644 index 4ad0a31c467..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client.ts +++ /dev/null @@ -1,909 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/executions_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './executions_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Executions is used to start and manage running instances of - * {@link protos.google.cloud.workflows.v1.Workflow|Workflows} called executions. - * @class - * @memberof v1 - */ -export class ExecutionsClient { - 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}; - executionsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ExecutionsClient. - * - * @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 ExecutionsClient({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 ExecutionsClient; - 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 = { - executionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}' - ), - workflowPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}' - ), - }; - - // 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 = { - listExecutions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.executions.v1.Executions', 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.executionsStub) { - return this.executionsStub; - } - - // Put together the "service stub" for - // google.cloud.workflows.executions.v1.Executions. - this.executionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1.Executions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.workflows.executions.v1.Executions, - 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 executionsStubMethods = - ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; - for (const methodName of executionsStubMethods) { - const callPromise = this.executionsStub.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.executionsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'workflowexecutions.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 'workflowexecutions.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 -- - // ------------------- -/** - * Creates a new execution using the latest revision of the given workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @param {google.cloud.workflows.executions.v1.Execution} request.execution - * Required. Execution 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.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.create_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_CreateExecution_async - */ - createExecution( - request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined - ]>; - createExecution( - request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; - createExecution( - request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; - createExecution( - request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createExecution(request, options, callback); - } -/** - * Returns an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * execution. The API will default to the FULL 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.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.get_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_GetExecution_async - */ - getExecution( - request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined - ]>; - getExecution( - request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; - getExecution( - request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; - getExecution( - request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getExecution(request, options, callback); - } -/** - * Cancels an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.cancel_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_CancelExecution_async - */ - cancelExecution( - request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined - ]>; - cancelExecution( - request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; - cancelExecution( - request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; - cancelExecution( - request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.cancelExecution(request, options, callback); - } - - /** - * Returns a list of executions which belong to the workflow with - * the given name. The method returns executions of all workflow - * revisions. Returned executions are ordered by their start time (newest - * first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.workflows.executions.v1.Execution|Execution}. - * 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExecutions( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution[], - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - ]>; - listExecutions( - request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): void; - listExecutions( - request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): void; - listExecutions( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>, - callback?: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution[], - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @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.workflows.executions.v1.Execution|Execution} 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExecutionsStream( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - 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['listExecutions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExecutions.createStream( - this.innerApiCalls.listExecutions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @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.workflows.executions.v1.Execution|Execution}. 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/executions.list_executions.js - * region_tag:workflowexecutions_v1_generated_Executions_ListExecutions_async - */ - listExecutionsAsync( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - 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['listExecutions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExecutions.asyncIterate( - this.innerApiCalls['listExecutions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified execution resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow - * @param {string} execution - * @returns {string} Resource name string. - */ - executionPath(project:string,location:string,workflow:string,execution:string) { - return this.pathTemplates.executionPathTemplate.render({ - project: project, - location: location, - workflow: workflow, - execution: execution, - }); - } - - /** - * Parse the project from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the project. - */ - matchProjectFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).project; - } - - /** - * Parse the location from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the location. - */ - matchLocationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).location; - } - - /** - * Parse the workflow from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the workflow. - */ - matchWorkflowFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).workflow; - } - - /** - * Parse the execution from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the execution. - */ - matchExecutionFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).execution; - } - - /** - * Return a fully-qualified workflow resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow - * @returns {string} Resource name string. - */ - workflowPath(project:string,location:string,workflow:string) { - return this.pathTemplates.workflowPathTemplate.render({ - project: project, - location: location, - workflow: workflow, - }); - } - - /** - * Parse the project from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).project; - } - - /** - * Parse the location from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).location; - } - - /** - * Parse the workflow from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the workflow. - */ - matchWorkflowFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; - } - - /** - * 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.executionsStub && !this._terminated) { - return this.executionsStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client_config.json deleted file mode 100644 index ea2d78fc822..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_client_config.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "interfaces": { - "google.cloud.workflows.executions.v1.Executions": { - "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": { - "ListExecutions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CancelExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_proto_list.json deleted file mode 100644 index 3cffd5df199..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/executions_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/workflows/executions/v1/executions.proto" -] diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 4beac113fbb..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/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.workflows.v1", - "libraryPackage": "@google-cloud/workflows", - "services": { - "Workflows": { - "clients": { - "grpc": { - "libraryClient": "WorkflowsClient", - "rpcs": { - "GetWorkflow": { - "methods": [ - "getWorkflow" - ] - }, - "CreateWorkflow": { - "methods": [ - "createWorkflow" - ] - }, - "DeleteWorkflow": { - "methods": [ - "deleteWorkflow" - ] - }, - "UpdateWorkflow": { - "methods": [ - "updateWorkflow" - ] - }, - "ListWorkflows": { - "methods": [ - "listWorkflows", - "listWorkflowsStream", - "listWorkflowsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WorkflowsClient", - "rpcs": { - "GetWorkflow": { - "methods": [ - "getWorkflow" - ] - }, - "CreateWorkflow": { - "methods": [ - "createWorkflow" - ] - }, - "DeleteWorkflow": { - "methods": [ - "deleteWorkflow" - ] - }, - "UpdateWorkflow": { - "methods": [ - "updateWorkflow" - ] - }, - "ListWorkflows": { - "methods": [ - "listWorkflows", - "listWorkflowsStream", - "listWorkflowsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/index.ts deleted file mode 100644 index 4efcde817e9..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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 {WorkflowsClient} from './workflows_client'; diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client.ts deleted file mode 100644 index 18d1152ede6..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client.ts +++ /dev/null @@ -1,1371 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/workflows_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './workflows_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Workflows is used to deploy and execute workflow programs. - * Workflows makes sure the program executes reliably, despite hardware and - * networking interruptions. - * @class - * @memberof v1 - */ -export class WorkflowsClient { - 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; - workflowsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WorkflowsClient. - * - * @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 WorkflowsClient({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 WorkflowsClient; - 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 = { - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - workflowPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}' - ), - }; - - // 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 = { - listWorkflows: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workflows') - }; - - 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.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 createWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.Workflow') as gax.protobuf.Type; - const createWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; - const deleteWorkflowResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; - const updateWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.Workflow') as gax.protobuf.Type; - const updateWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createWorkflow: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createWorkflowResponse.decode.bind(createWorkflowResponse), - createWorkflowMetadata.decode.bind(createWorkflowMetadata)), - deleteWorkflow: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteWorkflowResponse.decode.bind(deleteWorkflowResponse), - deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata)), - updateWorkflow: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateWorkflowResponse.decode.bind(updateWorkflowResponse), - updateWorkflowMetadata.decode.bind(updateWorkflowMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.v1.Workflows', 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.workflowsStub) { - return this.workflowsStub; - } - - // Put together the "service stub" for - // google.cloud.workflows.v1.Workflows. - this.workflowsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.v1.Workflows') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.workflows.v1.Workflows, - 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 workflowsStubMethods = - ['listWorkflows', 'getWorkflow', 'createWorkflow', 'deleteWorkflow', 'updateWorkflow']; - for (const methodName of workflowsStubMethods) { - const callPromise = this.workflowsStub.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.workflowsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'workflows.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 'workflows.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 workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow for which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {string} [request.revisionId] - * Optional. The revision of the workflow to retrieve. If the revision_id is - * empty, the latest revision is retrieved. - * The format is "000001-a4d", where the first six characters define - * the zero-padded decimal revision number. They are followed by a hyphen and - * three hexadecimal 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.workflows.v1.Workflow|Workflow}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.get_workflow.js - * region_tag:workflows_v1_generated_Workflows_GetWorkflow_async - */ - getWorkflow( - request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|undefined, {}|undefined - ]>; - getWorkflow( - request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): void; - getWorkflow( - request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - callback: Callback< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): void; - getWorkflow( - request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getWorkflow(request, options, callback); - } - -/** - * Creates a new workflow. If a workflow with the specified name already - * exists in the specified project and location, the long running operation - * returns a {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - * @param {google.cloud.workflows.v1.Workflow} request.workflow - * Required. Workflow to be created. - * @param {string} request.workflowId - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and 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/workflows.create_workflow.js - * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async - */ - createWorkflow( - request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createWorkflow( - request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkflow( - request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkflow( - request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createWorkflow(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.create_workflow.js - * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async - */ - async checkCreateWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a workflow with the specified name. - * This method also cancels and deletes all running executions of the - * workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.delete_workflow.js - * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async - */ - deleteWorkflow( - request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteWorkflow( - request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkflow( - request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkflow( - request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteWorkflow(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.delete_workflow.js - * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async - */ - async checkDeleteWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing workflow. - * Running this method has no impact on already running executions of the - * workflow. A new revision of the workflow might be created as a result of a - * successful update operation. In that case, the new revision is used - * in new workflow executions. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workflows.v1.Workflow} request.workflow - * Required. Workflow to be updated. - * @param {google.protobuf.FieldMask} request.updateMask - * List of fields to be updated. If not present, the entire workflow - * 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/v1/workflows.update_workflow.js - * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async - */ - updateWorkflow( - request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateWorkflow( - request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkflow( - request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkflow( - request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workflow.name': request.workflow!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateWorkflow(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.update_workflow.js - * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async - */ - async checkUpdateWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists workflows in a given project and location. - * The default order is not specified. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service might return - * fewer than this value even if not at the end of the collection. If a value - * is not specified, a default value of 500 is used. The maximum permitted - * value is 1000 and values greater than 1000 are coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a "desc" suffix. - * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. - * 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkflows( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.v1.IWorkflow[], - protos.google.cloud.workflows.v1.IListWorkflowsRequest|null, - protos.google.cloud.workflows.v1.IListWorkflowsResponse - ]>; - listWorkflows( - request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.v1.IListWorkflowsRequest, - protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1.IWorkflow>): void; - listWorkflows( - request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.v1.IListWorkflowsRequest, - protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1.IWorkflow>): void; - listWorkflows( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workflows.v1.IListWorkflowsRequest, - protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1.IWorkflow>, - callback?: PaginationCallback< - protos.google.cloud.workflows.v1.IListWorkflowsRequest, - protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1.IWorkflow>): - Promise<[ - protos.google.cloud.workflows.v1.IWorkflow[], - protos.google.cloud.workflows.v1.IListWorkflowsRequest|null, - protos.google.cloud.workflows.v1.IListWorkflowsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listWorkflows(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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service might return - * fewer than this value even if not at the end of the collection. If a value - * is not specified, a default value of 500 is used. The maximum permitted - * value is 1000 and values greater than 1000 are coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a "desc" suffix. - * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow} 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkflowsStream( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - 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['listWorkflows']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkflows.createStream( - this.innerApiCalls.listWorkflows as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service might return - * fewer than this value even if not at the end of the collection. If a value - * is not specified, a default value of 500 is used. The maximum permitted - * value is 1000 and values greater than 1000 are coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a "desc" suffix. - * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. 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/workflows.list_workflows.js - * region_tag:workflows_v1_generated_Workflows_ListWorkflows_async - */ - listWorkflowsAsync( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - 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['listWorkflows']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkflows.asyncIterate( - this.innerApiCalls['listWorkflows'] 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 cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} keyRing - * @param {string} cryptoKey - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - keyRing: keyRing, - cryptoKey: 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 keyRing from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the keyRing. - */ - matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).keyRing; - } - - /** - * Parse the cryptoKey from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the cryptoKey. - */ - matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).cryptoKey; - } - - /** - * 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 workflow resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow - * @returns {string} Resource name string. - */ - workflowPath(project:string,location:string,workflow:string) { - return this.pathTemplates.workflowPathTemplate.render({ - project: project, - location: location, - workflow: workflow, - }); - } - - /** - * Parse the project from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).project; - } - - /** - * Parse the location from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).location; - } - - /** - * Parse the workflow from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the workflow. - */ - matchWorkflowFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; - } - - /** - * 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.workflowsStub && !this._terminated) { - return this.workflowsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client_config.json deleted file mode 100644 index 02f67fcb3f5..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.workflows.v1.Workflows": { - "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": { - "ListWorkflows": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetWorkflow": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateWorkflow": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteWorkflow": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateWorkflow": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_proto_list.json deleted file mode 100644 index 46c65a972d7..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/src/v1/workflows_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/workflows/v1/workflows.proto" -] diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index c7a7c423f62..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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 workflows = require('@google-cloud/workflows'); - -function main() { - const workflowsClient = new workflows.WorkflowsClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 9e04ae05724..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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 {WorkflowsClient} from '@google-cloud/workflows'; - -// check that the client class type name can be used -function doStuffWithWorkflowsClient(client: WorkflowsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const workflowsClient = new WorkflowsClient(); - doStuffWithWorkflowsClient(workflowsClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/install.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1/test/gapic_executions_v1.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_executions_v1.ts deleted file mode 100644 index b971ac138bd..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_executions_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 executionsModule 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.ExecutionsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = executionsModule.v1.ExecutionsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = executionsModule.v1.ExecutionsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = executionsModule.v1.ExecutionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new executionsModule.v1.ExecutionsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new executionsModule.v1.ExecutionsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - await client.initialize(); - assert(client.executionsStub); - }); - - it('has close method for the initialized client', done => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.executionsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1.ExecutionsClient({ - 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 executionsModule.v1.ExecutionsClient({ - 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('createExecution', () => { - it('invokes createExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); - const [response] = await client.createExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createExecution(request), expectedError); - }); - }); - - describe('getExecution', () => { - it('invokes getExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); - const [response] = await client.getExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getExecution(request), expectedError); - }); - }); - - describe('cancelExecution', () => { - it('invokes cancelExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); - const [response] = await client.cancelExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelExecution(request), expectedError); - }); - }); - - describe('listExecutions', () => { - it('invokes listExecutions without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutions without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutions( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutions with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExecutions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutionsStream without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { - 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.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listExecutionsStream with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExecutions without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; - const iterable = client.listExecutionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExecutions with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('execution', () => { - const fakePath = "/rendered/path/execution"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - execution: "executionValue", - }; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.executionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.executionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('executionPath', () => { - const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.executionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExecutionName', () => { - const result = client.matchProjectFromExecutionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExecutionName', () => { - const result = client.matchLocationFromExecutionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromExecutionName', () => { - const result = client.matchWorkflowFromExecutionName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExecutionFromExecutionName', () => { - const result = client.matchExecutionFromExecutionName(fakePath); - assert.strictEqual(result, "executionValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workflow', () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_workflows_v1.ts b/owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_workflows_v1.ts deleted file mode 100644 index c1de3a97d3f..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1/test/gapic_workflows_v1.ts +++ /dev/null @@ -1,1594 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 workflowsModule 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.WorkflowsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = workflowsModule.v1.WorkflowsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = workflowsModule.v1.WorkflowsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = workflowsModule.v1.WorkflowsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new workflowsModule.v1.WorkflowsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new workflowsModule.v1.WorkflowsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - await client.initialize(); - assert(client.workflowsStub); - }); - - it('has close method for the initialized client', done => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.workflowsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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('getWorkflow', () => { - it('invokes getWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1.Workflow() - ); - client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkflow(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1.Workflow() - ); - client.innerApiCalls.getWorkflow = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkflow( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.v1.IWorkflow|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkflow with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkflow = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkflow with closed client', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkflow(request), expectedError); - }); - }); - - describe('createWorkflow', () => { - it('invokes createWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkflow with call error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkflow with LRO error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteWorkflow', () => { - it('invokes deleteWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkflow with call error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkflow with LRO error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteWorkflowProgress without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteWorkflowProgress with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateWorkflow', () => { - it('invokes updateWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkflow with call error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkflow with LRO error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listWorkflows', () => { - it('invokes listWorkflows without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkflows(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkflows without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.innerApiCalls.listWorkflows = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkflows( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.v1.IWorkflow[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkflows with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkflows = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkflows(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkflowsStream without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1.Workflow[] = []; - stream.on('data', (response: protos.google.cloud.workflows.v1.Workflow) => { - 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.listWorkflows.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listWorkflowsStream with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1.Workflow[] = []; - stream.on('data', (response: protos.google.cloud.workflows.v1.Workflow) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkflows without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; - const iterable = client.listWorkflowsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkflows with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkflowsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkflows.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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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('cryptoKey', () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - keyRing: "keyRingValue", - cryptoKey: "cryptoKeyValue", - }; - const client = new workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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('workflow', () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1/tsconfig.json b/owl-bot-staging/google-cloud-workflows-executions/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1/webpack.config.js b/owl-bot-staging/google-cloud-workflows-executions/v1/webpack.config.js deleted file mode 100644 index 5a6fddf6078..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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: 'Workflows', - filename: './workflows.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-workflows-executions/v1beta/.eslintignore b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/.gitignore b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.jsdoc.js deleted file mode 100644 index e7b50866513..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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/workflows', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1beta/README.md b/owl-bot-staging/google-cloud-workflows-executions/v1beta/README.md deleted file mode 100644 index 50496d9d5fb..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Workflows: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/package.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/package.json deleted file mode 100644 index b0fb2328d81..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/workflows", - "version": "0.1.0", - "description": "Workflows client for Node.js", - "repository": "googleapis/nodejs-workflows", - "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 workflows", - "workflows", - "workflows" - ], - "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-workflows-executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto b/owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto deleted file mode 100644 index dd37f3b88b5..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/executions/v1beta/executions.proto +++ /dev/null @@ -1,252 +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.workflows.executions.v1beta; - -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 go_package = "cloud.google.com/go/workflows/executions/apiv1beta/executionspb;executionspb"; -option java_multiple_files = true; -option java_outer_classname = "ExecutionsProto"; -option java_package = "com.google.cloud.workflows.executions.v1beta"; -option (google.api.resource_definition) = { - type: "workflows.googleapis.com/Workflow" - pattern: "projects/{project}/locations/{location}/workflows/{workflow}" -}; - -// Executions is used to start and manage running instances of -// [Workflows][google.cloud.workflows.v1beta.Workflow] called executions. -service Executions { - option (google.api.default_host) = "workflowexecutions.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Returns a list of executions which belong to the workflow with - // the given name. The method returns executions of all workflow - // revisions. Returned executions are ordered by their start time (newest - // first). - rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*/workflows/*}/executions" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new execution using the latest revision of the given workflow. - rpc CreateExecution(CreateExecutionRequest) returns (Execution) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*/workflows/*}/executions" - body: "execution" - }; - option (google.api.method_signature) = "parent,execution"; - } - - // Returns an execution of the given name. - rpc GetExecution(GetExecutionRequest) returns (Execution) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Cancels an execution of the given name. - rpc CancelExecution(CancelExecutionRequest) returns (Execution) { - option (google.api.http) = { - post: "/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}:cancel" - body: "*" - }; - option (google.api.method_signature) = "name"; - } -} - -// A running instance of a [Workflow][google.cloud.workflows.v1beta.Workflow]. -message Execution { - option (google.api.resource) = { - type: "workflowexecutions.googleapis.com/Execution" - pattern: "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}" - }; - - // Error describes why the execution was abnormally terminated. - message Error { - // Error payload returned by the execution, represented as a JSON string. - string payload = 1; - - // Human readable error context, helpful for debugging purposes. - string context = 2; - } - - // Describes the current state of the execution. More states may be added - // in the future. - enum State { - // Invalid state. - STATE_UNSPECIFIED = 0; - - // The execution is in progress. - ACTIVE = 1; - - // The execution finished successfully. - SUCCEEDED = 2; - - // The execution failed with an error. - FAILED = 3; - - // The execution was stopped intentionally. - CANCELLED = 4; - } - - // Output only. The resource name of the execution. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Marks the beginning of execution. - google.protobuf.Timestamp start_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Marks the end of execution, successful or not. - google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Current state of the execution. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input parameters of the execution represented as a JSON string. - // The size limit is 32KB. - string argument = 5; - - // Output only. Output of the execution represented as a JSON string. The - // value can only be present if the execution's state is `SUCCEEDED`. - string result = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The error which caused the execution to finish prematurely. - // The value is only present if the execution's state is `FAILED` - // or `CANCELLED`. - Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Revision of the workflow this execution is using. - string workflow_revision_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for the -// [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] -// method. -message ListExecutionsRequest { - // Required. Name of the workflow for which the executions should be listed. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; - - // Maximum number of executions to return per call. - // Max supported value depends on the selected Execution view: it's 10000 for - // BASIC and 100 for FULL. The default value used if the field is not - // specified is 100, regardless of the selected view. Values greater than - // the max value will be coerced down to it. - int32 page_size = 2; - - // A page token, received from a previous `ListExecutions` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListExecutions` must - // match the call that provided the page token. - string page_token = 3; - - // Optional. A view defining which fields should be filled in the returned executions. - // The API will default to the BASIC view. - ExecutionView view = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response for the -// [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] -// method. -message ListExecutionsResponse { - // The executions which match the request. - repeated Execution executions = 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 for the -// [CreateExecution][google.cloud.workflows.executions.v1beta.Executions.CreateExecution] -// method. -message CreateExecutionRequest { - // Required. Name of the workflow for which an execution should be created. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - // The latest revision of the workflow will be used. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; - - // Required. Execution to be created. - Execution execution = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the -// [GetExecution][google.cloud.workflows.executions.v1beta.Executions.GetExecution] -// method. -message GetExecutionRequest { - // Required. Name of the execution to be retrieved. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflowexecutions.googleapis.com/Execution" - } - ]; - - // Optional. A view defining which fields should be filled in the returned execution. - // The API will default to the FULL view. - ExecutionView view = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for the -// [CancelExecution][google.cloud.workflows.executions.v1beta.Executions.CancelExecution] -// method. -message CancelExecutionRequest { - // Required. Name of the execution to be cancelled. - // Format: - // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflowexecutions.googleapis.com/Execution" - } - ]; -} - -// Defines possible views for execution resource. -enum ExecutionView { - // The default / unset value. - EXECUTION_VIEW_UNSPECIFIED = 0; - - // Includes only basic metadata about the execution. - // Following fields are returned: name, start_time, end_time, state - // and workflow_revision_id. - BASIC = 1; - - // Includes all data. - FULL = 2; -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/v1beta/workflows.proto b/owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/v1beta/workflows.proto deleted file mode 100644 index d929f2006d7..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/protos/google/cloud/workflows/v1beta/workflows.proto +++ /dev/null @@ -1,314 +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.workflows.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/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/workflows/apiv1beta/workflowspb;workflowspb"; -option java_multiple_files = true; -option java_outer_classname = "WorkflowsProto"; -option java_package = "com.google.cloud.workflows.v1beta"; - -// Workflows is used to deploy and execute workflow programs. -// Workflows makes sure the program executes reliably, despite hardware and -// networking interruptions. -service Workflows { - option (google.api.default_host) = "workflows.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists Workflows in a given project and location. - // The default order is not specified. - rpc ListWorkflows(ListWorkflowsRequest) returns (ListWorkflowsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*}/workflows" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single Workflow. - rpc GetWorkflow(GetWorkflowRequest) returns (Workflow) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/workflows/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new workflow. If a workflow with the specified name already - // exists in the specified project and location, the long running operation - // will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. - rpc CreateWorkflow(CreateWorkflowRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*}/workflows" - body: "workflow" - }; - option (google.api.method_signature) = "parent,workflow,workflow_id"; - option (google.longrunning.operation_info) = { - response_type: "Workflow" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a workflow with the specified name. - // This method also cancels and deletes all running executions of the - // workflow. - rpc DeleteWorkflow(DeleteWorkflowRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/locations/*/workflows/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing workflow. - // Running this method has no impact on already running executions of the - // workflow. A new revision of the workflow may be created as a result of a - // successful update operation. In that case, such revision will be used - // in new workflow executions. - rpc UpdateWorkflow(UpdateWorkflowRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta/{workflow.name=projects/*/locations/*/workflows/*}" - body: "workflow" - }; - option (google.api.method_signature) = "workflow,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Workflow" - metadata_type: "OperationMetadata" - }; - } -} - -// Workflow program to be executed by Workflows. -message Workflow { - option (google.api.resource) = { - type: "workflows.googleapis.com/Workflow" - pattern: "projects/{project}/locations/{location}/workflows/{workflow}" - }; - - // Describes the current state of workflow deployment. More states may be - // added in the future. - enum State { - // Invalid state. - STATE_UNSPECIFIED = 0; - - // The workflow has been deployed successfully and is serving. - ACTIVE = 1; - } - - // The resource name of the workflow. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - string name = 1; - - // Description of the workflow provided by the user. - // Must be at most 1000 unicode characters long. - string description = 2; - - // Output only. State of the workflow deployment. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The revision of the workflow. - // A new revision of a workflow is created as a result of updating the - // following fields of a workflow: - // - `source_code` - // - `service_account` - // The format is "000001-a4d", where the first 6 characters define - // the zero-padded revision ordinal number. They are followed by a hyphen and - // 3 hexadecimal random characters. - string revision_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp of when the workflow was created. - google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the workflow. - google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp that the latest revision of the workflow - // was created. - google.protobuf.Timestamp revision_create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels associated with this workflow. - // Labels can contain at most 64 entries. Keys and values can be no longer - // than 63 characters and can only contain lowercase letters, numeric - // characters, underscores and dashes. Label keys must start with a letter. - // International characters are allowed. - map labels = 8; - - // Name of the service account associated with the latest workflow version. - // This service account represents the identity of the workflow and determines - // what permissions the workflow has. - // Format: projects/{project}/serviceAccounts/{account} - // - // Using `-` as a wildcard for the `{project}` will infer the project from - // the account. The `{account}` value can be the `email` address or the - // `unique_id` of the service account. - // - // If not provided, workflow will use the project's default service account. - // Modifying this field for an existing workflow results in a new workflow - // revision. - string service_account = 9; - - // Required. Location of the workflow source code. - // Modifying this field for an existing workflow results in a new workflow - // revision. - oneof source_code { - // Workflow code to be executed. The size limit is 32KB. - string source_contents = 10; - } -} - -// Request for the -// [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows] -// method. -message ListWorkflowsRequest { - // Required. Project and location from which the workflows should be listed. - // Format: projects/{project}/locations/{location} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Maximum number of workflows to return per call. The service may return - // fewer than this value. If the value is not specified, a default value of - // 500 will be used. The maximum permitted value is 1000 and values greater - // than 1000 will be coerced down to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListWorkflows` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListWorkflows` must - // match the call that provided the page token. - string page_token = 3; - - // Filter to restrict results to specific workflows. - string filter = 4; - - // Comma-separated list of fields that that specify the order of the results. - // Default sorting order for a field is ascending. To specify descending order - // for a field, append a " desc" suffix. - // If not specified, the results will be returned in an unspecified order. - string order_by = 5; -} - -// Response for the -// [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows] -// method. -message ListWorkflowsResponse { - // The workflows which match the request. - repeated Workflow workflows = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Request for the -// [GetWorkflow][google.cloud.workflows.v1beta.Workflows.GetWorkflow] method. -message GetWorkflowRequest { - // Required. Name of the workflow which information should be retrieved. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; -} - -// Request for the -// [CreateWorkflow][google.cloud.workflows.v1beta.Workflows.CreateWorkflow] -// method. -message CreateWorkflowRequest { - // Required. Project and location in which the workflow should be created. - // Format: projects/{project}/locations/{location} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Workflow to be created. - Workflow workflow = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the workflow to be created. It has to fulfill the - // following requirements: - // - // * Must contain only letters, numbers, underscores and hyphens. - // * Must start with a letter. - // * Must be between 1-64 characters. - // * Must end with a number or a letter. - // * Must be unique within the customer project and location. - string workflow_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the -// [DeleteWorkflow][google.cloud.workflows.v1beta.Workflows.DeleteWorkflow] -// method. -message DeleteWorkflowRequest { - // Required. Name of the workflow to be deleted. - // Format: projects/{project}/locations/{location}/workflows/{workflow} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workflows.googleapis.com/Workflow" - } - ]; -} - -// Request for the -// [UpdateWorkflow][google.cloud.workflows.v1beta.Workflows.UpdateWorkflow] -// method. -message UpdateWorkflowRequest { - // Required. Workflow to be updated. - Workflow workflow = 1 [(google.api.field_behavior) = REQUIRED]; - - // List of fields to be updated. If not present, the entire workflow - // will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// 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; - - // API version used to start the operation. - string api_version = 5; -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.cancel_execution.js deleted file mode 100644 index 3767b5aabea..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.cancel_execution.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 workflowexecutions_v1beta_generated_Executions_CancelExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - */ - // const name = 'abc123' - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callCancelExecution() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await executionsClient.cancelExecution(request); - console.log(response); - } - - callCancelExecution(); - // [END workflowexecutions_v1beta_generated_Executions_CancelExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.create_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.create_execution.js deleted file mode 100644 index ff47d779839..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.create_execution.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(parent, execution) { - // [START workflowexecutions_v1beta_generated_Executions_CreateExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - */ - // const parent = 'abc123' - /** - * Required. Execution to be created. - */ - // const execution = {} - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callCreateExecution() { - // Construct request - const request = { - parent, - execution, - }; - - // Run request - const response = await executionsClient.createExecution(request); - console.log(response); - } - - callCreateExecution(); - // [END workflowexecutions_v1beta_generated_Executions_CreateExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.get_execution.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.get_execution.js deleted file mode 100644 index 1bcfe963326..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.get_execution.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 workflowexecutions_v1beta_generated_Executions_GetExecution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - */ - // const name = 'abc123' - /** - * Optional. A view defining which fields should be filled in the returned execution. - * The API will default to the FULL view. - */ - // const view = {} - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callGetExecution() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await executionsClient.getExecution(request); - console.log(response); - } - - callGetExecution(); - // [END workflowexecutions_v1beta_generated_Executions_GetExecution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.list_executions.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.list_executions.js deleted file mode 100644 index 8edec13e293..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/executions.list_executions.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 workflowexecutions_v1beta_generated_Executions_ListExecutions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - */ - // const parent = 'abc123' - /** - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC view. - */ - // const view = {} - - // Imports the Executions library - const {ExecutionsClient} = require('@google-cloud/workflows-executions').v1beta; - - // Instantiates a client - const executionsClient = new ExecutionsClient(); - - async function callListExecutions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await executionsClient.listExecutionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListExecutions(); - // [END workflowexecutions_v1beta_generated_Executions_ListExecutions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json deleted file mode 100644 index 388d6848833..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-executions", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.workflows.executions.v1beta", - "version": "v1beta" - } - ] - }, - "snippets": [ - { - "regionTag": "workflowexecutions_v1beta_generated_Executions_ListExecutions_async", - "title": "Executions listExecutions Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).", - "canonical": true, - "file": "executions.list_executions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListExecutions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", - "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.workflows.executions.v1beta.ExecutionView" - } - ], - "resultType": ".google.cloud.workflows.executions.v1beta.ListExecutionsResponse", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" - }, - "method": { - "shortName": "ListExecutions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1beta_generated_Executions_CreateExecution_async", - "title": "Executions createExecution Sample", - "origin": "API_DEFINITION", - "description": " Creates a new execution using the latest revision of the given workflow.", - "canonical": true, - "file": "executions.create_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "execution", - "type": ".google.cloud.workflows.executions.v1beta.Execution" - } - ], - "resultType": ".google.cloud.workflows.executions.v1beta.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" - }, - "method": { - "shortName": "CreateExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1beta_generated_Executions_GetExecution_async", - "title": "Executions getExecution Sample", - "origin": "API_DEFINITION", - "description": " Returns an execution of the given name.", - "canonical": true, - "file": "executions.get_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.workflows.executions.v1beta.ExecutionView" - } - ], - "resultType": ".google.cloud.workflows.executions.v1beta.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" - }, - "method": { - "shortName": "GetExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions" - } - } - } - }, - { - "regionTag": "workflowexecutions_v1beta_generated_Executions_CancelExecution_async", - "title": "Executions cancelExecution Sample", - "origin": "API_DEFINITION", - "description": " Cancels an execution of the given name.", - "canonical": true, - "file": "executions.cancel_execution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.executions.v1beta.Execution", - "client": { - "shortName": "ExecutionsClient", - "fullName": "google.cloud.workflows.executions.v1beta.ExecutionsClient" - }, - "method": { - "shortName": "CancelExecution", - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", - "service": { - "shortName": "Executions", - "fullName": "google.cloud.workflows.executions.v1beta.Executions" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json deleted file mode 100644 index 400f73d4c9b..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-workflows", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.workflows.v1beta", - "version": "v1beta" - } - ] - }, - "snippets": [ - { - "regionTag": "workflows_v1beta_generated_Workflows_ListWorkflows_async", - "title": "Workflows listWorkflows Sample", - "origin": "API_DEFINITION", - "description": " Lists Workflows in a given project and location. The default order is not specified.", - "canonical": true, - "file": "workflows.list_workflows.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkflows", - "fullName": "google.cloud.workflows.v1beta.Workflows.ListWorkflows", - "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.workflows.v1beta.ListWorkflowsResponse", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" - }, - "method": { - "shortName": "ListWorkflows", - "fullName": "google.cloud.workflows.v1beta.Workflows.ListWorkflows", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1beta.Workflows" - } - } - } - }, - { - "regionTag": "workflows_v1beta_generated_Workflows_GetWorkflow_async", - "title": "Workflows getWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Workflow.", - "canonical": true, - "file": "workflows.get_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.GetWorkflow", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.v1beta.Workflow", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" - }, - "method": { - "shortName": "GetWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.GetWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1beta.Workflows" - } - } - } - }, - { - "regionTag": "workflows_v1beta_generated_Workflows_CreateWorkflow_async", - "title": "Workflows createWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.", - "canonical": true, - "file": "workflows.create_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.CreateWorkflow", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "workflow", - "type": ".google.cloud.workflows.v1beta.Workflow" - }, - { - "name": "workflow_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" - }, - "method": { - "shortName": "CreateWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.CreateWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1beta.Workflows" - } - } - } - }, - { - "regionTag": "workflows_v1beta_generated_Workflows_DeleteWorkflow_async", - "title": "Workflows deleteWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.", - "canonical": true, - "file": "workflows.delete_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.DeleteWorkflow", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" - }, - "method": { - "shortName": "DeleteWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.DeleteWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1beta.Workflows" - } - } - } - }, - { - "regionTag": "workflows_v1beta_generated_Workflows_UpdateWorkflow_async", - "title": "Workflows updateWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow may be created as a result of a successful update operation. In that case, such revision will be used in new workflow executions.", - "canonical": true, - "file": "workflows.update_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.UpdateWorkflow", - "async": true, - "parameters": [ - { - "name": "workflow", - "type": ".google.cloud.workflows.v1beta.Workflow" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" - }, - "method": { - "shortName": "UpdateWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.UpdateWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1beta.Workflows" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.create_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.create_workflow.js deleted file mode 100644 index acaf5af0d6d..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.create_workflow.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, workflow, workflowId) { - // [START workflows_v1beta_generated_Workflows_CreateWorkflow_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - */ - // const parent = 'abc123' - /** - * Required. Workflow to be created. - */ - // const workflow = {} - /** - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and location. - */ - // const workflowId = 'abc123' - - // Imports the Workflows library - const {WorkflowsClient} = require('@google-cloud/workflows').v1beta; - - // Instantiates a client - const workflowsClient = new WorkflowsClient(); - - async function callCreateWorkflow() { - // Construct request - const request = { - parent, - workflow, - workflowId, - }; - - // Run request - const [operation] = await workflowsClient.createWorkflow(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateWorkflow(); - // [END workflows_v1beta_generated_Workflows_CreateWorkflow_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.delete_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.delete_workflow.js deleted file mode 100644 index 2afa40e9c32..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.delete_workflow.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 workflows_v1beta_generated_Workflows_DeleteWorkflow_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - */ - // const name = 'abc123' - - // Imports the Workflows library - const {WorkflowsClient} = require('@google-cloud/workflows').v1beta; - - // Instantiates a client - const workflowsClient = new WorkflowsClient(); - - async function callDeleteWorkflow() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workflowsClient.deleteWorkflow(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteWorkflow(); - // [END workflows_v1beta_generated_Workflows_DeleteWorkflow_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.get_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.get_workflow.js deleted file mode 100644 index 6e1d7258fd4..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.get_workflow.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 workflows_v1beta_generated_Workflows_GetWorkflow_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workflow which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - */ - // const name = 'abc123' - - // Imports the Workflows library - const {WorkflowsClient} = require('@google-cloud/workflows').v1beta; - - // Instantiates a client - const workflowsClient = new WorkflowsClient(); - - async function callGetWorkflow() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await workflowsClient.getWorkflow(request); - console.log(response); - } - - callGetWorkflow(); - // [END workflows_v1beta_generated_Workflows_GetWorkflow_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.list_workflows.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.list_workflows.js deleted file mode 100644 index 864c24f97d2..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.list_workflows.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) { - // [START workflows_v1beta_generated_Workflows_ListWorkflows_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - */ - // const parent = 'abc123' - /** - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Filter to restrict results to specific workflows. - */ - // const filter = 'abc123' - /** - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified order. - */ - // const orderBy = 'abc123' - - // Imports the Workflows library - const {WorkflowsClient} = require('@google-cloud/workflows').v1beta; - - // Instantiates a client - const workflowsClient = new WorkflowsClient(); - - async function callListWorkflows() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workflowsClient.listWorkflowsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListWorkflows(); - // [END workflows_v1beta_generated_Workflows_ListWorkflows_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.update_workflow.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.update_workflow.js deleted file mode 100644 index 303f42ff21b..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/samples/generated/v1beta/workflows.update_workflow.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(workflow) { - // [START workflows_v1beta_generated_Workflows_UpdateWorkflow_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Workflow to be updated. - */ - // const workflow = {} - /** - * List of fields to be updated. If not present, the entire workflow - * will be updated. - */ - // const updateMask = {} - - // Imports the Workflows library - const {WorkflowsClient} = require('@google-cloud/workflows').v1beta; - - // Instantiates a client - const workflowsClient = new WorkflowsClient(); - - async function callUpdateWorkflow() { - // Construct request - const request = { - workflow, - }; - - // Run request - const [operation] = await workflowsClient.updateWorkflow(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateWorkflow(); - // [END workflows_v1beta_generated_Workflows_UpdateWorkflow_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/index.ts deleted file mode 100644 index 83c1f7863fc..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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 WorkflowsClient = v1beta.WorkflowsClient; -type WorkflowsClient = v1beta.WorkflowsClient; -export {v1beta, WorkflowsClient}; -export default {v1beta, WorkflowsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client.ts deleted file mode 100644 index d9acaa01415..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client.ts +++ /dev/null @@ -1,870 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1beta/executions_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './executions_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Executions is used to start and manage running instances of - * {@link protos.google.cloud.workflows.v1beta.Workflow|Workflows} called executions. - * @class - * @memberof v1beta - */ -export class ExecutionsClient { - 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}; - executionsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ExecutionsClient. - * - * @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 ExecutionsClient({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 ExecutionsClient; - 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 = { - executionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}' - ), - workflowPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}' - ), - }; - - // 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 = { - listExecutions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.executions.v1beta.Executions', 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.executionsStub) { - return this.executionsStub; - } - - // Put together the "service stub" for - // google.cloud.workflows.executions.v1beta.Executions. - this.executionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1beta.Executions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.workflows.executions.v1beta.Executions, - 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 executionsStubMethods = - ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; - for (const methodName of executionsStubMethods) { - const callPromise = this.executionsStub.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.executionsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'workflowexecutions.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 'workflowexecutions.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 -- - // ------------------- -/** - * Creates a new execution using the latest revision of the given workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @param {google.cloud.workflows.executions.v1beta.Execution} request.execution - * Required. Execution 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.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.create_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_CreateExecution_async - */ - createExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined - ]>; - createExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; - createExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; - createExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createExecution(request, options, callback); - } -/** - * Returns an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned execution. - * The API will default to the FULL 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.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.get_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_GetExecution_async - */ - getExecution( - request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined - ]>; - getExecution( - request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; - getExecution( - request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; - getExecution( - request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getExecution(request, options, callback); - } -/** - * Cancels an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.cancel_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_CancelExecution_async - */ - cancelExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined - ]>; - cancelExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; - cancelExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; - cancelExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.cancelExecution(request, options, callback); - } - - /** - * Returns a list of executions which belong to the workflow with - * the given name. The method returns executions of all workflow - * revisions. Returned executions are ordered by their start time (newest - * first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. - * 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExecutions( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution[], - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - ]>; - listExecutions( - request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): void; - listExecutions( - request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): void; - listExecutions( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>, - callback?: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution[], - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution} 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listExecutionsStream( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - 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['listExecutions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExecutions.createStream( - this.innerApiCalls.listExecutions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. 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/executions.list_executions.js - * region_tag:workflowexecutions_v1beta_generated_Executions_ListExecutions_async - */ - listExecutionsAsync( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - 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['listExecutions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listExecutions.asyncIterate( - this.innerApiCalls['listExecutions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified execution resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow - * @param {string} execution - * @returns {string} Resource name string. - */ - executionPath(project:string,location:string,workflow:string,execution:string) { - return this.pathTemplates.executionPathTemplate.render({ - project: project, - location: location, - workflow: workflow, - execution: execution, - }); - } - - /** - * Parse the project from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the project. - */ - matchProjectFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).project; - } - - /** - * Parse the location from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the location. - */ - matchLocationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).location; - } - - /** - * Parse the workflow from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the workflow. - */ - matchWorkflowFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).workflow; - } - - /** - * Parse the execution from Execution resource. - * - * @param {string} executionName - * A fully-qualified path representing Execution resource. - * @returns {string} A string representing the execution. - */ - matchExecutionFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).execution; - } - - /** - * Return a fully-qualified workflow resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow - * @returns {string} Resource name string. - */ - workflowPath(project:string,location:string,workflow:string) { - return this.pathTemplates.workflowPathTemplate.render({ - project: project, - location: location, - workflow: workflow, - }); - } - - /** - * Parse the project from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).project; - } - - /** - * Parse the location from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).location; - } - - /** - * Parse the workflow from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the workflow. - */ - matchWorkflowFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; - } - - /** - * 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.executionsStub && !this._terminated) { - return this.executionsStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client_config.json deleted file mode 100644 index bf2692e9a8d..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_client_config.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "interfaces": { - "google.cloud.workflows.executions.v1beta.Executions": { - "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": { - "ListExecutions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CancelExecution": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_proto_list.json deleted file mode 100644 index 245066757b4..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/executions_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/workflows/executions/v1beta/executions.proto" -] diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/gapic_metadata.json deleted file mode 100644 index 72f32dbfb64..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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.workflows.v1beta", - "libraryPackage": "@google-cloud/workflows", - "services": { - "Workflows": { - "clients": { - "grpc": { - "libraryClient": "WorkflowsClient", - "rpcs": { - "GetWorkflow": { - "methods": [ - "getWorkflow" - ] - }, - "CreateWorkflow": { - "methods": [ - "createWorkflow" - ] - }, - "DeleteWorkflow": { - "methods": [ - "deleteWorkflow" - ] - }, - "UpdateWorkflow": { - "methods": [ - "updateWorkflow" - ] - }, - "ListWorkflows": { - "methods": [ - "listWorkflows", - "listWorkflowsStream", - "listWorkflowsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WorkflowsClient", - "rpcs": { - "GetWorkflow": { - "methods": [ - "getWorkflow" - ] - }, - "CreateWorkflow": { - "methods": [ - "createWorkflow" - ] - }, - "DeleteWorkflow": { - "methods": [ - "deleteWorkflow" - ] - }, - "UpdateWorkflow": { - "methods": [ - "updateWorkflow" - ] - }, - "ListWorkflows": { - "methods": [ - "listWorkflows", - "listWorkflowsStream", - "listWorkflowsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/index.ts deleted file mode 100644 index 4efcde817e9..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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 {WorkflowsClient} from './workflows_client'; diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client.ts deleted file mode 100644 index 28c018c5a47..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client.ts +++ /dev/null @@ -1,1040 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/workflows_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './workflows_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Workflows is used to deploy and execute workflow programs. - * Workflows makes sure the program executes reliably, despite hardware and - * networking interruptions. - * @class - * @memberof v1beta - */ -export class WorkflowsClient { - 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; - workflowsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WorkflowsClient. - * - * @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 WorkflowsClient({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 WorkflowsClient; - 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}' - ), - workflowPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}' - ), - }; - - // 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 = { - listWorkflows: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workflows') - }; - - 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.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 createWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.Workflow') as gax.protobuf.Type; - const createWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; - const deleteWorkflowResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; - const updateWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.Workflow') as gax.protobuf.Type; - const updateWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createWorkflow: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createWorkflowResponse.decode.bind(createWorkflowResponse), - createWorkflowMetadata.decode.bind(createWorkflowMetadata)), - deleteWorkflow: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteWorkflowResponse.decode.bind(deleteWorkflowResponse), - deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata)), - updateWorkflow: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateWorkflowResponse.decode.bind(updateWorkflowResponse), - updateWorkflowMetadata.decode.bind(updateWorkflowMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.v1beta.Workflows', 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.workflowsStub) { - return this.workflowsStub; - } - - // Put together the "service stub" for - // google.cloud.workflows.v1beta.Workflows. - this.workflowsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.v1beta.Workflows') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.workflows.v1beta.Workflows, - 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 workflowsStubMethods = - ['listWorkflows', 'getWorkflow', 'createWorkflow', 'deleteWorkflow', 'updateWorkflow']; - for (const methodName of workflowsStubMethods) { - const callPromise = this.workflowsStub.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.workflowsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'workflows.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 'workflows.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 Workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workflows.v1beta.Workflow|Workflow}. - * Please see the {@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/workflows.get_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_GetWorkflow_async - */ - getWorkflow( - request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|undefined, {}|undefined - ]>; - getWorkflow( - request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): void; - getWorkflow( - request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - callback: Callback< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): void; - getWorkflow( - request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getWorkflow(request, options, callback); - } - -/** - * Creates a new workflow. If a workflow with the specified name already - * exists in the specified project and location, the long running operation - * will return {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - * @param {google.cloud.workflows.v1beta.Workflow} request.workflow - * Required. Workflow to be created. - * @param {string} request.workflowId - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and 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/v1beta/workflows.create_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async - */ - createWorkflow( - request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createWorkflow( - request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkflow( - request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkflow( - request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createWorkflow(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workflows.create_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async - */ - async checkCreateWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a workflow with the specified name. - * This method also cancels and deletes all running executions of the - * workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workflows.delete_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async - */ - deleteWorkflow( - request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteWorkflow( - request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkflow( - request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkflow( - request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteWorkflow(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workflows.delete_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async - */ - async checkDeleteWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing workflow. - * Running this method has no impact on already running executions of the - * workflow. A new revision of the workflow may be created as a result of a - * successful update operation. In that case, such revision will be used - * in new workflow executions. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workflows.v1beta.Workflow} request.workflow - * Required. Workflow to be updated. - * @param {google.protobuf.FieldMask} request.updateMask - * List of fields to be updated. If not present, the entire workflow - * 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/v1beta/workflows.update_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async - */ - updateWorkflow( - request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateWorkflow( - request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkflow( - request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkflow( - request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workflow.name': request.workflow!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateWorkflow(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workflows.update_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async - */ - async checkUpdateWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Workflows in a given project and location. - * The default order is not specified. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. - * 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkflows( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.v1beta.IWorkflow[], - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest|null, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse - ]>; - listWorkflows( - request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1beta.IWorkflow>): void; - listWorkflows( - request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1beta.IWorkflow>): void; - listWorkflows( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1beta.IWorkflow>, - callback?: PaginationCallback< - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1beta.IWorkflow>): - Promise<[ - protos.google.cloud.workflows.v1beta.IWorkflow[], - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest|null, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listWorkflows(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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow} 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkflowsStream( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - 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['listWorkflows']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkflows.createStream( - this.innerApiCalls.listWorkflows as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. 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/workflows.list_workflows.js - * region_tag:workflows_v1beta_generated_Workflows_ListWorkflows_async - */ - listWorkflowsAsync( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - 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['listWorkflows']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkflows.asyncIterate( - this.innerApiCalls['listWorkflows'] 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 workflow resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow - * @returns {string} Resource name string. - */ - workflowPath(project:string,location:string,workflow:string) { - return this.pathTemplates.workflowPathTemplate.render({ - project: project, - location: location, - workflow: workflow, - }); - } - - /** - * Parse the project from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).project; - } - - /** - * Parse the location from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).location; - } - - /** - * Parse the workflow from Workflow resource. - * - * @param {string} workflowName - * A fully-qualified path representing Workflow resource. - * @returns {string} A string representing the workflow. - */ - matchWorkflowFromWorkflowName(workflowName: string) { - return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; - } - - /** - * 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.workflowsStub && !this._terminated) { - return this.workflowsStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client_config.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client_config.json deleted file mode 100644 index bccc9e1babb..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.workflows.v1beta.Workflows": { - "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": { - "ListWorkflows": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetWorkflow": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateWorkflow": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteWorkflow": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateWorkflow": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_proto_list.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_proto_list.json deleted file mode 100644 index c9d0fa6bc07..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/src/v1beta/workflows_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/workflows/v1beta/workflows.proto" -] diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index c7a7c423f62..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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 workflows = require('@google-cloud/workflows'); - -function main() { - const workflowsClient = new workflows.WorkflowsClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 9e04ae05724..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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 {WorkflowsClient} from '@google-cloud/workflows'; - -// check that the client class type name can be used -function doStuffWithWorkflowsClient(client: WorkflowsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const workflowsClient = new WorkflowsClient(); - doStuffWithWorkflowsClient(workflowsClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1beta/test/gapic_executions_v1beta.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_executions_v1beta.ts deleted file mode 100644 index aabf52f4cda..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_executions_v1beta.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 executionsModule 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('v1beta.ExecutionsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = executionsModule.v1beta.ExecutionsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = executionsModule.v1beta.ExecutionsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = executionsModule.v1beta.ExecutionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new executionsModule.v1beta.ExecutionsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - await client.initialize(); - assert(client.executionsStub); - }); - - it('has close method for the initialized client', done => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.executionsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1beta.ExecutionsClient({ - 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 executionsModule.v1beta.ExecutionsClient({ - 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('createExecution', () => { - it('invokes createExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); - const [response] = await client.createExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createExecution(request), expectedError); - }); - }); - - describe('getExecution', () => { - it('invokes getExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); - const [response] = await client.getExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getExecution(request), expectedError); - }); - }); - - describe('cancelExecution', () => { - it('invokes cancelExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); - const [response] = await client.cancelExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelExecution(request), expectedError); - }); - }); - - describe('listExecutions', () => { - it('invokes listExecutions without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutions without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutions( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutions with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExecutions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExecutionsStream without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { - 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.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listExecutionsStream with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExecutions without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; - const iterable = client.listExecutionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExecutions with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('execution', () => { - const fakePath = "/rendered/path/execution"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - execution: "executionValue", - }; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.executionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.executionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('executionPath', () => { - const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.executionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExecutionName', () => { - const result = client.matchProjectFromExecutionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExecutionName', () => { - const result = client.matchLocationFromExecutionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromExecutionName', () => { - const result = client.matchWorkflowFromExecutionName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExecutionFromExecutionName', () => { - const result = client.matchExecutionFromExecutionName(fakePath); - assert.strictEqual(result, "executionValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workflow', () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_workflows_v1beta.ts b/owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_workflows_v1beta.ts deleted file mode 100644 index b444a534938..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/v1beta/test/gapic_workflows_v1beta.ts +++ /dev/null @@ -1,1119 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 workflowsModule 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.WorkflowsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = workflowsModule.v1beta.WorkflowsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = workflowsModule.v1beta.WorkflowsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = workflowsModule.v1beta.WorkflowsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new workflowsModule.v1beta.WorkflowsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - await client.initialize(); - assert(client.workflowsStub); - }); - - it('has close method for the initialized client', done => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.workflowsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workflowsModule.v1beta.WorkflowsClient({ - 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 workflowsModule.v1beta.WorkflowsClient({ - 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('getWorkflow', () => { - it('invokes getWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ); - client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkflow(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ); - client.innerApiCalls.getWorkflow = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkflow( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.v1beta.IWorkflow|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkflow with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkflow = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkflow with closed client', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkflow(request), expectedError); - }); - }); - - describe('createWorkflow', () => { - it('invokes createWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkflow with call error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkflow with LRO error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteWorkflow', () => { - it('invokes deleteWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkflow with call error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkflow with LRO error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteWorkflowProgress without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteWorkflowProgress with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateWorkflow', () => { - it('invokes updateWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkflow with call error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkflow with LRO error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listWorkflows', () => { - it('invokes listWorkflows without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - ]; - client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkflows(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkflows without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - ]; - client.innerApiCalls.listWorkflows = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkflows( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.v1beta.IWorkflow[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkflows with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkflows = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkflows(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkflowsStream without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - ]; - client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; - stream.on('data', (response: protos.google.cloud.workflows.v1beta.Workflow) => { - 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.listWorkflows.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listWorkflowsStream with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; - stream.on('data', (response: protos.google.cloud.workflows.v1beta.Workflow) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkflows without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - ]; - client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; - const iterable = client.listWorkflowsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkflows with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkflowsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkflows.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 workflowsModule.v1beta.WorkflowsClient({ - 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('workflow', () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-workflows-executions/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-workflows-executions/v1beta/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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-workflows-executions/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-workflows-executions/v1beta/webpack.config.js deleted file mode 100644 index 5a6fddf6078..00000000000 --- a/owl-bot-staging/google-cloud-workflows-executions/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: 'Workflows', - filename: './workflows.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-workstations/v1/.eslintignore b/owl-bot-staging/google-cloud-workstations/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1/.eslintrc.json b/owl-bot-staging/google-cloud-workstations/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-workstations/v1/.gitignore b/owl-bot-staging/google-cloud-workstations/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1/.jsdoc.js b/owl-bot-staging/google-cloud-workstations/v1/.jsdoc.js deleted file mode 100644 index 6398f035d9b..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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/workstations', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-workstations/v1/.mocharc.js b/owl-bot-staging/google-cloud-workstations/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1/.prettierrc.js b/owl-bot-staging/google-cloud-workstations/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1/README.md b/owl-bot-staging/google-cloud-workstations/v1/README.md deleted file mode 100644 index 8ef3807738a..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Workstations: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workstations/v1/package.json b/owl-bot-staging/google-cloud-workstations/v1/package.json deleted file mode 100644 index 94fc6760f48..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/workstations", - "version": "0.1.0", - "description": "Workstations client for Node.js", - "repository": "googleapis/nodejs-workstations", - "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 workstations", - "workstations", - "workstations" - ], - "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-workstations/v1/protos/google/cloud/workstations/v1/workstations.proto b/owl-bot-staging/google-cloud-workstations/v1/protos/google/cloud/workstations/v1/workstations.proto deleted file mode 100644 index b6082157195..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/protos/google/cloud/workstations/v1/workstations.proto +++ /dev/null @@ -1,1182 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.workstations.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/rpc/status.proto"; - -option go_package = "cloud.google.com/go/workstations/apiv1/workstationspb;workstationspb"; -option java_multiple_files = true; -option java_outer_classname = "WorkstationsProto"; -option java_package = "com.google.cloud.workstations.v1"; - -// Service for interacting with Cloud Workstations. -service Workstations { - option (google.api.default_host) = "workstations.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Returns the requested workstation cluster. - rpc GetWorkstationCluster(GetWorkstationClusterRequest) - returns (WorkstationCluster) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/workstationClusters/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns all workstation clusters in the specified location. - rpc ListWorkstationClusters(ListWorkstationClustersRequest) - returns (ListWorkstationClustersResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/workstationClusters" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new workstation cluster. - rpc CreateWorkstationCluster(CreateWorkstationClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/workstationClusters" - body: "workstation_cluster" - }; - option (google.api.method_signature) = - "parent,workstation_cluster,workstation_cluster_id"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationCluster" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing workstation cluster. - rpc UpdateWorkstationCluster(UpdateWorkstationClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{workstation_cluster.name=projects/*/locations/*/workstationClusters/*}" - body: "workstation_cluster" - }; - option (google.api.method_signature) = "workstation_cluster,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationCluster" - metadata_type: "OperationMetadata" - }; - } - - // Deletes the specified workstation cluster. - rpc DeleteWorkstationCluster(DeleteWorkstationClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/workstationClusters/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationCluster" - metadata_type: "OperationMetadata" - }; - } - - // Returns the requested workstation configuration. - rpc GetWorkstationConfig(GetWorkstationConfigRequest) - returns (WorkstationConfig) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns all workstation configurations in the specified cluster. - rpc ListWorkstationConfigs(ListWorkstationConfigsRequest) - returns (ListWorkstationConfigsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns all workstation configurations in the specified cluster on which - // the caller has the "workstations.workstation.create" permission. - rpc ListUsableWorkstationConfigs(ListUsableWorkstationConfigsRequest) - returns (ListUsableWorkstationConfigsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs:listUsable" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new workstation configuration. - rpc CreateWorkstationConfig(CreateWorkstationConfigRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs" - body: "workstation_config" - }; - option (google.api.method_signature) = - "parent,workstation_config,workstation_config_id"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationConfig" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing workstation configuration. - rpc UpdateWorkstationConfig(UpdateWorkstationConfigRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{workstation_config.name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" - body: "workstation_config" - }; - option (google.api.method_signature) = "workstation_config,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationConfig" - metadata_type: "OperationMetadata" - }; - } - - // Deletes the specified workstation configuration. - rpc DeleteWorkstationConfig(DeleteWorkstationConfigRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationConfig" - metadata_type: "OperationMetadata" - }; - } - - // Returns the requested workstation. - rpc GetWorkstation(GetWorkstationRequest) returns (Workstation) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns all Workstations using the specified workstation configuration. - rpc ListWorkstations(ListWorkstationsRequest) - returns (ListWorkstationsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns all workstations using the specified workstation configuration - // on which the caller has the "workstations.workstations.use" permission. - rpc ListUsableWorkstations(ListUsableWorkstationsRequest) - returns (ListUsableWorkstationsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations:listUsable" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new workstation. - rpc CreateWorkstation(CreateWorkstationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations" - body: "workstation" - }; - option (google.api.method_signature) = "parent,workstation,workstation_id"; - option (google.longrunning.operation_info) = { - response_type: "Workstation" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing workstation. - rpc UpdateWorkstation(UpdateWorkstationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{workstation.name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" - body: "workstation" - }; - option (google.api.method_signature) = "workstation,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Workstation" - metadata_type: "OperationMetadata" - }; - } - - // Deletes the specified workstation. - rpc DeleteWorkstation(DeleteWorkstationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "Workstation" - metadata_type: "OperationMetadata" - }; - } - - // Starts running a workstation so that users can connect to it. - rpc StartWorkstation(StartWorkstationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:start" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "Workstation" - metadata_type: "OperationMetadata" - }; - } - - // Stops running a workstation, reducing costs. - rpc StopWorkstation(StopWorkstationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:stop" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "Workstation" - metadata_type: "OperationMetadata" - }; - } - - // Returns a short-lived credential that can be used to send authenticated and - // authorized traffic to a workstation. - rpc GenerateAccessToken(GenerateAccessTokenRequest) - returns (GenerateAccessTokenResponse) { - option (google.api.http) = { - post: "/v1/{workstation=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:generateAccessToken" - body: "*" - }; - option (google.api.method_signature) = "workstation"; - } -} - -// A grouping of workstation configurations and the associated workstations -// in that region. -message WorkstationCluster { - option (google.api.resource) = { - type: "workstations.googleapis.com/WorkstationCluster" - pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}" - style: DECLARATIVE_FRIENDLY - }; - - // Configuration options for private clusters. - message PrivateClusterConfig { - // Immutable. Whether Workstations endpoint is private. - bool enable_private_endpoint = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. Hostname for the workstation cluster. This field will be - // populated only when private endpoint is enabled. To access workstations - // in the cluster, create a new DNS zone mapping this domain name to an - // internal IP address and a forwarding rule mapping that address to the - // service attachment. - string cluster_hostname = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Service attachment URI for the workstation cluster. The - // service attachemnt is created when private endpoint is enabled. To access - // workstations in the cluster, configure access to the managed service - // using [Private Service - // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-services). - string service_attachment_uri = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Additional projects that are allowed to attach to the workstation - // cluster's service attachment. By default, the workstation cluster's - // project and the VPC host project (if different) are allowed. - repeated string allowed_projects = 4; - } - - // Full name of this resource. - string name = 1; - - // Human-readable name for this resource. - string display_name = 2; - - // Output only. A system-assigned unique identified for this resource. - string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates whether this resource is currently being updated to - // match its intended state. - bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Client-specified annotations. - map annotations = 5; - - // Client-specified labels that are applied to the resource and that are also - // propagated to the underlying Compute Engine resources. - map labels = 15; - - // Output only. Time when this resource was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was most recently updated. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was soft-deleted. - google.protobuf.Timestamp delete_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Checksum computed by the server. May be sent on update and delete requests - // to make sure that the client has an up-to-date value before proceeding. - string etag = 9; - - // Immutable. Name of the Compute Engine network in which instances associated - // with this cluster will be created. - string network = 10 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Name of the Compute Engine subnetwork in which instances - // associated with this cluster will be created. Must be part of the - // subnetwork specified for this cluster. - string subnetwork = 11 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The private IP address of the control plane for this cluster. - // Workstation VMs need access to this IP address to work with the service, so - // make sure that your firewall rules allow egress from the workstation VMs to - // this address. - string control_plane_ip = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Configuration for private cluster. - PrivateClusterConfig private_cluster_config = 12; - - // Output only. Whether this resource is in degraded mode, in which case it - // may require user action to restore full functionality. Details can be found - // in the `conditions` field. - bool degraded = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Status conditions describing the current resource state. - repeated google.rpc.Status conditions = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A set of configuration options describing how a workstation will be run. -// Workstation configurations are intended to be shared across multiple -// workstations. -message WorkstationConfig { - option (google.api.resource) = { - type: "workstations.googleapis.com/WorkstationConfig" - pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}" - style: DECLARATIVE_FRIENDLY - }; - - // Runtime host for a workstation. - message Host { - // A runtime using a Compute Engine instance. - message GceInstance { - // A set of Compute Engine Shielded instance options. - message GceShieldedInstanceConfig { - // Whether the instance has Secure Boot enabled. - bool enable_secure_boot = 1; - - // Whether the instance has the vTPM enabled. - bool enable_vtpm = 2; - - // Whether the instance has integrity monitoring enabled. - bool enable_integrity_monitoring = 3; - } - - // A set of Compute Engine Confidential VM instance options. - message GceConfidentialInstanceConfig { - // Whether the instance has confidential compute enabled. - bool enable_confidential_compute = 1; - } - - // The name of a Compute Engine machine type. - string machine_type = 1; - - // Email address of the service account used on VM instances - // used to support this configuration. If not set, VMs run with a - // Google-managed service account. This service account must have - // permission to pull the specified container image; otherwise, the image - // must be publicly accessible. - string service_account = 2; - - // Network tags to add to the Compute Engine machines backing the - // Workstations. - repeated string tags = 4; - - // Number of instances to pool for faster workstation startup. - int32 pool_size = 5; - - // Output only. Number of instances currently available in the pool for - // faster workstation startup. - int32 pooled_instances = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Whether instances have no public IP address. - bool disable_public_ip_addresses = 6; - - // Whether to enable nested virtualization on instances. - bool enable_nested_virtualization = 7; - - // A set of Compute Engine Shielded instance options. - GceShieldedInstanceConfig shielded_instance_config = 8; - - // A set of Compute Engine Confidential VM instance options. - GceConfidentialInstanceConfig confidential_instance_config = 10; - - // Size of the boot disk in GB. Defaults to 50. - int32 boot_disk_size_gb = 9; - } - - // Type of host that will be used for the workstation's runtime. - oneof config { - // Specifies a Compute Engine instance as the host. - GceInstance gce_instance = 1; - } - } - - // A directory to persist across workstation sessions. - message PersistentDirectory { - // A PersistentDirectory backed by a Compute Engine regional persistent - // disk. - message GceRegionalPersistentDisk { - // Value representing what should happen to the disk after the workstation - // is deleted. - enum ReclaimPolicy { - // Do not use. - RECLAIM_POLICY_UNSPECIFIED = 0; - - // The persistent disk will be deleted with the workstation. - DELETE = 1; - - // The persistent disk will be remain after the workstation is deleted, - // and the administrator must manually delete the disk. - RETAIN = 2; - } - - // Size of the disk in GB. Must be empty if source_snapshot is set. - // Defaults to 200. - int32 size_gb = 1; - - // Type of file system that the disk should be formatted with. The - // workstation image must support this file system type. Must be empty - // if source_snapshot is set. Defaults to ext4. - string fs_type = 2; - - // Type of the disk to use. Defaults to pd-standard. - string disk_type = 3; - - // Name of the snapshot to use as the source for the disk. If set, - // size_gb and fs_type must be empty. - string source_snapshot = 5; - - // What should happen to the disk after the workstation is deleted. - // Defaults to DELETE. - ReclaimPolicy reclaim_policy = 4; - } - - // How a persistent directory should be implemented. - oneof directory_type { - // A PersistentDirectory backed by a Compute Engine persistent disk. - GceRegionalPersistentDisk gce_pd = 2; - } - - // Location of this directory in the running workstation. - string mount_path = 1; - } - - // A Docker container. - message Container { - // Docker image defining the container. This image must be accessible by the - // service account specified in the workstation configuration. - string image = 1; - - // If set, overrides the default ENTRYPOINT specified by the image. - repeated string command = 2; - - // Arguments passed to the entrypoint. - repeated string args = 3; - - // Environment variables passed to the container's entrypoint. - map env = 4; - - // If set, overrides the default DIR specified by the image. - string working_dir = 5; - - // If set, overrides the USER specified in the image with the given uid. - int32 run_as_user = 6; - } - - // A customer-managed encryption key for the Compute Engine resources - // of this workstation configuration. - message CustomerEncryptionKey { - // Immutable. The name of the Google Cloud KMS encryption key. For example, - // `projects/PROJECT_ID/locations/REGION/keyRings/KEY_RING/cryptoKeys/KEY_NAME`. - string kms_key = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. The service account to use with the specified - // KMS key. We recommend that you use a separate service account - // and follow KMS best practices. For more information, see - // [Separation of - // duties](https://cloud.google.com/kms/docs/separation-of-duties) and - // `gcloud kms keys add-iam-policy-binding` - // [`--member`](https://cloud.google.com/sdk/gcloud/reference/kms/keys/add-iam-policy-binding#--member). - string kms_key_service_account = 2 - [(google.api.field_behavior) = IMMUTABLE]; - } - - // Full name of this resource. - string name = 1; - - // Human-readable name for this resource. - string display_name = 2; - - // Output only. A system-assigned unique identified for this resource. - string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates whether this resource is currently being updated to - // match its intended state. - bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Client-specified annotations. - map annotations = 5; - - // Client-specified labels that are applied to the resource and that are also - // propagated to the underlying Compute Engine resources. - map labels = 18; - - // Output only. Time when this resource was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was most recently updated. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was soft-deleted. - google.protobuf.Timestamp delete_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Checksum computed by the server. May be sent on update and delete requests - // to make sure that the client has an up-to-date value before proceeding. - string etag = 9; - - // How long to wait before automatically stopping an instance that hasn't - // received any user traffic. A value of 0 indicates that this instance - // should never time out due to idleness. Defaults to 20 minutes. - google.protobuf.Duration idle_timeout = 10; - - // How long to wait before automatically stopping a workstation after it - // started. A value of 0 indicates that workstations using this configuration - // should never time out. Must be greater than 0 and less than 24 hours if - // encryption_key is set. Defaults to 12 hours. - google.protobuf.Duration running_timeout = 11; - - // Runtime host for the workstation. - Host host = 12; - - // Directories to persist across workstation sessions. - repeated PersistentDirectory persistent_directories = 13; - - // Container that will be run for each workstation using this configuration - // when that workstation is started. - Container container = 14; - - // Immutable. Encrypts resources of this workstation configuration using a - // customer-managed encryption key. - // - // If specified, the boot disk of the Compute Engine instance and the - // persistent disk are encrypted using this encryption key. If - // this field is not set, the disks are encrypted using a generated - // key. Customer-managed encryption keys do not protect disk metadata. - // - // If the customer-managed encryption key is rotated, when the workstation - // instance is stopped, the system attempts to recreate the - // persistent disk with the new version of the key. Be sure to keep - // older versions of the key until the persistent disk is recreated. - // Otherwise, data on the persistent disk will be lost. - // - // If the encryption key is revoked, the workstation session will - // automatically be stopped within 7 hours. - // - // Immutable after the workstation configuration is created. - CustomerEncryptionKey encryption_key = 17 - [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. Whether this resource is degraded, in which case it may - // require user action to restore full functionality. See also the - // `conditions` field. - bool degraded = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Status conditions describing the current resource state. - repeated google.rpc.Status conditions = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A single instance of a developer workstation with its own persistent storage. -message Workstation { - option (google.api.resource) = { - type: "workstations.googleapis.com/Workstation" - pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}/workstations/{workstation}" - style: DECLARATIVE_FRIENDLY - }; - - // Whether a workstation is running and ready to receive user requests. - enum State { - // Do not use. - STATE_UNSPECIFIED = 0; - - // The workstation is not yet ready to accept requests from users but will - // be soon. - STATE_STARTING = 1; - - // The workstation is ready to accept requests from users. - STATE_RUNNING = 2; - - // The workstation is being stopped. - STATE_STOPPING = 3; - - // The workstation is stopped and will not be able to receive requests until - // it is started. - STATE_STOPPED = 4; - } - - // Full name of this resource. - string name = 1; - - // Human-readable name for this resource. - string display_name = 2; - - // Output only. A system-assigned unique identified for this resource. - string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates whether this resource is currently being updated to - // match its intended state. - bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Client-specified annotations. - map annotations = 5; - - // Client-specified labels that are applied to the resource and that are also - // propagated to the underlying Compute Engine resources. - map labels = 13; - - // Output only. Time when this resource was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was most recently updated. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was soft-deleted. - google.protobuf.Timestamp delete_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Checksum computed by the server. May be sent on update and delete requests - // to make sure that the client has an up-to-date value before proceeding. - string etag = 9; - - // Output only. Current state of the workstation. - State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Host to which clients can send HTTPS traffic that will be - // received by the workstation. Authorized traffic will be received to the - // workstation as HTTP on port 80. To send traffic to a different port, - // clients may prefix the host with the destination port in the format - // `{port}-{host}`. - string host = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for GetWorkstationCluster. -message GetWorkstationClusterRequest { - // Required. Name of the requested resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationCluster" - } - ]; -} - -// Request message for ListWorkstationClusters. -message ListWorkstationClustersRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // Maximum number of items to return. - int32 page_size = 2; - - // next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for ListWorkstationClusters. -message ListWorkstationClustersResponse { - // The requested workstation clusters. - repeated WorkstationCluster workstation_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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Message for creating a CreateWorkstationCluster. -message CreateWorkstationClusterRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // Required. ID to use for the workstation cluster. - string workstation_cluster_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Workstation cluster to create. - WorkstationCluster workstation_cluster = 3 - [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 4; -} - -// Request message for UpdateWorkstationCluster. -message UpdateWorkstationClusterRequest { - // Required. Workstation cluster to update. - WorkstationCluster workstation_cluster = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Mask that specifies which fields in the workstation cluster - // should be updated. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 3; - - // If set, and the workstation cluster is not found, a new workstation - // cluster will be created. In this situation, update_mask is ignored. - bool allow_missing = 4; -} - -// Message for deleting a workstation cluster. -message DeleteWorkstationClusterRequest { - // Required. Name of the workstation cluster to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // If set, validate the request and preview the review, but do not apply it. - bool validate_only = 2; - - // If set, the request will be rejected if the latest version of the - // workstation cluster on the server does not have this ETag. - string etag = 3; - - // If set, any workstation configurations and workstations in the - // workstation cluster are also deleted. Otherwise, the request only - // works if the workstation cluster has no configurations or workstations. - bool force = 4; -} - -// Request message for GetWorkstationConfig. -message GetWorkstationConfigRequest { - // Required. Name of the requested resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationConfig" - } - ]; -} - -// Request message for ListWorkstationConfigs. -message ListWorkstationConfigsRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // Maximum number of items to return. - int32 page_size = 2; - - // next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for ListWorkstationConfigs. -message ListWorkstationConfigsResponse { - // The requested configs. - repeated WorkstationConfig workstation_configs = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Request message for ListUsableWorkstationConfigs. -message ListUsableWorkstationConfigsRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // Maximum number of items to return. - int32 page_size = 2; - - // next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for ListUsableWorkstationConfigs. -message ListUsableWorkstationConfigsResponse { - // The requested configs. - repeated WorkstationConfig workstation_configs = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Message for creating a CreateWorkstationConfig. -message CreateWorkstationConfigRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // Required. ID to use for the workstation configuration. - string workstation_config_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Config to create. - WorkstationConfig workstation_config = 3 - [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 4; -} - -// Request message for UpdateWorkstationConfig. -message UpdateWorkstationConfigRequest { - // Required. Config to update. - WorkstationConfig workstation_config = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Mask specifying which fields in the workstation configuration - // should be updated. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 3; - - // If set and the workstation configuration is not found, a new - // workstation configuration will be created. In this situation, - // update_mask is ignored. - bool allow_missing = 4; -} - -// Message for deleting a workstation configuration. -message DeleteWorkstationConfigRequest { - // Required. Name of the workstation configuration to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationConfig" - } - ]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 2; - - // If set, the request is rejected if the latest version of the - // workstation configuration on the server does not have this ETag. - string etag = 3; - - // If set, any workstations in the workstation configuration are also deleted. - // Otherwise, the request works only if the workstation configuration has - // no workstations. - bool force = 4; -} - -// Request message for GetWorkstation. -message GetWorkstationRequest { - // Required. Name of the requested resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/Workstation" - } - ]; -} - -// Request message for ListWorkstations. -message ListWorkstationsRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationConfig" - } - ]; - - // Maximum number of items to return. - int32 page_size = 2; - - // next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for ListWorkstations. -message ListWorkstationsResponse { - // The requested workstations. - repeated Workstation workstations = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Request message for ListUsableWorkstations. -message ListUsableWorkstationsRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationConfig" - } - ]; - - // Maximum number of items to return. - int32 page_size = 2; - - // next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for ListUsableWorkstations. -message ListUsableWorkstationsResponse { - // The requested workstations. - repeated Workstation workstations = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Message for creating a CreateWorkstation. -message CreateWorkstationRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationConfig" - } - ]; - - // Required. ID to use for the workstation. - string workstation_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Workstation to create. - Workstation workstation = 3 [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 4; -} - -// Request message for UpdateWorkstation. -message UpdateWorkstationRequest { - // Required. Workstation to update. - Workstation workstation = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Mask specifying which fields in the workstation configuration - // should be updated. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 3; - - // If set and the workstation configuration is not found, a new - // workstation configuration is created. In this situation, update_mask - // is ignored. - bool allow_missing = 4; -} - -// Request message for DeleteWorkstation. -message DeleteWorkstationRequest { - // Required. Name of the workstation to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/Workstation" - } - ]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 2; - - // If set, the request will be rejected if the latest version of the - // workstation on the server does not have this ETag. - string etag = 3; -} - -// Request message for StartWorkstation. -message StartWorkstationRequest { - // Required. Name of the workstation to start. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/Workstation" - } - ]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 2; - - // If set, the request will be rejected if the latest version of the - // workstation on the server does not have this ETag. - string etag = 3; -} - -// Request message for StopWorkstation. -message StopWorkstationRequest { - // Required. Name of the workstation to stop. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/Workstation" - } - ]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 2; - - // If set, the request will be rejected if the latest version of the - // workstation on the server does not have this ETag. - string etag = 3; -} - -// Request message for GenerateAccessToken. -message GenerateAccessTokenRequest { - // Desired expiration or lifetime of the access token. - oneof expiration { - // Desired expiration time of the access token. This value must - // be at most 24 hours in the future. If a value is not specified, the - // token's expiration time will be set to a default value of 1 hour in the - // future. - google.protobuf.Timestamp expire_time = 2; - - // Desired lifetime duration of the access token. This value must - // be at most 24 hours. If a value is not specified, the token's lifetime - // will be set to a default value of 1 hour. - google.protobuf.Duration ttl = 3; - } - - // Required. Name of the workstation for which the access token should be - // generated. - string workstation = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/Workstation" - } - ]; -} - -// Response message for GenerateAccessToken. -message GenerateAccessTokenResponse { - // The generated bearer access token. To use this token, include it in an - // Authorization header of an HTTP request sent to the associated - // workstation's hostname—for example, `Authorization: Bearer - // `. - string access_token = 1; - - // Time at which the generated token will expire. - google.protobuf.Timestamp expire_time = 2; -} - -// Metadata for long-running operations. -message OperationMetadata { - // Output only. Time that the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time that 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. - 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-workstations/v1/samples/generated/v1/snippet_metadata_google.cloud.workstations.v1.json b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/snippet_metadata_google.cloud.workstations.v1.json deleted file mode 100644 index d03d881f904..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/snippet_metadata_google.cloud.workstations.v1.json +++ /dev/null @@ -1,983 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-workstations", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.workstations.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "workstations_v1_generated_Workstations_GetWorkstationCluster_async", - "title": "Workstations getWorkstationCluster Sample", - "origin": "API_DEFINITION", - "description": " Returns the requested workstation cluster.", - "canonical": true, - "file": "workstations.get_workstation_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkstationCluster", - "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstationCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1.WorkstationCluster", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "GetWorkstationCluster", - "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstationCluster", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_ListWorkstationClusters_async", - "title": "Workstations listWorkstationClusters Sample", - "origin": "API_DEFINITION", - "description": " Returns all workstation clusters in the specified location.", - "canonical": true, - "file": "workstations.list_workstation_clusters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkstationClusters", - "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstationClusters", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1.ListWorkstationClustersResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "ListWorkstationClusters", - "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstationClusters", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_CreateWorkstationCluster_async", - "title": "Workstations createWorkstationCluster Sample", - "origin": "API_DEFINITION", - "description": " Creates a new workstation cluster.", - "canonical": true, - "file": "workstations.create_workstation_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkstationCluster", - "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstationCluster", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "workstation_cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "workstation_cluster", - "type": ".google.cloud.workstations.v1.WorkstationCluster" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "CreateWorkstationCluster", - "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstationCluster", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_UpdateWorkstationCluster_async", - "title": "Workstations updateWorkstationCluster Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing workstation cluster.", - "canonical": true, - "file": "workstations.update_workstation_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkstationCluster", - "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstationCluster", - "async": true, - "parameters": [ - { - "name": "workstation_cluster", - "type": ".google.cloud.workstations.v1.WorkstationCluster" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "UpdateWorkstationCluster", - "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstationCluster", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_DeleteWorkstationCluster_async", - "title": "Workstations deleteWorkstationCluster Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified workstation cluster.", - "canonical": true, - "file": "workstations.delete_workstation_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkstationCluster", - "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstationCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "DeleteWorkstationCluster", - "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstationCluster", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_GetWorkstationConfig_async", - "title": "Workstations getWorkstationConfig Sample", - "origin": "API_DEFINITION", - "description": " Returns the requested workstation configuration.", - "canonical": true, - "file": "workstations.get_workstation_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkstationConfig", - "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1.WorkstationConfig", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "GetWorkstationConfig", - "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstationConfig", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_ListWorkstationConfigs_async", - "title": "Workstations listWorkstationConfigs Sample", - "origin": "API_DEFINITION", - "description": " Returns all workstation configurations in the specified cluster.", - "canonical": true, - "file": "workstations.list_workstation_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkstationConfigs", - "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstationConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1.ListWorkstationConfigsResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "ListWorkstationConfigs", - "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstationConfigs", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_ListUsableWorkstationConfigs_async", - "title": "Workstations listUsableWorkstationConfigs Sample", - "origin": "API_DEFINITION", - "description": " Returns all workstation configurations in the specified cluster on which the caller has the \"workstations.workstation.create\" permission.", - "canonical": true, - "file": "workstations.list_usable_workstation_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListUsableWorkstationConfigs", - "fullName": "google.cloud.workstations.v1.Workstations.ListUsableWorkstationConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1.ListUsableWorkstationConfigsResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "ListUsableWorkstationConfigs", - "fullName": "google.cloud.workstations.v1.Workstations.ListUsableWorkstationConfigs", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_CreateWorkstationConfig_async", - "title": "Workstations createWorkstationConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a new workstation configuration.", - "canonical": true, - "file": "workstations.create_workstation_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkstationConfig", - "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstationConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "workstation_config_id", - "type": "TYPE_STRING" - }, - { - "name": "workstation_config", - "type": ".google.cloud.workstations.v1.WorkstationConfig" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "CreateWorkstationConfig", - "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstationConfig", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_UpdateWorkstationConfig_async", - "title": "Workstations updateWorkstationConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing workstation configuration.", - "canonical": true, - "file": "workstations.update_workstation_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkstationConfig", - "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstationConfig", - "async": true, - "parameters": [ - { - "name": "workstation_config", - "type": ".google.cloud.workstations.v1.WorkstationConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "UpdateWorkstationConfig", - "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstationConfig", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_DeleteWorkstationConfig_async", - "title": "Workstations deleteWorkstationConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified workstation configuration.", - "canonical": true, - "file": "workstations.delete_workstation_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkstationConfig", - "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "DeleteWorkstationConfig", - "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstationConfig", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_GetWorkstation_async", - "title": "Workstations getWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Returns the requested workstation.", - "canonical": true, - "file": "workstations.get_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1.Workstation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "GetWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.GetWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_ListWorkstations_async", - "title": "Workstations listWorkstations Sample", - "origin": "API_DEFINITION", - "description": " Returns all Workstations using the specified workstation configuration.", - "canonical": true, - "file": "workstations.list_workstations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkstations", - "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1.ListWorkstationsResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "ListWorkstations", - "fullName": "google.cloud.workstations.v1.Workstations.ListWorkstations", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_ListUsableWorkstations_async", - "title": "Workstations listUsableWorkstations Sample", - "origin": "API_DEFINITION", - "description": " Returns all workstations using the specified workstation configuration on which the caller has the \"workstations.workstations.use\" permission.", - "canonical": true, - "file": "workstations.list_usable_workstations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListUsableWorkstations", - "fullName": "google.cloud.workstations.v1.Workstations.ListUsableWorkstations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1.ListUsableWorkstationsResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "ListUsableWorkstations", - "fullName": "google.cloud.workstations.v1.Workstations.ListUsableWorkstations", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_CreateWorkstation_async", - "title": "Workstations createWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Creates a new workstation.", - "canonical": true, - "file": "workstations.create_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "workstation_id", - "type": "TYPE_STRING" - }, - { - "name": "workstation", - "type": ".google.cloud.workstations.v1.Workstation" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "CreateWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.CreateWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_UpdateWorkstation_async", - "title": "Workstations updateWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing workstation.", - "canonical": true, - "file": "workstations.update_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstation", - "async": true, - "parameters": [ - { - "name": "workstation", - "type": ".google.cloud.workstations.v1.Workstation" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "UpdateWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.UpdateWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_DeleteWorkstation_async", - "title": "Workstations deleteWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified workstation.", - "canonical": true, - "file": "workstations.delete_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "DeleteWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.DeleteWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_StartWorkstation_async", - "title": "Workstations startWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Starts running a workstation so that users can connect to it.", - "canonical": true, - "file": "workstations.start_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.StartWorkstation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "StartWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.StartWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_StopWorkstation_async", - "title": "Workstations stopWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Stops running a workstation, reducing costs.", - "canonical": true, - "file": "workstations.stop_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.StopWorkstation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "StopWorkstation", - "fullName": "google.cloud.workstations.v1.Workstations.StopWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1_generated_Workstations_GenerateAccessToken_async", - "title": "Workstations generateAccessToken Sample", - "origin": "API_DEFINITION", - "description": " Returns a short-lived credential that can be used to send authenticated and authorized traffic to a workstation.", - "canonical": true, - "file": "workstations.generate_access_token.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateAccessToken", - "fullName": "google.cloud.workstations.v1.Workstations.GenerateAccessToken", - "async": true, - "parameters": [ - { - "name": "expire_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "ttl", - "type": ".google.protobuf.Duration" - }, - { - "name": "workstation", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1.GenerateAccessTokenResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1.WorkstationsClient" - }, - "method": { - "shortName": "GenerateAccessToken", - "fullName": "google.cloud.workstations.v1.Workstations.GenerateAccessToken", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1.Workstations" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation.js deleted file mode 100644 index a81d5dbadd8..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation.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, workstationId, workstation) { - // [START workstations_v1_generated_Workstations_CreateWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Required. ID to use for the workstation. - */ - // const workstationId = 'abc123' - /** - * Required. Workstation to create. - */ - // const workstation = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callCreateWorkstation() { - // Construct request - const request = { - parent, - workstationId, - workstation, - }; - - // Run request - const [operation] = await workstationsClient.createWorkstation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateWorkstation(); - // [END workstations_v1_generated_Workstations_CreateWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_cluster.js deleted file mode 100644 index 21b02bbd7c5..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_cluster.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, workstationClusterId, workstationCluster) { - // [START workstations_v1_generated_Workstations_CreateWorkstationCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Required. ID to use for the workstation cluster. - */ - // const workstationClusterId = 'abc123' - /** - * Required. Workstation cluster to create. - */ - // const workstationCluster = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callCreateWorkstationCluster() { - // Construct request - const request = { - parent, - workstationClusterId, - workstationCluster, - }; - - // Run request - const [operation] = await workstationsClient.createWorkstationCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateWorkstationCluster(); - // [END workstations_v1_generated_Workstations_CreateWorkstationCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_config.js deleted file mode 100644 index 33c9e27bda5..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.create_workstation_config.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, workstationConfigId, workstationConfig) { - // [START workstations_v1_generated_Workstations_CreateWorkstationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Required. ID to use for the workstation configuration. - */ - // const workstationConfigId = 'abc123' - /** - * Required. Config to create. - */ - // const workstationConfig = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callCreateWorkstationConfig() { - // Construct request - const request = { - parent, - workstationConfigId, - workstationConfig, - }; - - // Run request - const [operation] = await workstationsClient.createWorkstationConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateWorkstationConfig(); - // [END workstations_v1_generated_Workstations_CreateWorkstationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation.js deleted file mode 100644 index 5e3cb409309..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation.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) { - // [START workstations_v1_generated_Workstations_DeleteWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workstation to delete. - */ - // const name = 'abc123' - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this ETag. - */ - // const etag = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callDeleteWorkstation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workstationsClient.deleteWorkstation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteWorkstation(); - // [END workstations_v1_generated_Workstations_DeleteWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_cluster.js deleted file mode 100644 index 9b25cc73f57..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_cluster.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 workstations_v1_generated_Workstations_DeleteWorkstationCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workstation cluster to delete. - */ - // const name = 'abc123' - /** - * If set, validate the request and preview the review, but do not apply it. - */ - // const validateOnly = true - /** - * If set, the request will be rejected if the latest version of the - * workstation cluster on the server does not have this ETag. - */ - // const etag = 'abc123' - /** - * If set, any workstation configurations and workstations in the - * workstation cluster are also deleted. Otherwise, the request only - * works if the workstation cluster has no configurations or workstations. - */ - // const force = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callDeleteWorkstationCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workstationsClient.deleteWorkstationCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteWorkstationCluster(); - // [END workstations_v1_generated_Workstations_DeleteWorkstationCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_config.js deleted file mode 100644 index e97506ccfd9..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.delete_workstation_config.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(name) { - // [START workstations_v1_generated_Workstations_DeleteWorkstationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workstation configuration to delete. - */ - // const name = 'abc123' - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set, the request is rejected if the latest version of the - * workstation configuration on the server does not have this ETag. - */ - // const etag = 'abc123' - /** - * If set, any workstations in the workstation configuration are also deleted. - * Otherwise, the request works only if the workstation configuration has - * no workstations. - */ - // const force = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callDeleteWorkstationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workstationsClient.deleteWorkstationConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteWorkstationConfig(); - // [END workstations_v1_generated_Workstations_DeleteWorkstationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.generate_access_token.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.generate_access_token.js deleted file mode 100644 index 84a042a8964..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.generate_access_token.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(workstation) { - // [START workstations_v1_generated_Workstations_GenerateAccessToken_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Desired expiration time of the access token. This value must - * be at most 24 hours in the future. If a value is not specified, the - * token's expiration time will be set to a default value of 1 hour in the - * future. - */ - // const expireTime = {} - /** - * Desired lifetime duration of the access token. This value must - * be at most 24 hours. If a value is not specified, the token's lifetime - * will be set to a default value of 1 hour. - */ - // const ttl = {} - /** - * Required. Name of the workstation for which the access token should be - * generated. - */ - // const workstation = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callGenerateAccessToken() { - // Construct request - const request = { - workstation, - }; - - // Run request - const response = await workstationsClient.generateAccessToken(request); - console.log(response); - } - - callGenerateAccessToken(); - // [END workstations_v1_generated_Workstations_GenerateAccessToken_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation.js deleted file mode 100644 index 44fd5c9394e..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation.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 workstations_v1_generated_Workstations_GetWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 requested resource. - */ - // const name = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callGetWorkstation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await workstationsClient.getWorkstation(request); - console.log(response); - } - - callGetWorkstation(); - // [END workstations_v1_generated_Workstations_GetWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_cluster.js deleted file mode 100644 index af52420b163..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_cluster.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 workstations_v1_generated_Workstations_GetWorkstationCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 requested resource. - */ - // const name = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callGetWorkstationCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await workstationsClient.getWorkstationCluster(request); - console.log(response); - } - - callGetWorkstationCluster(); - // [END workstations_v1_generated_Workstations_GetWorkstationCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_config.js deleted file mode 100644 index 6e3e86070fd..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.get_workstation_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 workstations_v1_generated_Workstations_GetWorkstationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 requested resource. - */ - // const name = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callGetWorkstationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await workstationsClient.getWorkstationConfig(request); - console.log(response); - } - - callGetWorkstationConfig(); - // [END workstations_v1_generated_Workstations_GetWorkstationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstation_configs.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstation_configs.js deleted file mode 100644 index e4393f0e08b..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstation_configs.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(parent) { - // [START workstations_v1_generated_Workstations_ListUsableWorkstationConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Maximum number of items to return. - */ - // const pageSize = 1234 - /** - * next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callListUsableWorkstationConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workstationsClient.listUsableWorkstationConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListUsableWorkstationConfigs(); - // [END workstations_v1_generated_Workstations_ListUsableWorkstationConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstations.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstations.js deleted file mode 100644 index d3f09434d14..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_usable_workstations.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(parent) { - // [START workstations_v1_generated_Workstations_ListUsableWorkstations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Maximum number of items to return. - */ - // const pageSize = 1234 - /** - * next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callListUsableWorkstations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workstationsClient.listUsableWorkstationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListUsableWorkstations(); - // [END workstations_v1_generated_Workstations_ListUsableWorkstations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_clusters.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_clusters.js deleted file mode 100644 index d46b9ee5fc8..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_clusters.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(parent) { - // [START workstations_v1_generated_Workstations_ListWorkstationClusters_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Maximum number of items to return. - */ - // const pageSize = 1234 - /** - * next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callListWorkstationClusters() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workstationsClient.listWorkstationClustersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListWorkstationClusters(); - // [END workstations_v1_generated_Workstations_ListWorkstationClusters_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_configs.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_configs.js deleted file mode 100644 index f26affab431..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstation_configs.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(parent) { - // [START workstations_v1_generated_Workstations_ListWorkstationConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Maximum number of items to return. - */ - // const pageSize = 1234 - /** - * next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callListWorkstationConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workstationsClient.listWorkstationConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListWorkstationConfigs(); - // [END workstations_v1_generated_Workstations_ListWorkstationConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstations.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstations.js deleted file mode 100644 index 78be2ba4e2b..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.list_workstations.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(parent) { - // [START workstations_v1_generated_Workstations_ListWorkstations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Maximum number of items to return. - */ - // const pageSize = 1234 - /** - * next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callListWorkstations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workstationsClient.listWorkstationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListWorkstations(); - // [END workstations_v1_generated_Workstations_ListWorkstations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.start_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.start_workstation.js deleted file mode 100644 index dd5a70e0bb0..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.start_workstation.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) { - // [START workstations_v1_generated_Workstations_StartWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workstation to start. - */ - // const name = 'abc123' - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this ETag. - */ - // const etag = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callStartWorkstation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workstationsClient.startWorkstation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callStartWorkstation(); - // [END workstations_v1_generated_Workstations_StartWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.stop_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.stop_workstation.js deleted file mode 100644 index 2c33aeaecb9..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.stop_workstation.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) { - // [START workstations_v1_generated_Workstations_StopWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workstation to stop. - */ - // const name = 'abc123' - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this ETag. - */ - // const etag = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callStopWorkstation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workstationsClient.stopWorkstation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callStopWorkstation(); - // [END workstations_v1_generated_Workstations_StopWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation.js deleted file mode 100644 index 5f69359861f..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation.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(workstation, updateMask) { - // [START workstations_v1_generated_Workstations_UpdateWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Workstation to update. - */ - // const workstation = {} - /** - * Required. Mask specifying which fields in the workstation configuration - * should be updated. - */ - // const updateMask = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set and the workstation configuration is not found, a new - * workstation configuration is created. In this situation, update_mask - * is ignored. - */ - // const allowMissing = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callUpdateWorkstation() { - // Construct request - const request = { - workstation, - updateMask, - }; - - // Run request - const [operation] = await workstationsClient.updateWorkstation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateWorkstation(); - // [END workstations_v1_generated_Workstations_UpdateWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_cluster.js deleted file mode 100644 index 9a27e3ef296..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_cluster.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(workstationCluster, updateMask) { - // [START workstations_v1_generated_Workstations_UpdateWorkstationCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Workstation cluster to update. - */ - // const workstationCluster = {} - /** - * Required. Mask that specifies which fields in the workstation cluster - * should be updated. - */ - // const updateMask = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set, and the workstation cluster is not found, a new workstation - * cluster will be created. In this situation, update_mask is ignored. - */ - // const allowMissing = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callUpdateWorkstationCluster() { - // Construct request - const request = { - workstationCluster, - updateMask, - }; - - // Run request - const [operation] = await workstationsClient.updateWorkstationCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateWorkstationCluster(); - // [END workstations_v1_generated_Workstations_UpdateWorkstationCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_config.js deleted file mode 100644 index b9213a81e2b..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/samples/generated/v1/workstations.update_workstation_config.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(workstationConfig, updateMask) { - // [START workstations_v1_generated_Workstations_UpdateWorkstationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Config to update. - */ - // const workstationConfig = {} - /** - * Required. Mask specifying which fields in the workstation configuration - * should be updated. - */ - // const updateMask = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set and the workstation configuration is not found, a new - * workstation configuration will be created. In this situation, - * update_mask is ignored. - */ - // const allowMissing = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callUpdateWorkstationConfig() { - // Construct request - const request = { - workstationConfig, - updateMask, - }; - - // Run request - const [operation] = await workstationsClient.updateWorkstationConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateWorkstationConfig(); - // [END workstations_v1_generated_Workstations_UpdateWorkstationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1/src/index.ts b/owl-bot-staging/google-cloud-workstations/v1/src/index.ts deleted file mode 100644 index dbc99d055ad..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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 WorkstationsClient = v1.WorkstationsClient; -type WorkstationsClient = v1.WorkstationsClient; -export {v1, WorkstationsClient}; -export default {v1, WorkstationsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-workstations/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-workstations/v1/src/v1/gapic_metadata.json deleted file mode 100644 index aad5c9cc0d2..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.workstations.v1", - "libraryPackage": "@google-cloud/workstations", - "services": { - "Workstations": { - "clients": { - "grpc": { - "libraryClient": "WorkstationsClient", - "rpcs": { - "GetWorkstationCluster": { - "methods": [ - "getWorkstationCluster" - ] - }, - "GetWorkstationConfig": { - "methods": [ - "getWorkstationConfig" - ] - }, - "GetWorkstation": { - "methods": [ - "getWorkstation" - ] - }, - "GenerateAccessToken": { - "methods": [ - "generateAccessToken" - ] - }, - "CreateWorkstationCluster": { - "methods": [ - "createWorkstationCluster" - ] - }, - "UpdateWorkstationCluster": { - "methods": [ - "updateWorkstationCluster" - ] - }, - "DeleteWorkstationCluster": { - "methods": [ - "deleteWorkstationCluster" - ] - }, - "CreateWorkstationConfig": { - "methods": [ - "createWorkstationConfig" - ] - }, - "UpdateWorkstationConfig": { - "methods": [ - "updateWorkstationConfig" - ] - }, - "DeleteWorkstationConfig": { - "methods": [ - "deleteWorkstationConfig" - ] - }, - "CreateWorkstation": { - "methods": [ - "createWorkstation" - ] - }, - "UpdateWorkstation": { - "methods": [ - "updateWorkstation" - ] - }, - "DeleteWorkstation": { - "methods": [ - "deleteWorkstation" - ] - }, - "StartWorkstation": { - "methods": [ - "startWorkstation" - ] - }, - "StopWorkstation": { - "methods": [ - "stopWorkstation" - ] - }, - "ListWorkstationClusters": { - "methods": [ - "listWorkstationClusters", - "listWorkstationClustersStream", - "listWorkstationClustersAsync" - ] - }, - "ListWorkstationConfigs": { - "methods": [ - "listWorkstationConfigs", - "listWorkstationConfigsStream", - "listWorkstationConfigsAsync" - ] - }, - "ListUsableWorkstationConfigs": { - "methods": [ - "listUsableWorkstationConfigs", - "listUsableWorkstationConfigsStream", - "listUsableWorkstationConfigsAsync" - ] - }, - "ListWorkstations": { - "methods": [ - "listWorkstations", - "listWorkstationsStream", - "listWorkstationsAsync" - ] - }, - "ListUsableWorkstations": { - "methods": [ - "listUsableWorkstations", - "listUsableWorkstationsStream", - "listUsableWorkstationsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WorkstationsClient", - "rpcs": { - "GetWorkstationCluster": { - "methods": [ - "getWorkstationCluster" - ] - }, - "GetWorkstationConfig": { - "methods": [ - "getWorkstationConfig" - ] - }, - "GetWorkstation": { - "methods": [ - "getWorkstation" - ] - }, - "GenerateAccessToken": { - "methods": [ - "generateAccessToken" - ] - }, - "CreateWorkstationCluster": { - "methods": [ - "createWorkstationCluster" - ] - }, - "UpdateWorkstationCluster": { - "methods": [ - "updateWorkstationCluster" - ] - }, - "DeleteWorkstationCluster": { - "methods": [ - "deleteWorkstationCluster" - ] - }, - "CreateWorkstationConfig": { - "methods": [ - "createWorkstationConfig" - ] - }, - "UpdateWorkstationConfig": { - "methods": [ - "updateWorkstationConfig" - ] - }, - "DeleteWorkstationConfig": { - "methods": [ - "deleteWorkstationConfig" - ] - }, - "CreateWorkstation": { - "methods": [ - "createWorkstation" - ] - }, - "UpdateWorkstation": { - "methods": [ - "updateWorkstation" - ] - }, - "DeleteWorkstation": { - "methods": [ - "deleteWorkstation" - ] - }, - "StartWorkstation": { - "methods": [ - "startWorkstation" - ] - }, - "StopWorkstation": { - "methods": [ - "stopWorkstation" - ] - }, - "ListWorkstationClusters": { - "methods": [ - "listWorkstationClusters", - "listWorkstationClustersStream", - "listWorkstationClustersAsync" - ] - }, - "ListWorkstationConfigs": { - "methods": [ - "listWorkstationConfigs", - "listWorkstationConfigsStream", - "listWorkstationConfigsAsync" - ] - }, - "ListUsableWorkstationConfigs": { - "methods": [ - "listUsableWorkstationConfigs", - "listUsableWorkstationConfigsStream", - "listUsableWorkstationConfigsAsync" - ] - }, - "ListWorkstations": { - "methods": [ - "listWorkstations", - "listWorkstationsStream", - "listWorkstationsAsync" - ] - }, - "ListUsableWorkstations": { - "methods": [ - "listUsableWorkstations", - "listUsableWorkstationsStream", - "listUsableWorkstationsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workstations/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-workstations/v1/src/v1/index.ts deleted file mode 100644 index 8fd62185321..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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 {WorkstationsClient} from './workstations_client'; diff --git a/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client.ts b/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client.ts deleted file mode 100644 index ffff24e033f..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client.ts +++ /dev/null @@ -1,3315 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/workstations_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './workstations_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for interacting with Cloud Workstations. - * @class - * @memberof v1 - */ -export class WorkstationsClient { - 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; - workstationsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WorkstationsClient. - * - * @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 WorkstationsClient({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 WorkstationsClient; - 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}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - workstationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}/workstations/{workstation}' - ), - workstationClusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}' - ), - workstationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listWorkstationClusters: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationClusters'), - listWorkstationConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationConfigs'), - listUsableWorkstationConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationConfigs'), - listWorkstations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstations'), - listUsableWorkstations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstations') - }; - - 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.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}: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 createWorkstationClusterResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.WorkstationCluster') as gax.protobuf.Type; - const createWorkstationClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; - const updateWorkstationClusterResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.WorkstationCluster') as gax.protobuf.Type; - const updateWorkstationClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; - const deleteWorkstationClusterResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.WorkstationCluster') as gax.protobuf.Type; - const deleteWorkstationClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; - const createWorkstationConfigResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.WorkstationConfig') as gax.protobuf.Type; - const createWorkstationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; - const updateWorkstationConfigResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.WorkstationConfig') as gax.protobuf.Type; - const updateWorkstationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; - const deleteWorkstationConfigResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.WorkstationConfig') as gax.protobuf.Type; - const deleteWorkstationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; - const createWorkstationResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.Workstation') as gax.protobuf.Type; - const createWorkstationMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; - const updateWorkstationResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.Workstation') as gax.protobuf.Type; - const updateWorkstationMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; - const deleteWorkstationResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.Workstation') as gax.protobuf.Type; - const deleteWorkstationMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; - const startWorkstationResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.Workstation') as gax.protobuf.Type; - const startWorkstationMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; - const stopWorkstationResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.Workstation') as gax.protobuf.Type; - const stopWorkstationMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createWorkstationCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createWorkstationClusterResponse.decode.bind(createWorkstationClusterResponse), - createWorkstationClusterMetadata.decode.bind(createWorkstationClusterMetadata)), - updateWorkstationCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateWorkstationClusterResponse.decode.bind(updateWorkstationClusterResponse), - updateWorkstationClusterMetadata.decode.bind(updateWorkstationClusterMetadata)), - deleteWorkstationCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteWorkstationClusterResponse.decode.bind(deleteWorkstationClusterResponse), - deleteWorkstationClusterMetadata.decode.bind(deleteWorkstationClusterMetadata)), - createWorkstationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createWorkstationConfigResponse.decode.bind(createWorkstationConfigResponse), - createWorkstationConfigMetadata.decode.bind(createWorkstationConfigMetadata)), - updateWorkstationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateWorkstationConfigResponse.decode.bind(updateWorkstationConfigResponse), - updateWorkstationConfigMetadata.decode.bind(updateWorkstationConfigMetadata)), - deleteWorkstationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteWorkstationConfigResponse.decode.bind(deleteWorkstationConfigResponse), - deleteWorkstationConfigMetadata.decode.bind(deleteWorkstationConfigMetadata)), - createWorkstation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createWorkstationResponse.decode.bind(createWorkstationResponse), - createWorkstationMetadata.decode.bind(createWorkstationMetadata)), - updateWorkstation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateWorkstationResponse.decode.bind(updateWorkstationResponse), - updateWorkstationMetadata.decode.bind(updateWorkstationMetadata)), - deleteWorkstation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteWorkstationResponse.decode.bind(deleteWorkstationResponse), - deleteWorkstationMetadata.decode.bind(deleteWorkstationMetadata)), - startWorkstation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - startWorkstationResponse.decode.bind(startWorkstationResponse), - startWorkstationMetadata.decode.bind(startWorkstationMetadata)), - stopWorkstation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - stopWorkstationResponse.decode.bind(stopWorkstationResponse), - stopWorkstationMetadata.decode.bind(stopWorkstationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workstations.v1.Workstations', 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.workstationsStub) { - return this.workstationsStub; - } - - // Put together the "service stub" for - // google.cloud.workstations.v1.Workstations. - this.workstationsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workstations.v1.Workstations') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.workstations.v1.Workstations, - 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 workstationsStubMethods = - ['getWorkstationCluster', 'listWorkstationClusters', 'createWorkstationCluster', 'updateWorkstationCluster', 'deleteWorkstationCluster', 'getWorkstationConfig', 'listWorkstationConfigs', 'listUsableWorkstationConfigs', 'createWorkstationConfig', 'updateWorkstationConfig', 'deleteWorkstationConfig', 'getWorkstation', 'listWorkstations', 'listUsableWorkstations', 'createWorkstation', 'updateWorkstation', 'deleteWorkstation', 'startWorkstation', 'stopWorkstation', 'generateAccessToken']; - for (const methodName of workstationsStubMethods) { - const callPromise = this.workstationsStub.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.workstationsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'workstations.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 'workstations.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 the requested workstation cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the requested 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.workstations.v1.WorkstationCluster|WorkstationCluster}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.get_workstation_cluster.js - * region_tag:workstations_v1_generated_Workstations_GetWorkstationCluster_async - */ - getWorkstationCluster( - request?: protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstationCluster, - protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|undefined, {}|undefined - ]>; - getWorkstationCluster( - request: protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workstations.v1.IWorkstationCluster, - protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|null|undefined, - {}|null|undefined>): void; - getWorkstationCluster( - request: protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest, - callback: Callback< - protos.google.cloud.workstations.v1.IWorkstationCluster, - protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|null|undefined, - {}|null|undefined>): void; - getWorkstationCluster( - request?: protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workstations.v1.IWorkstationCluster, - protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workstations.v1.IWorkstationCluster, - protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstationCluster, - protos.google.cloud.workstations.v1.IGetWorkstationClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getWorkstationCluster(request, options, callback); - } -/** - * Returns the requested workstation configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the requested 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.workstations.v1.WorkstationConfig|WorkstationConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.get_workstation_config.js - * region_tag:workstations_v1_generated_Workstations_GetWorkstationConfig_async - */ - getWorkstationConfig( - request?: protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstationConfig, - protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|undefined, {}|undefined - ]>; - getWorkstationConfig( - request: protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workstations.v1.IWorkstationConfig, - protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|null|undefined, - {}|null|undefined>): void; - getWorkstationConfig( - request: protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest, - callback: Callback< - protos.google.cloud.workstations.v1.IWorkstationConfig, - protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|null|undefined, - {}|null|undefined>): void; - getWorkstationConfig( - request?: protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workstations.v1.IWorkstationConfig, - protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workstations.v1.IWorkstationConfig, - protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstationConfig, - protos.google.cloud.workstations.v1.IGetWorkstationConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getWorkstationConfig(request, options, callback); - } -/** - * Returns the requested workstation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the requested 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.workstations.v1.Workstation|Workstation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.get_workstation.js - * region_tag:workstations_v1_generated_Workstations_GetWorkstation_async - */ - getWorkstation( - request?: protos.google.cloud.workstations.v1.IGetWorkstationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstation, - protos.google.cloud.workstations.v1.IGetWorkstationRequest|undefined, {}|undefined - ]>; - getWorkstation( - request: protos.google.cloud.workstations.v1.IGetWorkstationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workstations.v1.IWorkstation, - protos.google.cloud.workstations.v1.IGetWorkstationRequest|null|undefined, - {}|null|undefined>): void; - getWorkstation( - request: protos.google.cloud.workstations.v1.IGetWorkstationRequest, - callback: Callback< - protos.google.cloud.workstations.v1.IWorkstation, - protos.google.cloud.workstations.v1.IGetWorkstationRequest|null|undefined, - {}|null|undefined>): void; - getWorkstation( - request?: protos.google.cloud.workstations.v1.IGetWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workstations.v1.IWorkstation, - protos.google.cloud.workstations.v1.IGetWorkstationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workstations.v1.IWorkstation, - protos.google.cloud.workstations.v1.IGetWorkstationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstation, - protos.google.cloud.workstations.v1.IGetWorkstationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getWorkstation(request, options, callback); - } -/** - * Returns a short-lived credential that can be used to send authenticated and - * authorized traffic to a workstation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Timestamp} request.expireTime - * Desired expiration time of the access token. This value must - * be at most 24 hours in the future. If a value is not specified, the - * token's expiration time will be set to a default value of 1 hour in the - * future. - * @param {google.protobuf.Duration} request.ttl - * Desired lifetime duration of the access token. This value must - * be at most 24 hours. If a value is not specified, the token's lifetime - * will be set to a default value of 1 hour. - * @param {string} request.workstation - * Required. Name of the workstation for which the access token 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.workstations.v1.GenerateAccessTokenResponse|GenerateAccessTokenResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.generate_access_token.js - * region_tag:workstations_v1_generated_Workstations_GenerateAccessToken_async - */ - generateAccessToken( - request?: protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|undefined, {}|undefined - ]>; - generateAccessToken( - request: protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>): void; - generateAccessToken( - request: protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest, - callback: Callback< - protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>): void; - generateAccessToken( - request?: protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1.IGenerateAccessTokenRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workstation': request.workstation ?? '', - }); - this.initialize(); - return this.innerApiCalls.generateAccessToken(request, options, callback); - } - -/** - * Creates a new workstation cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {string} request.workstationClusterId - * Required. ID to use for the workstation cluster. - * @param {google.cloud.workstations.v1.WorkstationCluster} request.workstationCluster - * Required. Workstation cluster to create. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.create_workstation_cluster.js - * region_tag:workstations_v1_generated_Workstations_CreateWorkstationCluster_async - */ - createWorkstationCluster( - request?: protos.google.cloud.workstations.v1.ICreateWorkstationClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createWorkstationCluster( - request: protos.google.cloud.workstations.v1.ICreateWorkstationClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstationCluster( - request: protos.google.cloud.workstations.v1.ICreateWorkstationClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstationCluster( - request?: protos.google.cloud.workstations.v1.ICreateWorkstationClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createWorkstationCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createWorkstationCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.create_workstation_cluster.js - * region_tag:workstations_v1_generated_Workstations_CreateWorkstationCluster_async - */ - async checkCreateWorkstationClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing workstation cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workstations.v1.WorkstationCluster} request.workstationCluster - * Required. Workstation cluster to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask that specifies which fields in the workstation cluster - * should be updated. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {boolean} request.allowMissing - * If set, and the workstation cluster is not found, a new workstation - * cluster will be created. In this situation, update_mask is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.update_workstation_cluster.js - * region_tag:workstations_v1_generated_Workstations_UpdateWorkstationCluster_async - */ - updateWorkstationCluster( - request?: protos.google.cloud.workstations.v1.IUpdateWorkstationClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateWorkstationCluster( - request: protos.google.cloud.workstations.v1.IUpdateWorkstationClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstationCluster( - request: protos.google.cloud.workstations.v1.IUpdateWorkstationClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstationCluster( - request?: protos.google.cloud.workstations.v1.IUpdateWorkstationClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workstation_cluster.name': request.workstationCluster!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateWorkstationCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateWorkstationCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.update_workstation_cluster.js - * region_tag:workstations_v1_generated_Workstations_UpdateWorkstationCluster_async - */ - async checkUpdateWorkstationClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the specified workstation cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workstation cluster to delete. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not apply it. - * @param {string} request.etag - * If set, the request will be rejected if the latest version of the - * workstation cluster on the server does not have this ETag. - * @param {boolean} request.force - * If set, any workstation configurations and workstations in the - * workstation cluster are also deleted. Otherwise, the request only - * works if the workstation cluster has no configurations or workstations. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.delete_workstation_cluster.js - * region_tag:workstations_v1_generated_Workstations_DeleteWorkstationCluster_async - */ - deleteWorkstationCluster( - request?: protos.google.cloud.workstations.v1.IDeleteWorkstationClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteWorkstationCluster( - request: protos.google.cloud.workstations.v1.IDeleteWorkstationClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstationCluster( - request: protos.google.cloud.workstations.v1.IDeleteWorkstationClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstationCluster( - request?: protos.google.cloud.workstations.v1.IDeleteWorkstationClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteWorkstationCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteWorkstationCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.delete_workstation_cluster.js - * region_tag:workstations_v1_generated_Workstations_DeleteWorkstationCluster_async - */ - async checkDeleteWorkstationClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new workstation configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {string} request.workstationConfigId - * Required. ID to use for the workstation configuration. - * @param {google.cloud.workstations.v1.WorkstationConfig} request.workstationConfig - * Required. Config to create. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.create_workstation_config.js - * region_tag:workstations_v1_generated_Workstations_CreateWorkstationConfig_async - */ - createWorkstationConfig( - request?: protos.google.cloud.workstations.v1.ICreateWorkstationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createWorkstationConfig( - request: protos.google.cloud.workstations.v1.ICreateWorkstationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstationConfig( - request: protos.google.cloud.workstations.v1.ICreateWorkstationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstationConfig( - request?: protos.google.cloud.workstations.v1.ICreateWorkstationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createWorkstationConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createWorkstationConfig()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.create_workstation_config.js - * region_tag:workstations_v1_generated_Workstations_CreateWorkstationConfig_async - */ - async checkCreateWorkstationConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing workstation configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workstations.v1.WorkstationConfig} request.workstationConfig - * Required. Config to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask specifying which fields in the workstation configuration - * should be updated. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {boolean} request.allowMissing - * If set and the workstation configuration is not found, a new - * workstation configuration will be created. In this situation, - * update_mask is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.update_workstation_config.js - * region_tag:workstations_v1_generated_Workstations_UpdateWorkstationConfig_async - */ - updateWorkstationConfig( - request?: protos.google.cloud.workstations.v1.IUpdateWorkstationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateWorkstationConfig( - request: protos.google.cloud.workstations.v1.IUpdateWorkstationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstationConfig( - request: protos.google.cloud.workstations.v1.IUpdateWorkstationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstationConfig( - request?: protos.google.cloud.workstations.v1.IUpdateWorkstationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workstation_config.name': request.workstationConfig!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateWorkstationConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateWorkstationConfig()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.update_workstation_config.js - * region_tag:workstations_v1_generated_Workstations_UpdateWorkstationConfig_async - */ - async checkUpdateWorkstationConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the specified workstation configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workstation configuration to delete. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {string} request.etag - * If set, the request is rejected if the latest version of the - * workstation configuration on the server does not have this ETag. - * @param {boolean} request.force - * If set, any workstations in the workstation configuration are also deleted. - * Otherwise, the request works only if the workstation configuration has - * no workstations. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.delete_workstation_config.js - * region_tag:workstations_v1_generated_Workstations_DeleteWorkstationConfig_async - */ - deleteWorkstationConfig( - request?: protos.google.cloud.workstations.v1.IDeleteWorkstationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteWorkstationConfig( - request: protos.google.cloud.workstations.v1.IDeleteWorkstationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstationConfig( - request: protos.google.cloud.workstations.v1.IDeleteWorkstationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstationConfig( - request?: protos.google.cloud.workstations.v1.IDeleteWorkstationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteWorkstationConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteWorkstationConfig()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.delete_workstation_config.js - * region_tag:workstations_v1_generated_Workstations_DeleteWorkstationConfig_async - */ - async checkDeleteWorkstationConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new workstation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {string} request.workstationId - * Required. ID to use for the workstation. - * @param {google.cloud.workstations.v1.Workstation} request.workstation - * Required. Workstation to create. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.create_workstation.js - * region_tag:workstations_v1_generated_Workstations_CreateWorkstation_async - */ - createWorkstation( - request?: protos.google.cloud.workstations.v1.ICreateWorkstationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createWorkstation( - request: protos.google.cloud.workstations.v1.ICreateWorkstationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstation( - request: protos.google.cloud.workstations.v1.ICreateWorkstationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstation( - request?: protos.google.cloud.workstations.v1.ICreateWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createWorkstation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createWorkstation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.create_workstation.js - * region_tag:workstations_v1_generated_Workstations_CreateWorkstation_async - */ - async checkCreateWorkstationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing workstation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workstations.v1.Workstation} request.workstation - * Required. Workstation to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask specifying which fields in the workstation configuration - * should be updated. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {boolean} request.allowMissing - * If set and the workstation configuration is not found, a new - * workstation configuration is created. In this situation, update_mask - * is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.update_workstation.js - * region_tag:workstations_v1_generated_Workstations_UpdateWorkstation_async - */ - updateWorkstation( - request?: protos.google.cloud.workstations.v1.IUpdateWorkstationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateWorkstation( - request: protos.google.cloud.workstations.v1.IUpdateWorkstationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstation( - request: protos.google.cloud.workstations.v1.IUpdateWorkstationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstation( - request?: protos.google.cloud.workstations.v1.IUpdateWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workstation.name': request.workstation!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateWorkstation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateWorkstation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.update_workstation.js - * region_tag:workstations_v1_generated_Workstations_UpdateWorkstation_async - */ - async checkUpdateWorkstationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the specified workstation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workstation to delete. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {string} request.etag - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.delete_workstation.js - * region_tag:workstations_v1_generated_Workstations_DeleteWorkstation_async - */ - deleteWorkstation( - request?: protos.google.cloud.workstations.v1.IDeleteWorkstationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteWorkstation( - request: protos.google.cloud.workstations.v1.IDeleteWorkstationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstation( - request: protos.google.cloud.workstations.v1.IDeleteWorkstationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstation( - request?: protos.google.cloud.workstations.v1.IDeleteWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteWorkstation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteWorkstation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.delete_workstation.js - * region_tag:workstations_v1_generated_Workstations_DeleteWorkstation_async - */ - async checkDeleteWorkstationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Starts running a workstation so that users can connect to it. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workstation to start. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {string} request.etag - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.start_workstation.js - * region_tag:workstations_v1_generated_Workstations_StartWorkstation_async - */ - startWorkstation( - request?: protos.google.cloud.workstations.v1.IStartWorkstationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - startWorkstation( - request: protos.google.cloud.workstations.v1.IStartWorkstationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startWorkstation( - request: protos.google.cloud.workstations.v1.IStartWorkstationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startWorkstation( - request?: protos.google.cloud.workstations.v1.IStartWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.startWorkstation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `startWorkstation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.start_workstation.js - * region_tag:workstations_v1_generated_Workstations_StartWorkstation_async - */ - async checkStartWorkstationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.startWorkstation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Stops running a workstation, reducing costs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workstation to stop. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {string} request.etag - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.stop_workstation.js - * region_tag:workstations_v1_generated_Workstations_StopWorkstation_async - */ - stopWorkstation( - request?: protos.google.cloud.workstations.v1.IStopWorkstationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - stopWorkstation( - request: protos.google.cloud.workstations.v1.IStopWorkstationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopWorkstation( - request: protos.google.cloud.workstations.v1.IStopWorkstationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopWorkstation( - request?: protos.google.cloud.workstations.v1.IStopWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.stopWorkstation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `stopWorkstation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workstations.stop_workstation.js - * region_tag:workstations_v1_generated_Workstations_StopWorkstation_async - */ - async checkStopWorkstationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.stopWorkstation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Returns all workstation clusters in the specified location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.WorkstationCluster|WorkstationCluster}. - * 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 `listWorkstationClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstationClusters( - request?: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstationCluster[], - protos.google.cloud.workstations.v1.IListWorkstationClustersRequest|null, - protos.google.cloud.workstations.v1.IListWorkstationClustersResponse - ]>; - listWorkstationClusters( - request: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, - protos.google.cloud.workstations.v1.IListWorkstationClustersResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationCluster>): void; - listWorkstationClusters( - request: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, - callback: PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, - protos.google.cloud.workstations.v1.IListWorkstationClustersResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationCluster>): void; - listWorkstationClusters( - request?: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, - protos.google.cloud.workstations.v1.IListWorkstationClustersResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationCluster>, - callback?: PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, - protos.google.cloud.workstations.v1.IListWorkstationClustersResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationCluster>): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstationCluster[], - protos.google.cloud.workstations.v1.IListWorkstationClustersRequest|null, - protos.google.cloud.workstations.v1.IListWorkstationClustersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listWorkstationClusters(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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.WorkstationCluster|WorkstationCluster} 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 `listWorkstationClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstationClustersStream( - request?: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, - 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['listWorkstationClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstationClusters.createStream( - this.innerApiCalls.listWorkstationClusters as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listWorkstationClusters`, 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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.WorkstationCluster|WorkstationCluster}. 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/workstations.list_workstation_clusters.js - * region_tag:workstations_v1_generated_Workstations_ListWorkstationClusters_async - */ - listWorkstationClustersAsync( - request?: protos.google.cloud.workstations.v1.IListWorkstationClustersRequest, - 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['listWorkstationClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstationClusters.asyncIterate( - this.innerApiCalls['listWorkstationClusters'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns all workstation configurations in the specified cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig}. - * 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 `listWorkstationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstationConfigs( - request?: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstationConfig[], - protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest|null, - protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse - ]>; - listWorkstationConfigs( - request: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, - protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationConfig>): void; - listWorkstationConfigs( - request: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, - protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationConfig>): void; - listWorkstationConfigs( - request?: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, - protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationConfig>, - callback?: PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, - protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationConfig>): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstationConfig[], - protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest|null, - protos.google.cloud.workstations.v1.IListWorkstationConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listWorkstationConfigs(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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig} 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 `listWorkstationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstationConfigsStream( - request?: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, - 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['listWorkstationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstationConfigs.createStream( - this.innerApiCalls.listWorkstationConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listWorkstationConfigs`, 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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig}. 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/workstations.list_workstation_configs.js - * region_tag:workstations_v1_generated_Workstations_ListWorkstationConfigs_async - */ - listWorkstationConfigsAsync( - request?: protos.google.cloud.workstations.v1.IListWorkstationConfigsRequest, - 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['listWorkstationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstationConfigs.asyncIterate( - this.innerApiCalls['listWorkstationConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns all workstation configurations in the specified cluster on which - * the caller has the "workstations.workstation.create" permission. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig}. - * 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 `listUsableWorkstationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableWorkstationConfigs( - request?: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstationConfig[], - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest|null, - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse - ]>; - listUsableWorkstationConfigs( - request: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationConfig>): void; - listUsableWorkstationConfigs( - request: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationConfig>): void; - listUsableWorkstationConfigs( - request?: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationConfig>, - callback?: PaginationCallback< - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstationConfig>): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstationConfig[], - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest|null, - protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listUsableWorkstationConfigs(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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig} 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 `listUsableWorkstationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableWorkstationConfigsStream( - request?: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, - 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['listUsableWorkstationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableWorkstationConfigs.createStream( - this.innerApiCalls.listUsableWorkstationConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUsableWorkstationConfigs`, 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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.WorkstationConfig|WorkstationConfig}. 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/workstations.list_usable_workstation_configs.js - * region_tag:workstations_v1_generated_Workstations_ListUsableWorkstationConfigs_async - */ - listUsableWorkstationConfigsAsync( - request?: protos.google.cloud.workstations.v1.IListUsableWorkstationConfigsRequest, - 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['listUsableWorkstationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableWorkstationConfigs.asyncIterate( - this.innerApiCalls['listUsableWorkstationConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns all Workstations using the specified workstation configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation}. - * 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 `listWorkstationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstations( - request?: protos.google.cloud.workstations.v1.IListWorkstationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstation[], - protos.google.cloud.workstations.v1.IListWorkstationsRequest|null, - protos.google.cloud.workstations.v1.IListWorkstationsResponse - ]>; - listWorkstations( - request: protos.google.cloud.workstations.v1.IListWorkstationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationsRequest, - protos.google.cloud.workstations.v1.IListWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstation>): void; - listWorkstations( - request: protos.google.cloud.workstations.v1.IListWorkstationsRequest, - callback: PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationsRequest, - protos.google.cloud.workstations.v1.IListWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstation>): void; - listWorkstations( - request?: protos.google.cloud.workstations.v1.IListWorkstationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationsRequest, - protos.google.cloud.workstations.v1.IListWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstation>, - callback?: PaginationCallback< - protos.google.cloud.workstations.v1.IListWorkstationsRequest, - protos.google.cloud.workstations.v1.IListWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstation>): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstation[], - protos.google.cloud.workstations.v1.IListWorkstationsRequest|null, - protos.google.cloud.workstations.v1.IListWorkstationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listWorkstations(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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation} 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 `listWorkstationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstationsStream( - request?: protos.google.cloud.workstations.v1.IListWorkstationsRequest, - 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['listWorkstations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstations.createStream( - this.innerApiCalls.listWorkstations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listWorkstations`, 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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation}. 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/workstations.list_workstations.js - * region_tag:workstations_v1_generated_Workstations_ListWorkstations_async - */ - listWorkstationsAsync( - request?: protos.google.cloud.workstations.v1.IListWorkstationsRequest, - 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['listWorkstations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstations.asyncIterate( - this.innerApiCalls['listWorkstations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns all workstations using the specified workstation configuration - * on which the caller has the "workstations.workstations.use" permission. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation}. - * 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 `listUsableWorkstationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableWorkstations( - request?: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstation[], - protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest|null, - protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse - ]>; - listUsableWorkstations( - request: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, - protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstation>): void; - listUsableWorkstations( - request: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, - callback: PaginationCallback< - protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, - protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstation>): void; - listUsableWorkstations( - request?: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, - protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstation>, - callback?: PaginationCallback< - protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, - protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1.IWorkstation>): - Promise<[ - protos.google.cloud.workstations.v1.IWorkstation[], - protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest|null, - protos.google.cloud.workstations.v1.IListUsableWorkstationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listUsableWorkstations(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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation} 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 `listUsableWorkstationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableWorkstationsStream( - request?: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, - 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['listUsableWorkstations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableWorkstations.createStream( - this.innerApiCalls.listUsableWorkstations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUsableWorkstations`, 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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1.Workstation|Workstation}. 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/workstations.list_usable_workstations.js - * region_tag:workstations_v1_generated_Workstations_ListUsableWorkstations_async - */ - listUsableWorkstationsAsync( - request?: protos.google.cloud.workstations.v1.IListUsableWorkstationsRequest, - 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['listUsableWorkstations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableWorkstations.asyncIterate( - this.innerApiCalls['listUsableWorkstations'] 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 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 workstation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workstation_cluster - * @param {string} workstation_config - * @param {string} workstation - * @returns {string} Resource name string. - */ - workstationPath(project:string,location:string,workstationCluster:string,workstationConfig:string,workstation:string) { - return this.pathTemplates.workstationPathTemplate.render({ - project: project, - location: location, - workstation_cluster: workstationCluster, - workstation_config: workstationConfig, - workstation: workstation, - }); - } - - /** - * Parse the project from Workstation resource. - * - * @param {string} workstationName - * A fully-qualified path representing Workstation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkstationName(workstationName: string) { - return this.pathTemplates.workstationPathTemplate.match(workstationName).project; - } - - /** - * Parse the location from Workstation resource. - * - * @param {string} workstationName - * A fully-qualified path representing Workstation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkstationName(workstationName: string) { - return this.pathTemplates.workstationPathTemplate.match(workstationName).location; - } - - /** - * Parse the workstation_cluster from Workstation resource. - * - * @param {string} workstationName - * A fully-qualified path representing Workstation resource. - * @returns {string} A string representing the workstation_cluster. - */ - matchWorkstationClusterFromWorkstationName(workstationName: string) { - return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation_cluster; - } - - /** - * Parse the workstation_config from Workstation resource. - * - * @param {string} workstationName - * A fully-qualified path representing Workstation resource. - * @returns {string} A string representing the workstation_config. - */ - matchWorkstationConfigFromWorkstationName(workstationName: string) { - return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation_config; - } - - /** - * Parse the workstation from Workstation resource. - * - * @param {string} workstationName - * A fully-qualified path representing Workstation resource. - * @returns {string} A string representing the workstation. - */ - matchWorkstationFromWorkstationName(workstationName: string) { - return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation; - } - - /** - * Return a fully-qualified workstationCluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workstation_cluster - * @returns {string} Resource name string. - */ - workstationClusterPath(project:string,location:string,workstationCluster:string) { - return this.pathTemplates.workstationClusterPathTemplate.render({ - project: project, - location: location, - workstation_cluster: workstationCluster, - }); - } - - /** - * Parse the project from WorkstationCluster resource. - * - * @param {string} workstationClusterName - * A fully-qualified path representing WorkstationCluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkstationClusterName(workstationClusterName: string) { - return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).project; - } - - /** - * Parse the location from WorkstationCluster resource. - * - * @param {string} workstationClusterName - * A fully-qualified path representing WorkstationCluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkstationClusterName(workstationClusterName: string) { - return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).location; - } - - /** - * Parse the workstation_cluster from WorkstationCluster resource. - * - * @param {string} workstationClusterName - * A fully-qualified path representing WorkstationCluster resource. - * @returns {string} A string representing the workstation_cluster. - */ - matchWorkstationClusterFromWorkstationClusterName(workstationClusterName: string) { - return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).workstation_cluster; - } - - /** - * Return a fully-qualified workstationConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workstation_cluster - * @param {string} workstation_config - * @returns {string} Resource name string. - */ - workstationConfigPath(project:string,location:string,workstationCluster:string,workstationConfig:string) { - return this.pathTemplates.workstationConfigPathTemplate.render({ - project: project, - location: location, - workstation_cluster: workstationCluster, - workstation_config: workstationConfig, - }); - } - - /** - * Parse the project from WorkstationConfig resource. - * - * @param {string} workstationConfigName - * A fully-qualified path representing WorkstationConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkstationConfigName(workstationConfigName: string) { - return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).project; - } - - /** - * Parse the location from WorkstationConfig resource. - * - * @param {string} workstationConfigName - * A fully-qualified path representing WorkstationConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkstationConfigName(workstationConfigName: string) { - return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).location; - } - - /** - * Parse the workstation_cluster from WorkstationConfig resource. - * - * @param {string} workstationConfigName - * A fully-qualified path representing WorkstationConfig resource. - * @returns {string} A string representing the workstation_cluster. - */ - matchWorkstationClusterFromWorkstationConfigName(workstationConfigName: string) { - return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).workstation_cluster; - } - - /** - * Parse the workstation_config from WorkstationConfig resource. - * - * @param {string} workstationConfigName - * A fully-qualified path representing WorkstationConfig resource. - * @returns {string} A string representing the workstation_config. - */ - matchWorkstationConfigFromWorkstationConfigName(workstationConfigName: string) { - return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).workstation_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.workstationsStub && !this._terminated) { - return this.workstationsStub.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-workstations/v1/src/v1/workstations_client_config.json b/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client_config.json deleted file mode 100644 index eadd39f3056..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_client_config.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "interfaces": { - "google.cloud.workstations.v1.Workstations": { - "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": { - "GetWorkstationCluster": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListWorkstationClusters": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateWorkstationCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateWorkstationCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteWorkstationCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetWorkstationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListWorkstationConfigs": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListUsableWorkstationConfigs": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateWorkstationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateWorkstationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteWorkstationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListWorkstations": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListUsableWorkstations": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StopWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateAccessToken": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_proto_list.json b/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_proto_list.json deleted file mode 100644 index e55bee79a1c..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/src/v1/workstations_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/workstations/v1/workstations.proto" -] diff --git a/owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index baefb289660..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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 workstations = require('@google-cloud/workstations'); - -function main() { - const workstationsClient = new workstations.WorkstationsClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workstations/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 74cd8e0b246..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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 {WorkstationsClient} from '@google-cloud/workstations'; - -// check that the client class type name can be used -function doStuffWithWorkstationsClient(client: WorkstationsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const workstationsClient = new WorkstationsClient(); - doStuffWithWorkstationsClient(workstationsClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workstations/v1/system-test/install.ts b/owl-bot-staging/google-cloud-workstations/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1/test/gapic_workstations_v1.ts b/owl-bot-staging/google-cloud-workstations/v1/test/gapic_workstations_v1.ts deleted file mode 100644 index e76362ab871..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1/test/gapic_workstations_v1.ts +++ /dev/null @@ -1,4506 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 workstationsModule 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.WorkstationsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = workstationsModule.v1.WorkstationsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = workstationsModule.v1.WorkstationsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = workstationsModule.v1.WorkstationsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new workstationsModule.v1.WorkstationsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new workstationsModule.v1.WorkstationsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workstationsStub, undefined); - await client.initialize(); - assert(client.workstationsStub); - }); - - it('has close method for the initialized client', done => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.workstationsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workstationsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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('getWorkstationCluster', () => { - it('invokes getWorkstationCluster without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1.WorkstationCluster() - ); - client.innerApiCalls.getWorkstationCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkstationCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationCluster without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1.WorkstationCluster() - ); - client.innerApiCalls.getWorkstationCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkstationCluster( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstationCluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationCluster with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkstationCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkstationCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationCluster with closed client', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkstationCluster(request), expectedError); - }); - }); - - describe('getWorkstationConfig', () => { - it('invokes getWorkstationConfig without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1.WorkstationConfig() - ); - client.innerApiCalls.getWorkstationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkstationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationConfig without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1.WorkstationConfig() - ); - client.innerApiCalls.getWorkstationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkstationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationConfig with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkstationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkstationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationConfig with closed client', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkstationConfig(request), expectedError); - }); - }); - - describe('getWorkstation', () => { - it('invokes getWorkstation without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1.Workstation() - ); - client.innerApiCalls.getWorkstation = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkstation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstation without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1.Workstation() - ); - client.innerApiCalls.getWorkstation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkstation( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstation with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkstation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstation with closed client', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GetWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GetWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkstation(request), expectedError); - }); - }); - - describe('generateAccessToken', () => { - it('invokes generateAccessToken without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GenerateAccessTokenRequest', ['workstation']); - request.workstation = defaultValue1; - const expectedHeaderRequestParams = `workstation=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1.GenerateAccessTokenResponse() - ); - client.innerApiCalls.generateAccessToken = stubSimpleCall(expectedResponse); - const [response] = await client.generateAccessToken(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAccessToken without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GenerateAccessTokenRequest', ['workstation']); - request.workstation = defaultValue1; - const expectedHeaderRequestParams = `workstation=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1.GenerateAccessTokenResponse() - ); - client.innerApiCalls.generateAccessToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateAccessToken( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1.IGenerateAccessTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAccessToken with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GenerateAccessTokenRequest', ['workstation']); - request.workstation = defaultValue1; - const expectedHeaderRequestParams = `workstation=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateAccessToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateAccessToken(request), expectedError); - const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAccessToken with closed client', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.GenerateAccessTokenRequest', ['workstation']); - request.workstation = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateAccessToken(request), expectedError); - }); - }); - - describe('createWorkstationCluster', () => { - it('invokes createWorkstationCluster without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkstationCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationCluster without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkstationCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationCluster with call error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkstationCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationCluster with LRO error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkstationCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateWorkstationClusterProgress without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkstationClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateWorkstationClusterProgress with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkstationClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateWorkstationCluster', () => { - it('invokes updateWorkstationCluster without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationClusterRequest() - ); - request.workstationCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); - request.workstationCluster.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkstationCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationCluster without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationClusterRequest() - ); - request.workstationCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); - request.workstationCluster.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkstationCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationCluster with call error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationClusterRequest() - ); - request.workstationCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); - request.workstationCluster.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkstationCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationCluster with LRO error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationClusterRequest() - ); - request.workstationCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); - request.workstationCluster.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkstationCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateWorkstationClusterProgress without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkstationClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateWorkstationClusterProgress with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkstationClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteWorkstationCluster', () => { - it('invokes deleteWorkstationCluster without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkstationCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationCluster without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkstationCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationCluster with call error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkstationCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationCluster with LRO error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkstationCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteWorkstationClusterProgress without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkstationClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteWorkstationClusterProgress with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkstationClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createWorkstationConfig', () => { - it('invokes createWorkstationConfig without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkstationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationConfig without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkstationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationConfig with call error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkstationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationConfig with LRO error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkstationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateWorkstationConfigProgress without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkstationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateWorkstationConfigProgress with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkstationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateWorkstationConfig', () => { - it('invokes updateWorkstationConfig without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationConfigRequest() - ); - request.workstationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); - request.workstationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkstationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationConfig without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationConfigRequest() - ); - request.workstationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); - request.workstationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkstationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationConfig with call error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationConfigRequest() - ); - request.workstationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); - request.workstationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkstationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationConfig with LRO error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationConfigRequest() - ); - request.workstationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); - request.workstationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkstationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateWorkstationConfigProgress without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkstationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateWorkstationConfigProgress with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkstationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteWorkstationConfig', () => { - it('invokes deleteWorkstationConfig without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkstationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationConfig without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkstationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationConfig with call error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkstationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationConfig with LRO error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkstationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteWorkstationConfigProgress without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkstationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteWorkstationConfigProgress with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkstationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createWorkstation', () => { - it('invokes createWorkstation without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkstation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstation without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkstation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstation with call error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstation with LRO error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.CreateWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.CreateWorkstationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkstation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateWorkstationProgress without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkstationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateWorkstationProgress with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkstationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateWorkstation', () => { - it('invokes updateWorkstation without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationRequest() - ); - request.workstation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationRequest', ['workstation', 'name']); - request.workstation.name = defaultValue1; - const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkstation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstation without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationRequest() - ); - request.workstation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationRequest', ['workstation', 'name']); - request.workstation.name = defaultValue1; - const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkstation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstation with call error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationRequest() - ); - request.workstation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationRequest', ['workstation', 'name']); - request.workstation.name = defaultValue1; - const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstation with LRO error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.UpdateWorkstationRequest() - ); - request.workstation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.UpdateWorkstationRequest', ['workstation', 'name']); - request.workstation.name = defaultValue1; - const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkstation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateWorkstationProgress without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkstationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateWorkstationProgress with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkstationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteWorkstation', () => { - it('invokes deleteWorkstation without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkstation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstation without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkstation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstation with call error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstation with LRO error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.DeleteWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.DeleteWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkstation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteWorkstationProgress without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkstationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteWorkstationProgress with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkstationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('startWorkstation', () => { - it('invokes startWorkstation without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.StartWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.StartWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startWorkstation = stubLongRunningCall(expectedResponse); - const [operation] = await client.startWorkstation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startWorkstation without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.StartWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.StartWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startWorkstation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startWorkstation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startWorkstation with call error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.StartWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.StartWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startWorkstation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.startWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startWorkstation with LRO error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.StartWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.StartWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startWorkstation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.startWorkstation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStartWorkstationProgress without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkStartWorkstationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStartWorkstationProgress with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkStartWorkstationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('stopWorkstation', () => { - it('invokes stopWorkstation without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.StopWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.StopWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopWorkstation = stubLongRunningCall(expectedResponse); - const [operation] = await client.stopWorkstation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopWorkstation without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.StopWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.StopWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopWorkstation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopWorkstation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopWorkstation with call error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.StopWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.StopWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopWorkstation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.stopWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopWorkstation with LRO error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.StopWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.StopWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopWorkstation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.stopWorkstation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStopWorkstationProgress without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkStopWorkstationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStopWorkstationProgress with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkStopWorkstationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listWorkstationClusters', () => { - it('invokes listWorkstationClusters without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - ]; - client.innerApiCalls.listWorkstationClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkstationClusters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationClusters without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - ]; - client.innerApiCalls.listWorkstationClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkstationClusters( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstationCluster[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationClusters with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkstationClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkstationClusters(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationClustersStream without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - ]; - client.descriptors.page.listWorkstationClusters.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkstationClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1.WorkstationCluster[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationCluster) => { - 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.listWorkstationClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstationClusters, request)); - assert( - (client.descriptors.page.listWorkstationClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listWorkstationClustersStream with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstationClusters.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkstationClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1.WorkstationCluster[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationCluster) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkstationClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstationClusters, request)); - assert( - (client.descriptors.page.listWorkstationClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstationClusters without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationCluster()), - ]; - client.descriptors.page.listWorkstationClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workstations.v1.IWorkstationCluster[] = []; - const iterable = client.listWorkstationClustersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstationClusters with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstationClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkstationClustersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workstations.v1.IWorkstationCluster[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listWorkstationConfigs', () => { - it('invokes listWorkstationConfigs without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - ]; - client.innerApiCalls.listWorkstationConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkstationConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationConfigs without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - ]; - client.innerApiCalls.listWorkstationConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkstationConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstationConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationConfigs with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkstationConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkstationConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationConfigsStream without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - ]; - client.descriptors.page.listWorkstationConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkstationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1.WorkstationConfig[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationConfig) => { - 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.listWorkstationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstationConfigs, request)); - assert( - (client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listWorkstationConfigsStream with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkstationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1.WorkstationConfig[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstationConfigs, request)); - assert( - (client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstationConfigs without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - ]; - client.descriptors.page.listWorkstationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workstations.v1.IWorkstationConfig[] = []; - const iterable = client.listWorkstationConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstationConfigs with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkstationConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workstations.v1.IWorkstationConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listUsableWorkstationConfigs', () => { - it('invokes listUsableWorkstationConfigs without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - ]; - client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listUsableWorkstationConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstationConfigs without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - ]; - client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUsableWorkstationConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstationConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstationConfigs with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUsableWorkstationConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstationConfigsStream without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - ]; - client.descriptors.page.listUsableWorkstationConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUsableWorkstationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1.WorkstationConfig[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationConfig) => { - 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.listUsableWorkstationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstationConfigs, request)); - assert( - (client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listUsableWorkstationConfigsStream with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableWorkstationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUsableWorkstationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1.WorkstationConfig[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1.WorkstationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstationConfigs, request)); - assert( - (client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableWorkstationConfigs without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1.WorkstationConfig()), - ]; - client.descriptors.page.listUsableWorkstationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workstations.v1.IWorkstationConfig[] = []; - const iterable = client.listUsableWorkstationConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableWorkstationConfigs with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableWorkstationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUsableWorkstationConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workstations.v1.IWorkstationConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listWorkstations', () => { - it('invokes listWorkstations without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - ]; - client.innerApiCalls.listWorkstations = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkstations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstations without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - ]; - client.innerApiCalls.listWorkstations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkstations( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstations with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkstations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkstations(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationsStream without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - ]; - client.descriptors.page.listWorkstations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkstationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1.Workstation[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1.Workstation) => { - 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.listWorkstations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstations, request)); - assert( - (client.descriptors.page.listWorkstations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listWorkstationsStream with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkstationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1.Workstation[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1.Workstation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkstations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstations, request)); - assert( - (client.descriptors.page.listWorkstations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstations without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - ]; - client.descriptors.page.listWorkstations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workstations.v1.IWorkstation[] = []; - const iterable = client.listWorkstationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstations with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkstationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workstations.v1.IWorkstation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listUsableWorkstations', () => { - it('invokes listUsableWorkstations without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - ]; - client.innerApiCalls.listUsableWorkstations = stubSimpleCall(expectedResponse); - const [response] = await client.listUsableWorkstations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstations without error using callback', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - ]; - client.innerApiCalls.listUsableWorkstations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUsableWorkstations( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1.IWorkstation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstations with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUsableWorkstations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUsableWorkstations(request), expectedError); - const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstationsStream without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - ]; - client.descriptors.page.listUsableWorkstations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUsableWorkstationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1.Workstation[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1.Workstation) => { - 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.listUsableWorkstations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstations, request)); - assert( - (client.descriptors.page.listUsableWorkstations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listUsableWorkstationsStream with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableWorkstations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUsableWorkstationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1.Workstation[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1.Workstation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUsableWorkstations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstations, request)); - assert( - (client.descriptors.page.listUsableWorkstations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableWorkstations without error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1.Workstation()), - ]; - client.descriptors.page.listUsableWorkstations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workstations.v1.IWorkstation[] = []; - const iterable = client.listUsableWorkstationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableWorkstations with error', async () => { - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableWorkstations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUsableWorkstationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workstations.v1.IWorkstation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableWorkstations.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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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 workstationsModule.v1.WorkstationsClient({ - 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('workstation', () => { - const fakePath = "/rendered/path/workstation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workstation_cluster: "workstationClusterValue", - workstation_config: "workstationConfigValue", - workstation: "workstationValue", - }; - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workstationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workstationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workstationPath', () => { - const result = client.workstationPath("projectValue", "locationValue", "workstationClusterValue", "workstationConfigValue", "workstationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workstationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkstationName', () => { - const result = client.matchProjectFromWorkstationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkstationName', () => { - const result = client.matchLocationFromWorkstationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationClusterFromWorkstationName', () => { - const result = client.matchWorkstationClusterFromWorkstationName(fakePath); - assert.strictEqual(result, "workstationClusterValue"); - assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationConfigFromWorkstationName', () => { - const result = client.matchWorkstationConfigFromWorkstationName(fakePath); - assert.strictEqual(result, "workstationConfigValue"); - assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationFromWorkstationName', () => { - const result = client.matchWorkstationFromWorkstationName(fakePath); - assert.strictEqual(result, "workstationValue"); - assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workstationCluster', () => { - const fakePath = "/rendered/path/workstationCluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workstation_cluster: "workstationClusterValue", - }; - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workstationClusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workstationClusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workstationClusterPath', () => { - const result = client.workstationClusterPath("projectValue", "locationValue", "workstationClusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workstationClusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkstationClusterName', () => { - const result = client.matchProjectFromWorkstationClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkstationClusterName', () => { - const result = client.matchLocationFromWorkstationClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationClusterFromWorkstationClusterName', () => { - const result = client.matchWorkstationClusterFromWorkstationClusterName(fakePath); - assert.strictEqual(result, "workstationClusterValue"); - assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workstationConfig', () => { - const fakePath = "/rendered/path/workstationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workstation_cluster: "workstationClusterValue", - workstation_config: "workstationConfigValue", - }; - const client = new workstationsModule.v1.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workstationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workstationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workstationConfigPath', () => { - const result = client.workstationConfigPath("projectValue", "locationValue", "workstationClusterValue", "workstationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workstationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkstationConfigName', () => { - const result = client.matchProjectFromWorkstationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkstationConfigName', () => { - const result = client.matchLocationFromWorkstationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationClusterFromWorkstationConfigName', () => { - const result = client.matchWorkstationClusterFromWorkstationConfigName(fakePath); - assert.strictEqual(result, "workstationClusterValue"); - assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationConfigFromWorkstationConfigName', () => { - const result = client.matchWorkstationConfigFromWorkstationConfigName(fakePath); - assert.strictEqual(result, "workstationConfigValue"); - assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-workstations/v1/tsconfig.json b/owl-bot-staging/google-cloud-workstations/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1/webpack.config.js b/owl-bot-staging/google-cloud-workstations/v1/webpack.config.js deleted file mode 100644 index 46aed65f9a2..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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: 'Workstations', - filename: './workstations.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-workstations/v1beta/.eslintignore b/owl-bot-staging/google-cloud-workstations/v1beta/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-workstations/v1beta/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/.gitignore b/owl-bot-staging/google-cloud-workstations/v1beta/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-workstations/v1beta/.jsdoc.js deleted file mode 100644 index 6398f035d9b..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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/workstations', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-workstations/v1beta/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-workstations/v1beta/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1beta/README.md b/owl-bot-staging/google-cloud-workstations/v1beta/README.md deleted file mode 100644 index 8ef3807738a..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Workstations: Nodejs Client diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/package.json b/owl-bot-staging/google-cloud-workstations/v1beta/package.json deleted file mode 100644 index 94fc6760f48..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/workstations", - "version": "0.1.0", - "description": "Workstations client for Node.js", - "repository": "googleapis/nodejs-workstations", - "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 workstations", - "workstations", - "workstations" - ], - "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-workstations/v1beta/protos/google/cloud/workstations/v1beta/workstations.proto b/owl-bot-staging/google-cloud-workstations/v1beta/protos/google/cloud/workstations/v1beta/workstations.proto deleted file mode 100644 index 98951e8be83..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/protos/google/cloud/workstations/v1beta/workstations.proto +++ /dev/null @@ -1,1217 +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.workstations.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/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option go_package = "cloud.google.com/go/workstations/apiv1beta/workstationspb;workstationspb"; -option java_multiple_files = true; -option java_outer_classname = "WorkstationsProto"; -option java_package = "com.google.cloud.workstations.v1beta"; - -// Service for interacting with Cloud Workstations. -service Workstations { - option (google.api.default_host) = "workstations.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Returns the requested workstation cluster. - rpc GetWorkstationCluster(GetWorkstationClusterRequest) - returns (WorkstationCluster) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/workstationClusters/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns all workstation clusters in the specified location. - rpc ListWorkstationClusters(ListWorkstationClustersRequest) - returns (ListWorkstationClustersResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*}/workstationClusters" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new workstation cluster. - rpc CreateWorkstationCluster(CreateWorkstationClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*}/workstationClusters" - body: "workstation_cluster" - }; - option (google.api.method_signature) = - "parent,workstation_cluster,workstation_cluster_id"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationCluster" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing workstation cluster. - rpc UpdateWorkstationCluster(UpdateWorkstationClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta/{workstation_cluster.name=projects/*/locations/*/workstationClusters/*}" - body: "workstation_cluster" - }; - option (google.api.method_signature) = "workstation_cluster,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationCluster" - metadata_type: "OperationMetadata" - }; - } - - // Deletes the specified workstation cluster. - rpc DeleteWorkstationCluster(DeleteWorkstationClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/locations/*/workstationClusters/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationCluster" - metadata_type: "OperationMetadata" - }; - } - - // Returns the requested workstation configuration. - rpc GetWorkstationConfig(GetWorkstationConfigRequest) - returns (WorkstationConfig) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns all workstation configurations in the specified cluster. - rpc ListWorkstationConfigs(ListWorkstationConfigsRequest) - returns (ListWorkstationConfigsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns all workstation configurations in the specified cluster on which - // the caller has the "workstations.workstation.create" permission. - rpc ListUsableWorkstationConfigs(ListUsableWorkstationConfigsRequest) - returns (ListUsableWorkstationConfigsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs:listUsable" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new workstation configuration. - rpc CreateWorkstationConfig(CreateWorkstationConfigRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*}/workstationConfigs" - body: "workstation_config" - }; - option (google.api.method_signature) = - "parent,workstation_config,workstation_config_id"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationConfig" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing workstation configuration. - rpc UpdateWorkstationConfig(UpdateWorkstationConfigRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta/{workstation_config.name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" - body: "workstation_config" - }; - option (google.api.method_signature) = "workstation_config,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationConfig" - metadata_type: "OperationMetadata" - }; - } - - // Deletes the specified workstation configuration. - rpc DeleteWorkstationConfig(DeleteWorkstationConfigRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "WorkstationConfig" - metadata_type: "OperationMetadata" - }; - } - - // Returns the requested workstation. - rpc GetWorkstation(GetWorkstationRequest) returns (Workstation) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns all Workstations using the specified workstation configuration. - rpc ListWorkstations(ListWorkstationsRequest) - returns (ListWorkstationsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns all workstations using the specified workstation configuration - // on which the caller has the "workstations.workstations.use" permission. - rpc ListUsableWorkstations(ListUsableWorkstationsRequest) - returns (ListUsableWorkstationsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations:listUsable" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new workstation. - rpc CreateWorkstation(CreateWorkstationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}/workstations" - body: "workstation" - }; - option (google.api.method_signature) = "parent,workstation,workstation_id"; - option (google.longrunning.operation_info) = { - response_type: "Workstation" - metadata_type: "OperationMetadata" - }; - } - - // Updates an existing workstation. - rpc UpdateWorkstation(UpdateWorkstationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta/{workstation.name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" - body: "workstation" - }; - option (google.api.method_signature) = "workstation,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Workstation" - metadata_type: "OperationMetadata" - }; - } - - // Deletes the specified workstation. - rpc DeleteWorkstation(DeleteWorkstationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "Workstation" - metadata_type: "OperationMetadata" - }; - } - - // Starts running a workstation so that users can connect to it. - rpc StartWorkstation(StartWorkstationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:start" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "Workstation" - metadata_type: "OperationMetadata" - }; - } - - // Stops running a workstation, reducing costs. - rpc StopWorkstation(StopWorkstationRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{name=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:stop" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "Workstation" - metadata_type: "OperationMetadata" - }; - } - - // Returns a short-lived credential that can be used to send authenticated and - // authorized traffic to a workstation. - rpc GenerateAccessToken(GenerateAccessTokenRequest) - returns (GenerateAccessTokenResponse) { - option (google.api.http) = { - post: "/v1beta/{workstation=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:generateAccessToken" - body: "*" - }; - option (google.api.method_signature) = "workstation"; - } -} - -// A grouping of workstation configurations and the associated workstations -// in that region. -message WorkstationCluster { - option (google.api.resource) = { - type: "workstations.googleapis.com/WorkstationCluster" - pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}" - style: DECLARATIVE_FRIENDLY - }; - - // Configuration options for private clusters. - message PrivateClusterConfig { - // Immutable. Whether Workstations endpoint is private. - bool enable_private_endpoint = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. Hostname for the workstation cluster. This field will be - // populated only when private endpoint is enabled. To access workstations - // in the cluster, create a new DNS zone mapping this domain name to an - // internal IP address and a forwarding rule mapping that address to the - // service attachment. - string cluster_hostname = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Service attachment URI for the workstation cluster. The - // service attachemnt is created when private endpoint is enabled. To access - // workstations in the cluster, configure access to the managed service - // using [Private Service - // Connect](https://cloud.google.com/vpc/docs/configure-private-service-connect-services). - string service_attachment_uri = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Additional projects that are allowed to attach to the workstation - // cluster's service attachment. By default, the workstation cluster's - // project and the VPC host project (if different) are allowed. - repeated string allowed_projects = 4; - } - - // Full name of this resource. - string name = 1; - - // Human-readable name for this resource. - string display_name = 2; - - // Output only. A system-assigned unique identified for this resource. - string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates whether this resource is currently being updated to - // match its intended state. - bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Client-specified annotations. - map annotations = 5; - - // Client-specified labels that are applied to the resource and that are also - // propagated to the underlying Compute Engine resources. - map labels = 15; - - // Output only. Time when this resource was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was most recently updated. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was soft-deleted. - google.protobuf.Timestamp delete_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Checksum computed by the server. May be sent on update and delete requests - // to make sure that the client has an up-to-date value before proceeding. - string etag = 9; - - // Immutable. Name of the Compute Engine network in which instances associated - // with this cluster will be created. - string network = 10 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Name of the Compute Engine subnetwork in which instances - // associated with this cluster will be created. Must be part of the - // subnetwork specified for this cluster. - string subnetwork = 11 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The private IP address of the control plane for this cluster. - // Workstation VMs need access to this IP address to work with the service, so - // make sure that your firewall rules allow egress from the workstation VMs to - // this address. - string control_plane_ip = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Configuration for private cluster. - PrivateClusterConfig private_cluster_config = 12; - - // Output only. Whether this resource is in degraded mode, in which case it - // may require user action to restore full functionality. Details can be found - // in the `conditions` field. - bool degraded = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Status conditions describing the current resource state. - repeated google.rpc.Status conditions = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A set of configuration options describing how a workstation will be run. -// Workstation configurations are intended to be shared across multiple -// workstations. -message WorkstationConfig { - option (google.api.resource) = { - type: "workstations.googleapis.com/WorkstationConfig" - pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}" - style: DECLARATIVE_FRIENDLY - }; - - // Runtime host for a workstation. - message Host { - // A runtime using a Compute Engine instance. - message GceInstance { - // A set of Compute Engine Shielded instance options. - message GceShieldedInstanceConfig { - // Whether the instance has Secure Boot enabled. - bool enable_secure_boot = 1; - - // Whether the instance has the vTPM enabled. - bool enable_vtpm = 2; - - // Whether the instance has integrity monitoring enabled. - bool enable_integrity_monitoring = 3; - } - - // A set of Compute Engine Confidential VM instance options. - message GceConfidentialInstanceConfig { - // Whether the instance has confidential compute enabled. - bool enable_confidential_compute = 1; - } - - // An accelerator card attached to the instance. - message Accelerator { - // Type of accelerator resource to attach to the instance, for example, - // "nvidia-tesla-p100". - string type = 1; - - // Number of accelerator cards exposed to the instance. - int32 count = 2; - } - - // The name of a Compute Engine machine type. - string machine_type = 1; - - // Email address of the service account used on VM instances - // used to support this configuration. If not set, VMs run with a - // Google-managed service account. This service account must have - // permission to pull the specified container image; otherwise, the image - // must be publicly accessible. - string service_account = 2; - - // Network tags to add to the Compute Engine machines backing the - // Workstations. - repeated string tags = 4; - - // Number of instances to pool for faster workstation startup. - int32 pool_size = 5; - - // Output only. Number of instances currently available in the pool for - // faster workstation startup. - int32 pooled_instances = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Whether instances have no public IP address. - bool disable_public_ip_addresses = 6; - - // A set of Compute Engine Shielded instance options. - GceShieldedInstanceConfig shielded_instance_config = 8; - - // A set of Compute Engine Confidential VM instance options. - GceConfidentialInstanceConfig confidential_instance_config = 10; - - // Size of the boot disk in GB. Defaults to 50. - int32 boot_disk_size_gb = 9; - - // A list of the type and count of accelerator cards attached to the - // instance. - repeated Accelerator accelerators = 11; - } - - // Type of host that will be used for the workstation's runtime. - oneof config { - // Specifies a Compute Engine instance as the host. - GceInstance gce_instance = 1; - } - } - - // A directory to persist across workstation sessions. - message PersistentDirectory { - // A PersistentDirectory backed by a Compute Engine regional persistent - // disk. - message GceRegionalPersistentDisk { - // Value representing what should happen to the disk after the workstation - // is deleted. - enum ReclaimPolicy { - // Do not use. - RECLAIM_POLICY_UNSPECIFIED = 0; - - // The persistent disk will be deleted with the workstation. - DELETE = 1; - - // The persistent disk will be remain after the workstation is deleted, - // and the administrator must manually delete the disk. - RETAIN = 2; - } - - // Size of the disk in GB. Must be empty if source_snapshot is set. - // Defaults to 200. - int32 size_gb = 1; - - // Type of file system that the disk should be formatted with. The - // workstation image must support this file system type. Must be empty - // if source_snapshot is set. Defaults to ext4. - string fs_type = 2; - - // Type of the disk to use. Defaults to pd-standard. - string disk_type = 3; - - // Name of the snapshot to use as the source for the disk. If set, - // size_gb and fs_type must be empty. - string source_snapshot = 5; - - // What should happen to the disk after the workstation is deleted. - // Defaults to DELETE. - ReclaimPolicy reclaim_policy = 4; - } - - // Location of this directory in the running workstation. - string mount_path = 1; - - // How a persistent directory should be implemented. - oneof directory_type { - // A PersistentDirectory backed by a Compute Engine persistent disk. - GceRegionalPersistentDisk gce_pd = 2; - } - } - - // A Docker container. - message Container { - // Docker image defining the container. This image must be accessible by the - // service account specified in the workstation configuration. - string image = 1; - - // If set, overrides the default ENTRYPOINT specified by the image. - repeated string command = 2; - - // Arguments passed to the entrypoint. - repeated string args = 3; - - // Environment variables passed to the container's entrypoint. - map env = 4; - - // If set, overrides the default DIR specified by the image. - string working_dir = 5; - - // If set, overrides the USER specified in the image with the given uid. - int32 run_as_user = 6; - } - - // A customer-managed encryption key for the Compute Engine resources - // of this workstation configuration. - message CustomerEncryptionKey { - // Immutable. The name of the Google Cloud KMS encryption key. For example, - // `projects/PROJECT_ID/locations/REGION/keyRings/KEY_RING/cryptoKeys/KEY_NAME`. - string kms_key = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. The service account to use with the specified - // KMS key. We recommend that you use a separate service account - // and follow KMS best practices. For more information, see - // [Separation of - // duties](https://cloud.google.com/kms/docs/separation-of-duties) and - // `gcloud kms keys add-iam-policy-binding` - // [`--member`](https://cloud.google.com/sdk/gcloud/reference/kms/keys/add-iam-policy-binding#--member). - string kms_key_service_account = 2 - [(google.api.field_behavior) = IMMUTABLE]; - } - - // A readiness check to be performed on a workstation. - message ReadinessCheck { - // Path to which the request should be sent. - string path = 1; - - // Port to which the request should be sent. - int32 port = 2; - } - - // Full name of this resource. - string name = 1; - - // Human-readable name for this resource. - string display_name = 2; - - // Output only. A system-assigned unique identified for this resource. - string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates whether this resource is currently being updated to - // match its intended state. - bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Client-specified annotations. - map annotations = 5; - - // Client-specified labels that are applied to the resource and that are also - // propagated to the underlying Compute Engine resources. - map labels = 18; - - // Output only. Time when this resource was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was most recently updated. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was soft-deleted. - google.protobuf.Timestamp delete_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Checksum computed by the server. May be sent on update and delete requests - // to make sure that the client has an up-to-date value before proceeding. - string etag = 9; - - // How long to wait before automatically stopping an instance that hasn't - // received any user traffic. A value of 0 indicates that this instance - // should never time out due to idleness. Defaults to 20 minutes. - google.protobuf.Duration idle_timeout = 10; - - // How long to wait before automatically stopping a workstation after it - // started. A value of 0 indicates that workstations using this configuration - // should never time out. Must be greater than 0 and less than 24 hours if - // encryption_key is set. Defaults to 12 hours. - google.protobuf.Duration running_timeout = 11; - - // Runtime host for the workstation. - Host host = 12; - - // Directories to persist across workstation sessions. - repeated PersistentDirectory persistent_directories = 13; - - // Container that will be run for each workstation using this configuration - // when that workstation is started. - Container container = 14; - - // Immutable. Encrypts resources of this workstation configuration using a - // customer-managed encryption key. - // - // If specified, the boot disk of the Compute Engine instance and the - // persistent disk are encrypted using this encryption key. If - // this field is not set, the disks are encrypted using a generated - // key. Customer-managed encryption keys do not protect disk metadata. - // - // If the customer-managed encryption key is rotated, when the workstation - // instance is stopped, the system attempts to recreate the - // persistent disk with the new version of the key. Be sure to keep - // older versions of the key until the persistent disk is recreated. - // Otherwise, data on the persistent disk will be lost. - // - // If the encryption key is revoked, the workstation session will - // automatically be stopped within 7 hours. - // - // Immutable after the workstation configuration is created. - CustomerEncryptionKey encryption_key = 17 - [(google.api.field_behavior) = IMMUTABLE]; - - // Readiness checks to perform when starting a workstation using this - // workstation configuration. Mark a workstation as running only after all - // specified readiness checks return 200 status codes. - repeated ReadinessCheck readiness_checks = 19; - - // Output only. Whether this resource is in degraded mode, in which case it - // may require user action to restore full functionality. Details can be found - // in the `conditions` field. - bool degraded = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Status conditions describing the current resource state. - repeated google.rpc.Status conditions = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Whether to enable linux auditd logging on the workstation. When enabled, a - // service account must also be specified that has logging.buckets.write - // permission on the project. Operating system audit logging is distinct from - // [Cloud Audit - // Logs](https://cloud.google.com/workstations/docs/audit-logging). - bool enable_audit_agent = 20; -} - -// A single instance of a developer workstation with its own persistent storage. -message Workstation { - option (google.api.resource) = { - type: "workstations.googleapis.com/Workstation" - pattern: "projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}/workstations/{workstation}" - style: DECLARATIVE_FRIENDLY - }; - - // Whether a workstation is running and ready to receive user requests. - enum State { - // Do not use. - STATE_UNSPECIFIED = 0; - - // The workstation is not yet ready to accept requests from users but will - // be soon. - STATE_STARTING = 1; - - // The workstation is ready to accept requests from users. - STATE_RUNNING = 2; - - // The workstation is being stopped. - STATE_STOPPING = 3; - - // The workstation is stopped and will not be able to receive requests until - // it is started. - STATE_STOPPED = 4; - } - - // Full name of this resource. - string name = 1; - - // Human-readable name for this resource. - string display_name = 2; - - // Output only. A system-assigned unique identified for this resource. - string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates whether this resource is currently being updated to - // match its intended state. - bool reconciling = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Client-specified annotations. - map annotations = 5; - - // Client-specified labels that are applied to the resource and that are also - // propagated to the underlying Compute Engine resources. - map labels = 13; - - // Output only. Time when this resource was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was most recently updated. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this resource was soft-deleted. - google.protobuf.Timestamp delete_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Checksum computed by the server. May be sent on update and delete requests - // to make sure that the client has an up-to-date value before proceeding. - string etag = 9; - - // Output only. Current state of the workstation. - State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Host to which clients can send HTTPS traffic that will be - // received by the workstation. Authorized traffic will be received to the - // workstation as HTTP on port 80. To send traffic to a different port, - // clients may prefix the host with the destination port in the format - // `{port}-{host}`. - string host = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Environment variables passed to the workstation container's entrypoint. - map env = 12; -} - -// Request message for GetWorkstationCluster. -message GetWorkstationClusterRequest { - // Required. Name of the requested resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationCluster" - } - ]; -} - -// Request message for ListWorkstationClusters. -message ListWorkstationClustersRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // Maximum number of items to return. - int32 page_size = 2; - - // next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for ListWorkstationClusters. -message ListWorkstationClustersResponse { - // The requested workstation clusters. - repeated WorkstationCluster workstation_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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Message for creating a CreateWorkstationCluster. -message CreateWorkstationClusterRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // Required. ID to use for the workstation cluster. - string workstation_cluster_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Workstation cluster to create. - WorkstationCluster workstation_cluster = 3 - [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 4; -} - -// Request message for UpdateWorkstationCluster. -message UpdateWorkstationClusterRequest { - // Required. Workstation cluster to update. - WorkstationCluster workstation_cluster = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Mask that specifies which fields in the workstation cluster - // should be updated. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 3; - - // If set, and the workstation cluster is not found, a new workstation - // cluster will be created. In this situation, update_mask is ignored. - bool allow_missing = 4; -} - -// Message for deleting a workstation cluster. -message DeleteWorkstationClusterRequest { - // Required. Name of the workstation cluster to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // If set, validate the request and preview the review, but do not apply it. - bool validate_only = 2; - - // If set, the request will be rejected if the latest version of the - // workstation cluster on the server does not have this ETag. - string etag = 3; - - // If set, any workstation configurations and workstations in the - // workstation cluster are also deleted. Otherwise, the request only - // works if the workstation cluster has no configurations or workstations. - bool force = 4; -} - -// Request message for GetWorkstationConfig. -message GetWorkstationConfigRequest { - // Required. Name of the requested resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationConfig" - } - ]; -} - -// Request message for ListWorkstationConfigs. -message ListWorkstationConfigsRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // Maximum number of items to return. - int32 page_size = 2; - - // next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for ListWorkstationConfigs. -message ListWorkstationConfigsResponse { - // The requested configs. - repeated WorkstationConfig workstation_configs = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Request message for ListUsableWorkstationConfigs. -message ListUsableWorkstationConfigsRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // Maximum number of items to return. - int32 page_size = 2; - - // next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for ListUsableWorkstationConfigs. -message ListUsableWorkstationConfigsResponse { - // The requested configs. - repeated WorkstationConfig workstation_configs = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Message for creating a CreateWorkstationConfig. -message CreateWorkstationConfigRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationCluster" - } - ]; - - // Required. ID to use for the workstation configuration. - string workstation_config_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Config to create. - WorkstationConfig workstation_config = 3 - [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 4; -} - -// Request message for UpdateWorkstationConfig. -message UpdateWorkstationConfigRequest { - // Required. Config to update. - WorkstationConfig workstation_config = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Mask specifying which fields in the workstation configuration - // should be updated. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 3; - - // If set and the workstation configuration is not found, a new - // workstation configuration will be created. In this situation, - // update_mask is ignored. - bool allow_missing = 4; -} - -// Message for deleting a workstation configuration. -message DeleteWorkstationConfigRequest { - // Required. Name of the workstation configuration to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationConfig" - } - ]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 2; - - // If set, the request is rejected if the latest version of the - // workstation configuration on the server does not have this ETag. - string etag = 3; - - // If set, any workstations in the workstation configuration are also deleted. - // Otherwise, the request works only if the workstation configuration has - // no workstations. - bool force = 4; -} - -// Request message for GetWorkstation. -message GetWorkstationRequest { - // Required. Name of the requested resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/Workstation" - } - ]; -} - -// Request message for ListWorkstations. -message ListWorkstationsRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationConfig" - } - ]; - - // Maximum number of items to return. - int32 page_size = 2; - - // next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for ListWorkstations. -message ListWorkstationsResponse { - // The requested workstations. - repeated Workstation workstations = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Request message for ListUsableWorkstations. -message ListUsableWorkstationsRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationConfig" - } - ]; - - // Maximum number of items to return. - int32 page_size = 2; - - // next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for ListUsableWorkstations. -message ListUsableWorkstationsResponse { - // The requested workstations. - repeated Workstation workstations = 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; - - // Unreachable resources. - repeated string unreachable = 3; -} - -// Message for creating a CreateWorkstation. -message CreateWorkstationRequest { - // Required. Parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/WorkstationConfig" - } - ]; - - // Required. ID to use for the workstation. - string workstation_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Workstation to create. - Workstation workstation = 3 [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 4; -} - -// Request message for UpdateWorkstation. -message UpdateWorkstationRequest { - // Required. Workstation to update. - Workstation workstation = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Mask specifying which fields in the workstation configuration - // should be updated. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 3; - - // If set and the workstation configuration is not found, a new - // workstation configuration is created. In this situation, update_mask - // is ignored. - bool allow_missing = 4; -} - -// Request message for DeleteWorkstation. -message DeleteWorkstationRequest { - // Required. Name of the workstation to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/Workstation" - } - ]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 2; - - // If set, the request will be rejected if the latest version of the - // workstation on the server does not have this ETag. - string etag = 3; -} - -// Request message for StartWorkstation. -message StartWorkstationRequest { - // Required. Name of the workstation to start. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/Workstation" - } - ]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 2; - - // If set, the request will be rejected if the latest version of the - // workstation on the server does not have this ETag. - string etag = 3; -} - -// Request message for StopWorkstation. -message StopWorkstationRequest { - // Required. Name of the workstation to stop. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/Workstation" - } - ]; - - // If set, validate the request and preview the review, but do not actually - // apply it. - bool validate_only = 2; - - // If set, the request will be rejected if the latest version of the - // workstation on the server does not have this ETag. - string etag = 3; -} - -// Request message for GenerateAccessToken. -message GenerateAccessTokenRequest { - // Required. Name of the workstation for which the access token should be - // generated. - string workstation = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "workstations.googleapis.com/Workstation" - } - ]; - - // Desired expiration or lifetime of the access token. - oneof expiration { - // Desired expiration time of the access token. This value must - // be at most 24 hours in the future. If a value is not specified, the - // token's expiration time will be set to a default value of 1 hour in the - // future. - google.protobuf.Timestamp expire_time = 2; - - // Desired lifetime duration of the access token. This value must - // be at most 24 hours. If a value is not specified, the token's lifetime - // will be set to a default value of 1 hour. - google.protobuf.Duration ttl = 3; - } -} - -// Response message for GenerateAccessToken. -message GenerateAccessTokenResponse { - // The generated bearer access token. To use this token, include it in an - // Authorization header of an HTTP request sent to the associated - // workstation's hostname—for example, `Authorization: Bearer - // `. - string access_token = 1; - - // Time at which the generated token will expire. - google.protobuf.Timestamp expire_time = 2; -} - -// Metadata for long-running operations. -message OperationMetadata { - // Output only. Time that the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time that 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. - 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-workstations/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workstations.v1beta.json b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workstations.v1beta.json deleted file mode 100644 index a1e3de6d395..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/snippet_metadata_google.cloud.workstations.v1beta.json +++ /dev/null @@ -1,983 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-workstations", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.workstations.v1beta", - "version": "v1beta" - } - ] - }, - "snippets": [ - { - "regionTag": "workstations_v1beta_generated_Workstations_GetWorkstationCluster_async", - "title": "Workstations getWorkstationCluster Sample", - "origin": "API_DEFINITION", - "description": " Returns the requested workstation cluster.", - "canonical": true, - "file": "workstations.get_workstation_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkstationCluster", - "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstationCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1beta.WorkstationCluster", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "GetWorkstationCluster", - "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstationCluster", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_ListWorkstationClusters_async", - "title": "Workstations listWorkstationClusters Sample", - "origin": "API_DEFINITION", - "description": " Returns all workstation clusters in the specified location.", - "canonical": true, - "file": "workstations.list_workstation_clusters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkstationClusters", - "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstationClusters", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1beta.ListWorkstationClustersResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "ListWorkstationClusters", - "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstationClusters", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_CreateWorkstationCluster_async", - "title": "Workstations createWorkstationCluster Sample", - "origin": "API_DEFINITION", - "description": " Creates a new workstation cluster.", - "canonical": true, - "file": "workstations.create_workstation_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkstationCluster", - "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstationCluster", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "workstation_cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "workstation_cluster", - "type": ".google.cloud.workstations.v1beta.WorkstationCluster" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "CreateWorkstationCluster", - "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstationCluster", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_UpdateWorkstationCluster_async", - "title": "Workstations updateWorkstationCluster Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing workstation cluster.", - "canonical": true, - "file": "workstations.update_workstation_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkstationCluster", - "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstationCluster", - "async": true, - "parameters": [ - { - "name": "workstation_cluster", - "type": ".google.cloud.workstations.v1beta.WorkstationCluster" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "UpdateWorkstationCluster", - "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstationCluster", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_DeleteWorkstationCluster_async", - "title": "Workstations deleteWorkstationCluster Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified workstation cluster.", - "canonical": true, - "file": "workstations.delete_workstation_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkstationCluster", - "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstationCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "DeleteWorkstationCluster", - "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstationCluster", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_GetWorkstationConfig_async", - "title": "Workstations getWorkstationConfig Sample", - "origin": "API_DEFINITION", - "description": " Returns the requested workstation configuration.", - "canonical": true, - "file": "workstations.get_workstation_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkstationConfig", - "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1beta.WorkstationConfig", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "GetWorkstationConfig", - "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstationConfig", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_ListWorkstationConfigs_async", - "title": "Workstations listWorkstationConfigs Sample", - "origin": "API_DEFINITION", - "description": " Returns all workstation configurations in the specified cluster.", - "canonical": true, - "file": "workstations.list_workstation_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkstationConfigs", - "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstationConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1beta.ListWorkstationConfigsResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "ListWorkstationConfigs", - "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstationConfigs", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_ListUsableWorkstationConfigs_async", - "title": "Workstations listUsableWorkstationConfigs Sample", - "origin": "API_DEFINITION", - "description": " Returns all workstation configurations in the specified cluster on which the caller has the \"workstations.workstation.create\" permission.", - "canonical": true, - "file": "workstations.list_usable_workstation_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListUsableWorkstationConfigs", - "fullName": "google.cloud.workstations.v1beta.Workstations.ListUsableWorkstationConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1beta.ListUsableWorkstationConfigsResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "ListUsableWorkstationConfigs", - "fullName": "google.cloud.workstations.v1beta.Workstations.ListUsableWorkstationConfigs", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_CreateWorkstationConfig_async", - "title": "Workstations createWorkstationConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a new workstation configuration.", - "canonical": true, - "file": "workstations.create_workstation_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkstationConfig", - "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstationConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "workstation_config_id", - "type": "TYPE_STRING" - }, - { - "name": "workstation_config", - "type": ".google.cloud.workstations.v1beta.WorkstationConfig" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "CreateWorkstationConfig", - "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstationConfig", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_UpdateWorkstationConfig_async", - "title": "Workstations updateWorkstationConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing workstation configuration.", - "canonical": true, - "file": "workstations.update_workstation_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkstationConfig", - "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstationConfig", - "async": true, - "parameters": [ - { - "name": "workstation_config", - "type": ".google.cloud.workstations.v1beta.WorkstationConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "UpdateWorkstationConfig", - "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstationConfig", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_DeleteWorkstationConfig_async", - "title": "Workstations deleteWorkstationConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified workstation configuration.", - "canonical": true, - "file": "workstations.delete_workstation_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkstationConfig", - "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "DeleteWorkstationConfig", - "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstationConfig", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_GetWorkstation_async", - "title": "Workstations getWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Returns the requested workstation.", - "canonical": true, - "file": "workstations.get_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1beta.Workstation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "GetWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.GetWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_ListWorkstations_async", - "title": "Workstations listWorkstations Sample", - "origin": "API_DEFINITION", - "description": " Returns all Workstations using the specified workstation configuration.", - "canonical": true, - "file": "workstations.list_workstations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkstations", - "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1beta.ListWorkstationsResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "ListWorkstations", - "fullName": "google.cloud.workstations.v1beta.Workstations.ListWorkstations", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_ListUsableWorkstations_async", - "title": "Workstations listUsableWorkstations Sample", - "origin": "API_DEFINITION", - "description": " Returns all workstations using the specified workstation configuration on which the caller has the \"workstations.workstations.use\" permission.", - "canonical": true, - "file": "workstations.list_usable_workstations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListUsableWorkstations", - "fullName": "google.cloud.workstations.v1beta.Workstations.ListUsableWorkstations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workstations.v1beta.ListUsableWorkstationsResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "ListUsableWorkstations", - "fullName": "google.cloud.workstations.v1beta.Workstations.ListUsableWorkstations", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_CreateWorkstation_async", - "title": "Workstations createWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Creates a new workstation.", - "canonical": true, - "file": "workstations.create_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "workstation_id", - "type": "TYPE_STRING" - }, - { - "name": "workstation", - "type": ".google.cloud.workstations.v1beta.Workstation" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "CreateWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.CreateWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_UpdateWorkstation_async", - "title": "Workstations updateWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing workstation.", - "canonical": true, - "file": "workstations.update_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstation", - "async": true, - "parameters": [ - { - "name": "workstation", - "type": ".google.cloud.workstations.v1beta.Workstation" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "UpdateWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.UpdateWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_DeleteWorkstation_async", - "title": "Workstations deleteWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified workstation.", - "canonical": true, - "file": "workstations.delete_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "DeleteWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.DeleteWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_StartWorkstation_async", - "title": "Workstations startWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Starts running a workstation so that users can connect to it.", - "canonical": true, - "file": "workstations.start_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.StartWorkstation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "StartWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.StartWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_StopWorkstation_async", - "title": "Workstations stopWorkstation Sample", - "origin": "API_DEFINITION", - "description": " Stops running a workstation, reducing costs.", - "canonical": true, - "file": "workstations.stop_workstation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.StopWorkstation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "StopWorkstation", - "fullName": "google.cloud.workstations.v1beta.Workstations.StopWorkstation", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - }, - { - "regionTag": "workstations_v1beta_generated_Workstations_GenerateAccessToken_async", - "title": "Workstations generateAccessToken Sample", - "origin": "API_DEFINITION", - "description": " Returns a short-lived credential that can be used to send authenticated and authorized traffic to a workstation.", - "canonical": true, - "file": "workstations.generate_access_token.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateAccessToken", - "fullName": "google.cloud.workstations.v1beta.Workstations.GenerateAccessToken", - "async": true, - "parameters": [ - { - "name": "workstation", - "type": "TYPE_STRING" - }, - { - "name": "expire_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "ttl", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.cloud.workstations.v1beta.GenerateAccessTokenResponse", - "client": { - "shortName": "WorkstationsClient", - "fullName": "google.cloud.workstations.v1beta.WorkstationsClient" - }, - "method": { - "shortName": "GenerateAccessToken", - "fullName": "google.cloud.workstations.v1beta.Workstations.GenerateAccessToken", - "service": { - "shortName": "Workstations", - "fullName": "google.cloud.workstations.v1beta.Workstations" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation.js deleted file mode 100644 index 8f06f4e3ed2..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation.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, workstationId, workstation) { - // [START workstations_v1beta_generated_Workstations_CreateWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Required. ID to use for the workstation. - */ - // const workstationId = 'abc123' - /** - * Required. Workstation to create. - */ - // const workstation = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callCreateWorkstation() { - // Construct request - const request = { - parent, - workstationId, - workstation, - }; - - // Run request - const [operation] = await workstationsClient.createWorkstation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateWorkstation(); - // [END workstations_v1beta_generated_Workstations_CreateWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_cluster.js deleted file mode 100644 index cee2f671720..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_cluster.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, workstationClusterId, workstationCluster) { - // [START workstations_v1beta_generated_Workstations_CreateWorkstationCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Required. ID to use for the workstation cluster. - */ - // const workstationClusterId = 'abc123' - /** - * Required. Workstation cluster to create. - */ - // const workstationCluster = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callCreateWorkstationCluster() { - // Construct request - const request = { - parent, - workstationClusterId, - workstationCluster, - }; - - // Run request - const [operation] = await workstationsClient.createWorkstationCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateWorkstationCluster(); - // [END workstations_v1beta_generated_Workstations_CreateWorkstationCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_config.js deleted file mode 100644 index 06b8cdb0a1b..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.create_workstation_config.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, workstationConfigId, workstationConfig) { - // [START workstations_v1beta_generated_Workstations_CreateWorkstationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Required. ID to use for the workstation configuration. - */ - // const workstationConfigId = 'abc123' - /** - * Required. Config to create. - */ - // const workstationConfig = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callCreateWorkstationConfig() { - // Construct request - const request = { - parent, - workstationConfigId, - workstationConfig, - }; - - // Run request - const [operation] = await workstationsClient.createWorkstationConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateWorkstationConfig(); - // [END workstations_v1beta_generated_Workstations_CreateWorkstationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation.js deleted file mode 100644 index 2bbc0c5091a..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation.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) { - // [START workstations_v1beta_generated_Workstations_DeleteWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workstation to delete. - */ - // const name = 'abc123' - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this ETag. - */ - // const etag = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callDeleteWorkstation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workstationsClient.deleteWorkstation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteWorkstation(); - // [END workstations_v1beta_generated_Workstations_DeleteWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_cluster.js deleted file mode 100644 index e6b9d1833ed..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_cluster.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 workstations_v1beta_generated_Workstations_DeleteWorkstationCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workstation cluster to delete. - */ - // const name = 'abc123' - /** - * If set, validate the request and preview the review, but do not apply it. - */ - // const validateOnly = true - /** - * If set, the request will be rejected if the latest version of the - * workstation cluster on the server does not have this ETag. - */ - // const etag = 'abc123' - /** - * If set, any workstation configurations and workstations in the - * workstation cluster are also deleted. Otherwise, the request only - * works if the workstation cluster has no configurations or workstations. - */ - // const force = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callDeleteWorkstationCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workstationsClient.deleteWorkstationCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteWorkstationCluster(); - // [END workstations_v1beta_generated_Workstations_DeleteWorkstationCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_config.js deleted file mode 100644 index 689d9f063ca..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.delete_workstation_config.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(name) { - // [START workstations_v1beta_generated_Workstations_DeleteWorkstationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workstation configuration to delete. - */ - // const name = 'abc123' - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set, the request is rejected if the latest version of the - * workstation configuration on the server does not have this ETag. - */ - // const etag = 'abc123' - /** - * If set, any workstations in the workstation configuration are also deleted. - * Otherwise, the request works only if the workstation configuration has - * no workstations. - */ - // const force = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callDeleteWorkstationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workstationsClient.deleteWorkstationConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteWorkstationConfig(); - // [END workstations_v1beta_generated_Workstations_DeleteWorkstationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.generate_access_token.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.generate_access_token.js deleted file mode 100644 index 4daa06ed5a1..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.generate_access_token.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(workstation) { - // [START workstations_v1beta_generated_Workstations_GenerateAccessToken_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workstation for which the access token should be - * generated. - */ - // const workstation = 'abc123' - /** - * Desired expiration time of the access token. This value must - * be at most 24 hours in the future. If a value is not specified, the - * token's expiration time will be set to a default value of 1 hour in the - * future. - */ - // const expireTime = {} - /** - * Desired lifetime duration of the access token. This value must - * be at most 24 hours. If a value is not specified, the token's lifetime - * will be set to a default value of 1 hour. - */ - // const ttl = {} - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callGenerateAccessToken() { - // Construct request - const request = { - workstation, - }; - - // Run request - const response = await workstationsClient.generateAccessToken(request); - console.log(response); - } - - callGenerateAccessToken(); - // [END workstations_v1beta_generated_Workstations_GenerateAccessToken_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation.js deleted file mode 100644 index b530e0495fd..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation.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 workstations_v1beta_generated_Workstations_GetWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 requested resource. - */ - // const name = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callGetWorkstation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await workstationsClient.getWorkstation(request); - console.log(response); - } - - callGetWorkstation(); - // [END workstations_v1beta_generated_Workstations_GetWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_cluster.js deleted file mode 100644 index 428a03d1285..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_cluster.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 workstations_v1beta_generated_Workstations_GetWorkstationCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 requested resource. - */ - // const name = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callGetWorkstationCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await workstationsClient.getWorkstationCluster(request); - console.log(response); - } - - callGetWorkstationCluster(); - // [END workstations_v1beta_generated_Workstations_GetWorkstationCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_config.js deleted file mode 100644 index 65085239d8b..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.get_workstation_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 workstations_v1beta_generated_Workstations_GetWorkstationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 requested resource. - */ - // const name = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callGetWorkstationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await workstationsClient.getWorkstationConfig(request); - console.log(response); - } - - callGetWorkstationConfig(); - // [END workstations_v1beta_generated_Workstations_GetWorkstationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstation_configs.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstation_configs.js deleted file mode 100644 index e00acc5c95f..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstation_configs.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(parent) { - // [START workstations_v1beta_generated_Workstations_ListUsableWorkstationConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Maximum number of items to return. - */ - // const pageSize = 1234 - /** - * next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callListUsableWorkstationConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workstationsClient.listUsableWorkstationConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListUsableWorkstationConfigs(); - // [END workstations_v1beta_generated_Workstations_ListUsableWorkstationConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstations.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstations.js deleted file mode 100644 index 78ba41a96df..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_usable_workstations.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(parent) { - // [START workstations_v1beta_generated_Workstations_ListUsableWorkstations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Maximum number of items to return. - */ - // const pageSize = 1234 - /** - * next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callListUsableWorkstations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workstationsClient.listUsableWorkstationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListUsableWorkstations(); - // [END workstations_v1beta_generated_Workstations_ListUsableWorkstations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_clusters.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_clusters.js deleted file mode 100644 index 5077a5eeea0..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_clusters.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(parent) { - // [START workstations_v1beta_generated_Workstations_ListWorkstationClusters_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Maximum number of items to return. - */ - // const pageSize = 1234 - /** - * next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callListWorkstationClusters() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workstationsClient.listWorkstationClustersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListWorkstationClusters(); - // [END workstations_v1beta_generated_Workstations_ListWorkstationClusters_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_configs.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_configs.js deleted file mode 100644 index 84059dd3381..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstation_configs.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(parent) { - // [START workstations_v1beta_generated_Workstations_ListWorkstationConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Maximum number of items to return. - */ - // const pageSize = 1234 - /** - * next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callListWorkstationConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workstationsClient.listWorkstationConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListWorkstationConfigs(); - // [END workstations_v1beta_generated_Workstations_ListWorkstationConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstations.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstations.js deleted file mode 100644 index 40a4c1fc3bc..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.list_workstations.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(parent) { - // [START workstations_v1beta_generated_Workstations_ListWorkstations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - */ - // const parent = 'abc123' - /** - * Maximum number of items to return. - */ - // const pageSize = 1234 - /** - * next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callListWorkstations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await workstationsClient.listWorkstationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListWorkstations(); - // [END workstations_v1beta_generated_Workstations_ListWorkstations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.start_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.start_workstation.js deleted file mode 100644 index 80b23015d70..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.start_workstation.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) { - // [START workstations_v1beta_generated_Workstations_StartWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workstation to start. - */ - // const name = 'abc123' - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this ETag. - */ - // const etag = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callStartWorkstation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workstationsClient.startWorkstation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callStartWorkstation(); - // [END workstations_v1beta_generated_Workstations_StartWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.stop_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.stop_workstation.js deleted file mode 100644 index 16ad243fe8d..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.stop_workstation.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) { - // [START workstations_v1beta_generated_Workstations_StopWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 workstation to stop. - */ - // const name = 'abc123' - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this ETag. - */ - // const etag = 'abc123' - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callStopWorkstation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await workstationsClient.stopWorkstation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callStopWorkstation(); - // [END workstations_v1beta_generated_Workstations_StopWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation.js deleted file mode 100644 index 3dcab94e56f..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation.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(workstation, updateMask) { - // [START workstations_v1beta_generated_Workstations_UpdateWorkstation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Workstation to update. - */ - // const workstation = {} - /** - * Required. Mask specifying which fields in the workstation configuration - * should be updated. - */ - // const updateMask = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set and the workstation configuration is not found, a new - * workstation configuration is created. In this situation, update_mask - * is ignored. - */ - // const allowMissing = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callUpdateWorkstation() { - // Construct request - const request = { - workstation, - updateMask, - }; - - // Run request - const [operation] = await workstationsClient.updateWorkstation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateWorkstation(); - // [END workstations_v1beta_generated_Workstations_UpdateWorkstation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_cluster.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_cluster.js deleted file mode 100644 index 763ce7d3aee..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_cluster.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(workstationCluster, updateMask) { - // [START workstations_v1beta_generated_Workstations_UpdateWorkstationCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Workstation cluster to update. - */ - // const workstationCluster = {} - /** - * Required. Mask that specifies which fields in the workstation cluster - * should be updated. - */ - // const updateMask = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set, and the workstation cluster is not found, a new workstation - * cluster will be created. In this situation, update_mask is ignored. - */ - // const allowMissing = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callUpdateWorkstationCluster() { - // Construct request - const request = { - workstationCluster, - updateMask, - }; - - // Run request - const [operation] = await workstationsClient.updateWorkstationCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateWorkstationCluster(); - // [END workstations_v1beta_generated_Workstations_UpdateWorkstationCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_config.js b/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_config.js deleted file mode 100644 index 1d4a94bc91a..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/samples/generated/v1beta/workstations.update_workstation_config.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(workstationConfig, updateMask) { - // [START workstations_v1beta_generated_Workstations_UpdateWorkstationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Config to update. - */ - // const workstationConfig = {} - /** - * Required. Mask specifying which fields in the workstation configuration - * should be updated. - */ - // const updateMask = {} - /** - * If set, validate the request and preview the review, but do not actually - * apply it. - */ - // const validateOnly = true - /** - * If set and the workstation configuration is not found, a new - * workstation configuration will be created. In this situation, - * update_mask is ignored. - */ - // const allowMissing = true - - // Imports the Workstations library - const {WorkstationsClient} = require('@google-cloud/workstations').v1beta; - - // Instantiates a client - const workstationsClient = new WorkstationsClient(); - - async function callUpdateWorkstationConfig() { - // Construct request - const request = { - workstationConfig, - updateMask, - }; - - // Run request - const [operation] = await workstationsClient.updateWorkstationConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateWorkstationConfig(); - // [END workstations_v1beta_generated_Workstations_UpdateWorkstationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/src/index.ts b/owl-bot-staging/google-cloud-workstations/v1beta/src/index.ts deleted file mode 100644 index ef3f0b62af2..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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 WorkstationsClient = v1beta.WorkstationsClient; -type WorkstationsClient = v1beta.WorkstationsClient; -export {v1beta, WorkstationsClient}; -export default {v1beta, WorkstationsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/gapic_metadata.json deleted file mode 100644 index 14443a3ae14..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/gapic_metadata.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.workstations.v1beta", - "libraryPackage": "@google-cloud/workstations", - "services": { - "Workstations": { - "clients": { - "grpc": { - "libraryClient": "WorkstationsClient", - "rpcs": { - "GetWorkstationCluster": { - "methods": [ - "getWorkstationCluster" - ] - }, - "GetWorkstationConfig": { - "methods": [ - "getWorkstationConfig" - ] - }, - "GetWorkstation": { - "methods": [ - "getWorkstation" - ] - }, - "GenerateAccessToken": { - "methods": [ - "generateAccessToken" - ] - }, - "CreateWorkstationCluster": { - "methods": [ - "createWorkstationCluster" - ] - }, - "UpdateWorkstationCluster": { - "methods": [ - "updateWorkstationCluster" - ] - }, - "DeleteWorkstationCluster": { - "methods": [ - "deleteWorkstationCluster" - ] - }, - "CreateWorkstationConfig": { - "methods": [ - "createWorkstationConfig" - ] - }, - "UpdateWorkstationConfig": { - "methods": [ - "updateWorkstationConfig" - ] - }, - "DeleteWorkstationConfig": { - "methods": [ - "deleteWorkstationConfig" - ] - }, - "CreateWorkstation": { - "methods": [ - "createWorkstation" - ] - }, - "UpdateWorkstation": { - "methods": [ - "updateWorkstation" - ] - }, - "DeleteWorkstation": { - "methods": [ - "deleteWorkstation" - ] - }, - "StartWorkstation": { - "methods": [ - "startWorkstation" - ] - }, - "StopWorkstation": { - "methods": [ - "stopWorkstation" - ] - }, - "ListWorkstationClusters": { - "methods": [ - "listWorkstationClusters", - "listWorkstationClustersStream", - "listWorkstationClustersAsync" - ] - }, - "ListWorkstationConfigs": { - "methods": [ - "listWorkstationConfigs", - "listWorkstationConfigsStream", - "listWorkstationConfigsAsync" - ] - }, - "ListUsableWorkstationConfigs": { - "methods": [ - "listUsableWorkstationConfigs", - "listUsableWorkstationConfigsStream", - "listUsableWorkstationConfigsAsync" - ] - }, - "ListWorkstations": { - "methods": [ - "listWorkstations", - "listWorkstationsStream", - "listWorkstationsAsync" - ] - }, - "ListUsableWorkstations": { - "methods": [ - "listUsableWorkstations", - "listUsableWorkstationsStream", - "listUsableWorkstationsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WorkstationsClient", - "rpcs": { - "GetWorkstationCluster": { - "methods": [ - "getWorkstationCluster" - ] - }, - "GetWorkstationConfig": { - "methods": [ - "getWorkstationConfig" - ] - }, - "GetWorkstation": { - "methods": [ - "getWorkstation" - ] - }, - "GenerateAccessToken": { - "methods": [ - "generateAccessToken" - ] - }, - "CreateWorkstationCluster": { - "methods": [ - "createWorkstationCluster" - ] - }, - "UpdateWorkstationCluster": { - "methods": [ - "updateWorkstationCluster" - ] - }, - "DeleteWorkstationCluster": { - "methods": [ - "deleteWorkstationCluster" - ] - }, - "CreateWorkstationConfig": { - "methods": [ - "createWorkstationConfig" - ] - }, - "UpdateWorkstationConfig": { - "methods": [ - "updateWorkstationConfig" - ] - }, - "DeleteWorkstationConfig": { - "methods": [ - "deleteWorkstationConfig" - ] - }, - "CreateWorkstation": { - "methods": [ - "createWorkstation" - ] - }, - "UpdateWorkstation": { - "methods": [ - "updateWorkstation" - ] - }, - "DeleteWorkstation": { - "methods": [ - "deleteWorkstation" - ] - }, - "StartWorkstation": { - "methods": [ - "startWorkstation" - ] - }, - "StopWorkstation": { - "methods": [ - "stopWorkstation" - ] - }, - "ListWorkstationClusters": { - "methods": [ - "listWorkstationClusters", - "listWorkstationClustersStream", - "listWorkstationClustersAsync" - ] - }, - "ListWorkstationConfigs": { - "methods": [ - "listWorkstationConfigs", - "listWorkstationConfigsStream", - "listWorkstationConfigsAsync" - ] - }, - "ListUsableWorkstationConfigs": { - "methods": [ - "listUsableWorkstationConfigs", - "listUsableWorkstationConfigsStream", - "listUsableWorkstationConfigsAsync" - ] - }, - "ListWorkstations": { - "methods": [ - "listWorkstations", - "listWorkstationsStream", - "listWorkstationsAsync" - ] - }, - "ListUsableWorkstations": { - "methods": [ - "listUsableWorkstations", - "listUsableWorkstationsStream", - "listUsableWorkstationsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/index.ts deleted file mode 100644 index 8fd62185321..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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 {WorkstationsClient} from './workstations_client'; diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client.ts b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client.ts deleted file mode 100644 index 717821738c9..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client.ts +++ /dev/null @@ -1,3315 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/workstations_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './workstations_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for interacting with Cloud Workstations. - * @class - * @memberof v1beta - */ -export class WorkstationsClient { - 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; - workstationsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WorkstationsClient. - * - * @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 WorkstationsClient({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 WorkstationsClient; - 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}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - workstationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}/workstations/{workstation}' - ), - workstationClusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}' - ), - workstationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workstationClusters/{workstation_cluster}/workstationConfigs/{workstation_config}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listWorkstationClusters: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationClusters'), - listWorkstationConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationConfigs'), - listUsableWorkstationConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstationConfigs'), - listWorkstations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstations'), - listUsableWorkstations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workstations') - }; - - 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.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/workstationClusters/*/workstationConfigs/*/workstations/*}: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 createWorkstationClusterResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.WorkstationCluster') as gax.protobuf.Type; - const createWorkstationClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; - const updateWorkstationClusterResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.WorkstationCluster') as gax.protobuf.Type; - const updateWorkstationClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; - const deleteWorkstationClusterResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.WorkstationCluster') as gax.protobuf.Type; - const deleteWorkstationClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; - const createWorkstationConfigResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.WorkstationConfig') as gax.protobuf.Type; - const createWorkstationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; - const updateWorkstationConfigResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.WorkstationConfig') as gax.protobuf.Type; - const updateWorkstationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; - const deleteWorkstationConfigResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.WorkstationConfig') as gax.protobuf.Type; - const deleteWorkstationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; - const createWorkstationResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.Workstation') as gax.protobuf.Type; - const createWorkstationMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; - const updateWorkstationResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.Workstation') as gax.protobuf.Type; - const updateWorkstationMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; - const deleteWorkstationResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.Workstation') as gax.protobuf.Type; - const deleteWorkstationMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; - const startWorkstationResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.Workstation') as gax.protobuf.Type; - const startWorkstationMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; - const stopWorkstationResponse = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.Workstation') as gax.protobuf.Type; - const stopWorkstationMetadata = protoFilesRoot.lookup( - '.google.cloud.workstations.v1beta.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createWorkstationCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createWorkstationClusterResponse.decode.bind(createWorkstationClusterResponse), - createWorkstationClusterMetadata.decode.bind(createWorkstationClusterMetadata)), - updateWorkstationCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateWorkstationClusterResponse.decode.bind(updateWorkstationClusterResponse), - updateWorkstationClusterMetadata.decode.bind(updateWorkstationClusterMetadata)), - deleteWorkstationCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteWorkstationClusterResponse.decode.bind(deleteWorkstationClusterResponse), - deleteWorkstationClusterMetadata.decode.bind(deleteWorkstationClusterMetadata)), - createWorkstationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createWorkstationConfigResponse.decode.bind(createWorkstationConfigResponse), - createWorkstationConfigMetadata.decode.bind(createWorkstationConfigMetadata)), - updateWorkstationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateWorkstationConfigResponse.decode.bind(updateWorkstationConfigResponse), - updateWorkstationConfigMetadata.decode.bind(updateWorkstationConfigMetadata)), - deleteWorkstationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteWorkstationConfigResponse.decode.bind(deleteWorkstationConfigResponse), - deleteWorkstationConfigMetadata.decode.bind(deleteWorkstationConfigMetadata)), - createWorkstation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createWorkstationResponse.decode.bind(createWorkstationResponse), - createWorkstationMetadata.decode.bind(createWorkstationMetadata)), - updateWorkstation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateWorkstationResponse.decode.bind(updateWorkstationResponse), - updateWorkstationMetadata.decode.bind(updateWorkstationMetadata)), - deleteWorkstation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteWorkstationResponse.decode.bind(deleteWorkstationResponse), - deleteWorkstationMetadata.decode.bind(deleteWorkstationMetadata)), - startWorkstation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - startWorkstationResponse.decode.bind(startWorkstationResponse), - startWorkstationMetadata.decode.bind(startWorkstationMetadata)), - stopWorkstation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - stopWorkstationResponse.decode.bind(stopWorkstationResponse), - stopWorkstationMetadata.decode.bind(stopWorkstationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workstations.v1beta.Workstations', 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.workstationsStub) { - return this.workstationsStub; - } - - // Put together the "service stub" for - // google.cloud.workstations.v1beta.Workstations. - this.workstationsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workstations.v1beta.Workstations') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.workstations.v1beta.Workstations, - 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 workstationsStubMethods = - ['getWorkstationCluster', 'listWorkstationClusters', 'createWorkstationCluster', 'updateWorkstationCluster', 'deleteWorkstationCluster', 'getWorkstationConfig', 'listWorkstationConfigs', 'listUsableWorkstationConfigs', 'createWorkstationConfig', 'updateWorkstationConfig', 'deleteWorkstationConfig', 'getWorkstation', 'listWorkstations', 'listUsableWorkstations', 'createWorkstation', 'updateWorkstation', 'deleteWorkstation', 'startWorkstation', 'stopWorkstation', 'generateAccessToken']; - for (const methodName of workstationsStubMethods) { - const callPromise = this.workstationsStub.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.workstationsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'workstations.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 'workstations.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 the requested workstation cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the requested 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.workstations.v1beta.WorkstationCluster|WorkstationCluster}. - * Please see the {@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/workstations.get_workstation_cluster.js - * region_tag:workstations_v1beta_generated_Workstations_GetWorkstationCluster_async - */ - getWorkstationCluster( - request?: protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstationCluster, - protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|undefined, {}|undefined - ]>; - getWorkstationCluster( - request: protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workstations.v1beta.IWorkstationCluster, - protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|null|undefined, - {}|null|undefined>): void; - getWorkstationCluster( - request: protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest, - callback: Callback< - protos.google.cloud.workstations.v1beta.IWorkstationCluster, - protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|null|undefined, - {}|null|undefined>): void; - getWorkstationCluster( - request?: protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workstations.v1beta.IWorkstationCluster, - protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workstations.v1beta.IWorkstationCluster, - protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstationCluster, - protos.google.cloud.workstations.v1beta.IGetWorkstationClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getWorkstationCluster(request, options, callback); - } -/** - * Returns the requested workstation configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the requested 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.workstations.v1beta.WorkstationConfig|WorkstationConfig}. - * Please see the {@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/workstations.get_workstation_config.js - * region_tag:workstations_v1beta_generated_Workstations_GetWorkstationConfig_async - */ - getWorkstationConfig( - request?: protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstationConfig, - protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|undefined, {}|undefined - ]>; - getWorkstationConfig( - request: protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workstations.v1beta.IWorkstationConfig, - protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|null|undefined, - {}|null|undefined>): void; - getWorkstationConfig( - request: protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest, - callback: Callback< - protos.google.cloud.workstations.v1beta.IWorkstationConfig, - protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|null|undefined, - {}|null|undefined>): void; - getWorkstationConfig( - request?: protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workstations.v1beta.IWorkstationConfig, - protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workstations.v1beta.IWorkstationConfig, - protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstationConfig, - protos.google.cloud.workstations.v1beta.IGetWorkstationConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getWorkstationConfig(request, options, callback); - } -/** - * Returns the requested workstation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the requested 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.workstations.v1beta.Workstation|Workstation}. - * Please see the {@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/workstations.get_workstation.js - * region_tag:workstations_v1beta_generated_Workstations_GetWorkstation_async - */ - getWorkstation( - request?: protos.google.cloud.workstations.v1beta.IGetWorkstationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstation, - protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|undefined, {}|undefined - ]>; - getWorkstation( - request: protos.google.cloud.workstations.v1beta.IGetWorkstationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workstations.v1beta.IWorkstation, - protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|null|undefined, - {}|null|undefined>): void; - getWorkstation( - request: protos.google.cloud.workstations.v1beta.IGetWorkstationRequest, - callback: Callback< - protos.google.cloud.workstations.v1beta.IWorkstation, - protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|null|undefined, - {}|null|undefined>): void; - getWorkstation( - request?: protos.google.cloud.workstations.v1beta.IGetWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workstations.v1beta.IWorkstation, - protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workstations.v1beta.IWorkstation, - protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstation, - protos.google.cloud.workstations.v1beta.IGetWorkstationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getWorkstation(request, options, callback); - } -/** - * Returns a short-lived credential that can be used to send authenticated and - * authorized traffic to a workstation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.workstation - * Required. Name of the workstation for which the access token should be - * generated. - * @param {google.protobuf.Timestamp} request.expireTime - * Desired expiration time of the access token. This value must - * be at most 24 hours in the future. If a value is not specified, the - * token's expiration time will be set to a default value of 1 hour in the - * future. - * @param {google.protobuf.Duration} request.ttl - * Desired lifetime duration of the access token. This value must - * be at most 24 hours. If a value is not specified, the token's lifetime - * will be set to a default value of 1 hour. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workstations.v1beta.GenerateAccessTokenResponse|GenerateAccessTokenResponse}. - * Please see the {@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/workstations.generate_access_token.js - * region_tag:workstations_v1beta_generated_Workstations_GenerateAccessToken_async - */ - generateAccessToken( - request?: protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|undefined, {}|undefined - ]>; - generateAccessToken( - request: protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>): void; - generateAccessToken( - request: protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest, - callback: Callback< - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>): void; - generateAccessToken( - request?: protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse, - protos.google.cloud.workstations.v1beta.IGenerateAccessTokenRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workstation': request.workstation ?? '', - }); - this.initialize(); - return this.innerApiCalls.generateAccessToken(request, options, callback); - } - -/** - * Creates a new workstation cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {string} request.workstationClusterId - * Required. ID to use for the workstation cluster. - * @param {google.cloud.workstations.v1beta.WorkstationCluster} request.workstationCluster - * Required. Workstation cluster to create. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workstations.create_workstation_cluster.js - * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstationCluster_async - */ - createWorkstationCluster( - request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createWorkstationCluster( - request: protos.google.cloud.workstations.v1beta.ICreateWorkstationClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstationCluster( - request: protos.google.cloud.workstations.v1beta.ICreateWorkstationClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstationCluster( - request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createWorkstationCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createWorkstationCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workstations.create_workstation_cluster.js - * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstationCluster_async - */ - async checkCreateWorkstationClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing workstation cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workstations.v1beta.WorkstationCluster} request.workstationCluster - * Required. Workstation cluster to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask that specifies which fields in the workstation cluster - * should be updated. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {boolean} request.allowMissing - * If set, and the workstation cluster is not found, a new workstation - * cluster will be created. In this situation, update_mask is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workstations.update_workstation_cluster.js - * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstationCluster_async - */ - updateWorkstationCluster( - request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateWorkstationCluster( - request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstationCluster( - request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstationCluster( - request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workstation_cluster.name': request.workstationCluster!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateWorkstationCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateWorkstationCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workstations.update_workstation_cluster.js - * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstationCluster_async - */ - async checkUpdateWorkstationClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the specified workstation cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workstation cluster to delete. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not apply it. - * @param {string} request.etag - * If set, the request will be rejected if the latest version of the - * workstation cluster on the server does not have this ETag. - * @param {boolean} request.force - * If set, any workstation configurations and workstations in the - * workstation cluster are also deleted. Otherwise, the request only - * works if the workstation cluster has no configurations or workstations. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workstations.delete_workstation_cluster.js - * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstationCluster_async - */ - deleteWorkstationCluster( - request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteWorkstationCluster( - request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstationCluster( - request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstationCluster( - request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteWorkstationCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteWorkstationCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workstations.delete_workstation_cluster.js - * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstationCluster_async - */ - async checkDeleteWorkstationClusterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstationCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new workstation configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {string} request.workstationConfigId - * Required. ID to use for the workstation configuration. - * @param {google.cloud.workstations.v1beta.WorkstationConfig} request.workstationConfig - * Required. Config to create. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workstations.create_workstation_config.js - * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstationConfig_async - */ - createWorkstationConfig( - request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createWorkstationConfig( - request: protos.google.cloud.workstations.v1beta.ICreateWorkstationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstationConfig( - request: protos.google.cloud.workstations.v1beta.ICreateWorkstationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstationConfig( - request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createWorkstationConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createWorkstationConfig()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workstations.create_workstation_config.js - * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstationConfig_async - */ - async checkCreateWorkstationConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing workstation configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workstations.v1beta.WorkstationConfig} request.workstationConfig - * Required. Config to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask specifying which fields in the workstation configuration - * should be updated. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {boolean} request.allowMissing - * If set and the workstation configuration is not found, a new - * workstation configuration will be created. In this situation, - * update_mask is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workstations.update_workstation_config.js - * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstationConfig_async - */ - updateWorkstationConfig( - request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateWorkstationConfig( - request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstationConfig( - request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstationConfig( - request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workstation_config.name': request.workstationConfig!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateWorkstationConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateWorkstationConfig()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workstations.update_workstation_config.js - * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstationConfig_async - */ - async checkUpdateWorkstationConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the specified workstation configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workstation configuration to delete. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {string} request.etag - * If set, the request is rejected if the latest version of the - * workstation configuration on the server does not have this ETag. - * @param {boolean} request.force - * If set, any workstations in the workstation configuration are also deleted. - * Otherwise, the request works only if the workstation configuration has - * no workstations. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workstations.delete_workstation_config.js - * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstationConfig_async - */ - deleteWorkstationConfig( - request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteWorkstationConfig( - request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstationConfig( - request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstationConfig( - request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteWorkstationConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteWorkstationConfig()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workstations.delete_workstation_config.js - * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstationConfig_async - */ - async checkDeleteWorkstationConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new workstation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {string} request.workstationId - * Required. ID to use for the workstation. - * @param {google.cloud.workstations.v1beta.Workstation} request.workstation - * Required. Workstation to create. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workstations.create_workstation.js - * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstation_async - */ - createWorkstation( - request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createWorkstation( - request: protos.google.cloud.workstations.v1beta.ICreateWorkstationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstation( - request: protos.google.cloud.workstations.v1beta.ICreateWorkstationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkstation( - request?: protos.google.cloud.workstations.v1beta.ICreateWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createWorkstation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createWorkstation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workstations.create_workstation.js - * region_tag:workstations_v1beta_generated_Workstations_CreateWorkstation_async - */ - async checkCreateWorkstationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkstation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an existing workstation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workstations.v1beta.Workstation} request.workstation - * Required. Workstation to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask specifying which fields in the workstation configuration - * should be updated. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {boolean} request.allowMissing - * If set and the workstation configuration is not found, a new - * workstation configuration is created. In this situation, update_mask - * is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workstations.update_workstation.js - * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstation_async - */ - updateWorkstation( - request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateWorkstation( - request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstation( - request: protos.google.cloud.workstations.v1beta.IUpdateWorkstationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkstation( - request?: protos.google.cloud.workstations.v1beta.IUpdateWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workstation.name': request.workstation!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateWorkstation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateWorkstation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workstations.update_workstation.js - * region_tag:workstations_v1beta_generated_Workstations_UpdateWorkstation_async - */ - async checkUpdateWorkstationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkstation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the specified workstation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workstation to delete. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {string} request.etag - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workstations.delete_workstation.js - * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstation_async - */ - deleteWorkstation( - request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteWorkstation( - request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstation( - request: protos.google.cloud.workstations.v1beta.IDeleteWorkstationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkstation( - request?: protos.google.cloud.workstations.v1beta.IDeleteWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteWorkstation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteWorkstation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workstations.delete_workstation.js - * region_tag:workstations_v1beta_generated_Workstations_DeleteWorkstation_async - */ - async checkDeleteWorkstationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkstation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Starts running a workstation so that users can connect to it. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workstation to start. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {string} request.etag - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workstations.start_workstation.js - * region_tag:workstations_v1beta_generated_Workstations_StartWorkstation_async - */ - startWorkstation( - request?: protos.google.cloud.workstations.v1beta.IStartWorkstationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - startWorkstation( - request: protos.google.cloud.workstations.v1beta.IStartWorkstationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startWorkstation( - request: protos.google.cloud.workstations.v1beta.IStartWorkstationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startWorkstation( - request?: protos.google.cloud.workstations.v1beta.IStartWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.startWorkstation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `startWorkstation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workstations.start_workstation.js - * region_tag:workstations_v1beta_generated_Workstations_StartWorkstation_async - */ - async checkStartWorkstationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.startWorkstation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Stops running a workstation, reducing costs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workstation to stop. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * apply it. - * @param {string} request.etag - * If set, the request will be rejected if the latest version of the - * workstation on the server does not have this 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workstations.stop_workstation.js - * region_tag:workstations_v1beta_generated_Workstations_StopWorkstation_async - */ - stopWorkstation( - request?: protos.google.cloud.workstations.v1beta.IStopWorkstationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - stopWorkstation( - request: protos.google.cloud.workstations.v1beta.IStopWorkstationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopWorkstation( - request: protos.google.cloud.workstations.v1beta.IStopWorkstationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopWorkstation( - request?: protos.google.cloud.workstations.v1beta.IStopWorkstationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.stopWorkstation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `stopWorkstation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workstations.stop_workstation.js - * region_tag:workstations_v1beta_generated_Workstations_StopWorkstation_async - */ - async checkStopWorkstationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.stopWorkstation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Returns all workstation clusters in the specified location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationCluster|WorkstationCluster}. - * 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 `listWorkstationClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstationClusters( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstationCluster[], - protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest|null, - protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse - ]>; - listWorkstationClusters( - request: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationCluster>): void; - listWorkstationClusters( - request: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, - callback: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationCluster>): void; - listWorkstationClusters( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationCluster>, - callback?: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationCluster>): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstationCluster[], - protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest|null, - protos.google.cloud.workstations.v1beta.IListWorkstationClustersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listWorkstationClusters(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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationCluster|WorkstationCluster} 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 `listWorkstationClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstationClustersStream( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, - 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['listWorkstationClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstationClusters.createStream( - this.innerApiCalls.listWorkstationClusters as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listWorkstationClusters`, 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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationCluster|WorkstationCluster}. 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/workstations.list_workstation_clusters.js - * region_tag:workstations_v1beta_generated_Workstations_ListWorkstationClusters_async - */ - listWorkstationClustersAsync( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationClustersRequest, - 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['listWorkstationClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstationClusters.asyncIterate( - this.innerApiCalls['listWorkstationClusters'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns all workstation configurations in the specified cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig}. - * 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 `listWorkstationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstationConfigs( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstationConfig[], - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest|null, - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse - ]>; - listWorkstationConfigs( - request: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationConfig>): void; - listWorkstationConfigs( - request: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationConfig>): void; - listWorkstationConfigs( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationConfig>, - callback?: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationConfig>): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstationConfig[], - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest|null, - protos.google.cloud.workstations.v1beta.IListWorkstationConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listWorkstationConfigs(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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig} 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 `listWorkstationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstationConfigsStream( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, - 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['listWorkstationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstationConfigs.createStream( - this.innerApiCalls.listWorkstationConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listWorkstationConfigs`, 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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig}. 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/workstations.list_workstation_configs.js - * region_tag:workstations_v1beta_generated_Workstations_ListWorkstationConfigs_async - */ - listWorkstationConfigsAsync( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationConfigsRequest, - 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['listWorkstationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstationConfigs.asyncIterate( - this.innerApiCalls['listWorkstationConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns all workstation configurations in the specified cluster on which - * the caller has the "workstations.workstation.create" permission. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig}. - * 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 `listUsableWorkstationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableWorkstationConfigs( - request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstationConfig[], - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest|null, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse - ]>; - listUsableWorkstationConfigs( - request: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationConfig>): void; - listUsableWorkstationConfigs( - request: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationConfig>): void; - listUsableWorkstationConfigs( - request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationConfig>, - callback?: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstationConfig>): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstationConfig[], - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest|null, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listUsableWorkstationConfigs(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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig} 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 `listUsableWorkstationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableWorkstationConfigsStream( - request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, - 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['listUsableWorkstationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableWorkstationConfigs.createStream( - this.innerApiCalls.listUsableWorkstationConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUsableWorkstationConfigs`, 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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.WorkstationConfig|WorkstationConfig}. 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/workstations.list_usable_workstation_configs.js - * region_tag:workstations_v1beta_generated_Workstations_ListUsableWorkstationConfigs_async - */ - listUsableWorkstationConfigsAsync( - request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationConfigsRequest, - 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['listUsableWorkstationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableWorkstationConfigs.asyncIterate( - this.innerApiCalls['listUsableWorkstationConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns all Workstations using the specified workstation configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation}. - * 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 `listWorkstationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstations( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstation[], - protos.google.cloud.workstations.v1beta.IListWorkstationsRequest|null, - protos.google.cloud.workstations.v1beta.IListWorkstationsResponse - ]>; - listWorkstations( - request: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstation>): void; - listWorkstations( - request: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, - callback: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstation>): void; - listWorkstations( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstation>, - callback?: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, - protos.google.cloud.workstations.v1beta.IListWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstation>): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstation[], - protos.google.cloud.workstations.v1beta.IListWorkstationsRequest|null, - protos.google.cloud.workstations.v1beta.IListWorkstationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listWorkstations(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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation} 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 `listWorkstationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkstationsStream( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, - 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['listWorkstations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstations.createStream( - this.innerApiCalls.listWorkstations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listWorkstations`, 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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation}. 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/workstations.list_workstations.js - * region_tag:workstations_v1beta_generated_Workstations_ListWorkstations_async - */ - listWorkstationsAsync( - request?: protos.google.cloud.workstations.v1beta.IListWorkstationsRequest, - 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['listWorkstations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkstations.asyncIterate( - this.innerApiCalls['listWorkstations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns all workstations using the specified workstation configuration - * on which the caller has the "workstations.workstations.use" permission. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation}. - * 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 `listUsableWorkstationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableWorkstations( - request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstation[], - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest|null, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse - ]>; - listUsableWorkstations( - request: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstation>): void; - listUsableWorkstations( - request: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, - callback: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstation>): void; - listUsableWorkstations( - request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstation>, - callback?: PaginationCallback< - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse|null|undefined, - protos.google.cloud.workstations.v1beta.IWorkstation>): - Promise<[ - protos.google.cloud.workstations.v1beta.IWorkstation[], - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest|null, - protos.google.cloud.workstations.v1beta.IListUsableWorkstationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listUsableWorkstations(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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation} 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 `listUsableWorkstationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableWorkstationsStream( - request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, - 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['listUsableWorkstations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableWorkstations.createStream( - this.innerApiCalls.listUsableWorkstations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUsableWorkstations`, 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 resource name. - * @param {number} request.pageSize - * Maximum number of items to return. - * @param {string} request.pageToken - * next_page_token value returned from a previous 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.workstations.v1beta.Workstation|Workstation}. 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/workstations.list_usable_workstations.js - * region_tag:workstations_v1beta_generated_Workstations_ListUsableWorkstations_async - */ - listUsableWorkstationsAsync( - request?: protos.google.cloud.workstations.v1beta.IListUsableWorkstationsRequest, - 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['listUsableWorkstations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableWorkstations.asyncIterate( - this.innerApiCalls['listUsableWorkstations'] 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 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 workstation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workstation_cluster - * @param {string} workstation_config - * @param {string} workstation - * @returns {string} Resource name string. - */ - workstationPath(project:string,location:string,workstationCluster:string,workstationConfig:string,workstation:string) { - return this.pathTemplates.workstationPathTemplate.render({ - project: project, - location: location, - workstation_cluster: workstationCluster, - workstation_config: workstationConfig, - workstation: workstation, - }); - } - - /** - * Parse the project from Workstation resource. - * - * @param {string} workstationName - * A fully-qualified path representing Workstation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkstationName(workstationName: string) { - return this.pathTemplates.workstationPathTemplate.match(workstationName).project; - } - - /** - * Parse the location from Workstation resource. - * - * @param {string} workstationName - * A fully-qualified path representing Workstation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkstationName(workstationName: string) { - return this.pathTemplates.workstationPathTemplate.match(workstationName).location; - } - - /** - * Parse the workstation_cluster from Workstation resource. - * - * @param {string} workstationName - * A fully-qualified path representing Workstation resource. - * @returns {string} A string representing the workstation_cluster. - */ - matchWorkstationClusterFromWorkstationName(workstationName: string) { - return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation_cluster; - } - - /** - * Parse the workstation_config from Workstation resource. - * - * @param {string} workstationName - * A fully-qualified path representing Workstation resource. - * @returns {string} A string representing the workstation_config. - */ - matchWorkstationConfigFromWorkstationName(workstationName: string) { - return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation_config; - } - - /** - * Parse the workstation from Workstation resource. - * - * @param {string} workstationName - * A fully-qualified path representing Workstation resource. - * @returns {string} A string representing the workstation. - */ - matchWorkstationFromWorkstationName(workstationName: string) { - return this.pathTemplates.workstationPathTemplate.match(workstationName).workstation; - } - - /** - * Return a fully-qualified workstationCluster resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workstation_cluster - * @returns {string} Resource name string. - */ - workstationClusterPath(project:string,location:string,workstationCluster:string) { - return this.pathTemplates.workstationClusterPathTemplate.render({ - project: project, - location: location, - workstation_cluster: workstationCluster, - }); - } - - /** - * Parse the project from WorkstationCluster resource. - * - * @param {string} workstationClusterName - * A fully-qualified path representing WorkstationCluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkstationClusterName(workstationClusterName: string) { - return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).project; - } - - /** - * Parse the location from WorkstationCluster resource. - * - * @param {string} workstationClusterName - * A fully-qualified path representing WorkstationCluster resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkstationClusterName(workstationClusterName: string) { - return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).location; - } - - /** - * Parse the workstation_cluster from WorkstationCluster resource. - * - * @param {string} workstationClusterName - * A fully-qualified path representing WorkstationCluster resource. - * @returns {string} A string representing the workstation_cluster. - */ - matchWorkstationClusterFromWorkstationClusterName(workstationClusterName: string) { - return this.pathTemplates.workstationClusterPathTemplate.match(workstationClusterName).workstation_cluster; - } - - /** - * Return a fully-qualified workstationConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workstation_cluster - * @param {string} workstation_config - * @returns {string} Resource name string. - */ - workstationConfigPath(project:string,location:string,workstationCluster:string,workstationConfig:string) { - return this.pathTemplates.workstationConfigPathTemplate.render({ - project: project, - location: location, - workstation_cluster: workstationCluster, - workstation_config: workstationConfig, - }); - } - - /** - * Parse the project from WorkstationConfig resource. - * - * @param {string} workstationConfigName - * A fully-qualified path representing WorkstationConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkstationConfigName(workstationConfigName: string) { - return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).project; - } - - /** - * Parse the location from WorkstationConfig resource. - * - * @param {string} workstationConfigName - * A fully-qualified path representing WorkstationConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkstationConfigName(workstationConfigName: string) { - return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).location; - } - - /** - * Parse the workstation_cluster from WorkstationConfig resource. - * - * @param {string} workstationConfigName - * A fully-qualified path representing WorkstationConfig resource. - * @returns {string} A string representing the workstation_cluster. - */ - matchWorkstationClusterFromWorkstationConfigName(workstationConfigName: string) { - return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).workstation_cluster; - } - - /** - * Parse the workstation_config from WorkstationConfig resource. - * - * @param {string} workstationConfigName - * A fully-qualified path representing WorkstationConfig resource. - * @returns {string} A string representing the workstation_config. - */ - matchWorkstationConfigFromWorkstationConfigName(workstationConfigName: string) { - return this.pathTemplates.workstationConfigPathTemplate.match(workstationConfigName).workstation_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.workstationsStub && !this._terminated) { - return this.workstationsStub.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-workstations/v1beta/src/v1beta/workstations_client_config.json b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client_config.json deleted file mode 100644 index 4562a0c7736..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_client_config.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "interfaces": { - "google.cloud.workstations.v1beta.Workstations": { - "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": { - "GetWorkstationCluster": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListWorkstationClusters": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateWorkstationCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateWorkstationCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteWorkstationCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetWorkstationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListWorkstationConfigs": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListUsableWorkstationConfigs": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateWorkstationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateWorkstationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteWorkstationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListWorkstations": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListUsableWorkstations": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StopWorkstation": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateAccessToken": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_proto_list.json b/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_proto_list.json deleted file mode 100644 index 8903eb0e8bd..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/src/v1beta/workstations_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/workstations/v1beta/workstations.proto" -] diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index baefb289660..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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 workstations = require('@google-cloud/workstations'); - -function main() { - const workstationsClient = new workstations.WorkstationsClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-workstations/v1beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 74cd8e0b246..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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 {WorkstationsClient} from '@google-cloud/workstations'; - -// check that the client class type name can be used -function doStuffWithWorkstationsClient(client: WorkstationsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const workstationsClient = new WorkstationsClient(); - doStuffWithWorkstationsClient(workstationsClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-workstations/v1beta/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1beta/test/gapic_workstations_v1beta.ts b/owl-bot-staging/google-cloud-workstations/v1beta/test/gapic_workstations_v1beta.ts deleted file mode 100644 index 185427a6376..00000000000 --- a/owl-bot-staging/google-cloud-workstations/v1beta/test/gapic_workstations_v1beta.ts +++ /dev/null @@ -1,4506 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 workstationsModule 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.WorkstationsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = workstationsModule.v1beta.WorkstationsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = workstationsModule.v1beta.WorkstationsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = workstationsModule.v1beta.WorkstationsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new workstationsModule.v1beta.WorkstationsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workstationsStub, undefined); - await client.initialize(); - assert(client.workstationsStub); - }); - - it('has close method for the initialized client', done => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.workstationsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workstationsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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('getWorkstationCluster', () => { - it('invokes getWorkstationCluster without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.WorkstationCluster() - ); - client.innerApiCalls.getWorkstationCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkstationCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationCluster without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.WorkstationCluster() - ); - client.innerApiCalls.getWorkstationCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkstationCluster( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstationCluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationCluster with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkstationCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkstationCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationCluster with closed client', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkstationCluster(request), expectedError); - }); - }); - - describe('getWorkstationConfig', () => { - it('invokes getWorkstationConfig without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.WorkstationConfig() - ); - client.innerApiCalls.getWorkstationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkstationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationConfig without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.WorkstationConfig() - ); - client.innerApiCalls.getWorkstationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkstationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationConfig with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkstationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkstationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstationConfig with closed client', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkstationConfig(request), expectedError); - }); - }); - - describe('getWorkstation', () => { - it('invokes getWorkstation without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.Workstation() - ); - client.innerApiCalls.getWorkstation = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkstation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstation without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.Workstation() - ); - client.innerApiCalls.getWorkstation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkstation( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstation with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkstation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkstation with closed client', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GetWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GetWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkstation(request), expectedError); - }); - }); - - describe('generateAccessToken', () => { - it('invokes generateAccessToken without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GenerateAccessTokenRequest', ['workstation']); - request.workstation = defaultValue1; - const expectedHeaderRequestParams = `workstation=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GenerateAccessTokenResponse() - ); - client.innerApiCalls.generateAccessToken = stubSimpleCall(expectedResponse); - const [response] = await client.generateAccessToken(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAccessToken without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GenerateAccessTokenRequest', ['workstation']); - request.workstation = defaultValue1; - const expectedHeaderRequestParams = `workstation=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GenerateAccessTokenResponse() - ); - client.innerApiCalls.generateAccessToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateAccessToken( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IGenerateAccessTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAccessToken with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GenerateAccessTokenRequest', ['workstation']); - request.workstation = defaultValue1; - const expectedHeaderRequestParams = `workstation=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateAccessToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateAccessToken(request), expectedError); - const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAccessToken with closed client', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.GenerateAccessTokenRequest', ['workstation']); - request.workstation = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateAccessToken(request), expectedError); - }); - }); - - describe('createWorkstationCluster', () => { - it('invokes createWorkstationCluster without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkstationCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationCluster without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkstationCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationCluster with call error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkstationCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationCluster with LRO error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkstationCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateWorkstationClusterProgress without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkstationClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateWorkstationClusterProgress with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkstationClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateWorkstationCluster', () => { - it('invokes updateWorkstationCluster without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest() - ); - request.workstationCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); - request.workstationCluster.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkstationCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationCluster without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest() - ); - request.workstationCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); - request.workstationCluster.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkstationCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationCluster with call error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest() - ); - request.workstationCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); - request.workstationCluster.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkstationCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationCluster with LRO error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest() - ); - request.workstationCluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationClusterRequest', ['workstationCluster', 'name']); - request.workstationCluster.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_cluster.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkstationCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateWorkstationClusterProgress without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkstationClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateWorkstationClusterProgress with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkstationClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteWorkstationCluster', () => { - it('invokes deleteWorkstationCluster without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkstationCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationCluster without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkstationCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationCluster with call error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkstationCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationCluster with LRO error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstationCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkstationCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteWorkstationClusterProgress without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkstationClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteWorkstationClusterProgress with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkstationClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createWorkstationConfig', () => { - it('invokes createWorkstationConfig without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkstationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationConfig without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkstationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationConfig with call error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkstationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstationConfig with LRO error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkstationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateWorkstationConfigProgress without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkstationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateWorkstationConfigProgress with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkstationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateWorkstationConfig', () => { - it('invokes updateWorkstationConfig without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest() - ); - request.workstationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); - request.workstationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkstationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationConfig without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest() - ); - request.workstationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); - request.workstationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkstationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationConfig with call error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest() - ); - request.workstationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); - request.workstationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkstationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstationConfig with LRO error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest() - ); - request.workstationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationConfigRequest', ['workstationConfig', 'name']); - request.workstationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `workstation_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkstationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateWorkstationConfigProgress without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkstationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateWorkstationConfigProgress with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkstationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteWorkstationConfig', () => { - it('invokes deleteWorkstationConfig without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkstationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationConfig without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkstationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationConfig with call error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkstationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstationConfig with LRO error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkstationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteWorkstationConfigProgress without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkstationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteWorkstationConfigProgress with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkstationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createWorkstation', () => { - it('invokes createWorkstation without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkstation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstation without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkstation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkstation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstation with call error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkstation with LRO error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.CreateWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.CreateWorkstationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkstation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkstation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateWorkstationProgress without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkstationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateWorkstationProgress with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkstationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateWorkstation', () => { - it('invokes updateWorkstation without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationRequest() - ); - request.workstation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationRequest', ['workstation', 'name']); - request.workstation.name = defaultValue1; - const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkstation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstation without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationRequest() - ); - request.workstation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationRequest', ['workstation', 'name']); - request.workstation.name = defaultValue1; - const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkstation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkstation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstation with call error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationRequest() - ); - request.workstation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationRequest', ['workstation', 'name']); - request.workstation.name = defaultValue1; - const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkstation with LRO error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.UpdateWorkstationRequest() - ); - request.workstation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.UpdateWorkstationRequest', ['workstation', 'name']); - request.workstation.name = defaultValue1; - const expectedHeaderRequestParams = `workstation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkstation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkstation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateWorkstationProgress without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkstationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateWorkstationProgress with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkstationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteWorkstation', () => { - it('invokes deleteWorkstation without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkstation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstation without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkstation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkstation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstation with call error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkstation with LRO error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.DeleteWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.DeleteWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkstation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkstation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteWorkstationProgress without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkstationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteWorkstationProgress with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkstationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('startWorkstation', () => { - it('invokes startWorkstation without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.StartWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.StartWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startWorkstation = stubLongRunningCall(expectedResponse); - const [operation] = await client.startWorkstation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startWorkstation without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.StartWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.StartWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startWorkstation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startWorkstation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startWorkstation with call error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.StartWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.StartWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startWorkstation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.startWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startWorkstation with LRO error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.StartWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.StartWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startWorkstation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.startWorkstation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStartWorkstationProgress without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkStartWorkstationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStartWorkstationProgress with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkStartWorkstationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('stopWorkstation', () => { - it('invokes stopWorkstation without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.StopWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.StopWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopWorkstation = stubLongRunningCall(expectedResponse); - const [operation] = await client.stopWorkstation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopWorkstation without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.StopWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.StopWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopWorkstation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopWorkstation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopWorkstation with call error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.StopWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.StopWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopWorkstation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.stopWorkstation(request), expectedError); - const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopWorkstation with LRO error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.StopWorkstationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.StopWorkstationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopWorkstation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.stopWorkstation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopWorkstation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStopWorkstationProgress without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkStopWorkstationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStopWorkstationProgress with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkStopWorkstationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listWorkstationClusters', () => { - it('invokes listWorkstationClusters without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - ]; - client.innerApiCalls.listWorkstationClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkstationClusters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationClusters without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - ]; - client.innerApiCalls.listWorkstationClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkstationClusters( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstationCluster[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationClusters with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkstationClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkstationClusters(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationClustersStream without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - ]; - client.descriptors.page.listWorkstationClusters.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkstationClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1beta.WorkstationCluster[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationCluster) => { - 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.listWorkstationClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstationClusters, request)); - assert( - (client.descriptors.page.listWorkstationClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listWorkstationClustersStream with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstationClusters.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkstationClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1beta.WorkstationCluster[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationCluster) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkstationClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstationClusters, request)); - assert( - (client.descriptors.page.listWorkstationClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstationClusters without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationCluster()), - ]; - client.descriptors.page.listWorkstationClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workstations.v1beta.IWorkstationCluster[] = []; - const iterable = client.listWorkstationClustersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstationClusters with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstationClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkstationClustersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workstations.v1beta.IWorkstationCluster[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstationClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listWorkstationConfigs', () => { - it('invokes listWorkstationConfigs without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - ]; - client.innerApiCalls.listWorkstationConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkstationConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationConfigs without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - ]; - client.innerApiCalls.listWorkstationConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkstationConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstationConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationConfigs with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkstationConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkstationConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationConfigsStream without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - ]; - client.descriptors.page.listWorkstationConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkstationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1beta.WorkstationConfig[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationConfig) => { - 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.listWorkstationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstationConfigs, request)); - assert( - (client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listWorkstationConfigsStream with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkstationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1beta.WorkstationConfig[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstationConfigs, request)); - assert( - (client.descriptors.page.listWorkstationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstationConfigs without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - ]; - client.descriptors.page.listWorkstationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workstations.v1beta.IWorkstationConfig[] = []; - const iterable = client.listWorkstationConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstationConfigs with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkstationConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workstations.v1beta.IWorkstationConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listUsableWorkstationConfigs', () => { - it('invokes listUsableWorkstationConfigs without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - ]; - client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listUsableWorkstationConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstationConfigs without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - ]; - client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUsableWorkstationConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstationConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstationConfigs with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUsableWorkstationConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUsableWorkstationConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstationConfigsStream without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - ]; - client.descriptors.page.listUsableWorkstationConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUsableWorkstationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1beta.WorkstationConfig[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationConfig) => { - 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.listUsableWorkstationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstationConfigs, request)); - assert( - (client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listUsableWorkstationConfigsStream with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableWorkstationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUsableWorkstationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1beta.WorkstationConfig[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1beta.WorkstationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstationConfigs, request)); - assert( - (client.descriptors.page.listUsableWorkstationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableWorkstationConfigs without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.WorkstationConfig()), - ]; - client.descriptors.page.listUsableWorkstationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workstations.v1beta.IWorkstationConfig[] = []; - const iterable = client.listUsableWorkstationConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableWorkstationConfigs with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableWorkstationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUsableWorkstationConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workstations.v1beta.IWorkstationConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableWorkstationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listWorkstations', () => { - it('invokes listWorkstations without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - ]; - client.innerApiCalls.listWorkstations = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkstations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstations without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - ]; - client.innerApiCalls.listWorkstations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkstations( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstations with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkstations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkstations(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkstationsStream without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - ]; - client.descriptors.page.listWorkstations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkstationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1beta.Workstation[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1beta.Workstation) => { - 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.listWorkstations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstations, request)); - assert( - (client.descriptors.page.listWorkstations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listWorkstationsStream with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkstationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1beta.Workstation[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1beta.Workstation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkstations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkstations, request)); - assert( - (client.descriptors.page.listWorkstations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstations without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - ]; - client.descriptors.page.listWorkstations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workstations.v1beta.IWorkstation[] = []; - const iterable = client.listWorkstationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkstations with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkstations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkstationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workstations.v1beta.IWorkstation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkstations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listUsableWorkstations', () => { - it('invokes listUsableWorkstations without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - ]; - client.innerApiCalls.listUsableWorkstations = stubSimpleCall(expectedResponse); - const [response] = await client.listUsableWorkstations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstations without error using callback', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - ]; - client.innerApiCalls.listUsableWorkstations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUsableWorkstations( - request, - (err?: Error|null, result?: protos.google.cloud.workstations.v1beta.IWorkstation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstations with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUsableWorkstations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUsableWorkstations(request), expectedError); - const actualRequest = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableWorkstations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableWorkstationsStream without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - ]; - client.descriptors.page.listUsableWorkstations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUsableWorkstationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1beta.Workstation[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1beta.Workstation) => { - 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.listUsableWorkstations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstations, request)); - assert( - (client.descriptors.page.listUsableWorkstations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listUsableWorkstationsStream with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableWorkstations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUsableWorkstationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workstations.v1beta.Workstation[] = []; - stream.on('data', (response: protos.google.cloud.workstations.v1beta.Workstation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUsableWorkstations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableWorkstations, request)); - assert( - (client.descriptors.page.listUsableWorkstations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableWorkstations without error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - generateSampleMessage(new protos.google.cloud.workstations.v1beta.Workstation()), - ]; - client.descriptors.page.listUsableWorkstations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workstations.v1beta.IWorkstation[] = []; - const iterable = client.listUsableWorkstationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableWorkstations with error', async () => { - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workstations.v1beta.ListUsableWorkstationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableWorkstations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUsableWorkstationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workstations.v1beta.IWorkstation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUsableWorkstations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableWorkstations.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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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 workstationsModule.v1beta.WorkstationsClient({ - 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('workstation', () => { - const fakePath = "/rendered/path/workstation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workstation_cluster: "workstationClusterValue", - workstation_config: "workstationConfigValue", - workstation: "workstationValue", - }; - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workstationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workstationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workstationPath', () => { - const result = client.workstationPath("projectValue", "locationValue", "workstationClusterValue", "workstationConfigValue", "workstationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workstationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkstationName', () => { - const result = client.matchProjectFromWorkstationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkstationName', () => { - const result = client.matchLocationFromWorkstationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationClusterFromWorkstationName', () => { - const result = client.matchWorkstationClusterFromWorkstationName(fakePath); - assert.strictEqual(result, "workstationClusterValue"); - assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationConfigFromWorkstationName', () => { - const result = client.matchWorkstationConfigFromWorkstationName(fakePath); - assert.strictEqual(result, "workstationConfigValue"); - assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationFromWorkstationName', () => { - const result = client.matchWorkstationFromWorkstationName(fakePath); - assert.strictEqual(result, "workstationValue"); - assert((client.pathTemplates.workstationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workstationCluster', () => { - const fakePath = "/rendered/path/workstationCluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workstation_cluster: "workstationClusterValue", - }; - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workstationClusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workstationClusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workstationClusterPath', () => { - const result = client.workstationClusterPath("projectValue", "locationValue", "workstationClusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workstationClusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkstationClusterName', () => { - const result = client.matchProjectFromWorkstationClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkstationClusterName', () => { - const result = client.matchLocationFromWorkstationClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationClusterFromWorkstationClusterName', () => { - const result = client.matchWorkstationClusterFromWorkstationClusterName(fakePath); - assert.strictEqual(result, "workstationClusterValue"); - assert((client.pathTemplates.workstationClusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workstationConfig', () => { - const fakePath = "/rendered/path/workstationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workstation_cluster: "workstationClusterValue", - workstation_config: "workstationConfigValue", - }; - const client = new workstationsModule.v1beta.WorkstationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workstationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workstationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workstationConfigPath', () => { - const result = client.workstationConfigPath("projectValue", "locationValue", "workstationClusterValue", "workstationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workstationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkstationConfigName', () => { - const result = client.matchProjectFromWorkstationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkstationConfigName', () => { - const result = client.matchLocationFromWorkstationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationClusterFromWorkstationConfigName', () => { - const result = client.matchWorkstationClusterFromWorkstationConfigName(fakePath); - assert.strictEqual(result, "workstationClusterValue"); - assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkstationConfigFromWorkstationConfigName', () => { - const result = client.matchWorkstationConfigFromWorkstationConfigName(fakePath); - assert.strictEqual(result, "workstationConfigValue"); - assert((client.pathTemplates.workstationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-workstations/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-workstations/v1beta/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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-workstations/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-workstations/v1beta/webpack.config.js deleted file mode 100644 index 46aed65f9a2..00000000000 --- a/owl-bot-staging/google-cloud-workstations/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: 'Workstations', - filename: './workstations.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-container/v1/.eslintignore b/owl-bot-staging/google-container/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-container/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-container/v1/.eslintrc.json b/owl-bot-staging/google-container/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-container/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-container/v1/.gitignore b/owl-bot-staging/google-container/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-container/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-container/v1/.jsdoc.js b/owl-bot-staging/google-container/v1/.jsdoc.js deleted file mode 100644 index 6dc18e81193..00000000000 --- a/owl-bot-staging/google-container/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/container', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-container/v1/.mocharc.js b/owl-bot-staging/google-container/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-container/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-container/v1/.prettierrc.js b/owl-bot-staging/google-container/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-container/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-container/v1/README.md b/owl-bot-staging/google-container/v1/README.md deleted file mode 100644 index f32441d7e6b..00000000000 --- a/owl-bot-staging/google-container/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Container: Nodejs Client diff --git a/owl-bot-staging/google-container/v1/package.json b/owl-bot-staging/google-container/v1/package.json deleted file mode 100644 index b2ac12ed35f..00000000000 --- a/owl-bot-staging/google-container/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/container", - "version": "0.1.0", - "description": "Container client for Node.js", - "repository": "googleapis/nodejs-container", - "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 container", - "container", - "cluster 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-container/v1/protos/google/container/v1/cluster_service.proto b/owl-bot-staging/google-container/v1/protos/google/container/v1/cluster_service.proto deleted file mode 100644 index 4af79729da6..00000000000 --- a/owl-bot-staging/google-container/v1/protos/google/container/v1/cluster_service.proto +++ /dev/null @@ -1,5214 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.container.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/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/rpc/code.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.Container.V1"; -option go_package = "cloud.google.com/go/container/apiv1/containerpb;containerpb"; -option java_multiple_files = true; -option java_outer_classname = "ClusterServiceProto"; -option java_package = "com.google.container.v1"; -option php_namespace = "Google\\Cloud\\Container\\V1"; -option ruby_package = "Google::Cloud::Container::V1"; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; - -// Google Kubernetes Engine Cluster Manager v1 -service ClusterManager { - option (google.api.default_host) = "container.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all clusters owned by a project in either the specified zone or all - // zones. - rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/clusters" - additional_bindings { - get: "/v1/projects/{project_id}/zones/{zone}/clusters" - } - }; - option (google.api.method_signature) = "project_id,zone"; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a specific cluster. - rpc GetCluster(GetClusterRequest) returns (Cluster) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/clusters/*}" - additional_bindings { - get: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id"; - option (google.api.method_signature) = "name"; - } - - // Creates a cluster, consisting of the specified number and type of Google - // Compute Engine instances. - // - // By default, the cluster is created in the project's - // [default - // network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). - // - // One firewall is added for the cluster. After cluster creation, - // the Kubelet creates routes for each node to allow the containers - // on that node to communicate with all other instances in the - // cluster. - // - // Finally, an entry is added to the project's global metadata indicating - // which CIDR range the cluster is using. - rpc CreateCluster(CreateClusterRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/clusters" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster"; - option (google.api.method_signature) = "parent,cluster"; - } - - // Updates the settings of a specific cluster. - rpc UpdateCluster(UpdateClusterRequest) returns (Operation) { - option (google.api.http) = { - put: "/v1/{name=projects/*/locations/*/clusters/*}" - body: "*" - additional_bindings { - put: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id,update"; - option (google.api.method_signature) = "name,update"; - } - - // Updates the version and/or image type for the specified node pool. - rpc UpdateNodePool(UpdateNodePoolRequest) returns (Operation) { - option (google.api.http) = { - put: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/update" - body: "*" - } - }; - } - - // Sets the autoscaling settings for the specified node pool. - rpc SetNodePoolAutoscaling(SetNodePoolAutoscalingRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setAutoscaling" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/autoscaling" - body: "*" - } - }; - } - - // Sets the logging service for a specific cluster. - rpc SetLoggingService(SetLoggingServiceRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:setLogging" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/logging" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,logging_service"; - option (google.api.method_signature) = "name,logging_service"; - } - - // Sets the monitoring service for a specific cluster. - rpc SetMonitoringService(SetMonitoringServiceRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:setMonitoring" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/monitoring" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,monitoring_service"; - option (google.api.method_signature) = "name,monitoring_service"; - } - - // Sets the addons for a specific cluster. - rpc SetAddonsConfig(SetAddonsConfigRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:setAddons" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/addons" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,addons_config"; - option (google.api.method_signature) = "name,addons_config"; - } - - // Sets the locations for a specific cluster. - // Deprecated. Use - // [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/update) - // instead. - rpc SetLocations(SetLocationsRequest) returns (Operation) { - option deprecated = true; - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:setLocations" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/locations" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,locations"; - option (google.api.method_signature) = "name,locations"; - } - - // Updates the master for a specific cluster. - rpc UpdateMaster(UpdateMasterRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:updateMaster" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/master" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,master_version"; - option (google.api.method_signature) = "name,master_version"; - } - - // Sets master auth materials. Currently supports changing the admin password - // or a specific cluster, either via password generation or explicitly setting - // the password. - rpc SetMasterAuth(SetMasterAuthRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:setMasterAuth" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMasterAuth" - body: "*" - } - }; - } - - // Deletes the cluster, including the Kubernetes endpoint and all worker - // nodes. - // - // Firewalls and routes that were configured during cluster creation - // are also deleted. - // - // Other Google Compute Engine resources that might be in use by the cluster, - // such as load balancer resources, are not deleted if they weren't present - // when the cluster was initially created. - rpc DeleteCluster(DeleteClusterRequest) returns (Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/clusters/*}" - additional_bindings { - delete: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id"; - option (google.api.method_signature) = "name"; - } - - // Lists all operations in a project in a specific zone or all zones. - rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/operations" - additional_bindings { - get: "/v1/projects/{project_id}/zones/{zone}/operations" - } - }; - option (google.api.method_signature) = "project_id,zone"; - } - - // Gets the specified operation. - rpc GetOperation(GetOperationRequest) returns (Operation) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/operations/*}" - additional_bindings { - get: "/v1/projects/{project_id}/zones/{zone}/operations/{operation_id}" - } - }; - option (google.api.method_signature) = "project_id,zone,operation_id"; - option (google.api.method_signature) = "name"; - } - - // Cancels the specified operation. - rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/operations/*}:cancel" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/operations/{operation_id}:cancel" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,operation_id"; - option (google.api.method_signature) = "name"; - } - - // Returns configuration info about the Google Kubernetes Engine service. - rpc GetServerConfig(GetServerConfigRequest) returns (ServerConfig) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*}/serverConfig" - additional_bindings { - get: "/v1/projects/{project_id}/zones/{zone}/serverconfig" - } - }; - option (google.api.method_signature) = "project_id,zone"; - option (google.api.method_signature) = "name"; - } - - // Gets the public component of the cluster signing keys in - // JSON Web Key format. - // This API is not yet intended for general use, and is not available for all - // clusters. - rpc GetJSONWebKeys(GetJSONWebKeysRequest) returns (GetJSONWebKeysResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/clusters/*}/jwks" - }; - } - - // Lists the node pools for a cluster. - rpc ListNodePools(ListNodePoolsRequest) returns (ListNodePoolsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/clusters/*}/nodePools" - additional_bindings { - get: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id"; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the requested node pool. - rpc GetNodePool(GetNodePoolRequest) returns (NodePool) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}" - additional_bindings { - get: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,node_pool_id"; - option (google.api.method_signature) = "name"; - } - - // Creates a node pool for a cluster. - rpc CreateNodePool(CreateNodePoolRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/clusters/*}/nodePools" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,node_pool"; - option (google.api.method_signature) = "parent,node_pool"; - } - - // Deletes a node pool from a cluster. - rpc DeleteNodePool(DeleteNodePoolRequest) returns (Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}" - additional_bindings { - delete: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,node_pool_id"; - option (google.api.method_signature) = "name"; - } - - // CompleteNodePoolUpgrade will signal an on-going node pool upgrade to - // complete. - rpc CompleteNodePoolUpgrade(CompleteNodePoolUpgradeRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:completeUpgrade" - body: "*" - }; - } - - // Rolls back a previously Aborted or Failed NodePool upgrade. - // This makes no changes if the last upgrade successfully completed. - rpc RollbackNodePoolUpgrade(RollbackNodePoolUpgradeRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:rollback" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}:rollback" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,node_pool_id"; - option (google.api.method_signature) = "name"; - } - - // Sets the NodeManagement options for a node pool. - rpc SetNodePoolManagement(SetNodePoolManagementRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setManagement" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setManagement" - body: "*" - } - }; - } - - // Sets labels on a cluster. - rpc SetLabels(SetLabelsRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:setResourceLabels" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/resourceLabels" - body: "*" - } - }; - } - - // Enables or disables the ABAC authorization mechanism on a cluster. - rpc SetLegacyAbac(SetLegacyAbacRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:setLegacyAbac" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/legacyAbac" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id,enabled"; - option (google.api.method_signature) = "name,enabled"; - } - - // Starts master IP rotation. - rpc StartIPRotation(StartIPRotationRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:startIpRotation" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:startIpRotation" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id"; - option (google.api.method_signature) = "name"; - } - - // Completes master IP rotation. - rpc CompleteIPRotation(CompleteIPRotationRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:completeIpRotation" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:completeIpRotation" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id"; - option (google.api.method_signature) = "name"; - } - - // Sets the size for a specific node pool. The new size will be used for all - // replicas, including future replicas created by modifying - // [NodePool.locations][google.container.v1.NodePool.locations]. - rpc SetNodePoolSize(SetNodePoolSizeRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setSize" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setSize" - body: "*" - } - }; - } - - // Enables or disables Network Policy for a cluster. - rpc SetNetworkPolicy(SetNetworkPolicyRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:setNetworkPolicy" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setNetworkPolicy" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,network_policy"; - option (google.api.method_signature) = "name,network_policy"; - } - - // Sets the maintenance policy for a cluster. - rpc SetMaintenancePolicy(SetMaintenancePolicyRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/clusters/*}:setMaintenancePolicy" - body: "*" - additional_bindings { - post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMaintenancePolicy" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,maintenance_policy"; - option (google.api.method_signature) = "name,maintenance_policy"; - } - - // Lists subnetworks that are usable for creating clusters in a project. - rpc ListUsableSubnetworks(ListUsableSubnetworksRequest) - returns (ListUsableSubnetworksResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/aggregated/usableSubnetworks" - }; - } - - // Checks the cluster compatibility with Autopilot mode, and returns a list of - // compatibility issues. - rpc CheckAutopilotCompatibility(CheckAutopilotCompatibilityRequest) - returns (CheckAutopilotCompatibilityResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/clusters/*}:checkAutopilotCompatibility" - }; - } -} - -// Parameters that can be configured on Linux nodes. -message LinuxNodeConfig { - // Possible cgroup modes that can be used. - enum CgroupMode { - // CGROUP_MODE_UNSPECIFIED is when unspecified cgroup configuration is used. - // The default for the GKE node OS image will be used. - CGROUP_MODE_UNSPECIFIED = 0; - - // CGROUP_MODE_V1 specifies to use cgroupv1 for the cgroup configuration on - // the node image. - CGROUP_MODE_V1 = 1; - - // CGROUP_MODE_V2 specifies to use cgroupv2 for the cgroup configuration on - // the node image. - CGROUP_MODE_V2 = 2; - } - - // The Linux kernel parameters to be applied to the nodes and all pods running - // on the nodes. - // - // The following parameters are supported. - // - // net.core.busy_poll - // net.core.busy_read - // net.core.netdev_max_backlog - // net.core.rmem_max - // net.core.wmem_default - // net.core.wmem_max - // net.core.optmem_max - // net.core.somaxconn - // net.ipv4.tcp_rmem - // net.ipv4.tcp_wmem - // net.ipv4.tcp_tw_reuse - map sysctls = 1; - - // cgroup_mode specifies the cgroup mode to be used on the node. - CgroupMode cgroup_mode = 2; -} - -// Parameters that can be configured on Windows nodes. -// Windows Node Config that define the parameters that will be used to -// configure the Windows node pool settings -message WindowsNodeConfig { - // Possible OS version that can be used. - enum OSVersion { - // When OSVersion is not specified - OS_VERSION_UNSPECIFIED = 0; - - // LTSC2019 specifies to use LTSC2019 as the Windows Servercore Base Image - OS_VERSION_LTSC2019 = 1; - - // LTSC2022 specifies to use LTSC2022 as the Windows Servercore Base Image - OS_VERSION_LTSC2022 = 2; - } - - // OSVersion specifies the Windows node config to be used on the node - OSVersion os_version = 1; -} - -// Node kubelet configs. -message NodeKubeletConfig { - // Control the CPU management policy on the node. - // See - // https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/ - // - // The following values are allowed. - // * "none": the default, which represents the existing scheduling behavior. - // * "static": allows pods with certain resource characteristics to be granted - // increased CPU affinity and exclusivity on the node. - // The default value is 'none' if unspecified. - string cpu_manager_policy = 1; - - // Enable CPU CFS quota enforcement for containers that specify CPU limits. - // - // This option is enabled by default which makes kubelet use CFS quota - // (https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt) to - // enforce container CPU limits. Otherwise, CPU limits will not be enforced at - // all. - // - // Disable this option to mitigate CPU throttling problems while still having - // your pods to be in Guaranteed QoS class by specifying the CPU limits. - // - // The default value is 'true' if unspecified. - google.protobuf.BoolValue cpu_cfs_quota = 2; - - // Set the CPU CFS quota period value 'cpu.cfs_period_us'. - // - // The string must be a sequence of decimal numbers, each with optional - // fraction and a unit suffix, such as "300ms". - // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". - // The value must be a positive duration. - string cpu_cfs_quota_period = 3; - - // Set the Pod PID limits. See - // https://kubernetes.io/docs/concepts/policy/pid-limiting/#pod-pid-limits - // - // Controls the maximum number of processes allowed to run in a pod. The value - // must be greater than or equal to 1024 and less than 4194304. - int64 pod_pids_limit = 4; - - // Enable or disable Kubelet read only port. - optional bool insecure_kubelet_readonly_port_enabled = 7; -} - -// Parameters that describe the nodes in a cluster. -// -// GKE Autopilot clusters do not -// recognize parameters in `NodeConfig`. Use -// [AutoprovisioningNodePoolDefaults][google.container.v1.AutoprovisioningNodePoolDefaults] -// instead. -message NodeConfig { - // The name of a Google Compute Engine [machine - // type](https://cloud.google.com/compute/docs/machine-types) - // - // If unspecified, the default machine type is `e2-medium`. - string machine_type = 1; - - // Size of the disk attached to each node, specified in GB. - // The smallest allowed disk size is 10GB. - // - // If unspecified, the default disk size is 100GB. - int32 disk_size_gb = 2; - - // The set of Google API scopes to be made available on all of the - // node VMs under the "default" service account. - // - // The following scopes are recommended, but not required, and by default are - // not included: - // - // * `https://www.googleapis.com/auth/compute` is required for mounting - // persistent storage on your nodes. - // * `https://www.googleapis.com/auth/devstorage.read_only` is required for - // communicating with **gcr.io** - // (the [Google Container - // Registry](https://cloud.google.com/container-registry/)). - // - // If unspecified, no scopes are added, unless Cloud Logging or Cloud - // Monitoring are enabled, in which case their required scopes will be added. - repeated string oauth_scopes = 3; - - // The Google Cloud Platform Service Account to be used by the node VMs. - // Specify the email address of the Service Account; otherwise, if no Service - // Account is specified, the "default" service account is used. - string service_account = 9; - - // The metadata key/value pairs assigned to instances in the cluster. - // - // Keys must conform to the regexp `[a-zA-Z0-9-_]+` and be less than 128 bytes - // in length. These are reflected as part of a URL in the metadata server. - // Additionally, to avoid ambiguity, keys must not conflict with any other - // metadata keys for the project or be one of the reserved keys: - // - // - "cluster-location" - // - "cluster-name" - // - "cluster-uid" - // - "configure-sh" - // - "containerd-configure-sh" - // - "enable-os-login" - // - "gci-ensure-gke-docker" - // - "gci-metrics-enabled" - // - "gci-update-strategy" - // - "instance-template" - // - "kube-env" - // - "startup-script" - // - "user-data" - // - "disable-address-manager" - // - "windows-startup-script-ps1" - // - "common-psm1" - // - "k8s-node-setup-psm1" - // - "install-ssh-psm1" - // - "user-profile-psm1" - // - // Values are free-form strings, and only have meaning as interpreted by - // the image running in the instance. The only restriction placed on them is - // that each value's size must be less than or equal to 32 KB. - // - // The total size of all keys and values must be less than 512 KB. - map metadata = 4; - - // The image type to use for this node. Note that for a given image type, - // the latest version of it will be used. Please see - // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for - // available image types. - string image_type = 5; - - // The map of Kubernetes labels (key/value pairs) to be applied to each node. - // These will added in addition to any default label(s) that - // Kubernetes may apply to the node. - // In case of conflict in label keys, the applied set may differ depending on - // the Kubernetes version -- it's best to assume the behavior is undefined - // and conflicts should be avoided. - // For more information, including usage and the valid values, see: - // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ - map labels = 6; - - // The number of local SSD disks to be attached to the node. - // - // The limit for this value is dependent upon the maximum number of - // disks available on a machine per zone. See: - // https://cloud.google.com/compute/docs/disks/local-ssd - // for more information. - int32 local_ssd_count = 7; - - // The list of instance tags applied to all nodes. Tags are used to identify - // valid sources or targets for network firewalls and are specified by - // the client during cluster or node pool creation. Each tag within the list - // must comply with RFC1035. - repeated string tags = 8; - - // Whether the nodes are created as preemptible VM instances. See: - // https://cloud.google.com/compute/docs/instances/preemptible for more - // information about preemptible VM instances. - bool preemptible = 10; - - // A list of hardware accelerators to be attached to each node. - // See https://cloud.google.com/compute/docs/gpus for more information about - // support for GPUs. - repeated AcceleratorConfig accelerators = 11; - - // Type of the disk attached to each node (e.g. 'pd-standard', 'pd-ssd' or - // 'pd-balanced') - // - // If unspecified, the default disk type is 'pd-standard' - string disk_type = 12; - - // Minimum CPU platform to be used by this instance. The instance may be - // scheduled on the specified or newer CPU platform. Applicable values are the - // friendly names of CPU platforms, such as - // `minCpuPlatform: "Intel Haswell"` or - // `minCpuPlatform: "Intel Sandy Bridge"`. For more - // information, read [how to specify min CPU - // platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform) - string min_cpu_platform = 13; - - // The workload metadata configuration for this node. - WorkloadMetadataConfig workload_metadata_config = 14; - - // List of kubernetes taints to be applied to each node. - // - // For more information, including usage and the valid values, see: - // https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ - repeated NodeTaint taints = 15; - - // Sandbox configuration for this node. - SandboxConfig sandbox_config = 17; - - // Setting this field will assign instances of this - // pool to run on the specified node group. This is useful for running - // workloads on [sole tenant - // nodes](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes). - string node_group = 18; - - // The optional reservation affinity. Setting this field will apply - // the specified [Zonal Compute - // Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) - // to this node pool. - ReservationAffinity reservation_affinity = 19; - - // Shielded Instance options. - ShieldedInstanceConfig shielded_instance_config = 20; - - // Parameters that can be configured on Linux nodes. - LinuxNodeConfig linux_node_config = 21; - - // Node kubelet configs. - NodeKubeletConfig kubelet_config = 22; - - // - // The Customer Managed Encryption Key used to encrypt the boot disk attached - // to each node in the node pool. This should be of the form - // projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. - // For more information about protecting resources with Cloud KMS Keys please - // see: - // https://cloud.google.com/compute/docs/disks/customer-managed-encryption - string boot_disk_kms_key = 23; - - // Google Container File System (image streaming) configs. - GcfsConfig gcfs_config = 25; - - // Advanced features for the Compute Engine VM. - AdvancedMachineFeatures advanced_machine_features = 26; - - // Enable or disable gvnic in the node pool. - VirtualNIC gvnic = 29; - - // Spot flag for enabling Spot VM, which is a rebrand of - // the existing preemptible flag. - bool spot = 32; - - // Confidential nodes config. - // All the nodes in the node pool will be Confidential VM once enabled. - ConfidentialNodes confidential_nodes = 35; - - // Enable or disable NCCL fast socket for the node pool. - optional FastSocket fast_socket = 36; - - // The resource labels for the node pool to use to annotate any related - // Google Compute Engine resources. - map resource_labels = 37; - - // Logging configuration. - NodePoolLoggingConfig logging_config = 38; - - // Parameters that can be configured on Windows nodes. - WindowsNodeConfig windows_node_config = 39; - - // Parameters for using raw-block Local NVMe SSDs. - LocalNvmeSsdBlockConfig local_nvme_ssd_block_config = 40; - - // Parameters for the node ephemeral storage using Local SSDs. - // If unspecified, ephemeral storage is backed by the boot disk. - EphemeralStorageLocalSsdConfig ephemeral_storage_local_ssd_config = 41; - - // Parameters for node pools to be backed by shared sole tenant node groups. - SoleTenantConfig sole_tenant_config = 42; -} - -// Specifies options for controlling advanced machine features. -message AdvancedMachineFeatures { - // The number of threads per physical core. To disable simultaneous - // multithreading (SMT) set this to 1. If unset, the maximum number of threads - // supported per core by the underlying processor is assumed. - optional int64 threads_per_core = 1; -} - -// Parameters for node pool-level network config. -message NodeNetworkConfig { - // Configuration of all network bandwidth tiers - message NetworkPerformanceConfig { - // Node network tier - enum Tier { - // Default value - TIER_UNSPECIFIED = 0; - - // Higher bandwidth, actual values based on VM size. - TIER_1 = 1; - } - - // Specifies the total network bandwidth tier for the NodePool. - optional Tier total_egress_bandwidth_tier = 1; - } - - // Input only. Whether to create a new range for pod IPs in this node pool. - // Defaults are provided for `pod_range` and `pod_ipv4_cidr_block` if they - // are not specified. - // - // If neither `create_pod_range` or `pod_range` are specified, the - // cluster-level default (`ip_allocation_policy.cluster_ipv4_cidr_block`) is - // used. - // - // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. - // - // This field cannot be changed after the node pool has been created. - bool create_pod_range = 4 [(google.api.field_behavior) = INPUT_ONLY]; - - // The ID of the secondary range for pod IPs. - // If `create_pod_range` is true, this ID is used for the new range. - // If `create_pod_range` is false, uses an existing secondary range with this - // ID. - // - // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. - // - // This field cannot be changed after the node pool has been created. - string pod_range = 5; - - // The IP address range for pod IPs in this node pool. - // - // Only applicable if `create_pod_range` is true. - // - // Set to blank to have a range chosen with the default size. - // - // Set to /netmask (e.g. `/14`) to have a range chosen with a specific - // netmask. - // - // Set to a - // [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`) to pick a specific range to use. - // - // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. - // - // This field cannot be changed after the node pool has been created. - string pod_ipv4_cidr_block = 6; - - // Whether nodes have internal IP addresses only. - // If enable_private_nodes is not specified, then the value is derived from - // [cluster.privateClusterConfig.enablePrivateNodes][google.container.v1beta1.PrivateClusterConfig.enablePrivateNodes] - optional bool enable_private_nodes = 9; - - // Network bandwidth tier configuration. - optional NetworkPerformanceConfig network_performance_config = 11; - - // [PRIVATE FIELD] - // Pod CIDR size overprovisioning config for the nodepool. - // - // Pod CIDR size per node depends on max_pods_per_node. By default, the value - // of max_pods_per_node is rounded off to next power of 2 and we then double - // that to get the size of pod CIDR block per node. - // Example: max_pods_per_node of 30 would result in 64 IPs (/26). - // - // This config can disable the doubling of IPs (we still round off to next - // power of 2) - // Example: max_pods_per_node of 30 will result in 32 IPs (/27) when - // overprovisioning is disabled. - PodCIDROverprovisionConfig pod_cidr_overprovision_config = 13; - - // We specify the additional node networks for this node pool using this list. - // Each node network corresponds to an additional interface - repeated AdditionalNodeNetworkConfig additional_node_network_configs = 14; - - // We specify the additional pod networks for this node pool using this list. - // Each pod network corresponds to an additional alias IP range for the node - repeated AdditionalPodNetworkConfig additional_pod_network_configs = 15; - - // Output only. [Output only] The utilization of the IPv4 range for the pod. - // The ratio is Usage/[Total number of IPs in the secondary range], - // Usage=numNodes*numZones*podIPsPerNode. - double pod_ipv4_range_utilization = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// AdditionalNodeNetworkConfig is the configuration for additional node networks -// within the NodeNetworkConfig message -message AdditionalNodeNetworkConfig { - // Name of the VPC where the additional interface belongs - string network = 1; - - // Name of the subnetwork where the additional interface belongs - string subnetwork = 2; -} - -// AdditionalPodNetworkConfig is the configuration for additional pod networks -// within the NodeNetworkConfig message -message AdditionalPodNetworkConfig { - // Name of the subnetwork where the additional pod network belongs - string subnetwork = 1; - - // The name of the secondary range on the subnet which provides IP address for - // this pod range - string secondary_pod_range = 2; - - // The maximum number of pods per node which use this pod network - optional MaxPodsConstraint max_pods_per_node = 3; -} - -// A set of Shielded Instance options. -message ShieldedInstanceConfig { - // Defines whether the instance has Secure Boot enabled. - // - // Secure Boot helps ensure that the system only runs authentic software by - // verifying the digital signature of all boot components, and halting the - // boot process if signature verification fails. - bool enable_secure_boot = 1; - - // Defines whether the instance has integrity monitoring enabled. - // - // Enables monitoring and attestation of the boot integrity of the instance. - // The attestation is performed against the integrity policy baseline. This - // baseline is initially derived from the implicitly trusted boot image when - // the instance is created. - bool enable_integrity_monitoring = 2; -} - -// SandboxConfig contains configurations of the sandbox to use for the node. -message SandboxConfig { - // Possible types of sandboxes. - enum Type { - // Default value. This should not be used. - UNSPECIFIED = 0; - - // Run sandbox using gvisor. - GVISOR = 1; - } - - // Type of the sandbox to use for the node. - Type type = 2; -} - -// GcfsConfig contains configurations of Google Container File System -// (image streaming). -message GcfsConfig { - // Whether to use GCFS. - bool enabled = 1; -} - -// [ReservationAffinity](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) -// is the configuration of desired reservation which instances could take -// capacity from. -message ReservationAffinity { - // Indicates whether to consume capacity from a reservation or not. - enum Type { - // Default value. This should not be used. - UNSPECIFIED = 0; - - // Do not consume from any reserved capacity. - NO_RESERVATION = 1; - - // Consume any reservation available. - ANY_RESERVATION = 2; - - // Must consume from a specific reservation. Must specify key value fields - // for specifying the reservations. - SPECIFIC_RESERVATION = 3; - } - - // Corresponds to the type of reservation consumption. - Type consume_reservation_type = 1; - - // Corresponds to the label key of a reservation resource. To target a - // SPECIFIC_RESERVATION by name, specify - // "compute.googleapis.com/reservation-name" as the key and specify the name - // of your reservation as its value. - string key = 2; - - // Corresponds to the label value(s) of reservation resource(s). - repeated string values = 3; -} - -// SoleTenantConfig contains the NodeAffinities to specify what shared sole -// tenant node groups should back the node pool. -message SoleTenantConfig { - // Specifies the NodeAffinity key, values, and affinity operator according to - // [shared sole tenant node group - // affinities](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes#node_affinity_and_anti-affinity). - message NodeAffinity { - // Operator allows user to specify affinity or anti-affinity for the - // given key values. - enum Operator { - // Invalid or unspecified affinity operator. - OPERATOR_UNSPECIFIED = 0; - - // Affinity operator. - IN = 1; - - // Anti-affinity operator. - NOT_IN = 2; - } - - // Key for NodeAffinity. - string key = 1; - - // Operator for NodeAffinity. - Operator operator = 2; - - // Values for NodeAffinity. - repeated string values = 3; - } - - // NodeAffinities used to match to a shared sole tenant node group. - repeated NodeAffinity node_affinities = 1; -} - -// Kubernetes taint is composed of three fields: key, value, and effect. Effect -// can only be one of three types: NoSchedule, PreferNoSchedule or NoExecute. -// -// See -// [here](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration) -// for more information, including usage and the valid values. -message NodeTaint { - // Possible values for Effect in taint. - enum Effect { - // Not set - EFFECT_UNSPECIFIED = 0; - - // NoSchedule - NO_SCHEDULE = 1; - - // PreferNoSchedule - PREFER_NO_SCHEDULE = 2; - - // NoExecute - NO_EXECUTE = 3; - } - - // Key for taint. - string key = 1; - - // Value for taint. - string value = 2; - - // Effect for taint. - Effect effect = 3; -} - -// Collection of Kubernetes [node -// taints](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration). -message NodeTaints { - // List of node taints. - repeated NodeTaint taints = 1; -} - -// Collection of node-level [Kubernetes -// labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels). -message NodeLabels { - // Map of node label keys and node label values. - map labels = 1; -} - -// Collection of [GCP -// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels). -message ResourceLabels { - // Map of node label keys and node label values. - map labels = 1; -} - -// Collection of Compute Engine network tags that can be applied to a node's -// underlying VM instance. -message NetworkTags { - // List of network tags. - repeated string tags = 1; -} - -// The authentication information for accessing the master endpoint. -// Authentication can be done using HTTP basic auth or using client -// certificates. -message MasterAuth { - // The username to use for HTTP basic authentication to the master endpoint. - // For clusters v1.6.0 and later, basic authentication can be disabled by - // leaving username unspecified (or setting it to the empty string). - // - // Warning: basic authentication is deprecated, and will be removed in GKE - // control plane versions 1.19 and newer. For a list of recommended - // authentication methods, see: - // https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication - string username = 1 [deprecated = true]; - - // The password to use for HTTP basic authentication to the master endpoint. - // Because the master endpoint is open to the Internet, you should create a - // strong password. If a password is provided for cluster creation, username - // must be non-empty. - // - // Warning: basic authentication is deprecated, and will be removed in GKE - // control plane versions 1.19 and newer. For a list of recommended - // authentication methods, see: - // https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication - string password = 2 [deprecated = true]; - - // Configuration for client certificate authentication on the cluster. For - // clusters before v1.12, if no configuration is specified, a client - // certificate is issued. - ClientCertificateConfig client_certificate_config = 3; - - // [Output only] Base64-encoded public certificate that is the root of - // trust for the cluster. - string cluster_ca_certificate = 100; - - // [Output only] Base64-encoded public certificate used by clients to - // authenticate to the cluster endpoint. - string client_certificate = 101; - - // [Output only] Base64-encoded private key used by clients to authenticate - // to the cluster endpoint. - string client_key = 102; -} - -// Configuration for client certificates on the cluster. -message ClientCertificateConfig { - // Issue a client certificate. - bool issue_client_certificate = 1; -} - -// Configuration for the addons that can be automatically spun up in the -// cluster, enabling additional functionality. -message AddonsConfig { - // Configuration for the HTTP (L7) load balancing controller addon, which - // makes it easy to set up HTTP load balancers for services in a cluster. - HttpLoadBalancing http_load_balancing = 1; - - // Configuration for the horizontal pod autoscaling feature, which - // increases or decreases the number of replica pods a replication controller - // has based on the resource usage of the existing pods. - HorizontalPodAutoscaling horizontal_pod_autoscaling = 2; - - // Configuration for the Kubernetes Dashboard. - // This addon is deprecated, and will be disabled in 1.15. It is recommended - // to use the Cloud Console to manage and monitor your Kubernetes clusters, - // workloads and applications. For more information, see: - // https://cloud.google.com/kubernetes-engine/docs/concepts/dashboards - KubernetesDashboard kubernetes_dashboard = 3 [deprecated = true]; - - // Configuration for NetworkPolicy. This only tracks whether the addon - // is enabled or not on the Master, it does not track whether network policy - // is enabled for the nodes. - NetworkPolicyConfig network_policy_config = 4; - - // Configuration for the Cloud Run addon, which allows the user to use a - // managed Knative service. - CloudRunConfig cloud_run_config = 7; - - // Configuration for NodeLocalDNS, a dns cache running on cluster nodes - DnsCacheConfig dns_cache_config = 8; - - // Configuration for the ConfigConnector add-on, a Kubernetes - // extension to manage hosted GCP services through the Kubernetes API - ConfigConnectorConfig config_connector_config = 10; - - // Configuration for the Compute Engine Persistent Disk CSI driver. - GcePersistentDiskCsiDriverConfig gce_persistent_disk_csi_driver_config = 11; - - // Configuration for the GCP Filestore CSI driver. - GcpFilestoreCsiDriverConfig gcp_filestore_csi_driver_config = 14; - - // Configuration for the Backup for GKE agent addon. - GkeBackupAgentConfig gke_backup_agent_config = 16; - - // Configuration for the Cloud Storage Fuse CSI driver. - GcsFuseCsiDriverConfig gcs_fuse_csi_driver_config = 17; -} - -// Configuration options for the HTTP (L7) load balancing controller addon, -// which makes it easy to set up HTTP load balancers for services in a cluster. -message HttpLoadBalancing { - // Whether the HTTP Load Balancing controller is enabled in the cluster. - // When enabled, it runs a small pod in the cluster that manages the load - // balancers. - bool disabled = 1; -} - -// Configuration options for the horizontal pod autoscaling feature, which -// increases or decreases the number of replica pods a replication controller -// has based on the resource usage of the existing pods. -message HorizontalPodAutoscaling { - // Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. - // When enabled, it ensures that metrics are collected into Stackdriver - // Monitoring. - bool disabled = 1; -} - -// Configuration for the Kubernetes Dashboard. -message KubernetesDashboard { - // Whether the Kubernetes Dashboard is enabled for this cluster. - bool disabled = 1; -} - -// Configuration for NetworkPolicy. This only tracks whether the addon -// is enabled or not on the Master, it does not track whether network policy -// is enabled for the nodes. -message NetworkPolicyConfig { - // Whether NetworkPolicy is enabled for this cluster. - bool disabled = 1; -} - -// Configuration for NodeLocal DNSCache -message DnsCacheConfig { - // Whether NodeLocal DNSCache is enabled for this cluster. - bool enabled = 1; -} - -// Configuration for controlling master global access settings. -message PrivateClusterMasterGlobalAccessConfig { - // Whenever master is accessible globally or not. - bool enabled = 1; -} - -// Configuration options for private clusters. -message PrivateClusterConfig { - // Whether nodes have internal IP addresses only. If enabled, all nodes are - // given only RFC 1918 private addresses and communicate with the master via - // private networking. - bool enable_private_nodes = 1; - - // Whether the master's internal IP address is used as the cluster endpoint. - bool enable_private_endpoint = 2; - - // The IP range in CIDR notation to use for the hosted master network. This - // range will be used for assigning internal IP addresses to the master or - // set of masters, as well as the ILB VIP. This range must not overlap with - // any other ranges in use within the cluster's network. - string master_ipv4_cidr_block = 3; - - // Output only. The internal IP address of this cluster's master endpoint. - string private_endpoint = 4; - - // Output only. The external IP address of this cluster's master endpoint. - string public_endpoint = 5; - - // Output only. The peering name in the customer VPC used by this cluster. - string peering_name = 7; - - // Controls master global access settings. - PrivateClusterMasterGlobalAccessConfig master_global_access_config = 8; - - // Subnet to provision the master's private endpoint during cluster creation. - // Specified in projects/*/regions/*/subnetworks/* format. - string private_endpoint_subnetwork = 10; -} - -// Configuration for returning group information from authenticators. -message AuthenticatorGroupsConfig { - // Whether this cluster should return group membership lookups - // during authentication using a group of security groups. - bool enabled = 1; - - // The name of the security group-of-groups to be used. Only relevant - // if enabled = true. - string security_group = 2; -} - -// Configuration options for the Cloud Run feature. -message CloudRunConfig { - // Load balancer type of ingress service of Cloud Run. - enum LoadBalancerType { - // Load balancer type for Cloud Run is unspecified. - LOAD_BALANCER_TYPE_UNSPECIFIED = 0; - - // Install external load balancer for Cloud Run. - LOAD_BALANCER_TYPE_EXTERNAL = 1; - - // Install internal load balancer for Cloud Run. - LOAD_BALANCER_TYPE_INTERNAL = 2; - } - - // Whether Cloud Run addon is enabled for this cluster. - bool disabled = 1; - - // Which load balancer type is installed for Cloud Run. - LoadBalancerType load_balancer_type = 3; -} - -// Configuration options for the Config Connector add-on. -message ConfigConnectorConfig { - // Whether Cloud Connector is enabled for this cluster. - bool enabled = 1; -} - -// Configuration for the Compute Engine PD CSI driver. -message GcePersistentDiskCsiDriverConfig { - // Whether the Compute Engine PD CSI driver is enabled for this cluster. - bool enabled = 1; -} - -// Configuration for the GCP Filestore CSI driver. -message GcpFilestoreCsiDriverConfig { - // Whether the GCP Filestore CSI driver is enabled for this cluster. - bool enabled = 1; -} - -// Configuration for the Cloud Storage Fuse CSI driver. -message GcsFuseCsiDriverConfig { - // Whether the Cloud Storage Fuse CSI driver is enabled for this cluster. - bool enabled = 1; -} - -// Configuration for the Backup for GKE Agent. -message GkeBackupAgentConfig { - // Whether the Backup for GKE agent is enabled for this cluster. - bool enabled = 1; -} - -// Configuration options for the master authorized networks feature. Enabled -// master authorized networks will disallow all external traffic to access -// Kubernetes master through HTTPS except traffic from the given CIDR blocks, -// Google Compute Engine Public IPs and Google Prod IPs. -message MasterAuthorizedNetworksConfig { - // CidrBlock contains an optional name and one CIDR block. - message CidrBlock { - // display_name is an optional field for users to identify CIDR blocks. - string display_name = 1; - - // cidr_block must be specified in CIDR notation. - string cidr_block = 2; - } - - // Whether or not master authorized networks is enabled. - bool enabled = 1; - - // cidr_blocks define up to 50 external networks that could access - // Kubernetes master through HTTPS. - repeated CidrBlock cidr_blocks = 2; - - // Whether master is accessbile via Google Compute Engine Public IP addresses. - optional bool gcp_public_cidrs_access_enabled = 3; -} - -// Configuration for the legacy Attribute Based Access Control authorization -// mode. -message LegacyAbac { - // Whether the ABAC authorizer is enabled for this cluster. When enabled, - // identities in the system, including service accounts, nodes, and - // controllers, will have statically granted permissions beyond those - // provided by the RBAC configuration or IAM. - bool enabled = 1; -} - -// Configuration options for the NetworkPolicy feature. -// https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ -message NetworkPolicy { - // Allowed Network Policy providers. - enum Provider { - // Not set - PROVIDER_UNSPECIFIED = 0; - - // Tigera (Calico Felix). - CALICO = 1; - } - - // The selected network policy provider. - Provider provider = 1; - - // Whether network policy is enabled on the cluster. - bool enabled = 2; -} - -// Configuration for Binary Authorization. -message BinaryAuthorization { - // Binary Authorization mode of operation. - enum EvaluationMode { - // Default value - EVALUATION_MODE_UNSPECIFIED = 0; - - // Disable BinaryAuthorization - DISABLED = 1; - - // Enforce Kubernetes admission requests with BinaryAuthorization using the - // project's singleton policy. This is equivalent to setting the - // enabled boolean to true. - PROJECT_SINGLETON_POLICY_ENFORCE = 2; - } - - // This field is deprecated. Leave this unset and instead configure - // BinaryAuthorization using evaluation_mode. If evaluation_mode is set to - // anything other than EVALUATION_MODE_UNSPECIFIED, this field is ignored. - bool enabled = 1 [deprecated = true]; - - // Mode of operation for binauthz policy evaluation. If unspecified, defaults - // to DISABLED. - EvaluationMode evaluation_mode = 2; -} - -// [PRIVATE FIELD] -// Config for pod CIDR size overprovisioning. -message PodCIDROverprovisionConfig { - // Whether Pod CIDR overprovisioning is disabled. - // Note: Pod CIDR overprovisioning is enabled by default. - bool disable = 1; -} - -// Configuration for controlling how IPs are allocated in the cluster. -message IPAllocationPolicy { - // Whether alias IPs will be used for pod IPs in the cluster. - // This is used in conjunction with use_routes. It cannot - // be true if use_routes is true. If both use_ip_aliases and use_routes are - // false, then the server picks the default IP allocation mode - bool use_ip_aliases = 1; - - // Whether a new subnetwork will be created automatically for the cluster. - // - // This field is only applicable when `use_ip_aliases` is true. - bool create_subnetwork = 2; - - // A custom subnetwork name to be used if `create_subnetwork` is true. If - // this field is empty, then an automatic name will be chosen for the new - // subnetwork. - string subnetwork_name = 3; - - // This field is deprecated, use cluster_ipv4_cidr_block. - string cluster_ipv4_cidr = 4 [deprecated = true]; - - // This field is deprecated, use node_ipv4_cidr_block. - string node_ipv4_cidr = 5 [deprecated = true]; - - // This field is deprecated, use services_ipv4_cidr_block. - string services_ipv4_cidr = 6 [deprecated = true]; - - // The name of the secondary range to be used for the cluster CIDR - // block. The secondary range will be used for pod IP - // addresses. This must be an existing secondary range associated - // with the cluster subnetwork. - // - // This field is only applicable with use_ip_aliases is true and - // create_subnetwork is false. - string cluster_secondary_range_name = 7; - - // The name of the secondary range to be used as for the services - // CIDR block. The secondary range will be used for service - // ClusterIPs. This must be an existing secondary range associated - // with the cluster subnetwork. - // - // This field is only applicable with use_ip_aliases is true and - // create_subnetwork is false. - string services_secondary_range_name = 8; - - // The IP address range for the cluster pod IPs. If this field is set, then - // `cluster.cluster_ipv4_cidr` must be left blank. - // - // This field is only applicable when `use_ip_aliases` is true. - // - // Set to blank to have a range chosen with the default size. - // - // Set to /netmask (e.g. `/14`) to have a range chosen with a specific - // netmask. - // - // Set to a - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. - // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range - // to use. - string cluster_ipv4_cidr_block = 9; - - // The IP address range of the instance IPs in this cluster. - // - // This is applicable only if `create_subnetwork` is true. - // - // Set to blank to have a range chosen with the default size. - // - // Set to /netmask (e.g. `/14`) to have a range chosen with a specific - // netmask. - // - // Set to a - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. - // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range - // to use. - string node_ipv4_cidr_block = 10; - - // The IP address range of the services IPs in this cluster. If blank, a range - // will be automatically chosen with the default size. - // - // This field is only applicable when `use_ip_aliases` is true. - // - // Set to blank to have a range chosen with the default size. - // - // Set to /netmask (e.g. `/14`) to have a range chosen with a specific - // netmask. - // - // Set to a - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. - // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range - // to use. - string services_ipv4_cidr_block = 11; - - // The IP address range of the Cloud TPUs in this cluster. If unspecified, a - // range will be automatically chosen with the default size. - // - // This field is only applicable when `use_ip_aliases` is true. - // - // If unspecified, the range will use the default size. - // - // Set to /netmask (e.g. `/14`) to have a range chosen with a specific - // netmask. - // - // Set to a - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. - // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range - // to use. - string tpu_ipv4_cidr_block = 13; - - // Whether routes will be used for pod IPs in the cluster. - // This is used in conjunction with use_ip_aliases. It cannot be true if - // use_ip_aliases is true. If both use_ip_aliases and use_routes are false, - // then the server picks the default IP allocation mode - bool use_routes = 15; - - // The IP stack type of the cluster - StackType stack_type = 16; - - // The ipv6 access type (internal or external) when create_subnetwork is true - IPv6AccessType ipv6_access_type = 17; - - // [PRIVATE FIELD] - // Pod CIDR size overprovisioning config for the cluster. - // - // Pod CIDR size per node depends on max_pods_per_node. By default, the value - // of max_pods_per_node is doubled and then rounded off to next power of 2 to - // get the size of pod CIDR block per node. - // Example: max_pods_per_node of 30 would result in 64 IPs (/26). - // - // This config can disable the doubling of IPs (we still round off to next - // power of 2) - // Example: max_pods_per_node of 30 will result in 32 IPs (/27) when - // overprovisioning is disabled. - PodCIDROverprovisionConfig pod_cidr_overprovision_config = 21; - - // Output only. [Output only] The subnet's IPv6 CIDR block used by nodes and - // pods. - string subnet_ipv6_cidr_block = 22 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Output only] The services IPv6 CIDR block for the cluster. - string services_ipv6_cidr_block = 23 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Output only] The additional pod ranges that are added to the - // cluster. These pod ranges can be used by new node pools to allocate pod IPs - // automatically. Once the range is removed it will not show up in - // IPAllocationPolicy. - AdditionalPodRangesConfig additional_pod_ranges_config = 24 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Output only] The utilization of the cluster default IPv4 - // range for the pod. The ratio is Usage/[Total number of IPs in the secondary - // range], Usage=numNodes*numZones*podIPsPerNode. - double default_pod_ipv4_range_utilization = 25 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A Google Kubernetes Engine cluster. -message Cluster { - // The current status of the cluster. - enum Status { - // Not set. - STATUS_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 master or node software. Details can - // be found in the `statusMessage` field. - RECONCILING = 3; - - // The STOPPING state indicates the cluster is being deleted. - STOPPING = 4; - - // The ERROR state indicates the cluster is unusable. It will be - // automatically deleted. Details can be found in the `statusMessage` field. - ERROR = 5; - - // The DEGRADED state indicates the cluster requires user action to restore - // full functionality. Details can be found in the `statusMessage` field. - DEGRADED = 6; - } - - // The name of this cluster. The name must be unique within this project - // and location (e.g. zone or region), and can be up to 40 characters with - // the following restrictions: - // - // * Lowercase letters, numbers, and hyphens only. - // * Must start with a letter. - // * Must end with a number or a letter. - string name = 1; - - // An optional description of this cluster. - string description = 2; - - // The number of nodes to create in this cluster. You must ensure that your - // Compute Engine [resource quota](https://cloud.google.com/compute/quotas) - // is sufficient for this number of instances. You must also have available - // firewall and routes quota. - // For requests, this field should only be used in lieu of a - // "node_pool" object, since this configuration (along with the - // "node_config") will be used to create a "NodePool" object with an - // auto-generated name. Do not use this and a node_pool at the same time. - // - // This field is deprecated, use node_pool.initial_node_count instead. - int32 initial_node_count = 3 [deprecated = true]; - - // Parameters used in creating the cluster's nodes. - // For requests, this field should only be used in lieu of a - // "node_pool" object, since this configuration (along with the - // "initial_node_count") will be used to create a "NodePool" object with an - // auto-generated name. Do not use this and a node_pool at the same time. - // For responses, this field will be populated with the node configuration of - // the first node pool. (For configuration of each node pool, see - // `node_pool.config`) - // - // If unspecified, the defaults are used. - // This field is deprecated, use node_pool.config instead. - NodeConfig node_config = 4 [deprecated = true]; - - // The authentication information for accessing the master endpoint. - // If unspecified, the defaults are used: - // For clusters before v1.12, if master_auth is unspecified, `username` will - // be set to "admin", a random password will be generated, and a client - // certificate will be issued. - MasterAuth master_auth = 5; - - // The logging service the cluster should use to write logs. - // Currently available options: - // - // * `logging.googleapis.com/kubernetes` - The Cloud Logging - // service with a Kubernetes-native resource model - // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer - // available as of GKE 1.15). - // * `none` - no logs will be exported from the cluster. - // - // If left as an empty string,`logging.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. - string logging_service = 6; - - // The monitoring service the cluster should use to write metrics. - // Currently available options: - // - // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring - // service with a Kubernetes-native resource model - // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no - // longer available as of GKE 1.15). - // * `none` - No metrics will be exported from the cluster. - // - // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. - string monitoring_service = 7; - - // The name of the Google Compute Engine - // [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) - // to which the cluster is connected. If left unspecified, the `default` - // network will be used. - string network = 8; - - // The IP address range of the container pods in this cluster, in - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`). Leave blank to have - // one automatically chosen or specify a `/14` block in `10.0.0.0/8`. - string cluster_ipv4_cidr = 9; - - // Configurations for the various addons available to run in the cluster. - AddonsConfig addons_config = 10; - - // The name of the Google Compute Engine - // [subnetwork](https://cloud.google.com/compute/docs/subnetworks) to which - // the cluster is connected. - string subnetwork = 11; - - // The node pools associated with this cluster. - // This field should not be set if "node_config" or "initial_node_count" are - // specified. - repeated NodePool node_pools = 12; - - // The list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster's nodes should be located. - // - // This field provides a default value if - // [NodePool.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools#NodePool.FIELDS.locations) - // are not specified during node pool creation. - // - // Warning: changing cluster locations will update the - // [NodePool.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools#NodePool.FIELDS.locations) - // of all node pools and will result in nodes being added and/or removed. - repeated string locations = 13; - - // Kubernetes alpha features are enabled on this cluster. This includes alpha - // API groups (e.g. v1alpha1) and features that may not be production ready in - // the kubernetes version of the master and nodes. - // The cluster has no SLA for uptime and master/node upgrades are disabled. - // Alpha enabled clusters are automatically deleted thirty days after - // creation. - bool enable_kubernetes_alpha = 14; - - // The resource labels for the cluster to use to annotate any related - // Google Compute Engine resources. - map resource_labels = 15; - - // The fingerprint of the set of labels for this cluster. - string label_fingerprint = 16; - - // Configuration for the legacy ABAC authorization mode. - LegacyAbac legacy_abac = 18; - - // Configuration options for the NetworkPolicy feature. - NetworkPolicy network_policy = 19; - - // Configuration for cluster IP allocation. - IPAllocationPolicy ip_allocation_policy = 20; - - // The configuration options for master authorized networks feature. - MasterAuthorizedNetworksConfig master_authorized_networks_config = 22; - - // Configure the maintenance policy for this cluster. - MaintenancePolicy maintenance_policy = 23; - - // Configuration for Binary Authorization. - BinaryAuthorization binary_authorization = 24; - - // Cluster-level autoscaling configuration. - ClusterAutoscaling autoscaling = 26; - - // Configuration for cluster networking. - NetworkConfig network_config = 27; - - // The default constraint on the maximum number of pods that can be run - // simultaneously on a node in the node pool of this cluster. Only honored - // if cluster created with IP Alias support. - MaxPodsConstraint default_max_pods_constraint = 30; - - // Configuration for exporting resource usages. Resource usage export is - // disabled when this config is unspecified. - ResourceUsageExportConfig resource_usage_export_config = 33; - - // Configuration controlling RBAC group membership information. - AuthenticatorGroupsConfig authenticator_groups_config = 34; - - // Configuration for private cluster. - PrivateClusterConfig private_cluster_config = 37; - - // Configuration of etcd encryption. - DatabaseEncryption database_encryption = 38; - - // Cluster-level Vertical Pod Autoscaling configuration. - VerticalPodAutoscaling vertical_pod_autoscaling = 39; - - // Shielded Nodes configuration. - ShieldedNodes shielded_nodes = 40; - - // Release channel configuration. If left unspecified on cluster creation and - // a version is specified, the cluster is enrolled in the most mature release - // channel where the version is available (first checking STABLE, then - // REGULAR, and finally RAPID). Otherwise, if no release channel - // configuration and no version is specified, the cluster is enrolled in the - // REGULAR channel with its default version. - ReleaseChannel release_channel = 41; - - // Configuration for the use of Kubernetes Service Accounts in GCP IAM - // policies. - WorkloadIdentityConfig workload_identity_config = 43; - - // Configuration for issuance of mTLS keys and certificates to Kubernetes - // pods. - MeshCertificates mesh_certificates = 67; - - // Configuration for the fine-grained cost management feature. - CostManagementConfig cost_management_config = 45; - - // Notification configuration of the cluster. - NotificationConfig notification_config = 49; - - // Configuration of Confidential Nodes. - // All the nodes in the cluster will be Confidential VM once enabled. - ConfidentialNodes confidential_nodes = 50; - - // Configuration for Identity Service component. - IdentityServiceConfig identity_service_config = 54; - - // [Output only] Server-defined URL for the resource. - string self_link = 100; - - // [Output only] The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field is deprecated, use location instead. - string zone = 101 [deprecated = true]; - - // [Output only] The IP address of this cluster's master endpoint. - // The endpoint can be accessed from the internet at - // `https://username:password@endpoint/`. - // - // See the `masterAuth` property of this resource for username and - // password information. - string endpoint = 102; - - // The initial Kubernetes version for this cluster. Valid versions are those - // found in validMasterVersions returned by getServerConfig. The version can - // be upgraded over time; such upgrades are reflected in - // currentMasterVersion and currentNodeVersion. - // - // Users may specify either explicit versions offered by - // Kubernetes Engine or version aliases, which have the following behavior: - // - // - "latest": picks the highest valid Kubernetes version - // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - // - "1.X.Y-gke.N": picks an explicit Kubernetes version - // - "","-": picks the default Kubernetes version - string initial_cluster_version = 103; - - // [Output only] The current software version of the master endpoint. - string current_master_version = 104; - - // [Output only] Deprecated, use - // [NodePools.version](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools) - // instead. The current version of the node software components. If they are - // currently at multiple versions because they're in the process of being - // upgraded, this reflects the minimum version of all nodes. - string current_node_version = 105 [deprecated = true]; - - // [Output only] The time the cluster was created, in - // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string create_time = 106; - - // [Output only] The current status of this cluster. - Status status = 107; - - // [Output only] Deprecated. Use conditions instead. - // Additional information about the current status of this - // cluster, if available. - string status_message = 108 [deprecated = true]; - - // [Output only] The size of the address space on each node for hosting - // containers. This is provisioned from within the `container_ipv4_cidr` - // range. This field will only be set when cluster is in route-based network - // mode. - int32 node_ipv4_cidr_size = 109; - - // [Output only] The IP address range of the Kubernetes services in - // this cluster, in - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `1.2.3.4/29`). Service addresses are - // typically put in the last `/16` from the container CIDR. - string services_ipv4_cidr = 110; - - // Deprecated. Use node_pools.instance_group_urls. - repeated string instance_group_urls = 111 [deprecated = true]; - - // [Output only] The number of nodes currently in the cluster. Deprecated. - // Call Kubernetes API directly to retrieve node information. - int32 current_node_count = 112 [deprecated = true]; - - // [Output only] The time the cluster will be automatically - // deleted in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string expire_time = 113; - - // [Output only] The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) - // or - // [region](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) - // in which the cluster resides. - string location = 114; - - // Enable the ability to use Cloud TPUs in this cluster. - bool enable_tpu = 115; - - // [Output only] The IP address range of the Cloud TPUs in this cluster, in - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `1.2.3.4/29`). - string tpu_ipv4_cidr_block = 116; - - // Which conditions caused the current cluster state. - repeated StatusCondition conditions = 118; - - // Autopilot configuration for the cluster. - Autopilot autopilot = 128; - - // Output only. Unique id for the cluster. - string id = 129 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Default NodePool settings for the entire cluster. These settings are - // overridden if specified on the specific NodePool object. - optional NodePoolDefaults node_pool_defaults = 131; - - // Logging configuration for the cluster. - LoggingConfig logging_config = 132; - - // Monitoring configuration for the cluster. - MonitoringConfig monitoring_config = 133; - - // Node pool configs that apply to all auto-provisioned node pools - // in autopilot clusters and node auto-provisioning enabled clusters. - NodePoolAutoConfig node_pool_auto_config = 136; - - // This checksum is computed by the server based on the value of cluster - // fields, and may be sent on update requests to ensure the client has an - // up-to-date value before proceeding. - string etag = 139; - - // Fleet information for the cluster. - Fleet fleet = 140; - - // Enable/Disable Security Posture API features for the cluster. - SecurityPostureConfig security_posture_config = 145; - - // Beta APIs Config - K8sBetaAPIConfig enable_k8s_beta_apis = 143; -} - -// K8sBetaAPIConfig , configuration for beta APIs -message K8sBetaAPIConfig { - // Enabled k8s beta APIs. - repeated string enabled_apis = 1; -} - -// SecurityPostureConfig defines the flags needed to enable/disable features for -// the Security Posture API. -message SecurityPostureConfig { - // Mode defines enablement mode for GKE Security posture features. - enum Mode { - // Default value not specified. - MODE_UNSPECIFIED = 0; - - // Disables Security Posture features on the cluster. - DISABLED = 1; - - // Applies Security Posture features on the cluster. - BASIC = 2; - } - - // VulnerabilityMode defines enablement mode for vulnerability scanning. - enum VulnerabilityMode { - // Default value not specified. - VULNERABILITY_MODE_UNSPECIFIED = 0; - - // Disables vulnerability scanning on the cluster. - VULNERABILITY_DISABLED = 1; - - // Applies basic vulnerability scanning on the cluster. - VULNERABILITY_BASIC = 2; - } - - // Sets which mode to use for Security Posture features. - optional Mode mode = 1; - - // Sets which mode to use for vulnerability scanning. - optional VulnerabilityMode vulnerability_mode = 2; -} - -// Node pool configs that apply to all auto-provisioned node pools -// in autopilot clusters and node auto-provisioning enabled clusters. -message NodePoolAutoConfig { - // The list of instance tags applied to all nodes. Tags are used to identify - // valid sources or targets for network firewalls and are specified by - // the client during cluster creation. Each tag within the list - // must comply with RFC1035. - NetworkTags network_tags = 1; -} - -// Subset of Nodepool message that has defaults. -message NodePoolDefaults { - // Subset of NodeConfig message that has defaults. - NodeConfigDefaults node_config_defaults = 1; -} - -// Subset of NodeConfig message that has defaults. -message NodeConfigDefaults { - // GCFS (Google Container File System, also known as Riptide) options. - GcfsConfig gcfs_config = 1; - - // Logging configuration for node pools. - NodePoolLoggingConfig logging_config = 3; -} - -// ClusterUpdate describes an update to the cluster. Exactly one update can -// be applied to a cluster with each request, so at most one field can be -// provided. -message ClusterUpdate { - // The Kubernetes version to change the nodes to (typically an - // upgrade). - // - // Users may specify either explicit versions offered by - // Kubernetes Engine or version aliases, which have the following behavior: - // - // - "latest": picks the highest valid Kubernetes version - // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - // - "1.X.Y-gke.N": picks an explicit Kubernetes version - // - "-": picks the Kubernetes master version - string desired_node_version = 4; - - // The monitoring service the cluster should use to write metrics. - // Currently available options: - // - // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring - // service with a Kubernetes-native resource model - // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no - // longer available as of GKE 1.15). - // * `none` - No metrics will be exported from the cluster. - // - // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. - string desired_monitoring_service = 5; - - // Configurations for the various addons available to run in the cluster. - AddonsConfig desired_addons_config = 6; - - // The node pool to be upgraded. This field is mandatory if - // "desired_node_version", "desired_image_family" or - // "desired_node_pool_autoscaling" is specified and there is more than one - // node pool on the cluster. - string desired_node_pool_id = 7; - - // The desired image type for the node pool. - // NOTE: Set the "desired_node_pool" field as well. - string desired_image_type = 8; - - // Configuration of etcd encryption. - DatabaseEncryption desired_database_encryption = 46; - - // Configuration for Workload Identity. - WorkloadIdentityConfig desired_workload_identity_config = 47; - - // Configuration for issuance of mTLS keys and certificates to Kubernetes - // pods. - MeshCertificates desired_mesh_certificates = 67; - - // Configuration for Shielded Nodes. - ShieldedNodes desired_shielded_nodes = 48; - - // The desired configuration for the fine-grained cost management feature. - CostManagementConfig desired_cost_management_config = 49; - - // DNSConfig contains clusterDNS config for this cluster. - DNSConfig desired_dns_config = 53; - - // Autoscaler configuration for the node pool specified in - // desired_node_pool_id. If there is only one pool in the - // cluster and desired_node_pool_id is not provided then - // the change applies to that single node pool. - NodePoolAutoscaling desired_node_pool_autoscaling = 9; - - // The desired list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster's nodes should be located. - // - // This list must always include the cluster's primary zone. - // - // Warning: changing cluster locations will update the locations of all node - // pools and will result in nodes being added and/or removed. - repeated string desired_locations = 10; - - // The desired configuration options for master authorized networks feature. - MasterAuthorizedNetworksConfig desired_master_authorized_networks_config = 12; - - // Cluster-level autoscaling configuration. - ClusterAutoscaling desired_cluster_autoscaling = 15; - - // The desired configuration options for the Binary Authorization feature. - BinaryAuthorization desired_binary_authorization = 16; - - // The logging service the cluster should use to write logs. - // Currently available options: - // - // * `logging.googleapis.com/kubernetes` - The Cloud Logging - // service with a Kubernetes-native resource model - // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer - // available as of GKE 1.15). - // * `none` - no logs will be exported from the cluster. - // - // If left as an empty string,`logging.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. - string desired_logging_service = 19; - - // The desired configuration for exporting resource usage. - ResourceUsageExportConfig desired_resource_usage_export_config = 21; - - // Cluster-level Vertical Pod Autoscaling configuration. - VerticalPodAutoscaling desired_vertical_pod_autoscaling = 22; - - // The desired private cluster configuration. - PrivateClusterConfig desired_private_cluster_config = 25; - - // The desired config of Intra-node visibility. - IntraNodeVisibilityConfig desired_intra_node_visibility_config = 26; - - // The desired status of whether to disable default sNAT for this cluster. - DefaultSnatStatus desired_default_snat_status = 28; - - // The desired release channel configuration. - ReleaseChannel desired_release_channel = 31; - - // The desired L4 Internal Load Balancer Subsetting configuration. - ILBSubsettingConfig desired_l4ilb_subsetting_config = 39; - - // The desired datapath provider for the cluster. - DatapathProvider desired_datapath_provider = 50; - - // The desired state of IPv6 connectivity to Google Services. - PrivateIPv6GoogleAccess desired_private_ipv6_google_access = 51; - - // The desired notification configuration. - NotificationConfig desired_notification_config = 55; - - // The desired authenticator groups config for the cluster. - AuthenticatorGroupsConfig desired_authenticator_groups_config = 63; - - // The desired logging configuration. - LoggingConfig desired_logging_config = 64; - - // The desired monitoring configuration. - MonitoringConfig desired_monitoring_config = 65; - - // The desired Identity Service component configuration. - IdentityServiceConfig desired_identity_service_config = 66; - - // ServiceExternalIPsConfig specifies the config for the use of Services with - // ExternalIPs field. - ServiceExternalIPsConfig desired_service_external_ips_config = 60; - - // Enable/Disable private endpoint for the cluster's master. - optional bool desired_enable_private_endpoint = 71; - - // The Kubernetes version to change the master to. - // - // Users may specify either explicit versions offered by - // Kubernetes Engine or version aliases, which have the following behavior: - // - // - "latest": picks the highest valid Kubernetes version - // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - // - "1.X.Y-gke.N": picks an explicit Kubernetes version - // - "-": picks the default Kubernetes version - string desired_master_version = 100; - - // The desired GCFS config for the cluster - GcfsConfig desired_gcfs_config = 109; - - // The desired network tags that apply to all auto-provisioned node pools - // in autopilot clusters and node auto-provisioning enabled clusters. - NetworkTags desired_node_pool_auto_config_network_tags = 110; - - // The desired config of Gateway API on this cluster. - GatewayAPIConfig desired_gateway_api_config = 114; - - // The current etag of the cluster. - // If an etag is provided and does not match the current etag of the cluster, - // update will be blocked and an ABORTED error will be returned. - string etag = 115; - - // The desired node pool logging configuration defaults for the cluster. - NodePoolLoggingConfig desired_node_pool_logging_config = 116; - - // The desired fleet configuration for the cluster. - Fleet desired_fleet = 117; - - // The desired stack type of the cluster. - // If a stack type is provided and does not match the current stack type of - // the cluster, update will attempt to change the stack type to the new type. - StackType desired_stack_type = 119; - - // The additional pod ranges to be added to the cluster. These pod ranges - // can be used by node pools to allocate pod IPs. - AdditionalPodRangesConfig additional_pod_ranges_config = 120; - - // The additional pod ranges that are to be removed from the cluster. - // The pod ranges specified here must have been specified earlier in the - // 'additional_pod_ranges_config' argument. - AdditionalPodRangesConfig removed_additional_pod_ranges_config = 121; - - // Kubernetes open source beta apis enabled on the cluster. Only beta apis - K8sBetaAPIConfig enable_k8s_beta_apis = 122; - - // Enable/Disable Security Posture API features for the cluster. - SecurityPostureConfig desired_security_posture_config = 124; - - // The desired network performance config. - NetworkConfig.ClusterNetworkPerformanceConfig - desired_network_performance_config = 125; - - // Enable/Disable FQDN Network Policy for the cluster. - optional bool desired_enable_fqdn_network_policy = 126; - - // The desired workload policy configuration for the autopilot cluster. - WorkloadPolicyConfig desired_autopilot_workload_policy_config = 128; - - // Desired Beta APIs to be enabled for cluster. - K8sBetaAPIConfig desired_k8s_beta_apis = 131; -} - -// AdditionalPodRangesConfig is the configuration for additional pod secondary -// ranges supporting the ClusterUpdate message. -message AdditionalPodRangesConfig { - // Name for pod secondary ipv4 range which has the actual range defined ahead. - repeated string pod_range_names = 1; - - // Output only. [Output only] Information for additional pod range. - repeated RangeInfo pod_range_info = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// RangeInfo contains the range name and the range utilization by this cluster. -message RangeInfo { - // Output only. [Output only] Name of a range. - string range_name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Output only] The utilization of the range. - double utilization = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// This operation resource represents operations that may have happened or are -// happening on the cluster. All fields are output only. -message Operation { - // Current status of the operation. - enum Status { - // Not set. - STATUS_UNSPECIFIED = 0; - - // The operation has been created. - PENDING = 1; - - // The operation is currently running. - RUNNING = 2; - - // The operation is done, either cancelled or completed. - DONE = 3; - - // The operation is aborting. - ABORTING = 4; - } - - // Operation type categorizes the operation. - enum Type { - // Not set. - TYPE_UNSPECIFIED = 0; - - // The cluster is being created. The cluster should be assumed to be - // unusable until the operation finishes. - // - // In the event of the operation failing, the cluster will enter the [ERROR - // state][Cluster.Status.ERROR] and eventually be deleted. - CREATE_CLUSTER = 1; - - // The cluster is being deleted. The cluster should be assumed to be - // unusable as soon as this operation starts. - // - // In the event of the operation failing, the cluster will enter the [ERROR - // state][Cluster.Status.ERROR] and the deletion will be automatically - // retried until completed. - DELETE_CLUSTER = 2; - - // The [cluster - // version][google.container.v1.ClusterUpdate.desired_master_version] is - // being updated. Note that this includes "upgrades" to the same version, - // which are simply a recreation. This also includes - // [auto-upgrades](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-upgrades#upgrading_automatically). - // For more details, see [documentation on cluster - // upgrades](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-upgrades#cluster_upgrades). - UPGRADE_MASTER = 3; - - // A node pool is being updated. Despite calling this an "upgrade", this - // includes most forms of updates to node pools. This also includes - // [auto-upgrades](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-upgrades). - // - // This operation sets the - // [progress][google.container.v1.Operation.progress] field and may be - // [canceled][google.container.v1.ClusterManager.CancelOperation]. - // - // The upgrade strategy depends on [node pool - // configuration](https://cloud.google.com/kubernetes-engine/docs/concepts/node-pool-upgrade-strategies). - // The nodes are generally still usable during this operation. - UPGRADE_NODES = 4; - - // A problem has been detected with the control plane and is being repaired. - // This operation type is initiated by GKE. For more details, see - // [documentation on - // repairs](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions#repairs). - REPAIR_CLUSTER = 5; - - // The cluster is being updated. This is a broad category of operations and - // includes operations that only change metadata as well as those that must - // recreate the entire cluster. If the control plane must be recreated, this - // will cause temporary downtime for zonal clusters. - // - // Some features require recreating the nodes as well. Those will be - // recreated as separate operations and the update may not be completely - // functional until the node pools recreations finish. Node recreations will - // generally follow [maintenance - // policies](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions). - // - // Some GKE-initiated operations use this type. This includes certain types - // of auto-upgrades and incident mitigations. - UPDATE_CLUSTER = 6; - - // A node pool is being created. The node pool should be assumed to be - // unusable until this operation finishes. In the event of an error, the - // node pool may be partially created. - // - // If enabled, [node - // autoprovisioning](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-provisioning) - // may have automatically initiated such operations. - CREATE_NODE_POOL = 7; - - // The node pool is being deleted. The node pool should be assumed to be - // unusable as soon as this operation starts. - DELETE_NODE_POOL = 8; - - // The node pool's [manamagent][google.container.v1.NodePool.management] - // field is being updated. These operations only update metadata and may be - // concurrent with most other operations. - SET_NODE_POOL_MANAGEMENT = 9; - - // A problem has been detected with nodes and [they are being - // repaired](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-repair). - // This operation type is initiated by GKE, typically automatically. This - // operation may be concurrent with other operations and there may be - // multiple repairs occurring on the same node pool. - AUTO_REPAIR_NODES = 10; - - // Unused. Automatic node upgrade uses - // [UPGRADE_NODES][google.container.v1.Operation.Type.UPGRADE_NODES]. - AUTO_UPGRADE_NODES = 11 [deprecated = true]; - - // Unused. Updating labels uses - // [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. - SET_LABELS = 12 [deprecated = true]; - - // Unused. Updating master auth uses - // [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. - SET_MASTER_AUTH = 13 [deprecated = true]; - - // The node pool is being resized. With the exception of resizing to or from - // size zero, the node pool is generally usable during this operation. - SET_NODE_POOL_SIZE = 14; - - // Unused. Updating network policy uses - // [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. - SET_NETWORK_POLICY = 15 [deprecated = true]; - - // Unused. Updating maintenance policy uses - // [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. - SET_MAINTENANCE_POLICY = 16 [deprecated = true]; - - // The control plane is being resized. This operation type is initiated by - // GKE. These operations are often performed preemptively to ensure that the - // control plane has sufficient resources and is not typically an indication - // of issues. For more details, see - // [documentation on - // resizes](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions#repairs). - RESIZE_CLUSTER = 18; - } - - // The server-assigned ID for the operation. - string name = 1; - - // The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // operation is taking place. This field is deprecated, use location instead. - string zone = 2 [deprecated = true]; - - // The operation type. - Type operation_type = 3; - - // The current status of the operation. - Status status = 4; - - // Detailed operation progress, if available. - string detail = 8; - - // Output only. If an error has occurred, a textual description of the error. - // Deprecated. Use the field error instead. - string status_message = 5 - [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; - - // Server-defined URI for the operation. Example: - // `https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123`. - string self_link = 6; - - // Server-defined URI for the target of the operation. The format of this is a - // URI to the resource being modified (such as a cluster, node pool, or node). - // For node pool repairs, there may be multiple nodes being repaired, but only - // one will be the target. - // - // Examples: - // - // - - // ## - // `https://container.googleapis.com/v1/projects/123/locations/us-central1/clusters/my-cluster` - // - // ## - // `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np` - // - // `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np/node/my-node` - string target_link = 7; - - // [Output only] The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) - // or - // [region](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) - // in which the cluster resides. - string location = 9; - - // [Output only] The time the operation started, in - // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string start_time = 10; - - // [Output only] The time the operation completed, in - // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string end_time = 11; - - // Output only. [Output only] Progress information for an operation. - OperationProgress progress = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Which conditions caused the current cluster state. - // Deprecated. Use field error instead. - repeated StatusCondition cluster_conditions = 13 [deprecated = true]; - - // Which conditions caused the current node pool state. - // Deprecated. Use field error instead. - repeated StatusCondition nodepool_conditions = 14 [deprecated = true]; - - // The error result of the operation in case of failure. - google.rpc.Status error = 15; -} - -// Information about operation (or operation stage) progress. -message OperationProgress { - // Progress metric is (string, int|float|string) pair. - message Metric { - // Required. Metric name, e.g., "nodes total", "percent done". - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Strictly one of the values is required. - oneof value { - // For metrics with integer value. - int64 int_value = 2; - - // For metrics with floating point value. - double double_value = 3; - - // For metrics with custom values (ratios, visual progress, etc.). - string string_value = 4; - } - } - - // A non-parameterized string describing an operation stage. - // Unset for single-stage operations. - string name = 1; - - // Status of an operation stage. - // Unset for single-stage operations. - Operation.Status status = 2; - - // Progress metric bundle, for example: - // metrics: [{name: "nodes done", int_value: 15}, - // {name: "nodes total", int_value: 32}] - // or - // metrics: [{name: "progress", double_value: 0.56}, - // {name: "progress scale", double_value: 1.0}] - repeated Metric metrics = 3; - - // Substages of an operation or a stage. - repeated OperationProgress stages = 4; -} - -// CreateClusterRequest creates a cluster. -message CreateClusterRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the parent field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the parent - // field. - string zone = 2 [deprecated = true]; - - // Required. A [cluster - // resource](https://cloud.google.com/container-engine/reference/rest/v1/projects.locations.clusters) - Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED]; - - // The parent (project and location) where the cluster will be created. - // Specified in the format `projects/*/locations/*`. - string parent = 5; -} - -// GetClusterRequest gets the settings of a cluster. -message GetClusterRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to retrieve. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // The name (project, location, cluster) of the cluster to retrieve. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 5; -} - -// UpdateClusterRequest updates the settings of a cluster. -message UpdateClusterRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Required. A description of the update. - ClusterUpdate update = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to update. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 5; -} - -// UpdateNodePoolRequests update a node pool's image and/or version. -message UpdateNodePoolRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Deprecated. The name of the node pool to upgrade. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 [deprecated = true]; - - // Required. The Kubernetes version to change the nodes to (typically an - // upgrade). - // - // Users may specify either explicit versions offered by Kubernetes Engine or - // version aliases, which have the following behavior: - // - // - "latest": picks the highest valid Kubernetes version - // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - // - "1.X.Y-gke.N": picks an explicit Kubernetes version - // - "-": picks the Kubernetes master version - string node_version = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. The desired image type for the node pool. Please see - // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for - // available image types. - string image_type = 6 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster, node pool) of the node pool to - // update. Specified in the format - // `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 8; - - // The desired list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // node pool's nodes should be located. Changing the locations for a node pool - // will result in nodes being either created or removed from the node pool, - // depending on whether locations are being added or removed. - repeated string locations = 13; - - // The desired workload metadata config for the node pool. - WorkloadMetadataConfig workload_metadata_config = 14; - - // Upgrade settings control disruption and speed of the upgrade. - NodePool.UpgradeSettings upgrade_settings = 15; - - // The desired network tags to be applied to all nodes in the node pool. - // If this field is not present, the tags will not be changed. Otherwise, - // the existing network tags will be *replaced* with the provided tags. - NetworkTags tags = 16; - - // The desired node taints to be applied to all nodes in the node pool. - // If this field is not present, the taints will not be changed. Otherwise, - // the existing node taints will be *replaced* with the provided taints. - NodeTaints taints = 17; - - // The desired node labels to be applied to all nodes in the node pool. - // If this field is not present, the labels will not be changed. Otherwise, - // the existing node labels will be *replaced* with the provided labels. - NodeLabels labels = 18; - - // Parameters that can be configured on Linux nodes. - LinuxNodeConfig linux_node_config = 19; - - // Node kubelet configs. - NodeKubeletConfig kubelet_config = 20; - - // Node network config. - NodeNetworkConfig node_network_config = 21; - - // GCFS config. - GcfsConfig gcfs_config = 22; - - // Confidential nodes config. - // All the nodes in the node pool will be Confidential VM once enabled. - ConfidentialNodes confidential_nodes = 23; - - // Enable or disable gvnic on the node pool. - VirtualNIC gvnic = 29; - - // The current etag of the node pool. - // If an etag is provided and does not match the current etag of the node - // pool, update will be blocked and an ABORTED error will be returned. - string etag = 30; - - // Enable or disable NCCL fast socket for the node pool. - FastSocket fast_socket = 31; - - // Logging configuration. - NodePoolLoggingConfig logging_config = 32; - - // The resource labels for the node pool to use to annotate any related - // Google Compute Engine resources. - ResourceLabels resource_labels = 33; - - // Parameters that can be configured on Windows nodes. - WindowsNodeConfig windows_node_config = 34; -} - -// SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool. -message SetNodePoolAutoscalingRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Deprecated. The name of the node pool to upgrade. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 [deprecated = true]; - - // Required. Autoscaling configuration for the node pool. - NodePoolAutoscaling autoscaling = 5 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster, node pool) of the node pool to set - // autoscaler settings. Specified in the format - // `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 6; -} - -// SetLoggingServiceRequest sets the logging service of a cluster. -message SetLoggingServiceRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Required. The logging service the cluster should use to write logs. - // Currently available options: - // - // * `logging.googleapis.com/kubernetes` - The Cloud Logging - // service with a Kubernetes-native resource model - // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer - // available as of GKE 1.15). - // * `none` - no logs will be exported from the cluster. - // - // If left as an empty string,`logging.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. - string logging_service = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to set logging. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 5; -} - -// SetMonitoringServiceRequest sets the monitoring service of a cluster. -message SetMonitoringServiceRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Required. The monitoring service the cluster should use to write metrics. - // Currently available options: - // - // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring - // service with a Kubernetes-native resource model - // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no - // longer available as of GKE 1.15). - // * `none` - No metrics will be exported from the cluster. - // - // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. - string monitoring_service = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to set monitoring. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; -} - -// SetAddonsConfigRequest sets the addons associated with the cluster. -message SetAddonsConfigRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Required. The desired configurations for the various addons available to - // run in the cluster. - AddonsConfig addons_config = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to set addons. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; -} - -// SetLocationsRequest sets the locations of the cluster. -message SetLocationsRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Required. The desired list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster's nodes should be located. Changing the locations a cluster is in - // will result in nodes being either created or removed from the cluster, - // depending on whether locations are being added or removed. - // - // This list must always include the cluster's primary zone. - repeated string locations = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to set locations. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; -} - -// UpdateMasterRequest updates the master of the cluster. -message UpdateMasterRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Required. The Kubernetes version to change the master to. - // - // Users may specify either explicit versions offered by Kubernetes Engine or - // version aliases, which have the following behavior: - // - // - "latest": picks the highest valid Kubernetes version - // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - // - "1.X.Y-gke.N": picks an explicit Kubernetes version - // - "-": picks the default Kubernetes version - string master_version = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to update. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 7; -} - -// SetMasterAuthRequest updates the admin password of a cluster. -message SetMasterAuthRequest { - // Operation type: what type update to perform. - enum Action { - // Operation is unknown and will error out. - UNKNOWN = 0; - - // Set the password to a user generated value. - SET_PASSWORD = 1; - - // Generate a new password and set it to that. - GENERATE_PASSWORD = 2; - - // Set the username. If an empty username is provided, basic authentication - // is disabled for the cluster. If a non-empty username is provided, basic - // authentication is enabled, with either a provided password or a generated - // one. - SET_USERNAME = 3; - } - - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Required. The exact form of action to be taken on the master auth. - Action action = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. A description of the update. - MasterAuth update = 5 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to set auth. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 7; -} - -// DeleteClusterRequest deletes a cluster. -message DeleteClusterRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to delete. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // The name (project, location, cluster) of the cluster to delete. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 4; -} - -// ListClustersRequest lists clusters. -message ListClustersRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the parent field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides, or "-" for all zones. This field has been deprecated and - // replaced by the parent field. - string zone = 2 [deprecated = true]; - - // The parent (project and location) where the clusters will be listed. - // Specified in the format `projects/*/locations/*`. - // Location "-" matches all zones and all regions. - string parent = 4; -} - -// ListClustersResponse is the result of ListClustersRequest. -message ListClustersResponse { - // A list of clusters in the project in the specified zone, or - // across all ones. - repeated Cluster clusters = 1; - - // If any zones are listed here, the list of clusters returned - // may be missing those zones. - repeated string missing_zones = 2; -} - -// GetOperationRequest gets a single operation. -message GetOperationRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The server-assigned `name` of the operation. - // This field has been deprecated and replaced by the name field. - string operation_id = 3 [deprecated = true]; - - // The name (project, location, operation id) of the operation to get. - // Specified in the format `projects/*/locations/*/operations/*`. - string name = 5; -} - -// ListOperationsRequest lists operations. -message ListOperationsRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the parent field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) to return - // operations for, or `-` for all zones. This field has been deprecated and - // replaced by the parent field. - string zone = 2 [deprecated = true]; - - // The parent (project and location) where the operations will be listed. - // Specified in the format `projects/*/locations/*`. - // Location "-" matches all zones and all regions. - string parent = 4; -} - -// CancelOperationRequest cancels a single operation. -message CancelOperationRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // operation resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The server-assigned `name` of the operation. - // This field has been deprecated and replaced by the name field. - string operation_id = 3 [deprecated = true]; - - // The name (project, location, operation id) of the operation to cancel. - // Specified in the format `projects/*/locations/*/operations/*`. - string name = 4; -} - -// ListOperationsResponse is the result of ListOperationsRequest. -message ListOperationsResponse { - // A list of operations in the project in the specified zone. - repeated Operation operations = 1; - - // If any zones are listed here, the list of operations returned - // may be missing the operations from those zones. - repeated string missing_zones = 2; -} - -// Gets the current Kubernetes Engine service configuration. -message GetServerConfigRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) to return - // operations for. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // The name (project and location) of the server config to get, - // specified in the format `projects/*/locations/*`. - string name = 4; -} - -// Kubernetes Engine service configuration. -message ServerConfig { - // ReleaseChannelConfig exposes configuration for a release channel. - message ReleaseChannelConfig { - // The release channel this configuration applies to. - ReleaseChannel.Channel channel = 1; - - // The default version for newly created clusters on the channel. - string default_version = 2; - - // List of valid versions for the channel. - repeated string valid_versions = 4; - } - - // Version of Kubernetes the service deploys by default. - string default_cluster_version = 1; - - // List of valid node upgrade target versions, in descending order. - repeated string valid_node_versions = 3; - - // Default image type. - string default_image_type = 4; - - // List of valid image types. - repeated string valid_image_types = 5; - - // List of valid master versions, in descending order. - repeated string valid_master_versions = 6; - - // List of release channel configurations. - repeated ReleaseChannelConfig channels = 9; -} - -// CreateNodePoolRequest creates a node pool for a cluster. -message CreateNodePoolRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the parent field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the parent - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the parent field. - string cluster_id = 3 [deprecated = true]; - - // Required. The node pool to create. - NodePool node_pool = 4 [(google.api.field_behavior) = REQUIRED]; - - // The parent (project, location, cluster name) where the node pool will be - // created. Specified in the format - // `projects/*/locations/*/clusters/*`. - string parent = 6; -} - -// DeleteNodePoolRequest deletes a node pool for a cluster. -message DeleteNodePoolRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Deprecated. The name of the node pool to delete. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 [deprecated = true]; - - // The name (project, location, cluster, node pool id) of the node pool to - // delete. Specified in the format - // `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 6; -} - -// ListNodePoolsRequest lists the node pool(s) for a cluster. -message ListNodePoolsRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the parent field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the parent - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the parent field. - string cluster_id = 3 [deprecated = true]; - - // The parent (project, location, cluster name) where the node pools will be - // listed. Specified in the format `projects/*/locations/*/clusters/*`. - string parent = 5; -} - -// GetNodePoolRequest retrieves a node pool for a cluster. -message GetNodePoolRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Deprecated. The name of the node pool. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 [deprecated = true]; - - // The name (project, location, cluster, node pool id) of the node pool to - // get. Specified in the format - // `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 6; -} - -// Settings for blue-green upgrade. -message BlueGreenSettings { - // Standard rollout policy is the default policy for blue-green. - message StandardRolloutPolicy { - // Blue pool size to drain in a batch. - oneof update_batch_size { - // Percentage of the blue pool nodes to drain in a batch. - // The range of this field should be (0.0, 1.0]. - float batch_percentage = 1; - - // Number of blue nodes to drain in a batch. - int32 batch_node_count = 2; - } - - // Soak time after each batch gets drained. Default to zero. - optional google.protobuf.Duration batch_soak_duration = 3; - } - - // The rollout policy controls the general rollout progress of blue-green. - oneof rollout_policy { - // Standard policy for the blue-green upgrade. - StandardRolloutPolicy standard_rollout_policy = 1; - } - - // Time needed after draining entire blue pool. After this period, blue pool - // will be cleaned up. - optional google.protobuf.Duration node_pool_soak_duration = 2; -} - -// NodePool contains the name and configuration for a cluster's node pool. -// Node pools are a set of nodes (i.e. VM's), with a common configuration and -// specification, under the control of the cluster master. They may have a set -// of Kubernetes labels applied to them, which may be used to reference them -// during pod scheduling. They may also be resized up or down, to accommodate -// the workload. -message NodePool { - // These upgrade settings control the level of parallelism and the level of - // disruption caused by an upgrade. - // - // maxUnavailable controls the number of nodes that can be simultaneously - // unavailable. - // - // maxSurge controls the number of additional nodes that can be added to the - // node pool temporarily for the time of the upgrade to increase the number of - // available nodes. - // - // (maxUnavailable + maxSurge) determines the level of parallelism (how many - // nodes are being upgraded at the same time). - // - // Note: upgrades inevitably introduce some disruption since workloads need to - // be moved from old nodes to new, upgraded ones. Even if maxUnavailable=0, - // this holds true. (Disruption stays within the limits of - // PodDisruptionBudget, if it is configured.) - // - // Consider a hypothetical node pool with 5 nodes having maxSurge=2, - // maxUnavailable=1. This means the upgrade process upgrades 3 nodes - // simultaneously. It creates 2 additional (upgraded) nodes, then it brings - // down 3 old (not yet upgraded) nodes at the same time. This ensures that - // there are always at least 4 nodes available. - // - // These upgrade settings configure the upgrade strategy for the node pool. - // Use strategy to switch between the strategies applied to the node pool. - // - // If the strategy is ROLLING, use max_surge and max_unavailable to control - // the level of parallelism and the level of disruption caused by upgrade. - // 1. maxSurge controls the number of additional nodes that can be added to - // the node pool temporarily for the time of the upgrade to increase the - // number of available nodes. - // 2. maxUnavailable controls the number of nodes that can be simultaneously - // unavailable. - // 3. (maxUnavailable + maxSurge) determines the level of parallelism (how - // many nodes are being upgraded at the same time). - // - // If the strategy is BLUE_GREEN, use blue_green_settings to configure the - // blue-green upgrade related settings. - // 1. standard_rollout_policy is the default policy. The policy is used to - // control the way blue pool gets drained. The draining is executed in the - // batch mode. The batch size could be specified as either percentage of the - // node pool size or the number of nodes. batch_soak_duration is the soak - // time after each batch gets drained. - // 2. node_pool_soak_duration is the soak time after all blue nodes are - // drained. After this period, the blue pool nodes will be deleted. - message UpgradeSettings { - // The maximum number of nodes that can be created beyond the current size - // of the node pool during the upgrade process. - int32 max_surge = 1; - - // The maximum number of nodes that can be simultaneously unavailable during - // the upgrade process. A node is considered available if its status is - // Ready. - int32 max_unavailable = 2; - - // Update strategy of the node pool. - optional NodePoolUpdateStrategy strategy = 3; - - // Settings for blue-green upgrade strategy. - optional BlueGreenSettings blue_green_settings = 4; - } - - // UpdateInfo contains resource (instance groups, etc), status and other - // intermediate information relevant to a node pool upgrade. - message UpdateInfo { - // Information relevant to blue-green upgrade. - message BlueGreenInfo { - // Phase represents the different stages blue-green upgrade is running in. - enum Phase { - // Unspecified phase. - PHASE_UNSPECIFIED = 0; - - // blue-green upgrade has been initiated. - UPDATE_STARTED = 1; - - // Start creating green pool nodes. - CREATING_GREEN_POOL = 2; - - // Start cordoning blue pool nodes. - CORDONING_BLUE_POOL = 3; - - // Start draining blue pool nodes. - DRAINING_BLUE_POOL = 4; - - // Start soaking time after draining entire blue pool. - NODE_POOL_SOAKING = 5; - - // Start deleting blue nodes. - DELETING_BLUE_POOL = 6; - - // Rollback has been initiated. - ROLLBACK_STARTED = 7; - } - - // Current blue-green upgrade phase. - Phase phase = 1; - - // The resource URLs of the [managed instance groups] - // (/compute/docs/instance-groups/creating-groups-of-managed-instances) - // associated with blue pool. - repeated string blue_instance_group_urls = 2; - - // The resource URLs of the [managed instance groups] - // (/compute/docs/instance-groups/creating-groups-of-managed-instances) - // associated with green pool. - repeated string green_instance_group_urls = 3; - - // Time to start deleting blue pool to complete blue-green upgrade, - // in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string blue_pool_deletion_start_time = 4; - - // Version of green pool. - string green_pool_version = 5; - } - - // Information of a blue-green upgrade. - BlueGreenInfo blue_green_info = 1; - } - - // The current status of the node pool instance. - enum Status { - // Not set. - STATUS_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 RUNNING_WITH_ERROR state indicates the node pool has been created - // and is partially usable. Some error state has occurred and some - // functionality may be impaired. Customer may need to reissue a request - // or trigger a new update. - RUNNING_WITH_ERROR = 3; - - // The RECONCILING state indicates that some work is actively being done on - // the node pool, such as upgrading node software. Details can - // be found in the `statusMessage` field. - RECONCILING = 4; - - // The STOPPING state indicates the node pool is being deleted. - STOPPING = 5; - - // The ERROR state indicates the node pool may be unusable. Details - // can be found in the `statusMessage` field. - ERROR = 6; - } - - // PlacementPolicy defines the placement policy used by the node pool. - message PlacementPolicy { - // Type defines the type of placement policy. - enum Type { - // TYPE_UNSPECIFIED specifies no requirements on nodes - // placement. - TYPE_UNSPECIFIED = 0; - - // COMPACT specifies node placement in the same availability domain to - // ensure low communication latency. - COMPACT = 1; - } - - // The type of placement. - Type type = 1; - - // If set, refers to the name of a custom resource policy supplied by the - // user. The resource policy must be in the same project and region as the - // node pool. If not found, InvalidArgument error is returned. - string policy_name = 3; - } - - // The name of the node pool. - string name = 1; - - // The node configuration of the pool. - NodeConfig config = 2; - - // The initial node count for the pool. You must ensure that your - // Compute Engine [resource quota](https://cloud.google.com/compute/quotas) - // is sufficient for this number of instances. You must also have available - // firewall and routes quota. - int32 initial_node_count = 3; - - // The list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // NodePool's nodes should be located. - // - // If this value is unspecified during node pool creation, the - // [Cluster.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters#Cluster.FIELDS.locations) - // value will be used, instead. - // - // Warning: changing node pool locations will result in nodes being added - // and/or removed. - repeated string locations = 13; - - // Networking configuration for this NodePool. If specified, it overrides the - // cluster-level defaults. - NodeNetworkConfig network_config = 14; - - // [Output only] Server-defined URL for the resource. - string self_link = 100; - - // The version of Kubernetes running on this NodePool's nodes. If unspecified, - // it defaults as described - // [here](https://cloud.google.com/kubernetes-engine/versioning#specifying_node_version). - string version = 101; - - // [Output only] The resource URLs of the [managed instance - // groups](https://cloud.google.com/compute/docs/instance-groups/creating-groups-of-managed-instances) - // associated with this node pool. - // During the node pool blue-green upgrade operation, the URLs contain both - // blue and green resources. - repeated string instance_group_urls = 102; - - // [Output only] The status of the nodes in this pool instance. - Status status = 103; - - // [Output only] Deprecated. Use conditions instead. - // Additional information about the current status of this - // node pool instance, if available. - string status_message = 104 [deprecated = true]; - - // Autoscaler configuration for this NodePool. Autoscaler is enabled - // only if a valid configuration is present. - NodePoolAutoscaling autoscaling = 4; - - // NodeManagement configuration for this NodePool. - NodeManagement management = 5; - - // The constraint on the maximum number of pods that can be run - // simultaneously on a node in the node pool. - MaxPodsConstraint max_pods_constraint = 6; - - // Which conditions caused the current node pool state. - repeated StatusCondition conditions = 105; - - // [Output only] The pod CIDR block size per node in this node pool. - int32 pod_ipv4_cidr_size = 7; - - // Upgrade settings control disruption and speed of the upgrade. - UpgradeSettings upgrade_settings = 107; - - // Specifies the node placement policy. - PlacementPolicy placement_policy = 108; - - // Output only. [Output only] Update info contains relevant information during - // a node pool update. - UpdateInfo update_info = 109 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // This checksum is computed by the server based on the value of node pool - // fields, and may be sent on update requests to ensure the client has an - // up-to-date value before proceeding. - string etag = 110; - - // Enable best effort provisioning for nodes - BestEffortProvisioning best_effort_provisioning = 113; -} - -// NodeManagement defines the set of node management services turned on for the -// node pool. -message NodeManagement { - // A flag that specifies whether node auto-upgrade is enabled for the node - // pool. If enabled, node auto-upgrade helps keep the nodes in your node pool - // up to date with the latest release version of Kubernetes. - bool auto_upgrade = 1; - - // A flag that specifies whether the node auto-repair is enabled for the node - // pool. If enabled, the nodes in this node pool will be monitored and, if - // they fail health checks too many times, an automatic repair action will be - // triggered. - bool auto_repair = 2; - - // Specifies the Auto Upgrade knobs for the node pool. - AutoUpgradeOptions upgrade_options = 10; -} - -// Best effort provisioning. -message BestEffortProvisioning { - // When this is enabled, cluster/node pool creations will ignore non-fatal - // errors like stockout to best provision as many nodes as possible right now - // and eventually bring up all target number of nodes - bool enabled = 1; - - // Minimum number of nodes to be provisioned to be considered as succeeded, - // and the rest of nodes will be provisioned gradually and eventually when - // stockout issue has been resolved. - int32 min_provision_nodes = 2; -} - -// AutoUpgradeOptions defines the set of options for the user to control how -// the Auto Upgrades will proceed. -message AutoUpgradeOptions { - // [Output only] This field is set when upgrades are about to commence - // with the approximate start time for the upgrades, in - // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string auto_upgrade_start_time = 1; - - // [Output only] This field is set when upgrades are about to commence - // with the description of the upgrade. - string description = 2; -} - -// MaintenancePolicy defines the maintenance policy to be used for the cluster. -message MaintenancePolicy { - // Specifies the maintenance window in which maintenance may be performed. - MaintenanceWindow window = 1; - - // A hash identifying the version of this policy, so that updates to fields of - // the policy won't accidentally undo intermediate changes (and so that users - // of the API unaware of some fields won't accidentally remove other fields). - // Make a `get()` request to the cluster to get the current - // resource version and include it with requests to set the policy. - string resource_version = 3; -} - -// MaintenanceWindow defines the maintenance window to be used for the cluster. -message MaintenanceWindow { - oneof policy { - // DailyMaintenanceWindow specifies a daily maintenance operation window. - DailyMaintenanceWindow daily_maintenance_window = 2; - - // RecurringWindow specifies some number of recurring time periods for - // maintenance to occur. The time windows may be overlapping. If no - // maintenance windows are set, maintenance can occur at any time. - RecurringTimeWindow recurring_window = 3; - } - - // Exceptions to maintenance window. Non-emergency maintenance should not - // occur in these windows. - map maintenance_exclusions = 4; -} - -// Represents an arbitrary window of time. -message TimeWindow { - oneof options { - // MaintenanceExclusionOptions provides maintenance exclusion related - // options. - MaintenanceExclusionOptions maintenance_exclusion_options = 3; - } - - // The time that the window first starts. - google.protobuf.Timestamp start_time = 1; - - // The time that the window ends. The end time should take place after the - // start time. - google.protobuf.Timestamp end_time = 2; -} - -// Represents the Maintenance exclusion option. -message MaintenanceExclusionOptions { - // Scope of exclusion. - enum Scope { - // NO_UPGRADES excludes all upgrades, including patch upgrades and minor - // upgrades across control planes and nodes. This is the default exclusion - // behavior. - NO_UPGRADES = 0; - - // NO_MINOR_UPGRADES excludes all minor upgrades for the cluster, only - // patches are allowed. - NO_MINOR_UPGRADES = 1; - - // NO_MINOR_OR_NODE_UPGRADES excludes all minor upgrades for the cluster, - // and also exclude all node pool upgrades. Only control - // plane patches are allowed. - NO_MINOR_OR_NODE_UPGRADES = 2; - } - - // Scope specifies the upgrade scope which upgrades are blocked by the - // exclusion. - Scope scope = 1; -} - -// Represents an arbitrary window of time that recurs. -message RecurringTimeWindow { - // The window of the first recurrence. - TimeWindow window = 1; - - // An RRULE (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for how - // this window reccurs. They go on for the span of time between the start and - // end time. - // - // For example, to have something repeat every weekday, you'd use: - // `FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR` - // - // To repeat some window daily (equivalent to the DailyMaintenanceWindow): - // `FREQ=DAILY` - // - // For the first weekend of every month: - // `FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU` - // - // This specifies how frequently the window starts. Eg, if you wanted to have - // a 9-5 UTC-4 window every weekday, you'd use something like: - // ``` - // start time = 2019-01-01T09:00:00-0400 - // end time = 2019-01-01T17:00:00-0400 - // recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR - // ``` - // - // Windows can span multiple days. Eg, to make the window encompass every - // weekend from midnight Saturday till the last minute of Sunday UTC: - // ``` - // start time = 2019-01-05T00:00:00Z - // end time = 2019-01-07T23:59:00Z - // recurrence = FREQ=WEEKLY;BYDAY=SA - // ``` - // - // Note the start and end time's specific dates are largely arbitrary except - // to specify duration of the window and when it first starts. - // The FREQ values of HOURLY, MINUTELY, and SECONDLY are not supported. - string recurrence = 2; -} - -// Time window specified for daily maintenance operations. -message DailyMaintenanceWindow { - // Time within the maintenance window to start the maintenance operations. - // Time format should be in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) - // format "HH:MM", where HH : [00-23] and MM : [00-59] GMT. - string start_time = 2; - - // [Output only] Duration of the time window, automatically chosen to be - // smallest possible in the given scenario. - // Duration will be in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) - // format "PTnHnMnS". - string duration = 3; -} - -// SetNodePoolManagementRequest sets the node management properties of a node -// pool. -message SetNodePoolManagementRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to update. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Deprecated. The name of the node pool to update. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 [deprecated = true]; - - // Required. NodeManagement configuration for the node pool. - NodeManagement management = 5 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster, node pool id) of the node pool to set - // management properties. Specified in the format - // `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 7; -} - -// SetNodePoolSizeRequest sets the size of a node pool. -message SetNodePoolSizeRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to update. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Deprecated. The name of the node pool to update. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 [deprecated = true]; - - // Required. The desired node count for the pool. - int32 node_count = 5 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster, node pool id) of the node pool to set - // size. - // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 7; -} - -// CompleteNodePoolUpgradeRequest sets the name of target node pool to complete -// upgrade. -message CompleteNodePoolUpgradeRequest { - // The name (project, location, cluster, node pool id) of the node pool to - // complete upgrade. - // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 1; -} - -// RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed -// NodePool upgrade. This will be an no-op if the last upgrade successfully -// completed. -message RollbackNodePoolUpgradeRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to rollback. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Deprecated. The name of the node pool to rollback. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 [deprecated = true]; - - // The name (project, location, cluster, node pool id) of the node poll to - // rollback upgrade. - // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 6; - - // Option for rollback to ignore the PodDisruptionBudget. - // Default value is false. - bool respect_pdb = 7; -} - -// ListNodePoolsResponse is the result of ListNodePoolsRequest. -message ListNodePoolsResponse { - // A list of node pools for a cluster. - repeated NodePool node_pools = 1; -} - -// ClusterAutoscaling contains global, per-cluster information -// required by Cluster Autoscaler to automatically adjust -// the size of the cluster and create/delete -// node pools based on the current needs. -message ClusterAutoscaling { - // Defines possible options for autoscaling_profile field. - enum AutoscalingProfile { - // No change to autoscaling configuration. - PROFILE_UNSPECIFIED = 0; - - // Prioritize optimizing utilization of resources. - OPTIMIZE_UTILIZATION = 1; - - // Use default (balanced) autoscaling configuration. - BALANCED = 2; - } - - // Enables automatic node pool creation and deletion. - bool enable_node_autoprovisioning = 1; - - // Contains global constraints regarding minimum and maximum - // amount of resources in the cluster. - repeated ResourceLimit resource_limits = 2; - - // Defines autoscaling behaviour. - AutoscalingProfile autoscaling_profile = 3; - - // AutoprovisioningNodePoolDefaults contains defaults for a node pool - // created by NAP. - AutoprovisioningNodePoolDefaults autoprovisioning_node_pool_defaults = 4; - - // The list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // NodePool's nodes can be created by NAP. - repeated string autoprovisioning_locations = 5; -} - -// AutoprovisioningNodePoolDefaults contains defaults for a node pool created -// by NAP. -message AutoprovisioningNodePoolDefaults { - // Scopes that are used by NAP when creating node pools. - repeated string oauth_scopes = 1; - - // The Google Cloud Platform Service Account to be used by the node VMs. - string service_account = 2; - - // Specifies the upgrade settings for NAP created node pools - NodePool.UpgradeSettings upgrade_settings = 3; - - // Specifies the node management options for NAP created node-pools. - NodeManagement management = 4; - - // Deprecated. Minimum CPU platform to be used for NAP created node pools. - // The instance may be scheduled on the specified or newer CPU platform. - // Applicable values are the friendly names of CPU platforms, such as - // minCpuPlatform: Intel Haswell or - // minCpuPlatform: Intel Sandy Bridge. For more - // information, read [how to specify min CPU - // platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform). - // This field is deprecated, min_cpu_platform should be specified using - // `cloud.google.com/requested-min-cpu-platform` label selector on the pod. - // To unset the min cpu platform field pass "automatic" - // as field value. - string min_cpu_platform = 5 [deprecated = true]; - - // Size of the disk attached to each node, specified in GB. - // The smallest allowed disk size is 10GB. - // - // If unspecified, the default disk size is 100GB. - int32 disk_size_gb = 6; - - // Type of the disk attached to each node (e.g. 'pd-standard', 'pd-ssd' or - // 'pd-balanced') - // - // If unspecified, the default disk type is 'pd-standard' - string disk_type = 7; - - // Shielded Instance options. - ShieldedInstanceConfig shielded_instance_config = 8; - - // The Customer Managed Encryption Key used to encrypt the boot disk attached - // to each node in the node pool. This should be of the form - // projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. - // For more information about protecting resources with Cloud KMS Keys please - // see: - // https://cloud.google.com/compute/docs/disks/customer-managed-encryption - string boot_disk_kms_key = 9; - - // The image type to use for NAP created node. Please see - // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for - // available image types. - string image_type = 10; - - // Enable or disable Kubelet read only port. - optional bool insecure_kubelet_readonly_port_enabled = 13; -} - -// Contains information about amount of some resource in the cluster. -// For memory, value should be in GB. -message ResourceLimit { - // Resource name "cpu", "memory" or gpu-specific string. - string resource_type = 1; - - // Minimum amount of the resource in the cluster. - int64 minimum = 2; - - // Maximum amount of the resource in the cluster. - int64 maximum = 3; -} - -// NodePoolAutoscaling contains information required by cluster autoscaler to -// adjust the size of the node pool to the current cluster usage. -message NodePoolAutoscaling { - // Location policy specifies how zones are picked when scaling up the - // nodepool. - enum LocationPolicy { - // Not set. - LOCATION_POLICY_UNSPECIFIED = 0; - - // BALANCED is a best effort policy that aims to balance the sizes of - // different zones. - BALANCED = 1; - - // ANY policy picks zones that have the highest capacity available. - ANY = 2; - } - - // Is autoscaling enabled for this node pool. - bool enabled = 1; - - // Minimum number of nodes for one location in the NodePool. Must be >= 1 and - // <= max_node_count. - int32 min_node_count = 2; - - // Maximum number of nodes for one location in the NodePool. Must be >= - // min_node_count. There has to be enough quota to scale up the cluster. - int32 max_node_count = 3; - - // Can this node pool be deleted automatically. - bool autoprovisioned = 4; - - // Location policy used when scaling up a nodepool. - LocationPolicy location_policy = 5; - - // Minimum number of nodes in the node pool. Must be greater than 1 less than - // total_max_node_count. - // The total_*_node_count fields are mutually exclusive with the *_node_count - // fields. - int32 total_min_node_count = 6; - - // Maximum number of nodes in the node pool. Must be greater than - // total_min_node_count. There has to be enough quota to scale up the cluster. - // The total_*_node_count fields are mutually exclusive with the *_node_count - // fields. - int32 total_max_node_count = 7; -} - -// SetLabelsRequest sets the Google Cloud Platform labels on a Google Container -// Engine cluster, which will in turn set them for Google Compute Engine -// resources used by that cluster -message SetLabelsRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Required. The labels to set for that cluster. - map resource_labels = 4 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The fingerprint of the previous set of labels for this resource, - // used to detect conflicts. The fingerprint is initially generated by - // Kubernetes Engine and changes after every request to modify or update - // labels. You must always provide an up-to-date fingerprint hash when - // updating or changing labels. Make a `get()` request to the - // resource to get the latest fingerprint. - string label_fingerprint = 5 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster name) of the cluster to set labels. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 7; -} - -// SetLegacyAbacRequest enables or disables the ABAC authorization mechanism for -// a cluster. -message SetLegacyAbacRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster to update. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Required. Whether ABAC authorization will be enabled in the cluster. - bool enabled = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster name) of the cluster to set legacy - // abac. Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; -} - -// StartIPRotationRequest creates a new IP for the cluster and then performs -// a node upgrade on each node pool to point to the new IP. -message StartIPRotationRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // The name (project, location, cluster name) of the cluster to start IP - // rotation. Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; - - // Whether to rotate credentials during IP rotation. - bool rotate_credentials = 7; -} - -// CompleteIPRotationRequest moves the cluster master back into single-IP mode. -message CompleteIPRotationRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // The name (project, location, cluster name) of the cluster to complete IP - // rotation. Specified in the format `projects/*/locations/*/clusters/*`. - string name = 7; -} - -// AcceleratorConfig represents a Hardware Accelerator request. -message AcceleratorConfig { - // The number of the accelerator cards exposed to an instance. - int64 accelerator_count = 1; - - // The accelerator type resource name. List of supported accelerators - // [here](https://cloud.google.com/compute/docs/gpus) - string accelerator_type = 2; - - // Size of partitions to create on the GPU. Valid values are described in the - // NVIDIA [mig user - // guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning). - string gpu_partition_size = 3; - - // The configuration for GPU sharing options. - optional GPUSharingConfig gpu_sharing_config = 5; - - // The configuration for auto installation of GPU driver. - optional GPUDriverInstallationConfig gpu_driver_installation_config = 6; -} - -// GPUSharingConfig represents the GPU sharing configuration for Hardware -// Accelerators. -message GPUSharingConfig { - // The type of GPU sharing strategy currently provided. - enum GPUSharingStrategy { - // Default value. - GPU_SHARING_STRATEGY_UNSPECIFIED = 0; - - // GPUs are time-shared between containers. - TIME_SHARING = 1; - } - - // The max number of containers that can share a physical GPU. - int64 max_shared_clients_per_gpu = 1; - - // The type of GPU sharing strategy to enable on the GPU node. - optional GPUSharingStrategy gpu_sharing_strategy = 2; -} - -// GPUDriverInstallationConfig specifies the version of GPU driver to be auto -// installed. -message GPUDriverInstallationConfig { - // The GPU driver version to install. - enum GPUDriverVersion { - // Default value is to not install any GPU driver. - GPU_DRIVER_VERSION_UNSPECIFIED = 0; - - // Disable GPU driver auto installation and needs manual installation - INSTALLATION_DISABLED = 1; - - // "Default" GPU driver in COS and Ubuntu. - DEFAULT = 2; - - // "Latest" GPU driver in COS. - LATEST = 3; - } - - // Mode for how the GPU driver is installed. - optional GPUDriverVersion gpu_driver_version = 1; -} - -// WorkloadMetadataConfig defines the metadata configuration to expose to -// workloads on the node pool. -message WorkloadMetadataConfig { - // Mode is the configuration for how to expose metadata to workloads running - // on the node. - enum Mode { - // Not set. - MODE_UNSPECIFIED = 0; - - // Expose all Compute Engine metadata to pods. - GCE_METADATA = 1; - - // Run the GKE Metadata Server on this node. The GKE Metadata Server exposes - // a metadata API to workloads that is compatible with the V1 Compute - // Metadata APIs exposed by the Compute Engine and App Engine Metadata - // Servers. This feature can only be enabled if Workload Identity is enabled - // at the cluster level. - GKE_METADATA = 2; - } - - // Mode is the configuration for how to expose metadata to workloads running - // on the node pool. - Mode mode = 2; -} - -// SetNetworkPolicyRequest enables/disables network policy for a cluster. -message SetNetworkPolicyRequest { - // Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 [deprecated = true]; - - // Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true]; - - // Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 [deprecated = true]; - - // Required. Configuration options for the NetworkPolicy feature. - NetworkPolicy network_policy = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster name) of the cluster to set networking - // policy. Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; -} - -// SetMaintenancePolicyRequest sets the maintenance policy for a cluster. -message SetMaintenancePolicyRequest { - // Required. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. - string zone = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the cluster to update. - string cluster_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The maintenance policy to be set for the cluster. An empty field - // clears the existing maintenance policy. - MaintenancePolicy maintenance_policy = 4 - [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster name) of the cluster to set - // maintenance policy. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 5; -} - -// StatusCondition describes why a cluster or a node pool has a certain status -// (e.g., ERROR or DEGRADED). -message StatusCondition { - // Code for each condition - enum Code { - // UNKNOWN indicates a generic condition. - UNKNOWN = 0; - - // GCE_STOCKOUT indicates that Google Compute Engine resources are - // temporarily unavailable. - GCE_STOCKOUT = 1; - - // GKE_SERVICE_ACCOUNT_DELETED indicates that the user deleted their robot - // service account. - GKE_SERVICE_ACCOUNT_DELETED = 2; - - // Google Compute Engine quota was exceeded. - GCE_QUOTA_EXCEEDED = 3; - - // Cluster state was manually changed by an SRE due to a system logic error. - SET_BY_OPERATOR = 4; - - // Unable to perform an encrypt operation against the CloudKMS key used for - // etcd level encryption. - CLOUD_KMS_KEY_ERROR = 7; - - // Cluster CA is expiring soon. - CA_EXPIRING = 9; - } - - // Machine-friendly representation of the condition - // Deprecated. Use canonical_code instead. - Code code = 1 [deprecated = true]; - - // Human-friendly representation of the condition - string message = 2; - - // Canonical code of the condition. - google.rpc.Code canonical_code = 3; -} - -// NetworkConfig reports the relative names of network & subnetwork. -message NetworkConfig { - // Configuration of network bandwidth tiers - message ClusterNetworkPerformanceConfig { - // Node network tier - enum Tier { - // Default value - TIER_UNSPECIFIED = 0; - - // Higher bandwidth, actual values based on VM size. - TIER_1 = 1; - } - - // Specifies the total network bandwidth tier for NodePools in the cluster. - optional Tier total_egress_bandwidth_tier = 1; - } - - // Output only. The relative name of the Google Compute Engine - // [network][google.container.v1.NetworkConfig.network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) - // to which the cluster is connected. Example: - // projects/my-project/global/networks/my-network - string network = 1; - - // Output only. The relative name of the Google Compute Engine - // [subnetwork](https://cloud.google.com/compute/docs/vpc) to which the - // cluster is connected. Example: - // projects/my-project/regions/us-central1/subnetworks/my-subnet - string subnetwork = 2; - - // Whether Intra-node visibility is enabled for this cluster. - // This makes same node pod to pod traffic visible for VPC network. - bool enable_intra_node_visibility = 5; - - // Whether the cluster disables default in-node sNAT rules. In-node sNAT rules - // will be disabled when default_snat_status is disabled. When disabled is set - // to false, default IP masquerade rules will be applied to the nodes to - // prevent sNAT on cluster internal traffic. - DefaultSnatStatus default_snat_status = 7; - - // Whether L4ILB Subsetting is enabled for this cluster. - bool enable_l4ilb_subsetting = 10; - - // The desired datapath provider for this cluster. By default, uses the - // IPTables-based kube-proxy implementation. - DatapathProvider datapath_provider = 11; - - // The desired state of IPv6 connectivity to Google Services. - // By default, no private IPv6 access to or from Google Services (all access - // will be via IPv4) - PrivateIPv6GoogleAccess private_ipv6_google_access = 12; - - // DNSConfig contains clusterDNS config for this cluster. - DNSConfig dns_config = 13; - - // ServiceExternalIPsConfig specifies if services with externalIPs field are - // blocked or not. - ServiceExternalIPsConfig service_external_ips_config = 15; - - // GatewayAPIConfig contains the desired config of Gateway API on this - // cluster. - GatewayAPIConfig gateway_api_config = 16; - - // Whether multi-networking is enabled for this cluster. - bool enable_multi_networking = 17; - - // Network bandwidth tier configuration. - ClusterNetworkPerformanceConfig network_performance_config = 18; - - // Whether FQDN Network Policy is enabled on this cluster. - optional bool enable_fqdn_network_policy = 19; -} - -// GatewayAPIConfig contains the desired config of Gateway API on this cluster. -message GatewayAPIConfig { - // Channel describes if/how Gateway API should be installed and implemented in - // a cluster. - enum Channel { - // Default value. - CHANNEL_UNSPECIFIED = 0; - - // Gateway API support is disabled - CHANNEL_DISABLED = 1; - - // Gateway API support is enabled, experimental CRDs are installed - CHANNEL_EXPERIMENTAL = 3; - - // Gateway API support is enabled, standard CRDs are installed - CHANNEL_STANDARD = 4; - } - - // The Gateway API release channel to use for Gateway API. - Channel channel = 1; -} - -// Config to block services with externalIPs field. -message ServiceExternalIPsConfig { - // Whether Services with ExternalIPs field are allowed or not. - bool enabled = 1; -} - -// GetOpenIDConfigRequest gets the OIDC discovery document for the -// cluster. See the OpenID Connect Discovery 1.0 specification for details. -message GetOpenIDConfigRequest { - // The cluster (project, location, cluster name) to get the discovery document - // for. Specified in the format `projects/*/locations/*/clusters/*`. - string parent = 1; -} - -// GetOpenIDConfigResponse is an OIDC discovery document for the cluster. -// See the OpenID Connect Discovery 1.0 specification for details. -message GetOpenIDConfigResponse { - // OIDC Issuer. - string issuer = 1; - - // JSON Web Key uri. - string jwks_uri = 2; - - // Supported response types. - repeated string response_types_supported = 3; - - // Supported subject types. - repeated string subject_types_supported = 4; - - // supported ID Token signing Algorithms. - repeated string id_token_signing_alg_values_supported = 5; - - // Supported claims. - repeated string claims_supported = 6; - - // Supported grant types. - repeated string grant_types = 7; -} - -// GetJSONWebKeysRequest gets the public component of the keys used by the -// cluster to sign token requests. This will be the jwks_uri for the discover -// document returned by getOpenIDConfig. See the OpenID Connect -// Discovery 1.0 specification for details. -message GetJSONWebKeysRequest { - // The cluster (project, location, cluster name) to get keys for. Specified in - // the format `projects/*/locations/*/clusters/*`. - string parent = 1; -} - -// Jwk is a JSON Web Key as specified in RFC 7517 -message Jwk { - // Key Type. - string kty = 1; - - // Algorithm. - string alg = 2; - - // Permitted uses for the public keys. - string use = 3; - - // Key ID. - string kid = 4; - - // Used for RSA keys. - string n = 5; - - // Used for RSA keys. - string e = 6; - - // Used for ECDSA keys. - string x = 7; - - // Used for ECDSA keys. - string y = 8; - - // Used for ECDSA keys. - string crv = 9; -} - -// GetJSONWebKeysResponse is a valid JSON Web Key Set as specififed in rfc 7517 -message GetJSONWebKeysResponse { - // The public component of the keys used by the cluster to sign token - // requests. - repeated Jwk keys = 1; -} - -// CheckAutopilotCompatibilityRequest requests getting the blockers for the -// given operation in the cluster. -message CheckAutopilotCompatibilityRequest { - // The name (project, location, cluster) of the cluster to retrieve. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 1; -} - -// AutopilotCompatibilityIssue contains information about a specific -// compatibility issue with Autopilot mode. -message AutopilotCompatibilityIssue { - // The type of the reported issue. - enum IssueType { - // Default value, should not be used. - UNSPECIFIED = 0; - - // Indicates that the issue is a known incompatibility between the - // cluster and Autopilot mode. - INCOMPATIBILITY = 1; - - // Indicates the issue is an incompatibility if customers take no further - // action to resolve. - ADDITIONAL_CONFIG_REQUIRED = 2; - - // Indicates the issue is not an incompatibility, but depending on the - // workloads business logic, there is a potential that they won't work on - // Autopilot. - PASSED_WITH_OPTIONAL_CONFIG = 3; - } - - // The last time when this issue was observed. - google.protobuf.Timestamp last_observation = 1; - - // The constraint type of the issue. - string constraint_type = 2; - - // The incompatibility type of this issue. - IssueType incompatibility_type = 3; - - // The name of the resources which are subject to this issue. - repeated string subjects = 4; - - // A URL to a public documnetation, which addresses resolving this issue. - string documentation_url = 5; - - // The description of the issue. - string description = 6; -} - -// CheckAutopilotCompatibilityResponse has a list of compatibility issues. -message CheckAutopilotCompatibilityResponse { - // The list of issues for the given operation. - repeated AutopilotCompatibilityIssue issues = 1; - - // The summary of the autopilot compatibility response. - string summary = 2; -} - -// ReleaseChannel indicates which release channel a cluster is -// subscribed to. Release channels are arranged in order of risk. -// -// When a cluster is subscribed to a release channel, Google maintains -// both the master version and the node version. Node auto-upgrade -// defaults to true and cannot be disabled. -message ReleaseChannel { - // Possible values for 'channel'. - enum Channel { - // No channel specified. - UNSPECIFIED = 0; - - // RAPID channel is offered on an early access basis for customers who want - // to test new releases. - // - // WARNING: Versions available in the RAPID Channel may be subject to - // unresolved issues with no known workaround and are not subject to any - // SLAs. - RAPID = 1; - - // Clusters subscribed to REGULAR receive versions that are considered GA - // quality. REGULAR is intended for production users who want to take - // advantage of new features. - REGULAR = 2; - - // Clusters subscribed to STABLE receive versions that are known to be - // stable and reliable in production. - STABLE = 3; - } - - // channel specifies which release channel the cluster is subscribed to. - Channel channel = 1; -} - -// Configuration for fine-grained cost management feature. -message CostManagementConfig { - // Whether the feature is enabled or not. - bool enabled = 1; -} - -// IntraNodeVisibilityConfig contains the desired config of the intra-node -// visibility on this cluster. -message IntraNodeVisibilityConfig { - // Enables intra node visibility for this cluster. - bool enabled = 1; -} - -// ILBSubsettingConfig contains the desired config of L4 Internal LoadBalancer -// subsetting on this cluster. -message ILBSubsettingConfig { - // Enables l4 ILB subsetting for this cluster. - bool enabled = 1; -} - -// DNSConfig contains the desired set of options for configuring clusterDNS. -message DNSConfig { - // Provider lists the various in-cluster DNS providers. - enum Provider { - // Default value - PROVIDER_UNSPECIFIED = 0; - - // Use GKE default DNS provider(kube-dns) for DNS resolution. - PLATFORM_DEFAULT = 1; - - // Use CloudDNS for DNS resolution. - CLOUD_DNS = 2; - - // Use KubeDNS for DNS resolution. - KUBE_DNS = 3; - } - - // DNSScope lists the various scopes of access to cluster DNS records. - enum DNSScope { - // Default value, will be inferred as cluster scope. - DNS_SCOPE_UNSPECIFIED = 0; - - // DNS records are accessible from within the cluster. - CLUSTER_SCOPE = 1; - - // DNS records are accessible from within the VPC. - VPC_SCOPE = 2; - } - - // cluster_dns indicates which in-cluster DNS provider should be used. - Provider cluster_dns = 1; - - // cluster_dns_scope indicates the scope of access to cluster DNS records. - DNSScope cluster_dns_scope = 2; - - // cluster_dns_domain is the suffix used for all cluster service records. - string cluster_dns_domain = 3; -} - -// Constraints applied to pods. -message MaxPodsConstraint { - // Constraint enforced on the max num of pods per node. - int64 max_pods_per_node = 1; -} - -// Configuration for the use of Kubernetes Service Accounts in GCP IAM -// policies. -message WorkloadIdentityConfig { - // The workload pool to attach all Kubernetes service accounts to. - string workload_pool = 2; -} - -// IdentityServiceConfig is configuration for Identity Service which allows -// customers to use external identity providers with the K8S API -message IdentityServiceConfig { - // Whether to enable the Identity Service component - bool enabled = 1; -} - -// Configuration for issuance of mTLS keys and certificates to Kubernetes pods. -message MeshCertificates { - // enable_certificates controls issuance of workload mTLS certificates. - // - // If set, the GKE Workload Identity Certificates controller and node agent - // will be deployed in the cluster, which can then be configured by creating a - // WorkloadCertificateConfig Custom Resource. - // - // Requires Workload Identity - // ([workload_pool][google.container.v1.WorkloadIdentityConfig.workload_pool] - // must be non-empty). - google.protobuf.BoolValue enable_certificates = 1; -} - -// Configuration of etcd encryption. -message DatabaseEncryption { - // State of etcd encryption. - enum State { - // Should never be set - UNKNOWN = 0; - - // Secrets in etcd are encrypted. - ENCRYPTED = 1; - - // Secrets in etcd are stored in plain text (at etcd level) - this is - // unrelated to Compute Engine level full disk encryption. - DECRYPTED = 2; - } - - // Name of CloudKMS key to use for the encryption of secrets in etcd. - // Ex. projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key - string key_name = 1; - - // The desired state of etcd encryption. - State state = 2; -} - -// ListUsableSubnetworksRequest requests the list of usable subnetworks -// available to a user for creating clusters. -message ListUsableSubnetworksRequest { - // The parent project where subnetworks are usable. - // Specified in the format `projects/*`. - string parent = 1; - - // Filtering currently only supports equality on the networkProjectId and must - // be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` - // is the project which owns the listed subnetworks. This defaults to the - // parent project ID. - string filter = 2; - - // The max number of results per page that should be returned. If the number - // of available results is larger than `page_size`, a `next_page_token` is - // returned which can be used to get the next page of results in subsequent - // requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - int32 page_size = 3; - - // Specifies a page token to use. Set this to the nextPageToken returned by - // previous list requests to get the next page of results. - string page_token = 4; -} - -// ListUsableSubnetworksResponse is the response of -// ListUsableSubnetworksRequest. -message ListUsableSubnetworksResponse { - // A list of usable subnetworks in the specified network project. - repeated UsableSubnetwork subnetworks = 1; - - // This token allows you to get the next page of results for list requests. - // If the number of results is larger than `page_size`, use the - // `next_page_token` as a value for the query parameter `page_token` in the - // next request. The value will become empty when there are no more pages. - string next_page_token = 2; -} - -// Secondary IP range of a usable subnetwork. -message UsableSubnetworkSecondaryRange { - // Status shows the current usage of a secondary IP range. - enum Status { - // UNKNOWN is the zero value of the Status enum. It's not a valid status. - UNKNOWN = 0; - - // UNUSED denotes that this range is unclaimed by any cluster. - UNUSED = 1; - - // IN_USE_SERVICE denotes that this range is claimed by cluster(s) for - // services. User-managed services range can be shared between clusters - // within the same subnetwork. - IN_USE_SERVICE = 2; - - // IN_USE_SHAREABLE_POD denotes this range was created by the network admin - // and is currently claimed by a cluster for pods. It can only be used by - // other clusters as a pod range. - IN_USE_SHAREABLE_POD = 3; - - // IN_USE_MANAGED_POD denotes this range was created by GKE and is claimed - // for pods. It cannot be used for other clusters. - IN_USE_MANAGED_POD = 4; - } - - // The name associated with this subnetwork secondary range, used when adding - // an alias IP range to a VM instance. - string range_name = 1; - - // The range of IP addresses belonging to this subnetwork secondary range. - string ip_cidr_range = 2; - - // This field is to determine the status of the secondary range programmably. - Status status = 3; -} - -// UsableSubnetwork resource returns the subnetwork name, its associated network -// and the primary CIDR range. -message UsableSubnetwork { - // Subnetwork Name. - // Example: projects/my-project/regions/us-central1/subnetworks/my-subnet - string subnetwork = 1; - - // Network Name. - // Example: projects/my-project/global/networks/my-network - string network = 2; - - // The range of internal addresses that are owned by this subnetwork. - string ip_cidr_range = 3; - - // Secondary IP ranges. - repeated UsableSubnetworkSecondaryRange secondary_ip_ranges = 4; - - // A human readable status message representing the reasons for cases where - // the caller cannot use the secondary ranges under the subnet. For example if - // the secondary_ip_ranges is empty due to a permission issue, an insufficient - // permission message will be given by status_message. - string status_message = 5; -} - -// Configuration for exporting cluster resource usages. -message ResourceUsageExportConfig { - // Parameters for using BigQuery as the destination of resource usage export. - message BigQueryDestination { - // The ID of a BigQuery Dataset. - string dataset_id = 1; - } - - // Parameters for controlling consumption metering. - message ConsumptionMeteringConfig { - // Whether to enable consumption metering for this cluster. If enabled, a - // second BigQuery table will be created to hold resource consumption - // records. - bool enabled = 1; - } - - // Configuration to use BigQuery as usage export destination. - BigQueryDestination bigquery_destination = 1; - - // Whether to enable network egress metering for this cluster. If enabled, a - // daemonset will be created in the cluster to meter network egress traffic. - bool enable_network_egress_metering = 2; - - // Configuration to enable resource consumption metering. - ConsumptionMeteringConfig consumption_metering_config = 3; -} - -// VerticalPodAutoscaling contains global, per-cluster information -// required by Vertical Pod Autoscaler to automatically adjust -// the resources of pods controlled by it. -message VerticalPodAutoscaling { - // Enables vertical pod autoscaling. - bool enabled = 1; -} - -// DefaultSnatStatus contains the desired state of whether default sNAT should -// be disabled on the cluster. -message DefaultSnatStatus { - // Disables cluster default sNAT rules. - bool disabled = 1; -} - -// Configuration of Shielded Nodes feature. -message ShieldedNodes { - // Whether Shielded Nodes features are enabled on all nodes in this cluster. - bool enabled = 1; -} - -// Configuration of gVNIC feature. -message VirtualNIC { - // Whether gVNIC features are enabled in the node pool. - bool enabled = 1; -} - -// Configuration of Fast Socket feature. -message FastSocket { - // Whether Fast Socket features are enabled in the node pool. - bool enabled = 1; -} - -// PrivateIPv6GoogleAccess controls whether and how the pods can communicate -// with Google Services through gRPC over IPv6. -enum PrivateIPv6GoogleAccess { - // Default value. Same as DISABLED - PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED = 0; - - // No private access to or from Google Services - PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED = 1; - - // Enables private IPv6 access to Google Services from GKE - PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE = 2; - - // Enables private IPv6 access to and from Google Services - PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL = 3; -} - -// NotificationConfig is the configuration of notifications. -message NotificationConfig { - // Types of notifications currently supported. Can be used to filter what - // notifications are sent. - enum EventType { - // Not set, will be ignored. - EVENT_TYPE_UNSPECIFIED = 0; - - // Corresponds with UpgradeAvailableEvent. - UPGRADE_AVAILABLE_EVENT = 1; - - // Corresponds with UpgradeEvent. - UPGRADE_EVENT = 2; - - // Corresponds with SecurityBulletinEvent. - SECURITY_BULLETIN_EVENT = 3; - } - - // Pub/Sub specific notification config. - message PubSub { - // Enable notifications for Pub/Sub. - bool enabled = 1; - - // The desired Pub/Sub topic to which notifications will be - // sent by GKE. Format is `projects/{project}/topics/{topic}`. - string topic = 2 [ - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Allows filtering to one or more specific event types. If no filter is - // specified, or if a filter is specified with no event types, all event - // types will be sent - Filter filter = 3; - } - - // Allows filtering to one or more specific event types. If event types are - // present, those and only those event types will be transmitted to the - // cluster. Other types will be skipped. If no filter is specified, or no - // event types are present, all event types will be sent - message Filter { - // Event types to allowlist. - repeated EventType event_type = 1; - } - - // Notification config for Pub/Sub. - PubSub pubsub = 1; -} - -// ConfidentialNodes is configuration for the confidential nodes feature, which -// makes nodes run on confidential VMs. -message ConfidentialNodes { - // Whether Confidential Nodes feature is enabled. - bool enabled = 1; -} - -// UpgradeResourceType is the resource type that is upgrading. It is used -// in upgrade notifications. -enum UpgradeResourceType { - // Default value. This shouldn't be used. - UPGRADE_RESOURCE_TYPE_UNSPECIFIED = 0; - - // Master / control plane - MASTER = 1; - - // Node pool - NODE_POOL = 2; -} - -// UpgradeEvent is a notification sent to customers by the cluster server when -// a resource is upgrading. -message UpgradeEvent { - // The resource type that is upgrading. - UpgradeResourceType resource_type = 1; - - // The operation associated with this upgrade. - string operation = 2; - - // The time when the operation was started. - google.protobuf.Timestamp operation_start_time = 3; - - // The current version before the upgrade. - string current_version = 4; - - // The target version for the upgrade. - string target_version = 5; - - // Optional relative path to the resource. For example in node pool upgrades, - // the relative path of the node pool. - string resource = 6; -} - -// UpgradeAvailableEvent is a notification sent to customers when a new -// available version is released. -message UpgradeAvailableEvent { - // The release version available for upgrade. - string version = 1; - - // The resource type of the release version. - UpgradeResourceType resource_type = 2; - - // The release channel of the version. If empty, it means a non-channel - // release. - ReleaseChannel release_channel = 3; - - // Optional relative path to the resource. For example, the relative path of - // the node pool. - string resource = 4; -} - -// SecurityBulletinEvent is a notification sent to customers when a security -// bulletin has been posted that they are vulnerable to. -message SecurityBulletinEvent { - // The resource type (node/control plane) that has the vulnerability. Multiple - // notifications (1 notification per resource type) will be sent for a - // vulnerability that affects > 1 resource type. - string resource_type_affected = 1; - - // The ID of the bulletin corresponding to the vulnerability. - string bulletin_id = 2; - - // The CVEs associated with this bulletin. - repeated string cve_ids = 3; - - // The severity of this bulletin as it relates to GKE. - string severity = 4; - - // The URI link to the bulletin on the website for more information. - string bulletin_uri = 5; - - // A brief description of the bulletin. See the bulletin pointed to by the - // bulletin_uri field for an expanded description. - string brief_description = 6; - - // The GKE minor versions affected by this vulnerability. - repeated string affected_supported_minors = 7; - - // The GKE versions where this vulnerability is patched. - repeated string patched_versions = 8; - - // This represents a version selected from the patched_versions field that - // the cluster receiving this notification should most likely want to upgrade - // to based on its current version. Note that if this notification is being - // received by a given cluster, it means that this version is currently - // available as an upgrade target in that cluster's location. - string suggested_upgrade_target = 9; - - // If this field is specified, it means there are manual steps that the user - // must take to make their clusters safe. - bool manual_steps_required = 10; -} - -// Autopilot is the configuration for Autopilot settings on the cluster. -message Autopilot { - // Enable Autopilot - bool enabled = 1; - - // Workload policy configuration for Autopilot. - WorkloadPolicyConfig workload_policy_config = 2; -} - -// WorkloadPolicyConfig is the configuration of workload policy for autopilot -// clusters. -message WorkloadPolicyConfig { - // If true, workloads can use NET_ADMIN capability. - optional bool allow_net_admin = 1; -} - -// LoggingConfig is cluster logging configuration. -message LoggingConfig { - // Logging components configuration - LoggingComponentConfig component_config = 1; -} - -// LoggingComponentConfig is cluster logging component configuration. -message LoggingComponentConfig { - // GKE components exposing logs - enum Component { - // Default value. This shouldn't be used. - COMPONENT_UNSPECIFIED = 0; - - // system components - SYSTEM_COMPONENTS = 1; - - // workloads - WORKLOADS = 2; - - // kube-apiserver - APISERVER = 3; - - // kube-scheduler - SCHEDULER = 4; - - // kube-controller-manager - CONTROLLER_MANAGER = 5; - } - - // Select components to collect logs. An empty set would disable all logging. - repeated Component enable_components = 1; -} - -// MonitoringConfig is cluster monitoring configuration. -message MonitoringConfig { - // Monitoring components configuration - MonitoringComponentConfig component_config = 1; - - // Enable Google Cloud Managed Service for Prometheus - // in the cluster. - ManagedPrometheusConfig managed_prometheus_config = 2; - - // Configuration of Advanced Datapath Observability features. - AdvancedDatapathObservabilityConfig advanced_datapath_observability_config = - 3; -} - -// AdvancedDatapathObservabilityConfig specifies configuration of observability -// features of advanced datapath. -message AdvancedDatapathObservabilityConfig { - // Supported Relay modes - enum RelayMode { - // Default value. This shouldn't be used. - RELAY_MODE_UNSPECIFIED = 0; - - // disabled - DISABLED = 1; - - // exposed via internal load balancer - INTERNAL_VPC_LB = 3; - - // exposed via external load balancer - EXTERNAL_LB = 4; - } - - // Expose flow metrics on nodes - bool enable_metrics = 1; - - // Method used to make Relay available - RelayMode relay_mode = 2; -} - -// NodePoolLoggingConfig specifies logging configuration for nodepools. -message NodePoolLoggingConfig { - // Logging variant configuration. - LoggingVariantConfig variant_config = 1; -} - -// LoggingVariantConfig specifies the behaviour of the logging component. -message LoggingVariantConfig { - // Logging component variants. - enum Variant { - // Default value. This shouldn't be used. - VARIANT_UNSPECIFIED = 0; - - // default logging variant. - DEFAULT = 1; - - // maximum logging throughput variant. - MAX_THROUGHPUT = 2; - } - - // Logging variant deployed on nodes. - Variant variant = 1; -} - -// MonitoringComponentConfig is cluster monitoring component configuration. -message MonitoringComponentConfig { - // GKE components exposing metrics - enum Component { - // Default value. This shouldn't be used. - COMPONENT_UNSPECIFIED = 0; - - // system components - SYSTEM_COMPONENTS = 1; - - // kube-apiserver - APISERVER = 3; - - // kube-scheduler - SCHEDULER = 4; - - // kube-controller-manager - CONTROLLER_MANAGER = 5; - - // Storage - STORAGE = 7; - - // Horizontal Pod Autoscaling - HPA = 8; - - // Pod - POD = 9; - - // DaemonSet - DAEMONSET = 10; - - // Deployment - DEPLOYMENT = 11; - - // Statefulset - STATEFULSET = 12; - } - - // Select components to collect metrics. An empty set would disable all - // monitoring. - repeated Component enable_components = 1; -} - -// The datapath provider selects the implementation of the Kubernetes networking -// model for service resolution and network policy enforcement. -enum DatapathProvider { - // Default value. - DATAPATH_PROVIDER_UNSPECIFIED = 0; - - // Use the IPTables implementation based on kube-proxy. - LEGACY_DATAPATH = 1; - - // Use the eBPF based GKE Dataplane V2 with additional features. See the [GKE - // Dataplane V2 - // documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/dataplane-v2) - // for more. - ADVANCED_DATAPATH = 2; -} - -// Strategy used for node pool update. -enum NodePoolUpdateStrategy { - // Default value if unset. GKE internally defaults the update strategy to - // SURGE for unspecified strategies. - NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED = 0; - - // blue-green upgrade. - BLUE_GREEN = 2; - - // SURGE is the traditional way of upgrade a node pool. - // max_surge and max_unavailable determines the level of upgrade parallelism. - SURGE = 3; -} - -// ManagedPrometheusConfig defines the configuration for -// Google Cloud Managed Service for Prometheus. -message ManagedPrometheusConfig { - // Enable Managed Collection. - bool enabled = 1; -} - -// Fleet is the fleet configuration for the cluster. -message Fleet { - // The Fleet host project(project ID or project number) where this cluster - // will be registered to. This field cannot be changed after the cluster has - // been registered. - string project = 1; - - // [Output only] The full resource name of the registered fleet membership of - // the cluster, in the format - // `//gkehub.googleapis.com/projects/*/locations/*/memberships/*`. - string membership = 2; - - // [Output only] Whether the cluster has been registered through the fleet - // API. - bool pre_registered = 3; -} - -// Possible values for IP stack type -enum StackType { - // Default value, will be defaulted as IPV4 only - STACK_TYPE_UNSPECIFIED = 0; - - // Cluster is IPV4 only - IPV4 = 1; - - // Cluster can use both IPv4 and IPv6 - IPV4_IPV6 = 2; -} - -// Possible values for IPv6 access type -enum IPv6AccessType { - // Default value, will be defaulted as type external. - IPV6_ACCESS_TYPE_UNSPECIFIED = 0; - - // Access type internal (all v6 addresses are internal IPs) - INTERNAL = 1; - - // Access type external (all v6 addresses are external IPs) - EXTERNAL = 2; -} - -// LocalNvmeSsdBlockConfig contains configuration for using raw-block local -// NVMe SSD. -message LocalNvmeSsdBlockConfig { - // The number of raw-block local NVMe SSD disks to be attached to the node. - // Each local SSD is 375 GB in size. If zero, it means no raw-block local NVMe - // SSD disks to be attached to the node. - // The limit for this value is dependent upon the maximum number of - // disks available on a machine per zone. See: - // https://cloud.google.com/compute/docs/disks/local-ssd - // for more information. - int32 local_ssd_count = 1; -} - -// EphemeralStorageLocalSsdConfig contains configuration for the node ephemeral -// storage using Local SSD. -message EphemeralStorageLocalSsdConfig { - // Number of local SSDs to use to back ephemeral storage. Uses NVMe - // interfaces. Each local SSD is 375 GB in size. - // If zero, it means to disable using local SSDs as ephemeral storage. - // The limit for this value is dependent upon the maximum number of - // disks available on a machine per zone. See: - // https://cloud.google.com/compute/docs/disks/local-ssd - // for more information. - int32 local_ssd_count = 1; -} diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.cancel_operation.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.cancel_operation.js deleted file mode 100644 index e556c2aaf76..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.cancel_operation.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 container_v1_generated_ClusterManager_CancelOperation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, operation id) of the operation to cancel. - * Specified in the format `projects/* /locations/* /operations/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCancelOperation() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.cancelOperation(request); - console.log(response); - } - - callCancelOperation(); - // [END container_v1_generated_ClusterManager_CancelOperation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.check_autopilot_compatibility.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.check_autopilot_compatibility.js deleted file mode 100644 index e4d731fc2d0..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.check_autopilot_compatibility.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 container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster) of the cluster to retrieve. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCheckAutopilotCompatibility() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.checkAutopilotCompatibility(request); - console.log(response); - } - - callCheckAutopilotCompatibility(); - // [END container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_i_p_rotation.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_i_p_rotation.js deleted file mode 100644 index 82b71531860..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_i_p_rotation.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 container_v1_generated_ClusterManager_CompleteIPRotation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster name) of the cluster to complete IP - * rotation. Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCompleteIPRotation() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.completeIPRotation(request); - console.log(response); - } - - callCompleteIPRotation(); - // [END container_v1_generated_ClusterManager_CompleteIPRotation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_node_pool_upgrade.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_node_pool_upgrade.js deleted file mode 100644 index 8cf74642faf..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.complete_node_pool_upgrade.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() { - // [START container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster, node pool id) of the node pool to - * complete upgrade. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCompleteNodePoolUpgrade() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.completeNodePoolUpgrade(request); - console.log(response); - } - - callCompleteNodePoolUpgrade(); - // [END container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_cluster.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_cluster.js deleted file mode 100644 index bc132fbb109..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_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(cluster) { - // [START container_v1_generated_ClusterManager_CreateCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 cluster - * resource (https://cloud.google.com/container-engine/reference/rest/v1/projects.locations.clusters) - */ - // const cluster = {} - /** - * The parent (project and location) where the cluster will be created. - * Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCreateCluster() { - // Construct request - const request = { - cluster, - }; - - // Run request - const response = await containerClient.createCluster(request); - console.log(response); - } - - callCreateCluster(); - // [END container_v1_generated_ClusterManager_CreateCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_node_pool.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_node_pool.js deleted file mode 100644 index c2526e72425..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.create_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(nodePool) { - // [START container_v1_generated_ClusterManager_CreateNodePool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The node pool to create. - */ - // const nodePool = {} - /** - * The parent (project, location, cluster name) where the node pool will be - * created. Specified in the format - * `projects/* /locations/* /clusters/*`. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCreateNodePool() { - // Construct request - const request = { - nodePool, - }; - - // Run request - const response = await containerClient.createNodePool(request); - console.log(response); - } - - callCreateNodePool(); - // [END container_v1_generated_ClusterManager_CreateNodePool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_cluster.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_cluster.js deleted file mode 100644 index b7f789d7b80..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_cluster.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 container_v1_generated_ClusterManager_DeleteCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster) of the cluster to delete. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callDeleteCluster() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.deleteCluster(request); - console.log(response); - } - - callDeleteCluster(); - // [END container_v1_generated_ClusterManager_DeleteCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_node_pool.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_node_pool.js deleted file mode 100644 index 1d286e9963b..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.delete_node_pool.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() { - // [START container_v1_generated_ClusterManager_DeleteNodePool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster, node pool id) of the node pool to - * delete. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callDeleteNodePool() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.deleteNodePool(request); - console.log(response); - } - - callDeleteNodePool(); - // [END container_v1_generated_ClusterManager_DeleteNodePool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_cluster.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_cluster.js deleted file mode 100644 index 565479929b5..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_cluster.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 container_v1_generated_ClusterManager_GetCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster) of the cluster to retrieve. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callGetCluster() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.getCluster(request); - console.log(response); - } - - callGetCluster(); - // [END container_v1_generated_ClusterManager_GetCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_j_s_o_n_web_keys.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_j_s_o_n_web_keys.js deleted file mode 100644 index ce76d378ce1..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_j_s_o_n_web_keys.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 container_v1_generated_ClusterManager_GetJSONWebKeys_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 cluster (project, location, cluster name) to get keys for. Specified in - * the format `projects/* /locations/* /clusters/*`. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callGetJSONWebKeys() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.getJSONWebKeys(request); - console.log(response); - } - - callGetJSONWebKeys(); - // [END container_v1_generated_ClusterManager_GetJSONWebKeys_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_node_pool.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_node_pool.js deleted file mode 100644 index fb3301234b1..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_node_pool.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() { - // [START container_v1_generated_ClusterManager_GetNodePool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster, node pool id) of the node pool to - * get. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callGetNodePool() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.getNodePool(request); - console.log(response); - } - - callGetNodePool(); - // [END container_v1_generated_ClusterManager_GetNodePool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_operation.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_operation.js deleted file mode 100644 index 58a774ae645..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_operation.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 container_v1_generated_ClusterManager_GetOperation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, operation id) of the operation to get. - * Specified in the format `projects/* /locations/* /operations/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callGetOperation() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.getOperation(request); - console.log(response); - } - - callGetOperation(); - // [END container_v1_generated_ClusterManager_GetOperation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_server_config.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_server_config.js deleted file mode 100644 index 6a1e2ef0e69..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.get_server_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() { - // [START container_v1_generated_ClusterManager_GetServerConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project and location) of the server config to get, - * specified in the format `projects/* /locations/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callGetServerConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.getServerConfig(request); - console.log(response); - } - - callGetServerConfig(); - // [END container_v1_generated_ClusterManager_GetServerConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_clusters.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_clusters.js deleted file mode 100644 index fb7dbc835b2..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_clusters.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() { - // [START container_v1_generated_ClusterManager_ListClusters_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 clusters will be listed. - * Specified in the format `projects/* /locations/*`. - * Location "-" matches all zones and all regions. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callListClusters() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.listClusters(request); - console.log(response); - } - - callListClusters(); - // [END container_v1_generated_ClusterManager_ListClusters_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_node_pools.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_node_pools.js deleted file mode 100644 index fa48c06009a..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_node_pools.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 container_v1_generated_ClusterManager_ListNodePools_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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, location, cluster name) where the node pools will be - * listed. Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callListNodePools() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.listNodePools(request); - console.log(response); - } - - callListNodePools(); - // [END container_v1_generated_ClusterManager_ListNodePools_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_operations.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_operations.js deleted file mode 100644 index 69eb1730393..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_operations.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() { - // [START container_v1_generated_ClusterManager_ListOperations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 operations will be listed. - * Specified in the format `projects/* /locations/*`. - * Location "-" matches all zones and all regions. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callListOperations() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.listOperations(request); - console.log(response); - } - - callListOperations(); - // [END container_v1_generated_ClusterManager_ListOperations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_usable_subnetworks.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_usable_subnetworks.js deleted file mode 100644 index a70af157bf3..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.list_usable_subnetworks.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 container_v1_generated_ClusterManager_ListUsableSubnetworks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 where subnetworks are usable. - * Specified in the format `projects/*`. - */ - // const parent = 'abc123' - /** - * Filtering currently only supports equality on the networkProjectId and must - * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` - * is the project which owns the listed subnetworks. This defaults to the - * parent project ID. - */ - // const filter = 'abc123' - /** - * The max number of results per page that should be returned. If the number - * of available results is larger than `page_size`, a `next_page_token` is - * returned which can be used to get the next page of results in subsequent - * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - */ - // const pageSize = 1234 - /** - * Specifies a page token to use. Set this to the nextPageToken returned by - * previous list requests to get the next page of results. - */ - // const pageToken = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callListUsableSubnetworks() { - // Construct request - const request = { - }; - - // Run request - const iterable = await containerClient.listUsableSubnetworksAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListUsableSubnetworks(); - // [END container_v1_generated_ClusterManager_ListUsableSubnetworks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.rollback_node_pool_upgrade.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.rollback_node_pool_upgrade.js deleted file mode 100644 index 3356c397660..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.rollback_node_pool_upgrade.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() { - // [START container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster, node pool id) of the node poll to - * rollback upgrade. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - /** - * Option for rollback to ignore the PodDisruptionBudget. - * Default value is false. - */ - // const respectPdb = true - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callRollbackNodePoolUpgrade() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.rollbackNodePoolUpgrade(request); - console.log(response); - } - - callRollbackNodePoolUpgrade(); - // [END container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_addons_config.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_addons_config.js deleted file mode 100644 index c6e24e63456..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_addons_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(addonsConfig) { - // [START container_v1_generated_ClusterManager_SetAddonsConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The desired configurations for the various addons available to - * run in the cluster. - */ - // const addonsConfig = {} - /** - * The name (project, location, cluster) of the cluster to set addons. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetAddonsConfig() { - // Construct request - const request = { - addonsConfig, - }; - - // Run request - const response = await containerClient.setAddonsConfig(request); - console.log(response); - } - - callSetAddonsConfig(); - // [END container_v1_generated_ClusterManager_SetAddonsConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_labels.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_labels.js deleted file mode 100644 index 3d77f05457f..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_labels.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(resourceLabels, labelFingerprint) { - // [START container_v1_generated_ClusterManager_SetLabels_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The labels to set for that cluster. - */ - // const resourceLabels = [1,2,3,4] - /** - * Required. The fingerprint of the previous set of labels for this resource, - * used to detect conflicts. The fingerprint is initially generated by - * Kubernetes Engine and changes after every request to modify or update - * labels. You must always provide an up-to-date fingerprint hash when - * updating or changing labels. Make a `get()` request to the - * resource to get the latest fingerprint. - */ - // const labelFingerprint = 'abc123' - /** - * The name (project, location, cluster name) of the cluster to set labels. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetLabels() { - // Construct request - const request = { - resourceLabels, - labelFingerprint, - }; - - // Run request - const response = await containerClient.setLabels(request); - console.log(response); - } - - callSetLabels(); - // [END container_v1_generated_ClusterManager_SetLabels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_legacy_abac.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_legacy_abac.js deleted file mode 100644 index 9c2a450c361..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_legacy_abac.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(enabled) { - // [START container_v1_generated_ClusterManager_SetLegacyAbac_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Whether ABAC authorization will be enabled in the cluster. - */ - // const enabled = true - /** - * The name (project, location, cluster name) of the cluster to set legacy - * abac. Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetLegacyAbac() { - // Construct request - const request = { - enabled, - }; - - // Run request - const response = await containerClient.setLegacyAbac(request); - console.log(response); - } - - callSetLegacyAbac(); - // [END container_v1_generated_ClusterManager_SetLegacyAbac_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_locations.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_locations.js deleted file mode 100644 index ee8b451d6e9..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_locations.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(locations) { - // [START container_v1_generated_ClusterManager_SetLocations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The desired list of Google Compute Engine - * zones (https://cloud.google.com/compute/docs/zones#available) in which the - * cluster's nodes should be located. Changing the locations a cluster is in - * will result in nodes being either created or removed from the cluster, - * depending on whether locations are being added or removed. - * This list must always include the cluster's primary zone. - */ - // const locations = ['abc','def'] - /** - * The name (project, location, cluster) of the cluster to set locations. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetLocations() { - // Construct request - const request = { - locations, - }; - - // Run request - const response = await containerClient.setLocations(request); - console.log(response); - } - - callSetLocations(); - // [END container_v1_generated_ClusterManager_SetLocations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_logging_service.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_logging_service.js deleted file mode 100644 index 3333d0219c5..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_logging_service.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(loggingService) { - // [START container_v1_generated_ClusterManager_SetLoggingService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The logging service the cluster should use to write logs. - * Currently available options: - * * `logging.googleapis.com/kubernetes` - The Cloud Logging - * service with a Kubernetes-native resource model - * * `logging.googleapis.com` - The legacy Cloud Logging service (no longer - * available as of GKE 1.15). - * * `none` - no logs will be exported from the cluster. - * If left as an empty string,`logging.googleapis.com/kubernetes` will be - * used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. - */ - // const loggingService = 'abc123' - /** - * The name (project, location, cluster) of the cluster to set logging. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetLoggingService() { - // Construct request - const request = { - loggingService, - }; - - // Run request - const response = await containerClient.setLoggingService(request); - console.log(response); - } - - callSetLoggingService(); - // [END container_v1_generated_ClusterManager_SetLoggingService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_maintenance_policy.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_maintenance_policy.js deleted file mode 100644 index 4e675414de2..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_maintenance_policy.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(projectId, zone, clusterId, maintenancePolicy) { - // [START container_v1_generated_ClusterManager_SetMaintenancePolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Developers Console project ID or project - * number (https://cloud.google.com/resource-manager/docs/creating-managing-projects). - */ - // const projectId = 'abc123' - /** - * Required. The name of the Google Compute Engine - * zone (https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. - */ - // const zone = 'abc123' - /** - * Required. The name of the cluster to update. - */ - // const clusterId = 'abc123' - /** - * Required. The maintenance policy to be set for the cluster. An empty field - * clears the existing maintenance policy. - */ - // const maintenancePolicy = {} - /** - * The name (project, location, cluster name) of the cluster to set - * maintenance policy. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetMaintenancePolicy() { - // Construct request - const request = { - projectId, - zone, - clusterId, - maintenancePolicy, - }; - - // Run request - const response = await containerClient.setMaintenancePolicy(request); - console.log(response); - } - - callSetMaintenancePolicy(); - // [END container_v1_generated_ClusterManager_SetMaintenancePolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_master_auth.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_master_auth.js deleted file mode 100644 index 4376ebb1adc..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_master_auth.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(action, update) { - // [START container_v1_generated_ClusterManager_SetMasterAuth_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The exact form of action to be taken on the master auth. - */ - // const action = {} - /** - * Required. A description of the update. - */ - // const update = {} - /** - * The name (project, location, cluster) of the cluster to set auth. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetMasterAuth() { - // Construct request - const request = { - action, - update, - }; - - // Run request - const response = await containerClient.setMasterAuth(request); - console.log(response); - } - - callSetMasterAuth(); - // [END container_v1_generated_ClusterManager_SetMasterAuth_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_monitoring_service.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_monitoring_service.js deleted file mode 100644 index 5767da6da8f..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_monitoring_service.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(monitoringService) { - // [START container_v1_generated_ClusterManager_SetMonitoringService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The monitoring service the cluster should use to write metrics. - * Currently available options: - * * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring - * service with a Kubernetes-native resource model - * * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no - * longer available as of GKE 1.15). - * * `none` - No metrics will be exported from the cluster. - * If left as an empty string,`monitoring.googleapis.com/kubernetes` will be - * used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. - */ - // const monitoringService = 'abc123' - /** - * The name (project, location, cluster) of the cluster to set monitoring. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetMonitoringService() { - // Construct request - const request = { - monitoringService, - }; - - // Run request - const response = await containerClient.setMonitoringService(request); - console.log(response); - } - - callSetMonitoringService(); - // [END container_v1_generated_ClusterManager_SetMonitoringService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_network_policy.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_network_policy.js deleted file mode 100644 index 70e4a954cd3..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_network_policy.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(networkPolicy) { - // [START container_v1_generated_ClusterManager_SetNetworkPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Configuration options for the NetworkPolicy feature. - */ - // const networkPolicy = {} - /** - * The name (project, location, cluster name) of the cluster to set networking - * policy. Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetNetworkPolicy() { - // Construct request - const request = { - networkPolicy, - }; - - // Run request - const response = await containerClient.setNetworkPolicy(request); - console.log(response); - } - - callSetNetworkPolicy(); - // [END container_v1_generated_ClusterManager_SetNetworkPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_autoscaling.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_autoscaling.js deleted file mode 100644 index fde99e8483c..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_autoscaling.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(autoscaling) { - // [START container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Autoscaling configuration for the node pool. - */ - // const autoscaling = {} - /** - * The name (project, location, cluster, node pool) of the node pool to set - * autoscaler settings. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetNodePoolAutoscaling() { - // Construct request - const request = { - autoscaling, - }; - - // Run request - const response = await containerClient.setNodePoolAutoscaling(request); - console.log(response); - } - - callSetNodePoolAutoscaling(); - // [END container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_management.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_management.js deleted file mode 100644 index e1ea4030588..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_management.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(management) { - // [START container_v1_generated_ClusterManager_SetNodePoolManagement_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. NodeManagement configuration for the node pool. - */ - // const management = {} - /** - * The name (project, location, cluster, node pool id) of the node pool to set - * management properties. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetNodePoolManagement() { - // Construct request - const request = { - management, - }; - - // Run request - const response = await containerClient.setNodePoolManagement(request); - console.log(response); - } - - callSetNodePoolManagement(); - // [END container_v1_generated_ClusterManager_SetNodePoolManagement_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_size.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_size.js deleted file mode 100644 index aedfdd9f71b..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.set_node_pool_size.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(nodeCount) { - // [START container_v1_generated_ClusterManager_SetNodePoolSize_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The desired node count for the pool. - */ - // const nodeCount = 1234 - /** - * The name (project, location, cluster, node pool id) of the node pool to set - * size. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetNodePoolSize() { - // Construct request - const request = { - nodeCount, - }; - - // Run request - const response = await containerClient.setNodePoolSize(request); - console.log(response); - } - - callSetNodePoolSize(); - // [END container_v1_generated_ClusterManager_SetNodePoolSize_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.start_i_p_rotation.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.start_i_p_rotation.js deleted file mode 100644 index a8f65196353..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.start_i_p_rotation.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() { - // [START container_v1_generated_ClusterManager_StartIPRotation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster name) of the cluster to start IP - * rotation. Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - /** - * Whether to rotate credentials during IP rotation. - */ - // const rotateCredentials = true - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callStartIPRotation() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.startIPRotation(request); - console.log(response); - } - - callStartIPRotation(); - // [END container_v1_generated_ClusterManager_StartIPRotation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_cluster.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_cluster.js deleted file mode 100644 index b0280b7fea6..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_cluster.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(update) { - // [START container_v1_generated_ClusterManager_UpdateCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 description of the update. - */ - // const update = {} - /** - * The name (project, location, cluster) of the cluster to update. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callUpdateCluster() { - // Construct request - const request = { - update, - }; - - // Run request - const response = await containerClient.updateCluster(request); - console.log(response); - } - - callUpdateCluster(); - // [END container_v1_generated_ClusterManager_UpdateCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_master.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_master.js deleted file mode 100644 index 37f555312f8..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_master.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(masterVersion) { - // [START container_v1_generated_ClusterManager_UpdateMaster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Kubernetes version to change the master to. - * Users may specify either explicit versions offered by Kubernetes Engine or - * version aliases, which have the following behavior: - * - "latest": picks the highest valid Kubernetes version - * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - * - "1.X.Y-gke.N": picks an explicit Kubernetes version - * - "-": picks the default Kubernetes version - */ - // const masterVersion = 'abc123' - /** - * The name (project, location, cluster) of the cluster to update. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callUpdateMaster() { - // Construct request - const request = { - masterVersion, - }; - - // Run request - const response = await containerClient.updateMaster(request); - console.log(response); - } - - callUpdateMaster(); - // [END container_v1_generated_ClusterManager_UpdateMaster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_node_pool.js b/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_node_pool.js deleted file mode 100644 index 4620b7c49e5..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/cluster_manager.update_node_pool.js +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(nodeVersion, imageType) { - // [START container_v1_generated_ClusterManager_UpdateNodePool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Kubernetes version to change the nodes to (typically an - * upgrade). - * Users may specify either explicit versions offered by Kubernetes Engine or - * version aliases, which have the following behavior: - * - "latest": picks the highest valid Kubernetes version - * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - * - "1.X.Y-gke.N": picks an explicit Kubernetes version - * - "-": picks the Kubernetes master version - */ - // const nodeVersion = 'abc123' - /** - * Required. The desired image type for the node pool. Please see - * https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for - * available image types. - */ - // const imageType = 'abc123' - /** - * The name (project, location, cluster, node pool) of the node pool to - * update. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - /** - * The desired list of Google Compute Engine - * zones (https://cloud.google.com/compute/docs/zones#available) in which the - * node pool's nodes should be located. Changing the locations for a node pool - * will result in nodes being either created or removed from the node pool, - * depending on whether locations are being added or removed. - */ - // const locations = ['abc','def'] - /** - * The desired workload metadata config for the node pool. - */ - // const workloadMetadataConfig = {} - /** - * Upgrade settings control disruption and speed of the upgrade. - */ - // const upgradeSettings = {} - /** - * The desired network tags to be applied to all nodes in the node pool. - * If this field is not present, the tags will not be changed. Otherwise, - * the existing network tags will be *replaced* with the provided tags. - */ - // const tags = {} - /** - * The desired node taints to be applied to all nodes in the node pool. - * If this field is not present, the taints will not be changed. Otherwise, - * the existing node taints will be *replaced* with the provided taints. - */ - // const taints = {} - /** - * The desired node labels to be applied to all nodes in the node pool. - * If this field is not present, the labels will not be changed. Otherwise, - * the existing node labels will be *replaced* with the provided labels. - */ - // const labels = {} - /** - * Parameters that can be configured on Linux nodes. - */ - // const linuxNodeConfig = {} - /** - * Node kubelet configs. - */ - // const kubeletConfig = {} - /** - * Node network config. - */ - // const nodeNetworkConfig = {} - /** - * GCFS config. - */ - // const gcfsConfig = {} - /** - * Confidential nodes config. - * All the nodes in the node pool will be Confidential VM once enabled. - */ - // const confidentialNodes = {} - /** - * Enable or disable gvnic on the node pool. - */ - // const gvnic = {} - /** - * The current etag of the node pool. - * If an etag is provided and does not match the current etag of the node - * pool, update will be blocked and an ABORTED error will be returned. - */ - // const etag = 'abc123' - /** - * Enable or disable NCCL fast socket for the node pool. - */ - // const fastSocket = {} - /** - * Logging configuration. - */ - // const loggingConfig = {} - /** - * The resource labels for the node pool to use to annotate any related - * Google Compute Engine resources. - */ - // const resourceLabels = {} - /** - * Parameters that can be configured on Windows nodes. - */ - // const windowsNodeConfig = {} - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callUpdateNodePool() { - // Construct request - const request = { - nodeVersion, - imageType, - }; - - // Run request - const response = await containerClient.updateNodePool(request); - console.log(response); - } - - callUpdateNodePool(); - // [END container_v1_generated_ClusterManager_UpdateNodePool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1/samples/generated/v1/snippet_metadata_google.container.v1.json b/owl-bot-staging/google-container/v1/samples/generated/v1/snippet_metadata_google.container.v1.json deleted file mode 100644 index 66a864e5ad7..00000000000 --- a/owl-bot-staging/google-container/v1/samples/generated/v1/snippet_metadata_google.container.v1.json +++ /dev/null @@ -1,1915 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-container", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.container.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "container_v1_generated_ClusterManager_ListClusters_async", - "title": "ClusterManager listClusters Sample", - "origin": "API_DEFINITION", - "description": " Lists all clusters owned by a project in either the specified zone or all zones.", - "canonical": true, - "file": "cluster_manager.list_clusters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListClusters", - "fullName": "google.container.v1.ClusterManager.ListClusters", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.ListClustersResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "ListClusters", - "fullName": "google.container.v1.ClusterManager.ListClusters", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_GetCluster_async", - "title": "ClusterManager getCluster Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a specific cluster.", - "canonical": true, - "file": "cluster_manager.get_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCluster", - "fullName": "google.container.v1.ClusterManager.GetCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Cluster", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "GetCluster", - "fullName": "google.container.v1.ClusterManager.GetCluster", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_CreateCluster_async", - "title": "ClusterManager createCluster Sample", - "origin": "API_DEFINITION", - "description": " Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's [default network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.", - "canonical": true, - "file": "cluster_manager.create_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCluster", - "fullName": "google.container.v1.ClusterManager.CreateCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster", - "type": ".google.container.v1.Cluster" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "CreateCluster", - "fullName": "google.container.v1.ClusterManager.CreateCluster", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_UpdateCluster_async", - "title": "ClusterManager updateCluster Sample", - "origin": "API_DEFINITION", - "description": " Updates the settings of a specific cluster.", - "canonical": true, - "file": "cluster_manager.update_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCluster", - "fullName": "google.container.v1.ClusterManager.UpdateCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "update", - "type": ".google.container.v1.ClusterUpdate" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "UpdateCluster", - "fullName": "google.container.v1.ClusterManager.UpdateCluster", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_UpdateNodePool_async", - "title": "ClusterManager updateNodePool Sample", - "origin": "API_DEFINITION", - "description": " Updates the version and/or image type for the specified node pool.", - "canonical": true, - "file": "cluster_manager.update_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 156, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNodePool", - "fullName": "google.container.v1.ClusterManager.UpdateNodePool", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "node_version", - "type": "TYPE_STRING" - }, - { - "name": "image_type", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "locations", - "type": "TYPE_STRING[]" - }, - { - "name": "workload_metadata_config", - "type": ".google.container.v1.WorkloadMetadataConfig" - }, - { - "name": "upgrade_settings", - "type": ".google.container.v1.NodePool.UpgradeSettings" - }, - { - "name": "tags", - "type": ".google.container.v1.NetworkTags" - }, - { - "name": "taints", - "type": ".google.container.v1.NodeTaints" - }, - { - "name": "labels", - "type": ".google.container.v1.NodeLabels" - }, - { - "name": "linux_node_config", - "type": ".google.container.v1.LinuxNodeConfig" - }, - { - "name": "kubelet_config", - "type": ".google.container.v1.NodeKubeletConfig" - }, - { - "name": "node_network_config", - "type": ".google.container.v1.NodeNetworkConfig" - }, - { - "name": "gcfs_config", - "type": ".google.container.v1.GcfsConfig" - }, - { - "name": "confidential_nodes", - "type": ".google.container.v1.ConfidentialNodes" - }, - { - "name": "gvnic", - "type": ".google.container.v1.VirtualNIC" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "fast_socket", - "type": ".google.container.v1.FastSocket" - }, - { - "name": "logging_config", - "type": ".google.container.v1.NodePoolLoggingConfig" - }, - { - "name": "resource_labels", - "type": ".google.container.v1.ResourceLabels" - }, - { - "name": "windows_node_config", - "type": ".google.container.v1.WindowsNodeConfig" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "UpdateNodePool", - "fullName": "google.container.v1.ClusterManager.UpdateNodePool", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async", - "title": "ClusterManager setNodePoolAutoscaling Sample", - "origin": "API_DEFINITION", - "description": " Sets the autoscaling settings for the specified node pool.", - "canonical": true, - "file": "cluster_manager.set_node_pool_autoscaling.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetNodePoolAutoscaling", - "fullName": "google.container.v1.ClusterManager.SetNodePoolAutoscaling", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "autoscaling", - "type": ".google.container.v1.NodePoolAutoscaling" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetNodePoolAutoscaling", - "fullName": "google.container.v1.ClusterManager.SetNodePoolAutoscaling", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetLoggingService_async", - "title": "ClusterManager setLoggingService Sample", - "origin": "API_DEFINITION", - "description": " Sets the logging service for a specific cluster.", - "canonical": true, - "file": "cluster_manager.set_logging_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetLoggingService", - "fullName": "google.container.v1.ClusterManager.SetLoggingService", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "logging_service", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetLoggingService", - "fullName": "google.container.v1.ClusterManager.SetLoggingService", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetMonitoringService_async", - "title": "ClusterManager setMonitoringService Sample", - "origin": "API_DEFINITION", - "description": " Sets the monitoring service for a specific cluster.", - "canonical": true, - "file": "cluster_manager.set_monitoring_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetMonitoringService", - "fullName": "google.container.v1.ClusterManager.SetMonitoringService", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "monitoring_service", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetMonitoringService", - "fullName": "google.container.v1.ClusterManager.SetMonitoringService", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetAddonsConfig_async", - "title": "ClusterManager setAddonsConfig Sample", - "origin": "API_DEFINITION", - "description": " Sets the addons for a specific cluster.", - "canonical": true, - "file": "cluster_manager.set_addons_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetAddonsConfig", - "fullName": "google.container.v1.ClusterManager.SetAddonsConfig", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "addons_config", - "type": ".google.container.v1.AddonsConfig" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetAddonsConfig", - "fullName": "google.container.v1.ClusterManager.SetAddonsConfig", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetLocations_async", - "title": "ClusterManager setLocations Sample", - "origin": "API_DEFINITION", - "description": " Sets the locations for a specific cluster. Deprecated. Use [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/update) instead.", - "canonical": true, - "file": "cluster_manager.set_locations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetLocations", - "fullName": "google.container.v1.ClusterManager.SetLocations", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "locations", - "type": "TYPE_STRING[]" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetLocations", - "fullName": "google.container.v1.ClusterManager.SetLocations", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_UpdateMaster_async", - "title": "ClusterManager updateMaster Sample", - "origin": "API_DEFINITION", - "description": " Updates the master for a specific cluster.", - "canonical": true, - "file": "cluster_manager.update_master.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMaster", - "fullName": "google.container.v1.ClusterManager.UpdateMaster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "master_version", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "UpdateMaster", - "fullName": "google.container.v1.ClusterManager.UpdateMaster", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetMasterAuth_async", - "title": "ClusterManager setMasterAuth Sample", - "origin": "API_DEFINITION", - "description": " Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.", - "canonical": true, - "file": "cluster_manager.set_master_auth.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetMasterAuth", - "fullName": "google.container.v1.ClusterManager.SetMasterAuth", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "action", - "type": ".google.container.v1.SetMasterAuthRequest.Action" - }, - { - "name": "update", - "type": ".google.container.v1.MasterAuth" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetMasterAuth", - "fullName": "google.container.v1.ClusterManager.SetMasterAuth", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_DeleteCluster_async", - "title": "ClusterManager deleteCluster Sample", - "origin": "API_DEFINITION", - "description": " Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.", - "canonical": true, - "file": "cluster_manager.delete_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteCluster", - "fullName": "google.container.v1.ClusterManager.DeleteCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "DeleteCluster", - "fullName": "google.container.v1.ClusterManager.DeleteCluster", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_ListOperations_async", - "title": "ClusterManager listOperations Sample", - "origin": "API_DEFINITION", - "description": " Lists all operations in a project in a specific zone or all zones.", - "canonical": true, - "file": "cluster_manager.list_operations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListOperations", - "fullName": "google.container.v1.ClusterManager.ListOperations", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.ListOperationsResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "ListOperations", - "fullName": "google.container.v1.ClusterManager.ListOperations", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_GetOperation_async", - "title": "ClusterManager getOperation Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified operation.", - "canonical": true, - "file": "cluster_manager.get_operation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOperation", - "fullName": "google.container.v1.ClusterManager.GetOperation", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "operation_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "GetOperation", - "fullName": "google.container.v1.ClusterManager.GetOperation", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_CancelOperation_async", - "title": "ClusterManager cancelOperation Sample", - "origin": "API_DEFINITION", - "description": " Cancels the specified operation.", - "canonical": true, - "file": "cluster_manager.cancel_operation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelOperation", - "fullName": "google.container.v1.ClusterManager.CancelOperation", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "operation_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "CancelOperation", - "fullName": "google.container.v1.ClusterManager.CancelOperation", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_GetServerConfig_async", - "title": "ClusterManager getServerConfig Sample", - "origin": "API_DEFINITION", - "description": " Returns configuration info about the Google Kubernetes Engine service.", - "canonical": true, - "file": "cluster_manager.get_server_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetServerConfig", - "fullName": "google.container.v1.ClusterManager.GetServerConfig", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.ServerConfig", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "GetServerConfig", - "fullName": "google.container.v1.ClusterManager.GetServerConfig", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_GetJSONWebKeys_async", - "title": "ClusterManager getJSONWebKeys Sample", - "origin": "API_DEFINITION", - "description": " Gets the public component of the cluster signing keys in JSON Web Key format. This API is not yet intended for general use, and is not available for all clusters.", - "canonical": true, - "file": "cluster_manager.get_j_s_o_n_web_keys.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJSONWebKeys", - "fullName": "google.container.v1.ClusterManager.GetJSONWebKeys", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.GetJSONWebKeysResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "GetJSONWebKeys", - "fullName": "google.container.v1.ClusterManager.GetJSONWebKeys", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_ListNodePools_async", - "title": "ClusterManager listNodePools Sample", - "origin": "API_DEFINITION", - "description": " Lists the node pools for a cluster.", - "canonical": true, - "file": "cluster_manager.list_node_pools.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNodePools", - "fullName": "google.container.v1.ClusterManager.ListNodePools", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.ListNodePoolsResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "ListNodePools", - "fullName": "google.container.v1.ClusterManager.ListNodePools", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_GetNodePool_async", - "title": "ClusterManager getNodePool Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the requested node pool.", - "canonical": true, - "file": "cluster_manager.get_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNodePool", - "fullName": "google.container.v1.ClusterManager.GetNodePool", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.NodePool", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "GetNodePool", - "fullName": "google.container.v1.ClusterManager.GetNodePool", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_CreateNodePool_async", - "title": "ClusterManager createNodePool Sample", - "origin": "API_DEFINITION", - "description": " Creates a node pool for a cluster.", - "canonical": true, - "file": "cluster_manager.create_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNodePool", - "fullName": "google.container.v1.ClusterManager.CreateNodePool", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool", - "type": ".google.container.v1.NodePool" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "CreateNodePool", - "fullName": "google.container.v1.ClusterManager.CreateNodePool", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_DeleteNodePool_async", - "title": "ClusterManager deleteNodePool Sample", - "origin": "API_DEFINITION", - "description": " Deletes a node pool from a cluster.", - "canonical": true, - "file": "cluster_manager.delete_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNodePool", - "fullName": "google.container.v1.ClusterManager.DeleteNodePool", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "DeleteNodePool", - "fullName": "google.container.v1.ClusterManager.DeleteNodePool", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async", - "title": "ClusterManager completeNodePoolUpgrade Sample", - "origin": "API_DEFINITION", - "description": " CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.", - "canonical": true, - "file": "cluster_manager.complete_node_pool_upgrade.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompleteNodePoolUpgrade", - "fullName": "google.container.v1.ClusterManager.CompleteNodePoolUpgrade", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "CompleteNodePoolUpgrade", - "fullName": "google.container.v1.ClusterManager.CompleteNodePoolUpgrade", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async", - "title": "ClusterManager rollbackNodePoolUpgrade Sample", - "origin": "API_DEFINITION", - "description": " Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.", - "canonical": true, - "file": "cluster_manager.rollback_node_pool_upgrade.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RollbackNodePoolUpgrade", - "fullName": "google.container.v1.ClusterManager.RollbackNodePoolUpgrade", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "respect_pdb", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "RollbackNodePoolUpgrade", - "fullName": "google.container.v1.ClusterManager.RollbackNodePoolUpgrade", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetNodePoolManagement_async", - "title": "ClusterManager setNodePoolManagement Sample", - "origin": "API_DEFINITION", - "description": " Sets the NodeManagement options for a node pool.", - "canonical": true, - "file": "cluster_manager.set_node_pool_management.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetNodePoolManagement", - "fullName": "google.container.v1.ClusterManager.SetNodePoolManagement", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "management", - "type": ".google.container.v1.NodeManagement" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetNodePoolManagement", - "fullName": "google.container.v1.ClusterManager.SetNodePoolManagement", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetLabels_async", - "title": "ClusterManager setLabels Sample", - "origin": "API_DEFINITION", - "description": " Sets labels on a cluster.", - "canonical": true, - "file": "cluster_manager.set_labels.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetLabels", - "fullName": "google.container.v1.ClusterManager.SetLabels", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "resource_labels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "label_fingerprint", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetLabels", - "fullName": "google.container.v1.ClusterManager.SetLabels", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetLegacyAbac_async", - "title": "ClusterManager setLegacyAbac Sample", - "origin": "API_DEFINITION", - "description": " Enables or disables the ABAC authorization mechanism on a cluster.", - "canonical": true, - "file": "cluster_manager.set_legacy_abac.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetLegacyAbac", - "fullName": "google.container.v1.ClusterManager.SetLegacyAbac", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "enabled", - "type": "TYPE_BOOL" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetLegacyAbac", - "fullName": "google.container.v1.ClusterManager.SetLegacyAbac", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_StartIPRotation_async", - "title": "ClusterManager startIPRotation Sample", - "origin": "API_DEFINITION", - "description": " Starts master IP rotation.", - "canonical": true, - "file": "cluster_manager.start_i_p_rotation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartIPRotation", - "fullName": "google.container.v1.ClusterManager.StartIPRotation", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "rotate_credentials", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "StartIPRotation", - "fullName": "google.container.v1.ClusterManager.StartIPRotation", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_CompleteIPRotation_async", - "title": "ClusterManager completeIPRotation Sample", - "origin": "API_DEFINITION", - "description": " Completes master IP rotation.", - "canonical": true, - "file": "cluster_manager.complete_i_p_rotation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompleteIPRotation", - "fullName": "google.container.v1.ClusterManager.CompleteIPRotation", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "CompleteIPRotation", - "fullName": "google.container.v1.ClusterManager.CompleteIPRotation", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetNodePoolSize_async", - "title": "ClusterManager setNodePoolSize Sample", - "origin": "API_DEFINITION", - "description": " Sets the size for a specific node pool. The new size will be used for all replicas, including future replicas created by modifying [NodePool.locations][google.container.v1.NodePool.locations].", - "canonical": true, - "file": "cluster_manager.set_node_pool_size.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetNodePoolSize", - "fullName": "google.container.v1.ClusterManager.SetNodePoolSize", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "node_count", - "type": "TYPE_INT32" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetNodePoolSize", - "fullName": "google.container.v1.ClusterManager.SetNodePoolSize", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetNetworkPolicy_async", - "title": "ClusterManager setNetworkPolicy Sample", - "origin": "API_DEFINITION", - "description": " Enables or disables Network Policy for a cluster.", - "canonical": true, - "file": "cluster_manager.set_network_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetNetworkPolicy", - "fullName": "google.container.v1.ClusterManager.SetNetworkPolicy", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "network_policy", - "type": ".google.container.v1.NetworkPolicy" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetNetworkPolicy", - "fullName": "google.container.v1.ClusterManager.SetNetworkPolicy", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_SetMaintenancePolicy_async", - "title": "ClusterManager setMaintenancePolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the maintenance policy for a cluster.", - "canonical": true, - "file": "cluster_manager.set_maintenance_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetMaintenancePolicy", - "fullName": "google.container.v1.ClusterManager.SetMaintenancePolicy", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "maintenance_policy", - "type": ".google.container.v1.MaintenancePolicy" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "SetMaintenancePolicy", - "fullName": "google.container.v1.ClusterManager.SetMaintenancePolicy", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_ListUsableSubnetworks_async", - "title": "ClusterManager listUsableSubnetworks Sample", - "origin": "API_DEFINITION", - "description": " Lists subnetworks that are usable for creating clusters in a project.", - "canonical": true, - "file": "cluster_manager.list_usable_subnetworks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListUsableSubnetworks", - "fullName": "google.container.v1.ClusterManager.ListUsableSubnetworks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.ListUsableSubnetworksResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "ListUsableSubnetworks", - "fullName": "google.container.v1.ClusterManager.ListUsableSubnetworks", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async", - "title": "ClusterManager checkAutopilotCompatibility Sample", - "origin": "API_DEFINITION", - "description": " Checks the cluster compatibility with Autopilot mode, and returns a list of compatibility issues.", - "canonical": true, - "file": "cluster_manager.check_autopilot_compatibility.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CheckAutopilotCompatibility", - "fullName": "google.container.v1.ClusterManager.CheckAutopilotCompatibility", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1.CheckAutopilotCompatibilityResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1.ClusterManagerClient" - }, - "method": { - "shortName": "CheckAutopilotCompatibility", - "fullName": "google.container.v1.ClusterManager.CheckAutopilotCompatibility", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1.ClusterManager" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-container/v1/src/index.ts b/owl-bot-staging/google-container/v1/src/index.ts deleted file mode 100644 index 7f3539e2b2d..00000000000 --- a/owl-bot-staging/google-container/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 ClusterManagerClient = v1.ClusterManagerClient; -type ClusterManagerClient = v1.ClusterManagerClient; -export {v1, ClusterManagerClient}; -export default {v1, ClusterManagerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client.ts b/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client.ts deleted file mode 100644 index 46d1a94e37f..00000000000 --- a/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client.ts +++ /dev/null @@ -1,3514 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/cluster_manager_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cluster_manager_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Google Kubernetes Engine Cluster Manager v1 - * @class - * @memberof v1 - */ -export class ClusterManagerClient { - 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}; - clusterManagerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ClusterManagerClient. - * - * @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 ClusterManagerClient({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 ClusterManagerClient; - 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 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 = { - listUsableSubnetworks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'subnetworks') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.container.v1.ClusterManager', 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.clusterManagerStub) { - return this.clusterManagerStub; - } - - // Put together the "service stub" for - // google.container.v1.ClusterManager. - this.clusterManagerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.container.v1.ClusterManager') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.container.v1.ClusterManager, - 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 clusterManagerStubMethods = - ['listClusters', 'getCluster', 'createCluster', 'updateCluster', 'updateNodePool', 'setNodePoolAutoscaling', 'setLoggingService', 'setMonitoringService', 'setAddonsConfig', 'setLocations', 'updateMaster', 'setMasterAuth', 'deleteCluster', 'listOperations', 'getOperation', 'cancelOperation', 'getServerConfig', 'getJsonWebKeys', 'listNodePools', 'getNodePool', 'createNodePool', 'deleteNodePool', 'completeNodePoolUpgrade', 'rollbackNodePoolUpgrade', 'setNodePoolManagement', 'setLabels', 'setLegacyAbac', 'startIpRotation', 'completeIpRotation', 'setNodePoolSize', 'setNetworkPolicy', 'setMaintenancePolicy', 'listUsableSubnetworks', 'checkAutopilotCompatibility']; - for (const methodName of clusterManagerStubMethods) { - const callPromise = this.clusterManagerStub.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.clusterManagerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'container.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 'container.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 all clusters owned by a project in either the specified zone or all - * zones. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the parent field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides, or "-" for all zones. This field has been deprecated and - * replaced by the parent field. - * @param {string} request.parent - * The parent (project and location) where the clusters will be listed. - * Specified in the format `projects/* /locations/*`. - * Location "-" matches all zones and all regions. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.ListClustersResponse|ListClustersResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.list_clusters.js - * region_tag:container_v1_generated_ClusterManager_ListClusters_async - */ - listClusters( - request?: protos.google.container.v1.IListClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IListClustersResponse, - protos.google.container.v1.IListClustersRequest|undefined, {}|undefined - ]>; - listClusters( - request: protos.google.container.v1.IListClustersRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IListClustersResponse, - protos.google.container.v1.IListClustersRequest|null|undefined, - {}|null|undefined>): void; - listClusters( - request: protos.google.container.v1.IListClustersRequest, - callback: Callback< - protos.google.container.v1.IListClustersResponse, - protos.google.container.v1.IListClustersRequest|null|undefined, - {}|null|undefined>): void; - listClusters( - request?: protos.google.container.v1.IListClustersRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IListClustersResponse, - protos.google.container.v1.IListClustersRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IListClustersResponse, - protos.google.container.v1.IListClustersRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IListClustersResponse, - protos.google.container.v1.IListClustersRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - }); - this.initialize(); - return this.innerApiCalls.listClusters(request, options, callback); - } -/** - * Gets the details of a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to retrieve. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to retrieve. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Cluster|Cluster}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.get_cluster.js - * region_tag:container_v1_generated_ClusterManager_GetCluster_async - */ - getCluster( - request?: protos.google.container.v1.IGetClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.ICluster, - protos.google.container.v1.IGetClusterRequest|undefined, {}|undefined - ]>; - getCluster( - request: protos.google.container.v1.IGetClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.ICluster, - protos.google.container.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; - getCluster( - request: protos.google.container.v1.IGetClusterRequest, - callback: Callback< - protos.google.container.v1.ICluster, - protos.google.container.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; - getCluster( - request?: protos.google.container.v1.IGetClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.ICluster, - protos.google.container.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.ICluster, - protos.google.container.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.ICluster, - protos.google.container.v1.IGetClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getCluster(request, options, callback); - } -/** - * Creates a cluster, consisting of the specified number and type of Google - * Compute Engine instances. - * - * By default, the cluster is created in the project's - * [default - * network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). - * - * One firewall is added for the cluster. After cluster creation, - * the Kubelet creates routes for each node to allow the containers - * on that node to communicate with all other instances in the - * cluster. - * - * Finally, an entry is added to the project's global metadata indicating - * which CIDR range the cluster is using. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the parent field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the parent - * field. - * @param {google.container.v1.Cluster} request.cluster - * Required. A [cluster - * resource](https://cloud.google.com/container-engine/reference/rest/v1/projects.locations.clusters) - * @param {string} request.parent - * The parent (project and location) where the cluster will be created. - * Specified in the format `projects/* /locations/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.create_cluster.js - * region_tag:container_v1_generated_ClusterManager_CreateCluster_async - */ - createCluster( - request?: protos.google.container.v1.ICreateClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateClusterRequest|undefined, {}|undefined - ]>; - createCluster( - request: protos.google.container.v1.ICreateClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateClusterRequest|null|undefined, - {}|null|undefined>): void; - createCluster( - request: protos.google.container.v1.ICreateClusterRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateClusterRequest|null|undefined, - {}|null|undefined>): void; - createCluster( - request?: protos.google.container.v1.ICreateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - }); - this.initialize(); - return this.innerApiCalls.createCluster(request, options, callback); - } -/** - * Updates the settings of a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1.ClusterUpdate} request.update - * Required. A description of the update. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to update. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.update_cluster.js - * region_tag:container_v1_generated_ClusterManager_UpdateCluster_async - */ - updateCluster( - request?: protos.google.container.v1.IUpdateClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateClusterRequest|undefined, {}|undefined - ]>; - updateCluster( - request: protos.google.container.v1.IUpdateClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateClusterRequest|null|undefined, - {}|null|undefined>): void; - updateCluster( - request: protos.google.container.v1.IUpdateClusterRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateClusterRequest|null|undefined, - {}|null|undefined>): void; - updateCluster( - request?: protos.google.container.v1.IUpdateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateCluster(request, options, callback); - } -/** - * Updates the version and/or image type for the specified node pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Deprecated. The name of the node pool to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodeVersion - * Required. The Kubernetes version to change the nodes to (typically an - * upgrade). - * - * Users may specify either explicit versions offered by Kubernetes Engine or - * version aliases, which have the following behavior: - * - * - "latest": picks the highest valid Kubernetes version - * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - * - "1.X.Y-gke.N": picks an explicit Kubernetes version - * - "-": picks the Kubernetes master version - * @param {string} request.imageType - * Required. The desired image type for the node pool. Please see - * https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for - * available image types. - * @param {string} request.name - * The name (project, location, cluster, node pool) of the node pool to - * update. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {string[]} request.locations - * The desired list of Google Compute Engine - * [zones](https://cloud.google.com/compute/docs/zones#available) in which the - * node pool's nodes should be located. Changing the locations for a node pool - * will result in nodes being either created or removed from the node pool, - * depending on whether locations are being added or removed. - * @param {google.container.v1.WorkloadMetadataConfig} request.workloadMetadataConfig - * The desired workload metadata config for the node pool. - * @param {google.container.v1.NodePool.UpgradeSettings} request.upgradeSettings - * Upgrade settings control disruption and speed of the upgrade. - * @param {google.container.v1.NetworkTags} request.tags - * The desired network tags to be applied to all nodes in the node pool. - * If this field is not present, the tags will not be changed. Otherwise, - * the existing network tags will be *replaced* with the provided tags. - * @param {google.container.v1.NodeTaints} request.taints - * The desired node taints to be applied to all nodes in the node pool. - * If this field is not present, the taints will not be changed. Otherwise, - * the existing node taints will be *replaced* with the provided taints. - * @param {google.container.v1.NodeLabels} request.labels - * The desired node labels to be applied to all nodes in the node pool. - * If this field is not present, the labels will not be changed. Otherwise, - * the existing node labels will be *replaced* with the provided labels. - * @param {google.container.v1.LinuxNodeConfig} request.linuxNodeConfig - * Parameters that can be configured on Linux nodes. - * @param {google.container.v1.NodeKubeletConfig} request.kubeletConfig - * Node kubelet configs. - * @param {google.container.v1.NodeNetworkConfig} request.nodeNetworkConfig - * Node network config. - * @param {google.container.v1.GcfsConfig} request.gcfsConfig - * GCFS config. - * @param {google.container.v1.ConfidentialNodes} request.confidentialNodes - * Confidential nodes config. - * All the nodes in the node pool will be Confidential VM once enabled. - * @param {google.container.v1.VirtualNIC} request.gvnic - * Enable or disable gvnic on the node pool. - * @param {string} request.etag - * The current etag of the node pool. - * If an etag is provided and does not match the current etag of the node - * pool, update will be blocked and an ABORTED error will be returned. - * @param {google.container.v1.FastSocket} request.fastSocket - * Enable or disable NCCL fast socket for the node pool. - * @param {google.container.v1.NodePoolLoggingConfig} request.loggingConfig - * Logging configuration. - * @param {google.container.v1.ResourceLabels} request.resourceLabels - * The resource labels for the node pool to use to annotate any related - * Google Compute Engine resources. - * @param {google.container.v1.WindowsNodeConfig} request.windowsNodeConfig - * Parameters that can be configured on Windows nodes. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.update_node_pool.js - * region_tag:container_v1_generated_ClusterManager_UpdateNodePool_async - */ - updateNodePool( - request?: protos.google.container.v1.IUpdateNodePoolRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateNodePoolRequest|undefined, {}|undefined - ]>; - updateNodePool( - request: protos.google.container.v1.IUpdateNodePoolRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateNodePoolRequest|null|undefined, - {}|null|undefined>): void; - updateNodePool( - request: protos.google.container.v1.IUpdateNodePoolRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateNodePoolRequest|null|undefined, - {}|null|undefined>): void; - updateNodePool( - request?: protos.google.container.v1.IUpdateNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateNodePoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateNodePoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateNodePoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateNodePool(request, options, callback); - } -/** - * Sets the autoscaling settings for the specified node pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Deprecated. The name of the node pool to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1.NodePoolAutoscaling} request.autoscaling - * Required. Autoscaling configuration for the node pool. - * @param {string} request.name - * The name (project, location, cluster, node pool) of the node pool to set - * autoscaler settings. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_node_pool_autoscaling.js - * region_tag:container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async - */ - setNodePoolAutoscaling( - request?: protos.google.container.v1.ISetNodePoolAutoscalingRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolAutoscalingRequest|undefined, {}|undefined - ]>; - setNodePoolAutoscaling( - request: protos.google.container.v1.ISetNodePoolAutoscalingRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolAutoscalingRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolAutoscaling( - request: protos.google.container.v1.ISetNodePoolAutoscalingRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolAutoscalingRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolAutoscaling( - request?: protos.google.container.v1.ISetNodePoolAutoscalingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolAutoscalingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolAutoscalingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolAutoscalingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setNodePoolAutoscaling(request, options, callback); - } -/** - * Sets the logging service for a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.loggingService - * Required. The logging service the cluster should use to write logs. - * Currently available options: - * - * * `logging.googleapis.com/kubernetes` - The Cloud Logging - * service with a Kubernetes-native resource model - * * `logging.googleapis.com` - The legacy Cloud Logging service (no longer - * available as of GKE 1.15). - * * `none` - no logs will be exported from the cluster. - * - * If left as an empty string,`logging.googleapis.com/kubernetes` will be - * used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to set logging. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_logging_service.js - * region_tag:container_v1_generated_ClusterManager_SetLoggingService_async - */ - setLoggingService( - request?: protos.google.container.v1.ISetLoggingServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLoggingServiceRequest|undefined, {}|undefined - ]>; - setLoggingService( - request: protos.google.container.v1.ISetLoggingServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLoggingServiceRequest|null|undefined, - {}|null|undefined>): void; - setLoggingService( - request: protos.google.container.v1.ISetLoggingServiceRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLoggingServiceRequest|null|undefined, - {}|null|undefined>): void; - setLoggingService( - request?: protos.google.container.v1.ISetLoggingServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLoggingServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLoggingServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLoggingServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setLoggingService(request, options, callback); - } -/** - * Sets the monitoring service for a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.monitoringService - * Required. The monitoring service the cluster should use to write metrics. - * Currently available options: - * - * * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring - * service with a Kubernetes-native resource model - * * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no - * longer available as of GKE 1.15). - * * `none` - No metrics will be exported from the cluster. - * - * If left as an empty string,`monitoring.googleapis.com/kubernetes` will be - * used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to set monitoring. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_monitoring_service.js - * region_tag:container_v1_generated_ClusterManager_SetMonitoringService_async - */ - setMonitoringService( - request?: protos.google.container.v1.ISetMonitoringServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMonitoringServiceRequest|undefined, {}|undefined - ]>; - setMonitoringService( - request: protos.google.container.v1.ISetMonitoringServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMonitoringServiceRequest|null|undefined, - {}|null|undefined>): void; - setMonitoringService( - request: protos.google.container.v1.ISetMonitoringServiceRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMonitoringServiceRequest|null|undefined, - {}|null|undefined>): void; - setMonitoringService( - request?: protos.google.container.v1.ISetMonitoringServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMonitoringServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMonitoringServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMonitoringServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setMonitoringService(request, options, callback); - } -/** - * Sets the addons for a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1.AddonsConfig} request.addonsConfig - * Required. The desired configurations for the various addons available to - * run in the cluster. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to set addons. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_addons_config.js - * region_tag:container_v1_generated_ClusterManager_SetAddonsConfig_async - */ - setAddonsConfig( - request?: protos.google.container.v1.ISetAddonsConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetAddonsConfigRequest|undefined, {}|undefined - ]>; - setAddonsConfig( - request: protos.google.container.v1.ISetAddonsConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetAddonsConfigRequest|null|undefined, - {}|null|undefined>): void; - setAddonsConfig( - request: protos.google.container.v1.ISetAddonsConfigRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetAddonsConfigRequest|null|undefined, - {}|null|undefined>): void; - setAddonsConfig( - request?: protos.google.container.v1.ISetAddonsConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetAddonsConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetAddonsConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetAddonsConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setAddonsConfig(request, options, callback); - } -/** - * Sets the locations for a specific cluster. - * Deprecated. Use - * [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/update) - * instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string[]} request.locations - * Required. The desired list of Google Compute Engine - * [zones](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster's nodes should be located. Changing the locations a cluster is in - * will result in nodes being either created or removed from the cluster, - * depending on whether locations are being added or removed. - * - * This list must always include the cluster's primary zone. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to set locations. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_locations.js - * region_tag:container_v1_generated_ClusterManager_SetLocations_async - * @deprecated SetLocations is deprecated and may be removed in a future version. - */ - setLocations( - request?: protos.google.container.v1.ISetLocationsRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLocationsRequest|undefined, {}|undefined - ]>; - setLocations( - request: protos.google.container.v1.ISetLocationsRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLocationsRequest|null|undefined, - {}|null|undefined>): void; - setLocations( - request: protos.google.container.v1.ISetLocationsRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLocationsRequest|null|undefined, - {}|null|undefined>): void; - setLocations( - request?: protos.google.container.v1.ISetLocationsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLocationsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLocationsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLocationsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - this.warn('DEP$ClusterManager-$SetLocations','SetLocations is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.innerApiCalls.setLocations(request, options, callback); - } -/** - * Updates the master for a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.masterVersion - * Required. The Kubernetes version to change the master to. - * - * Users may specify either explicit versions offered by Kubernetes Engine or - * version aliases, which have the following behavior: - * - * - "latest": picks the highest valid Kubernetes version - * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - * - "1.X.Y-gke.N": picks an explicit Kubernetes version - * - "-": picks the default Kubernetes version - * @param {string} request.name - * The name (project, location, cluster) of the cluster to update. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.update_master.js - * region_tag:container_v1_generated_ClusterManager_UpdateMaster_async - */ - updateMaster( - request?: protos.google.container.v1.IUpdateMasterRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateMasterRequest|undefined, {}|undefined - ]>; - updateMaster( - request: protos.google.container.v1.IUpdateMasterRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateMasterRequest|null|undefined, - {}|null|undefined>): void; - updateMaster( - request: protos.google.container.v1.IUpdateMasterRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateMasterRequest|null|undefined, - {}|null|undefined>): void; - updateMaster( - request?: protos.google.container.v1.IUpdateMasterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateMasterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateMasterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IUpdateMasterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMaster(request, options, callback); - } -/** - * Sets master auth materials. Currently supports changing the admin password - * or a specific cluster, either via password generation or explicitly setting - * the password. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1.SetMasterAuthRequest.Action} request.action - * Required. The exact form of action to be taken on the master auth. - * @param {google.container.v1.MasterAuth} request.update - * Required. A description of the update. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to set auth. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_master_auth.js - * region_tag:container_v1_generated_ClusterManager_SetMasterAuth_async - */ - setMasterAuth( - request?: protos.google.container.v1.ISetMasterAuthRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMasterAuthRequest|undefined, {}|undefined - ]>; - setMasterAuth( - request: protos.google.container.v1.ISetMasterAuthRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMasterAuthRequest|null|undefined, - {}|null|undefined>): void; - setMasterAuth( - request: protos.google.container.v1.ISetMasterAuthRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMasterAuthRequest|null|undefined, - {}|null|undefined>): void; - setMasterAuth( - request?: protos.google.container.v1.ISetMasterAuthRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMasterAuthRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMasterAuthRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMasterAuthRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setMasterAuth(request, options, callback); - } -/** - * Deletes the cluster, including the Kubernetes endpoint and all worker - * nodes. - * - * Firewalls and routes that were configured during cluster creation - * are also deleted. - * - * Other Google Compute Engine resources that might be in use by the cluster, - * such as load balancer resources, are not deleted if they weren't present - * when the cluster was initially created. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to delete. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to delete. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.delete_cluster.js - * region_tag:container_v1_generated_ClusterManager_DeleteCluster_async - */ - deleteCluster( - request?: protos.google.container.v1.IDeleteClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteClusterRequest|undefined, {}|undefined - ]>; - deleteCluster( - request: protos.google.container.v1.IDeleteClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteClusterRequest|null|undefined, - {}|null|undefined>): void; - deleteCluster( - request: protos.google.container.v1.IDeleteClusterRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteClusterRequest|null|undefined, - {}|null|undefined>): void; - deleteCluster( - request?: protos.google.container.v1.IDeleteClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteCluster(request, options, callback); - } -/** - * Lists all operations in a project in a specific zone or all zones. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the parent field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) to return - * operations for, or `-` for all zones. This field has been deprecated and - * replaced by the parent field. - * @param {string} request.parent - * The parent (project and location) where the operations will be listed. - * Specified in the format `projects/* /locations/*`. - * Location "-" matches all zones and all regions. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.ListOperationsResponse|ListOperationsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.list_operations.js - * region_tag:container_v1_generated_ClusterManager_ListOperations_async - */ - listOperations( - request?: protos.google.container.v1.IListOperationsRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IListOperationsResponse, - protos.google.container.v1.IListOperationsRequest|undefined, {}|undefined - ]>; - listOperations( - request: protos.google.container.v1.IListOperationsRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IListOperationsResponse, - protos.google.container.v1.IListOperationsRequest|null|undefined, - {}|null|undefined>): void; - listOperations( - request: protos.google.container.v1.IListOperationsRequest, - callback: Callback< - protos.google.container.v1.IListOperationsResponse, - protos.google.container.v1.IListOperationsRequest|null|undefined, - {}|null|undefined>): void; - listOperations( - request?: protos.google.container.v1.IListOperationsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IListOperationsResponse, - protos.google.container.v1.IListOperationsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IListOperationsResponse, - protos.google.container.v1.IListOperationsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IListOperationsResponse, - protos.google.container.v1.IListOperationsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - }); - this.initialize(); - return this.innerApiCalls.listOperations(request, options, callback); - } -/** - * Gets the specified operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.operationId - * Deprecated. The server-assigned `name` of the operation. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, operation id) of the operation to get. - * Specified in the format `projects/* /locations/* /operations/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.get_operation.js - * region_tag:container_v1_generated_ClusterManager_GetOperation_async - */ - getOperation( - request?: protos.google.container.v1.IGetOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IGetOperationRequest|undefined, {}|undefined - ]>; - getOperation( - request: protos.google.container.v1.IGetOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IGetOperationRequest|null|undefined, - {}|null|undefined>): void; - getOperation( - request: protos.google.container.v1.IGetOperationRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IGetOperationRequest|null|undefined, - {}|null|undefined>): void; - getOperation( - request?: protos.google.container.v1.IGetOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IGetOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IGetOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IGetOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'operation_id': request.operationId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getOperation(request, options, callback); - } -/** - * Cancels the specified operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * operation resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.operationId - * Deprecated. The server-assigned `name` of the operation. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, operation id) of the operation to cancel. - * Specified in the format `projects/* /locations/* /operations/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/cluster_manager.cancel_operation.js - * region_tag:container_v1_generated_ClusterManager_CancelOperation_async - */ - cancelOperation( - request?: protos.google.container.v1.ICancelOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICancelOperationRequest|undefined, {}|undefined - ]>; - cancelOperation( - request: protos.google.container.v1.ICancelOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICancelOperationRequest|null|undefined, - {}|null|undefined>): void; - cancelOperation( - request: protos.google.container.v1.ICancelOperationRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICancelOperationRequest|null|undefined, - {}|null|undefined>): void; - cancelOperation( - request?: protos.google.container.v1.ICancelOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICancelOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICancelOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICancelOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'operation_id': request.operationId ?? '', - }); - this.initialize(); - return this.innerApiCalls.cancelOperation(request, options, callback); - } -/** - * Returns configuration info about the Google Kubernetes Engine service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) to return - * operations for. This field has been deprecated and replaced by the name - * field. - * @param {string} request.name - * The name (project and location) of the server config to get, - * specified in the format `projects/* /locations/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.ServerConfig|ServerConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.get_server_config.js - * region_tag:container_v1_generated_ClusterManager_GetServerConfig_async - */ - getServerConfig( - request?: protos.google.container.v1.IGetServerConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IServerConfig, - protos.google.container.v1.IGetServerConfigRequest|undefined, {}|undefined - ]>; - getServerConfig( - request: protos.google.container.v1.IGetServerConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IServerConfig, - protos.google.container.v1.IGetServerConfigRequest|null|undefined, - {}|null|undefined>): void; - getServerConfig( - request: protos.google.container.v1.IGetServerConfigRequest, - callback: Callback< - protos.google.container.v1.IServerConfig, - protos.google.container.v1.IGetServerConfigRequest|null|undefined, - {}|null|undefined>): void; - getServerConfig( - request?: protos.google.container.v1.IGetServerConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IServerConfig, - protos.google.container.v1.IGetServerConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IServerConfig, - protos.google.container.v1.IGetServerConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IServerConfig, - protos.google.container.v1.IGetServerConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - }); - this.initialize(); - return this.innerApiCalls.getServerConfig(request, options, callback); - } -/** - * Gets the public component of the cluster signing keys in - * JSON Web Key format. - * This API is not yet intended for general use, and is not available for all - * clusters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The cluster (project, location, cluster name) to get keys for. Specified in - * the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.GetJSONWebKeysResponse|GetJSONWebKeysResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.get_j_s_o_n_web_keys.js - * region_tag:container_v1_generated_ClusterManager_GetJSONWebKeys_async - */ - getJSONWebKeys( - request?: protos.google.container.v1.IGetJSONWebKeysRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IGetJSONWebKeysResponse, - protos.google.container.v1.IGetJSONWebKeysRequest|undefined, {}|undefined - ]>; - getJSONWebKeys( - request: protos.google.container.v1.IGetJSONWebKeysRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IGetJSONWebKeysResponse, - protos.google.container.v1.IGetJSONWebKeysRequest|null|undefined, - {}|null|undefined>): void; - getJSONWebKeys( - request: protos.google.container.v1.IGetJSONWebKeysRequest, - callback: Callback< - protos.google.container.v1.IGetJSONWebKeysResponse, - protos.google.container.v1.IGetJSONWebKeysRequest|null|undefined, - {}|null|undefined>): void; - getJSONWebKeys( - request?: protos.google.container.v1.IGetJSONWebKeysRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IGetJSONWebKeysResponse, - protos.google.container.v1.IGetJSONWebKeysRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IGetJSONWebKeysResponse, - protos.google.container.v1.IGetJSONWebKeysRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IGetJSONWebKeysResponse, - protos.google.container.v1.IGetJSONWebKeysRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.getJsonWebKeys(request, options, callback); - } -/** - * Lists the node pools for a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the parent field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the parent - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the parent field. - * @param {string} request.parent - * The parent (project, location, cluster name) where the node pools will be - * listed. Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.ListNodePoolsResponse|ListNodePoolsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.list_node_pools.js - * region_tag:container_v1_generated_ClusterManager_ListNodePools_async - */ - listNodePools( - request?: protos.google.container.v1.IListNodePoolsRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IListNodePoolsResponse, - protos.google.container.v1.IListNodePoolsRequest|undefined, {}|undefined - ]>; - listNodePools( - request: protos.google.container.v1.IListNodePoolsRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IListNodePoolsResponse, - protos.google.container.v1.IListNodePoolsRequest|null|undefined, - {}|null|undefined>): void; - listNodePools( - request: protos.google.container.v1.IListNodePoolsRequest, - callback: Callback< - protos.google.container.v1.IListNodePoolsResponse, - protos.google.container.v1.IListNodePoolsRequest|null|undefined, - {}|null|undefined>): void; - listNodePools( - request?: protos.google.container.v1.IListNodePoolsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IListNodePoolsResponse, - protos.google.container.v1.IListNodePoolsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IListNodePoolsResponse, - protos.google.container.v1.IListNodePoolsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IListNodePoolsResponse, - protos.google.container.v1.IListNodePoolsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.listNodePools(request, options, callback); - } -/** - * Retrieves the requested node pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Deprecated. The name of the node pool. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node pool to - * get. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.NodePool|NodePool}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.get_node_pool.js - * region_tag:container_v1_generated_ClusterManager_GetNodePool_async - */ - getNodePool( - request?: protos.google.container.v1.IGetNodePoolRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.INodePool, - protos.google.container.v1.IGetNodePoolRequest|undefined, {}|undefined - ]>; - getNodePool( - request: protos.google.container.v1.IGetNodePoolRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.INodePool, - protos.google.container.v1.IGetNodePoolRequest|null|undefined, - {}|null|undefined>): void; - getNodePool( - request: protos.google.container.v1.IGetNodePoolRequest, - callback: Callback< - protos.google.container.v1.INodePool, - protos.google.container.v1.IGetNodePoolRequest|null|undefined, - {}|null|undefined>): void; - getNodePool( - request?: protos.google.container.v1.IGetNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.INodePool, - protos.google.container.v1.IGetNodePoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.INodePool, - protos.google.container.v1.IGetNodePoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.INodePool, - protos.google.container.v1.IGetNodePoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getNodePool(request, options, callback); - } -/** - * Creates a node pool for a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the parent field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the parent - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the parent field. - * @param {google.container.v1.NodePool} request.nodePool - * Required. The node pool to create. - * @param {string} request.parent - * The parent (project, location, cluster name) where the node pool will be - * created. Specified in the format - * `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.create_node_pool.js - * region_tag:container_v1_generated_ClusterManager_CreateNodePool_async - */ - createNodePool( - request?: protos.google.container.v1.ICreateNodePoolRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateNodePoolRequest|undefined, {}|undefined - ]>; - createNodePool( - request: protos.google.container.v1.ICreateNodePoolRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateNodePoolRequest|null|undefined, - {}|null|undefined>): void; - createNodePool( - request: protos.google.container.v1.ICreateNodePoolRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateNodePoolRequest|null|undefined, - {}|null|undefined>): void; - createNodePool( - request?: protos.google.container.v1.ICreateNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateNodePoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateNodePoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ICreateNodePoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.createNodePool(request, options, callback); - } -/** - * Deletes a node pool from a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Deprecated. The name of the node pool to delete. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node pool to - * delete. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.delete_node_pool.js - * region_tag:container_v1_generated_ClusterManager_DeleteNodePool_async - */ - deleteNodePool( - request?: protos.google.container.v1.IDeleteNodePoolRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteNodePoolRequest|undefined, {}|undefined - ]>; - deleteNodePool( - request: protos.google.container.v1.IDeleteNodePoolRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteNodePoolRequest|null|undefined, - {}|null|undefined>): void; - deleteNodePool( - request: protos.google.container.v1.IDeleteNodePoolRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteNodePoolRequest|null|undefined, - {}|null|undefined>): void; - deleteNodePool( - request?: protos.google.container.v1.IDeleteNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteNodePoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteNodePoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IDeleteNodePoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteNodePool(request, options, callback); - } -/** - * CompleteNodePoolUpgrade will signal an on-going node pool upgrade to - * complete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node pool to - * complete upgrade. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/cluster_manager.complete_node_pool_upgrade.js - * region_tag:container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async - */ - completeNodePoolUpgrade( - request?: protos.google.container.v1.ICompleteNodePoolUpgradeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICompleteNodePoolUpgradeRequest|undefined, {}|undefined - ]>; - completeNodePoolUpgrade( - request: protos.google.container.v1.ICompleteNodePoolUpgradeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICompleteNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): void; - completeNodePoolUpgrade( - request: protos.google.container.v1.ICompleteNodePoolUpgradeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICompleteNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): void; - completeNodePoolUpgrade( - request?: protos.google.container.v1.ICompleteNodePoolUpgradeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICompleteNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICompleteNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.container.v1.ICompleteNodePoolUpgradeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.completeNodePoolUpgrade(request, options, callback); - } -/** - * Rolls back a previously Aborted or Failed NodePool upgrade. - * This makes no changes if the last upgrade successfully completed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to rollback. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Deprecated. The name of the node pool to rollback. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node poll to - * rollback upgrade. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {boolean} request.respectPdb - * Option for rollback to ignore the PodDisruptionBudget. - * 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.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.rollback_node_pool_upgrade.js - * region_tag:container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async - */ - rollbackNodePoolUpgrade( - request?: protos.google.container.v1.IRollbackNodePoolUpgradeRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IRollbackNodePoolUpgradeRequest|undefined, {}|undefined - ]>; - rollbackNodePoolUpgrade( - request: protos.google.container.v1.IRollbackNodePoolUpgradeRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IRollbackNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): void; - rollbackNodePoolUpgrade( - request: protos.google.container.v1.IRollbackNodePoolUpgradeRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IRollbackNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): void; - rollbackNodePoolUpgrade( - request?: protos.google.container.v1.IRollbackNodePoolUpgradeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IRollbackNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IRollbackNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IRollbackNodePoolUpgradeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.rollbackNodePoolUpgrade(request, options, callback); - } -/** - * Sets the NodeManagement options for a node pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to update. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Deprecated. The name of the node pool to update. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1.NodeManagement} request.management - * Required. NodeManagement configuration for the node pool. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node pool to set - * management properties. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_node_pool_management.js - * region_tag:container_v1_generated_ClusterManager_SetNodePoolManagement_async - */ - setNodePoolManagement( - request?: protos.google.container.v1.ISetNodePoolManagementRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolManagementRequest|undefined, {}|undefined - ]>; - setNodePoolManagement( - request: protos.google.container.v1.ISetNodePoolManagementRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolManagementRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolManagement( - request: protos.google.container.v1.ISetNodePoolManagementRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolManagementRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolManagement( - request?: protos.google.container.v1.ISetNodePoolManagementRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolManagementRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolManagementRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolManagementRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setNodePoolManagement(request, options, callback); - } -/** - * Sets labels on a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {number[]} request.resourceLabels - * Required. The labels to set for that cluster. - * @param {string} request.labelFingerprint - * Required. The fingerprint of the previous set of labels for this resource, - * used to detect conflicts. The fingerprint is initially generated by - * Kubernetes Engine and changes after every request to modify or update - * labels. You must always provide an up-to-date fingerprint hash when - * updating or changing labels. Make a `get()` request to the - * resource to get the latest fingerprint. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to set labels. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_labels.js - * region_tag:container_v1_generated_ClusterManager_SetLabels_async - */ - setLabels( - request?: protos.google.container.v1.ISetLabelsRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLabelsRequest|undefined, {}|undefined - ]>; - setLabels( - request: protos.google.container.v1.ISetLabelsRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLabelsRequest|null|undefined, - {}|null|undefined>): void; - setLabels( - request: protos.google.container.v1.ISetLabelsRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLabelsRequest|null|undefined, - {}|null|undefined>): void; - setLabels( - request?: protos.google.container.v1.ISetLabelsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLabelsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLabelsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLabelsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setLabels(request, options, callback); - } -/** - * Enables or disables the ABAC authorization mechanism on a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to update. - * This field has been deprecated and replaced by the name field. - * @param {boolean} request.enabled - * Required. Whether ABAC authorization will be enabled in the cluster. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to set legacy - * abac. Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_legacy_abac.js - * region_tag:container_v1_generated_ClusterManager_SetLegacyAbac_async - */ - setLegacyAbac( - request?: protos.google.container.v1.ISetLegacyAbacRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLegacyAbacRequest|undefined, {}|undefined - ]>; - setLegacyAbac( - request: protos.google.container.v1.ISetLegacyAbacRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLegacyAbacRequest|null|undefined, - {}|null|undefined>): void; - setLegacyAbac( - request: protos.google.container.v1.ISetLegacyAbacRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLegacyAbacRequest|null|undefined, - {}|null|undefined>): void; - setLegacyAbac( - request?: protos.google.container.v1.ISetLegacyAbacRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLegacyAbacRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLegacyAbacRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetLegacyAbacRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setLegacyAbac(request, options, callback); - } -/** - * Starts master IP rotation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to start IP - * rotation. Specified in the format `projects/* /locations/* /clusters/*`. - * @param {boolean} request.rotateCredentials - * Whether to rotate credentials during IP rotation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.start_i_p_rotation.js - * region_tag:container_v1_generated_ClusterManager_StartIPRotation_async - */ - startIPRotation( - request?: protos.google.container.v1.IStartIPRotationRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IStartIPRotationRequest|undefined, {}|undefined - ]>; - startIPRotation( - request: protos.google.container.v1.IStartIPRotationRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IStartIPRotationRequest|null|undefined, - {}|null|undefined>): void; - startIPRotation( - request: protos.google.container.v1.IStartIPRotationRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IStartIPRotationRequest|null|undefined, - {}|null|undefined>): void; - startIPRotation( - request?: protos.google.container.v1.IStartIPRotationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IStartIPRotationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.IStartIPRotationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.IStartIPRotationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.startIpRotation(request, options, callback); - } -/** - * Completes master IP rotation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to complete IP - * rotation. Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.complete_i_p_rotation.js - * region_tag:container_v1_generated_ClusterManager_CompleteIPRotation_async - */ - completeIPRotation( - request?: protos.google.container.v1.ICompleteIPRotationRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ICompleteIPRotationRequest|undefined, {}|undefined - ]>; - completeIPRotation( - request: protos.google.container.v1.ICompleteIPRotationRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICompleteIPRotationRequest|null|undefined, - {}|null|undefined>): void; - completeIPRotation( - request: protos.google.container.v1.ICompleteIPRotationRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICompleteIPRotationRequest|null|undefined, - {}|null|undefined>): void; - completeIPRotation( - request?: protos.google.container.v1.ICompleteIPRotationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICompleteIPRotationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ICompleteIPRotationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ICompleteIPRotationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.completeIpRotation(request, options, callback); - } -/** - * Sets the size for a specific node pool. The new size will be used for all - * replicas, including future replicas created by modifying - * {@link protos.google.container.v1.NodePool.locations|NodePool.locations}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster to update. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Deprecated. The name of the node pool to update. - * This field has been deprecated and replaced by the name field. - * @param {number} request.nodeCount - * Required. The desired node count for the pool. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node pool to set - * size. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_node_pool_size.js - * region_tag:container_v1_generated_ClusterManager_SetNodePoolSize_async - */ - setNodePoolSize( - request?: protos.google.container.v1.ISetNodePoolSizeRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolSizeRequest|undefined, {}|undefined - ]>; - setNodePoolSize( - request: protos.google.container.v1.ISetNodePoolSizeRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolSizeRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolSize( - request: protos.google.container.v1.ISetNodePoolSizeRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolSizeRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolSize( - request?: protos.google.container.v1.ISetNodePoolSizeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolSizeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolSizeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNodePoolSizeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setNodePoolSize(request, options, callback); - } -/** - * Enables or disables Network Policy for a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1.NetworkPolicy} request.networkPolicy - * Required. Configuration options for the NetworkPolicy feature. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to set networking - * policy. Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_network_policy.js - * region_tag:container_v1_generated_ClusterManager_SetNetworkPolicy_async - */ - setNetworkPolicy( - request?: protos.google.container.v1.ISetNetworkPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNetworkPolicyRequest|undefined, {}|undefined - ]>; - setNetworkPolicy( - request: protos.google.container.v1.ISetNetworkPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): void; - setNetworkPolicy( - request: protos.google.container.v1.ISetNetworkPolicyRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): void; - setNetworkPolicy( - request?: protos.google.container.v1.ISetNetworkPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNetworkPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetNetworkPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setNetworkPolicy(request, options, callback); - } -/** - * Sets the maintenance policy for a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * @param {string} request.zone - * Required. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. - * @param {string} request.clusterId - * Required. The name of the cluster to update. - * @param {google.container.v1.MaintenancePolicy} request.maintenancePolicy - * Required. The maintenance policy to be set for the cluster. An empty field - * clears the existing maintenance policy. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to set - * maintenance policy. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.set_maintenance_policy.js - * region_tag:container_v1_generated_ClusterManager_SetMaintenancePolicy_async - */ - setMaintenancePolicy( - request?: protos.google.container.v1.ISetMaintenancePolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMaintenancePolicyRequest|undefined, {}|undefined - ]>; - setMaintenancePolicy( - request: protos.google.container.v1.ISetMaintenancePolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMaintenancePolicyRequest|null|undefined, - {}|null|undefined>): void; - setMaintenancePolicy( - request: protos.google.container.v1.ISetMaintenancePolicyRequest, - callback: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMaintenancePolicyRequest|null|undefined, - {}|null|undefined>): void; - setMaintenancePolicy( - request?: protos.google.container.v1.ISetMaintenancePolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMaintenancePolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMaintenancePolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.IOperation, - protos.google.container.v1.ISetMaintenancePolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setMaintenancePolicy(request, options, callback); - } -/** - * Checks the cluster compatibility with Autopilot mode, and returns a list of - * compatibility issues. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to retrieve. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1.CheckAutopilotCompatibilityResponse|CheckAutopilotCompatibilityResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_manager.check_autopilot_compatibility.js - * region_tag:container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async - */ - checkAutopilotCompatibility( - request?: protos.google.container.v1.ICheckAutopilotCompatibilityRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1.ICheckAutopilotCompatibilityRequest|undefined, {}|undefined - ]>; - checkAutopilotCompatibility( - request: protos.google.container.v1.ICheckAutopilotCompatibilityRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1.ICheckAutopilotCompatibilityRequest|null|undefined, - {}|null|undefined>): void; - checkAutopilotCompatibility( - request: protos.google.container.v1.ICheckAutopilotCompatibilityRequest, - callback: Callback< - protos.google.container.v1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1.ICheckAutopilotCompatibilityRequest|null|undefined, - {}|null|undefined>): void; - checkAutopilotCompatibility( - request?: protos.google.container.v1.ICheckAutopilotCompatibilityRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1.ICheckAutopilotCompatibilityRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1.ICheckAutopilotCompatibilityRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1.ICheckAutopilotCompatibilityRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.checkAutopilotCompatibility(request, options, callback); - } - - /** - * Lists subnetworks that are usable for creating clusters in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent project where subnetworks are usable. - * Specified in the format `projects/*`. - * @param {string} request.filter - * Filtering currently only supports equality on the networkProjectId and must - * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` - * is the project which owns the listed subnetworks. This defaults to the - * parent project ID. - * @param {number} request.pageSize - * The max number of results per page that should be returned. If the number - * of available results is larger than `page_size`, a `next_page_token` is - * returned which can be used to get the next page of results in subsequent - * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.pageToken - * Specifies a page token to use. Set this to the nextPageToken returned by - * previous list requests to get 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.container.v1.UsableSubnetwork|UsableSubnetwork}. - * 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 `listUsableSubnetworksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableSubnetworks( - request?: protos.google.container.v1.IListUsableSubnetworksRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1.IUsableSubnetwork[], - protos.google.container.v1.IListUsableSubnetworksRequest|null, - protos.google.container.v1.IListUsableSubnetworksResponse - ]>; - listUsableSubnetworks( - request: protos.google.container.v1.IListUsableSubnetworksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.container.v1.IListUsableSubnetworksRequest, - protos.google.container.v1.IListUsableSubnetworksResponse|null|undefined, - protos.google.container.v1.IUsableSubnetwork>): void; - listUsableSubnetworks( - request: protos.google.container.v1.IListUsableSubnetworksRequest, - callback: PaginationCallback< - protos.google.container.v1.IListUsableSubnetworksRequest, - protos.google.container.v1.IListUsableSubnetworksResponse|null|undefined, - protos.google.container.v1.IUsableSubnetwork>): void; - listUsableSubnetworks( - request?: protos.google.container.v1.IListUsableSubnetworksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.container.v1.IListUsableSubnetworksRequest, - protos.google.container.v1.IListUsableSubnetworksResponse|null|undefined, - protos.google.container.v1.IUsableSubnetwork>, - callback?: PaginationCallback< - protos.google.container.v1.IListUsableSubnetworksRequest, - protos.google.container.v1.IListUsableSubnetworksResponse|null|undefined, - protos.google.container.v1.IUsableSubnetwork>): - Promise<[ - protos.google.container.v1.IUsableSubnetwork[], - protos.google.container.v1.IListUsableSubnetworksRequest|null, - protos.google.container.v1.IListUsableSubnetworksResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listUsableSubnetworks(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 where subnetworks are usable. - * Specified in the format `projects/*`. - * @param {string} request.filter - * Filtering currently only supports equality on the networkProjectId and must - * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` - * is the project which owns the listed subnetworks. This defaults to the - * parent project ID. - * @param {number} request.pageSize - * The max number of results per page that should be returned. If the number - * of available results is larger than `page_size`, a `next_page_token` is - * returned which can be used to get the next page of results in subsequent - * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.pageToken - * Specifies a page token to use. Set this to the nextPageToken returned by - * previous list requests to get 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.container.v1.UsableSubnetwork|UsableSubnetwork} 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 `listUsableSubnetworksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableSubnetworksStream( - request?: protos.google.container.v1.IListUsableSubnetworksRequest, - 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['listUsableSubnetworks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableSubnetworks.createStream( - this.innerApiCalls.listUsableSubnetworks as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUsableSubnetworks`, 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 where subnetworks are usable. - * Specified in the format `projects/*`. - * @param {string} request.filter - * Filtering currently only supports equality on the networkProjectId and must - * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` - * is the project which owns the listed subnetworks. This defaults to the - * parent project ID. - * @param {number} request.pageSize - * The max number of results per page that should be returned. If the number - * of available results is larger than `page_size`, a `next_page_token` is - * returned which can be used to get the next page of results in subsequent - * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.pageToken - * Specifies a page token to use. Set this to the nextPageToken returned by - * previous list requests to get 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.container.v1.UsableSubnetwork|UsableSubnetwork}. 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/cluster_manager.list_usable_subnetworks.js - * region_tag:container_v1_generated_ClusterManager_ListUsableSubnetworks_async - */ - listUsableSubnetworksAsync( - request?: protos.google.container.v1.IListUsableSubnetworksRequest, - 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['listUsableSubnetworks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableSubnetworks.asyncIterate( - this.innerApiCalls['listUsableSubnetworks'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * 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.clusterManagerStub && !this._terminated) { - return this.clusterManagerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client_config.json b/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client_config.json deleted file mode 100644 index 33fb266b6bd..00000000000 --- a/owl-bot-staging/google-container/v1/src/v1/cluster_manager_client_config.json +++ /dev/null @@ -1,192 +0,0 @@ -{ - "interfaces": { - "google.container.v1.ClusterManager": { - "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": { - "ListClusters": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetCluster": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateCluster": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCluster": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNodePool": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetNodePoolAutoscaling": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetLoggingService": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetMonitoringService": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetAddonsConfig": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetLocations": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateMaster": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetMasterAuth": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteCluster": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListOperations": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetOperation": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CancelOperation": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetServerConfig": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetJSONWebKeys": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListNodePools": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetNodePool": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateNodePool": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNodePool": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CompleteNodePoolUpgrade": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RollbackNodePoolUpgrade": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetNodePoolManagement": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetLabels": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetLegacyAbac": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartIPRotation": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CompleteIPRotation": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetNodePoolSize": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetNetworkPolicy": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetMaintenancePolicy": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListUsableSubnetworks": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CheckAutopilotCompatibility": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-container/v1/src/v1/cluster_manager_proto_list.json b/owl-bot-staging/google-container/v1/src/v1/cluster_manager_proto_list.json deleted file mode 100644 index aa69748e51b..00000000000 --- a/owl-bot-staging/google-container/v1/src/v1/cluster_manager_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/container/v1/cluster_service.proto" -] diff --git a/owl-bot-staging/google-container/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-container/v1/src/v1/gapic_metadata.json deleted file mode 100644 index c08b06ded09..00000000000 --- a/owl-bot-staging/google-container/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,367 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.container.v1", - "libraryPackage": "@google-cloud/container", - "services": { - "ClusterManager": { - "clients": { - "grpc": { - "libraryClient": "ClusterManagerClient", - "rpcs": { - "ListClusters": { - "methods": [ - "listClusters" - ] - }, - "GetCluster": { - "methods": [ - "getCluster" - ] - }, - "CreateCluster": { - "methods": [ - "createCluster" - ] - }, - "UpdateCluster": { - "methods": [ - "updateCluster" - ] - }, - "UpdateNodePool": { - "methods": [ - "updateNodePool" - ] - }, - "SetNodePoolAutoscaling": { - "methods": [ - "setNodePoolAutoscaling" - ] - }, - "SetLoggingService": { - "methods": [ - "setLoggingService" - ] - }, - "SetMonitoringService": { - "methods": [ - "setMonitoringService" - ] - }, - "SetAddonsConfig": { - "methods": [ - "setAddonsConfig" - ] - }, - "SetLocations": { - "methods": [ - "setLocations" - ] - }, - "UpdateMaster": { - "methods": [ - "updateMaster" - ] - }, - "SetMasterAuth": { - "methods": [ - "setMasterAuth" - ] - }, - "DeleteCluster": { - "methods": [ - "deleteCluster" - ] - }, - "ListOperations": { - "methods": [ - "listOperations" - ] - }, - "GetOperation": { - "methods": [ - "getOperation" - ] - }, - "CancelOperation": { - "methods": [ - "cancelOperation" - ] - }, - "GetServerConfig": { - "methods": [ - "getServerConfig" - ] - }, - "GetJSONWebKeys": { - "methods": [ - "getJSONWebKeys" - ] - }, - "ListNodePools": { - "methods": [ - "listNodePools" - ] - }, - "GetNodePool": { - "methods": [ - "getNodePool" - ] - }, - "CreateNodePool": { - "methods": [ - "createNodePool" - ] - }, - "DeleteNodePool": { - "methods": [ - "deleteNodePool" - ] - }, - "CompleteNodePoolUpgrade": { - "methods": [ - "completeNodePoolUpgrade" - ] - }, - "RollbackNodePoolUpgrade": { - "methods": [ - "rollbackNodePoolUpgrade" - ] - }, - "SetNodePoolManagement": { - "methods": [ - "setNodePoolManagement" - ] - }, - "SetLabels": { - "methods": [ - "setLabels" - ] - }, - "SetLegacyAbac": { - "methods": [ - "setLegacyAbac" - ] - }, - "StartIPRotation": { - "methods": [ - "startIPRotation" - ] - }, - "CompleteIPRotation": { - "methods": [ - "completeIPRotation" - ] - }, - "SetNodePoolSize": { - "methods": [ - "setNodePoolSize" - ] - }, - "SetNetworkPolicy": { - "methods": [ - "setNetworkPolicy" - ] - }, - "SetMaintenancePolicy": { - "methods": [ - "setMaintenancePolicy" - ] - }, - "CheckAutopilotCompatibility": { - "methods": [ - "checkAutopilotCompatibility" - ] - }, - "ListUsableSubnetworks": { - "methods": [ - "listUsableSubnetworks", - "listUsableSubnetworksStream", - "listUsableSubnetworksAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ClusterManagerClient", - "rpcs": { - "ListClusters": { - "methods": [ - "listClusters" - ] - }, - "GetCluster": { - "methods": [ - "getCluster" - ] - }, - "CreateCluster": { - "methods": [ - "createCluster" - ] - }, - "UpdateCluster": { - "methods": [ - "updateCluster" - ] - }, - "UpdateNodePool": { - "methods": [ - "updateNodePool" - ] - }, - "SetNodePoolAutoscaling": { - "methods": [ - "setNodePoolAutoscaling" - ] - }, - "SetLoggingService": { - "methods": [ - "setLoggingService" - ] - }, - "SetMonitoringService": { - "methods": [ - "setMonitoringService" - ] - }, - "SetAddonsConfig": { - "methods": [ - "setAddonsConfig" - ] - }, - "SetLocations": { - "methods": [ - "setLocations" - ] - }, - "UpdateMaster": { - "methods": [ - "updateMaster" - ] - }, - "SetMasterAuth": { - "methods": [ - "setMasterAuth" - ] - }, - "DeleteCluster": { - "methods": [ - "deleteCluster" - ] - }, - "ListOperations": { - "methods": [ - "listOperations" - ] - }, - "GetOperation": { - "methods": [ - "getOperation" - ] - }, - "CancelOperation": { - "methods": [ - "cancelOperation" - ] - }, - "GetServerConfig": { - "methods": [ - "getServerConfig" - ] - }, - "GetJSONWebKeys": { - "methods": [ - "getJSONWebKeys" - ] - }, - "ListNodePools": { - "methods": [ - "listNodePools" - ] - }, - "GetNodePool": { - "methods": [ - "getNodePool" - ] - }, - "CreateNodePool": { - "methods": [ - "createNodePool" - ] - }, - "DeleteNodePool": { - "methods": [ - "deleteNodePool" - ] - }, - "CompleteNodePoolUpgrade": { - "methods": [ - "completeNodePoolUpgrade" - ] - }, - "RollbackNodePoolUpgrade": { - "methods": [ - "rollbackNodePoolUpgrade" - ] - }, - "SetNodePoolManagement": { - "methods": [ - "setNodePoolManagement" - ] - }, - "SetLabels": { - "methods": [ - "setLabels" - ] - }, - "SetLegacyAbac": { - "methods": [ - "setLegacyAbac" - ] - }, - "StartIPRotation": { - "methods": [ - "startIPRotation" - ] - }, - "CompleteIPRotation": { - "methods": [ - "completeIPRotation" - ] - }, - "SetNodePoolSize": { - "methods": [ - "setNodePoolSize" - ] - }, - "SetNetworkPolicy": { - "methods": [ - "setNetworkPolicy" - ] - }, - "SetMaintenancePolicy": { - "methods": [ - "setMaintenancePolicy" - ] - }, - "CheckAutopilotCompatibility": { - "methods": [ - "checkAutopilotCompatibility" - ] - }, - "ListUsableSubnetworks": { - "methods": [ - "listUsableSubnetworks", - "listUsableSubnetworksStream", - "listUsableSubnetworksAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-container/v1/src/v1/index.ts b/owl-bot-staging/google-container/v1/src/v1/index.ts deleted file mode 100644 index b1b39233034..00000000000 --- a/owl-bot-staging/google-container/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 {ClusterManagerClient} from './cluster_manager_client'; diff --git a/owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 1101d781caa..00000000000 --- a/owl-bot-staging/google-container/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 container = require('@google-cloud/container'); - -function main() { - const clusterManagerClient = new container.ClusterManagerClient(); -} - -main(); diff --git a/owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-container/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 6685b8649e6..00000000000 --- a/owl-bot-staging/google-container/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 {ClusterManagerClient} from '@google-cloud/container'; - -// check that the client class type name can be used -function doStuffWithClusterManagerClient(client: ClusterManagerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const clusterManagerClient = new ClusterManagerClient(); - doStuffWithClusterManagerClient(clusterManagerClient); -} - -main(); diff --git a/owl-bot-staging/google-container/v1/system-test/install.ts b/owl-bot-staging/google-container/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-container/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-container/v1/test/gapic_cluster_manager_v1.ts b/owl-bot-staging/google-container/v1/test/gapic_cluster_manager_v1.ts deleted file mode 100644 index 9632e377d3a..00000000000 --- a/owl-bot-staging/google-container/v1/test/gapic_cluster_manager_v1.ts +++ /dev/null @@ -1,5130 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 clustermanagerModule 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.ClusterManagerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = clustermanagerModule.v1.ClusterManagerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = clustermanagerModule.v1.ClusterManagerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = clustermanagerModule.v1.ClusterManagerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new clustermanagerModule.v1.ClusterManagerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.clusterManagerStub, undefined); - await client.initialize(); - assert(client.clusterManagerStub); - }); - - it('has close method for the initialized client', done => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.clusterManagerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.clusterManagerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new clustermanagerModule.v1.ClusterManagerClient({ - 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 clustermanagerModule.v1.ClusterManagerClient({ - 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('listClusters', () => { - it('invokes listClusters without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.ListClustersResponse() - ); - client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listClusters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClusters without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.ListClustersResponse() - ); - client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listClusters( - request, - (err?: Error|null, result?: protos.google.container.v1.IListClustersResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClusters with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listClusters(request), expectedError); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClusters with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListClustersRequest', ['zone']); - request.zone = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listClusters(request), expectedError); - }); - }); - - describe('getCluster', () => { - it('invokes getCluster without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCluster( - request, - (err?: Error|null, result?: protos.google.container.v1.ICluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCluster(request), expectedError); - }); - }); - - describe('createCluster', () => { - it('invokes createCluster without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.createCluster = stubSimpleCall(expectedResponse); - const [response] = await client.createCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.createCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCluster( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CreateClusterRequest', ['zone']); - request.zone = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createCluster(request), expectedError); - }); - }); - - describe('updateCluster', () => { - it('invokes updateCluster without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.updateCluster = stubSimpleCall(expectedResponse); - const [response] = await client.updateCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.updateCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCluster( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateCluster(request), expectedError); - }); - }); - - describe('updateNodePool', () => { - it('invokes updateNodePool without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.updateNodePool = stubSimpleCall(expectedResponse); - const [response] = await client.updateNodePool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNodePool without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.updateNodePool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNodePool( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNodePool with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNodePool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNodePool with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.UpdateNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateNodePool(request), expectedError); - }); - }); - - describe('setNodePoolAutoscaling', () => { - it('invokes setNodePoolAutoscaling without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolAutoscalingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCall(expectedResponse); - const [response] = await client.setNodePoolAutoscaling(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolAutoscaling without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolAutoscalingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setNodePoolAutoscaling( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolAutoscaling with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolAutoscalingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setNodePoolAutoscaling(request), expectedError); - const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolAutoscaling with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolAutoscalingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolAutoscalingRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setNodePoolAutoscaling(request), expectedError); - }); - }); - - describe('setLoggingService', () => { - it('invokes setLoggingService without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLoggingServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setLoggingService = stubSimpleCall(expectedResponse); - const [response] = await client.setLoggingService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLoggingService without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLoggingServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setLoggingService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setLoggingService( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLoggingService with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLoggingServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setLoggingService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setLoggingService(request), expectedError); - const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLoggingService with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLoggingServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLoggingServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setLoggingService(request), expectedError); - }); - }); - - describe('setMonitoringService', () => { - it('invokes setMonitoringService without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMonitoringServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setMonitoringService = stubSimpleCall(expectedResponse); - const [response] = await client.setMonitoringService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMonitoringService without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMonitoringServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setMonitoringService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setMonitoringService( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMonitoringService with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMonitoringServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setMonitoringService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setMonitoringService(request), expectedError); - const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMonitoringService with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMonitoringServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMonitoringServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setMonitoringService(request), expectedError); - }); - }); - - describe('setAddonsConfig', () => { - it('invokes setAddonsConfig without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetAddonsConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setAddonsConfig = stubSimpleCall(expectedResponse); - const [response] = await client.setAddonsConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setAddonsConfig without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetAddonsConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setAddonsConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setAddonsConfig( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setAddonsConfig with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetAddonsConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setAddonsConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setAddonsConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setAddonsConfig with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetAddonsConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetAddonsConfigRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setAddonsConfig(request), expectedError); - }); - }); - - describe('setLocations', () => { - it('invokes setLocations without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setLocations = stubSimpleCall(expectedResponse); - const [response] = await client.setLocations(request); - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLocations without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setLocations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setLocations( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLocations with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setLocations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setLocations(request), expectedError); - assert(stub.calledOnce); - const actualRequest = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLocations with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLocationsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setLocations(request), expectedError); - assert(stub.calledOnce); - }); - }); - - describe('updateMaster', () => { - it('invokes updateMaster without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.updateMaster = stubSimpleCall(expectedResponse); - const [response] = await client.updateMaster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMaster without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.updateMaster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMaster( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMaster with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMaster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateMaster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMaster with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.UpdateMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.UpdateMasterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateMaster(request), expectedError); - }); - }); - - describe('setMasterAuth', () => { - it('invokes setMasterAuth without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMasterAuthRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setMasterAuth = stubSimpleCall(expectedResponse); - const [response] = await client.setMasterAuth(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMasterAuth without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMasterAuthRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setMasterAuth = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setMasterAuth( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMasterAuth with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMasterAuthRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setMasterAuth = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setMasterAuth(request), expectedError); - const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMasterAuth with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMasterAuthRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMasterAuthRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setMasterAuth(request), expectedError); - }); - }); - - describe('deleteCluster', () => { - it('invokes deleteCluster without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.deleteCluster = stubSimpleCall(expectedResponse); - const [response] = await client.deleteCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.deleteCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCluster( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.DeleteClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteCluster(request), expectedError); - }); - }); - - describe('listOperations', () => { - it('invokes listOperations without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListOperationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.ListOperationsResponse() - ); - client.innerApiCalls.listOperations = stubSimpleCall(expectedResponse); - const [response] = await client.listOperations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOperations without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListOperationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.ListOperationsResponse() - ); - client.innerApiCalls.listOperations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listOperations( - request, - (err?: Error|null, result?: protos.google.container.v1.IListOperationsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOperations with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListOperationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listOperations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listOperations(request), expectedError); - const actualRequest = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOperations with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListOperationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListOperationsRequest', ['zone']); - request.zone = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listOperations(request), expectedError); - }); - }); - - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.getOperation = stubSimpleCall(expectedResponse); - const [response] = await client.getOperation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOperation without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.getOperation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOperation( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOperation with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOperation(request), expectedError); - const actualRequest = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOperation with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOperation(request), expectedError); - }); - }); - - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CancelOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancelOperation = stubSimpleCall(expectedResponse); - const [response] = await client.cancelOperation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelOperation without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CancelOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancelOperation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelOperation( - 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.cancelOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelOperation with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CancelOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelOperation(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelOperation with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CancelOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CancelOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelOperation(request), expectedError); - }); - }); - - describe('getServerConfig', () => { - it('invokes getServerConfig without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.ServerConfig() - ); - client.innerApiCalls.getServerConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getServerConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServerConfig without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.ServerConfig() - ); - client.innerApiCalls.getServerConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServerConfig( - request, - (err?: Error|null, result?: protos.google.container.v1.IServerConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServerConfig with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServerConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServerConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServerConfig with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetServerConfigRequest', ['zone']); - request.zone = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getServerConfig(request), expectedError); - }); - }); - - describe('getJSONWebKeys', () => { - it('invokes getJSONWebKeys without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetJSONWebKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetJSONWebKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.GetJSONWebKeysResponse() - ); - client.innerApiCalls.getJsonWebKeys = stubSimpleCall(expectedResponse); - const [response] = await client.getJSONWebKeys(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJSONWebKeys without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetJSONWebKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetJSONWebKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.GetJSONWebKeysResponse() - ); - client.innerApiCalls.getJsonWebKeys = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJSONWebKeys( - request, - (err?: Error|null, result?: protos.google.container.v1.IGetJSONWebKeysResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJSONWebKeys with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetJSONWebKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetJSONWebKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getJsonWebKeys = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJSONWebKeys(request), expectedError); - const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJSONWebKeys with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetJSONWebKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetJSONWebKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getJSONWebKeys(request), expectedError); - }); - }); - - describe('listNodePools', () => { - it('invokes listNodePools without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.ListNodePoolsResponse() - ); - client.innerApiCalls.listNodePools = stubSimpleCall(expectedResponse); - const [response] = await client.listNodePools(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodePools without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.ListNodePoolsResponse() - ); - client.innerApiCalls.listNodePools = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNodePools( - request, - (err?: Error|null, result?: protos.google.container.v1.IListNodePoolsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodePools with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNodePools = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNodePools(request), expectedError); - const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodePools with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.ListNodePoolsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listNodePools(request), expectedError); - }); - }); - - describe('getNodePool', () => { - it('invokes getNodePool without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.NodePool() - ); - client.innerApiCalls.getNodePool = stubSimpleCall(expectedResponse); - const [response] = await client.getNodePool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodePool without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.NodePool() - ); - client.innerApiCalls.getNodePool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNodePool( - request, - (err?: Error|null, result?: protos.google.container.v1.INodePool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodePool with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNodePool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodePool with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.GetNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.GetNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNodePool(request), expectedError); - }); - }); - - describe('createNodePool', () => { - it('invokes createNodePool without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CreateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.createNodePool = stubSimpleCall(expectedResponse); - const [response] = await client.createNodePool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNodePool without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CreateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.createNodePool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNodePool( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNodePool with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CreateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNodePool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNodePool with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CreateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CreateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createNodePool(request), expectedError); - }); - }); - - describe('deleteNodePool', () => { - it('invokes deleteNodePool without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.DeleteNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.deleteNodePool = stubSimpleCall(expectedResponse); - const [response] = await client.deleteNodePool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNodePool without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.DeleteNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.deleteNodePool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNodePool( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNodePool with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.DeleteNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNodePool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNodePool with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.DeleteNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.DeleteNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteNodePool(request), expectedError); - }); - }); - - describe('completeNodePoolUpgrade', () => { - it('invokes completeNodePoolUpgrade without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CompleteNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CompleteNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCall(expectedResponse); - const [response] = await client.completeNodePoolUpgrade(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeNodePoolUpgrade without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CompleteNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CompleteNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.completeNodePoolUpgrade( - 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.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeNodePoolUpgrade with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CompleteNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CompleteNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.completeNodePoolUpgrade(request), expectedError); - const actualRequest = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeNodePoolUpgrade with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CompleteNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CompleteNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.completeNodePoolUpgrade(request), expectedError); - }); - }); - - describe('rollbackNodePoolUpgrade', () => { - it('invokes rollbackNodePoolUpgrade without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.RollbackNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCall(expectedResponse); - const [response] = await client.rollbackNodePoolUpgrade(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackNodePoolUpgrade without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.RollbackNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rollbackNodePoolUpgrade( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackNodePoolUpgrade with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.RollbackNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rollbackNodePoolUpgrade(request), expectedError); - const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackNodePoolUpgrade with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.RollbackNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.rollbackNodePoolUpgrade(request), expectedError); - }); - }); - - describe('setNodePoolManagement', () => { - it('invokes setNodePoolManagement without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolManagementRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setNodePoolManagement = stubSimpleCall(expectedResponse); - const [response] = await client.setNodePoolManagement(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolManagement without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolManagementRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setNodePoolManagement = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setNodePoolManagement( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolManagement with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolManagementRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setNodePoolManagement = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setNodePoolManagement(request), expectedError); - const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolManagement with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolManagementRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolManagementRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setNodePoolManagement(request), expectedError); - }); - }); - - describe('setLabels', () => { - it('invokes setLabels without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLabelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setLabels = stubSimpleCall(expectedResponse); - const [response] = await client.setLabels(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLabels without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLabelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setLabels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setLabels( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLabels with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLabelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setLabels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setLabels(request), expectedError); - const actualRequest = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLabels with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLabelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLabelsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setLabels(request), expectedError); - }); - }); - - describe('setLegacyAbac', () => { - it('invokes setLegacyAbac without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLegacyAbacRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setLegacyAbac = stubSimpleCall(expectedResponse); - const [response] = await client.setLegacyAbac(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLegacyAbac without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLegacyAbacRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setLegacyAbac = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setLegacyAbac( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLegacyAbac with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLegacyAbacRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setLegacyAbac = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setLegacyAbac(request), expectedError); - const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLegacyAbac with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetLegacyAbacRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetLegacyAbacRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setLegacyAbac(request), expectedError); - }); - }); - - describe('startIPRotation', () => { - it('invokes startIPRotation without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.StartIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.startIpRotation = stubSimpleCall(expectedResponse); - const [response] = await client.startIPRotation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startIPRotation without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.StartIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.startIpRotation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startIPRotation( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startIPRotation with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.StartIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startIpRotation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startIPRotation(request), expectedError); - const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startIPRotation with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.StartIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.StartIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.startIPRotation(request), expectedError); - }); - }); - - describe('completeIPRotation', () => { - it('invokes completeIPRotation without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CompleteIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.completeIpRotation = stubSimpleCall(expectedResponse); - const [response] = await client.completeIPRotation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeIPRotation without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CompleteIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.completeIpRotation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.completeIPRotation( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeIPRotation with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CompleteIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.completeIpRotation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.completeIPRotation(request), expectedError); - const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeIPRotation with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CompleteIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.CompleteIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.completeIPRotation(request), expectedError); - }); - }); - - describe('setNodePoolSize', () => { - it('invokes setNodePoolSize without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setNodePoolSize = stubSimpleCall(expectedResponse); - const [response] = await client.setNodePoolSize(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolSize without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setNodePoolSize = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setNodePoolSize( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolSize with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setNodePoolSize = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setNodePoolSize(request), expectedError); - const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolSize with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNodePoolSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1.SetNodePoolSizeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setNodePoolSize(request), expectedError); - }); - }); - - describe('setNetworkPolicy', () => { - it('invokes setNetworkPolicy without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setNetworkPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setNetworkPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNetworkPolicy without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setNetworkPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setNetworkPolicy( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNetworkPolicy with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setNetworkPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setNetworkPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNetworkPolicy with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetNetworkPolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setNetworkPolicy(request), expectedError); - }); - }); - - describe('setMaintenancePolicy', () => { - it('invokes setMaintenancePolicy without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMaintenancePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setMaintenancePolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setMaintenancePolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMaintenancePolicy without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMaintenancePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.Operation() - ); - client.innerApiCalls.setMaintenancePolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setMaintenancePolicy( - request, - (err?: Error|null, result?: protos.google.container.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMaintenancePolicy with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMaintenancePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setMaintenancePolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setMaintenancePolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMaintenancePolicy with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.SetMaintenancePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1.SetMaintenancePolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setMaintenancePolicy(request), expectedError); - }); - }); - - describe('checkAutopilotCompatibility', () => { - it('invokes checkAutopilotCompatibility without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CheckAutopilotCompatibilityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CheckAutopilotCompatibilityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.CheckAutopilotCompatibilityResponse() - ); - client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCall(expectedResponse); - const [response] = await client.checkAutopilotCompatibility(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAutopilotCompatibility without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CheckAutopilotCompatibilityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CheckAutopilotCompatibilityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1.CheckAutopilotCompatibilityResponse() - ); - client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.checkAutopilotCompatibility( - request, - (err?: Error|null, result?: protos.google.container.v1.ICheckAutopilotCompatibilityResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAutopilotCompatibility with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CheckAutopilotCompatibilityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CheckAutopilotCompatibilityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAutopilotCompatibility(request), expectedError); - const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAutopilotCompatibility with closed client', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.CheckAutopilotCompatibilityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.CheckAutopilotCompatibilityRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.checkAutopilotCompatibility(request), expectedError); - }); - }); - - describe('listUsableSubnetworks', () => { - it('invokes listUsableSubnetworks without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - ]; - client.innerApiCalls.listUsableSubnetworks = stubSimpleCall(expectedResponse); - const [response] = await client.listUsableSubnetworks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableSubnetworks without error using callback', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - ]; - client.innerApiCalls.listUsableSubnetworks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUsableSubnetworks( - request, - (err?: Error|null, result?: protos.google.container.v1.IUsableSubnetwork[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableSubnetworks with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUsableSubnetworks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUsableSubnetworks(request), expectedError); - const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableSubnetworksStream without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - ]; - client.descriptors.page.listUsableSubnetworks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUsableSubnetworksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.container.v1.UsableSubnetwork[] = []; - stream.on('data', (response: protos.google.container.v1.UsableSubnetwork) => { - 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.listUsableSubnetworks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableSubnetworks, request)); - assert( - (client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listUsableSubnetworksStream with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableSubnetworks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUsableSubnetworksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.container.v1.UsableSubnetwork[] = []; - stream.on('data', (response: protos.google.container.v1.UsableSubnetwork) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableSubnetworks, request)); - assert( - (client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableSubnetworks without error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1.UsableSubnetwork()), - ]; - client.descriptors.page.listUsableSubnetworks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.container.v1.IUsableSubnetwork[] = []; - const iterable = client.listUsableSubnetworksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableSubnetworks with error', async () => { - const client = new clustermanagerModule.v1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableSubnetworks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUsableSubnetworksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.container.v1.IUsableSubnetwork[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/owl-bot-staging/google-container/v1/tsconfig.json b/owl-bot-staging/google-container/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-container/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-container/v1/webpack.config.js b/owl-bot-staging/google-container/v1/webpack.config.js deleted file mode 100644 index 9032271af9d..00000000000 --- a/owl-bot-staging/google-container/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: 'ClusterManager', - filename: './cluster-manager.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-container/v1beta1/.eslintignore b/owl-bot-staging/google-container/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-container/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-container/v1beta1/.eslintrc.json b/owl-bot-staging/google-container/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-container/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-container/v1beta1/.gitignore b/owl-bot-staging/google-container/v1beta1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-container/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-container/v1beta1/.jsdoc.js b/owl-bot-staging/google-container/v1beta1/.jsdoc.js deleted file mode 100644 index 6dc18e81193..00000000000 --- a/owl-bot-staging/google-container/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/container', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-container/v1beta1/.mocharc.js b/owl-bot-staging/google-container/v1beta1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-container/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-container/v1beta1/.prettierrc.js b/owl-bot-staging/google-container/v1beta1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-container/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-container/v1beta1/README.md b/owl-bot-staging/google-container/v1beta1/README.md deleted file mode 100644 index f32441d7e6b..00000000000 --- a/owl-bot-staging/google-container/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Container: Nodejs Client diff --git a/owl-bot-staging/google-container/v1beta1/package.json b/owl-bot-staging/google-container/v1beta1/package.json deleted file mode 100644 index b2ac12ed35f..00000000000 --- a/owl-bot-staging/google-container/v1beta1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/container", - "version": "0.1.0", - "description": "Container client for Node.js", - "repository": "googleapis/nodejs-container", - "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 container", - "container", - "cluster 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-container/v1beta1/protos/google/container/v1beta1/cluster_service.proto b/owl-bot-staging/google-container/v1beta1/protos/google/container/v1beta1/cluster_service.proto deleted file mode 100644 index 60ca0f57e8c..00000000000 --- a/owl-bot-staging/google-container/v1beta1/protos/google/container/v1beta1/cluster_service.proto +++ /dev/null @@ -1,5733 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.container.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/rpc/code.proto"; -import "google/rpc/status.proto"; -import "google/type/date.proto"; - -option csharp_namespace = "Google.Cloud.Container.V1Beta1"; -option go_package = "cloud.google.com/go/container/apiv1beta1/containerpb;containerpb"; -option java_multiple_files = true; -option java_outer_classname = "ClusterServiceProto"; -option java_package = "com.google.container.v1beta1"; -option php_namespace = "Google\\Cloud\\Container\\V1beta1"; -option ruby_package = "Google::Cloud::Container::V1beta1"; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; - -// Google Kubernetes Engine Cluster Manager v1beta1 -service ClusterManager { - option (google.api.default_host) = "container.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all clusters owned by a project in either the specified zone or all - // zones. - rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*}/clusters" - additional_bindings { - get: "/v1beta1/projects/{project_id}/zones/{zone}/clusters" - } - }; - option (google.api.method_signature) = "project_id,zone"; - } - - // Gets the details for a specific cluster. - rpc GetCluster(GetClusterRequest) returns (Cluster) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/clusters/*}" - additional_bindings { - get: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id"; - } - - // Creates a cluster, consisting of the specified number and type of Google - // Compute Engine instances. - // - // By default, the cluster is created in the project's - // [default - // network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). - // - // One firewall is added for the cluster. After cluster creation, - // the Kubelet creates routes for each node to allow the containers - // on that node to communicate with all other instances in the - // cluster. - // - // Finally, an entry is added to the project's global metadata indicating - // which CIDR range the cluster is using. - rpc CreateCluster(CreateClusterRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/*}/clusters" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster"; - } - - // Updates the settings for a specific cluster. - rpc UpdateCluster(UpdateClusterRequest) returns (Operation) { - option (google.api.http) = { - put: "/v1beta1/{name=projects/*/locations/*/clusters/*}" - body: "*" - additional_bindings { - put: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id,update"; - } - - // Updates the version and/or image type of a specific node pool. - rpc UpdateNodePool(UpdateNodePoolRequest) returns (Operation) { - option (google.api.http) = { - put: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/update" - body: "*" - } - }; - } - - // Sets the autoscaling settings of a specific node pool. - rpc SetNodePoolAutoscaling(SetNodePoolAutoscalingRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setAutoscaling" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/autoscaling" - body: "*" - } - }; - } - - // Sets the logging service for a specific cluster. - rpc SetLoggingService(SetLoggingServiceRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setLogging" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/logging" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,logging_service"; - } - - // Sets the monitoring service for a specific cluster. - rpc SetMonitoringService(SetMonitoringServiceRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setMonitoring" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/monitoring" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,monitoring_service"; - } - - // Sets the addons for a specific cluster. - rpc SetAddonsConfig(SetAddonsConfigRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setAddons" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/addons" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,addons_config"; - } - - // Sets the locations for a specific cluster. - // Deprecated. Use - // [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters/update) - // instead. - rpc SetLocations(SetLocationsRequest) returns (Operation) { - option deprecated = true; - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setLocations" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/locations" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,locations"; - } - - // Updates the master for a specific cluster. - rpc UpdateMaster(UpdateMasterRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:updateMaster" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/master" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,master_version"; - } - - // Sets master auth materials. Currently supports changing the admin password - // or a specific cluster, either via password generation or explicitly setting - // the password. - rpc SetMasterAuth(SetMasterAuthRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setMasterAuth" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMasterAuth" - body: "*" - } - }; - } - - // Deletes the cluster, including the Kubernetes endpoint and all worker - // nodes. - // - // Firewalls and routes that were configured during cluster creation - // are also deleted. - // - // Other Google Compute Engine resources that might be in use by the cluster, - // such as load balancer resources, are not deleted if they weren't present - // when the cluster was initially created. - rpc DeleteCluster(DeleteClusterRequest) returns (Operation) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/locations/*/clusters/*}" - additional_bindings { - delete: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id"; - } - - // Lists all operations in a project in the specified zone or all zones. - rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*}/operations" - additional_bindings { - get: "/v1beta1/projects/{project_id}/zones/{zone}/operations" - } - }; - option (google.api.method_signature) = "project_id,zone"; - } - - // Gets the specified operation. - rpc GetOperation(GetOperationRequest) returns (Operation) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/operations/*}" - additional_bindings { - get: "/v1beta1/projects/{project_id}/zones/{zone}/operations/{operation_id}" - } - }; - option (google.api.method_signature) = "project_id,zone,operation_id"; - } - - // Cancels the specified operation. - rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/operations/*}:cancel" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/operations/{operation_id}:cancel" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,operation_id"; - } - - // Returns configuration info about the Google Kubernetes Engine service. - rpc GetServerConfig(GetServerConfigRequest) returns (ServerConfig) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*}/serverConfig" - additional_bindings { - get: "/v1beta1/projects/{project_id}/zones/{zone}/serverconfig" - } - }; - option (google.api.method_signature) = "project_id,zone"; - } - - // Gets the public component of the cluster signing keys in - // JSON Web Key format. - // This API is not yet intended for general use, and is not available for all - // clusters. - rpc GetJSONWebKeys(GetJSONWebKeysRequest) returns (GetJSONWebKeysResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*/clusters/*}/jwks" - }; - } - - // Lists the node pools for a cluster. - rpc ListNodePools(ListNodePoolsRequest) returns (ListNodePoolsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*/clusters/*}/nodePools" - additional_bindings { - get: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id"; - } - - // Retrieves the requested node pool. - rpc GetNodePool(GetNodePoolRequest) returns (NodePool) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}" - additional_bindings { - get: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,node_pool_id"; - } - - // Creates a node pool for a cluster. - rpc CreateNodePool(CreateNodePoolRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/*/clusters/*}/nodePools" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,node_pool"; - } - - // Deletes a node pool from a cluster. - rpc DeleteNodePool(DeleteNodePoolRequest) returns (Operation) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}" - additional_bindings { - delete: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,node_pool_id"; - } - - // CompleteNodePoolUpgrade will signal an on-going node pool upgrade to - // complete. - rpc CompleteNodePoolUpgrade(CompleteNodePoolUpgradeRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:completeUpgrade" - body: "*" - }; - } - - // Rolls back a previously Aborted or Failed NodePool upgrade. - // This makes no changes if the last upgrade successfully completed. - rpc RollbackNodePoolUpgrade(RollbackNodePoolUpgradeRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:rollback" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}:rollback" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,node_pool_id"; - } - - // Sets the NodeManagement options for a node pool. - rpc SetNodePoolManagement(SetNodePoolManagementRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setManagement" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setManagement" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,node_pool_id,management"; - } - - // Sets labels on a cluster. - rpc SetLabels(SetLabelsRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setResourceLabels" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/resourceLabels" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,resource_labels,label_fingerprint"; - } - - // Enables or disables the ABAC authorization mechanism on a cluster. - rpc SetLegacyAbac(SetLegacyAbacRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setLegacyAbac" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/legacyAbac" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id,enabled"; - } - - // Starts master IP rotation. - rpc StartIPRotation(StartIPRotationRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:startIpRotation" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:startIpRotation" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id"; - } - - // Completes master IP rotation. - rpc CompleteIPRotation(CompleteIPRotationRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:completeIpRotation" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:completeIpRotation" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,zone,cluster_id"; - } - - // SetNodePoolSizeRequest sets the size of a node pool. The new size will be - // used for all replicas, including future replicas created by modifying - // [NodePool.locations][google.container.v1beta1.NodePool.locations]. - rpc SetNodePoolSize(SetNodePoolSizeRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setSize" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setSize" - body: "*" - } - }; - } - - // Enables or disables Network Policy for a cluster. - rpc SetNetworkPolicy(SetNetworkPolicyRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setNetworkPolicy" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setNetworkPolicy" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,network_policy"; - } - - // Sets the maintenance policy for a cluster. - rpc SetMaintenancePolicy(SetMaintenancePolicyRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setMaintenancePolicy" - body: "*" - additional_bindings { - post: "/v1beta1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMaintenancePolicy" - body: "*" - } - }; - option (google.api.method_signature) = - "project_id,zone,cluster_id,maintenance_policy"; - } - - // Lists subnetworks that can be used for creating clusters in a project. - rpc ListUsableSubnetworks(ListUsableSubnetworksRequest) - returns (ListUsableSubnetworksResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*}/aggregated/usableSubnetworks" - }; - option (google.api.method_signature) = "parent"; - } - - // Checks the cluster compatibility with Autopilot mode, and returns a list of - // compatibility issues. - rpc CheckAutopilotCompatibility(CheckAutopilotCompatibilityRequest) - returns (CheckAutopilotCompatibilityResponse) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/clusters/*}:checkAutopilotCompatibility" - }; - } - - // Fetches locations that offer Google Kubernetes Engine. - rpc ListLocations(ListLocationsRequest) returns (ListLocationsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*}/locations" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Parameters that can be configured on Linux nodes. -message LinuxNodeConfig { - // Possible cgroup modes that can be used. - enum CgroupMode { - // CGROUP_MODE_UNSPECIFIED is when unspecified cgroup configuration is used. - // The default for the GKE node OS image will be used. - CGROUP_MODE_UNSPECIFIED = 0; - - // CGROUP_MODE_V1 specifies to use cgroupv1 for the cgroup configuration on - // the node image. - CGROUP_MODE_V1 = 1; - - // CGROUP_MODE_V2 specifies to use cgroupv2 for the cgroup configuration on - // the node image. - CGROUP_MODE_V2 = 2; - } - - // The Linux kernel parameters to be applied to the nodes and all pods running - // on the nodes. - // - // The following parameters are supported. - // - // net.core.busy_poll - // net.core.busy_read - // net.core.netdev_max_backlog - // net.core.rmem_max - // net.core.wmem_default - // net.core.wmem_max - // net.core.optmem_max - // net.core.somaxconn - // net.ipv4.tcp_rmem - // net.ipv4.tcp_wmem - // net.ipv4.tcp_tw_reuse - map sysctls = 1; - - // cgroup_mode specifies the cgroup mode to be used on the node. - CgroupMode cgroup_mode = 2; -} - -// Parameters that can be configured on Windows nodes. -// Windows Node Config that define the parameters that will be used to -// configure the Windows node pool settings -message WindowsNodeConfig { - // Possible OS version that can be used. - enum OSVersion { - // When OSVersion is not specified - OS_VERSION_UNSPECIFIED = 0; - - // LTSC2019 specifies to use LTSC2019 as the Windows Servercore Base Image - OS_VERSION_LTSC2019 = 1; - - // LTSC2022 specifies to use LTSC2022 as the Windows Servercore Base Image - OS_VERSION_LTSC2022 = 2; - } - - // OSVersion specifies the Windows node config to be used on the node - OSVersion os_version = 1; -} - -// Node kubelet configs. -message NodeKubeletConfig { - // Control the CPU management policy on the node. - // See - // https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/ - // - // The following values are allowed. - // * "none": the default, which represents the existing scheduling behavior. - // * "static": allows pods with certain resource characteristics to be granted - // increased CPU affinity and exclusivity on the node. - // The default value is 'none' if unspecified. - string cpu_manager_policy = 1; - - // Enable CPU CFS quota enforcement for containers that specify CPU limits. - // - // This option is enabled by default which makes kubelet use CFS quota - // (https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt) to - // enforce container CPU limits. Otherwise, CPU limits will not be enforced at - // all. - // - // Disable this option to mitigate CPU throttling problems while still having - // your pods to be in Guaranteed QoS class by specifying the CPU limits. - // - // The default value is 'true' if unspecified. - google.protobuf.BoolValue cpu_cfs_quota = 2; - - // Set the CPU CFS quota period value 'cpu.cfs_period_us'. - // - // The string must be a sequence of decimal numbers, each with optional - // fraction and a unit suffix, such as "300ms". - // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". - // The value must be a positive duration. - string cpu_cfs_quota_period = 3; - - // Set the Pod PID limits. See - // https://kubernetes.io/docs/concepts/policy/pid-limiting/#pod-pid-limits - // - // Controls the maximum number of processes allowed to run in a pod. The value - // must be greater than or equal to 1024 and less than 4194304. - int64 pod_pids_limit = 4; - - // Enable or disable Kubelet read only port. - optional bool insecure_kubelet_readonly_port_enabled = 7; -} - -// Parameters that describe the nodes in a cluster. -// -// GKE Autopilot clusters do not -// recognize parameters in `NodeConfig`. Use -// [AutoprovisioningNodePoolDefaults][google.container.v1beta1.AutoprovisioningNodePoolDefaults] -// instead. -message NodeConfig { - // The name of a Google Compute Engine [machine - // type](https://cloud.google.com/compute/docs/machine-types). - // - // If unspecified, the default machine type is - // `e2-medium`. - string machine_type = 1; - - // Size of the disk attached to each node, specified in GB. - // The smallest allowed disk size is 10GB. - // - // If unspecified, the default disk size is 100GB. - int32 disk_size_gb = 2; - - // The set of Google API scopes to be made available on all of the - // node VMs under the "default" service account. - // - // The following scopes are recommended, but not required, and by default are - // not included: - // - // * `https://www.googleapis.com/auth/compute` is required for mounting - // persistent storage on your nodes. - // * `https://www.googleapis.com/auth/devstorage.read_only` is required for - // communicating with **gcr.io** - // (the [Google Container - // Registry](https://cloud.google.com/container-registry/)). - // - // If unspecified, no scopes are added, unless Cloud Logging or Cloud - // Monitoring are enabled, in which case their required scopes will be added. - repeated string oauth_scopes = 3; - - // The Google Cloud Platform Service Account to be used by the node VMs. - // Specify the email address of the Service Account; otherwise, if no Service - // Account is specified, the "default" service account is used. - string service_account = 9; - - // The metadata key/value pairs assigned to instances in the cluster. - // - // Keys must conform to the regexp `[a-zA-Z0-9-_]+` and be less than 128 bytes - // in length. These are reflected as part of a URL in the metadata server. - // Additionally, to avoid ambiguity, keys must not conflict with any other - // metadata keys for the project or be one of the reserved keys: - // - // - "cluster-location" - // - "cluster-name" - // - "cluster-uid" - // - "configure-sh" - // - "containerd-configure-sh" - // - "enable-oslogin" - // - "gci-ensure-gke-docker" - // - "gci-metrics-enabled" - // - "gci-update-strategy" - // - "instance-template" - // - "kube-env" - // - "startup-script" - // - "user-data" - // - "disable-address-manager" - // - "windows-startup-script-ps1" - // - "common-psm1" - // - "k8s-node-setup-psm1" - // - "install-ssh-psm1" - // - "user-profile-psm1" - // - // Values are free-form strings, and only have meaning as interpreted by - // the image running in the instance. The only restriction placed on them is - // that each value's size must be less than or equal to 32 KB. - // - // The total size of all keys and values must be less than 512 KB. - map metadata = 4; - - // The image type to use for this node. Note that for a given image type, - // the latest version of it will be used. Please see - // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for - // available image types. - string image_type = 5; - - // The map of Kubernetes labels (key/value pairs) to be applied to each node. - // These will added in addition to any default label(s) that - // Kubernetes may apply to the node. - // In case of conflict in label keys, the applied set may differ depending on - // the Kubernetes version -- it's best to assume the behavior is undefined - // and conflicts should be avoided. - // For more information, including usage and the valid values, see: - // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ - map labels = 6; - - // The number of local SSD disks to be attached to the node. - // - // The limit for this value is dependent upon the maximum number of - // disks available on a machine per zone. See: - // https://cloud.google.com/compute/docs/disks/local-ssd - // for more information. - int32 local_ssd_count = 7; - - // The list of instance tags applied to all nodes. Tags are used to identify - // valid sources or targets for network firewalls and are specified by - // the client during cluster or node pool creation. Each tag within the list - // must comply with RFC1035. - repeated string tags = 8; - - // Whether the nodes are created as preemptible VM instances. See: - // https://cloud.google.com/compute/docs/instances/preemptible for more - // information about preemptible VM instances. - bool preemptible = 10; - - // A list of hardware accelerators to be attached to each node. - // See https://cloud.google.com/compute/docs/gpus for more information about - // support for GPUs. - repeated AcceleratorConfig accelerators = 11; - - // Sandbox configuration for this node. - SandboxConfig sandbox_config = 17; - - // Setting this field will assign instances of this - // pool to run on the specified node group. This is useful for running - // workloads on [sole tenant - // nodes](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes). - string node_group = 18; - - // The optional reservation affinity. Setting this field will apply - // the specified [Zonal Compute - // Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) - // to this node pool. - ReservationAffinity reservation_affinity = 19; - - // Type of the disk attached to each node (e.g. 'pd-standard', 'pd-ssd' or - // 'pd-balanced') - // - // If unspecified, the default disk type is 'pd-standard' - string disk_type = 12; - - // Minimum CPU platform to be used by this instance. The instance may be - // scheduled on the specified or newer CPU platform. Applicable values are the - // friendly names of CPU platforms, such as - // `minCpuPlatform: "Intel Haswell"` or - // `minCpuPlatform: "Intel Sandy Bridge"`. For more - // information, read [how to specify min CPU - // platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform). - string min_cpu_platform = 13; - - // The workload metadata configuration for this node. - WorkloadMetadataConfig workload_metadata_config = 14; - - // List of kubernetes taints to be applied to each node. - // - // For more information, including usage and the valid values, see: - // https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ - repeated NodeTaint taints = 15; - - // - // The Customer Managed Encryption Key used to encrypt the boot disk attached - // to each node in the node pool. This should be of the form - // projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. - // For more information about protecting resources with Cloud KMS Keys please - // see: - // https://cloud.google.com/compute/docs/disks/customer-managed-encryption - string boot_disk_kms_key = 23; - - // Shielded Instance options. - ShieldedInstanceConfig shielded_instance_config = 20; - - // Parameters that can be configured on Linux nodes. - LinuxNodeConfig linux_node_config = 21; - - // Node kubelet configs. - NodeKubeletConfig kubelet_config = 22; - - // Parameters for the ephemeral storage filesystem. - // If unspecified, ephemeral storage is backed by the boot disk. - EphemeralStorageConfig ephemeral_storage_config = 24; - - // GCFS (Google Container File System) configs. - GcfsConfig gcfs_config = 25; - - // Advanced features for the Compute Engine VM. - AdvancedMachineFeatures advanced_machine_features = 26; - - // Enable or disable gvnic on the node pool. - VirtualNIC gvnic = 29; - - // Spot flag for enabling Spot VM, which is a rebrand of - // the existing preemptible flag. - bool spot = 32; - - // Confidential nodes config. - // All the nodes in the node pool will be Confidential VM once enabled. - ConfidentialNodes confidential_nodes = 35; - - // Enable or disable NCCL fast socket for the node pool. - optional FastSocket fast_socket = 36; - - // The resource labels for the node pool to use to annotate any related - // Google Compute Engine resources. - map resource_labels = 37; - - // Logging configuration. - NodePoolLoggingConfig logging_config = 38; - - // Parameters that can be configured on Windows nodes. - WindowsNodeConfig windows_node_config = 39; - - // Parameters for using raw-block Local NVMe SSDs. - LocalNvmeSsdBlockConfig local_nvme_ssd_block_config = 40; - - // Parameters for the node ephemeral storage using Local SSDs. - // If unspecified, ephemeral storage is backed by the boot disk. - // This field is functionally equivalent to the ephemeral_storage_config - EphemeralStorageLocalSsdConfig ephemeral_storage_local_ssd_config = 41; - - // Parameters for node pools to be backed by shared sole tenant node groups. - SoleTenantConfig sole_tenant_config = 42; - - // HostMaintenancePolicy contains the desired maintenance policy for the - // Google Compute Engine hosts. - HostMaintenancePolicy host_maintenance_policy = 44; -} - -// Specifies options for controlling advanced machine features. -message AdvancedMachineFeatures { - // The number of threads per physical core. To disable simultaneous - // multithreading (SMT) set this to 1. If unset, the maximum number of threads - // supported per core by the underlying processor is assumed. - optional int64 threads_per_core = 1; -} - -// Parameters for node pool-level network config. -message NodeNetworkConfig { - // Configuration of all network bandwidth tiers - message NetworkPerformanceConfig { - // Node network tier - enum Tier { - // Default value - TIER_UNSPECIFIED = 0; - - // Higher bandwidth, actual values based on VM size. - TIER_1 = 1; - } - - // Specifies the total network bandwidth tier for the NodePool. - optional Tier total_egress_bandwidth_tier = 1; - - // Specifies the network bandwidth tier for the NodePool for traffic to - // external/public IP addresses. - optional Tier external_ip_egress_bandwidth_tier = 2; - } - - // Input only. Whether to create a new range for pod IPs in this node pool. - // Defaults are provided for `pod_range` and `pod_ipv4_cidr_block` if they - // are not specified. - // - // If neither `create_pod_range` or `pod_range` are specified, the - // cluster-level default (`ip_allocation_policy.cluster_ipv4_cidr_block`) is - // used. - // - // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. - // - // This field cannot be changed after the node pool has been created. - bool create_pod_range = 4 [(google.api.field_behavior) = INPUT_ONLY]; - - // The ID of the secondary range for pod IPs. - // If `create_pod_range` is true, this ID is used for the new range. - // If `create_pod_range` is false, uses an existing secondary range with this - // ID. - // - // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. - // - // This field cannot be changed after the node pool has been created. - string pod_range = 5; - - // The IP address range for pod IPs in this node pool. - // - // Only applicable if `create_pod_range` is true. - // - // Set to blank to have a range chosen with the default size. - // - // Set to /netmask (e.g. `/14`) to have a range chosen with a specific - // netmask. - // - // Set to a - // [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`) to pick a specific range to use. - // - // Only applicable if `ip_allocation_policy.use_ip_aliases` is true. - // - // This field cannot be changed after the node pool has been created. - string pod_ipv4_cidr_block = 6; - - // Whether nodes have internal IP addresses only. - // If enable_private_nodes is not specified, then the value is derived from - // [cluster.privateClusterConfig.enablePrivateNodes][google.container.v1beta1.PrivateClusterConfig.enablePrivateNodes] - optional bool enable_private_nodes = 9; - - // Network bandwidth tier configuration. - optional NetworkPerformanceConfig network_performance_config = 11; - - // [PRIVATE FIELD] - // Pod CIDR size overprovisioning config for the nodepool. - // - // Pod CIDR size per node depends on max_pods_per_node. By default, the value - // of max_pods_per_node is rounded off to next power of 2 and we then double - // that to get the size of pod CIDR block per node. - // Example: max_pods_per_node of 30 would result in 64 IPs (/26). - // - // This config can disable the doubling of IPs (we still round off to next - // power of 2) - // Example: max_pods_per_node of 30 will result in 32 IPs (/27) when - // overprovisioning is disabled. - PodCIDROverprovisionConfig pod_cidr_overprovision_config = 13; - - // We specify the additional node networks for this node pool using this list. - // Each node network corresponds to an additional interface - repeated AdditionalNodeNetworkConfig additional_node_network_configs = 14; - - // We specify the additional pod networks for this node pool using this list. - // Each pod network corresponds to an additional alias IP range for the node - repeated AdditionalPodNetworkConfig additional_pod_network_configs = 15; - - // Output only. [Output only] The utilization of the IPv4 range for the pod. - // The ratio is Usage/[Total number of IPs in the secondary range], - // Usage=numNodes*numZones*podIPsPerNode. - double pod_ipv4_range_utilization = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// AdditionalNodeNetworkConfig is the configuration for additional node networks -// within the NodeNetworkConfig message -message AdditionalNodeNetworkConfig { - // Name of the VPC where the additional interface belongs - string network = 1; - - // Name of the subnetwork where the additional interface belongs - string subnetwork = 2; -} - -// AdditionalPodNetworkConfig is the configuration for additional pod networks -// within the NodeNetworkConfig message -message AdditionalPodNetworkConfig { - // Name of the subnetwork where the additional pod network belongs - string subnetwork = 1; - - // The name of the secondary range on the subnet which provides IP address for - // this pod range - string secondary_pod_range = 2; - - // The maximum number of pods per node which use this pod network - optional MaxPodsConstraint max_pods_per_node = 3; -} - -// A set of Shielded Instance options. -message ShieldedInstanceConfig { - // Defines whether the instance has Secure Boot enabled. - // - // Secure Boot helps ensure that the system only runs authentic software by - // verifying the digital signature of all boot components, and halting the - // boot process if signature verification fails. - bool enable_secure_boot = 1; - - // Defines whether the instance has integrity monitoring enabled. - // - // Enables monitoring and attestation of the boot integrity of the instance. - // The attestation is performed against the integrity policy baseline. This - // baseline is initially derived from the implicitly trusted boot image when - // the instance is created. - bool enable_integrity_monitoring = 2; -} - -// SandboxConfig contains configurations of the sandbox to use for the node. -message SandboxConfig { - // Possible types of sandboxes. - enum Type { - // Default value. This should not be used. - UNSPECIFIED = 0; - - // Run sandbox using gvisor. - GVISOR = 1; - } - - // Type of the sandbox to use for the node (e.g. 'gvisor') - string sandbox_type = 1 [deprecated = true]; - - // Type of the sandbox to use for the node. - Type type = 2; -} - -// EphemeralStorageConfig contains configuration for the ephemeral storage -// filesystem. -message EphemeralStorageConfig { - // Number of local SSDs to use to back ephemeral storage. Uses NVMe - // interfaces. Each local SSD is 375 GB in size. - // If zero, it means to disable using local SSDs as ephemeral storage. - int32 local_ssd_count = 1; -} - -// LocalNvmeSsdBlockConfig contains configuration for using raw-block local -// NVMe SSDs -message LocalNvmeSsdBlockConfig { - // The number of raw-block local NVMe SSD disks to be attached to the node. - // Each local SSD is 375 GB in size. If zero, it means no raw-block local NVMe - // SSD disks to be attached to the node. - // The limit for this value is dependent upon the maximum number of - // disks available on a machine per zone. See: - // https://cloud.google.com/compute/docs/disks/local-ssd - // for more information. - int32 local_ssd_count = 1; -} - -// EphemeralStorageLocalSsdConfig contains configuration for the node ephemeral -// storage using Local SSDs. -message EphemeralStorageLocalSsdConfig { - // Number of local SSDs to use to back ephemeral storage. Uses NVMe - // interfaces. Each local SSD is 375 GB in size. - // If zero, it means to disable using local SSDs as ephemeral storage. - // The limit for this value is dependent upon the maximum number of - // disks available on a machine per zone. See: - // https://cloud.google.com/compute/docs/disks/local-ssd - // for more information. - int32 local_ssd_count = 1; -} - -// GcfsConfig contains configurations of Google Container File System. -message GcfsConfig { - // Whether to use GCFS. - bool enabled = 1; -} - -// [ReservationAffinity](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) -// is the configuration of desired reservation which instances could take -// capacity from. -message ReservationAffinity { - // Indicates whether to consume capacity from a reservation or not. - enum Type { - // Default value. This should not be used. - UNSPECIFIED = 0; - - // Do not consume from any reserved capacity. - NO_RESERVATION = 1; - - // Consume any reservation available. - ANY_RESERVATION = 2; - - // Must consume from a specific reservation. Must specify key value fields - // for specifying the reservations. - SPECIFIC_RESERVATION = 3; - } - - // Corresponds to the type of reservation consumption. - Type consume_reservation_type = 1; - - // Corresponds to the label key of a reservation resource. To target a - // SPECIFIC_RESERVATION by name, specify - // "compute.googleapis.com/reservation-name" as the key and specify the name - // of your reservation as its value. - string key = 2; - - // Corresponds to the label value(s) of reservation resource(s). - repeated string values = 3; -} - -// SoleTenantConfig contains the NodeAffinities to specify what shared sole -// tenant node groups should back the node pool. -message SoleTenantConfig { - // Specifies the NodeAffinity key, values, and affinity operator according to - // [shared sole tenant node group - // affinities](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes#node_affinity_and_anti-affinity). - message NodeAffinity { - // Operator allows user to specify affinity or anti-affinity for the - // given key values. - enum Operator { - // Invalid or unspecified affinity operator. - OPERATOR_UNSPECIFIED = 0; - - // Affinity operator. - IN = 1; - - // Anti-affinity operator. - NOT_IN = 2; - } - - // Key for NodeAffinity. - string key = 1; - - // Operator for NodeAffinity. - Operator operator = 2; - - // Values for NodeAffinity. - repeated string values = 3; - } - - // NodeAffinities used to match to a shared sole tenant node group. - repeated NodeAffinity node_affinities = 1; -} - -// HostMaintenancePolicy contains the maintenance policy for the hosts on which -// the GKE VMs run on. -message HostMaintenancePolicy { - // Allows selecting how infrastructure upgrades should be applied to the - // cluster or node pool. - enum MaintenanceInterval { - // The maintenance interval is not explicitly specified. - MAINTENANCE_INTERVAL_UNSPECIFIED = 0; - - // Nodes are eligible to receive infrastructure and hypervisor updates as - // they become available. This may result in more maintenance operations - // (live migrations or terminations) for the node than the PERIODIC option. - AS_NEEDED = 1; - - // Nodes receive infrastructure and hypervisor updates on a periodic basis, - // minimizing the number of maintenance operations (live migrations or - // terminations) on an individual VM. This may mean underlying VMs will - // take longer to receive an update than if it was configured for - // AS_NEEDED. Security updates will still be applied as soon - // as they are available. - PERIODIC = 2; - } - - // Specifies the frequency of planned maintenance events. - optional MaintenanceInterval maintenance_interval = 1; -} - -// Kubernetes taint is composed of three fields: key, value, and effect. Effect -// can only be one of three types: NoSchedule, PreferNoSchedule or NoExecute. -// -// See -// [here](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration) -// for more information, including usage and the valid values. -message NodeTaint { - // Possible values for Effect in taint. - enum Effect { - // Not set - EFFECT_UNSPECIFIED = 0; - - // NoSchedule - NO_SCHEDULE = 1; - - // PreferNoSchedule - PREFER_NO_SCHEDULE = 2; - - // NoExecute - NO_EXECUTE = 3; - } - - // Key for taint. - string key = 1; - - // Value for taint. - string value = 2; - - // Effect for taint. - Effect effect = 3; -} - -// Collection of Kubernetes [node -// taints](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration). -message NodeTaints { - // List of node taints. - repeated NodeTaint taints = 1; -} - -// Collection of node-level [Kubernetes -// labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels). -message NodeLabels { - // Map of node label keys and node label values. - map labels = 1; -} - -// Collection of [GCP -// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels). -message ResourceLabels { - // Map of node label keys and node label values. - map labels = 1; -} - -// Collection of Compute Engine network tags that can be applied to a node's -// underlying VM instance. (See `tags` field in -// [`NodeConfig`](/kubernetes-engine/docs/reference/rest/v1/NodeConfig)). -message NetworkTags { - // List of network tags. - repeated string tags = 1; -} - -// The authentication information for accessing the master endpoint. -// Authentication can be done using HTTP basic auth or using client -// certificates. -message MasterAuth { - // The username to use for HTTP basic authentication to the master endpoint. - // For clusters v1.6.0 and later, basic authentication can be disabled by - // leaving username unspecified (or setting it to the empty string). - // - // Warning: basic authentication is deprecated, and will be removed in GKE - // control plane versions 1.19 and newer. For a list of recommended - // authentication methods, see: - // https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication - string username = 1 [deprecated = true]; - - // The password to use for HTTP basic authentication to the master endpoint. - // Because the master endpoint is open to the Internet, you should create a - // strong password. If a password is provided for cluster creation, username - // must be non-empty. - // - // Warning: basic authentication is deprecated, and will be removed in GKE - // control plane versions 1.19 and newer. For a list of recommended - // authentication methods, see: - // https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication - string password = 2 [deprecated = true]; - - // Configuration for client certificate authentication on the cluster. For - // clusters before v1.12, if no configuration is specified, a client - // certificate is issued. - ClientCertificateConfig client_certificate_config = 3; - - string cluster_ca_certificate = 100; - - // [Output only] Base64-encoded public certificate used by clients to - // authenticate to the cluster endpoint. - string client_certificate = 101; - - // [Output only] Base64-encoded private key used by clients to authenticate - // to the cluster endpoint. - string client_key = 102; -} - -// Configuration for client certificates on the cluster. -message ClientCertificateConfig { - // Issue a client certificate. - bool issue_client_certificate = 1; -} - -// Configuration for the addons that can be automatically spun up in the -// cluster, enabling additional functionality. -message AddonsConfig { - // Configuration for the HTTP (L7) load balancing controller addon, which - // makes it easy to set up HTTP load balancers for services in a cluster. - HttpLoadBalancing http_load_balancing = 1; - - // Configuration for the horizontal pod autoscaling feature, which - // increases or decreases the number of replica pods a replication controller - // has based on the resource usage of the existing pods. - HorizontalPodAutoscaling horizontal_pod_autoscaling = 2; - - // Configuration for the Kubernetes Dashboard. - // This addon is deprecated, and will be disabled in 1.15. It is recommended - // to use the Cloud Console to manage and monitor your Kubernetes clusters, - // workloads and applications. For more information, see: - // https://cloud.google.com/kubernetes-engine/docs/concepts/dashboards - KubernetesDashboard kubernetes_dashboard = 3 [deprecated = true]; - - // Configuration for NetworkPolicy. This only tracks whether the addon - // is enabled or not on the Master, it does not track whether network policy - // is enabled for the nodes. - NetworkPolicyConfig network_policy_config = 4; - - // Configuration for Istio, an open platform to connect, manage, and secure - // microservices. - IstioConfig istio_config = 5 [deprecated = true]; - - // Configuration for the Cloud Run addon. The `IstioConfig` addon must be - // enabled in order to enable Cloud Run addon. This option can only be enabled - // at cluster creation time. - CloudRunConfig cloud_run_config = 7; - - // Configuration for NodeLocalDNS, a dns cache running on cluster nodes - DnsCacheConfig dns_cache_config = 8; - - // Configuration for the ConfigConnector add-on, a Kubernetes - // extension to manage hosted GCP services through the Kubernetes API - ConfigConnectorConfig config_connector_config = 10; - - // Configuration for the Compute Engine Persistent Disk CSI driver. - GcePersistentDiskCsiDriverConfig gce_persistent_disk_csi_driver_config = 11; - - // Configuration for the KALM addon, which manages the lifecycle of k8s - // applications. - KalmConfig kalm_config = 12 [deprecated = true]; - - // Configuration for the GCP Filestore CSI driver. - GcpFilestoreCsiDriverConfig gcp_filestore_csi_driver_config = 14; - - // Configuration for the Backup for GKE agent addon. - GkeBackupAgentConfig gke_backup_agent_config = 16; - - // Configuration for the Cloud Storage Fuse CSI driver. - GcsFuseCsiDriverConfig gcs_fuse_csi_driver_config = 17; -} - -// Configuration options for the HTTP (L7) load balancing controller addon, -// which makes it easy to set up HTTP load balancers for services in a cluster. -message HttpLoadBalancing { - // Whether the HTTP Load Balancing controller is enabled in the cluster. - // When enabled, it runs a small pod in the cluster that manages the load - // balancers. - bool disabled = 1; -} - -// Configuration options for the horizontal pod autoscaling feature, which -// increases or decreases the number of replica pods a replication controller -// has based on the resource usage of the existing pods. -message HorizontalPodAutoscaling { - // Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. - // When enabled, it ensures that metrics are collected into Stackdriver - // Monitoring. - bool disabled = 1; -} - -// Configuration for the Kubernetes Dashboard. -message KubernetesDashboard { - // Whether the Kubernetes Dashboard is enabled for this cluster. - bool disabled = 1; -} - -// Configuration for NetworkPolicy. This only tracks whether the addon -// is enabled or not on the Master, it does not track whether network policy -// is enabled for the nodes. -message NetworkPolicyConfig { - // Whether NetworkPolicy is enabled for this cluster. - bool disabled = 1; -} - -// Configuration for NodeLocal DNSCache -message DnsCacheConfig { - // Whether NodeLocal DNSCache is enabled for this cluster. - bool enabled = 1; -} - -// Configuration options for the KALM addon. -message KalmConfig { - // Whether KALM is enabled for this cluster. - bool enabled = 1 [deprecated = true]; -} - -// Configuration for the Backup for GKE Agent. -message GkeBackupAgentConfig { - // Whether the Backup for GKE agent is enabled for this cluster. - bool enabled = 1; -} - -// Configuration options for the Config Connector add-on. -message ConfigConnectorConfig { - // Whether Cloud Connector is enabled for this cluster. - bool enabled = 1; -} - -// Configuration for the Compute Engine PD CSI driver. -message GcePersistentDiskCsiDriverConfig { - // Whether the Compute Engine PD CSI driver is enabled for this cluster. - bool enabled = 1; -} - -// Configuration for the GCP Filestore CSI driver. -message GcpFilestoreCsiDriverConfig { - // Whether the GCP Filestore CSI driver is enabled for this cluster. - bool enabled = 1; -} - -// Configuration for the Cloud Storage Fuse CSI driver. -message GcsFuseCsiDriverConfig { - // Whether the Cloud Storage Fuse CSI driver is enabled for this cluster. - bool enabled = 1; -} - -// Configuration for controlling master global access settings. -message PrivateClusterMasterGlobalAccessConfig { - // Whenever master is accessible globally or not. - bool enabled = 1; -} - -// Configuration options for private clusters. -message PrivateClusterConfig { - // Whether nodes have internal IP addresses only. If enabled, all nodes are - // given only RFC 1918 private addresses and communicate with the master via - // private networking. - bool enable_private_nodes = 1; - - // Whether the master's internal IP address is used as the cluster endpoint. - bool enable_private_endpoint = 2; - - // The IP range in CIDR notation to use for the hosted master network. This - // range will be used for assigning internal IP addresses to the master or - // set of masters, as well as the ILB VIP. This range must not overlap with - // any other ranges in use within the cluster's network. - string master_ipv4_cidr_block = 3; - - // Output only. The internal IP address of this cluster's master endpoint. - string private_endpoint = 4; - - // Output only. The external IP address of this cluster's master endpoint. - string public_endpoint = 5; - - // Output only. The peering name in the customer VPC used by this cluster. - string peering_name = 7; - - // Controls master global access settings. - PrivateClusterMasterGlobalAccessConfig master_global_access_config = 8; - - // Subnet to provision the master's private endpoint during cluster creation. - // Specified in projects/*/regions/*/subnetworks/* format. - string private_endpoint_subnetwork = 10; -} - -// Configuration options for Istio addon. -message IstioConfig { - // Istio auth mode, https://istio.io/docs/concepts/security/mutual-tls.html - enum IstioAuthMode { - // auth not enabled - AUTH_NONE = 0; - - // auth mutual TLS enabled - AUTH_MUTUAL_TLS = 1; - } - - // Whether Istio is enabled for this cluster. - bool disabled = 1 [deprecated = true]; - - // The specified Istio auth mode, either none, or mutual TLS. - IstioAuthMode auth = 2 [deprecated = true]; -} - -// Configuration options for the Cloud Run feature. -message CloudRunConfig { - // Load balancer type of ingress service of Cloud Run. - enum LoadBalancerType { - // Load balancer type for Cloud Run is unspecified. - LOAD_BALANCER_TYPE_UNSPECIFIED = 0; - - // Install external load balancer for Cloud Run. - LOAD_BALANCER_TYPE_EXTERNAL = 1; - - // Install internal load balancer for Cloud Run. - LOAD_BALANCER_TYPE_INTERNAL = 2; - } - - // Whether Cloud Run addon is enabled for this cluster. - bool disabled = 1; - - // Which load balancer type is installed for Cloud Run. - LoadBalancerType load_balancer_type = 3; -} - -// Configuration options for the master authorized networks feature. Enabled -// master authorized networks will disallow all external traffic to access -// Kubernetes master through HTTPS except traffic from the given CIDR blocks, -// Google Compute Engine Public IPs and Google Prod IPs. -message MasterAuthorizedNetworksConfig { - // CidrBlock contains an optional name and one CIDR block. - message CidrBlock { - // display_name is an optional field for users to identify CIDR blocks. - string display_name = 1; - - // cidr_block must be specified in CIDR notation. - string cidr_block = 2; - } - - // Whether or not master authorized networks is enabled. - bool enabled = 1; - - // cidr_blocks define up to 10 external networks that could access - // Kubernetes master through HTTPS. - repeated CidrBlock cidr_blocks = 2; - - // Whether master is accessbile via Google Compute Engine Public IP addresses. - optional bool gcp_public_cidrs_access_enabled = 3; -} - -// Configuration for the legacy Attribute Based Access Control authorization -// mode. -message LegacyAbac { - // Whether the ABAC authorizer is enabled for this cluster. When enabled, - // identities in the system, including service accounts, nodes, and - // controllers, will have statically granted permissions beyond those - // provided by the RBAC configuration or IAM. - bool enabled = 1; -} - -// Configuration options for the NetworkPolicy feature. -// https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ -message NetworkPolicy { - // Allowed Network Policy providers. - enum Provider { - // Not set - PROVIDER_UNSPECIFIED = 0; - - // Tigera (Calico Felix). - CALICO = 1; - } - - // The selected network policy provider. - Provider provider = 1; - - // Whether network policy is enabled on the cluster. - bool enabled = 2; -} - -// [PRIVATE FIELD] -// Config for pod CIDR size overprovisioning. -message PodCIDROverprovisionConfig { - // Whether Pod CIDR overprovisioning is disabled. - // Note: Pod CIDR overprovisioning is enabled by default. - bool disable = 1; -} - -// Configuration for controlling how IPs are allocated in the cluster. -message IPAllocationPolicy { - // Possible values for IP stack type - enum StackType { - // By default, the clusters will be IPV4 only - STACK_TYPE_UNSPECIFIED = 0; - - // The value used if the cluster is a IPV4 only - IPV4 = 1; - - // The value used if the cluster is a dual stack cluster - IPV4_IPV6 = 2; - } - - // IPv6 access type - enum IPv6AccessType { - // Default value, will be defaulted as type external. - IPV6_ACCESS_TYPE_UNSPECIFIED = 0; - - // Access type internal (all v6 addresses are internal IPs) - INTERNAL = 1; - - // Access type external (all v6 addresses are external IPs) - EXTERNAL = 2; - } - - // Whether alias IPs will be used for pod IPs in the cluster. - // This is used in conjunction with use_routes. It cannot - // be true if use_routes is true. If both use_ip_aliases and use_routes are - // false, then the server picks the default IP allocation mode - bool use_ip_aliases = 1; - - // Whether a new subnetwork will be created automatically for the cluster. - // - // This field is only applicable when `use_ip_aliases` is true. - bool create_subnetwork = 2; - - // A custom subnetwork name to be used if `create_subnetwork` is true. If - // this field is empty, then an automatic name will be chosen for the new - // subnetwork. - string subnetwork_name = 3; - - // This field is deprecated, use cluster_ipv4_cidr_block. - string cluster_ipv4_cidr = 4 [deprecated = true]; - - // This field is deprecated, use node_ipv4_cidr_block. - string node_ipv4_cidr = 5 [deprecated = true]; - - // This field is deprecated, use services_ipv4_cidr_block. - string services_ipv4_cidr = 6 [deprecated = true]; - - // The name of the secondary range to be used for the cluster CIDR - // block. The secondary range will be used for pod IP - // addresses. This must be an existing secondary range associated - // with the cluster subnetwork. - // - // This field is only applicable with use_ip_aliases and - // create_subnetwork is false. - string cluster_secondary_range_name = 7; - - // The name of the secondary range to be used as for the services - // CIDR block. The secondary range will be used for service - // ClusterIPs. This must be an existing secondary range associated - // with the cluster subnetwork. - // - // This field is only applicable with use_ip_aliases and - // create_subnetwork is false. - string services_secondary_range_name = 8; - - // The IP address range for the cluster pod IPs. If this field is set, then - // `cluster.cluster_ipv4_cidr` must be left blank. - // - // This field is only applicable when `use_ip_aliases` is true. - // - // Set to blank to have a range chosen with the default size. - // - // Set to /netmask (e.g. `/14`) to have a range chosen with a specific - // netmask. - // - // Set to a - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. - // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range - // to use. - string cluster_ipv4_cidr_block = 9; - - // The IP address range of the instance IPs in this cluster. - // - // This is applicable only if `create_subnetwork` is true. - // - // Set to blank to have a range chosen with the default size. - // - // Set to /netmask (e.g. `/14`) to have a range chosen with a specific - // netmask. - // - // Set to a - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. - // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range - // to use. - string node_ipv4_cidr_block = 10; - - // The IP address range of the services IPs in this cluster. If blank, a range - // will be automatically chosen with the default size. - // - // This field is only applicable when `use_ip_aliases` is true. - // - // Set to blank to have a range chosen with the default size. - // - // Set to /netmask (e.g. `/14`) to have a range chosen with a specific - // netmask. - // - // Set to a - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. - // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range - // to use. - string services_ipv4_cidr_block = 11; - - // If true, allow allocation of cluster CIDR ranges that overlap with certain - // kinds of network routes. By default we do not allow cluster CIDR ranges to - // intersect with any user declared routes. With allow_route_overlap == true, - // we allow overlapping with CIDR ranges that are larger than the cluster CIDR - // range. - // - // If this field is set to true, then cluster and services CIDRs must be - // fully-specified (e.g. `10.96.0.0/14`, but not `/14`), which means: - // 1) When `use_ip_aliases` is true, `cluster_ipv4_cidr_block` and - // `services_ipv4_cidr_block` must be fully-specified. - // 2) When `use_ip_aliases` is false, `cluster.cluster_ipv4_cidr` muse be - // fully-specified. - bool allow_route_overlap = 12; - - // The IP address range of the Cloud TPUs in this cluster. If unspecified, a - // range will be automatically chosen with the default size. - // - // This field is only applicable when `use_ip_aliases` is true. - // - // If unspecified, the range will use the default size. - // - // Set to /netmask (e.g. `/14`) to have a range chosen with a specific - // netmask. - // - // Set to a - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. - // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range - // to use. - // This field is deprecated, use cluster.tpu_config.ipv4_cidr_block instead. - string tpu_ipv4_cidr_block = 13; - - // Whether routes will be used for pod IPs in the cluster. - // This is used in conjunction with use_ip_aliases. It cannot be true if - // use_ip_aliases is true. If both use_ip_aliases and use_routes are false, - // then the server picks the default IP allocation mode - bool use_routes = 15; - - // IP stack type - StackType stack_type = 16; - - // The ipv6 access type (internal or external) when create_subnetwork is true - IPv6AccessType ipv6_access_type = 17; - - // [PRIVATE FIELD] - // Pod CIDR size overprovisioning config for the cluster. - // - // Pod CIDR size per node depends on max_pods_per_node. By default, the value - // of max_pods_per_node is doubled and then rounded off to next power of 2 to - // get the size of pod CIDR block per node. - // Example: max_pods_per_node of 30 would result in 64 IPs (/26). - // - // This config can disable the doubling of IPs (we still round off to next - // power of 2) - // Example: max_pods_per_node of 30 will result in 32 IPs (/27) when - // overprovisioning is disabled. - PodCIDROverprovisionConfig pod_cidr_overprovision_config = 21; - - // Output only. [Output only] The subnet's IPv6 CIDR block used by nodes and - // pods. - string subnet_ipv6_cidr_block = 22 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Output only] The services IPv6 CIDR block for the cluster. - string services_ipv6_cidr_block = 23 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Output only] The additional pod ranges that are added to the - // cluster. These pod ranges can be used by new node pools to allocate pod IPs - // automatically. Once the range is removed it will not show up in - // IPAllocationPolicy. - AdditionalPodRangesConfig additional_pod_ranges_config = 24 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Output only] The utilization of the cluster default IPv4 - // range for the pod. The ratio is Usage/[Total number of IPs in the secondary - // range], Usage=numNodes*numZones*podIPsPerNode. - double default_pod_ipv4_range_utilization = 25 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Configuration for Binary Authorization. -message BinaryAuthorization { - // Binary Authorization mode of operation. - enum EvaluationMode { - // Default value - EVALUATION_MODE_UNSPECIFIED = 0; - - // Disable BinaryAuthorization - DISABLED = 1; - - // Enforce Kubernetes admission requests with BinaryAuthorization using the - // project's singleton policy. This is equivalent to setting the - // enabled boolean to true. - PROJECT_SINGLETON_POLICY_ENFORCE = 2; - - // Use Binary Authorization with the policies specified in policy_bindings. - POLICY_BINDINGS = 5; - - // Use Binary Authorization with the policies specified in policy_bindings, - // and also with the project's singleton policy in enforcement mode. - POLICY_BINDINGS_AND_PROJECT_SINGLETON_POLICY_ENFORCE = 6; - } - - // Binauthz policy that applies to this cluster. - message PolicyBinding { - // The relative resource name of the binauthz platform policy to audit. GKE - // platform policies have the following format: - // `projects/{project_number}/platforms/gke/policies/{policy_id}`. - optional string name = 1; - } - - // This field is deprecated. Leave this unset and instead configure - // BinaryAuthorization using evaluation_mode. If evaluation_mode is set to - // anything other than EVALUATION_MODE_UNSPECIFIED, this field is ignored. - bool enabled = 1 [deprecated = true]; - - // Mode of operation for binauthz policy evaluation. If unspecified, defaults - // to DISABLED. - EvaluationMode evaluation_mode = 2; - - // Optional. Binauthz policies that apply to this cluster. - repeated PolicyBinding policy_bindings = 5 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Configuration for the PodSecurityPolicy feature. -message PodSecurityPolicyConfig { - // Enable the PodSecurityPolicy controller for this cluster. If enabled, pods - // must be valid under a PodSecurityPolicy to be created. - bool enabled = 1; -} - -// Configuration for returning group information from authenticators. -message AuthenticatorGroupsConfig { - // Whether this cluster should return group membership lookups - // during authentication using a group of security groups. - bool enabled = 1; - - // The name of the security group-of-groups to be used. Only relevant - // if enabled = true. - string security_group = 2; -} - -// Telemetry integration for the cluster. -message ClusterTelemetry { - // Type of the integration. - enum Type { - // Not set. - UNSPECIFIED = 0; - - // Monitoring integration is disabled. - DISABLED = 1; - - // Monitoring integration is enabled. - ENABLED = 2; - - // Only system components are monitored and logged. - SYSTEM_ONLY = 3; - } - - // Type of the integration. - Type type = 1; -} - -// A Google Kubernetes Engine cluster. -message Cluster { - // The current status of the cluster. - enum Status { - // Not set. - STATUS_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 master or node software. Details can - // be found in the `statusMessage` field. - RECONCILING = 3; - - // The STOPPING state indicates the cluster is being deleted. - STOPPING = 4; - - // The ERROR state indicates the cluster may be unusable. Details - // can be found in the `statusMessage` field. - ERROR = 5; - - // The DEGRADED state indicates the cluster requires user action to restore - // full functionality. Details can be found in the `statusMessage` field. - DEGRADED = 6; - } - - // The name of this cluster. The name must be unique within this project - // and location (e.g. zone or region), and can be up to 40 characters with - // the following restrictions: - // - // * Lowercase letters, numbers, and hyphens only. - // * Must start with a letter. - // * Must end with a number or a letter. - string name = 1; - - // An optional description of this cluster. - string description = 2; - - // The number of nodes to create in this cluster. You must ensure that your - // Compute Engine [resource quota](https://cloud.google.com/compute/quotas) - // is sufficient for this number of instances. You must also have available - // firewall and routes quota. - // For requests, this field should only be used in lieu of a - // "node_pool" object, since this configuration (along with the - // "node_config") will be used to create a "NodePool" object with an - // auto-generated name. Do not use this and a node_pool at the same time. - // - // This field is deprecated, use node_pool.initial_node_count instead. - int32 initial_node_count = 3 [deprecated = true]; - - // Parameters used in creating the cluster's nodes. - // For requests, this field should only be used in lieu of a - // "node_pool" object, since this configuration (along with the - // "initial_node_count") will be used to create a "NodePool" object with an - // auto-generated name. Do not use this and a node_pool at the same time. - // For responses, this field will be populated with the node configuration of - // the first node pool. (For configuration of each node pool, see - // `node_pool.config`) - // - // If unspecified, the defaults are used. - // This field is deprecated, use node_pool.config instead. - NodeConfig node_config = 4 [deprecated = true]; - - // The authentication information for accessing the master endpoint. - // If unspecified, the defaults are used: - // For clusters before v1.12, if master_auth is unspecified, `username` will - // be set to "admin", a random password will be generated, and a client - // certificate will be issued. - MasterAuth master_auth = 5; - - // The logging service the cluster should use to write logs. - // Currently available options: - // - // * `logging.googleapis.com/kubernetes` - The Cloud Logging - // service with a Kubernetes-native resource model - // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer - // available as of GKE 1.15). - // * `none` - no logs will be exported from the cluster. - // - // If left as an empty string,`logging.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. - string logging_service = 6; - - // The monitoring service the cluster should use to write metrics. - // Currently available options: - // - // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring - // service with a Kubernetes-native resource model - // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no - // longer available as of GKE 1.15). - // * `none` - No metrics will be exported from the cluster. - // - // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. - string monitoring_service = 7; - - // The name of the Google Compute Engine - // [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) - // to which the cluster is connected. If left unspecified, the `default` - // network will be used. On output this shows the network ID instead of the - // name. - string network = 8; - - // The IP address range of the container pods in this cluster, in - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `10.96.0.0/14`). Leave blank to have - // one automatically chosen or specify a `/14` block in `10.0.0.0/8`. - string cluster_ipv4_cidr = 9; - - // Configurations for the various addons available to run in the cluster. - AddonsConfig addons_config = 10; - - // The name of the Google Compute Engine - // [subnetwork](https://cloud.google.com/compute/docs/subnetworks) to which - // the cluster is connected. On output this shows the subnetwork ID instead of - // the name. - string subnetwork = 11; - - // The node pools associated with this cluster. - // This field should not be set if "node_config" or "initial_node_count" are - // specified. - repeated NodePool node_pools = 12; - - // The list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster's nodes should be located. - // - // This field provides a default value if - // [NodePool.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools#NodePool.FIELDS.locations) - // are not specified during node pool creation. - // - // Warning: changing cluster locations will update the - // [NodePool.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools#NodePool.FIELDS.locations) - // of all node pools and will result in nodes being added and/or removed. - repeated string locations = 13; - - // Kubernetes alpha features are enabled on this cluster. This includes alpha - // API groups (e.g. v1beta1) and features that may not be production ready in - // the kubernetes version of the master and nodes. - // The cluster has no SLA for uptime and master/node upgrades are disabled. - // Alpha enabled clusters are automatically deleted thirty days after - // creation. - bool enable_kubernetes_alpha = 14; - - // Kubernetes open source beta apis enabled on the cluster. Only beta apis. - K8sBetaAPIConfig enable_k8s_beta_apis = 143; - - // The resource labels for the cluster to use to annotate any related - // Google Compute Engine resources. - map resource_labels = 15; - - // The fingerprint of the set of labels for this cluster. - string label_fingerprint = 16; - - // Configuration for the legacy ABAC authorization mode. - LegacyAbac legacy_abac = 18; - - // Configuration options for the NetworkPolicy feature. - NetworkPolicy network_policy = 19; - - // Configuration for cluster IP allocation. - IPAllocationPolicy ip_allocation_policy = 20; - - // The configuration options for master authorized networks feature. - MasterAuthorizedNetworksConfig master_authorized_networks_config = 22; - - // Configure the maintenance policy for this cluster. - MaintenancePolicy maintenance_policy = 23; - - // Configuration for Binary Authorization. - BinaryAuthorization binary_authorization = 24; - - // Configuration for the PodSecurityPolicy feature. - PodSecurityPolicyConfig pod_security_policy_config = 25; - - // Cluster-level autoscaling configuration. - ClusterAutoscaling autoscaling = 26; - - // Configuration for cluster networking. - NetworkConfig network_config = 27; - - // If this is a private cluster setup. Private clusters are clusters that, by - // default have no external IP addresses on the nodes and where nodes and the - // master communicate over private IP addresses. - // This field is deprecated, use private_cluster_config.enable_private_nodes - // instead. - bool private_cluster = 28 [deprecated = true]; - - // The IP prefix in CIDR notation to use for the hosted master network. - // This prefix will be used for assigning private IP addresses to the - // master or set of masters, as well as the ILB VIP. - // This field is deprecated, use - // private_cluster_config.master_ipv4_cidr_block instead. - string master_ipv4_cidr_block = 29 [deprecated = true]; - - // The default constraint on the maximum number of pods that can be run - // simultaneously on a node in the node pool of this cluster. Only honored - // if cluster created with IP Alias support. - MaxPodsConstraint default_max_pods_constraint = 30; - - // Configuration for exporting resource usages. Resource usage export is - // disabled when this config unspecified. - ResourceUsageExportConfig resource_usage_export_config = 33; - - // Configuration controlling RBAC group membership information. - AuthenticatorGroupsConfig authenticator_groups_config = 34; - - // Configuration for private cluster. - PrivateClusterConfig private_cluster_config = 37; - - // Cluster-level Vertical Pod Autoscaling configuration. - VerticalPodAutoscaling vertical_pod_autoscaling = 39; - - // Shielded Nodes configuration. - ShieldedNodes shielded_nodes = 40; - - // Release channel configuration. If left unspecified on cluster creation and - // a version is specified, the cluster is enrolled in the most mature release - // channel where the version is available (first checking STABLE, then - // REGULAR, and finally RAPID). Otherwise, if no release channel - // configuration and no version is specified, the cluster is enrolled in the - // REGULAR channel with its default version. - ReleaseChannel release_channel = 41; - - // Configuration for the use of Kubernetes Service Accounts in GCP IAM - // policies. - WorkloadIdentityConfig workload_identity_config = 43; - - // Configuration for issuance of mTLS keys and certificates to Kubernetes - // pods. - WorkloadCertificates workload_certificates = 52; - - // Configuration for issuance of mTLS keys and certificates to Kubernetes - // pods. - MeshCertificates mesh_certificates = 67; - - // Configuration for direct-path (via ALTS) with workload identity. - WorkloadALTSConfig workload_alts_config = 53; - - // Configuration for the fine-grained cost management feature. - CostManagementConfig cost_management_config = 45; - - // Telemetry integration for the cluster. - ClusterTelemetry cluster_telemetry = 46; - - // Configuration for Cloud TPU support; - TpuConfig tpu_config = 47; - - // Notification configuration of the cluster. - NotificationConfig notification_config = 49; - - // Configuration of Confidential Nodes. - // All the nodes in the cluster will be Confidential VM once enabled. - ConfidentialNodes confidential_nodes = 50; - - // Configuration for Identity Service component. - IdentityServiceConfig identity_service_config = 54; - - // [Output only] Server-defined URL for the resource. - string self_link = 100; - - // [Output only] The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field is deprecated, use location instead. - string zone = 101 [deprecated = true]; - - // [Output only] The IP address of this cluster's master endpoint. - // The endpoint can be accessed from the internet at - // `https://username:password@endpoint/`. - // - // See the `masterAuth` property of this resource for username and - // password information. - string endpoint = 102; - - // The initial Kubernetes version for this cluster. Valid versions are those - // found in validMasterVersions returned by getServerConfig. The version can - // be upgraded over time; such upgrades are reflected in - // currentMasterVersion and currentNodeVersion. - // - // Users may specify either explicit versions offered by - // Kubernetes Engine or version aliases, which have the following behavior: - // - // - "latest": picks the highest valid Kubernetes version - // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - // - "1.X.Y-gke.N": picks an explicit Kubernetes version - // - "","-": picks the default Kubernetes version - string initial_cluster_version = 103; - - // [Output only] The current software version of the master endpoint. - string current_master_version = 104; - - // [Output only] Deprecated, use - // [NodePool.version](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters.nodePools) - // instead. The current version of the node software components. - // If they are currently at multiple versions because they're in the process - // of being upgraded, this reflects the minimum version of all nodes. - string current_node_version = 105 [deprecated = true]; - - // [Output only] The time the cluster was created, in - // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string create_time = 106; - - // [Output only] The current status of this cluster. - Status status = 107; - - // [Output only] Deprecated. Use conditions instead. - // Additional information about the current status of this - // cluster, if available. - string status_message = 108 [deprecated = true]; - - // [Output only] The size of the address space on each node for hosting - // containers. This is provisioned from within the `container_ipv4_cidr` - // range. This field will only be set when cluster is in route-based network - // mode. - int32 node_ipv4_cidr_size = 109; - - // [Output only] The IP address range of the Kubernetes services in - // this cluster, in - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `1.2.3.4/29`). Service addresses are - // typically put in the last `/16` from the container CIDR. - string services_ipv4_cidr = 110; - - // Deprecated. Use node_pools.instance_group_urls. - repeated string instance_group_urls = 111 [deprecated = true]; - - // [Output only] The number of nodes currently in the cluster. Deprecated. - // Call Kubernetes API directly to retrieve node information. - int32 current_node_count = 112 [deprecated = true]; - - // [Output only] The time the cluster will be automatically - // deleted in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string expire_time = 113; - - // [Output only] The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) - // or - // [region](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) - // in which the cluster resides. - string location = 114; - - // Enable the ability to use Cloud TPUs in this cluster. - // This field is deprecated, use tpu_config.enabled instead. - bool enable_tpu = 115; - - // [Output only] The IP address range of the Cloud TPUs in this cluster, in - // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - // notation (e.g. `1.2.3.4/29`). - string tpu_ipv4_cidr_block = 116; - - // Configuration of etcd encryption. - DatabaseEncryption database_encryption = 38; - - // Which conditions caused the current cluster state. - repeated StatusCondition conditions = 118; - - // Configuration for master components. - Master master = 124; - - // Autopilot configuration for the cluster. - Autopilot autopilot = 128; - - // Output only. Unique id for the cluster. - string id = 129 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Default NodePool settings for the entire cluster. These settings are - // overridden if specified on the specific NodePool object. - optional NodePoolDefaults node_pool_defaults = 131; - - // Logging configuration for the cluster. - LoggingConfig logging_config = 132; - - // Monitoring configuration for the cluster. - MonitoringConfig monitoring_config = 133; - - // Node pool configs that apply to all auto-provisioned node pools - // in autopilot clusters and node auto-provisioning enabled clusters. - NodePoolAutoConfig node_pool_auto_config = 136; - - // Enable/Disable Protect API features for the cluster. - optional ProtectConfig protect_config = 137; - - // This checksum is computed by the server based on the value of cluster - // fields, and may be sent on update requests to ensure the client has an - // up-to-date value before proceeding. - string etag = 139; - - // Fleet information for the cluster. - Fleet fleet = 140; - - // Enable/Disable Security Posture API features for the cluster. - SecurityPostureConfig security_posture_config = 145; -} - -// Kubernetes open source beta apis enabled on the cluster. -message K8sBetaAPIConfig { - // api name, e.g. storage.k8s.io/v1beta1/csistoragecapacities. - repeated string enabled_apis = 1; -} - -// WorkloadConfig defines the flags to enable or disable the -// workload configurations for the cluster. -message WorkloadConfig { - // Mode defines how to audit the workload configs. - enum Mode { - // Default value meaning that no mode has been specified. - MODE_UNSPECIFIED = 0; - - // This disables Workload Configuration auditing on the cluster, - // meaning that nothing is surfaced. - DISABLED = 1; - - // Applies the default set of policy auditing to a cluster's workloads. - BASIC = 4; - - // Surfaces configurations that are not in line with the - // Pod Security Standard Baseline policy. - BASELINE = 2 [deprecated = true]; - - // Surfaces configurations that are not in line with the - // Pod Security Standard Restricted policy. - RESTRICTED = 3 [deprecated = true]; - } - - // Sets which mode of auditing should be used for the cluster's workloads. - optional Mode audit_mode = 1; -} - -// ProtectConfig defines the flags needed to enable/disable features for the -// Protect API. -message ProtectConfig { - // WorkloadVulnerabilityMode defines mode to perform vulnerability scanning. - enum WorkloadVulnerabilityMode { - // Default value not specified. - WORKLOAD_VULNERABILITY_MODE_UNSPECIFIED = 0; - - // Disables Workload Vulnerability Scanning feature on the cluster. - DISABLED = 1; - - // Applies basic vulnerability scanning settings for cluster workloads. - BASIC = 2; - } - - // WorkloadConfig defines which actions are enabled for a cluster's workload - // configurations. - optional WorkloadConfig workload_config = 1; - - // Sets which mode to use for Protect workload vulnerability scanning feature. - optional WorkloadVulnerabilityMode workload_vulnerability_mode = 2; -} - -// SecurityPostureConfig defines the flags needed to enable/disable features for -// the Security Posture API. -message SecurityPostureConfig { - // Mode defines enablement mode for GKE Security posture features. - enum Mode { - // Default value not specified. - MODE_UNSPECIFIED = 0; - - // Disables Security Posture features on the cluster. - DISABLED = 1; - - // Applies Security Posture features on the cluster. - BASIC = 2; - } - - // VulnerabilityMode defines enablement mode for vulnerability scanning. - enum VulnerabilityMode { - // Default value not specified. - VULNERABILITY_MODE_UNSPECIFIED = 0; - - // Disables vulnerability scanning on the cluster. - VULNERABILITY_DISABLED = 1; - - // Applies basic vulnerability scanning on the cluster. - VULNERABILITY_BASIC = 2; - } - - // Sets which mode to use for Security Posture features. - optional Mode mode = 1; - - // Sets which mode to use for vulnerability scanning. - optional VulnerabilityMode vulnerability_mode = 2; -} - -// Subset of Nodepool message that has defaults. -message NodePoolDefaults { - // Subset of NodeConfig message that has defaults. - NodeConfigDefaults node_config_defaults = 1; -} - -// Subset of NodeConfig message that has defaults. -message NodeConfigDefaults { - // GCFS (Google Container File System, also known as Riptide) options. - GcfsConfig gcfs_config = 1; - - // Logging configuration for node pools. - NodePoolLoggingConfig logging_config = 3; - - // HostMaintenancePolicy contains the desired maintenance policy for the - // Google Compute Engine hosts. - HostMaintenancePolicy host_maintenance_policy = 5; -} - -// node pool configs that apply to all auto-provisioned node pools -// in autopilot clusters and node auto-provisioning enabled clusters -message NodePoolAutoConfig { - // The list of instance tags applied to all nodes. Tags are used to identify - // valid sources or targets for network firewalls and are specified by - // the client during cluster creation. Each tag within the list - // must comply with RFC1035. - NetworkTags network_tags = 1; -} - -// ClusterUpdate describes an update to the cluster. Exactly one update can -// be applied to a cluster with each request, so at most one field can be -// provided. -message ClusterUpdate { - // The Kubernetes version to change the nodes to (typically an - // upgrade). - // - // Users may specify either explicit versions offered by - // Kubernetes Engine or version aliases, which have the following behavior: - // - // - "latest": picks the highest valid Kubernetes version - // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - // - "1.X.Y-gke.N": picks an explicit Kubernetes version - // - "-": picks the Kubernetes master version - string desired_node_version = 4; - - // The monitoring service the cluster should use to write metrics. - // Currently available options: - // - // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring - // service with a Kubernetes-native resource model - // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no - // longer available as of GKE 1.15). - // * `none` - No metrics will be exported from the cluster. - // - // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. - string desired_monitoring_service = 5; - - // Configurations for the various addons available to run in the cluster. - AddonsConfig desired_addons_config = 6; - - // The node pool to be upgraded. This field is mandatory if - // "desired_node_version", "desired_image_family", - // "desired_node_pool_autoscaling", or "desired_workload_metadata_config" - // is specified and there is more than one node pool on the cluster. - string desired_node_pool_id = 7; - - // The desired image type for the node pool. - // NOTE: Set the "desired_node_pool" field as well. - string desired_image_type = 8; - - // Autoscaler configuration for the node pool specified in - // desired_node_pool_id. If there is only one pool in the - // cluster and desired_node_pool_id is not provided then - // the change applies to that single node pool. - NodePoolAutoscaling desired_node_pool_autoscaling = 9; - - // The desired list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster's nodes should be located. - // - // This list must always include the cluster's primary zone. - // - // Warning: changing cluster locations will update the locations of all node - // pools and will result in nodes being added and/or removed. - repeated string desired_locations = 10; - - // The desired configuration options for master authorized networks feature. - MasterAuthorizedNetworksConfig desired_master_authorized_networks_config = 12; - - // The desired configuration options for the PodSecurityPolicy feature. - PodSecurityPolicyConfig desired_pod_security_policy_config = 14; - - // Cluster-level autoscaling configuration. - ClusterAutoscaling desired_cluster_autoscaling = 15; - - // The desired configuration options for the Binary Authorization feature. - BinaryAuthorization desired_binary_authorization = 16; - - // The logging service the cluster should use to write logs. - // Currently available options: - // - // * `logging.googleapis.com/kubernetes` - The Cloud Logging - // service with a Kubernetes-native resource model - // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer - // available as of GKE 1.15). - // * `none` - no logs will be exported from the cluster. - // - // If left as an empty string,`logging.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. - string desired_logging_service = 19; - - // The desired configuration for exporting resource usage. - ResourceUsageExportConfig desired_resource_usage_export_config = 21; - - // Cluster-level Vertical Pod Autoscaling configuration. - VerticalPodAutoscaling desired_vertical_pod_autoscaling = 22; - - // The desired private cluster configuration. - PrivateClusterConfig desired_private_cluster_config = 25; - - // The desired config of Intra-node visibility. - IntraNodeVisibilityConfig desired_intra_node_visibility_config = 26; - - // The desired status of whether to disable default sNAT for this cluster. - DefaultSnatStatus desired_default_snat_status = 28; - - // The desired telemetry integration for the cluster. - ClusterTelemetry desired_cluster_telemetry = 30; - - // The desired release channel configuration. - ReleaseChannel desired_release_channel = 31; - - // The desired Cloud TPU configuration. - TpuConfig desired_tpu_config = 38; - - // The desired L4 Internal Load Balancer Subsetting configuration. - ILBSubsettingConfig desired_l4ilb_subsetting_config = 39; - - // The desired datapath provider for the cluster. - DatapathProvider desired_datapath_provider = 50; - - // The desired state of IPv6 connectivity to Google Services. - PrivateIPv6GoogleAccess desired_private_ipv6_google_access = 51; - - // The desired notification configuration. - NotificationConfig desired_notification_config = 55; - - // The Kubernetes version to change the master to. The only valid value is the - // latest supported version. - // - // Users may specify either explicit versions offered by - // Kubernetes Engine or version aliases, which have the following behavior: - // - // - "latest": picks the highest valid Kubernetes version - // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - // - "1.X.Y-gke.N": picks an explicit Kubernetes version - // - "-": picks the default Kubernetes version - string desired_master_version = 100; - - // The desired GCFS config for the cluster. - GcfsConfig desired_gcfs_config = 109; - - // Configuration of etcd encryption. - DatabaseEncryption desired_database_encryption = 46; - - // Configuration for Workload Identity. - WorkloadIdentityConfig desired_workload_identity_config = 47; - - // Configuration for issuance of mTLS keys and certificates to Kubernetes - // pods. - WorkloadCertificates desired_workload_certificates = 61; - - // Configuration for issuance of mTLS keys and certificates to Kubernetes - // pods. - MeshCertificates desired_mesh_certificates = 67; - - // Configuration for direct-path (via ALTS) with workload identity. - WorkloadALTSConfig desired_workload_alts_config = 62; - - // Configuration for Shielded Nodes. - ShieldedNodes desired_shielded_nodes = 48; - - // The desired configuration for the fine-grained cost management feature. - CostManagementConfig desired_cost_management_config = 49; - - // Configuration for master components. - Master desired_master = 52; - - // DNSConfig contains clusterDNS config for this cluster. - DNSConfig desired_dns_config = 53; - - // ServiceExternalIPsConfig specifies the config for the use of Services with - // ExternalIPs field. - ServiceExternalIPsConfig desired_service_external_ips_config = 60; - - // AuthenticatorGroupsConfig specifies the config for the cluster security - // groups settings. - AuthenticatorGroupsConfig desired_authenticator_groups_config = 63; - - // The desired logging configuration. - LoggingConfig desired_logging_config = 64; - - // The desired monitoring configuration. - MonitoringConfig desired_monitoring_config = 65; - - // The desired Identity Service component configuration. - IdentityServiceConfig desired_identity_service_config = 66; - - // Enable/Disable private endpoint for the cluster's master. - optional bool desired_enable_private_endpoint = 71; - - // The desired network tags that apply to all auto-provisioned node pools - // in autopilot clusters and node auto-provisioning enabled clusters. - NetworkTags desired_node_pool_auto_config_network_tags = 110; - - // Enable/Disable Protect API features for the cluster. - optional ProtectConfig desired_protect_config = 112; - - // The desired config of Gateway API on this cluster. - GatewayAPIConfig desired_gateway_api_config = 114; - - // The current etag of the cluster. - // If an etag is provided and does not match the current etag of the cluster, - // update will be blocked and an ABORTED error will be returned. - string etag = 115; - - // The desired node pool logging configuration defaults for the cluster. - NodePoolLoggingConfig desired_node_pool_logging_config = 116; - - // The desired fleet configuration for the cluster. - Fleet desired_fleet = 117; - - // The desired stack type of the cluster. - // If a stack type is provided and does not match the current stack type of - // the cluster, update will attempt to change the stack type to the new type. - StackType desired_stack_type = 119; - - // The additional pod ranges to be added to the cluster. These pod ranges - // can be used by node pools to allocate pod IPs. - AdditionalPodRangesConfig additional_pod_ranges_config = 120; - - // The additional pod ranges that are to be removed from the cluster. - // The pod ranges specified here must have been specified earlier in the - // 'additional_pod_ranges_config' argument. - AdditionalPodRangesConfig removed_additional_pod_ranges_config = 121; - - // Kubernetes open source beta apis enabled on the cluster. Only beta apis - K8sBetaAPIConfig enable_k8s_beta_apis = 122; - - // Enable/Disable Security Posture API features for the cluster. - SecurityPostureConfig desired_security_posture_config = 124; - - // The desired network performance config. - NetworkConfig.ClusterNetworkPerformanceConfig - desired_network_performance_config = 125; - - // Enable/Disable FQDN Network Policy for the cluster. - optional bool desired_enable_fqdn_network_policy = 126; - - // The desired workload policy configuration for the autopilot cluster. - WorkloadPolicyConfig desired_autopilot_workload_policy_config = 128; - - // Beta APIs enabled for cluster. - K8sBetaAPIConfig desired_k8s_beta_apis = 131; - - // HostMaintenancePolicy contains the desired maintenance policy for the - // Google Compute Engine hosts. - HostMaintenancePolicy desired_host_maintenance_policy = 132; -} - -// AdditionalPodRangesConfig is the configuration for additional pod secondary -// ranges supporting the ClusterUpdate message. -message AdditionalPodRangesConfig { - // Name for pod secondary ipv4 range which has the actual range defined ahead. - repeated string pod_range_names = 1; - - // Output only. [Output only] Information for additional pod range. - repeated RangeInfo pod_range_info = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// RangeInfo contains the range name and the range utilization by this cluster. -message RangeInfo { - // Output only. [Output only] Name of a range. - string range_name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Output only] The utilization of the range. - double utilization = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// This operation resource represents operations that may have happened or are -// happening on the cluster. All fields are output only. -message Operation { - // Current status of the operation. - enum Status { - // Not set. - STATUS_UNSPECIFIED = 0; - - // The operation has been created. - PENDING = 1; - - // The operation is currently running. - RUNNING = 2; - - // The operation is done, either cancelled or completed. - DONE = 3; - - // The operation is aborting. - ABORTING = 4; - } - - // Operation type categorizes the operation. - enum Type { - // Not set. - TYPE_UNSPECIFIED = 0; - - // The cluster is being created. The cluster should be assumed to be - // unusable until the operation finishes. - // - // In the event of the operation failing, the cluster will enter the [ERROR - // state][Cluster.Status.ERROR] and eventually be deleted. - CREATE_CLUSTER = 1; - - // The cluster is being deleted. The cluster should be assumed to be - // unusable as soon as this operation starts. - // - // In the event of the operation failing, the cluster will enter the [ERROR - // state][Cluster.Status.ERROR] and the deletion will be automatically - // retried until completed. - DELETE_CLUSTER = 2; - - // The [cluster - // version][google.container.v1beta1.ClusterUpdate.desired_master_version] - // is being updated. Note that this includes "upgrades" to the same version, - // which are simply a recreation. This also includes - // [auto-upgrades](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-upgrades#upgrading_automatically). - // For more details, see [documentation on cluster - // upgrades](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-upgrades#cluster_upgrades). - UPGRADE_MASTER = 3; - - // A node pool is being updated. Despite calling this an "upgrade", this - // includes most forms of updates to node pools. This also includes - // [auto-upgrades](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-upgrades). - // - // This operation sets the - // [progress][google.container.v1beta1.Operation.progress] field and may be - // [canceled][google.container.v1beta1.ClusterManager.CancelOperation]. - // - // The upgrade strategy depends on [node pool - // configuration](https://cloud.google.com/kubernetes-engine/docs/concepts/node-pool-upgrade-strategies). - // The nodes are generally still usable during this operation. - UPGRADE_NODES = 4; - - // A problem has been detected with the control plane and is being repaired. - // This operation type is initiated by GKE. For more details, see - // [documentation on - // repairs](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions#repairs). - REPAIR_CLUSTER = 5; - - // The cluster is being updated. This is a broad category of operations and - // includes operations that only change metadata as well as those that must - // recreate the entire cluster. If the control plane must be recreated, this - // will cause temporary downtime for zonal clusters. - // - // Some features require recreating the nodes as well. Those will be - // recreated as separate operations and the update may not be completely - // functional until the node pools recreations finish. Node recreations will - // generally follow [maintenance - // policies](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions). - // - // Some GKE-initiated operations use this type. This includes certain types - // of auto-upgrades and incident mitigations. - UPDATE_CLUSTER = 6; - - // A node pool is being created. The node pool should be assumed to be - // unusable until this operation finishes. In the event of an error, the - // node pool may be partially created. - // - // If enabled, [node - // autoprovisioning](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-provisioning) - // may have automatically initiated such operations. - CREATE_NODE_POOL = 7; - - // The node pool is being deleted. The node pool should be assumed to be - // unusable as soon as this operation starts. - DELETE_NODE_POOL = 8; - - // The node pool's - // [manamagent][google.container.v1beta1.NodePool.management] field is being - // updated. These operations only update metadata and may be concurrent with - // most other operations. - SET_NODE_POOL_MANAGEMENT = 9; - - // A problem has been detected with nodes and [they are being - // repaired](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-repair). - // This operation type is initiated by GKE, typically automatically. This - // operation may be concurrent with other operations and there may be - // multiple repairs occurring on the same node pool. - AUTO_REPAIR_NODES = 10; - - // Unused. Automatic node upgrade uses - // [UPGRADE_NODES][google.container.v1beta1.Operation.Type.UPGRADE_NODES]. - AUTO_UPGRADE_NODES = 11 [deprecated = true]; - - // Unused. Updating labels uses - // [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. - SET_LABELS = 12 [deprecated = true]; - - // Unused. Updating master auth uses - // [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. - SET_MASTER_AUTH = 13 [deprecated = true]; - - // The node pool is being resized. With the exception of resizing to or from - // size zero, the node pool is generally usable during this operation. - SET_NODE_POOL_SIZE = 14; - - // Unused. Updating network policy uses - // [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. - SET_NETWORK_POLICY = 15 [deprecated = true]; - - // Unused. Updating maintenance policy uses - // [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. - SET_MAINTENANCE_POLICY = 16 [deprecated = true]; - - // The control plane is being resized. This operation type is initiated by - // GKE. These operations are often performed preemptively to ensure that the - // control plane has sufficient resources and is not typically an indication - // of issues. For more details, see - // [documentation on - // resizes](https://cloud.google.com/kubernetes-engine/docs/concepts/maintenance-windows-and-exclusions#repairs). - RESIZE_CLUSTER = 18; - } - - // The server-assigned ID for the operation. - string name = 1; - - // The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // operation is taking place. This field is deprecated, use location instead. - string zone = 2 [deprecated = true]; - - // The operation type. - Type operation_type = 3; - - // The current status of the operation. - Status status = 4; - - // Detailed operation progress, if available. - string detail = 8; - - // Output only. If an error has occurred, a textual description of the error. - // Deprecated. Use field error instead. - string status_message = 5 - [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; - - // Server-defined URI for the operation. Example: - // `https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123`. - string self_link = 6; - - // Server-defined URI for the target of the operation. The format of this is a - // URI to the resource being modified (such as a cluster, node pool, or node). - // For node pool repairs, there may be multiple nodes being repaired, but only - // one will be the target. - // - // Examples: - // - // - - // ## - // `https://container.googleapis.com/v1/projects/123/locations/us-central1/clusters/my-cluster` - // - // ## - // `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np` - // - // `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np/node/my-node` - string target_link = 7; - - // [Output only] The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) - // or - // [region](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) - // in which the cluster resides. - string location = 9; - - // [Output only] The time the operation started, in - // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string start_time = 10; - - // [Output only] The time the operation completed, in - // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string end_time = 11; - - // Output only. [Output only] Progress information for an operation. - OperationProgress progress = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Which conditions caused the current cluster state. - // Deprecated. Use field error instead. - repeated StatusCondition cluster_conditions = 13 [deprecated = true]; - - // Which conditions caused the current node pool state. - // Deprecated. Use field error instead. - repeated StatusCondition nodepool_conditions = 14 [deprecated = true]; - - // The error result of the operation in case of failure. - google.rpc.Status error = 15; -} - -// Information about operation (or operation stage) progress. -message OperationProgress { - // Progress metric is (string, int|float|string) pair. - message Metric { - // Required. Metric name, e.g., "nodes total", "percent done". - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Strictly one of the values is required. - oneof value { - // For metrics with integer value. - int64 int_value = 2; - - // For metrics with floating point value. - double double_value = 3; - - // For metrics with custom values (ratios, visual progress, etc.). - string string_value = 4; - } - } - - // A non-parameterized string describing an operation stage. - // Unset for single-stage operations. - string name = 1; - - // Status of an operation stage. - // Unset for single-stage operations. - Operation.Status status = 2; - - // Progress metric bundle, for example: - // metrics: [{name: "nodes done", int_value: 15}, - // {name: "nodes total", int_value: 32}] - // or - // metrics: [{name: "progress", double_value: 0.56}, - // {name: "progress scale", double_value: 1.0}] - repeated Metric metrics = 3; - - // Substages of an operation or a stage. - repeated OperationProgress stages = 4; -} - -// CreateClusterRequest creates a cluster. -message CreateClusterRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the parent field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the parent - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. A [cluster - // resource](https://cloud.google.com/container-engine/reference/rest/v1beta1/projects.locations.clusters) - Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED]; - - // The parent (project and location) where the cluster will be created. - // Specified in the format `projects/*/locations/*`. - string parent = 5; -} - -// GetClusterRequest gets the settings of a cluster. -message GetClusterRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to retrieve. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to retrieve. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 5; -} - -// UpdateClusterRequest updates the settings of a cluster. -message UpdateClusterRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. A description of the update. - ClusterUpdate update = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to update. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 5; -} - -// SetNodePoolVersionRequest updates the version of a node pool. -message UpdateNodePoolRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the node pool to upgrade. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. The Kubernetes version to change the nodes to (typically an - // upgrade). - // - // Users may specify either explicit versions offered by Kubernetes Engine or - // version aliases, which have the following behavior: - // - // - "latest": picks the highest valid Kubernetes version - // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - // - "1.X.Y-gke.N": picks an explicit Kubernetes version - // - "-": picks the Kubernetes master version - string node_version = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. The desired image type for the node pool. Please see - // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for - // available image types. - string image_type = 6 [(google.api.field_behavior) = REQUIRED]; - - // The desired list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // node pool's nodes should be located. Changing the locations for a node pool - // will result in nodes being either created or removed from the node pool, - // depending on whether locations are being added or removed. - repeated string locations = 13; - - // The desired workload metadata config for the node pool. - WorkloadMetadataConfig workload_metadata_config = 14; - - // The name (project, location, cluster, node pool) of the node pool to - // update. Specified in the format - // `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 8; - - // Upgrade settings control disruption and speed of the upgrade. - NodePool.UpgradeSettings upgrade_settings = 15; - - // The desired network tags to be applied to all nodes in the node pool. - // If this field is not present, the tags will not be changed. Otherwise, - // the existing network tags will be *replaced* with the provided tags. - NetworkTags tags = 16; - - // The desired node taints to be applied to all nodes in the node pool. - // If this field is not present, the taints will not be changed. Otherwise, - // the existing node taints will be *replaced* with the provided taints. - NodeTaints taints = 17; - - // The desired node labels to be applied to all nodes in the node pool. - // If this field is not present, the labels will not be changed. Otherwise, - // the existing node labels will be *replaced* with the provided labels. - NodeLabels labels = 18; - - // Parameters that can be configured on Linux nodes. - LinuxNodeConfig linux_node_config = 19; - - // Node kubelet configs. - NodeKubeletConfig kubelet_config = 20; - - // Node network config. - NodeNetworkConfig node_network_config = 21; - - // GCFS config. - GcfsConfig gcfs_config = 22; - - // Confidential nodes config. - // All the nodes in the node pool will be Confidential VM once enabled. - ConfidentialNodes confidential_nodes = 23; - - // Enable or disable gvnic on the node pool. - VirtualNIC gvnic = 29; - - // The current etag of the node pool. - // If an etag is provided and does not match the current etag of the node - // pool, update will be blocked and an ABORTED error will be returned. - string etag = 30; - - // Enable or disable NCCL fast socket for the node pool. - FastSocket fast_socket = 31; - - // Logging configuration. - NodePoolLoggingConfig logging_config = 32; - - // The resource labels for the node pool to use to annotate any related - // Google Compute Engine resources. - ResourceLabels resource_labels = 33; - - // Parameters that can be configured on Windows nodes. - WindowsNodeConfig windows_node_config = 34; -} - -// SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool. -message SetNodePoolAutoscalingRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the node pool to upgrade. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Autoscaling configuration for the node pool. - NodePoolAutoscaling autoscaling = 5 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster, node pool) of the node pool to set - // autoscaler settings. Specified in the format - // `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 6; -} - -// SetLoggingServiceRequest sets the logging service of a cluster. -message SetLoggingServiceRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. The logging service the cluster should use to write logs. - // Currently available options: - // - // * `logging.googleapis.com/kubernetes` - The Cloud Logging - // service with a Kubernetes-native resource model - // * `logging.googleapis.com` - The legacy Cloud Logging service (no longer - // available as of GKE 1.15). - // * `none` - no logs will be exported from the cluster. - // - // If left as an empty string,`logging.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. - string logging_service = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to set logging. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 5; -} - -// SetMonitoringServiceRequest sets the monitoring service of a cluster. -message SetMonitoringServiceRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. The monitoring service the cluster should use to write metrics. - // Currently available options: - // - // * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring - // service with a Kubernetes-native resource model - // * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no - // longer available as of GKE 1.15). - // * `none` - No metrics will be exported from the cluster. - // - // If left as an empty string,`monitoring.googleapis.com/kubernetes` will be - // used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. - string monitoring_service = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to set monitoring. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; -} - -// SetAddonsRequest sets the addons associated with the cluster. -message SetAddonsConfigRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. The desired configurations for the various addons available to - // run in the cluster. - AddonsConfig addons_config = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to set addons. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; -} - -// SetLocationsRequest sets the locations of the cluster. -message SetLocationsRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. The desired list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster's nodes should be located. Changing the locations a cluster is in - // will result in nodes being either created or removed from the cluster, - // depending on whether locations are being added or removed. - // - // This list must always include the cluster's primary zone. - repeated string locations = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to set locations. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; -} - -// UpdateMasterRequest updates the master of the cluster. -message UpdateMasterRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. The Kubernetes version to change the master to. - // - // Users may specify either explicit versions offered by - // Kubernetes Engine or version aliases, which have the following behavior: - // - // - "latest": picks the highest valid Kubernetes version - // - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - // - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - // - "1.X.Y-gke.N": picks an explicit Kubernetes version - // - "-": picks the default Kubernetes version - string master_version = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to update. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 7; -} - -// SetMasterAuthRequest updates the admin password of a cluster. -message SetMasterAuthRequest { - // Operation type: what type update to perform. - enum Action { - // Operation is unknown and will error out. - UNKNOWN = 0; - - // Set the password to a user generated value. - SET_PASSWORD = 1; - - // Generate a new password and set it to that. - GENERATE_PASSWORD = 2; - - // Set the username. If an empty username is provided, basic authentication - // is disabled for the cluster. If a non-empty username is provided, basic - // authentication is enabled, with either a provided password or a generated - // one. - SET_USERNAME = 3; - } - - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to upgrade. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. The exact form of action to be taken on the master auth. - Action action = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. A description of the update. - MasterAuth update = 5 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to set auth. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 7; -} - -// DeleteClusterRequest deletes a cluster. -message DeleteClusterRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to delete. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster) of the cluster to delete. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 4; -} - -// ListClustersRequest lists clusters. -message ListClustersRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the parent field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides, or "-" for all zones. This field has been deprecated and - // replaced by the parent field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The parent (project and location) where the clusters will be listed. - // Specified in the format `projects/*/locations/*`. - // Location "-" matches all zones and all regions. - string parent = 4; -} - -// ListClustersResponse is the result of ListClustersRequest. -message ListClustersResponse { - // A list of clusters in the project in the specified zone, or - // across all ones. - repeated Cluster clusters = 1; - - // If any zones are listed here, the list of clusters returned - // may be missing those zones. - repeated string missing_zones = 2; -} - -// GetOperationRequest gets a single operation. -message GetOperationRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The server-assigned `name` of the operation. - // This field has been deprecated and replaced by the name field. - string operation_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The name (project, location, operation id) of the operation to get. - // Specified in the format `projects/*/locations/*/operations/*`. - string name = 5; -} - -// ListOperationsRequest lists operations. -message ListOperationsRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the parent field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) to return - // operations for, or `-` for all zones. This field has been deprecated and - // replaced by the parent field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The parent (project and location) where the operations will be listed. - // Specified in the format `projects/*/locations/*`. - // Location "-" matches all zones and all regions. - string parent = 4; -} - -// CancelOperationRequest cancels a single operation. -message CancelOperationRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // operation resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The server-assigned `name` of the operation. - // This field has been deprecated and replaced by the name field. - string operation_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The name (project, location, operation id) of the operation to cancel. - // Specified in the format `projects/*/locations/*/operations/*`. - string name = 4; -} - -// ListOperationsResponse is the result of ListOperationsRequest. -message ListOperationsResponse { - // A list of operations in the project in the specified zone. - repeated Operation operations = 1; - - // If any zones are listed here, the list of operations returned - // may be missing the operations from those zones. - repeated string missing_zones = 2; -} - -// Gets the current Kubernetes Engine service configuration. -message GetServerConfigRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) to return - // operations for. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The name (project and location) of the server config to get, - // specified in the format `projects/*/locations/*`. - string name = 4; -} - -// Kubernetes Engine service configuration. -message ServerConfig { - // ReleaseChannelConfig exposes configuration for a release channel. - message ReleaseChannelConfig { - // Deprecated. - message AvailableVersion { - option deprecated = true; - - // Kubernetes version. - string version = 1; - - // Reason for availability. - string reason = 2; - } - - // The release channel this configuration applies to. - ReleaseChannel.Channel channel = 1; - - // The default version for newly created clusters on the channel. - string default_version = 2; - - // Deprecated. - // This field has been deprecated and replaced with the valid_versions - // field. - repeated AvailableVersion available_versions = 3 [deprecated = true]; - - // List of valid versions for the channel. - repeated string valid_versions = 4; - } - - // Version of Kubernetes the service deploys by default. - string default_cluster_version = 1; - - // List of valid node upgrade target versions, in descending order. - repeated string valid_node_versions = 3; - - // Default image type. - string default_image_type = 4; - - // List of valid image types. - repeated string valid_image_types = 5; - - // List of valid master versions, in descending order. - repeated string valid_master_versions = 6; - - // List of release channel configurations. - repeated ReleaseChannelConfig channels = 9; - - // Maps of Kubernetes version and supported Windows server versions. - map windows_version_maps = 10; -} - -// Best effort provisioning. -message BestEffortProvisioning { - // When this is enabled, cluster/node pool creations will ignore non-fatal - // errors like stockout to best provision as many nodes as possible right now - // and eventually bring up all target number of nodes - bool enabled = 1; - - // Minimum number of nodes to be provisioned to be considered as succeeded, - // and the rest of nodes will be provisioned gradually and eventually when - // stockout issue has been resolved. - int32 min_provision_nodes = 2; -} - -// Windows server versions. -message WindowsVersions { - // Windows server version. - message WindowsVersion { - // Windows server image type - string image_type = 1; - - // Windows server build number - string os_version = 2; - - // Mainstream support end date - google.type.Date support_end_date = 3; - } - - // List of Windows server versions. - repeated WindowsVersion windows_versions = 1; -} - -// CreateNodePoolRequest creates a node pool for a cluster. -message CreateNodePoolRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the parent field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the parent - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the parent field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. The node pool to create. - NodePool node_pool = 4 [(google.api.field_behavior) = REQUIRED]; - - // The parent (project, location, cluster name) where the node pool will be - // created. Specified in the format - // `projects/*/locations/*/clusters/*`. - string parent = 6; -} - -// DeleteNodePoolRequest deletes a node pool for a cluster. -message DeleteNodePoolRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the node pool to delete. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster, node pool id) of the node pool to - // delete. Specified in the format - // `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 6; -} - -// ListNodePoolsRequest lists the node pool(s) for a cluster. -message ListNodePoolsRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the parent field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the parent - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the parent field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The parent (project, location, cluster name) where the node pools will be - // listed. Specified in the format `projects/*/locations/*/clusters/*`. - string parent = 5; -} - -// GetNodePoolRequest retrieves a node pool for a cluster. -message GetNodePoolRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the node pool. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster, node pool id) of the node pool to - // get. Specified in the format - // `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 6; -} - -// Settings for blue-green upgrade. -message BlueGreenSettings { - // Standard rollout policy is the default policy for blue-green. - message StandardRolloutPolicy { - // Blue pool size to drain in a batch. - oneof update_batch_size { - // Percentage of the blue pool nodes to drain in a batch. - // The range of this field should be (0.0, 1.0]. - float batch_percentage = 1; - - // Number of blue nodes to drain in a batch. - int32 batch_node_count = 2; - } - - // Soak time after each batch gets drained. Default to zero. - optional google.protobuf.Duration batch_soak_duration = 3; - } - - // The rollout policy controls the general rollout progress of blue-green. - oneof rollout_policy { - // Standard policy for the blue-green upgrade. - StandardRolloutPolicy standard_rollout_policy = 1; - } - - // Time needed after draining entire blue pool. After this period, blue pool - // will be cleaned up. - optional google.protobuf.Duration node_pool_soak_duration = 2; -} - -// NodePool contains the name and configuration for a cluster's node pool. -// Node pools are a set of nodes (i.e. VM's), with a common configuration and -// specification, under the control of the cluster master. They may have a set -// of Kubernetes labels applied to them, which may be used to reference them -// during pod scheduling. They may also be resized up or down, to accommodate -// the workload. -// These upgrade settings control the level of parallelism and the level of -// disruption caused by an upgrade. -// -// maxUnavailable controls the number of nodes that can be simultaneously -// unavailable. -// -// maxSurge controls the number of additional nodes that can be added to the -// node pool temporarily for the time of the upgrade to increase the number of -// available nodes. -// -// (maxUnavailable + maxSurge) determines the level of parallelism (how many -// nodes are being upgraded at the same time). -// -// Note: upgrades inevitably introduce some disruption since workloads need to -// be moved from old nodes to new, upgraded ones. Even if maxUnavailable=0, -// this holds true. (Disruption stays within the limits of -// PodDisruptionBudget, if it is configured.) -// -// Consider a hypothetical node pool with 5 nodes having maxSurge=2, -// maxUnavailable=1. This means the upgrade process upgrades 3 nodes -// simultaneously. It creates 2 additional (upgraded) nodes, then it brings -// down 3 old (not yet upgraded) nodes at the same time. This ensures that -// there are always at least 4 nodes available. -message NodePool { - // These upgrade settings configure the upgrade strategy for the node pool. - // Use strategy to switch between the strategies applied to the node pool. - // - // If the strategy is SURGE, use max_surge and max_unavailable to control - // the level of parallelism and the level of disruption caused by upgrade. - // 1. maxSurge controls the number of additional nodes that can be added to - // the node pool temporarily for the time of the upgrade to increase the - // number of available nodes. - // 2. maxUnavailable controls the number of nodes that can be simultaneously - // unavailable. - // 3. (maxUnavailable + maxSurge) determines the level of parallelism (how - // many nodes are being upgraded at the same time). - // - // If the strategy is BLUE_GREEN, use blue_green_settings to configure the - // blue-green upgrade related settings. - // 1. standard_rollout_policy is the default policy. The policy is used to - // control the way blue pool gets drained. The draining is executed in the - // batch mode. The batch size could be specified as either percentage of the - // node pool size or the number of nodes. batch_soak_duration is the soak - // time after each batch gets drained. - // 2. node_pool_soak_duration is the soak time after all blue nodes are - // drained. After this period, the blue pool nodes will be deleted. - message UpgradeSettings { - // The maximum number of nodes that can be created beyond the current size - // of the node pool during the upgrade process. - int32 max_surge = 1; - - // The maximum number of nodes that can be simultaneously unavailable during - // the upgrade process. A node is considered available if its status is - // Ready. - int32 max_unavailable = 2; - - // Update strategy of the node pool. - optional NodePoolUpdateStrategy strategy = 3; - - // Settings for blue-green upgrade strategy. - optional BlueGreenSettings blue_green_settings = 4; - } - - // UpdateInfo contains resource (instance groups, etc), status and other - // intermediate information relevant to a node pool upgrade. - message UpdateInfo { - // Information relevant to blue-green upgrade. - message BlueGreenInfo { - // Phase represents the different stages blue-green upgrade is running in. - enum Phase { - // Unspecified phase. - PHASE_UNSPECIFIED = 0; - - // blue-green upgrade has been initiated. - UPDATE_STARTED = 1; - - // Start creating green pool nodes. - CREATING_GREEN_POOL = 2; - - // Start cordoning blue pool nodes. - CORDONING_BLUE_POOL = 3; - - // Start draining blue pool nodes. - DRAINING_BLUE_POOL = 4; - - // Start soaking time after draining entire blue pool. - NODE_POOL_SOAKING = 5; - - // Start deleting blue nodes. - DELETING_BLUE_POOL = 6; - - // Rollback has been initiated. - ROLLBACK_STARTED = 7; - } - - // Current blue-green upgrade phase. - Phase phase = 1; - - // The resource URLs of the [managed instance groups] - // (/compute/docs/instance-groups/creating-groups-of-managed-instances) - // associated with blue pool. - repeated string blue_instance_group_urls = 2; - - // The resource URLs of the [managed instance groups] - // (/compute/docs/instance-groups/creating-groups-of-managed-instances) - // associated with green pool. - repeated string green_instance_group_urls = 3; - - // Time to start deleting blue pool to complete blue-green upgrade, - // in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string blue_pool_deletion_start_time = 4; - - // Version of green pool. - string green_pool_version = 5; - } - - // Information of a blue-green upgrade. - BlueGreenInfo blue_green_info = 1; - } - - // The current status of the node pool instance. - enum Status { - // Not set. - STATUS_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 RUNNING_WITH_ERROR state indicates the node pool has been created - // and is partially usable. Some error state has occurred and some - // functionality may be impaired. Customer may need to reissue a request - // or trigger a new update. - RUNNING_WITH_ERROR = 3; - - // The RECONCILING state indicates that some work is actively being done on - // the node pool, such as upgrading node software. Details can - // be found in the `statusMessage` field. - RECONCILING = 4; - - // The STOPPING state indicates the node pool is being deleted. - STOPPING = 5; - - // The ERROR state indicates the node pool may be unusable. Details - // can be found in the `statusMessage` field. - ERROR = 6; - } - - // PlacementPolicy defines the placement policy used by the node pool. - message PlacementPolicy { - // Type defines the type of placement policy. - enum Type { - // TYPE_UNSPECIFIED specifies no requirements on nodes - // placement. - TYPE_UNSPECIFIED = 0; - - // COMPACT specifies node placement in the same availability domain to - // ensure low communication latency. - COMPACT = 1; - } - - // The type of placement. - Type type = 1; - - // TPU placement topology for pod slice node pool. - // https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies - string tpu_topology = 2; - - // If set, refers to the name of a custom resource policy supplied by the - // user. The resource policy must be in the same project and region as the - // node pool. If not found, InvalidArgument error is returned. - string policy_name = 3; - } - - // The name of the node pool. - string name = 1; - - // The node configuration of the pool. - NodeConfig config = 2; - - // The initial node count for the pool. You must ensure that your - // Compute Engine [resource quota](https://cloud.google.com/compute/quotas) - // is sufficient for this number of instances. You must also have available - // firewall and routes quota. - int32 initial_node_count = 3; - - // The list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // NodePool's nodes should be located. - // - // If this value is unspecified during node pool creation, the - // [Cluster.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters#Cluster.FIELDS.locations) - // value will be used, instead. - // - // Warning: changing node pool locations will result in nodes being added - // and/or removed. - repeated string locations = 13; - - // Networking configuration for this NodePool. If specified, it overrides the - // cluster-level defaults. - NodeNetworkConfig network_config = 14; - - // [Output only] Server-defined URL for the resource. - string self_link = 100; - - // The version of Kubernetes running on this NodePool's nodes. If unspecified, - // it defaults as described - // [here](https://cloud.google.com/kubernetes-engine/versioning#specifying_node_version). - string version = 101; - - // [Output only] The resource URLs of the [managed instance - // groups](https://cloud.google.com/compute/docs/instance-groups/creating-groups-of-managed-instances) - // associated with this node pool. - // During the node pool blue-green upgrade operation, the URLs contain both - // blue and green resources. - repeated string instance_group_urls = 102; - - // [Output only] The status of the nodes in this pool instance. - Status status = 103; - - // [Output only] Deprecated. Use conditions instead. - // Additional information about the current status of this - // node pool instance, if available. - string status_message = 104 [deprecated = true]; - - // Autoscaler configuration for this NodePool. Autoscaler is enabled - // only if a valid configuration is present. - NodePoolAutoscaling autoscaling = 4; - - // NodeManagement configuration for this NodePool. - NodeManagement management = 5; - - // The constraint on the maximum number of pods that can be run - // simultaneously on a node in the node pool. - MaxPodsConstraint max_pods_constraint = 6; - - // Which conditions caused the current node pool state. - repeated StatusCondition conditions = 105; - - // [Output only] The pod CIDR block size per node in this node pool. - int32 pod_ipv4_cidr_size = 7; - - // Upgrade settings control disruption and speed of the upgrade. - UpgradeSettings upgrade_settings = 107; - - // Specifies the node placement policy. - PlacementPolicy placement_policy = 108; - - // Output only. [Output only] Update info contains relevant information during - // a node pool update. - UpdateInfo update_info = 109 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // This checksum is computed by the server based on the value of node pool - // fields, and may be sent on update requests to ensure the client has an - // up-to-date value before proceeding. - string etag = 110; - - // Enable best effort provisioning for nodes - BestEffortProvisioning best_effort_provisioning = 113; -} - -// NodeManagement defines the set of node management services turned on for the -// node pool. -message NodeManagement { - // Whether the nodes will be automatically upgraded. - bool auto_upgrade = 1; - - // Whether the nodes will be automatically repaired. - bool auto_repair = 2; - - // Specifies the Auto Upgrade knobs for the node pool. - AutoUpgradeOptions upgrade_options = 10; -} - -// AutoUpgradeOptions defines the set of options for the user to control how -// the Auto Upgrades will proceed. -message AutoUpgradeOptions { - // [Output only] This field is set when upgrades are about to commence - // with the approximate start time for the upgrades, in - // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - string auto_upgrade_start_time = 1; - - // [Output only] This field is set when upgrades are about to commence - // with the description of the upgrade. - string description = 2; -} - -// MaintenancePolicy defines the maintenance policy to be used for the cluster. -message MaintenancePolicy { - // Specifies the maintenance window in which maintenance may be performed. - MaintenanceWindow window = 1; - - // A hash identifying the version of this policy, so that updates to fields of - // the policy won't accidentally undo intermediate changes (and so that users - // of the API unaware of some fields won't accidentally remove other fields). - // Make a `get()` request to the cluster to get the current - // resource version and include it with requests to set the policy. - string resource_version = 3; -} - -// MaintenanceWindow defines the maintenance window to be used for the cluster. -message MaintenanceWindow { - // Unimplemented, reserved for future use. - // HourlyMaintenanceWindow hourly_maintenance_window = 1; - oneof policy { - // DailyMaintenanceWindow specifies a daily maintenance operation window. - DailyMaintenanceWindow daily_maintenance_window = 2; - - // RecurringWindow specifies some number of recurring time periods for - // maintenance to occur. The time windows may be overlapping. If no - // maintenance windows are set, maintenance can occur at any time. - RecurringTimeWindow recurring_window = 3; - } - - // Exceptions to maintenance window. Non-emergency maintenance should not - // occur in these windows. - map maintenance_exclusions = 4; -} - -// Represents an arbitrary window of time. -message TimeWindow { - oneof options { - // MaintenanceExclusionOptions provides maintenance exclusion related - // options. - MaintenanceExclusionOptions maintenance_exclusion_options = 3; - } - - // The time that the window first starts. - google.protobuf.Timestamp start_time = 1; - - // The time that the window ends. The end time should take place after the - // start time. - google.protobuf.Timestamp end_time = 2; -} - -// Represents the Maintenance exclusion option. -message MaintenanceExclusionOptions { - // Scope of exclusion. - enum Scope { - // NO_UPGRADES excludes all upgrades, including patch upgrades and minor - // upgrades across control planes and nodes. This is the default exclusion - // behavior. - NO_UPGRADES = 0; - - // NO_MINOR_UPGRADES excludes all minor upgrades for the cluster, only - // patches are allowed. - NO_MINOR_UPGRADES = 1; - - // NO_MINOR_OR_NODE_UPGRADES excludes all minor upgrades for the cluster, - // and also exclude all node pool upgrades. Only control - // plane patches are allowed. - NO_MINOR_OR_NODE_UPGRADES = 2; - } - - // Scope specifies the upgrade scope which upgrades are blocked by the - // exclusion. - Scope scope = 1; -} - -// Represents an arbitrary window of time that recurs. -message RecurringTimeWindow { - // The window of the first recurrence. - TimeWindow window = 1; - - // An RRULE (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for how - // this window reccurs. They go on for the span of time between the start and - // end time. - // - // For example, to have something repeat every weekday, you'd use: - // `FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR` - // - // To repeat some window daily (equivalent to the DailyMaintenanceWindow): - // `FREQ=DAILY` - // - // For the first weekend of every month: - // `FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU` - // - // This specifies how frequently the window starts. Eg, if you wanted to have - // a 9-5 UTC-4 window every weekday, you'd use something like: - // ``` - // start time = 2019-01-01T09:00:00-0400 - // end time = 2019-01-01T17:00:00-0400 - // recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR - // ``` - // - // Windows can span multiple days. Eg, to make the window encompass every - // weekend from midnight Saturday till the last minute of Sunday UTC: - // ``` - // start time = 2019-01-05T00:00:00Z - // end time = 2019-01-07T23:59:00Z - // recurrence = FREQ=WEEKLY;BYDAY=SA - // ``` - // - // Note the start and end time's specific dates are largely arbitrary except - // to specify duration of the window and when it first starts. - // The FREQ values of HOURLY, MINUTELY, and SECONDLY are not supported. - string recurrence = 2; -} - -// Time window specified for daily maintenance operations. -message DailyMaintenanceWindow { - // Time within the maintenance window to start the maintenance operations. - // It must be in format "HH:MM", where HH : [00-23] and MM : [00-59] GMT. - string start_time = 2; - - // [Output only] Duration of the time window, automatically chosen to be - // smallest possible in the given scenario. - string duration = 3; -} - -// SetNodePoolManagementRequest sets the node management properties of a node -// pool. -message SetNodePoolManagementRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to update. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the node pool to update. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. NodeManagement configuration for the node pool. - NodeManagement management = 5 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster, node pool id) of the node pool to set - // management properties. Specified in the format - // `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 7; -} - -// SetNodePoolSizeRequest sets the size of a node pool. -message SetNodePoolSizeRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to update. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the node pool to update. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. The desired node count for the pool. - int32 node_count = 5 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster, node pool id) of the node pool to set - // size. - // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 7; -} - -// CompleteNodePoolUpgradeRequest sets the name of target node pool to complete -// upgrade. -message CompleteNodePoolUpgradeRequest { - // The name (project, location, cluster, node pool id) of the node pool to - // complete upgrade. - // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 1; -} - -// RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed -// NodePool upgrade. This will be an no-op if the last upgrade successfully -// completed. -message RollbackNodePoolUpgradeRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to rollback. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the node pool to rollback. - // This field has been deprecated and replaced by the name field. - string node_pool_id = 4 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster, node pool id) of the node poll to - // rollback upgrade. - // Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`. - string name = 6; - - // Option for rollback to ignore the PodDisruptionBudget. - // Default value is false. - bool respect_pdb = 7; -} - -// ListNodePoolsResponse is the result of ListNodePoolsRequest. -message ListNodePoolsResponse { - // A list of node pools for a cluster. - repeated NodePool node_pools = 1; -} - -// ClusterAutoscaling contains global, per-cluster information -// required by Cluster Autoscaler to automatically adjust -// the size of the cluster and create/delete -// node pools based on the current needs. -message ClusterAutoscaling { - // Defines possible options for autoscaling_profile field. - enum AutoscalingProfile { - // No change to autoscaling configuration. - PROFILE_UNSPECIFIED = 0; - - // Prioritize optimizing utilization of resources. - OPTIMIZE_UTILIZATION = 1; - - // Use default (balanced) autoscaling configuration. - BALANCED = 2; - } - - // Enables automatic node pool creation and deletion. - bool enable_node_autoprovisioning = 1; - - // Contains global constraints regarding minimum and maximum - // amount of resources in the cluster. - repeated ResourceLimit resource_limits = 2; - - // Defines autoscaling behaviour. - AutoscalingProfile autoscaling_profile = 3; - - // AutoprovisioningNodePoolDefaults contains defaults for a node pool - // created by NAP. - AutoprovisioningNodePoolDefaults autoprovisioning_node_pool_defaults = 4; - - // The list of Google Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) in which the - // NodePool's nodes can be created by NAP. - repeated string autoprovisioning_locations = 5; -} - -// AutoprovisioningNodePoolDefaults contains defaults for a node pool created -// by NAP. -message AutoprovisioningNodePoolDefaults { - // The set of Google API scopes to be made available on all of the - // node VMs under the "default" service account. - // - // The following scopes are recommended, but not required, and by default are - // not included: - // - // * `https://www.googleapis.com/auth/compute` is required for mounting - // persistent storage on your nodes. - // * `https://www.googleapis.com/auth/devstorage.read_only` is required for - // communicating with **gcr.io** - // (the [Google Container - // Registry](https://cloud.google.com/container-registry/)). - // - // If unspecified, no scopes are added, unless Cloud Logging or Cloud - // Monitoring are enabled, in which case their required scopes will be added. - repeated string oauth_scopes = 1; - - // The Google Cloud Platform Service Account to be used by the node VMs. - // Specify the email address of the Service Account; otherwise, if no Service - // Account is specified, the "default" service account is used. - string service_account = 2; - - // Upgrade settings control disruption and speed of the upgrade. - NodePool.UpgradeSettings upgrade_settings = 3; - - // NodeManagement configuration for this NodePool. - NodeManagement management = 4; - - // Deprecated. Minimum CPU platform to be used for NAP created node pools. - // The instance may be scheduled on the specified or newer CPU platform. - // Applicable values are the friendly names of CPU platforms, such as - // minCpuPlatform: Intel Haswell or - // minCpuPlatform: Intel Sandy Bridge. For more - // information, read [how to specify min CPU - // platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform). - // This field is deprecated, min_cpu_platform should be specified using - // `cloud.google.com/requested-min-cpu-platform` label selector on the pod. - // To unset the min cpu platform field pass "automatic" - // as field value. - string min_cpu_platform = 5 [deprecated = true]; - - // Size of the disk attached to each node, specified in GB. - // The smallest allowed disk size is 10GB. - // - // If unspecified, the default disk size is 100GB. - int32 disk_size_gb = 6; - - // Type of the disk attached to each node (e.g. 'pd-standard', 'pd-ssd' or - // 'pd-balanced') - // - // If unspecified, the default disk type is 'pd-standard' - string disk_type = 7; - - // Shielded Instance options. - ShieldedInstanceConfig shielded_instance_config = 8; - - // - // The Customer Managed Encryption Key used to encrypt the boot disk attached - // to each node in the node pool. This should be of the form - // projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. - // For more information about protecting resources with Cloud KMS Keys please - // see: - // https://cloud.google.com/compute/docs/disks/customer-managed-encryption - string boot_disk_kms_key = 9; - - // The image type to use for NAP created node. Please see - // https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for - // available image types. - string image_type = 10; - - // Enable or disable Kubelet read only port. - optional bool insecure_kubelet_readonly_port_enabled = 13; -} - -// Contains information about amount of some resource in the cluster. -// For memory, value should be in GB. -message ResourceLimit { - // Resource name "cpu", "memory" or gpu-specific string. - string resource_type = 1; - - // Minimum amount of the resource in the cluster. - int64 minimum = 2; - - // Maximum amount of the resource in the cluster. - int64 maximum = 3; -} - -// NodePoolAutoscaling contains information required by cluster autoscaler to -// adjust the size of the node pool to the current cluster usage. -message NodePoolAutoscaling { - // Location policy specifies how zones are picked when scaling up the - // nodepool. - enum LocationPolicy { - // Not set. - LOCATION_POLICY_UNSPECIFIED = 0; - - // BALANCED is a best effort policy that aims to balance the sizes of - // different zones. - BALANCED = 1; - - // ANY policy picks zones that have the highest capacity available. - ANY = 2; - } - - // Is autoscaling enabled for this node pool. - bool enabled = 1; - - // Minimum number of nodes for one location in the NodePool. Must be >= 1 and - // <= max_node_count. - int32 min_node_count = 2; - - // Maximum number of nodes for one location in the NodePool. Must be >= - // min_node_count. There has to be enough quota to scale up the cluster. - int32 max_node_count = 3; - - // Can this node pool be deleted automatically. - bool autoprovisioned = 4; - - // Location policy used when scaling up a nodepool. - LocationPolicy location_policy = 5; - - // Minimum number of nodes in the node pool. Must be greater than 1 less than - // total_max_node_count. - // The total_*_node_count fields are mutually exclusive with the *_node_count - // fields. - int32 total_min_node_count = 6; - - // Maximum number of nodes in the node pool. Must be greater than - // total_min_node_count. There has to be enough quota to scale up the cluster. - // The total_*_node_count fields are mutually exclusive with the *_node_count - // fields. - int32 total_max_node_count = 7; -} - -// SetLabelsRequest sets the Google Cloud Platform labels on a Google Container -// Engine cluster, which will in turn set them for Google Compute Engine -// resources used by that cluster -message SetLabelsRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. The labels to set for that cluster. - map resource_labels = 4 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The fingerprint of the previous set of labels for this resource, - // used to detect conflicts. The fingerprint is initially generated by - // Kubernetes Engine and changes after every request to modify or update - // labels. You must always provide an up-to-date fingerprint hash when - // updating or changing labels. Make a `get()` request to the - // resource to get the latest fingerprint. - string label_fingerprint = 5 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster name) of the cluster to set labels. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 7; -} - -// SetLegacyAbacRequest enables or disables the ABAC authorization mechanism for -// a cluster. -message SetLegacyAbacRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster to update. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Whether ABAC authorization will be enabled in the cluster. - bool enabled = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster name) of the cluster to set legacy - // abac. Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; -} - -// StartIPRotationRequest creates a new IP for the cluster and then performs -// a node upgrade on each node pool to point to the new IP. -message StartIPRotationRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster name) of the cluster to start IP - // rotation. Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; - - // Whether to rotate credentials during IP rotation. - bool rotate_credentials = 7; -} - -// CompleteIPRotationRequest moves the cluster master back into single-IP mode. -message CompleteIPRotationRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster name) of the cluster to complete IP - // rotation. Specified in the format `projects/*/locations/*/clusters/*`. - string name = 7; -} - -// AcceleratorConfig represents a Hardware Accelerator request. -message AcceleratorConfig { - // The number of the accelerator cards exposed to an instance. - int64 accelerator_count = 1; - - // The accelerator type resource name. List of supported accelerators - // [here](https://cloud.google.com/compute/docs/gpus) - string accelerator_type = 2; - - // Size of partitions to create on the GPU. Valid values are described in the - // NVIDIA [mig user - // guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning). - string gpu_partition_size = 3; - - // The number of time-shared GPU resources to expose for each physical GPU. - int64 max_time_shared_clients_per_gpu = 4 [deprecated = true]; - - // The configuration for GPU sharing options. - optional GPUSharingConfig gpu_sharing_config = 5; - - // The configuration for auto installation of GPU driver. - optional GPUDriverInstallationConfig gpu_driver_installation_config = 6; -} - -// GPUSharingConfig represents the GPU sharing configuration for Hardware -// Accelerators. -message GPUSharingConfig { - // The type of GPU sharing strategy currently provided. - enum GPUSharingStrategy { - // Default value. - GPU_SHARING_STRATEGY_UNSPECIFIED = 0; - - // GPUs are time-shared between containers. - TIME_SHARING = 1; - } - - // The max number of containers that can share a physical GPU. - int64 max_shared_clients_per_gpu = 1; - - // The type of GPU sharing strategy to enable on the GPU node. - optional GPUSharingStrategy gpu_sharing_strategy = 2; -} - -// GPUDriverInstallationConfig specifies the version of GPU driver to be auto -// installed. -message GPUDriverInstallationConfig { - // The GPU driver version to install. - enum GPUDriverVersion { - // Default value is to not install any GPU driver. - GPU_DRIVER_VERSION_UNSPECIFIED = 0; - - // Disable GPU driver auto installation and needs manual installation - INSTALLATION_DISABLED = 1; - - // "Default" GPU driver in COS and Ubuntu. - DEFAULT = 2; - - // "Latest" GPU driver in COS. - LATEST = 3; - } - - // Mode for how the GPU driver is installed. - optional GPUDriverVersion gpu_driver_version = 1; -} - -// ManagedPrometheusConfig defines the configuration for -// Google Cloud Managed Service for Prometheus. -message ManagedPrometheusConfig { - // Enable Managed Collection. - bool enabled = 1; -} - -// WorkloadMetadataConfig defines the metadata configuration to expose to -// workloads on the node pool. -message WorkloadMetadataConfig { - // NodeMetadata is the configuration for if and how to expose the node - // metadata to the workload running on the node. - enum NodeMetadata { - // Not set. - UNSPECIFIED = 0; - - // Prevent workloads not in hostNetwork from accessing certain VM metadata, - // specifically kube-env, which contains Kubelet credentials, and the - // instance identity token. - // - // Metadata concealment is a temporary security solution available while the - // bootstrapping process for cluster nodes is being redesigned with - // significant security improvements. This feature is scheduled to be - // deprecated in the future and later removed. - SECURE = 1; - - // Expose all VM metadata to pods. - EXPOSE = 2; - - // Run the GKE Metadata Server on this node. The GKE Metadata Server exposes - // a metadata API to workloads that is compatible with the V1 Compute - // Metadata APIs exposed by the Compute Engine and App Engine Metadata - // Servers. This feature can only be enabled if Workload Identity is enabled - // at the cluster level. - GKE_METADATA_SERVER = 3; - } - - // Mode is the configuration for how to expose metadata to workloads running - // on the node. - enum Mode { - // Not set. - MODE_UNSPECIFIED = 0; - - // Expose all Compute Engine metadata to pods. - GCE_METADATA = 1; - - // Run the GKE Metadata Server on this node. The GKE Metadata Server exposes - // a metadata API to workloads that is compatible with the V1 Compute - // Metadata APIs exposed by the Compute Engine and App Engine Metadata - // Servers. This feature can only be enabled if Workload Identity is enabled - // at the cluster level. - GKE_METADATA = 2; - } - - // NodeMetadata is the configuration for how to expose metadata to the - // workloads running on the node. - NodeMetadata node_metadata = 1 [deprecated = true]; - - // Mode is the configuration for how to expose metadata to workloads running - // on the node pool. - Mode mode = 2; -} - -// SetNetworkPolicyRequest enables/disables network policy for a cluster. -message SetNetworkPolicyRequest { - // Required. Deprecated. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - // This field has been deprecated and replaced by the name field. - string project_id = 1 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. This field has been deprecated and replaced by the name - // field. - string zone = 2 [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Deprecated. The name of the cluster. - // This field has been deprecated and replaced by the name field. - string cluster_id = 3 - [deprecated = true, (google.api.field_behavior) = REQUIRED]; - - // Required. Configuration options for the NetworkPolicy feature. - NetworkPolicy network_policy = 4 [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster name) of the cluster to set networking - // policy. Specified in the format `projects/*/locations/*/clusters/*`. - string name = 6; -} - -// SetMaintenancePolicyRequest sets the maintenance policy for a cluster. -message SetMaintenancePolicyRequest { - // Required. The Google Developers Console [project ID or project - // number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the Google Compute Engine - // [zone](https://cloud.google.com/compute/docs/zones#available) in which the - // cluster resides. - string zone = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the cluster to update. - string cluster_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The maintenance policy to be set for the cluster. An empty field - // clears the existing maintenance policy. - MaintenancePolicy maintenance_policy = 4 - [(google.api.field_behavior) = REQUIRED]; - - // The name (project, location, cluster name) of the cluster to set - // maintenance policy. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 5; -} - -// ListLocationsRequest is used to request the locations that offer GKE. -message ListLocationsRequest { - // Required. Contains the name of the resource requested. - // Specified in the format `projects/*`. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// ListLocationsResponse returns the list of all GKE locations and their -// recommendation state. -message ListLocationsResponse { - // A full list of GKE locations. - repeated Location locations = 1; - - // Only return ListLocationsResponse that occur after the page_token. This - // value should be populated from the ListLocationsResponse.next_page_token if - // that response token was set (which happens when listing more Locations than - // fit in a single ListLocationsResponse). - string next_page_token = 2; -} - -// Location returns the location name, and if the location is recommended -// for GKE cluster scheduling. -message Location { - // LocationType is the type of GKE location, regional or zonal. - enum LocationType { - // LOCATION_TYPE_UNSPECIFIED means the location type was not determined. - LOCATION_TYPE_UNSPECIFIED = 0; - - // A GKE Location where Zonal clusters can be created. - ZONE = 1; - - // A GKE Location where Regional clusters can be created. - REGION = 2; - } - - // Contains the type of location this Location is for. - // Regional or Zonal. - LocationType type = 1; - - // Contains the name of the resource requested. - // Specified in the format `projects/*/locations/*`. - string name = 2; - - // Whether the location is recommended for GKE cluster scheduling. - bool recommended = 3; -} - -// StatusCondition describes why a cluster or a node pool has a certain status -// (e.g., ERROR or DEGRADED). -message StatusCondition { - // Code for each condition - enum Code { - option deprecated = true; - - // UNKNOWN indicates a generic condition. - UNKNOWN = 0; - - // GCE_STOCKOUT indicates that Google Compute Engine resources are - // temporarily unavailable. - GCE_STOCKOUT = 1; - - // GKE_SERVICE_ACCOUNT_DELETED indicates that the user deleted their robot - // service account. - GKE_SERVICE_ACCOUNT_DELETED = 2; - - // Google Compute Engine quota was exceeded. - GCE_QUOTA_EXCEEDED = 3; - - // Cluster state was manually changed by an SRE due to a system logic error. - SET_BY_OPERATOR = 4; - - // Unable to perform an encrypt operation against the CloudKMS key used for - // etcd level encryption. - CLOUD_KMS_KEY_ERROR = 7; - - // Cluster CA is expiring soon. - // More codes TBA - CA_EXPIRING = 9; - } - - // Machine-friendly representation of the condition - // Deprecated. Use canonical_code instead. - Code code = 1 [deprecated = true]; - - // Human-friendly representation of the condition - string message = 2; - - // Canonical code of the condition. - google.rpc.Code canonical_code = 3; -} - -// NetworkConfig reports the relative names of network & subnetwork. -message NetworkConfig { - // Configuration of all network bandwidth tiers - message ClusterNetworkPerformanceConfig { - // Node network tier - enum Tier { - // Default value - TIER_UNSPECIFIED = 0; - - // Higher bandwidth, actual values based on VM size. - TIER_1 = 1; - } - - // Specifies the total network bandwidth tier for the NodePool. - optional Tier total_egress_bandwidth_tier = 1; - } - - // Output only. The relative name of the Google Compute Engine - // [network][google.container.v1beta1.NetworkConfig.network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) - // to which the cluster is connected. Example: - // projects/my-project/global/networks/my-network - string network = 1; - - // Output only. The relative name of the Google Compute Engine - // [subnetwork](https://cloud.google.com/compute/docs/vpc) to which the - // cluster is connected. Example: - // projects/my-project/regions/us-central1/subnetworks/my-subnet - string subnetwork = 2; - - // Whether Intra-node visibility is enabled for this cluster. - // This makes same node pod to pod traffic visible for VPC network. - bool enable_intra_node_visibility = 5; - - // Whether the cluster disables default in-node sNAT rules. In-node sNAT rules - // will be disabled when default_snat_status is disabled. When disabled is set - // to false, default IP masquerade rules will be applied to the nodes to - // prevent sNAT on cluster internal traffic. - DefaultSnatStatus default_snat_status = 7; - - // Whether L4ILB Subsetting is enabled for this cluster. - bool enable_l4ilb_subsetting = 10; - - // The desired datapath provider for this cluster. By default, uses the - // IPTables-based kube-proxy implementation. - DatapathProvider datapath_provider = 11; - - // The desired state of IPv6 connectivity to Google Services. - // By default, no private IPv6 access to or from Google Services (all access - // will be via IPv4) - PrivateIPv6GoogleAccess private_ipv6_google_access = 12; - - // DNSConfig contains clusterDNS config for this cluster. - DNSConfig dns_config = 13; - - // ServiceExternalIPsConfig specifies if services with externalIPs field are - // blocked or not. - ServiceExternalIPsConfig service_external_ips_config = 15; - - // GatewayAPIConfig contains the desired config of Gateway API on this - // cluster. - GatewayAPIConfig gateway_api_config = 16; - - // Whether multi-networking is enabled for this cluster. - bool enable_multi_networking = 17; - - // Network bandwidth tier configuration. - ClusterNetworkPerformanceConfig network_performance_config = 18; - - // Whether FQDN Network Policy is enabled on this cluster. - optional bool enable_fqdn_network_policy = 19; -} - -// GatewayAPIConfig contains the desired config of Gateway API on this cluster. -message GatewayAPIConfig { - // Channel describes if/how Gateway API should be installed and implemented in - // a cluster. - enum Channel { - // Default value. - CHANNEL_UNSPECIFIED = 0; - - // Gateway API support is disabled - CHANNEL_DISABLED = 1; - - // Gateway API support is enabled, experimental CRDs are installed - CHANNEL_EXPERIMENTAL = 3; - - // Gateway API support is enabled, standard CRDs are installed - CHANNEL_STANDARD = 4; - } - - // The Gateway API release channel to use for Gateway API. - Channel channel = 1; -} - -// Config to block services with externalIPs field. -message ServiceExternalIPsConfig { - // Whether Services with ExternalIPs field are allowed or not. - bool enabled = 1; -} - -// ListUsableSubnetworksRequest requests the list of usable subnetworks. -// available to a user for creating clusters. -message ListUsableSubnetworksRequest { - // Required. The parent project where subnetworks are usable. - // Specified in the format `projects/*`. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Filtering currently only supports equality on the networkProjectId and must - // be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` - // is the project which owns the listed subnetworks. This defaults to the - // parent project ID. - string filter = 2; - - // The max number of results per page that should be returned. If the number - // of available results is larger than `page_size`, a `next_page_token` is - // returned which can be used to get the next page of results in subsequent - // requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - int32 page_size = 3; - - // Specifies a page token to use. Set this to the nextPageToken returned by - // previous list requests to get the next page of results. - string page_token = 4; -} - -// ListUsableSubnetworksResponse is the response of -// ListUsableSubnetworksRequest. -message ListUsableSubnetworksResponse { - // A list of usable subnetworks in the specified network project. - repeated UsableSubnetwork subnetworks = 1; - - // This token allows you to get the next page of results for list requests. - // If the number of results is larger than `page_size`, use the - // `next_page_token` as a value for the query parameter `page_token` in the - // next request. The value will become empty when there are no more pages. - string next_page_token = 2; -} - -// Secondary IP range of a usable subnetwork. -message UsableSubnetworkSecondaryRange { - // Status shows the current usage of a secondary IP range. - enum Status { - // UNKNOWN is the zero value of the Status enum. It's not a valid status. - UNKNOWN = 0; - - // UNUSED denotes that this range is unclaimed by any cluster. - UNUSED = 1; - - // IN_USE_SERVICE denotes that this range is claimed by a cluster for - // services. It cannot be used for other clusters. - IN_USE_SERVICE = 2; - - // IN_USE_SHAREABLE_POD denotes this range was created by the network admin - // and is currently claimed by a cluster for pods. It can only be used by - // other clusters as a pod range. - IN_USE_SHAREABLE_POD = 3; - - // IN_USE_MANAGED_POD denotes this range was created by GKE and is claimed - // for pods. It cannot be used for other clusters. - IN_USE_MANAGED_POD = 4; - } - - // The name associated with this subnetwork secondary range, used when adding - // an alias IP range to a VM instance. - string range_name = 1; - - // The range of IP addresses belonging to this subnetwork secondary range. - string ip_cidr_range = 2; - - // This field is to determine the status of the secondary range programmably. - Status status = 3; -} - -// UsableSubnetwork resource returns the subnetwork name, its associated network -// and the primary CIDR range. -message UsableSubnetwork { - // Subnetwork Name. - // Example: projects/my-project/regions/us-central1/subnetworks/my-subnet - string subnetwork = 1; - - // Network Name. - // Example: projects/my-project/global/networks/my-network - string network = 2; - - // The range of internal addresses that are owned by this subnetwork. - string ip_cidr_range = 3; - - // Secondary IP ranges. - repeated UsableSubnetworkSecondaryRange secondary_ip_ranges = 4; - - // A human readable status message representing the reasons for cases where - // the caller cannot use the secondary ranges under the subnet. For example if - // the secondary_ip_ranges is empty due to a permission issue, an insufficient - // permission message will be given by status_message. - string status_message = 5; -} - -// VerticalPodAutoscaling contains global, per-cluster information -// required by Vertical Pod Autoscaler to automatically adjust -// the resources of pods controlled by it. -message VerticalPodAutoscaling { - // Enables vertical pod autoscaling. - bool enabled = 1; -} - -// DefaultSnatStatus contains the desired state of whether default sNAT should -// be disabled on the cluster. -message DefaultSnatStatus { - // Disables cluster default sNAT rules. - bool disabled = 1; -} - -// IntraNodeVisibilityConfig contains the desired config of the intra-node -// visibility on this cluster. -message IntraNodeVisibilityConfig { - // Enables intra node visibility for this cluster. - bool enabled = 1; -} - -// ILBSubsettingConfig contains the desired config of L4 Internal LoadBalancer -// subsetting on this cluster. -message ILBSubsettingConfig { - // Enables l4 ILB subsetting for this cluster - bool enabled = 1; -} - -// DNSConfig contains the desired set of options for configuring clusterDNS. -message DNSConfig { - // Provider lists the various in-cluster DNS providers. - enum Provider { - // Default value - PROVIDER_UNSPECIFIED = 0; - - // Use GKE default DNS provider(kube-dns) for DNS resolution. - PLATFORM_DEFAULT = 1; - - // Use CloudDNS for DNS resolution. - CLOUD_DNS = 2; - - // Use KubeDNS for DNS resolution. - KUBE_DNS = 3; - } - - // DNSScope lists the various scopes of access to cluster DNS records. - enum DNSScope { - // Default value, will be inferred as cluster scope. - DNS_SCOPE_UNSPECIFIED = 0; - - // DNS records are accessible from within the cluster. - CLUSTER_SCOPE = 1; - - // DNS records are accessible from within the VPC. - VPC_SCOPE = 2; - } - - // cluster_dns indicates which in-cluster DNS provider should be used. - Provider cluster_dns = 1; - - // cluster_dns_scope indicates the scope of access to cluster DNS records. - DNSScope cluster_dns_scope = 2; - - // cluster_dns_domain is the suffix used for all cluster service records. - string cluster_dns_domain = 3; -} - -// Constraints applied to pods. -message MaxPodsConstraint { - // Constraint enforced on the max num of pods per node. - int64 max_pods_per_node = 1; -} - -// Configuration for the use of Kubernetes Service Accounts in GCP IAM -// policies. -message WorkloadIdentityConfig { - // IAM Identity Namespace to attach all Kubernetes Service Accounts to. - string identity_namespace = 1 [deprecated = true]; - - // The workload pool to attach all Kubernetes service accounts to. - string workload_pool = 2; - - // identity provider is the third party identity provider. - string identity_provider = 3; -} - -// Configuration for direct-path (via ALTS) with workload identity. -message WorkloadALTSConfig { - // enable_alts controls whether the alts handshaker should be enabled or not - // for direct-path. - // - // Requires Workload Identity - // ([workload_pool][google.container.v1beta1.WorkloadIdentityConfig.workload_pool] - // must be non-empty). - google.protobuf.BoolValue enable_alts = 1; -} - -// Configuration for issuance of mTLS keys and certificates to Kubernetes pods. -message WorkloadCertificates { - // enable_certificates controls issuance of workload mTLS certificates. - // - // If set, the GKE Workload Identity Certificates controller and node agent - // will be deployed in the cluster, which can then be configured by creating a - // WorkloadCertificateConfig Custom Resource. - // - // Requires Workload Identity - // ([workload_pool][google.container.v1beta1.WorkloadIdentityConfig.workload_pool] - // must be non-empty). - google.protobuf.BoolValue enable_certificates = 1; -} - -// Configuration for issuance of mTLS keys and certificates to Kubernetes pods. -message MeshCertificates { - // enable_certificates controls issuance of workload mTLS certificates. - // - // If set, the GKE Workload Identity Certificates controller and node agent - // will be deployed in the cluster, which can then be configured by creating a - // WorkloadCertificateConfig Custom Resource. - // - // Requires Workload Identity - // ([workload_pool][google.container.v1alpha1.WorkloadIdentityConfig.workload_pool] - // must be non-empty). - google.protobuf.BoolValue enable_certificates = 1; -} - -// Configuration of etcd encryption. -message DatabaseEncryption { - // State of etcd encryption. - enum State { - // Should never be set - UNKNOWN = 0; - - // Secrets in etcd are encrypted. - ENCRYPTED = 1; - - // Secrets in etcd are stored in plain text (at etcd level) - this is - // unrelated to Compute Engine level full disk encryption. - DECRYPTED = 2; - } - - // Name of CloudKMS key to use for the encryption of secrets in etcd. - // Ex. projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key - string key_name = 1; - - // The desired state of etcd encryption. - State state = 2; -} - -// Configuration for exporting cluster resource usages. -message ResourceUsageExportConfig { - // Parameters for using BigQuery as the destination of resource usage export. - message BigQueryDestination { - // The ID of a BigQuery Dataset. - string dataset_id = 1; - } - - // Parameters for controlling consumption metering. - message ConsumptionMeteringConfig { - // Whether to enable consumption metering for this cluster. If enabled, a - // second BigQuery table will be created to hold resource consumption - // records. - bool enabled = 1; - } - - // Configuration to use BigQuery as usage export destination. - BigQueryDestination bigquery_destination = 1; - - // Whether to enable network egress metering for this cluster. If enabled, a - // daemonset will be created in the cluster to meter network egress traffic. - bool enable_network_egress_metering = 2; - - // Configuration to enable resource consumption metering. - ConsumptionMeteringConfig consumption_metering_config = 3; -} - -// Configuration of Shielded Nodes feature. -message ShieldedNodes { - // Whether Shielded Nodes features are enabled on all nodes in this cluster. - bool enabled = 1; -} - -// Configuration of gVNIC feature. -message VirtualNIC { - // Whether gVNIC features are enabled in the node pool. - bool enabled = 1; -} - -// Configuration of Fast Socket feature. -message FastSocket { - // Whether Fast Socket features are enabled in the node pool. - bool enabled = 1; -} - -// GetOpenIDConfigRequest gets the OIDC discovery document for the -// cluster. See the OpenID Connect Discovery 1.0 specification for details. -message GetOpenIDConfigRequest { - // The cluster (project, location, cluster name) to get the discovery document - // for. Specified in the format `projects/*/locations/*/clusters/*`. - string parent = 1; -} - -// GetOpenIDConfigResponse is an OIDC discovery document for the cluster. -// See the OpenID Connect Discovery 1.0 specification for details. -message GetOpenIDConfigResponse { - // OIDC Issuer. - string issuer = 1; - - // JSON Web Key uri. - string jwks_uri = 2; - - // Supported response types. - repeated string response_types_supported = 3; - - // Supported subject types. - repeated string subject_types_supported = 4; - - // supported ID Token signing Algorithms. - repeated string id_token_signing_alg_values_supported = 5; - - // Supported claims. - repeated string claims_supported = 6; - - // Supported grant types. - repeated string grant_types = 7; -} - -// GetJSONWebKeysRequest gets the public component of the keys used by the -// cluster to sign token requests. This will be the jwks_uri for the discover -// document returned by getOpenIDConfig. See the OpenID Connect -// Discovery 1.0 specification for details. -message GetJSONWebKeysRequest { - // The cluster (project, location, cluster name) to get keys for. Specified in - // the format `projects/*/locations/*/clusters/*`. - string parent = 1; -} - -// Jwk is a JSON Web Key as specified in RFC 7517 -message Jwk { - // Key Type. - string kty = 1; - - // Algorithm. - string alg = 2; - - // Permitted uses for the public keys. - string use = 3; - - // Key ID. - string kid = 4; - - // Used for RSA keys. - string n = 5; - - // Used for RSA keys. - string e = 6; - - // Used for ECDSA keys. - string x = 7; - - // Used for ECDSA keys. - string y = 8; - - // Used for ECDSA keys. - string crv = 9; -} - -// GetJSONWebKeysResponse is a valid JSON Web Key Set as specififed in rfc 7517 -message GetJSONWebKeysResponse { - // The public component of the keys used by the cluster to sign token - // requests. - repeated Jwk keys = 1; -} - -// CheckAutopilotCompatibilityRequest requests getting the blockers for the -// given operation in the cluster. -message CheckAutopilotCompatibilityRequest { - // The name (project, location, cluster) of the cluster to retrieve. - // Specified in the format `projects/*/locations/*/clusters/*`. - string name = 1; -} - -// AutopilotCompatibilityIssue contains information about a specific -// compatibility issue with Autopilot mode. -message AutopilotCompatibilityIssue { - // The type of the reported issue. - enum IssueType { - // Default value, should not be used. - UNSPECIFIED = 0; - - // Indicates that the issue is a known incompatibility between the - // cluster and Autopilot mode. - INCOMPATIBILITY = 1; - - // Indicates the issue is an incompatibility if customers take no further - // action to resolve. - ADDITIONAL_CONFIG_REQUIRED = 2; - - // Indicates the issue is not an incompatibility, but depending on the - // workloads business logic, there is a potential that they won't work on - // Autopilot. - PASSED_WITH_OPTIONAL_CONFIG = 3; - } - - // The last time when this issue was observed. - google.protobuf.Timestamp last_observation = 1; - - // The constraint type of the issue. - string constraint_type = 2; - - // The incompatibility type of this issue. - IssueType incompatibility_type = 3; - - // The name of the resources which are subject to this issue. - repeated string subjects = 4; - - // A URL to a public documnetation, which addresses resolving this issue. - string documentation_url = 5; - - // The description of the issue. - string description = 6; -} - -// CheckAutopilotCompatibilityResponse has a list of compatibility issues. -message CheckAutopilotCompatibilityResponse { - // The list of issues for the given operation. - repeated AutopilotCompatibilityIssue issues = 1; - - // The summary of the autopilot compatibility response. - string summary = 2; -} - -// ReleaseChannel indicates which release channel a cluster is -// subscribed to. Release channels are arranged in order of risk. -// -// When a cluster is subscribed to a release channel, Google maintains -// both the master version and the node version. Node auto-upgrade -// defaults to true and cannot be disabled. -message ReleaseChannel { - // Possible values for 'channel'. - enum Channel { - // No channel specified. - UNSPECIFIED = 0; - - // RAPID channel is offered on an early access basis for customers who want - // to test new releases. - // - // WARNING: Versions available in the RAPID Channel may be subject to - // unresolved issues with no known workaround and are not subject to any - // SLAs. - RAPID = 1; - - // Clusters subscribed to REGULAR receive versions that are considered GA - // quality. REGULAR is intended for production users who want to take - // advantage of new features. - REGULAR = 2; - - // Clusters subscribed to STABLE receive versions that are known to be - // stable and reliable in production. - STABLE = 3; - } - - // channel specifies which release channel the cluster is subscribed to. - Channel channel = 1; -} - -// Configuration for fine-grained cost management feature. -message CostManagementConfig { - // Whether the feature is enabled or not. - bool enabled = 1; -} - -// Configuration for Cloud TPU. -message TpuConfig { - // Whether Cloud TPU integration is enabled or not. - bool enabled = 1; - - // Whether to use service networking for Cloud TPU or not. - bool use_service_networking = 2; - - // IPv4 CIDR block reserved for Cloud TPU in the VPC. - string ipv4_cidr_block = 3; -} - -// PrivateIPv6GoogleAccess controls whether and how the pods can communicate -// with Google Services through gRPC over IPv6. -enum PrivateIPv6GoogleAccess { - // Default value. Same as DISABLED - PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED = 0; - - // No private access to or from Google Services - PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED = 1; - - // Enables private IPv6 access to Google Services from GKE - PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE = 2; - - // Enables private IPv6 access to and from Google Services - PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL = 3; -} - -// Master is the configuration for components on master. -message Master {} - -// Autopilot is the configuration for Autopilot settings on the cluster. -message Autopilot { - // Enable Autopilot - bool enabled = 1; - - // Workload policy configuration for Autopilot. - WorkloadPolicyConfig workload_policy_config = 2; -} - -// WorkloadPolicyConfig is the configuration of workload policy for autopilot -// clusters. -message WorkloadPolicyConfig { - // If true, workloads can use NET_ADMIN capability. - optional bool allow_net_admin = 1; -} - -// NotificationConfig is the configuration of notifications. -message NotificationConfig { - // Types of notifications currently supported. Can be used to filter what - // notifications are sent. - enum EventType { - // Not set, will be ignored. - EVENT_TYPE_UNSPECIFIED = 0; - - // Corresponds with UpgradeAvailableEvent. - UPGRADE_AVAILABLE_EVENT = 1; - - // Corresponds with UpgradeEvent. - UPGRADE_EVENT = 2; - - // Corresponds with SecurityBulletinEvent. - SECURITY_BULLETIN_EVENT = 3; - } - - // Pub/Sub specific notification config. - message PubSub { - // Enable notifications for Pub/Sub. - bool enabled = 1; - - // The desired Pub/Sub topic to which notifications will be - // sent by GKE. Format is `projects/{project}/topics/{topic}`. - string topic = 2 [ - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Allows filtering to one or more specific event types. If no filter is - // specified, or if a filter is specified with no event types, all event - // types will be sent - Filter filter = 3; - } - - // Allows filtering to one or more specific event types. If event types are - // present, those and only those event types will be transmitted to the - // cluster. Other types will be skipped. If no filter is specified, or no - // event types are present, all event types will be sent - message Filter { - // Event types to allowlist. - repeated EventType event_type = 1; - } - - // Notification config for Pub/Sub. - PubSub pubsub = 1; -} - -// ConfidentialNodes is configuration for the confidential nodes feature, which -// makes nodes run on confidential VMs. -message ConfidentialNodes { - // Whether Confidential Nodes feature is enabled. - bool enabled = 1; -} - -// UpgradeResourceType is the resource type that is upgrading. It is used -// in upgrade notifications. -enum UpgradeResourceType { - // Default value. This shouldn't be used. - UPGRADE_RESOURCE_TYPE_UNSPECIFIED = 0; - - // Master / control plane - MASTER = 1; - - // Node pool - NODE_POOL = 2; -} - -// UpgradeEvent is a notification sent to customers by the cluster server when -// a resource is upgrading. -message UpgradeEvent { - // The resource type that is upgrading. - UpgradeResourceType resource_type = 1; - - // The operation associated with this upgrade. - string operation = 2; - - // The time when the operation was started. - google.protobuf.Timestamp operation_start_time = 3; - - // The current version before the upgrade. - string current_version = 4; - - // The target version for the upgrade. - string target_version = 5; - - // Optional relative path to the resource. For example in node pool upgrades, - // the relative path of the node pool. - string resource = 6; -} - -// UpgradeAvailableEvent is a notification sent to customers when a new -// available version is released. -message UpgradeAvailableEvent { - // The release version available for upgrade. - string version = 1; - - // The resource type of the release version. - UpgradeResourceType resource_type = 2; - - // The release channel of the version. If empty, it means a non-channel - // release. - ReleaseChannel release_channel = 3; - - // Optional relative path to the resource. For example, the relative path of - // the node pool. - string resource = 4; - - // Windows node versions info. - WindowsVersions windows_versions = 5; -} - -// SecurityBulletinEvent is a notification sent to customers when a security -// bulletin has been posted that they are vulnerable to. -message SecurityBulletinEvent { - // The resource type (node/control plane) that has the vulnerability. Multiple - // notifications (1 notification per resource type) will be sent for a - // vulnerability that affects > 1 resource type. - string resource_type_affected = 1; - - // The ID of the bulletin corresponding to the vulnerability. - string bulletin_id = 2; - - // The CVEs associated with this bulletin. - repeated string cve_ids = 3; - - // The severity of this bulletin as it relates to GKE. - string severity = 4; - - // The URI link to the bulletin on the website for more information. - string bulletin_uri = 5; - - // A brief description of the bulletin. See the bulletin pointed to by the - // bulletin_uri field for an expanded description. - string brief_description = 6; - - // The GKE minor versions affected by this vulnerability. - repeated string affected_supported_minors = 7; - - // The GKE versions where this vulnerability is patched. - repeated string patched_versions = 8; - - // This represents a version selected from the patched_versions field that - // the cluster receiving this notification should most likely want to upgrade - // to based on its current version. Note that if this notification is being - // received by a given cluster, it means that this version is currently - // available as an upgrade target in that cluster's location. - string suggested_upgrade_target = 9; - - // If this field is specified, it means there are manual steps that the user - // must take to make their clusters safe. - bool manual_steps_required = 10; -} - -// IdentityServiceConfig is configuration for Identity Service which allows -// customers to use external identity providers with the K8S API -message IdentityServiceConfig { - // Whether to enable the Identity Service component - bool enabled = 1; -} - -// Strategy used for node pool update. -enum NodePoolUpdateStrategy { - // Default value if unset. GKE internally defaults the update strategy to - // SURGE for unspecified strategies. - NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED = 0; - - // blue-green upgrade. - BLUE_GREEN = 2; - - // SURGE is the traditional way of upgrading a node pool. - // max_surge and max_unavailable determines the level of upgrade parallelism. - SURGE = 3; -} - -// LoggingConfig is cluster logging configuration. -message LoggingConfig { - // Logging components configuration - LoggingComponentConfig component_config = 1; -} - -// LoggingComponentConfig is cluster logging component configuration. -message LoggingComponentConfig { - // GKE components exposing logs - enum Component { - // Default value. This shouldn't be used. - COMPONENT_UNSPECIFIED = 0; - - // system components - SYSTEM_COMPONENTS = 1; - - // workloads - WORKLOADS = 2; - - // kube-apiserver - APISERVER = 3; - - // kube-scheduler - SCHEDULER = 4; - - // kube-controller-manager - CONTROLLER_MANAGER = 5; - } - - // Select components to collect logs. An empty set would disable all logging. - repeated Component enable_components = 1; -} - -// MonitoringConfig is cluster monitoring configuration. -message MonitoringConfig { - // Monitoring components configuration - MonitoringComponentConfig component_config = 1; - - // Enable Google Cloud Managed Service for Prometheus - // in the cluster. - ManagedPrometheusConfig managed_prometheus_config = 2; - - // Configuration of Advanced Datapath Observability features. - AdvancedDatapathObservabilityConfig advanced_datapath_observability_config = - 3; -} - -// AdvancedDatapathObservabilityConfig specifies configuration of observability -// features of advanced datapath. -message AdvancedDatapathObservabilityConfig { - // Supported Relay modes - enum RelayMode { - // Default value. This shouldn't be used. - RELAY_MODE_UNSPECIFIED = 0; - - // disabled - DISABLED = 1; - - // exposed via internal load balancer - INTERNAL_VPC_LB = 3; - - // exposed via external load balancer - EXTERNAL_LB = 4; - } - - // Expose flow metrics on nodes - bool enable_metrics = 1; - - // Method used to make Relay available - RelayMode relay_mode = 2; -} - -// NodePoolLoggingConfig specifies logging configuration for nodepools. -message NodePoolLoggingConfig { - // Logging variant configuration. - LoggingVariantConfig variant_config = 1; -} - -// LoggingVariantConfig specifies the behaviour of the logging component. -message LoggingVariantConfig { - // Logging component variants. - enum Variant { - // Default value. This shouldn't be used. - VARIANT_UNSPECIFIED = 0; - - // default logging variant. - DEFAULT = 1; - - // maximum logging throughput variant. - MAX_THROUGHPUT = 2; - } - - // Logging variant deployed on nodes. - Variant variant = 1; -} - -// MonitoringComponentConfig is cluster monitoring component configuration. -message MonitoringComponentConfig { - // GKE components exposing metrics - enum Component { - // Default value. This shouldn't be used. - COMPONENT_UNSPECIFIED = 0; - - // system components - SYSTEM_COMPONENTS = 1; - - // Deprecated: Use Google Cloud Managed Service for Prometheus. - WORKLOADS = 2 [deprecated = true]; - - // kube-apiserver - APISERVER = 3; - - // kube-scheduler - SCHEDULER = 4; - - // kube-controller-manager - CONTROLLER_MANAGER = 5; - - // Storage - STORAGE = 7; - - // Horizontal Pod Autoscaling - HPA = 8; - - // Pod - POD = 9; - - // DaemonSet - DAEMONSET = 10; - - // Deployment - DEPLOYMENT = 11; - - // Statefulset - STATEFULSET = 12; - } - - // Select components to collect metrics. An empty set would disable all - // monitoring. - repeated Component enable_components = 1; -} - -// The datapath provider selects the implementation of the Kubernetes networking -// model for service resolution and network policy enforcement. -enum DatapathProvider { - // Default value. - DATAPATH_PROVIDER_UNSPECIFIED = 0; - - // Use the IPTables implementation based on kube-proxy. - LEGACY_DATAPATH = 1; - - // Use the eBPF based GKE Dataplane V2 with additional features. See the [GKE - // Dataplane V2 - // documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/dataplane-v2) - // for more. - ADVANCED_DATAPATH = 2; -} - -// Fleet is the fleet configuration for the cluster. -message Fleet { - // The Fleet host project(project ID or project number) where this cluster - // will be registered to. This field cannot be changed after the cluster has - // been registered. - string project = 1; - - // [Output only] The full resource name of the registered fleet membership of - // the cluster, in the format - // `//gkehub.googleapis.com/projects/*/locations/*/memberships/*`. - string membership = 2; - - // [Output only] Whether the cluster has been registered through the fleet - // API. - bool pre_registered = 3; -} - -// Possible values for IP stack type -enum StackType { - // By default, the clusters will be IPV4 only - STACK_TYPE_UNSPECIFIED = 0; - - // The value used if the cluster is a IPV4 only - IPV4 = 1; - - // The value used if the cluster is a dual stack cluster - IPV4_IPV6 = 2; -} diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.cancel_operation.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.cancel_operation.js deleted file mode 100644 index 939c8c4aaca..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.cancel_operation.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(projectId, zone, operationId) { - // [START container_v1beta1_generated_ClusterManager_CancelOperation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, operation id) of the operation to cancel. - * Specified in the format `projects/* /locations/* /operations/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCancelOperation() { - // Construct request - const request = { - projectId, - zone, - operationId, - }; - - // Run request - const response = await containerClient.cancelOperation(request); - console.log(response); - } - - callCancelOperation(); - // [END container_v1beta1_generated_ClusterManager_CancelOperation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.check_autopilot_compatibility.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.check_autopilot_compatibility.js deleted file mode 100644 index 4511c66ce17..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.check_autopilot_compatibility.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 container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster) of the cluster to retrieve. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCheckAutopilotCompatibility() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.checkAutopilotCompatibility(request); - console.log(response); - } - - callCheckAutopilotCompatibility(); - // [END container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_i_p_rotation.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_i_p_rotation.js deleted file mode 100644 index 57cb300a08f..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_i_p_rotation.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(projectId, zone, clusterId) { - // [START container_v1beta1_generated_ClusterManager_CompleteIPRotation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster name) of the cluster to complete IP - * rotation. Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCompleteIPRotation() { - // Construct request - const request = { - projectId, - zone, - clusterId, - }; - - // Run request - const response = await containerClient.completeIPRotation(request); - console.log(response); - } - - callCompleteIPRotation(); - // [END container_v1beta1_generated_ClusterManager_CompleteIPRotation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_node_pool_upgrade.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_node_pool_upgrade.js deleted file mode 100644 index 152c6971b1b..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.complete_node_pool_upgrade.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() { - // [START container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster, node pool id) of the node pool to - * complete upgrade. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCompleteNodePoolUpgrade() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.completeNodePoolUpgrade(request); - console.log(response); - } - - callCompleteNodePoolUpgrade(); - // [END container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_cluster.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_cluster.js deleted file mode 100644 index 4414e1ca9d3..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_cluster.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(projectId, zone, cluster) { - // [START container_v1beta1_generated_ClusterManager_CreateCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 cluster - * resource (https://cloud.google.com/container-engine/reference/rest/v1beta1/projects.locations.clusters) - */ - // const cluster = {} - /** - * The parent (project and location) where the cluster will be created. - * Specified in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCreateCluster() { - // Construct request - const request = { - projectId, - zone, - cluster, - }; - - // Run request - const response = await containerClient.createCluster(request); - console.log(response); - } - - callCreateCluster(); - // [END container_v1beta1_generated_ClusterManager_CreateCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_node_pool.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_node_pool.js deleted file mode 100644 index 9d53c6be79e..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.create_node_pool.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(projectId, zone, clusterId, nodePool) { - // [START container_v1beta1_generated_ClusterManager_CreateNodePool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The node pool to create. - */ - // const nodePool = {} - /** - * The parent (project, location, cluster name) where the node pool will be - * created. Specified in the format - * `projects/* /locations/* /clusters/*`. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callCreateNodePool() { - // Construct request - const request = { - projectId, - zone, - clusterId, - nodePool, - }; - - // Run request - const response = await containerClient.createNodePool(request); - console.log(response); - } - - callCreateNodePool(); - // [END container_v1beta1_generated_ClusterManager_CreateNodePool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_cluster.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_cluster.js deleted file mode 100644 index d387c456166..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_cluster.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(projectId, zone, clusterId) { - // [START container_v1beta1_generated_ClusterManager_DeleteCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster) of the cluster to delete. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callDeleteCluster() { - // Construct request - const request = { - projectId, - zone, - clusterId, - }; - - // Run request - const response = await containerClient.deleteCluster(request); - console.log(response); - } - - callDeleteCluster(); - // [END container_v1beta1_generated_ClusterManager_DeleteCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_node_pool.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_node_pool.js deleted file mode 100644 index d406bb8686c..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.delete_node_pool.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(projectId, zone, clusterId, nodePoolId) { - // [START container_v1beta1_generated_ClusterManager_DeleteNodePool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster, node pool id) of the node pool to - * delete. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callDeleteNodePool() { - // Construct request - const request = { - projectId, - zone, - clusterId, - nodePoolId, - }; - - // Run request - const response = await containerClient.deleteNodePool(request); - console.log(response); - } - - callDeleteNodePool(); - // [END container_v1beta1_generated_ClusterManager_DeleteNodePool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_cluster.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_cluster.js deleted file mode 100644 index 0e388e69226..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_cluster.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(projectId, zone, clusterId) { - // [START container_v1beta1_generated_ClusterManager_GetCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster) of the cluster to retrieve. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callGetCluster() { - // Construct request - const request = { - projectId, - zone, - clusterId, - }; - - // Run request - const response = await containerClient.getCluster(request); - console.log(response); - } - - callGetCluster(); - // [END container_v1beta1_generated_ClusterManager_GetCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_j_s_o_n_web_keys.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_j_s_o_n_web_keys.js deleted file mode 100644 index f48cfa5316d..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_j_s_o_n_web_keys.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 container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 cluster (project, location, cluster name) to get keys for. Specified in - * the format `projects/* /locations/* /clusters/*`. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callGetJSONWebKeys() { - // Construct request - const request = { - }; - - // Run request - const response = await containerClient.getJSONWebKeys(request); - console.log(response); - } - - callGetJSONWebKeys(); - // [END container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_node_pool.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_node_pool.js deleted file mode 100644 index 21f384189f6..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_node_pool.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(projectId, zone, clusterId, nodePoolId) { - // [START container_v1beta1_generated_ClusterManager_GetNodePool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster, node pool id) of the node pool to - * get. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callGetNodePool() { - // Construct request - const request = { - projectId, - zone, - clusterId, - nodePoolId, - }; - - // Run request - const response = await containerClient.getNodePool(request); - console.log(response); - } - - callGetNodePool(); - // [END container_v1beta1_generated_ClusterManager_GetNodePool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_operation.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_operation.js deleted file mode 100644 index f693d6982e6..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_operation.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(projectId, zone, operationId) { - // [START container_v1beta1_generated_ClusterManager_GetOperation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, operation id) of the operation to get. - * Specified in the format `projects/* /locations/* /operations/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callGetOperation() { - // Construct request - const request = { - projectId, - zone, - operationId, - }; - - // Run request - const response = await containerClient.getOperation(request); - console.log(response); - } - - callGetOperation(); - // [END container_v1beta1_generated_ClusterManager_GetOperation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_server_config.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_server_config.js deleted file mode 100644 index 147c03feb39..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.get_server_config.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(projectId, zone) { - // [START container_v1beta1_generated_ClusterManager_GetServerConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project and location) of the server config to get, - * specified in the format `projects/* /locations/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callGetServerConfig() { - // Construct request - const request = { - projectId, - zone, - }; - - // Run request - const response = await containerClient.getServerConfig(request); - console.log(response); - } - - callGetServerConfig(); - // [END container_v1beta1_generated_ClusterManager_GetServerConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_clusters.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_clusters.js deleted file mode 100644 index 3a468a6e586..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_clusters.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(projectId, zone) { - // [START container_v1beta1_generated_ClusterManager_ListClusters_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 clusters will be listed. - * Specified in the format `projects/* /locations/*`. - * Location "-" matches all zones and all regions. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callListClusters() { - // Construct request - const request = { - projectId, - zone, - }; - - // Run request - const response = await containerClient.listClusters(request); - console.log(response); - } - - callListClusters(); - // [END container_v1beta1_generated_ClusterManager_ListClusters_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_locations.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_locations.js deleted file mode 100644 index 62e86afb204..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_locations.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 container_v1beta1_generated_ClusterManager_ListLocations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Contains the name of the resource requested. - * Specified in the format `projects/*`. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callListLocations() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await containerClient.listLocations(request); - console.log(response); - } - - callListLocations(); - // [END container_v1beta1_generated_ClusterManager_ListLocations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_node_pools.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_node_pools.js deleted file mode 100644 index 6c5aaa855e4..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_node_pools.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(projectId, zone, clusterId) { - // [START container_v1beta1_generated_ClusterManager_ListNodePools_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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, location, cluster name) where the node pools will be - * listed. Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callListNodePools() { - // Construct request - const request = { - projectId, - zone, - clusterId, - }; - - // Run request - const response = await containerClient.listNodePools(request); - console.log(response); - } - - callListNodePools(); - // [END container_v1beta1_generated_ClusterManager_ListNodePools_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_operations.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_operations.js deleted file mode 100644 index adaf08f3129..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_operations.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(projectId, zone) { - // [START container_v1beta1_generated_ClusterManager_ListOperations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 operations will be listed. - * Specified in the format `projects/* /locations/*`. - * Location "-" matches all zones and all regions. - */ - // const parent = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callListOperations() { - // Construct request - const request = { - projectId, - zone, - }; - - // Run request - const response = await containerClient.listOperations(request); - console.log(response); - } - - callListOperations(); - // [END container_v1beta1_generated_ClusterManager_ListOperations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_usable_subnetworks.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_usable_subnetworks.js deleted file mode 100644 index 400d21f447c..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.list_usable_subnetworks.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 container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 where subnetworks are usable. - * Specified in the format `projects/*`. - */ - // const parent = 'abc123' - /** - * Filtering currently only supports equality on the networkProjectId and must - * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` - * is the project which owns the listed subnetworks. This defaults to the - * parent project ID. - */ - // const filter = 'abc123' - /** - * The max number of results per page that should be returned. If the number - * of available results is larger than `page_size`, a `next_page_token` is - * returned which can be used to get the next page of results in subsequent - * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - */ - // const pageSize = 1234 - /** - * Specifies a page token to use. Set this to the nextPageToken returned by - * previous list requests to get the next page of results. - */ - // const pageToken = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callListUsableSubnetworks() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await containerClient.listUsableSubnetworksAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListUsableSubnetworks(); - // [END container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.rollback_node_pool_upgrade.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.rollback_node_pool_upgrade.js deleted file mode 100644 index fd127925ad0..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.rollback_node_pool_upgrade.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(projectId, zone, clusterId, nodePoolId) { - // [START container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster, node pool id) of the node poll to - * rollback upgrade. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - /** - * Option for rollback to ignore the PodDisruptionBudget. - * Default value is false. - */ - // const respectPdb = true - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callRollbackNodePoolUpgrade() { - // Construct request - const request = { - projectId, - zone, - clusterId, - nodePoolId, - }; - - // Run request - const response = await containerClient.rollbackNodePoolUpgrade(request); - console.log(response); - } - - callRollbackNodePoolUpgrade(); - // [END container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_addons_config.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_addons_config.js deleted file mode 100644 index 575a4bf0e5f..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_addons_config.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(projectId, zone, clusterId, addonsConfig) { - // [START container_v1beta1_generated_ClusterManager_SetAddonsConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The desired configurations for the various addons available to - * run in the cluster. - */ - // const addonsConfig = {} - /** - * The name (project, location, cluster) of the cluster to set addons. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetAddonsConfig() { - // Construct request - const request = { - projectId, - zone, - clusterId, - addonsConfig, - }; - - // Run request - const response = await containerClient.setAddonsConfig(request); - console.log(response); - } - - callSetAddonsConfig(); - // [END container_v1beta1_generated_ClusterManager_SetAddonsConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_labels.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_labels.js deleted file mode 100644 index 25237d1b2e1..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_labels.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(projectId, zone, clusterId, resourceLabels, labelFingerprint) { - // [START container_v1beta1_generated_ClusterManager_SetLabels_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The labels to set for that cluster. - */ - // const resourceLabels = [1,2,3,4] - /** - * Required. The fingerprint of the previous set of labels for this resource, - * used to detect conflicts. The fingerprint is initially generated by - * Kubernetes Engine and changes after every request to modify or update - * labels. You must always provide an up-to-date fingerprint hash when - * updating or changing labels. Make a `get()` request to the - * resource to get the latest fingerprint. - */ - // const labelFingerprint = 'abc123' - /** - * The name (project, location, cluster name) of the cluster to set labels. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetLabels() { - // Construct request - const request = { - projectId, - zone, - clusterId, - resourceLabels, - labelFingerprint, - }; - - // Run request - const response = await containerClient.setLabels(request); - console.log(response); - } - - callSetLabels(); - // [END container_v1beta1_generated_ClusterManager_SetLabels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_legacy_abac.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_legacy_abac.js deleted file mode 100644 index c59d4c74879..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_legacy_abac.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(projectId, zone, clusterId, enabled) { - // [START container_v1beta1_generated_ClusterManager_SetLegacyAbac_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Whether ABAC authorization will be enabled in the cluster. - */ - // const enabled = true - /** - * The name (project, location, cluster name) of the cluster to set legacy - * abac. Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetLegacyAbac() { - // Construct request - const request = { - projectId, - zone, - clusterId, - enabled, - }; - - // Run request - const response = await containerClient.setLegacyAbac(request); - console.log(response); - } - - callSetLegacyAbac(); - // [END container_v1beta1_generated_ClusterManager_SetLegacyAbac_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_locations.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_locations.js deleted file mode 100644 index 48de1254575..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_locations.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(projectId, zone, clusterId, locations) { - // [START container_v1beta1_generated_ClusterManager_SetLocations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The desired list of Google Compute Engine - * zones (https://cloud.google.com/compute/docs/zones#available) in which the - * cluster's nodes should be located. Changing the locations a cluster is in - * will result in nodes being either created or removed from the cluster, - * depending on whether locations are being added or removed. - * This list must always include the cluster's primary zone. - */ - // const locations = ['abc','def'] - /** - * The name (project, location, cluster) of the cluster to set locations. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetLocations() { - // Construct request - const request = { - projectId, - zone, - clusterId, - locations, - }; - - // Run request - const response = await containerClient.setLocations(request); - console.log(response); - } - - callSetLocations(); - // [END container_v1beta1_generated_ClusterManager_SetLocations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_logging_service.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_logging_service.js deleted file mode 100644 index e6cd4a0d7f1..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_logging_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(projectId, zone, clusterId, loggingService) { - // [START container_v1beta1_generated_ClusterManager_SetLoggingService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The logging service the cluster should use to write logs. - * Currently available options: - * * `logging.googleapis.com/kubernetes` - The Cloud Logging - * service with a Kubernetes-native resource model - * * `logging.googleapis.com` - The legacy Cloud Logging service (no longer - * available as of GKE 1.15). - * * `none` - no logs will be exported from the cluster. - * If left as an empty string,`logging.googleapis.com/kubernetes` will be - * used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. - */ - // const loggingService = 'abc123' - /** - * The name (project, location, cluster) of the cluster to set logging. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetLoggingService() { - // Construct request - const request = { - projectId, - zone, - clusterId, - loggingService, - }; - - // Run request - const response = await containerClient.setLoggingService(request); - console.log(response); - } - - callSetLoggingService(); - // [END container_v1beta1_generated_ClusterManager_SetLoggingService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_maintenance_policy.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_maintenance_policy.js deleted file mode 100644 index fa688eb7520..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_maintenance_policy.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(projectId, zone, clusterId, maintenancePolicy) { - // [START container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Developers Console project ID or project - * number (https://cloud.google.com/resource-manager/docs/creating-managing-projects). - */ - // const projectId = 'abc123' - /** - * Required. The name of the Google Compute Engine - * zone (https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. - */ - // const zone = 'abc123' - /** - * Required. The name of the cluster to update. - */ - // const clusterId = 'abc123' - /** - * Required. The maintenance policy to be set for the cluster. An empty field - * clears the existing maintenance policy. - */ - // const maintenancePolicy = {} - /** - * The name (project, location, cluster name) of the cluster to set - * maintenance policy. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetMaintenancePolicy() { - // Construct request - const request = { - projectId, - zone, - clusterId, - maintenancePolicy, - }; - - // Run request - const response = await containerClient.setMaintenancePolicy(request); - console.log(response); - } - - callSetMaintenancePolicy(); - // [END container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_master_auth.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_master_auth.js deleted file mode 100644 index f39467e7cab..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_master_auth.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(projectId, zone, clusterId, action, update) { - // [START container_v1beta1_generated_ClusterManager_SetMasterAuth_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The exact form of action to be taken on the master auth. - */ - // const action = {} - /** - * Required. A description of the update. - */ - // const update = {} - /** - * The name (project, location, cluster) of the cluster to set auth. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetMasterAuth() { - // Construct request - const request = { - projectId, - zone, - clusterId, - action, - update, - }; - - // Run request - const response = await containerClient.setMasterAuth(request); - console.log(response); - } - - callSetMasterAuth(); - // [END container_v1beta1_generated_ClusterManager_SetMasterAuth_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_monitoring_service.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_monitoring_service.js deleted file mode 100644 index a7fe3208d49..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_monitoring_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(projectId, zone, clusterId, monitoringService) { - // [START container_v1beta1_generated_ClusterManager_SetMonitoringService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The monitoring service the cluster should use to write metrics. - * Currently available options: - * * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring - * service with a Kubernetes-native resource model - * * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no - * longer available as of GKE 1.15). - * * `none` - No metrics will be exported from the cluster. - * If left as an empty string,`monitoring.googleapis.com/kubernetes` will be - * used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. - */ - // const monitoringService = 'abc123' - /** - * The name (project, location, cluster) of the cluster to set monitoring. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetMonitoringService() { - // Construct request - const request = { - projectId, - zone, - clusterId, - monitoringService, - }; - - // Run request - const response = await containerClient.setMonitoringService(request); - console.log(response); - } - - callSetMonitoringService(); - // [END container_v1beta1_generated_ClusterManager_SetMonitoringService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_network_policy.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_network_policy.js deleted file mode 100644 index 08f2bd01e43..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_network_policy.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(projectId, zone, clusterId, networkPolicy) { - // [START container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Configuration options for the NetworkPolicy feature. - */ - // const networkPolicy = {} - /** - * The name (project, location, cluster name) of the cluster to set networking - * policy. Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetNetworkPolicy() { - // Construct request - const request = { - projectId, - zone, - clusterId, - networkPolicy, - }; - - // Run request - const response = await containerClient.setNetworkPolicy(request); - console.log(response); - } - - callSetNetworkPolicy(); - // [END container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_autoscaling.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_autoscaling.js deleted file mode 100644 index 48045be1f16..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_autoscaling.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(projectId, zone, clusterId, nodePoolId, autoscaling) { - // [START container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Autoscaling configuration for the node pool. - */ - // const autoscaling = {} - /** - * The name (project, location, cluster, node pool) of the node pool to set - * autoscaler settings. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetNodePoolAutoscaling() { - // Construct request - const request = { - projectId, - zone, - clusterId, - nodePoolId, - autoscaling, - }; - - // Run request - const response = await containerClient.setNodePoolAutoscaling(request); - console.log(response); - } - - callSetNodePoolAutoscaling(); - // [END container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_management.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_management.js deleted file mode 100644 index 904e07be6c2..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_management.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(projectId, zone, clusterId, nodePoolId, management) { - // [START container_v1beta1_generated_ClusterManager_SetNodePoolManagement_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. NodeManagement configuration for the node pool. - */ - // const management = {} - /** - * The name (project, location, cluster, node pool id) of the node pool to set - * management properties. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetNodePoolManagement() { - // Construct request - const request = { - projectId, - zone, - clusterId, - nodePoolId, - management, - }; - - // Run request - const response = await containerClient.setNodePoolManagement(request); - console.log(response); - } - - callSetNodePoolManagement(); - // [END container_v1beta1_generated_ClusterManager_SetNodePoolManagement_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_size.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_size.js deleted file mode 100644 index 3903f3ff656..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.set_node_pool_size.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(projectId, zone, clusterId, nodePoolId, nodeCount) { - // [START container_v1beta1_generated_ClusterManager_SetNodePoolSize_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The desired node count for the pool. - */ - // const nodeCount = 1234 - /** - * The name (project, location, cluster, node pool id) of the node pool to set - * size. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callSetNodePoolSize() { - // Construct request - const request = { - projectId, - zone, - clusterId, - nodePoolId, - nodeCount, - }; - - // Run request - const response = await containerClient.setNodePoolSize(request); - console.log(response); - } - - callSetNodePoolSize(); - // [END container_v1beta1_generated_ClusterManager_SetNodePoolSize_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.start_i_p_rotation.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.start_i_p_rotation.js deleted file mode 100644 index 181752cb53f..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.start_i_p_rotation.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(projectId, zone, clusterId) { - // [START container_v1beta1_generated_ClusterManager_StartIPRotation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 (project, location, cluster name) of the cluster to start IP - * rotation. Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - /** - * Whether to rotate credentials during IP rotation. - */ - // const rotateCredentials = true - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callStartIPRotation() { - // Construct request - const request = { - projectId, - zone, - clusterId, - }; - - // Run request - const response = await containerClient.startIPRotation(request); - console.log(response); - } - - callStartIPRotation(); - // [END container_v1beta1_generated_ClusterManager_StartIPRotation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_cluster.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_cluster.js deleted file mode 100644 index 23c5ff8b0c8..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_cluster.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(projectId, zone, clusterId, update) { - // [START container_v1beta1_generated_ClusterManager_UpdateCluster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 description of the update. - */ - // const update = {} - /** - * The name (project, location, cluster) of the cluster to update. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callUpdateCluster() { - // Construct request - const request = { - projectId, - zone, - clusterId, - update, - }; - - // Run request - const response = await containerClient.updateCluster(request); - console.log(response); - } - - callUpdateCluster(); - // [END container_v1beta1_generated_ClusterManager_UpdateCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_master.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_master.js deleted file mode 100644 index d76efa7a362..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_master.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(projectId, zone, clusterId, masterVersion) { - // [START container_v1beta1_generated_ClusterManager_UpdateMaster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Kubernetes version to change the master to. - * Users may specify either explicit versions offered by - * Kubernetes Engine or version aliases, which have the following behavior: - * - "latest": picks the highest valid Kubernetes version - * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - * - "1.X.Y-gke.N": picks an explicit Kubernetes version - * - "-": picks the default Kubernetes version - */ - // const masterVersion = 'abc123' - /** - * The name (project, location, cluster) of the cluster to update. - * Specified in the format `projects/* /locations/* /clusters/*`. - */ - // const name = 'abc123' - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callUpdateMaster() { - // Construct request - const request = { - projectId, - zone, - clusterId, - masterVersion, - }; - - // Run request - const response = await containerClient.updateMaster(request); - console.log(response); - } - - callUpdateMaster(); - // [END container_v1beta1_generated_ClusterManager_UpdateMaster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_node_pool.js b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_node_pool.js deleted file mode 100644 index 3ce346d4a1b..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/cluster_manager.update_node_pool.js +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, zone, clusterId, nodePoolId, nodeVersion, imageType) { - // [START container_v1beta1_generated_ClusterManager_UpdateNodePool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Kubernetes version to change the nodes to (typically an - * upgrade). - * Users may specify either explicit versions offered by Kubernetes Engine or - * version aliases, which have the following behavior: - * - "latest": picks the highest valid Kubernetes version - * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - * - "1.X.Y-gke.N": picks an explicit Kubernetes version - * - "-": picks the Kubernetes master version - */ - // const nodeVersion = 'abc123' - /** - * Required. The desired image type for the node pool. Please see - * https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for - * available image types. - */ - // const imageType = 'abc123' - /** - * The desired list of Google Compute Engine - * zones (https://cloud.google.com/compute/docs/zones#available) in which the - * node pool's nodes should be located. Changing the locations for a node pool - * will result in nodes being either created or removed from the node pool, - * depending on whether locations are being added or removed. - */ - // const locations = ['abc','def'] - /** - * The desired workload metadata config for the node pool. - */ - // const workloadMetadataConfig = {} - /** - * The name (project, location, cluster, node pool) of the node pool to - * update. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - */ - // const name = 'abc123' - /** - * Upgrade settings control disruption and speed of the upgrade. - */ - // const upgradeSettings = {} - /** - * The desired network tags to be applied to all nodes in the node pool. - * If this field is not present, the tags will not be changed. Otherwise, - * the existing network tags will be *replaced* with the provided tags. - */ - // const tags = {} - /** - * The desired node taints to be applied to all nodes in the node pool. - * If this field is not present, the taints will not be changed. Otherwise, - * the existing node taints will be *replaced* with the provided taints. - */ - // const taints = {} - /** - * The desired node labels to be applied to all nodes in the node pool. - * If this field is not present, the labels will not be changed. Otherwise, - * the existing node labels will be *replaced* with the provided labels. - */ - // const labels = {} - /** - * Parameters that can be configured on Linux nodes. - */ - // const linuxNodeConfig = {} - /** - * Node kubelet configs. - */ - // const kubeletConfig = {} - /** - * Node network config. - */ - // const nodeNetworkConfig = {} - /** - * GCFS config. - */ - // const gcfsConfig = {} - /** - * Confidential nodes config. - * All the nodes in the node pool will be Confidential VM once enabled. - */ - // const confidentialNodes = {} - /** - * Enable or disable gvnic on the node pool. - */ - // const gvnic = {} - /** - * The current etag of the node pool. - * If an etag is provided and does not match the current etag of the node - * pool, update will be blocked and an ABORTED error will be returned. - */ - // const etag = 'abc123' - /** - * Enable or disable NCCL fast socket for the node pool. - */ - // const fastSocket = {} - /** - * Logging configuration. - */ - // const loggingConfig = {} - /** - * The resource labels for the node pool to use to annotate any related - * Google Compute Engine resources. - */ - // const resourceLabels = {} - /** - * Parameters that can be configured on Windows nodes. - */ - // const windowsNodeConfig = {} - - // Imports the Container library - const {ClusterManagerClient} = require('@google-cloud/container').v1beta1; - - // Instantiates a client - const containerClient = new ClusterManagerClient(); - - async function callUpdateNodePool() { - // Construct request - const request = { - projectId, - zone, - clusterId, - nodePoolId, - nodeVersion, - imageType, - }; - - // Run request - const response = await containerClient.updateNodePool(request); - console.log(response); - } - - callUpdateNodePool(); - // [END container_v1beta1_generated_ClusterManager_UpdateNodePool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/snippet_metadata_google.container.v1beta1.json b/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/snippet_metadata_google.container.v1beta1.json deleted file mode 100644 index 5e5c05ee1ca..00000000000 --- a/owl-bot-staging/google-container/v1beta1/samples/generated/v1beta1/snippet_metadata_google.container.v1beta1.json +++ /dev/null @@ -1,1955 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-container", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.container.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "container_v1beta1_generated_ClusterManager_ListClusters_async", - "title": "ClusterManager listClusters Sample", - "origin": "API_DEFINITION", - "description": " Lists all clusters owned by a project in either the specified zone or all zones.", - "canonical": true, - "file": "cluster_manager.list_clusters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListClusters", - "fullName": "google.container.v1beta1.ClusterManager.ListClusters", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.ListClustersResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "ListClusters", - "fullName": "google.container.v1beta1.ClusterManager.ListClusters", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_GetCluster_async", - "title": "ClusterManager getCluster Sample", - "origin": "API_DEFINITION", - "description": " Gets the details for a specific cluster.", - "canonical": true, - "file": "cluster_manager.get_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCluster", - "fullName": "google.container.v1beta1.ClusterManager.GetCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Cluster", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "GetCluster", - "fullName": "google.container.v1beta1.ClusterManager.GetCluster", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_CreateCluster_async", - "title": "ClusterManager createCluster Sample", - "origin": "API_DEFINITION", - "description": " Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's [default network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.", - "canonical": true, - "file": "cluster_manager.create_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCluster", - "fullName": "google.container.v1beta1.ClusterManager.CreateCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster", - "type": ".google.container.v1beta1.Cluster" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "CreateCluster", - "fullName": "google.container.v1beta1.ClusterManager.CreateCluster", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_UpdateCluster_async", - "title": "ClusterManager updateCluster Sample", - "origin": "API_DEFINITION", - "description": " Updates the settings for a specific cluster.", - "canonical": true, - "file": "cluster_manager.update_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCluster", - "fullName": "google.container.v1beta1.ClusterManager.UpdateCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "update", - "type": ".google.container.v1beta1.ClusterUpdate" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "UpdateCluster", - "fullName": "google.container.v1beta1.ClusterManager.UpdateCluster", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_UpdateNodePool_async", - "title": "ClusterManager updateNodePool Sample", - "origin": "API_DEFINITION", - "description": " Updates the version and/or image type of a specific node pool.", - "canonical": true, - "file": "cluster_manager.update_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 160, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNodePool", - "fullName": "google.container.v1beta1.ClusterManager.UpdateNodePool", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "node_version", - "type": "TYPE_STRING" - }, - { - "name": "image_type", - "type": "TYPE_STRING" - }, - { - "name": "locations", - "type": "TYPE_STRING[]" - }, - { - "name": "workload_metadata_config", - "type": ".google.container.v1beta1.WorkloadMetadataConfig" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "upgrade_settings", - "type": ".google.container.v1beta1.NodePool.UpgradeSettings" - }, - { - "name": "tags", - "type": ".google.container.v1beta1.NetworkTags" - }, - { - "name": "taints", - "type": ".google.container.v1beta1.NodeTaints" - }, - { - "name": "labels", - "type": ".google.container.v1beta1.NodeLabels" - }, - { - "name": "linux_node_config", - "type": ".google.container.v1beta1.LinuxNodeConfig" - }, - { - "name": "kubelet_config", - "type": ".google.container.v1beta1.NodeKubeletConfig" - }, - { - "name": "node_network_config", - "type": ".google.container.v1beta1.NodeNetworkConfig" - }, - { - "name": "gcfs_config", - "type": ".google.container.v1beta1.GcfsConfig" - }, - { - "name": "confidential_nodes", - "type": ".google.container.v1beta1.ConfidentialNodes" - }, - { - "name": "gvnic", - "type": ".google.container.v1beta1.VirtualNIC" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "fast_socket", - "type": ".google.container.v1beta1.FastSocket" - }, - { - "name": "logging_config", - "type": ".google.container.v1beta1.NodePoolLoggingConfig" - }, - { - "name": "resource_labels", - "type": ".google.container.v1beta1.ResourceLabels" - }, - { - "name": "windows_node_config", - "type": ".google.container.v1beta1.WindowsNodeConfig" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "UpdateNodePool", - "fullName": "google.container.v1beta1.ClusterManager.UpdateNodePool", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_async", - "title": "ClusterManager setNodePoolAutoscaling Sample", - "origin": "API_DEFINITION", - "description": " Sets the autoscaling settings of a specific node pool.", - "canonical": true, - "file": "cluster_manager.set_node_pool_autoscaling.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetNodePoolAutoscaling", - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolAutoscaling", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "autoscaling", - "type": ".google.container.v1beta1.NodePoolAutoscaling" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetNodePoolAutoscaling", - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolAutoscaling", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetLoggingService_async", - "title": "ClusterManager setLoggingService Sample", - "origin": "API_DEFINITION", - "description": " Sets the logging service for a specific cluster.", - "canonical": true, - "file": "cluster_manager.set_logging_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetLoggingService", - "fullName": "google.container.v1beta1.ClusterManager.SetLoggingService", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "logging_service", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetLoggingService", - "fullName": "google.container.v1beta1.ClusterManager.SetLoggingService", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetMonitoringService_async", - "title": "ClusterManager setMonitoringService Sample", - "origin": "API_DEFINITION", - "description": " Sets the monitoring service for a specific cluster.", - "canonical": true, - "file": "cluster_manager.set_monitoring_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetMonitoringService", - "fullName": "google.container.v1beta1.ClusterManager.SetMonitoringService", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "monitoring_service", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetMonitoringService", - "fullName": "google.container.v1beta1.ClusterManager.SetMonitoringService", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetAddonsConfig_async", - "title": "ClusterManager setAddonsConfig Sample", - "origin": "API_DEFINITION", - "description": " Sets the addons for a specific cluster.", - "canonical": true, - "file": "cluster_manager.set_addons_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetAddonsConfig", - "fullName": "google.container.v1beta1.ClusterManager.SetAddonsConfig", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "addons_config", - "type": ".google.container.v1beta1.AddonsConfig" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetAddonsConfig", - "fullName": "google.container.v1beta1.ClusterManager.SetAddonsConfig", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetLocations_async", - "title": "ClusterManager setLocations Sample", - "origin": "API_DEFINITION", - "description": " Sets the locations for a specific cluster. Deprecated. Use [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters/update) instead.", - "canonical": true, - "file": "cluster_manager.set_locations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetLocations", - "fullName": "google.container.v1beta1.ClusterManager.SetLocations", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "locations", - "type": "TYPE_STRING[]" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetLocations", - "fullName": "google.container.v1beta1.ClusterManager.SetLocations", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_UpdateMaster_async", - "title": "ClusterManager updateMaster Sample", - "origin": "API_DEFINITION", - "description": " Updates the master for a specific cluster.", - "canonical": true, - "file": "cluster_manager.update_master.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMaster", - "fullName": "google.container.v1beta1.ClusterManager.UpdateMaster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "master_version", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "UpdateMaster", - "fullName": "google.container.v1beta1.ClusterManager.UpdateMaster", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetMasterAuth_async", - "title": "ClusterManager setMasterAuth Sample", - "origin": "API_DEFINITION", - "description": " Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.", - "canonical": true, - "file": "cluster_manager.set_master_auth.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetMasterAuth", - "fullName": "google.container.v1beta1.ClusterManager.SetMasterAuth", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "action", - "type": ".google.container.v1beta1.SetMasterAuthRequest.Action" - }, - { - "name": "update", - "type": ".google.container.v1beta1.MasterAuth" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetMasterAuth", - "fullName": "google.container.v1beta1.ClusterManager.SetMasterAuth", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_DeleteCluster_async", - "title": "ClusterManager deleteCluster Sample", - "origin": "API_DEFINITION", - "description": " Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.", - "canonical": true, - "file": "cluster_manager.delete_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteCluster", - "fullName": "google.container.v1beta1.ClusterManager.DeleteCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "DeleteCluster", - "fullName": "google.container.v1beta1.ClusterManager.DeleteCluster", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_ListOperations_async", - "title": "ClusterManager listOperations Sample", - "origin": "API_DEFINITION", - "description": " Lists all operations in a project in the specified zone or all zones.", - "canonical": true, - "file": "cluster_manager.list_operations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListOperations", - "fullName": "google.container.v1beta1.ClusterManager.ListOperations", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.ListOperationsResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "ListOperations", - "fullName": "google.container.v1beta1.ClusterManager.ListOperations", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_GetOperation_async", - "title": "ClusterManager getOperation Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified operation.", - "canonical": true, - "file": "cluster_manager.get_operation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOperation", - "fullName": "google.container.v1beta1.ClusterManager.GetOperation", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "operation_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "GetOperation", - "fullName": "google.container.v1beta1.ClusterManager.GetOperation", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_CancelOperation_async", - "title": "ClusterManager cancelOperation Sample", - "origin": "API_DEFINITION", - "description": " Cancels the specified operation.", - "canonical": true, - "file": "cluster_manager.cancel_operation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelOperation", - "fullName": "google.container.v1beta1.ClusterManager.CancelOperation", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "operation_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "CancelOperation", - "fullName": "google.container.v1beta1.ClusterManager.CancelOperation", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_GetServerConfig_async", - "title": "ClusterManager getServerConfig Sample", - "origin": "API_DEFINITION", - "description": " Returns configuration info about the Google Kubernetes Engine service.", - "canonical": true, - "file": "cluster_manager.get_server_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetServerConfig", - "fullName": "google.container.v1beta1.ClusterManager.GetServerConfig", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.ServerConfig", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "GetServerConfig", - "fullName": "google.container.v1beta1.ClusterManager.GetServerConfig", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async", - "title": "ClusterManager getJSONWebKeys Sample", - "origin": "API_DEFINITION", - "description": " Gets the public component of the cluster signing keys in JSON Web Key format. This API is not yet intended for general use, and is not available for all clusters.", - "canonical": true, - "file": "cluster_manager.get_j_s_o_n_web_keys.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJSONWebKeys", - "fullName": "google.container.v1beta1.ClusterManager.GetJSONWebKeys", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.GetJSONWebKeysResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "GetJSONWebKeys", - "fullName": "google.container.v1beta1.ClusterManager.GetJSONWebKeys", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_ListNodePools_async", - "title": "ClusterManager listNodePools Sample", - "origin": "API_DEFINITION", - "description": " Lists the node pools for a cluster.", - "canonical": true, - "file": "cluster_manager.list_node_pools.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNodePools", - "fullName": "google.container.v1beta1.ClusterManager.ListNodePools", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.ListNodePoolsResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "ListNodePools", - "fullName": "google.container.v1beta1.ClusterManager.ListNodePools", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_GetNodePool_async", - "title": "ClusterManager getNodePool Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the requested node pool.", - "canonical": true, - "file": "cluster_manager.get_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNodePool", - "fullName": "google.container.v1beta1.ClusterManager.GetNodePool", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.NodePool", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "GetNodePool", - "fullName": "google.container.v1beta1.ClusterManager.GetNodePool", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_CreateNodePool_async", - "title": "ClusterManager createNodePool Sample", - "origin": "API_DEFINITION", - "description": " Creates a node pool for a cluster.", - "canonical": true, - "file": "cluster_manager.create_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNodePool", - "fullName": "google.container.v1beta1.ClusterManager.CreateNodePool", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool", - "type": ".google.container.v1beta1.NodePool" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "CreateNodePool", - "fullName": "google.container.v1beta1.ClusterManager.CreateNodePool", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_DeleteNodePool_async", - "title": "ClusterManager deleteNodePool Sample", - "origin": "API_DEFINITION", - "description": " Deletes a node pool from a cluster.", - "canonical": true, - "file": "cluster_manager.delete_node_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNodePool", - "fullName": "google.container.v1beta1.ClusterManager.DeleteNodePool", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "DeleteNodePool", - "fullName": "google.container.v1beta1.ClusterManager.DeleteNodePool", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async", - "title": "ClusterManager completeNodePoolUpgrade Sample", - "origin": "API_DEFINITION", - "description": " CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.", - "canonical": true, - "file": "cluster_manager.complete_node_pool_upgrade.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompleteNodePoolUpgrade", - "fullName": "google.container.v1beta1.ClusterManager.CompleteNodePoolUpgrade", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "CompleteNodePoolUpgrade", - "fullName": "google.container.v1beta1.ClusterManager.CompleteNodePoolUpgrade", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_async", - "title": "ClusterManager rollbackNodePoolUpgrade Sample", - "origin": "API_DEFINITION", - "description": " Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.", - "canonical": true, - "file": "cluster_manager.rollback_node_pool_upgrade.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RollbackNodePoolUpgrade", - "fullName": "google.container.v1beta1.ClusterManager.RollbackNodePoolUpgrade", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "respect_pdb", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "RollbackNodePoolUpgrade", - "fullName": "google.container.v1beta1.ClusterManager.RollbackNodePoolUpgrade", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolManagement_async", - "title": "ClusterManager setNodePoolManagement Sample", - "origin": "API_DEFINITION", - "description": " Sets the NodeManagement options for a node pool.", - "canonical": true, - "file": "cluster_manager.set_node_pool_management.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetNodePoolManagement", - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolManagement", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "management", - "type": ".google.container.v1beta1.NodeManagement" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetNodePoolManagement", - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolManagement", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetLabels_async", - "title": "ClusterManager setLabels Sample", - "origin": "API_DEFINITION", - "description": " Sets labels on a cluster.", - "canonical": true, - "file": "cluster_manager.set_labels.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetLabels", - "fullName": "google.container.v1beta1.ClusterManager.SetLabels", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "resource_labels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "label_fingerprint", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetLabels", - "fullName": "google.container.v1beta1.ClusterManager.SetLabels", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetLegacyAbac_async", - "title": "ClusterManager setLegacyAbac Sample", - "origin": "API_DEFINITION", - "description": " Enables or disables the ABAC authorization mechanism on a cluster.", - "canonical": true, - "file": "cluster_manager.set_legacy_abac.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetLegacyAbac", - "fullName": "google.container.v1beta1.ClusterManager.SetLegacyAbac", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "enabled", - "type": "TYPE_BOOL" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetLegacyAbac", - "fullName": "google.container.v1beta1.ClusterManager.SetLegacyAbac", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_StartIPRotation_async", - "title": "ClusterManager startIPRotation Sample", - "origin": "API_DEFINITION", - "description": " Starts master IP rotation.", - "canonical": true, - "file": "cluster_manager.start_i_p_rotation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartIPRotation", - "fullName": "google.container.v1beta1.ClusterManager.StartIPRotation", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "rotate_credentials", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "StartIPRotation", - "fullName": "google.container.v1beta1.ClusterManager.StartIPRotation", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_CompleteIPRotation_async", - "title": "ClusterManager completeIPRotation Sample", - "origin": "API_DEFINITION", - "description": " Completes master IP rotation.", - "canonical": true, - "file": "cluster_manager.complete_i_p_rotation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompleteIPRotation", - "fullName": "google.container.v1beta1.ClusterManager.CompleteIPRotation", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "CompleteIPRotation", - "fullName": "google.container.v1beta1.ClusterManager.CompleteIPRotation", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolSize_async", - "title": "ClusterManager setNodePoolSize Sample", - "origin": "API_DEFINITION", - "description": " SetNodePoolSizeRequest sets the size of a node pool. The new size will be used for all replicas, including future replicas created by modifying [NodePool.locations][google.container.v1beta1.NodePool.locations].", - "canonical": true, - "file": "cluster_manager.set_node_pool_size.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetNodePoolSize", - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolSize", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "node_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "node_count", - "type": "TYPE_INT32" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetNodePoolSize", - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolSize", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async", - "title": "ClusterManager setNetworkPolicy Sample", - "origin": "API_DEFINITION", - "description": " Enables or disables Network Policy for a cluster.", - "canonical": true, - "file": "cluster_manager.set_network_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetNetworkPolicy", - "fullName": "google.container.v1beta1.ClusterManager.SetNetworkPolicy", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "network_policy", - "type": ".google.container.v1beta1.NetworkPolicy" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetNetworkPolicy", - "fullName": "google.container.v1beta1.ClusterManager.SetNetworkPolicy", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async", - "title": "ClusterManager setMaintenancePolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the maintenance policy for a cluster.", - "canonical": true, - "file": "cluster_manager.set_maintenance_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetMaintenancePolicy", - "fullName": "google.container.v1beta1.ClusterManager.SetMaintenancePolicy", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "zone", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "maintenance_policy", - "type": ".google.container.v1beta1.MaintenancePolicy" - }, - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.Operation", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "SetMaintenancePolicy", - "fullName": "google.container.v1beta1.ClusterManager.SetMaintenancePolicy", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_async", - "title": "ClusterManager listUsableSubnetworks Sample", - "origin": "API_DEFINITION", - "description": " Lists subnetworks that can be used for creating clusters in a project.", - "canonical": true, - "file": "cluster_manager.list_usable_subnetworks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListUsableSubnetworks", - "fullName": "google.container.v1beta1.ClusterManager.ListUsableSubnetworks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.ListUsableSubnetworksResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "ListUsableSubnetworks", - "fullName": "google.container.v1beta1.ClusterManager.ListUsableSubnetworks", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async", - "title": "ClusterManager checkAutopilotCompatibility Sample", - "origin": "API_DEFINITION", - "description": " Checks the cluster compatibility with Autopilot mode, and returns a list of compatibility issues.", - "canonical": true, - "file": "cluster_manager.check_autopilot_compatibility.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CheckAutopilotCompatibility", - "fullName": "google.container.v1beta1.ClusterManager.CheckAutopilotCompatibility", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.CheckAutopilotCompatibilityResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "CheckAutopilotCompatibility", - "fullName": "google.container.v1beta1.ClusterManager.CheckAutopilotCompatibility", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - }, - { - "regionTag": "container_v1beta1_generated_ClusterManager_ListLocations_async", - "title": "ClusterManager listLocations Sample", - "origin": "API_DEFINITION", - "description": " Fetches locations that offer Google Kubernetes Engine.", - "canonical": true, - "file": "cluster_manager.list_locations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLocations", - "fullName": "google.container.v1beta1.ClusterManager.ListLocations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.container.v1beta1.ListLocationsResponse", - "client": { - "shortName": "ClusterManagerClient", - "fullName": "google.container.v1beta1.ClusterManagerClient" - }, - "method": { - "shortName": "ListLocations", - "fullName": "google.container.v1beta1.ClusterManager.ListLocations", - "service": { - "shortName": "ClusterManager", - "fullName": "google.container.v1beta1.ClusterManager" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-container/v1beta1/src/index.ts b/owl-bot-staging/google-container/v1beta1/src/index.ts deleted file mode 100644 index 44cbef9d2d2..00000000000 --- a/owl-bot-staging/google-container/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 ClusterManagerClient = v1beta1.ClusterManagerClient; -type ClusterManagerClient = v1beta1.ClusterManagerClient; -export {v1beta1, ClusterManagerClient}; -export default {v1beta1, ClusterManagerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client.ts b/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client.ts deleted file mode 100644 index f8d0392d180..00000000000 --- a/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client.ts +++ /dev/null @@ -1,3585 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1beta1/cluster_manager_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cluster_manager_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Google Kubernetes Engine Cluster Manager v1beta1 - * @class - * @memberof v1beta1 - */ -export class ClusterManagerClient { - 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}; - clusterManagerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ClusterManagerClient. - * - * @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 ClusterManagerClient({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 ClusterManagerClient; - 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 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 = { - listUsableSubnetworks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'subnetworks') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.container.v1beta1.ClusterManager', 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.clusterManagerStub) { - return this.clusterManagerStub; - } - - // Put together the "service stub" for - // google.container.v1beta1.ClusterManager. - this.clusterManagerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.container.v1beta1.ClusterManager') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.container.v1beta1.ClusterManager, - 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 clusterManagerStubMethods = - ['listClusters', 'getCluster', 'createCluster', 'updateCluster', 'updateNodePool', 'setNodePoolAutoscaling', 'setLoggingService', 'setMonitoringService', 'setAddonsConfig', 'setLocations', 'updateMaster', 'setMasterAuth', 'deleteCluster', 'listOperations', 'getOperation', 'cancelOperation', 'getServerConfig', 'getJsonWebKeys', 'listNodePools', 'getNodePool', 'createNodePool', 'deleteNodePool', 'completeNodePoolUpgrade', 'rollbackNodePoolUpgrade', 'setNodePoolManagement', 'setLabels', 'setLegacyAbac', 'startIpRotation', 'completeIpRotation', 'setNodePoolSize', 'setNetworkPolicy', 'setMaintenancePolicy', 'listUsableSubnetworks', 'checkAutopilotCompatibility', 'listLocations']; - for (const methodName of clusterManagerStubMethods) { - const callPromise = this.clusterManagerStub.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.clusterManagerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'container.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 'container.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 all clusters owned by a project in either the specified zone or all - * zones. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the parent field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides, or "-" for all zones. This field has been deprecated and - * replaced by the parent field. - * @param {string} request.parent - * The parent (project and location) where the clusters will be listed. - * Specified in the format `projects/* /locations/*`. - * Location "-" matches all zones and all regions. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.ListClustersResponse|ListClustersResponse}. - * Please see the {@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/cluster_manager.list_clusters.js - * region_tag:container_v1beta1_generated_ClusterManager_ListClusters_async - */ - listClusters( - request?: protos.google.container.v1beta1.IListClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IListClustersResponse, - protos.google.container.v1beta1.IListClustersRequest|undefined, {}|undefined - ]>; - listClusters( - request: protos.google.container.v1beta1.IListClustersRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IListClustersResponse, - protos.google.container.v1beta1.IListClustersRequest|null|undefined, - {}|null|undefined>): void; - listClusters( - request: protos.google.container.v1beta1.IListClustersRequest, - callback: Callback< - protos.google.container.v1beta1.IListClustersResponse, - protos.google.container.v1beta1.IListClustersRequest|null|undefined, - {}|null|undefined>): void; - listClusters( - request?: protos.google.container.v1beta1.IListClustersRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IListClustersResponse, - protos.google.container.v1beta1.IListClustersRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IListClustersResponse, - protos.google.container.v1beta1.IListClustersRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IListClustersResponse, - protos.google.container.v1beta1.IListClustersRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - }); - this.initialize(); - return this.innerApiCalls.listClusters(request, options, callback); - } -/** - * Gets the details for a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to retrieve. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to retrieve. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Cluster|Cluster}. - * Please see the {@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/cluster_manager.get_cluster.js - * region_tag:container_v1beta1_generated_ClusterManager_GetCluster_async - */ - getCluster( - request?: protos.google.container.v1beta1.IGetClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.ICluster, - protos.google.container.v1beta1.IGetClusterRequest|undefined, {}|undefined - ]>; - getCluster( - request: protos.google.container.v1beta1.IGetClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.ICluster, - protos.google.container.v1beta1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; - getCluster( - request: protos.google.container.v1beta1.IGetClusterRequest, - callback: Callback< - protos.google.container.v1beta1.ICluster, - protos.google.container.v1beta1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; - getCluster( - request?: protos.google.container.v1beta1.IGetClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.ICluster, - protos.google.container.v1beta1.IGetClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.ICluster, - protos.google.container.v1beta1.IGetClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.ICluster, - protos.google.container.v1beta1.IGetClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getCluster(request, options, callback); - } -/** - * Creates a cluster, consisting of the specified number and type of Google - * Compute Engine instances. - * - * By default, the cluster is created in the project's - * [default - * network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). - * - * One firewall is added for the cluster. After cluster creation, - * the Kubelet creates routes for each node to allow the containers - * on that node to communicate with all other instances in the - * cluster. - * - * Finally, an entry is added to the project's global metadata indicating - * which CIDR range the cluster is using. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the parent field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the parent - * field. - * @param {google.container.v1beta1.Cluster} request.cluster - * Required. A [cluster - * resource](https://cloud.google.com/container-engine/reference/rest/v1beta1/projects.locations.clusters) - * @param {string} request.parent - * The parent (project and location) where the cluster will be created. - * Specified in the format `projects/* /locations/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.create_cluster.js - * region_tag:container_v1beta1_generated_ClusterManager_CreateCluster_async - */ - createCluster( - request?: protos.google.container.v1beta1.ICreateClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateClusterRequest|undefined, {}|undefined - ]>; - createCluster( - request: protos.google.container.v1beta1.ICreateClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateClusterRequest|null|undefined, - {}|null|undefined>): void; - createCluster( - request: protos.google.container.v1beta1.ICreateClusterRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateClusterRequest|null|undefined, - {}|null|undefined>): void; - createCluster( - request?: protos.google.container.v1beta1.ICreateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - }); - this.initialize(); - return this.innerApiCalls.createCluster(request, options, callback); - } -/** - * Updates the settings for a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1beta1.ClusterUpdate} request.update - * Required. A description of the update. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to update. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.update_cluster.js - * region_tag:container_v1beta1_generated_ClusterManager_UpdateCluster_async - */ - updateCluster( - request?: protos.google.container.v1beta1.IUpdateClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateClusterRequest|undefined, {}|undefined - ]>; - updateCluster( - request: protos.google.container.v1beta1.IUpdateClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateClusterRequest|null|undefined, - {}|null|undefined>): void; - updateCluster( - request: protos.google.container.v1beta1.IUpdateClusterRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateClusterRequest|null|undefined, - {}|null|undefined>): void; - updateCluster( - request?: protos.google.container.v1beta1.IUpdateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateCluster(request, options, callback); - } -/** - * Updates the version and/or image type of a specific node pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Required. Deprecated. The name of the node pool to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodeVersion - * Required. The Kubernetes version to change the nodes to (typically an - * upgrade). - * - * Users may specify either explicit versions offered by Kubernetes Engine or - * version aliases, which have the following behavior: - * - * - "latest": picks the highest valid Kubernetes version - * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - * - "1.X.Y-gke.N": picks an explicit Kubernetes version - * - "-": picks the Kubernetes master version - * @param {string} request.imageType - * Required. The desired image type for the node pool. Please see - * https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for - * available image types. - * @param {string[]} request.locations - * The desired list of Google Compute Engine - * [zones](https://cloud.google.com/compute/docs/zones#available) in which the - * node pool's nodes should be located. Changing the locations for a node pool - * will result in nodes being either created or removed from the node pool, - * depending on whether locations are being added or removed. - * @param {google.container.v1beta1.WorkloadMetadataConfig} request.workloadMetadataConfig - * The desired workload metadata config for the node pool. - * @param {string} request.name - * The name (project, location, cluster, node pool) of the node pool to - * update. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {google.container.v1beta1.NodePool.UpgradeSettings} request.upgradeSettings - * Upgrade settings control disruption and speed of the upgrade. - * @param {google.container.v1beta1.NetworkTags} request.tags - * The desired network tags to be applied to all nodes in the node pool. - * If this field is not present, the tags will not be changed. Otherwise, - * the existing network tags will be *replaced* with the provided tags. - * @param {google.container.v1beta1.NodeTaints} request.taints - * The desired node taints to be applied to all nodes in the node pool. - * If this field is not present, the taints will not be changed. Otherwise, - * the existing node taints will be *replaced* with the provided taints. - * @param {google.container.v1beta1.NodeLabels} request.labels - * The desired node labels to be applied to all nodes in the node pool. - * If this field is not present, the labels will not be changed. Otherwise, - * the existing node labels will be *replaced* with the provided labels. - * @param {google.container.v1beta1.LinuxNodeConfig} request.linuxNodeConfig - * Parameters that can be configured on Linux nodes. - * @param {google.container.v1beta1.NodeKubeletConfig} request.kubeletConfig - * Node kubelet configs. - * @param {google.container.v1beta1.NodeNetworkConfig} request.nodeNetworkConfig - * Node network config. - * @param {google.container.v1beta1.GcfsConfig} request.gcfsConfig - * GCFS config. - * @param {google.container.v1beta1.ConfidentialNodes} request.confidentialNodes - * Confidential nodes config. - * All the nodes in the node pool will be Confidential VM once enabled. - * @param {google.container.v1beta1.VirtualNIC} request.gvnic - * Enable or disable gvnic on the node pool. - * @param {string} request.etag - * The current etag of the node pool. - * If an etag is provided and does not match the current etag of the node - * pool, update will be blocked and an ABORTED error will be returned. - * @param {google.container.v1beta1.FastSocket} request.fastSocket - * Enable or disable NCCL fast socket for the node pool. - * @param {google.container.v1beta1.NodePoolLoggingConfig} request.loggingConfig - * Logging configuration. - * @param {google.container.v1beta1.ResourceLabels} request.resourceLabels - * The resource labels for the node pool to use to annotate any related - * Google Compute Engine resources. - * @param {google.container.v1beta1.WindowsNodeConfig} request.windowsNodeConfig - * Parameters that can be configured on Windows nodes. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.update_node_pool.js - * region_tag:container_v1beta1_generated_ClusterManager_UpdateNodePool_async - */ - updateNodePool( - request?: protos.google.container.v1beta1.IUpdateNodePoolRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateNodePoolRequest|undefined, {}|undefined - ]>; - updateNodePool( - request: protos.google.container.v1beta1.IUpdateNodePoolRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateNodePoolRequest|null|undefined, - {}|null|undefined>): void; - updateNodePool( - request: protos.google.container.v1beta1.IUpdateNodePoolRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateNodePoolRequest|null|undefined, - {}|null|undefined>): void; - updateNodePool( - request?: protos.google.container.v1beta1.IUpdateNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateNodePoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateNodePoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateNodePoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateNodePool(request, options, callback); - } -/** - * Sets the autoscaling settings of a specific node pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Required. Deprecated. The name of the node pool to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1beta1.NodePoolAutoscaling} request.autoscaling - * Required. Autoscaling configuration for the node pool. - * @param {string} request.name - * The name (project, location, cluster, node pool) of the node pool to set - * autoscaler settings. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_node_pool_autoscaling.js - * region_tag:container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_async - */ - setNodePoolAutoscaling( - request?: protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|undefined, {}|undefined - ]>; - setNodePoolAutoscaling( - request: protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolAutoscaling( - request: protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolAutoscaling( - request?: protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolAutoscalingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setNodePoolAutoscaling(request, options, callback); - } -/** - * Sets the logging service for a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.loggingService - * Required. The logging service the cluster should use to write logs. - * Currently available options: - * - * * `logging.googleapis.com/kubernetes` - The Cloud Logging - * service with a Kubernetes-native resource model - * * `logging.googleapis.com` - The legacy Cloud Logging service (no longer - * available as of GKE 1.15). - * * `none` - no logs will be exported from the cluster. - * - * If left as an empty string,`logging.googleapis.com/kubernetes` will be - * used for GKE 1.14+ or `logging.googleapis.com` for earlier versions. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to set logging. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_logging_service.js - * region_tag:container_v1beta1_generated_ClusterManager_SetLoggingService_async - */ - setLoggingService( - request?: protos.google.container.v1beta1.ISetLoggingServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLoggingServiceRequest|undefined, {}|undefined - ]>; - setLoggingService( - request: protos.google.container.v1beta1.ISetLoggingServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLoggingServiceRequest|null|undefined, - {}|null|undefined>): void; - setLoggingService( - request: protos.google.container.v1beta1.ISetLoggingServiceRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLoggingServiceRequest|null|undefined, - {}|null|undefined>): void; - setLoggingService( - request?: protos.google.container.v1beta1.ISetLoggingServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLoggingServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLoggingServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLoggingServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setLoggingService(request, options, callback); - } -/** - * Sets the monitoring service for a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.monitoringService - * Required. The monitoring service the cluster should use to write metrics. - * Currently available options: - * - * * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring - * service with a Kubernetes-native resource model - * * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no - * longer available as of GKE 1.15). - * * `none` - No metrics will be exported from the cluster. - * - * If left as an empty string,`monitoring.googleapis.com/kubernetes` will be - * used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to set monitoring. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_monitoring_service.js - * region_tag:container_v1beta1_generated_ClusterManager_SetMonitoringService_async - */ - setMonitoringService( - request?: protos.google.container.v1beta1.ISetMonitoringServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMonitoringServiceRequest|undefined, {}|undefined - ]>; - setMonitoringService( - request: protos.google.container.v1beta1.ISetMonitoringServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMonitoringServiceRequest|null|undefined, - {}|null|undefined>): void; - setMonitoringService( - request: protos.google.container.v1beta1.ISetMonitoringServiceRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMonitoringServiceRequest|null|undefined, - {}|null|undefined>): void; - setMonitoringService( - request?: protos.google.container.v1beta1.ISetMonitoringServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMonitoringServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMonitoringServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMonitoringServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setMonitoringService(request, options, callback); - } -/** - * Sets the addons for a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1beta1.AddonsConfig} request.addonsConfig - * Required. The desired configurations for the various addons available to - * run in the cluster. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to set addons. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_addons_config.js - * region_tag:container_v1beta1_generated_ClusterManager_SetAddonsConfig_async - */ - setAddonsConfig( - request?: protos.google.container.v1beta1.ISetAddonsConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetAddonsConfigRequest|undefined, {}|undefined - ]>; - setAddonsConfig( - request: protos.google.container.v1beta1.ISetAddonsConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetAddonsConfigRequest|null|undefined, - {}|null|undefined>): void; - setAddonsConfig( - request: protos.google.container.v1beta1.ISetAddonsConfigRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetAddonsConfigRequest|null|undefined, - {}|null|undefined>): void; - setAddonsConfig( - request?: protos.google.container.v1beta1.ISetAddonsConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetAddonsConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetAddonsConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetAddonsConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setAddonsConfig(request, options, callback); - } -/** - * Sets the locations for a specific cluster. - * Deprecated. Use - * [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters/update) - * instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string[]} request.locations - * Required. The desired list of Google Compute Engine - * [zones](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster's nodes should be located. Changing the locations a cluster is in - * will result in nodes being either created or removed from the cluster, - * depending on whether locations are being added or removed. - * - * This list must always include the cluster's primary zone. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to set locations. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_locations.js - * region_tag:container_v1beta1_generated_ClusterManager_SetLocations_async - * @deprecated SetLocations is deprecated and may be removed in a future version. - */ - setLocations( - request?: protos.google.container.v1beta1.ISetLocationsRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLocationsRequest|undefined, {}|undefined - ]>; - setLocations( - request: protos.google.container.v1beta1.ISetLocationsRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLocationsRequest|null|undefined, - {}|null|undefined>): void; - setLocations( - request: protos.google.container.v1beta1.ISetLocationsRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLocationsRequest|null|undefined, - {}|null|undefined>): void; - setLocations( - request?: protos.google.container.v1beta1.ISetLocationsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLocationsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLocationsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLocationsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - this.warn('DEP$ClusterManager-$SetLocations','SetLocations is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.innerApiCalls.setLocations(request, options, callback); - } -/** - * Updates the master for a specific cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {string} request.masterVersion - * Required. The Kubernetes version to change the master to. - * - * Users may specify either explicit versions offered by - * Kubernetes Engine or version aliases, which have the following behavior: - * - * - "latest": picks the highest valid Kubernetes version - * - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - * - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - * - "1.X.Y-gke.N": picks an explicit Kubernetes version - * - "-": picks the default Kubernetes version - * @param {string} request.name - * The name (project, location, cluster) of the cluster to update. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.update_master.js - * region_tag:container_v1beta1_generated_ClusterManager_UpdateMaster_async - */ - updateMaster( - request?: protos.google.container.v1beta1.IUpdateMasterRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateMasterRequest|undefined, {}|undefined - ]>; - updateMaster( - request: protos.google.container.v1beta1.IUpdateMasterRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateMasterRequest|null|undefined, - {}|null|undefined>): void; - updateMaster( - request: protos.google.container.v1beta1.IUpdateMasterRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateMasterRequest|null|undefined, - {}|null|undefined>): void; - updateMaster( - request?: protos.google.container.v1beta1.IUpdateMasterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateMasterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateMasterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IUpdateMasterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMaster(request, options, callback); - } -/** - * Sets master auth materials. Currently supports changing the admin password - * or a specific cluster, either via password generation or explicitly setting - * the password. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to upgrade. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1beta1.SetMasterAuthRequest.Action} request.action - * Required. The exact form of action to be taken on the master auth. - * @param {google.container.v1beta1.MasterAuth} request.update - * Required. A description of the update. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to set auth. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_master_auth.js - * region_tag:container_v1beta1_generated_ClusterManager_SetMasterAuth_async - */ - setMasterAuth( - request?: protos.google.container.v1beta1.ISetMasterAuthRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMasterAuthRequest|undefined, {}|undefined - ]>; - setMasterAuth( - request: protos.google.container.v1beta1.ISetMasterAuthRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMasterAuthRequest|null|undefined, - {}|null|undefined>): void; - setMasterAuth( - request: protos.google.container.v1beta1.ISetMasterAuthRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMasterAuthRequest|null|undefined, - {}|null|undefined>): void; - setMasterAuth( - request?: protos.google.container.v1beta1.ISetMasterAuthRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMasterAuthRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMasterAuthRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMasterAuthRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setMasterAuth(request, options, callback); - } -/** - * Deletes the cluster, including the Kubernetes endpoint and all worker - * nodes. - * - * Firewalls and routes that were configured during cluster creation - * are also deleted. - * - * Other Google Compute Engine resources that might be in use by the cluster, - * such as load balancer resources, are not deleted if they weren't present - * when the cluster was initially created. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to delete. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to delete. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.delete_cluster.js - * region_tag:container_v1beta1_generated_ClusterManager_DeleteCluster_async - */ - deleteCluster( - request?: protos.google.container.v1beta1.IDeleteClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteClusterRequest|undefined, {}|undefined - ]>; - deleteCluster( - request: protos.google.container.v1beta1.IDeleteClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteClusterRequest|null|undefined, - {}|null|undefined>): void; - deleteCluster( - request: protos.google.container.v1beta1.IDeleteClusterRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteClusterRequest|null|undefined, - {}|null|undefined>): void; - deleteCluster( - request?: protos.google.container.v1beta1.IDeleteClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteCluster(request, options, callback); - } -/** - * Lists all operations in a project in the specified zone or all zones. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the parent field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) to return - * operations for, or `-` for all zones. This field has been deprecated and - * replaced by the parent field. - * @param {string} request.parent - * The parent (project and location) where the operations will be listed. - * Specified in the format `projects/* /locations/*`. - * Location "-" matches all zones and all regions. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.ListOperationsResponse|ListOperationsResponse}. - * Please see the {@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/cluster_manager.list_operations.js - * region_tag:container_v1beta1_generated_ClusterManager_ListOperations_async - */ - listOperations( - request?: protos.google.container.v1beta1.IListOperationsRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IListOperationsResponse, - protos.google.container.v1beta1.IListOperationsRequest|undefined, {}|undefined - ]>; - listOperations( - request: protos.google.container.v1beta1.IListOperationsRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IListOperationsResponse, - protos.google.container.v1beta1.IListOperationsRequest|null|undefined, - {}|null|undefined>): void; - listOperations( - request: protos.google.container.v1beta1.IListOperationsRequest, - callback: Callback< - protos.google.container.v1beta1.IListOperationsResponse, - protos.google.container.v1beta1.IListOperationsRequest|null|undefined, - {}|null|undefined>): void; - listOperations( - request?: protos.google.container.v1beta1.IListOperationsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IListOperationsResponse, - protos.google.container.v1beta1.IListOperationsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IListOperationsResponse, - protos.google.container.v1beta1.IListOperationsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IListOperationsResponse, - protos.google.container.v1beta1.IListOperationsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - }); - this.initialize(); - return this.innerApiCalls.listOperations(request, options, callback); - } -/** - * Gets the specified operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.operationId - * Required. Deprecated. The server-assigned `name` of the operation. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, operation id) of the operation to get. - * Specified in the format `projects/* /locations/* /operations/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.get_operation.js - * region_tag:container_v1beta1_generated_ClusterManager_GetOperation_async - */ - getOperation( - request?: protos.google.container.v1beta1.IGetOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IGetOperationRequest|undefined, {}|undefined - ]>; - getOperation( - request: protos.google.container.v1beta1.IGetOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IGetOperationRequest|null|undefined, - {}|null|undefined>): void; - getOperation( - request: protos.google.container.v1beta1.IGetOperationRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IGetOperationRequest|null|undefined, - {}|null|undefined>): void; - getOperation( - request?: protos.google.container.v1beta1.IGetOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IGetOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IGetOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IGetOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'operation_id': request.operationId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getOperation(request, options, callback); - } -/** - * Cancels the specified operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * operation resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.operationId - * Required. Deprecated. The server-assigned `name` of the operation. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, operation id) of the operation to cancel. - * Specified in the format `projects/* /locations/* /operations/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1beta1/cluster_manager.cancel_operation.js - * region_tag:container_v1beta1_generated_ClusterManager_CancelOperation_async - */ - cancelOperation( - request?: protos.google.container.v1beta1.ICancelOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICancelOperationRequest|undefined, {}|undefined - ]>; - cancelOperation( - request: protos.google.container.v1beta1.ICancelOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICancelOperationRequest|null|undefined, - {}|null|undefined>): void; - cancelOperation( - request: protos.google.container.v1beta1.ICancelOperationRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICancelOperationRequest|null|undefined, - {}|null|undefined>): void; - cancelOperation( - request?: protos.google.container.v1beta1.ICancelOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICancelOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICancelOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICancelOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'operation_id': request.operationId ?? '', - }); - this.initialize(); - return this.innerApiCalls.cancelOperation(request, options, callback); - } -/** - * Returns configuration info about the Google Kubernetes Engine service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) to return - * operations for. This field has been deprecated and replaced by the name - * field. - * @param {string} request.name - * The name (project and location) of the server config to get, - * specified in the format `projects/* /locations/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.ServerConfig|ServerConfig}. - * Please see the {@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/cluster_manager.get_server_config.js - * region_tag:container_v1beta1_generated_ClusterManager_GetServerConfig_async - */ - getServerConfig( - request?: protos.google.container.v1beta1.IGetServerConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IServerConfig, - protos.google.container.v1beta1.IGetServerConfigRequest|undefined, {}|undefined - ]>; - getServerConfig( - request: protos.google.container.v1beta1.IGetServerConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IServerConfig, - protos.google.container.v1beta1.IGetServerConfigRequest|null|undefined, - {}|null|undefined>): void; - getServerConfig( - request: protos.google.container.v1beta1.IGetServerConfigRequest, - callback: Callback< - protos.google.container.v1beta1.IServerConfig, - protos.google.container.v1beta1.IGetServerConfigRequest|null|undefined, - {}|null|undefined>): void; - getServerConfig( - request?: protos.google.container.v1beta1.IGetServerConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IServerConfig, - protos.google.container.v1beta1.IGetServerConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IServerConfig, - protos.google.container.v1beta1.IGetServerConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IServerConfig, - protos.google.container.v1beta1.IGetServerConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - }); - this.initialize(); - return this.innerApiCalls.getServerConfig(request, options, callback); - } -/** - * Gets the public component of the cluster signing keys in - * JSON Web Key format. - * This API is not yet intended for general use, and is not available for all - * clusters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The cluster (project, location, cluster name) to get keys for. Specified in - * the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.GetJSONWebKeysResponse|GetJSONWebKeysResponse}. - * Please see the {@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/cluster_manager.get_j_s_o_n_web_keys.js - * region_tag:container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async - */ - getJSONWebKeys( - request?: protos.google.container.v1beta1.IGetJSONWebKeysRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IGetJSONWebKeysResponse, - protos.google.container.v1beta1.IGetJSONWebKeysRequest|undefined, {}|undefined - ]>; - getJSONWebKeys( - request: protos.google.container.v1beta1.IGetJSONWebKeysRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IGetJSONWebKeysResponse, - protos.google.container.v1beta1.IGetJSONWebKeysRequest|null|undefined, - {}|null|undefined>): void; - getJSONWebKeys( - request: protos.google.container.v1beta1.IGetJSONWebKeysRequest, - callback: Callback< - protos.google.container.v1beta1.IGetJSONWebKeysResponse, - protos.google.container.v1beta1.IGetJSONWebKeysRequest|null|undefined, - {}|null|undefined>): void; - getJSONWebKeys( - request?: protos.google.container.v1beta1.IGetJSONWebKeysRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IGetJSONWebKeysResponse, - protos.google.container.v1beta1.IGetJSONWebKeysRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IGetJSONWebKeysResponse, - protos.google.container.v1beta1.IGetJSONWebKeysRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IGetJSONWebKeysResponse, - protos.google.container.v1beta1.IGetJSONWebKeysRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.getJsonWebKeys(request, options, callback); - } -/** - * Lists the node pools for a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the parent field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the parent - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the parent field. - * @param {string} request.parent - * The parent (project, location, cluster name) where the node pools will be - * listed. Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.ListNodePoolsResponse|ListNodePoolsResponse}. - * Please see the {@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/cluster_manager.list_node_pools.js - * region_tag:container_v1beta1_generated_ClusterManager_ListNodePools_async - */ - listNodePools( - request?: protos.google.container.v1beta1.IListNodePoolsRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IListNodePoolsResponse, - protos.google.container.v1beta1.IListNodePoolsRequest|undefined, {}|undefined - ]>; - listNodePools( - request: protos.google.container.v1beta1.IListNodePoolsRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IListNodePoolsResponse, - protos.google.container.v1beta1.IListNodePoolsRequest|null|undefined, - {}|null|undefined>): void; - listNodePools( - request: protos.google.container.v1beta1.IListNodePoolsRequest, - callback: Callback< - protos.google.container.v1beta1.IListNodePoolsResponse, - protos.google.container.v1beta1.IListNodePoolsRequest|null|undefined, - {}|null|undefined>): void; - listNodePools( - request?: protos.google.container.v1beta1.IListNodePoolsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IListNodePoolsResponse, - protos.google.container.v1beta1.IListNodePoolsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IListNodePoolsResponse, - protos.google.container.v1beta1.IListNodePoolsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IListNodePoolsResponse, - protos.google.container.v1beta1.IListNodePoolsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.listNodePools(request, options, callback); - } -/** - * Retrieves the requested node pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Required. Deprecated. The name of the node pool. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node pool to - * get. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.NodePool|NodePool}. - * Please see the {@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/cluster_manager.get_node_pool.js - * region_tag:container_v1beta1_generated_ClusterManager_GetNodePool_async - */ - getNodePool( - request?: protos.google.container.v1beta1.IGetNodePoolRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.INodePool, - protos.google.container.v1beta1.IGetNodePoolRequest|undefined, {}|undefined - ]>; - getNodePool( - request: protos.google.container.v1beta1.IGetNodePoolRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.INodePool, - protos.google.container.v1beta1.IGetNodePoolRequest|null|undefined, - {}|null|undefined>): void; - getNodePool( - request: protos.google.container.v1beta1.IGetNodePoolRequest, - callback: Callback< - protos.google.container.v1beta1.INodePool, - protos.google.container.v1beta1.IGetNodePoolRequest|null|undefined, - {}|null|undefined>): void; - getNodePool( - request?: protos.google.container.v1beta1.IGetNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.INodePool, - protos.google.container.v1beta1.IGetNodePoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.INodePool, - protos.google.container.v1beta1.IGetNodePoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.INodePool, - protos.google.container.v1beta1.IGetNodePoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getNodePool(request, options, callback); - } -/** - * Creates a node pool for a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the parent field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the parent - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the parent field. - * @param {google.container.v1beta1.NodePool} request.nodePool - * Required. The node pool to create. - * @param {string} request.parent - * The parent (project, location, cluster name) where the node pool will be - * created. Specified in the format - * `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.create_node_pool.js - * region_tag:container_v1beta1_generated_ClusterManager_CreateNodePool_async - */ - createNodePool( - request?: protos.google.container.v1beta1.ICreateNodePoolRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateNodePoolRequest|undefined, {}|undefined - ]>; - createNodePool( - request: protos.google.container.v1beta1.ICreateNodePoolRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateNodePoolRequest|null|undefined, - {}|null|undefined>): void; - createNodePool( - request: protos.google.container.v1beta1.ICreateNodePoolRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateNodePoolRequest|null|undefined, - {}|null|undefined>): void; - createNodePool( - request?: protos.google.container.v1beta1.ICreateNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateNodePoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateNodePoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICreateNodePoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.createNodePool(request, options, callback); - } -/** - * Deletes a node pool from a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Required. Deprecated. The name of the node pool to delete. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node pool to - * delete. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.delete_node_pool.js - * region_tag:container_v1beta1_generated_ClusterManager_DeleteNodePool_async - */ - deleteNodePool( - request?: protos.google.container.v1beta1.IDeleteNodePoolRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteNodePoolRequest|undefined, {}|undefined - ]>; - deleteNodePool( - request: protos.google.container.v1beta1.IDeleteNodePoolRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteNodePoolRequest|null|undefined, - {}|null|undefined>): void; - deleteNodePool( - request: protos.google.container.v1beta1.IDeleteNodePoolRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteNodePoolRequest|null|undefined, - {}|null|undefined>): void; - deleteNodePool( - request?: protos.google.container.v1beta1.IDeleteNodePoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteNodePoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteNodePoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IDeleteNodePoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteNodePool(request, options, callback); - } -/** - * CompleteNodePoolUpgrade will signal an on-going node pool upgrade to - * complete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node pool to - * complete upgrade. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1beta1/cluster_manager.complete_node_pool_upgrade.js - * region_tag:container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async - */ - completeNodePoolUpgrade( - request?: protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|undefined, {}|undefined - ]>; - completeNodePoolUpgrade( - request: protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): void; - completeNodePoolUpgrade( - request: protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): void; - completeNodePoolUpgrade( - request?: protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.container.v1beta1.ICompleteNodePoolUpgradeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.completeNodePoolUpgrade(request, options, callback); - } -/** - * Rolls back a previously Aborted or Failed NodePool upgrade. - * This makes no changes if the last upgrade successfully completed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to rollback. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Required. Deprecated. The name of the node pool to rollback. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node poll to - * rollback upgrade. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {boolean} request.respectPdb - * Option for rollback to ignore the PodDisruptionBudget. - * 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.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.rollback_node_pool_upgrade.js - * region_tag:container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_async - */ - rollbackNodePoolUpgrade( - request?: protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|undefined, {}|undefined - ]>; - rollbackNodePoolUpgrade( - request: protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): void; - rollbackNodePoolUpgrade( - request: protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): void; - rollbackNodePoolUpgrade( - request?: protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IRollbackNodePoolUpgradeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.rollbackNodePoolUpgrade(request, options, callback); - } -/** - * Sets the NodeManagement options for a node pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to update. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Required. Deprecated. The name of the node pool to update. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1beta1.NodeManagement} request.management - * Required. NodeManagement configuration for the node pool. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node pool to set - * management properties. Specified in the format - * `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_node_pool_management.js - * region_tag:container_v1beta1_generated_ClusterManager_SetNodePoolManagement_async - */ - setNodePoolManagement( - request?: protos.google.container.v1beta1.ISetNodePoolManagementRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolManagementRequest|undefined, {}|undefined - ]>; - setNodePoolManagement( - request: protos.google.container.v1beta1.ISetNodePoolManagementRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolManagementRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolManagement( - request: protos.google.container.v1beta1.ISetNodePoolManagementRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolManagementRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolManagement( - request?: protos.google.container.v1beta1.ISetNodePoolManagementRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolManagementRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolManagementRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolManagementRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setNodePoolManagement(request, options, callback); - } -/** - * Sets labels on a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {number[]} request.resourceLabels - * Required. The labels to set for that cluster. - * @param {string} request.labelFingerprint - * Required. The fingerprint of the previous set of labels for this resource, - * used to detect conflicts. The fingerprint is initially generated by - * Kubernetes Engine and changes after every request to modify or update - * labels. You must always provide an up-to-date fingerprint hash when - * updating or changing labels. Make a `get()` request to the - * resource to get the latest fingerprint. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to set labels. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_labels.js - * region_tag:container_v1beta1_generated_ClusterManager_SetLabels_async - */ - setLabels( - request?: protos.google.container.v1beta1.ISetLabelsRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLabelsRequest|undefined, {}|undefined - ]>; - setLabels( - request: protos.google.container.v1beta1.ISetLabelsRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLabelsRequest|null|undefined, - {}|null|undefined>): void; - setLabels( - request: protos.google.container.v1beta1.ISetLabelsRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLabelsRequest|null|undefined, - {}|null|undefined>): void; - setLabels( - request?: protos.google.container.v1beta1.ISetLabelsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLabelsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLabelsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLabelsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setLabels(request, options, callback); - } -/** - * Enables or disables the ABAC authorization mechanism on a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to update. - * This field has been deprecated and replaced by the name field. - * @param {boolean} request.enabled - * Required. Whether ABAC authorization will be enabled in the cluster. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to set legacy - * abac. Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_legacy_abac.js - * region_tag:container_v1beta1_generated_ClusterManager_SetLegacyAbac_async - */ - setLegacyAbac( - request?: protos.google.container.v1beta1.ISetLegacyAbacRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLegacyAbacRequest|undefined, {}|undefined - ]>; - setLegacyAbac( - request: protos.google.container.v1beta1.ISetLegacyAbacRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLegacyAbacRequest|null|undefined, - {}|null|undefined>): void; - setLegacyAbac( - request: protos.google.container.v1beta1.ISetLegacyAbacRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLegacyAbacRequest|null|undefined, - {}|null|undefined>): void; - setLegacyAbac( - request?: protos.google.container.v1beta1.ISetLegacyAbacRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLegacyAbacRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLegacyAbacRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetLegacyAbacRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setLegacyAbac(request, options, callback); - } -/** - * Starts master IP rotation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to start IP - * rotation. Specified in the format `projects/* /locations/* /clusters/*`. - * @param {boolean} request.rotateCredentials - * Whether to rotate credentials during IP rotation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.start_i_p_rotation.js - * region_tag:container_v1beta1_generated_ClusterManager_StartIPRotation_async - */ - startIPRotation( - request?: protos.google.container.v1beta1.IStartIPRotationRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IStartIPRotationRequest|undefined, {}|undefined - ]>; - startIPRotation( - request: protos.google.container.v1beta1.IStartIPRotationRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IStartIPRotationRequest|null|undefined, - {}|null|undefined>): void; - startIPRotation( - request: protos.google.container.v1beta1.IStartIPRotationRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IStartIPRotationRequest|null|undefined, - {}|null|undefined>): void; - startIPRotation( - request?: protos.google.container.v1beta1.IStartIPRotationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IStartIPRotationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IStartIPRotationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.IStartIPRotationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.startIpRotation(request, options, callback); - } -/** - * Completes master IP rotation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to complete IP - * rotation. Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.complete_i_p_rotation.js - * region_tag:container_v1beta1_generated_ClusterManager_CompleteIPRotation_async - */ - completeIPRotation( - request?: protos.google.container.v1beta1.ICompleteIPRotationRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICompleteIPRotationRequest|undefined, {}|undefined - ]>; - completeIPRotation( - request: protos.google.container.v1beta1.ICompleteIPRotationRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICompleteIPRotationRequest|null|undefined, - {}|null|undefined>): void; - completeIPRotation( - request: protos.google.container.v1beta1.ICompleteIPRotationRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICompleteIPRotationRequest|null|undefined, - {}|null|undefined>): void; - completeIPRotation( - request?: protos.google.container.v1beta1.ICompleteIPRotationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICompleteIPRotationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICompleteIPRotationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ICompleteIPRotationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.completeIpRotation(request, options, callback); - } -/** - * SetNodePoolSizeRequest sets the size of a node pool. The new size will be - * used for all replicas, including future replicas created by modifying - * {@link protos.google.container.v1beta1.NodePool.locations|NodePool.locations}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster to update. - * This field has been deprecated and replaced by the name field. - * @param {string} request.nodePoolId - * Required. Deprecated. The name of the node pool to update. - * This field has been deprecated and replaced by the name field. - * @param {number} request.nodeCount - * Required. The desired node count for the pool. - * @param {string} request.name - * The name (project, location, cluster, node pool id) of the node pool to set - * size. - * Specified in the format `projects/* /locations/* /clusters/* /nodePools/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_node_pool_size.js - * region_tag:container_v1beta1_generated_ClusterManager_SetNodePoolSize_async - */ - setNodePoolSize( - request?: protos.google.container.v1beta1.ISetNodePoolSizeRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolSizeRequest|undefined, {}|undefined - ]>; - setNodePoolSize( - request: protos.google.container.v1beta1.ISetNodePoolSizeRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolSizeRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolSize( - request: protos.google.container.v1beta1.ISetNodePoolSizeRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolSizeRequest|null|undefined, - {}|null|undefined>): void; - setNodePoolSize( - request?: protos.google.container.v1beta1.ISetNodePoolSizeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolSizeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolSizeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNodePoolSizeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - 'node_pool_id': request.nodePoolId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setNodePoolSize(request, options, callback); - } -/** - * Enables or disables Network Policy for a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Deprecated. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * This field has been deprecated and replaced by the name field. - * @param {string} request.zone - * Required. Deprecated. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. This field has been deprecated and replaced by the name - * field. - * @param {string} request.clusterId - * Required. Deprecated. The name of the cluster. - * This field has been deprecated and replaced by the name field. - * @param {google.container.v1beta1.NetworkPolicy} request.networkPolicy - * Required. Configuration options for the NetworkPolicy feature. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to set networking - * policy. Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_network_policy.js - * region_tag:container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async - */ - setNetworkPolicy( - request?: protos.google.container.v1beta1.ISetNetworkPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNetworkPolicyRequest|undefined, {}|undefined - ]>; - setNetworkPolicy( - request: protos.google.container.v1beta1.ISetNetworkPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): void; - setNetworkPolicy( - request: protos.google.container.v1beta1.ISetNetworkPolicyRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): void; - setNetworkPolicy( - request?: protos.google.container.v1beta1.ISetNetworkPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNetworkPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetNetworkPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setNetworkPolicy(request, options, callback); - } -/** - * Sets the maintenance policy for a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The Google Developers Console [project ID or project - * number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - * @param {string} request.zone - * Required. The name of the Google Compute Engine - * [zone](https://cloud.google.com/compute/docs/zones#available) in which the - * cluster resides. - * @param {string} request.clusterId - * Required. The name of the cluster to update. - * @param {google.container.v1beta1.MaintenancePolicy} request.maintenancePolicy - * Required. The maintenance policy to be set for the cluster. An empty field - * clears the existing maintenance policy. - * @param {string} request.name - * The name (project, location, cluster name) of the cluster to set - * maintenance policy. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.Operation|Operation}. - * Please see the {@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/cluster_manager.set_maintenance_policy.js - * region_tag:container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async - */ - setMaintenancePolicy( - request?: protos.google.container.v1beta1.ISetMaintenancePolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMaintenancePolicyRequest|undefined, {}|undefined - ]>; - setMaintenancePolicy( - request: protos.google.container.v1beta1.ISetMaintenancePolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMaintenancePolicyRequest|null|undefined, - {}|null|undefined>): void; - setMaintenancePolicy( - request: protos.google.container.v1beta1.ISetMaintenancePolicyRequest, - callback: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMaintenancePolicyRequest|null|undefined, - {}|null|undefined>): void; - setMaintenancePolicy( - request?: protos.google.container.v1beta1.ISetMaintenancePolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMaintenancePolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMaintenancePolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IOperation, - protos.google.container.v1beta1.ISetMaintenancePolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - 'project_id': request.projectId ?? '', - 'zone': request.zone ?? '', - 'cluster_id': request.clusterId ?? '', - }); - this.initialize(); - return this.innerApiCalls.setMaintenancePolicy(request, options, callback); - } -/** - * Checks the cluster compatibility with Autopilot mode, and returns a list of - * compatibility issues. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name (project, location, cluster) of the cluster to retrieve. - * Specified in the format `projects/* /locations/* /clusters/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.CheckAutopilotCompatibilityResponse|CheckAutopilotCompatibilityResponse}. - * Please see the {@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/cluster_manager.check_autopilot_compatibility.js - * region_tag:container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async - */ - checkAutopilotCompatibility( - request?: protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|undefined, {}|undefined - ]>; - checkAutopilotCompatibility( - request: protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|null|undefined, - {}|null|undefined>): void; - checkAutopilotCompatibility( - request: protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest, - callback: Callback< - protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|null|undefined, - {}|null|undefined>): void; - checkAutopilotCompatibility( - request?: protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse, - protos.google.container.v1beta1.ICheckAutopilotCompatibilityRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.checkAutopilotCompatibility(request, options, callback); - } -/** - * Fetches locations that offer Google Kubernetes Engine. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Contains the name of the resource requested. - * Specified in the format `projects/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.container.v1beta1.ListLocationsResponse|ListLocationsResponse}. - * Please see the {@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/cluster_manager.list_locations.js - * region_tag:container_v1beta1_generated_ClusterManager_ListLocations_async - */ - listLocations( - request?: protos.google.container.v1beta1.IListLocationsRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IListLocationsResponse, - protos.google.container.v1beta1.IListLocationsRequest|undefined, {}|undefined - ]>; - listLocations( - request: protos.google.container.v1beta1.IListLocationsRequest, - options: CallOptions, - callback: Callback< - protos.google.container.v1beta1.IListLocationsResponse, - protos.google.container.v1beta1.IListLocationsRequest|null|undefined, - {}|null|undefined>): void; - listLocations( - request: protos.google.container.v1beta1.IListLocationsRequest, - callback: Callback< - protos.google.container.v1beta1.IListLocationsResponse, - protos.google.container.v1beta1.IListLocationsRequest|null|undefined, - {}|null|undefined>): void; - listLocations( - request?: protos.google.container.v1beta1.IListLocationsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.container.v1beta1.IListLocationsResponse, - protos.google.container.v1beta1.IListLocationsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.container.v1beta1.IListLocationsResponse, - protos.google.container.v1beta1.IListLocationsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.container.v1beta1.IListLocationsResponse, - protos.google.container.v1beta1.IListLocationsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listLocations(request, options, callback); - } - - /** - * Lists subnetworks that can be used for creating clusters in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent project where subnetworks are usable. - * Specified in the format `projects/*`. - * @param {string} request.filter - * Filtering currently only supports equality on the networkProjectId and must - * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` - * is the project which owns the listed subnetworks. This defaults to the - * parent project ID. - * @param {number} request.pageSize - * The max number of results per page that should be returned. If the number - * of available results is larger than `page_size`, a `next_page_token` is - * returned which can be used to get the next page of results in subsequent - * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.pageToken - * Specifies a page token to use. Set this to the nextPageToken returned by - * previous list requests to get 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.container.v1beta1.UsableSubnetwork|UsableSubnetwork}. - * 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 `listUsableSubnetworksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableSubnetworks( - request?: protos.google.container.v1beta1.IListUsableSubnetworksRequest, - options?: CallOptions): - Promise<[ - protos.google.container.v1beta1.IUsableSubnetwork[], - protos.google.container.v1beta1.IListUsableSubnetworksRequest|null, - protos.google.container.v1beta1.IListUsableSubnetworksResponse - ]>; - listUsableSubnetworks( - request: protos.google.container.v1beta1.IListUsableSubnetworksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.container.v1beta1.IListUsableSubnetworksRequest, - protos.google.container.v1beta1.IListUsableSubnetworksResponse|null|undefined, - protos.google.container.v1beta1.IUsableSubnetwork>): void; - listUsableSubnetworks( - request: protos.google.container.v1beta1.IListUsableSubnetworksRequest, - callback: PaginationCallback< - protos.google.container.v1beta1.IListUsableSubnetworksRequest, - protos.google.container.v1beta1.IListUsableSubnetworksResponse|null|undefined, - protos.google.container.v1beta1.IUsableSubnetwork>): void; - listUsableSubnetworks( - request?: protos.google.container.v1beta1.IListUsableSubnetworksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.container.v1beta1.IListUsableSubnetworksRequest, - protos.google.container.v1beta1.IListUsableSubnetworksResponse|null|undefined, - protos.google.container.v1beta1.IUsableSubnetwork>, - callback?: PaginationCallback< - protos.google.container.v1beta1.IListUsableSubnetworksRequest, - protos.google.container.v1beta1.IListUsableSubnetworksResponse|null|undefined, - protos.google.container.v1beta1.IUsableSubnetwork>): - Promise<[ - protos.google.container.v1beta1.IUsableSubnetwork[], - protos.google.container.v1beta1.IListUsableSubnetworksRequest|null, - protos.google.container.v1beta1.IListUsableSubnetworksResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listUsableSubnetworks(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 where subnetworks are usable. - * Specified in the format `projects/*`. - * @param {string} request.filter - * Filtering currently only supports equality on the networkProjectId and must - * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` - * is the project which owns the listed subnetworks. This defaults to the - * parent project ID. - * @param {number} request.pageSize - * The max number of results per page that should be returned. If the number - * of available results is larger than `page_size`, a `next_page_token` is - * returned which can be used to get the next page of results in subsequent - * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.pageToken - * Specifies a page token to use. Set this to the nextPageToken returned by - * previous list requests to get 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.container.v1beta1.UsableSubnetwork|UsableSubnetwork} 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 `listUsableSubnetworksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listUsableSubnetworksStream( - request?: protos.google.container.v1beta1.IListUsableSubnetworksRequest, - 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['listUsableSubnetworks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableSubnetworks.createStream( - this.innerApiCalls.listUsableSubnetworks as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUsableSubnetworks`, 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 where subnetworks are usable. - * Specified in the format `projects/*`. - * @param {string} request.filter - * Filtering currently only supports equality on the networkProjectId and must - * be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` - * is the project which owns the listed subnetworks. This defaults to the - * parent project ID. - * @param {number} request.pageSize - * The max number of results per page that should be returned. If the number - * of available results is larger than `page_size`, a `next_page_token` is - * returned which can be used to get the next page of results in subsequent - * requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.pageToken - * Specifies a page token to use. Set this to the nextPageToken returned by - * previous list requests to get 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.container.v1beta1.UsableSubnetwork|UsableSubnetwork}. 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/cluster_manager.list_usable_subnetworks.js - * region_tag:container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_async - */ - listUsableSubnetworksAsync( - request?: protos.google.container.v1beta1.IListUsableSubnetworksRequest, - 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['listUsableSubnetworks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listUsableSubnetworks.asyncIterate( - this.innerApiCalls['listUsableSubnetworks'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * 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.clusterManagerStub && !this._terminated) { - return this.clusterManagerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client_config.json b/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client_config.json deleted file mode 100644 index 911352f9362..00000000000 --- a/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_client_config.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "interfaces": { - "google.container.v1beta1.ClusterManager": { - "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": { - "ListClusters": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetCluster": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateCluster": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCluster": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNodePool": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetNodePoolAutoscaling": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetLoggingService": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetMonitoringService": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetAddonsConfig": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetLocations": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateMaster": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetMasterAuth": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteCluster": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListOperations": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetOperation": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CancelOperation": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetServerConfig": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetJSONWebKeys": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListNodePools": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetNodePool": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateNodePool": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNodePool": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CompleteNodePoolUpgrade": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RollbackNodePoolUpgrade": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetNodePoolManagement": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetLabels": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetLegacyAbac": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartIPRotation": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CompleteIPRotation": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetNodePoolSize": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetNetworkPolicy": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetMaintenancePolicy": { - "timeout_millis": 45000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListUsableSubnetworks": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CheckAutopilotCompatibility": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListLocations": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_proto_list.json b/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_proto_list.json deleted file mode 100644 index 7a594ccf698..00000000000 --- a/owl-bot-staging/google-container/v1beta1/src/v1beta1/cluster_manager_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/container/v1beta1/cluster_service.proto" -] diff --git a/owl-bot-staging/google-container/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-container/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 0278af900c2..00000000000 --- a/owl-bot-staging/google-container/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,377 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.container.v1beta1", - "libraryPackage": "@google-cloud/container", - "services": { - "ClusterManager": { - "clients": { - "grpc": { - "libraryClient": "ClusterManagerClient", - "rpcs": { - "ListClusters": { - "methods": [ - "listClusters" - ] - }, - "GetCluster": { - "methods": [ - "getCluster" - ] - }, - "CreateCluster": { - "methods": [ - "createCluster" - ] - }, - "UpdateCluster": { - "methods": [ - "updateCluster" - ] - }, - "UpdateNodePool": { - "methods": [ - "updateNodePool" - ] - }, - "SetNodePoolAutoscaling": { - "methods": [ - "setNodePoolAutoscaling" - ] - }, - "SetLoggingService": { - "methods": [ - "setLoggingService" - ] - }, - "SetMonitoringService": { - "methods": [ - "setMonitoringService" - ] - }, - "SetAddonsConfig": { - "methods": [ - "setAddonsConfig" - ] - }, - "SetLocations": { - "methods": [ - "setLocations" - ] - }, - "UpdateMaster": { - "methods": [ - "updateMaster" - ] - }, - "SetMasterAuth": { - "methods": [ - "setMasterAuth" - ] - }, - "DeleteCluster": { - "methods": [ - "deleteCluster" - ] - }, - "ListOperations": { - "methods": [ - "listOperations" - ] - }, - "GetOperation": { - "methods": [ - "getOperation" - ] - }, - "CancelOperation": { - "methods": [ - "cancelOperation" - ] - }, - "GetServerConfig": { - "methods": [ - "getServerConfig" - ] - }, - "GetJSONWebKeys": { - "methods": [ - "getJSONWebKeys" - ] - }, - "ListNodePools": { - "methods": [ - "listNodePools" - ] - }, - "GetNodePool": { - "methods": [ - "getNodePool" - ] - }, - "CreateNodePool": { - "methods": [ - "createNodePool" - ] - }, - "DeleteNodePool": { - "methods": [ - "deleteNodePool" - ] - }, - "CompleteNodePoolUpgrade": { - "methods": [ - "completeNodePoolUpgrade" - ] - }, - "RollbackNodePoolUpgrade": { - "methods": [ - "rollbackNodePoolUpgrade" - ] - }, - "SetNodePoolManagement": { - "methods": [ - "setNodePoolManagement" - ] - }, - "SetLabels": { - "methods": [ - "setLabels" - ] - }, - "SetLegacyAbac": { - "methods": [ - "setLegacyAbac" - ] - }, - "StartIPRotation": { - "methods": [ - "startIPRotation" - ] - }, - "CompleteIPRotation": { - "methods": [ - "completeIPRotation" - ] - }, - "SetNodePoolSize": { - "methods": [ - "setNodePoolSize" - ] - }, - "SetNetworkPolicy": { - "methods": [ - "setNetworkPolicy" - ] - }, - "SetMaintenancePolicy": { - "methods": [ - "setMaintenancePolicy" - ] - }, - "CheckAutopilotCompatibility": { - "methods": [ - "checkAutopilotCompatibility" - ] - }, - "ListLocations": { - "methods": [ - "listLocations" - ] - }, - "ListUsableSubnetworks": { - "methods": [ - "listUsableSubnetworks", - "listUsableSubnetworksStream", - "listUsableSubnetworksAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ClusterManagerClient", - "rpcs": { - "ListClusters": { - "methods": [ - "listClusters" - ] - }, - "GetCluster": { - "methods": [ - "getCluster" - ] - }, - "CreateCluster": { - "methods": [ - "createCluster" - ] - }, - "UpdateCluster": { - "methods": [ - "updateCluster" - ] - }, - "UpdateNodePool": { - "methods": [ - "updateNodePool" - ] - }, - "SetNodePoolAutoscaling": { - "methods": [ - "setNodePoolAutoscaling" - ] - }, - "SetLoggingService": { - "methods": [ - "setLoggingService" - ] - }, - "SetMonitoringService": { - "methods": [ - "setMonitoringService" - ] - }, - "SetAddonsConfig": { - "methods": [ - "setAddonsConfig" - ] - }, - "SetLocations": { - "methods": [ - "setLocations" - ] - }, - "UpdateMaster": { - "methods": [ - "updateMaster" - ] - }, - "SetMasterAuth": { - "methods": [ - "setMasterAuth" - ] - }, - "DeleteCluster": { - "methods": [ - "deleteCluster" - ] - }, - "ListOperations": { - "methods": [ - "listOperations" - ] - }, - "GetOperation": { - "methods": [ - "getOperation" - ] - }, - "CancelOperation": { - "methods": [ - "cancelOperation" - ] - }, - "GetServerConfig": { - "methods": [ - "getServerConfig" - ] - }, - "GetJSONWebKeys": { - "methods": [ - "getJSONWebKeys" - ] - }, - "ListNodePools": { - "methods": [ - "listNodePools" - ] - }, - "GetNodePool": { - "methods": [ - "getNodePool" - ] - }, - "CreateNodePool": { - "methods": [ - "createNodePool" - ] - }, - "DeleteNodePool": { - "methods": [ - "deleteNodePool" - ] - }, - "CompleteNodePoolUpgrade": { - "methods": [ - "completeNodePoolUpgrade" - ] - }, - "RollbackNodePoolUpgrade": { - "methods": [ - "rollbackNodePoolUpgrade" - ] - }, - "SetNodePoolManagement": { - "methods": [ - "setNodePoolManagement" - ] - }, - "SetLabels": { - "methods": [ - "setLabels" - ] - }, - "SetLegacyAbac": { - "methods": [ - "setLegacyAbac" - ] - }, - "StartIPRotation": { - "methods": [ - "startIPRotation" - ] - }, - "CompleteIPRotation": { - "methods": [ - "completeIPRotation" - ] - }, - "SetNodePoolSize": { - "methods": [ - "setNodePoolSize" - ] - }, - "SetNetworkPolicy": { - "methods": [ - "setNetworkPolicy" - ] - }, - "SetMaintenancePolicy": { - "methods": [ - "setMaintenancePolicy" - ] - }, - "CheckAutopilotCompatibility": { - "methods": [ - "checkAutopilotCompatibility" - ] - }, - "ListLocations": { - "methods": [ - "listLocations" - ] - }, - "ListUsableSubnetworks": { - "methods": [ - "listUsableSubnetworks", - "listUsableSubnetworksStream", - "listUsableSubnetworksAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-container/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-container/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index b1b39233034..00000000000 --- a/owl-bot-staging/google-container/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 {ClusterManagerClient} from './cluster_manager_client'; diff --git a/owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 1101d781caa..00000000000 --- a/owl-bot-staging/google-container/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 container = require('@google-cloud/container'); - -function main() { - const clusterManagerClient = new container.ClusterManagerClient(); -} - -main(); diff --git a/owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-container/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 6685b8649e6..00000000000 --- a/owl-bot-staging/google-container/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 {ClusterManagerClient} from '@google-cloud/container'; - -// check that the client class type name can be used -function doStuffWithClusterManagerClient(client: ClusterManagerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const clusterManagerClient = new ClusterManagerClient(); - doStuffWithClusterManagerClient(clusterManagerClient); -} - -main(); diff --git a/owl-bot-staging/google-container/v1beta1/system-test/install.ts b/owl-bot-staging/google-container/v1beta1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-container/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-container/v1beta1/test/gapic_cluster_manager_v1beta1.ts b/owl-bot-staging/google-container/v1beta1/test/gapic_cluster_manager_v1beta1.ts deleted file mode 100644 index 7f93f752f2c..00000000000 --- a/owl-bot-staging/google-container/v1beta1/test/gapic_cluster_manager_v1beta1.ts +++ /dev/null @@ -1,5238 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 clustermanagerModule 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('v1beta1.ClusterManagerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = clustermanagerModule.v1beta1.ClusterManagerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = clustermanagerModule.v1beta1.ClusterManagerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = clustermanagerModule.v1beta1.ClusterManagerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.clusterManagerStub, undefined); - await client.initialize(); - assert(client.clusterManagerStub); - }); - - it('has close method for the initialized client', done => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.clusterManagerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.clusterManagerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - 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 clustermanagerModule.v1beta1.ClusterManagerClient({ - 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('listClusters', () => { - it('invokes listClusters without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.ListClustersResponse() - ); - client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listClusters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClusters without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.ListClustersResponse() - ); - client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listClusters( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IListClustersResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClusters with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listClusters(request), expectedError); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClusters with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListClustersRequest', ['zone']); - request.zone = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listClusters(request), expectedError); - }); - }); - - describe('getCluster', () => { - it('invokes getCluster without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCluster( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.ICluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCluster(request), expectedError); - }); - }); - - describe('createCluster', () => { - it('invokes createCluster without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.createCluster = stubSimpleCall(expectedResponse); - const [response] = await client.createCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.createCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCluster( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CreateClusterRequest', ['zone']); - request.zone = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createCluster(request), expectedError); - }); - }); - - describe('updateCluster', () => { - it('invokes updateCluster without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.updateCluster = stubSimpleCall(expectedResponse); - const [response] = await client.updateCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.updateCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCluster( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateCluster(request), expectedError); - }); - }); - - describe('updateNodePool', () => { - it('invokes updateNodePool without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.updateNodePool = stubSimpleCall(expectedResponse); - const [response] = await client.updateNodePool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNodePool without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.updateNodePool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNodePool( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNodePool with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNodePool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNodePool with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.UpdateNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateNodePool(request), expectedError); - }); - }); - - describe('setNodePoolAutoscaling', () => { - it('invokes setNodePoolAutoscaling without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolAutoscalingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCall(expectedResponse); - const [response] = await client.setNodePoolAutoscaling(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolAutoscaling without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolAutoscalingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setNodePoolAutoscaling( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolAutoscaling with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolAutoscalingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setNodePoolAutoscaling = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setNodePoolAutoscaling(request), expectedError); - const actualRequest = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolAutoscaling as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolAutoscaling with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolAutoscalingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolAutoscalingRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setNodePoolAutoscaling(request), expectedError); - }); - }); - - describe('setLoggingService', () => { - it('invokes setLoggingService without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLoggingServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setLoggingService = stubSimpleCall(expectedResponse); - const [response] = await client.setLoggingService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLoggingService without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLoggingServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setLoggingService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setLoggingService( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLoggingService with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLoggingServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setLoggingService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setLoggingService(request), expectedError); - const actualRequest = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLoggingService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLoggingService with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLoggingServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLoggingServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setLoggingService(request), expectedError); - }); - }); - - describe('setMonitoringService', () => { - it('invokes setMonitoringService without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMonitoringServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setMonitoringService = stubSimpleCall(expectedResponse); - const [response] = await client.setMonitoringService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMonitoringService without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMonitoringServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setMonitoringService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setMonitoringService( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMonitoringService with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMonitoringServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setMonitoringService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setMonitoringService(request), expectedError); - const actualRequest = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMonitoringService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMonitoringService with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMonitoringServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMonitoringServiceRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setMonitoringService(request), expectedError); - }); - }); - - describe('setAddonsConfig', () => { - it('invokes setAddonsConfig without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetAddonsConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setAddonsConfig = stubSimpleCall(expectedResponse); - const [response] = await client.setAddonsConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setAddonsConfig without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetAddonsConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setAddonsConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setAddonsConfig( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setAddonsConfig with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetAddonsConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setAddonsConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setAddonsConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAddonsConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setAddonsConfig with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetAddonsConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetAddonsConfigRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setAddonsConfig(request), expectedError); - }); - }); - - describe('setLocations', () => { - it('invokes setLocations without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setLocations = stubSimpleCall(expectedResponse); - const [response] = await client.setLocations(request); - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLocations without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setLocations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setLocations( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLocations with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setLocations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setLocations(request), expectedError); - assert(stub.calledOnce); - const actualRequest = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLocations with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLocationsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setLocations(request), expectedError); - assert(stub.calledOnce); - }); - }); - - describe('updateMaster', () => { - it('invokes updateMaster without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.updateMaster = stubSimpleCall(expectedResponse); - const [response] = await client.updateMaster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMaster without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.updateMaster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMaster( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMaster with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMaster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateMaster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMaster with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.UpdateMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.UpdateMasterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateMaster(request), expectedError); - }); - }); - - describe('setMasterAuth', () => { - it('invokes setMasterAuth without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMasterAuthRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setMasterAuth = stubSimpleCall(expectedResponse); - const [response] = await client.setMasterAuth(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMasterAuth without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMasterAuthRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setMasterAuth = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setMasterAuth( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMasterAuth with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMasterAuthRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setMasterAuth = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setMasterAuth(request), expectedError); - const actualRequest = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMasterAuth as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMasterAuth with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMasterAuthRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMasterAuthRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setMasterAuth(request), expectedError); - }); - }); - - describe('deleteCluster', () => { - it('invokes deleteCluster without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.deleteCluster = stubSimpleCall(expectedResponse); - const [response] = await client.deleteCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.deleteCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCluster( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.DeleteClusterRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteCluster(request), expectedError); - }); - }); - - describe('listOperations', () => { - it('invokes listOperations without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListOperationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.ListOperationsResponse() - ); - client.innerApiCalls.listOperations = stubSimpleCall(expectedResponse); - const [response] = await client.listOperations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOperations without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListOperationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.ListOperationsResponse() - ); - client.innerApiCalls.listOperations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listOperations( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IListOperationsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOperations with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListOperationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listOperations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listOperations(request), expectedError); - const actualRequest = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOperations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOperations with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListOperationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListOperationsRequest', ['zone']); - request.zone = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listOperations(request), expectedError); - }); - }); - - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.getOperation = stubSimpleCall(expectedResponse); - const [response] = await client.getOperation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOperation without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.getOperation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOperation( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOperation with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOperation(request), expectedError); - const actualRequest = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOperation with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOperation(request), expectedError); - }); - }); - - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CancelOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancelOperation = stubSimpleCall(expectedResponse); - const [response] = await client.cancelOperation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelOperation without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CancelOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancelOperation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelOperation( - 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.cancelOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelOperation with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CancelOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&operation_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelOperation(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelOperation with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CancelOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CancelOperationRequest', ['operationId']); - request.operationId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelOperation(request), expectedError); - }); - }); - - describe('getServerConfig', () => { - it('invokes getServerConfig without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.ServerConfig() - ); - client.innerApiCalls.getServerConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getServerConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServerConfig without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.ServerConfig() - ); - client.innerApiCalls.getServerConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServerConfig( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IServerConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServerConfig with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['zone']); - request.zone = defaultValue3; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServerConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServerConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServerConfig with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetServerConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetServerConfigRequest', ['zone']); - request.zone = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getServerConfig(request), expectedError); - }); - }); - - describe('getJSONWebKeys', () => { - it('invokes getJSONWebKeys without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetJSONWebKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetJSONWebKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.GetJSONWebKeysResponse() - ); - client.innerApiCalls.getJsonWebKeys = stubSimpleCall(expectedResponse); - const [response] = await client.getJSONWebKeys(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJSONWebKeys without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetJSONWebKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetJSONWebKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.GetJSONWebKeysResponse() - ); - client.innerApiCalls.getJsonWebKeys = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJSONWebKeys( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IGetJSONWebKeysResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJSONWebKeys with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetJSONWebKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetJSONWebKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getJsonWebKeys = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJSONWebKeys(request), expectedError); - const actualRequest = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJsonWebKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJSONWebKeys with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetJSONWebKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetJSONWebKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getJSONWebKeys(request), expectedError); - }); - }); - - describe('listNodePools', () => { - it('invokes listNodePools without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.ListNodePoolsResponse() - ); - client.innerApiCalls.listNodePools = stubSimpleCall(expectedResponse); - const [response] = await client.listNodePools(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodePools without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.ListNodePoolsResponse() - ); - client.innerApiCalls.listNodePools = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNodePools( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IListNodePoolsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodePools with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNodePools = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNodePools(request), expectedError); - const actualRequest = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodePools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodePools with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListNodePoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.ListNodePoolsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listNodePools(request), expectedError); - }); - }); - - describe('getNodePool', () => { - it('invokes getNodePool without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.NodePool() - ); - client.innerApiCalls.getNodePool = stubSimpleCall(expectedResponse); - const [response] = await client.getNodePool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodePool without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.NodePool() - ); - client.innerApiCalls.getNodePool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNodePool( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.INodePool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodePool with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNodePool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodePool with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.GetNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.GetNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNodePool(request), expectedError); - }); - }); - - describe('createNodePool', () => { - it('invokes createNodePool without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CreateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.createNodePool = stubSimpleCall(expectedResponse); - const [response] = await client.createNodePool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNodePool without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CreateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.createNodePool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNodePool( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNodePool with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CreateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `parent=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNodePool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNodePool with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CreateNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CreateNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createNodePool(request), expectedError); - }); - }); - - describe('deleteNodePool', () => { - it('invokes deleteNodePool without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.DeleteNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.deleteNodePool = stubSimpleCall(expectedResponse); - const [response] = await client.deleteNodePool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNodePool without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.DeleteNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.deleteNodePool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNodePool( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNodePool with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.DeleteNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNodePool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteNodePool(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNodePool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNodePool with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.DeleteNodePoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.DeleteNodePoolRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteNodePool(request), expectedError); - }); - }); - - describe('completeNodePoolUpgrade', () => { - it('invokes completeNodePoolUpgrade without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CompleteNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CompleteNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCall(expectedResponse); - const [response] = await client.completeNodePoolUpgrade(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeNodePoolUpgrade without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CompleteNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CompleteNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.completeNodePoolUpgrade( - 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.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeNodePoolUpgrade with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CompleteNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CompleteNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.completeNodePoolUpgrade = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.completeNodePoolUpgrade(request), expectedError); - const actualRequest = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeNodePoolUpgrade with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CompleteNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CompleteNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.completeNodePoolUpgrade(request), expectedError); - }); - }); - - describe('rollbackNodePoolUpgrade', () => { - it('invokes rollbackNodePoolUpgrade without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.RollbackNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCall(expectedResponse); - const [response] = await client.rollbackNodePoolUpgrade(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackNodePoolUpgrade without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.RollbackNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rollbackNodePoolUpgrade( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackNodePoolUpgrade with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.RollbackNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rollbackNodePoolUpgrade = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rollbackNodePoolUpgrade(request), expectedError); - const actualRequest = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackNodePoolUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackNodePoolUpgrade with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.RollbackNodePoolUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.RollbackNodePoolUpgradeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.rollbackNodePoolUpgrade(request), expectedError); - }); - }); - - describe('setNodePoolManagement', () => { - it('invokes setNodePoolManagement without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolManagementRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setNodePoolManagement = stubSimpleCall(expectedResponse); - const [response] = await client.setNodePoolManagement(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolManagement without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolManagementRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setNodePoolManagement = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setNodePoolManagement( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolManagement with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolManagementRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setNodePoolManagement = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setNodePoolManagement(request), expectedError); - const actualRequest = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolManagement as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolManagement with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolManagementRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolManagementRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setNodePoolManagement(request), expectedError); - }); - }); - - describe('setLabels', () => { - it('invokes setLabels without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLabelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setLabels = stubSimpleCall(expectedResponse); - const [response] = await client.setLabels(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLabels without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLabelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setLabels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setLabels( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLabels with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLabelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setLabels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setLabels(request), expectedError); - const actualRequest = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLabels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLabels with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLabelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLabelsRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setLabels(request), expectedError); - }); - }); - - describe('setLegacyAbac', () => { - it('invokes setLegacyAbac without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLegacyAbacRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setLegacyAbac = stubSimpleCall(expectedResponse); - const [response] = await client.setLegacyAbac(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLegacyAbac without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLegacyAbacRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setLegacyAbac = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setLegacyAbac( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLegacyAbac with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLegacyAbacRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setLegacyAbac = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setLegacyAbac(request), expectedError); - const actualRequest = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setLegacyAbac as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setLegacyAbac with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetLegacyAbacRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetLegacyAbacRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setLegacyAbac(request), expectedError); - }); - }); - - describe('startIPRotation', () => { - it('invokes startIPRotation without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.StartIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.startIpRotation = stubSimpleCall(expectedResponse); - const [response] = await client.startIPRotation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startIPRotation without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.StartIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.startIpRotation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startIPRotation( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startIPRotation with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.StartIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startIpRotation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startIPRotation(request), expectedError); - const actualRequest = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startIPRotation with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.StartIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.StartIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.startIPRotation(request), expectedError); - }); - }); - - describe('completeIPRotation', () => { - it('invokes completeIPRotation without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CompleteIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.completeIpRotation = stubSimpleCall(expectedResponse); - const [response] = await client.completeIPRotation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeIPRotation without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CompleteIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.completeIpRotation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.completeIPRotation( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeIPRotation with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CompleteIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.completeIpRotation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.completeIPRotation(request), expectedError); - const actualRequest = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeIpRotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeIPRotation with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CompleteIPRotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.CompleteIPRotationRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.completeIPRotation(request), expectedError); - }); - }); - - describe('setNodePoolSize', () => { - it('invokes setNodePoolSize without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setNodePoolSize = stubSimpleCall(expectedResponse); - const [response] = await client.setNodePoolSize(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolSize without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setNodePoolSize = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setNodePoolSize( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolSize with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}&node_pool_id=${defaultValue5}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setNodePoolSize = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setNodePoolSize(request), expectedError); - const actualRequest = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNodePoolSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNodePoolSize with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNodePoolSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['clusterId']); - request.clusterId = defaultValue4; - const defaultValue5 = - getTypeDefaultValue('.google.container.v1beta1.SetNodePoolSizeRequest', ['nodePoolId']); - request.nodePoolId = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setNodePoolSize(request), expectedError); - }); - }); - - describe('setNetworkPolicy', () => { - it('invokes setNetworkPolicy without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setNetworkPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setNetworkPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNetworkPolicy without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setNetworkPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setNetworkPolicy( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNetworkPolicy with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setNetworkPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setNetworkPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setNetworkPolicy with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetNetworkPolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setNetworkPolicy(request), expectedError); - }); - }); - - describe('setMaintenancePolicy', () => { - it('invokes setMaintenancePolicy without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMaintenancePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setMaintenancePolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setMaintenancePolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMaintenancePolicy without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMaintenancePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.Operation() - ); - client.innerApiCalls.setMaintenancePolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setMaintenancePolicy( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMaintenancePolicy with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMaintenancePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedHeaderRequestParams = `name=${defaultValue1}&project_id=${defaultValue2}&zone=${defaultValue3}&cluster_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setMaintenancePolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setMaintenancePolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMaintenancePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMaintenancePolicy with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.SetMaintenancePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['name']); - request.name = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['projectId']); - request.projectId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['zone']); - request.zone = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.container.v1beta1.SetMaintenancePolicyRequest', ['clusterId']); - request.clusterId = defaultValue4; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setMaintenancePolicy(request), expectedError); - }); - }); - - describe('checkAutopilotCompatibility', () => { - it('invokes checkAutopilotCompatibility without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CheckAutopilotCompatibilityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CheckAutopilotCompatibilityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.CheckAutopilotCompatibilityResponse() - ); - client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCall(expectedResponse); - const [response] = await client.checkAutopilotCompatibility(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAutopilotCompatibility without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CheckAutopilotCompatibilityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CheckAutopilotCompatibilityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.CheckAutopilotCompatibilityResponse() - ); - client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.checkAutopilotCompatibility( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.ICheckAutopilotCompatibilityResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAutopilotCompatibility with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CheckAutopilotCompatibilityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CheckAutopilotCompatibilityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.checkAutopilotCompatibility = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAutopilotCompatibility(request), expectedError); - const actualRequest = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.checkAutopilotCompatibility as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAutopilotCompatibility with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.CheckAutopilotCompatibilityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.CheckAutopilotCompatibilityRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.checkAutopilotCompatibility(request), expectedError); - }); - }); - - describe('listLocations', () => { - it('invokes listLocations without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListLocationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.ListLocationsResponse() - ); - client.innerApiCalls.listLocations = stubSimpleCall(expectedResponse); - const [response] = await client.listLocations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocations without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListLocationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.container.v1beta1.ListLocationsResponse() - ); - client.innerApiCalls.listLocations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLocations( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IListLocationsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocations with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListLocationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLocations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLocations(request), expectedError); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocations with closed client', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListLocationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listLocations(request), expectedError); - }); - }); - - describe('listUsableSubnetworks', () => { - it('invokes listUsableSubnetworks without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - ]; - client.innerApiCalls.listUsableSubnetworks = stubSimpleCall(expectedResponse); - const [response] = await client.listUsableSubnetworks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableSubnetworks without error using callback', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - ]; - client.innerApiCalls.listUsableSubnetworks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUsableSubnetworks( - request, - (err?: Error|null, result?: protos.google.container.v1beta1.IUsableSubnetwork[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableSubnetworks with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUsableSubnetworks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUsableSubnetworks(request), expectedError); - const actualRequest = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUsableSubnetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUsableSubnetworksStream without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - ]; - client.descriptors.page.listUsableSubnetworks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUsableSubnetworksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.container.v1beta1.UsableSubnetwork[] = []; - stream.on('data', (response: protos.google.container.v1beta1.UsableSubnetwork) => { - 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.listUsableSubnetworks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableSubnetworks, request)); - assert( - (client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listUsableSubnetworksStream with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableSubnetworks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUsableSubnetworksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.container.v1beta1.UsableSubnetwork[] = []; - stream.on('data', (response: protos.google.container.v1beta1.UsableSubnetwork) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsableSubnetworks, request)); - assert( - (client.descriptors.page.listUsableSubnetworks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableSubnetworks without error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - generateSampleMessage(new protos.google.container.v1beta1.UsableSubnetwork()), - ]; - client.descriptors.page.listUsableSubnetworks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.container.v1beta1.IUsableSubnetwork[] = []; - const iterable = client.listUsableSubnetworksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUsableSubnetworks with error', async () => { - const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.container.v1beta1.ListUsableSubnetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.container.v1beta1.ListUsableSubnetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listUsableSubnetworks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUsableSubnetworksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.container.v1beta1.IUsableSubnetwork[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUsableSubnetworks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/owl-bot-staging/google-container/v1beta1/tsconfig.json b/owl-bot-staging/google-container/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-container/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-container/v1beta1/webpack.config.js b/owl-bot-staging/google-container/v1beta1/webpack.config.js deleted file mode 100644 index 9032271af9d..00000000000 --- a/owl-bot-staging/google-container/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: 'ClusterManager', - filename: './cluster-manager.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-dataflow/v1beta3/.eslintignore b/owl-bot-staging/google-dataflow/v1beta3/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-dataflow/v1beta3/.eslintrc.json b/owl-bot-staging/google-dataflow/v1beta3/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/.gitignore b/owl-bot-staging/google-dataflow/v1beta3/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/.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-dataflow/v1beta3/.jsdoc.js b/owl-bot-staging/google-dataflow/v1beta3/.jsdoc.js deleted file mode 100644 index efcec47573f..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/.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/dataflow', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-dataflow/v1beta3/.mocharc.js b/owl-bot-staging/google-dataflow/v1beta3/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/.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-dataflow/v1beta3/.prettierrc.js b/owl-bot-staging/google-dataflow/v1beta3/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/.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-dataflow/v1beta3/README.md b/owl-bot-staging/google-dataflow/v1beta3/README.md deleted file mode 100644 index 13c331ccf54..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/README.md +++ /dev/null @@ -1 +0,0 @@ -Dataflow: Nodejs Client diff --git a/owl-bot-staging/google-dataflow/v1beta3/package.json b/owl-bot-staging/google-dataflow/v1beta3/package.json deleted file mode 100644 index 7db4b3cac0b..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@google-cloud/dataflow", - "version": "0.1.0", - "description": "Dataflow client for Node.js", - "repository": "googleapis/nodejs-dataflow", - "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 dataflow", - "dataflow", - "flex templates service", - "jobs v1 beta3", - "messages v1 beta3", - "metrics v1 beta3", - "snapshots v1 beta3", - "templates 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-dataflow/v1beta3/protos/google/dataflow/v1beta3/environment.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/environment.proto deleted file mode 100644 index e243c5e7934..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/environment.proto +++ /dev/null @@ -1,554 +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.dataflow.v1beta3; - -import "google/api/field_behavior.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/struct.proto"; - -option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; -option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; -option java_multiple_files = true; -option java_outer_classname = "EnvironmentProto"; -option java_package = "com.google.dataflow.v1beta3"; -option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; -option ruby_package = "Google::Cloud::Dataflow::V1beta3"; - -// Describes the environment in which a Dataflow Job runs. -message Environment { - // The prefix of the resources the system should use for temporary - // storage. The system will append the suffix "/temp-{JOBNAME} to - // this resource prefix, where {JOBNAME} is the value of the - // job_name field. The resulting bucket and object prefix is used - // as the prefix of the resources used to store temporary data - // needed during the job execution. NOTE: This will override the - // value in taskrunner_settings. - // The supported resource type is: - // - // Google Cloud Storage: - // - // storage.googleapis.com/{bucket}/{object} - // bucket.storage.googleapis.com/{object} - string temp_storage_prefix = 1; - - // The type of cluster manager API to use. If unknown or - // unspecified, the service will attempt to choose a reasonable - // default. This should be in the form of the API service name, - // e.g. "compute.googleapis.com". - string cluster_manager_api_service = 2; - - // The list of experiments to enable. This field should be used for SDK - // related experiments and not for service related experiments. The proper - // field for service related experiments is service_options. - repeated string experiments = 3; - - // The list of service options to enable. This field should be used for - // service related experiments only. These experiments, when graduating to GA, - // should be replaced by dedicated fields or become default (i.e. always on). - repeated string service_options = 16; - - // If set, contains the Cloud KMS key identifier used to encrypt data - // at rest, AKA a Customer Managed Encryption Key (CMEK). - // - // Format: - // projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY - string service_kms_key_name = 12; - - // The worker pools. At least one "harness" worker pool must be - // specified in order for the job to have workers. - repeated WorkerPool worker_pools = 4; - - // A description of the process that generated the request. - google.protobuf.Struct user_agent = 5; - - // A structure describing which components and their versions of the service - // are required in order to run the job. - google.protobuf.Struct version = 6; - - // The dataset for the current project where various workflow - // related tables are stored. - // - // The supported resource type is: - // - // Google BigQuery: - // bigquery.googleapis.com/{dataset} - string dataset = 7; - - // The Cloud Dataflow SDK pipeline options specified by the user. These - // options are passed through the service and are used to recreate the - // SDK pipeline options on the worker in a language agnostic and platform - // independent way. - google.protobuf.Struct sdk_pipeline_options = 8; - - // Experimental settings. - google.protobuf.Any internal_experiments = 9; - - // Identity to run virtual machines as. Defaults to the default account. - string service_account_email = 10; - - // Which Flexible Resource Scheduling mode to run in. - FlexResourceSchedulingGoal flex_resource_scheduling_goal = 11; - - // The Compute Engine region - // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in - // which worker processing should occur, e.g. "us-west1". Mutually exclusive - // with worker_zone. If neither worker_region nor worker_zone is specified, - // default to the control plane's region. - string worker_region = 13; - - // The Compute Engine zone - // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in - // which worker processing should occur, e.g. "us-west1-a". Mutually exclusive - // with worker_region. If neither worker_region nor worker_zone is specified, - // a zone in the control plane's region is chosen based on available capacity. - string worker_zone = 14; - - // Output only. The shuffle mode used for the job. - ShuffleMode shuffle_mode = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Any debugging options to be supplied to the job. - DebugOptions debug_options = 17; -} - -// The packages that must be installed in order for a worker to run the -// steps of the Cloud Dataflow job that will be assigned to its worker -// pool. -// -// This is the mechanism by which the Cloud Dataflow SDK causes code to -// be loaded onto the workers. For example, the Cloud Dataflow Java SDK -// might use this to install jars containing the user's code and all of the -// various dependencies (libraries, data files, etc.) required in order -// for that code to run. -message Package { - // The name of the package. - string name = 1; - - // The resource to read the package from. The supported resource type is: - // - // Google Cloud Storage: - // - // storage.googleapis.com/{bucket} - // bucket.storage.googleapis.com/ - string location = 2; -} - -// Specifies the processing model used by a -// [google.dataflow.v1beta3.Job], which determines the way the Job is -// managed by the Cloud Dataflow service (how workers are scheduled, how -// inputs are sharded, etc). -enum JobType { - // The type of the job is unspecified, or unknown. - JOB_TYPE_UNKNOWN = 0; - - // A batch job with a well-defined end point: data is read, data is - // processed, data is written, and the job is done. - JOB_TYPE_BATCH = 1; - - // A continuously streaming job with no end: data is read, - // processed, and written continuously. - JOB_TYPE_STREAMING = 2; -} - -// Specifies the resource to optimize for in Flexible Resource Scheduling. -enum FlexResourceSchedulingGoal { - // Run in the default mode. - FLEXRS_UNSPECIFIED = 0; - - // Optimize for lower execution time. - FLEXRS_SPEED_OPTIMIZED = 1; - - // Optimize for lower cost. - FLEXRS_COST_OPTIMIZED = 2; -} - -// Describes the data disk used by a workflow job. -message Disk { - // Size of disk in GB. If zero or unspecified, the service will - // attempt to choose a reasonable default. - int32 size_gb = 1; - - // Disk storage type, as defined by Google Compute Engine. This - // must be a disk type appropriate to the project and zone in which - // the workers will run. If unknown or unspecified, the service - // will attempt to choose a reasonable default. - // - // For example, the standard persistent disk type is a resource name - // typically ending in "pd-standard". If SSD persistent disks are - // available, the resource name typically ends with "pd-ssd". The - // actual valid values are defined the Google Compute Engine API, - // not by the Cloud Dataflow API; consult the Google Compute Engine - // documentation for more information about determining the set of - // available disk types for a particular project and zone. - // - // Google Compute Engine Disk types are local to a particular - // project in a particular zone, and so the resource name will - // typically look something like this: - // - // compute.googleapis.com/projects/project-id/zones/zone/diskTypes/pd-standard - string disk_type = 2; - - // Directory in a VM where disk is mounted. - string mount_point = 3; -} - -// Provides data to pass through to the worker harness. -message WorkerSettings { - // The base URL for accessing Google Cloud APIs. - // - // When workers access Google Cloud APIs, they logically do so via - // relative URLs. If this field is specified, it supplies the base - // URL to use for resolving these relative URLs. The normative - // algorithm used is defined by RFC 1808, "Relative Uniform Resource - // Locators". - // - // If not specified, the default value is "http://www.googleapis.com/" - string base_url = 1; - - // Whether to send work progress updates to the service. - bool reporting_enabled = 2; - - // The Cloud Dataflow service path relative to the root URL, for example, - // "dataflow/v1b3/projects". - string service_path = 3; - - // The Shuffle service path relative to the root URL, for example, - // "shuffle/v1beta1". - string shuffle_service_path = 4; - - // The ID of the worker running this pipeline. - string worker_id = 5; - - // The prefix of the resources the system should use for temporary - // storage. - // - // The supported resource type is: - // - // Google Cloud Storage: - // - // storage.googleapis.com/{bucket}/{object} - // bucket.storage.googleapis.com/{object} - string temp_storage_prefix = 6; -} - -// Taskrunner configuration settings. -message TaskRunnerSettings { - // The UNIX user ID on the worker VM to use for tasks launched by - // taskrunner; e.g. "root". - string task_user = 1; - - // The UNIX group ID on the worker VM to use for tasks launched by - // taskrunner; e.g. "wheel". - string task_group = 2; - - // The OAuth2 scopes to be requested by the taskrunner in order to - // access the Cloud Dataflow API. - repeated string oauth_scopes = 3; - - // The base URL for the taskrunner to use when accessing Google Cloud APIs. - // - // When workers access Google Cloud APIs, they logically do so via - // relative URLs. If this field is specified, it supplies the base - // URL to use for resolving these relative URLs. The normative - // algorithm used is defined by RFC 1808, "Relative Uniform Resource - // Locators". - // - // If not specified, the default value is "http://www.googleapis.com/" - string base_url = 4; - - // The API version of endpoint, e.g. "v1b3" - string dataflow_api_version = 5; - - // The settings to pass to the parallel worker harness. - WorkerSettings parallel_worker_settings = 6; - - // The location on the worker for task-specific subdirectories. - string base_task_dir = 7; - - // Whether to continue taskrunner if an exception is hit. - bool continue_on_exception = 8; - - // Whether to send taskrunner log info to Google Compute Engine VM serial - // console. - bool log_to_serialconsole = 9; - - // Whether to also send taskrunner log info to stderr. - bool alsologtostderr = 10; - - // Indicates where to put logs. If this is not specified, the logs - // will not be uploaded. - // - // The supported resource type is: - // - // Google Cloud Storage: - // storage.googleapis.com/{bucket}/{object} - // bucket.storage.googleapis.com/{object} - string log_upload_location = 11; - - // The directory on the VM to store logs. - string log_dir = 12; - - // The prefix of the resources the taskrunner should use for - // temporary storage. - // - // The supported resource type is: - // - // Google Cloud Storage: - // storage.googleapis.com/{bucket}/{object} - // bucket.storage.googleapis.com/{object} - string temp_storage_prefix = 13; - - // The command to launch the worker harness. - string harness_command = 14; - - // The file to store the workflow in. - string workflow_file_name = 15; - - // The file to store preprocessing commands in. - string commandlines_file_name = 16; - - // The ID string of the VM. - string vm_id = 17; - - // The suggested backend language. - string language_hint = 18; - - // The streaming worker main class name. - string streaming_worker_main_class = 19; -} - -// Specifies what happens to a resource when a Cloud Dataflow -// [google.dataflow.v1beta3.Job][google.dataflow.v1beta3.Job] has completed. -enum TeardownPolicy { - // The teardown policy isn't specified, or is unknown. - TEARDOWN_POLICY_UNKNOWN = 0; - - // Always teardown the resource. - TEARDOWN_ALWAYS = 1; - - // Teardown the resource on success. This is useful for debugging - // failures. - TEARDOWN_ON_SUCCESS = 2; - - // Never teardown the resource. This is useful for debugging and - // development. - TEARDOWN_NEVER = 3; -} - -// The default set of packages to be staged on a pool of workers. -enum DefaultPackageSet { - // The default set of packages to stage is unknown, or unspecified. - DEFAULT_PACKAGE_SET_UNKNOWN = 0; - - // Indicates that no packages should be staged at the worker unless - // explicitly specified by the job. - DEFAULT_PACKAGE_SET_NONE = 1; - - // Stage packages typically useful to workers written in Java. - DEFAULT_PACKAGE_SET_JAVA = 2; - - // Stage packages typically useful to workers written in Python. - DEFAULT_PACKAGE_SET_PYTHON = 3; -} - -// Specifies the algorithm used to determine the number of worker -// processes to run at any given point in time, based on the amount of -// data left to process, the number of workers, and how quickly -// existing workers are processing data. -enum AutoscalingAlgorithm { - // The algorithm is unknown, or unspecified. - AUTOSCALING_ALGORITHM_UNKNOWN = 0; - - // Disable autoscaling. - AUTOSCALING_ALGORITHM_NONE = 1; - - // Increase worker count over time to reduce job execution time. - AUTOSCALING_ALGORITHM_BASIC = 2; -} - -// Settings for WorkerPool autoscaling. -message AutoscalingSettings { - // The algorithm to use for autoscaling. - AutoscalingAlgorithm algorithm = 1; - - // The maximum number of workers to cap scaling at. - int32 max_num_workers = 2; -} - -// Specifies how IP addresses should be allocated to the worker machines. -enum WorkerIPAddressConfiguration { - // The configuration is unknown, or unspecified. - WORKER_IP_UNSPECIFIED = 0; - - // Workers should have public IP addresses. - WORKER_IP_PUBLIC = 1; - - // Workers should have private IP addresses. - WORKER_IP_PRIVATE = 2; -} - -// Defines a SDK harness container for executing Dataflow pipelines. -message SdkHarnessContainerImage { - // A docker container image that resides in Google Container Registry. - string container_image = 1; - - // If true, recommends the Dataflow service to use only one core per SDK - // container instance with this image. If false (or unset) recommends using - // more than one core per SDK container instance with this image for - // efficiency. Note that Dataflow service may choose to override this property - // if needed. - bool use_single_core_per_container = 2; - - // Environment ID for the Beam runner API proto Environment that corresponds - // to the current SDK Harness. - string environment_id = 3; - - // The set of capabilities enumerated in the above Environment proto. See also - // https://github.com/apache/beam/blob/master/model/pipeline/src/main/proto/beam_runner_api.proto - repeated string capabilities = 4; -} - -// Describes one particular pool of Cloud Dataflow workers to be -// instantiated by the Cloud Dataflow service in order to perform the -// computations required by a job. Note that a workflow job may use -// multiple pools, in order to match the various computational -// requirements of the various stages of the job. -message WorkerPool { - // The kind of the worker pool; currently only `harness` and `shuffle` - // are supported. - string kind = 1; - - // Number of Google Compute Engine workers in this pool needed to - // execute the job. If zero or unspecified, the service will - // attempt to choose a reasonable default. - int32 num_workers = 2; - - // Packages to be installed on workers. - repeated Package packages = 3; - - // The default package set to install. This allows the service to - // select a default set of packages which are useful to worker - // harnesses written in a particular language. - DefaultPackageSet default_package_set = 4; - - // Machine type (e.g. "n1-standard-1"). If empty or unspecified, the - // service will attempt to choose a reasonable default. - string machine_type = 5; - - // Sets the policy for determining when to turndown worker pool. - // Allowed values are: `TEARDOWN_ALWAYS`, `TEARDOWN_ON_SUCCESS`, and - // `TEARDOWN_NEVER`. - // `TEARDOWN_ALWAYS` means workers are always torn down regardless of whether - // the job succeeds. `TEARDOWN_ON_SUCCESS` means workers are torn down - // if the job succeeds. `TEARDOWN_NEVER` means the workers are never torn - // down. - // - // If the workers are not torn down by the service, they will - // continue to run and use Google Compute Engine VM resources in the - // user's project until they are explicitly terminated by the user. - // Because of this, Google recommends using the `TEARDOWN_ALWAYS` - // policy except for small, manually supervised test jobs. - // - // If unknown or unspecified, the service will attempt to choose a reasonable - // default. - TeardownPolicy teardown_policy = 6; - - // Size of root disk for VMs, in GB. If zero or unspecified, the service will - // attempt to choose a reasonable default. - int32 disk_size_gb = 7; - - // Type of root disk for VMs. If empty or unspecified, the service will - // attempt to choose a reasonable default. - string disk_type = 16; - - // Fully qualified source image for disks. - string disk_source_image = 8; - - // Zone to run the worker pools in. If empty or unspecified, the service - // will attempt to choose a reasonable default. - string zone = 9; - - // Settings passed through to Google Compute Engine workers when - // using the standard Dataflow task runner. Users should ignore - // this field. - TaskRunnerSettings taskrunner_settings = 10; - - // The action to take on host maintenance, as defined by the Google - // Compute Engine API. - string on_host_maintenance = 11; - - // Data disks that are used by a VM in this workflow. - repeated Disk data_disks = 12; - - // Metadata to set on the Google Compute Engine VMs. - map metadata = 13; - - // Settings for autoscaling of this WorkerPool. - AutoscalingSettings autoscaling_settings = 14; - - // Extra arguments for this worker pool. - google.protobuf.Any pool_args = 15; - - // Network to which VMs will be assigned. If empty or unspecified, - // the service will use the network "default". - string network = 17; - - // Subnetwork to which VMs will be assigned, if desired. Expected to be of - // the form "regions/REGION/subnetworks/SUBNETWORK". - string subnetwork = 19; - - // Required. Docker container image that executes the Cloud Dataflow worker - // harness, residing in Google Container Registry. - // - // Deprecated for the Fn API path. Use sdk_harness_container_images instead. - string worker_harness_container_image = 18; - - // The number of threads per worker harness. If empty or unspecified, the - // service will choose a number of threads (according to the number of cores - // on the selected machine type for batch, or 1 by convention for streaming). - int32 num_threads_per_worker = 20; - - // Configuration for VM IPs. - WorkerIPAddressConfiguration ip_configuration = 21; - - // Set of SDK harness containers needed to execute this pipeline. This will - // only be set in the Fn API path. For non-cross-language pipelines this - // should have only one entry. Cross-language pipelines will have two or more - // entries. - repeated SdkHarnessContainerImage sdk_harness_container_images = 22; -} - -// Specifies the shuffle mode used by a -// [google.dataflow.v1beta3.Job], which determines the approach data is shuffled -// during processing. More details in: -// https://cloud.google.com/dataflow/docs/guides/deploying-a-pipeline#dataflow-shuffle -enum ShuffleMode { - // Shuffle mode information is not available. - SHUFFLE_MODE_UNSPECIFIED = 0; - - // Shuffle is done on the worker VMs. - VM_BASED = 1; - - // Shuffle is done on the service side. - SERVICE_BASED = 2; -} - -// Describes any options that have an effect on the debugging of pipelines. -message DebugOptions { - // When true, enables the logging of the literal hot key to the user's Cloud - // Logging. - bool enable_hot_key_logging = 1; -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/jobs.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/jobs.proto deleted file mode 100644 index f961e1c3c2f..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/jobs.proto +++ /dev/null @@ -1,926 +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.dataflow.v1beta3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/dataflow/v1beta3/environment.proto"; -import "google/dataflow/v1beta3/snapshots.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; -option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; -option java_multiple_files = true; -option java_outer_classname = "JobsProto"; -option java_package = "com.google.dataflow.v1beta3"; -option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; -option ruby_package = "Google::Cloud::Dataflow::V1beta3"; - -// Provides a method to create and modify Google Cloud Dataflow jobs. -// A Job is a multi-stage computation graph run by the Cloud Dataflow service. -service JobsV1Beta3 { - option (google.api.default_host) = "dataflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/compute.readonly," - "https://www.googleapis.com/auth/userinfo.email"; - - // Creates a Cloud Dataflow job. - // - // To create a job, we recommend using `projects.locations.jobs.create` with a - // [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using - // `projects.jobs.create` is not recommended, as your job will always start - // in `us-central1`. - rpc CreateJob(CreateJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1b3/projects/{project_id}/locations/{location}/jobs" - body: "job" - additional_bindings { - post: "/v1b3/projects/{project_id}/jobs" - body: "job" - } - }; - } - - // Gets the state of the specified Cloud Dataflow job. - // - // To get the state of a job, we recommend using `projects.locations.jobs.get` - // with a [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using - // `projects.jobs.get` is not recommended, as you can only get the state of - // jobs that are running in `us-central1`. - rpc GetJob(GetJobRequest) returns (Job) { - option (google.api.http) = { - get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}" - additional_bindings { - get: "/v1b3/projects/{project_id}/jobs/{job_id}" - } - }; - } - - // Updates the state of an existing Cloud Dataflow job. - // - // To update the state of an existing job, we recommend using - // `projects.locations.jobs.update` with a [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using - // `projects.jobs.update` is not recommended, as you can only update the state - // of jobs that are running in `us-central1`. - rpc UpdateJob(UpdateJobRequest) returns (Job) { - option (google.api.http) = { - put: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}" - body: "job" - additional_bindings { - put: "/v1b3/projects/{project_id}/jobs/{job_id}" - body: "job" - } - }; - } - - // List the jobs of a project. - // - // To list the jobs of a project in a region, we recommend using - // `projects.locations.jobs.list` with a [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). To - // list the all jobs across all regions, use `projects.jobs.aggregated`. Using - // `projects.jobs.list` is not recommended, as you can only get the list of - // jobs that are running in `us-central1`. - rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { - option (google.api.http) = { - get: "/v1b3/projects/{project_id}/locations/{location}/jobs" - additional_bindings { - get: "/v1b3/projects/{project_id}/jobs" - } - }; - } - - // List the jobs of a project across all regions. - rpc AggregatedListJobs(ListJobsRequest) returns (ListJobsResponse) { - option (google.api.http) = { - get: "/v1b3/projects/{project_id}/jobs:aggregated" - }; - } - - // Check for existence of active jobs in the given project across all regions. - rpc CheckActiveJobs(CheckActiveJobsRequest) returns (CheckActiveJobsResponse) { - } - - // Snapshot the state of a streaming job. - rpc SnapshotJob(SnapshotJobRequest) returns (Snapshot) { - option (google.api.http) = { - post: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}:snapshot" - body: "*" - additional_bindings { - post: "/v1b3/projects/{project_id}/jobs/{job_id}:snapshot" - body: "*" - } - }; - } -} - -// Defines a job to be run by the Cloud Dataflow service. -message Job { - // The unique ID of this job. - // - // This field is set by the Cloud Dataflow service when the Job is - // created, and is immutable for the life of the job. - string id = 1; - - // The ID of the Cloud Platform project that the job belongs to. - string project_id = 2; - - // The user-specified Cloud Dataflow job name. - // - // Only one Job with a given name may exist in a project at any - // given time. If a caller attempts to create a Job with the same - // name as an already-existing Job, the attempt returns the - // existing Job. - // - // The name must match the regular expression - // `[a-z]([-a-z0-9]{0,1022}[a-z0-9])?` - string name = 3; - - // The type of Cloud Dataflow job. - JobType type = 4; - - // The environment for the job. - Environment environment = 5; - - // Exactly one of step or steps_location should be specified. - // - // The top-level steps that constitute the entire job. Only retrieved with - // JOB_VIEW_ALL. - repeated Step steps = 6; - - // The Cloud Storage location where the steps are stored. - string steps_location = 24; - - // The current state of the job. - // - // Jobs are created in the `JOB_STATE_STOPPED` state unless otherwise - // specified. - // - // A job in the `JOB_STATE_RUNNING` state may asynchronously enter a - // terminal state. After a job has reached a terminal state, no - // further state updates may be made. - // - // This field may be mutated by the Cloud Dataflow service; - // callers cannot mutate it. - JobState current_state = 7; - - // The timestamp associated with the current state. - google.protobuf.Timestamp current_state_time = 8; - - // The job's requested state. - // - // `UpdateJob` may be used to switch between the `JOB_STATE_STOPPED` and - // `JOB_STATE_RUNNING` states, by setting requested_state. `UpdateJob` may - // also be used to directly set a job's requested state to - // `JOB_STATE_CANCELLED` or `JOB_STATE_DONE`, irrevocably terminating the - // job if it has not already reached a terminal state. - JobState requested_state = 9; - - // Deprecated. - JobExecutionInfo execution_info = 10; - - // The timestamp when the job was initially created. Immutable and set by the - // Cloud Dataflow service. - google.protobuf.Timestamp create_time = 11; - - // If this job is an update of an existing job, this field is the job ID - // of the job it replaced. - // - // When sending a `CreateJobRequest`, you can update a job by specifying it - // here. The job named here is stopped, and its intermediate state is - // transferred to this job. - string replace_job_id = 12; - - // The map of transform name prefixes of the job to be replaced to the - // corresponding name prefixes of the new job. - map transform_name_mapping = 13; - - // The client's unique identifier of the job, re-used across retried attempts. - // If this field is set, the service will ensure its uniqueness. - // The request to create a job will fail if the service has knowledge of a - // previously submitted job with the same client's ID and job name. - // The caller may use this field to ensure idempotence of job - // creation across retried attempts to create a job. - // By default, the field is empty and, in that case, the service ignores it. - string client_request_id = 14; - - // If another job is an update of this job (and thus, this job is in - // `JOB_STATE_UPDATED`), this field contains the ID of that job. - string replaced_by_job_id = 15; - - // A set of files the system should be aware of that are used - // for temporary storage. These temporary files will be - // removed on job completion. - // No duplicates are allowed. - // No file patterns are supported. - // - // The supported files are: - // - // Google Cloud Storage: - // - // storage.googleapis.com/{bucket}/{object} - // bucket.storage.googleapis.com/{object} - repeated string temp_files = 16; - - // User-defined labels for this job. - // - // The labels map can contain no more than 64 entries. Entries of the labels - // map are UTF8 strings that comply with the following restrictions: - // - // * Keys must conform to regexp: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62} - // * Values must conform to regexp: [\p{Ll}\p{Lo}\p{N}_-]{0,63} - // * Both keys and values are additionally constrained to be <= 128 bytes in - // size. - map labels = 17; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - // contains this job. - string location = 18; - - // Preliminary field: The format of this data may change at any time. - // A description of the user pipeline and stages through which it is executed. - // Created by Cloud Dataflow service. Only retrieved with - // JOB_VIEW_DESCRIPTION or JOB_VIEW_ALL. - PipelineDescription pipeline_description = 19; - - // This field may be mutated by the Cloud Dataflow service; - // callers cannot mutate it. - repeated ExecutionStageState stage_states = 20; - - // This field is populated by the Dataflow service to support filtering jobs - // by the metadata values provided here. Populated for ListJobs and all GetJob - // views SUMMARY and higher. - JobMetadata job_metadata = 21; - - // The timestamp when the job was started (transitioned to JOB_STATE_PENDING). - // Flexible resource scheduling jobs are started with some delay after job - // creation, so start_time is unset before start and is updated when the - // job is started by the Cloud Dataflow service. For other jobs, start_time - // always equals to create_time and is immutable and set by the Cloud Dataflow - // service. - google.protobuf.Timestamp start_time = 22; - - // If this is specified, the job's initial state is populated from the given - // snapshot. - string created_from_snapshot_id = 23; - - // Reserved for future use. This field is set only in responses from the - // server; it is ignored if it is set in any requests. - bool satisfies_pzs = 25; -} - -// Metadata for a Datastore connector used by the job. -message DatastoreIODetails { - // Namespace used in the connection. - string namespace = 1; - - // ProjectId accessed in the connection. - string project_id = 2; -} - -// Metadata for a Pub/Sub connector used by the job. -message PubSubIODetails { - // Topic accessed in the connection. - string topic = 1; - - // Subscription used in the connection. - string subscription = 2; -} - -// Metadata for a File connector used by the job. -message FileIODetails { - // File Pattern used to access files by the connector. - string file_pattern = 1; -} - -// Metadata for a Cloud Bigtable connector used by the job. -message BigTableIODetails { - // ProjectId accessed in the connection. - string project_id = 1; - - // InstanceId accessed in the connection. - string instance_id = 2; - - // TableId accessed in the connection. - string table_id = 3; -} - -// Metadata for a BigQuery connector used by the job. -message BigQueryIODetails { - // Table accessed in the connection. - string table = 1; - - // Dataset accessed in the connection. - string dataset = 2; - - // Project accessed in the connection. - string project_id = 3; - - // Query used to access data in the connection. - string query = 4; -} - -// Metadata for a Spanner connector used by the job. -message SpannerIODetails { - // ProjectId accessed in the connection. - string project_id = 1; - - // InstanceId accessed in the connection. - string instance_id = 2; - - // DatabaseId accessed in the connection. - string database_id = 3; -} - -// The version of the SDK used to run the job. -message SdkVersion { - // The support status of the SDK used to run the job. - enum SdkSupportStatus { - // Cloud Dataflow is unaware of this version. - UNKNOWN = 0; - - // This is a known version of an SDK, and is supported. - SUPPORTED = 1; - - // A newer version of the SDK family exists, and an update is recommended. - STALE = 2; - - // This version of the SDK is deprecated and will eventually be - // unsupported. - DEPRECATED = 3; - - // Support for this SDK version has ended and it should no longer be used. - UNSUPPORTED = 4; - } - - // The version of the SDK used to run the job. - string version = 1; - - // A readable string describing the version of the SDK. - string version_display_name = 2; - - // The support status for this SDK version. - SdkSupportStatus sdk_support_status = 3; -} - -// Metadata available primarily for filtering jobs. Will be included in the -// ListJob response and Job SUMMARY view. -message JobMetadata { - // The SDK version used to run the job. - SdkVersion sdk_version = 1; - - // Identification of a Spanner source used in the Dataflow job. - repeated SpannerIODetails spanner_details = 2; - - // Identification of a BigQuery source used in the Dataflow job. - repeated BigQueryIODetails bigquery_details = 3; - - // Identification of a Cloud Bigtable source used in the Dataflow job. - repeated BigTableIODetails big_table_details = 4; - - // Identification of a Pub/Sub source used in the Dataflow job. - repeated PubSubIODetails pubsub_details = 5; - - // Identification of a File source used in the Dataflow job. - repeated FileIODetails file_details = 6; - - // Identification of a Datastore source used in the Dataflow job. - repeated DatastoreIODetails datastore_details = 7; -} - -// A message describing the state of a particular execution stage. -message ExecutionStageState { - // The name of the execution stage. - string execution_stage_name = 1; - - // Executions stage states allow the same set of values as JobState. - JobState execution_stage_state = 2; - - // The time at which the stage transitioned to this state. - google.protobuf.Timestamp current_state_time = 3; -} - -// A descriptive representation of submitted pipeline as well as the executed -// form. This data is provided by the Dataflow service for ease of visualizing -// the pipeline and interpreting Dataflow provided metrics. -message PipelineDescription { - // Description of each transform in the pipeline and collections between them. - repeated TransformSummary original_pipeline_transform = 1; - - // Description of each stage of execution of the pipeline. - repeated ExecutionStageSummary execution_pipeline_stage = 2; - - // Pipeline level display data. - repeated DisplayData display_data = 3; -} - -// Type of transform or stage operation. -enum KindType { - // Unrecognized transform type. - UNKNOWN_KIND = 0; - - // ParDo transform. - PAR_DO_KIND = 1; - - // Group By Key transform. - GROUP_BY_KEY_KIND = 2; - - // Flatten transform. - FLATTEN_KIND = 3; - - // Read transform. - READ_KIND = 4; - - // Write transform. - WRITE_KIND = 5; - - // Constructs from a constant value, such as with Create.of. - CONSTANT_KIND = 6; - - // Creates a Singleton view of a collection. - SINGLETON_KIND = 7; - - // Opening or closing a shuffle session, often as part of a GroupByKey. - SHUFFLE_KIND = 8; -} - -// Description of the type, names/ids, and input/outputs for a transform. -message TransformSummary { - // Type of transform. - KindType kind = 1; - - // SDK generated id of this transform instance. - string id = 2; - - // User provided name for this transform instance. - string name = 3; - - // Transform-specific display data. - repeated DisplayData display_data = 4; - - // User names for all collection outputs to this transform. - repeated string output_collection_name = 5; - - // User names for all collection inputs to this transform. - repeated string input_collection_name = 6; -} - -// Description of the composing transforms, names/ids, and input/outputs of a -// stage of execution. Some composing transforms and sources may have been -// generated by the Dataflow service during execution planning. -message ExecutionStageSummary { - // Description of an input or output of an execution stage. - message StageSource { - // Human-readable name for this source; may be user or system generated. - string user_name = 1; - - // Dataflow service generated name for this source. - string name = 2; - - // User name for the original user transform or collection with which this - // source is most closely associated. - string original_transform_or_collection = 3; - - // Size of the source, if measurable. - int64 size_bytes = 4; - } - - // Description of a transform executed as part of an execution stage. - message ComponentTransform { - // Human-readable name for this transform; may be user or system generated. - string user_name = 1; - - // Dataflow service generated name for this source. - string name = 2; - - // User name for the original user transform with which this transform is - // most closely associated. - string original_transform = 3; - } - - // Description of an interstitial value between transforms in an execution - // stage. - message ComponentSource { - // Human-readable name for this transform; may be user or system generated. - string user_name = 1; - - // Dataflow service generated name for this source. - string name = 2; - - // User name for the original user transform or collection with which this - // source is most closely associated. - string original_transform_or_collection = 3; - } - - // Dataflow service generated name for this stage. - string name = 1; - - // Dataflow service generated id for this stage. - string id = 2; - - // Type of transform this stage is executing. - KindType kind = 3; - - // Input sources for this stage. - repeated StageSource input_source = 4; - - // Output sources for this stage. - repeated StageSource output_source = 5; - - // Other stages that must complete before this stage can run. - repeated string prerequisite_stage = 8; - - // Transforms that comprise this execution stage. - repeated ComponentTransform component_transform = 6; - - // Collections produced and consumed by component transforms of this stage. - repeated ComponentSource component_source = 7; -} - -// Data provided with a pipeline or transform to provide descriptive info. -message DisplayData { - // The key identifying the display data. - // This is intended to be used as a label for the display data - // when viewed in a dax monitoring system. - string key = 1; - - // The namespace for the key. This is usually a class name or programming - // language namespace (i.e. python module) which defines the display data. - // This allows a dax monitoring system to specially handle the data - // and perform custom rendering. - string namespace = 2; - - // Various value types which can be used for display data. Only one will be - // set. - oneof Value { - // Contains value if the data is of string type. - string str_value = 4; - - // Contains value if the data is of int64 type. - int64 int64_value = 5; - - // Contains value if the data is of float type. - float float_value = 6; - - // Contains value if the data is of java class type. - string java_class_value = 7; - - // Contains value if the data is of timestamp type. - google.protobuf.Timestamp timestamp_value = 8; - - // Contains value if the data is of duration type. - google.protobuf.Duration duration_value = 9; - - // Contains value if the data is of a boolean type. - bool bool_value = 10; - } - - // A possible additional shorter value to display. - // For example a java_class_name_value of com.mypackage.MyDoFn - // will be stored with MyDoFn as the short_str_value and - // com.mypackage.MyDoFn as the java_class_name value. - // short_str_value can be displayed and java_class_name_value - // will be displayed as a tooltip. - string short_str_value = 11; - - // An optional full URL. - string url = 12; - - // An optional label to display in a dax UI for the element. - string label = 13; -} - -// Defines a particular step within a Cloud Dataflow job. -// -// A job consists of multiple steps, each of which performs some -// specific operation as part of the overall job. Data is typically -// passed from one step to another as part of the job. -// -// Here's an example of a sequence of steps which together implement a -// Map-Reduce job: -// -// * Read a collection of data from some source, parsing the -// collection's elements. -// -// * Validate the elements. -// -// * Apply a user-defined function to map each element to some value -// and extract an element-specific key value. -// -// * Group elements with the same key into a single element with -// that key, transforming a multiply-keyed collection into a -// uniquely-keyed collection. -// -// * Write the elements out to some data sink. -// -// Note that the Cloud Dataflow service may be used to run many different -// types of jobs, not just Map-Reduce. -message Step { - // The kind of step in the Cloud Dataflow job. - string kind = 1; - - // The name that identifies the step. This must be unique for each - // step with respect to all other steps in the Cloud Dataflow job. - string name = 2; - - // Named properties associated with the step. Each kind of - // predefined step has its own required set of properties. - // Must be provided on Create. Only retrieved with JOB_VIEW_ALL. - google.protobuf.Struct properties = 3; -} - -// Describes the overall state of a [google.dataflow.v1beta3.Job][google.dataflow.v1beta3.Job]. -enum JobState { - // The job's run state isn't specified. - JOB_STATE_UNKNOWN = 0; - - // `JOB_STATE_STOPPED` indicates that the job has not - // yet started to run. - JOB_STATE_STOPPED = 1; - - // `JOB_STATE_RUNNING` indicates that the job is currently running. - JOB_STATE_RUNNING = 2; - - // `JOB_STATE_DONE` indicates that the job has successfully completed. - // This is a terminal job state. This state may be set by the Cloud Dataflow - // service, as a transition from `JOB_STATE_RUNNING`. It may also be set via a - // Cloud Dataflow `UpdateJob` call, if the job has not yet reached a terminal - // state. - JOB_STATE_DONE = 3; - - // `JOB_STATE_FAILED` indicates that the job has failed. This is a - // terminal job state. This state may only be set by the Cloud Dataflow - // service, and only as a transition from `JOB_STATE_RUNNING`. - JOB_STATE_FAILED = 4; - - // `JOB_STATE_CANCELLED` indicates that the job has been explicitly - // cancelled. This is a terminal job state. This state may only be - // set via a Cloud Dataflow `UpdateJob` call, and only if the job has not - // yet reached another terminal state. - JOB_STATE_CANCELLED = 5; - - // `JOB_STATE_UPDATED` indicates that the job was successfully updated, - // meaning that this job was stopped and another job was started, inheriting - // state from this one. This is a terminal job state. This state may only be - // set by the Cloud Dataflow service, and only as a transition from - // `JOB_STATE_RUNNING`. - JOB_STATE_UPDATED = 6; - - // `JOB_STATE_DRAINING` indicates that the job is in the process of draining. - // A draining job has stopped pulling from its input sources and is processing - // any data that remains in-flight. This state may be set via a Cloud Dataflow - // `UpdateJob` call, but only as a transition from `JOB_STATE_RUNNING`. Jobs - // that are draining may only transition to `JOB_STATE_DRAINED`, - // `JOB_STATE_CANCELLED`, or `JOB_STATE_FAILED`. - JOB_STATE_DRAINING = 7; - - // `JOB_STATE_DRAINED` indicates that the job has been drained. - // A drained job terminated by stopping pulling from its input sources and - // processing any data that remained in-flight when draining was requested. - // This state is a terminal state, may only be set by the Cloud Dataflow - // service, and only as a transition from `JOB_STATE_DRAINING`. - JOB_STATE_DRAINED = 8; - - // `JOB_STATE_PENDING` indicates that the job has been created but is not yet - // running. Jobs that are pending may only transition to `JOB_STATE_RUNNING`, - // or `JOB_STATE_FAILED`. - JOB_STATE_PENDING = 9; - - // `JOB_STATE_CANCELLING` indicates that the job has been explicitly cancelled - // and is in the process of stopping. Jobs that are cancelling may only - // transition to `JOB_STATE_CANCELLED` or `JOB_STATE_FAILED`. - JOB_STATE_CANCELLING = 10; - - // `JOB_STATE_QUEUED` indicates that the job has been created but is being - // delayed until launch. Jobs that are queued may only transition to - // `JOB_STATE_PENDING` or `JOB_STATE_CANCELLED`. - JOB_STATE_QUEUED = 11; - - // `JOB_STATE_RESOURCE_CLEANING_UP` indicates that the batch job's associated - // resources are currently being cleaned up after a successful run. - // Currently, this is an opt-in feature, please reach out to Cloud support - // team if you are interested. - JOB_STATE_RESOURCE_CLEANING_UP = 12; -} - -// Additional information about how a Cloud Dataflow job will be executed that -// isn't contained in the submitted job. -message JobExecutionInfo { - // A mapping from each stage to the information about that stage. - map stages = 1; -} - -// Contains information about how a particular -// [google.dataflow.v1beta3.Step][google.dataflow.v1beta3.Step] will be executed. -message JobExecutionStageInfo { - // The steps associated with the execution stage. - // Note that stages may have several steps, and that a given step - // might be run by more than one stage. - repeated string step_name = 1; -} - -// Selector for how much information is returned in Job responses. -enum JobView { - // The job view to return isn't specified, or is unknown. - // Responses will contain at least the `JOB_VIEW_SUMMARY` information, - // and may contain additional information. - JOB_VIEW_UNKNOWN = 0; - - // Request summary information only: - // Project ID, Job ID, job name, job type, job status, start/end time, - // and Cloud SDK version details. - JOB_VIEW_SUMMARY = 1; - - // Request all information available for this job. - JOB_VIEW_ALL = 2; - - // Request summary info and limited job description data for steps, labels and - // environment. - JOB_VIEW_DESCRIPTION = 3; -} - -// Request to create a Cloud Dataflow job. -message CreateJobRequest { - // The ID of the Cloud Platform project that the job belongs to. - string project_id = 1; - - // The job to create. - Job job = 2; - - // The level of information requested in response. - JobView view = 3; - - // Deprecated. This field is now in the Job message. - string replace_job_id = 4; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - // contains this job. - string location = 5; -} - -// Request to get the state of a Cloud Dataflow job. -message GetJobRequest { - // The ID of the Cloud Platform project that the job belongs to. - string project_id = 1; - - // The job ID. - string job_id = 2; - - // The level of information requested in response. - JobView view = 3; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - // contains this job. - string location = 4; -} - -// Request to update a Cloud Dataflow job. -message UpdateJobRequest { - // The ID of the Cloud Platform project that the job belongs to. - string project_id = 1; - - // The job ID. - string job_id = 2; - - // The updated job. - // Only the job state is updatable; other fields will be ignored. - Job job = 3; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - // contains this job. - string location = 4; -} - -// Request to list Cloud Dataflow jobs. -message ListJobsRequest { - // This field filters out and returns jobs in the specified job state. The - // order of data returned is determined by the filter used, and is subject to - // change. - enum Filter { - // The filter isn't specified, or is unknown. This returns all jobs ordered - // on descending `JobUuid`. - UNKNOWN = 0; - - // Returns all running jobs first ordered on creation timestamp, then - // returns all terminated jobs ordered on the termination timestamp. - ALL = 1; - - // Filters the jobs that have a terminated state, ordered on the - // termination timestamp. Example terminated states: `JOB_STATE_STOPPED`, - // `JOB_STATE_UPDATED`, `JOB_STATE_DRAINED`, etc. - TERMINATED = 2; - - // Filters the jobs that are running ordered on the creation timestamp. - ACTIVE = 3; - } - - // The kind of filter to use. - Filter filter = 5; - - // The project which owns the jobs. - string project_id = 1; - - // Deprecated. ListJobs always returns summaries now. - // Use GetJob for other JobViews. - JobView view = 2 [deprecated = true]; - - // If there are many jobs, limit response to at most this many. - // The actual number of jobs returned will be the lesser of max_responses - // and an unspecified server-defined limit. - int32 page_size = 3; - - // Set this to the 'next_page_token' field of a previous response - // to request additional results in a long list. - string page_token = 4; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - // contains this job. - string location = 17; -} - -// Indicates which [regional endpoint] -// (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) failed -// to respond to a request for data. -message FailedLocation { - // The name of the [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - // failed to respond. - string name = 1; -} - -// Response to a request to list Cloud Dataflow jobs in a project. This might -// be a partial response, depending on the page size in the ListJobsRequest. -// However, if the project does not have any jobs, an instance of -// ListJobsResponse is not returned and the requests's response -// body is empty {}. -message ListJobsResponse { - // A subset of the requested job information. - repeated Job jobs = 1; - - // Set if there may be more results than fit in this response. - string next_page_token = 2; - - // Zero or more messages describing the [regional endpoints] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - // failed to respond. - repeated FailedLocation failed_location = 3; -} - -// Request to create a snapshot of a job. -message SnapshotJobRequest { - // The project which owns the job to be snapshotted. - string project_id = 1; - - // The job to be snapshotted. - string job_id = 2; - - // TTL for the snapshot. - google.protobuf.Duration ttl = 3; - - // The location that contains this job. - string location = 4; - - // If true, perform snapshots for sources which support this. - bool snapshot_sources = 5; - - // User specified description of the snapshot. Maybe empty. - string description = 6; -} - -// Request to check is active jobs exists for a project -message CheckActiveJobsRequest { - // The project which owns the jobs. - string project_id = 1; -} - -// Response for CheckActiveJobsRequest. -message CheckActiveJobsResponse { - // If True, active jobs exists for project. False otherwise. - bool active_jobs_exist = 1; -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/messages.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/messages.proto deleted file mode 100644 index 9fe098887f5..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/messages.proto +++ /dev/null @@ -1,238 +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.dataflow.v1beta3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; -option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; -option java_multiple_files = true; -option java_outer_classname = "MessagesProto"; -option java_package = "com.google.dataflow.v1beta3"; -option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; -option ruby_package = "Google::Cloud::Dataflow::V1beta3"; - -// The Dataflow Messages API is used for monitoring the progress of -// Dataflow jobs. -service MessagesV1Beta3 { - option (google.api.default_host) = "dataflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/compute.readonly," - "https://www.googleapis.com/auth/userinfo.email"; - - // Request the job status. - // - // To request the status of a job, we recommend using - // `projects.locations.jobs.messages.list` with a [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using - // `projects.jobs.messages.list` is not recommended, as you can only request - // the status of jobs that are running in `us-central1`. - rpc ListJobMessages(ListJobMessagesRequest) returns (ListJobMessagesResponse) { - option (google.api.http) = { - get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/messages" - additional_bindings { - get: "/v1b3/projects/{project_id}/jobs/{job_id}/messages" - } - }; - } -} - -// A particular message pertaining to a Dataflow job. -message JobMessage { - // Deprecated. - string id = 1; - - // The timestamp of the message. - google.protobuf.Timestamp time = 2; - - // The text of the message. - string message_text = 3; - - // Importance level of the message. - JobMessageImportance message_importance = 4; -} - -// Indicates the importance of the message. -enum JobMessageImportance { - // The message importance isn't specified, or is unknown. - JOB_MESSAGE_IMPORTANCE_UNKNOWN = 0; - - // The message is at the 'debug' level: typically only useful for - // software engineers working on the code the job is running. - // Typically, Dataflow pipeline runners do not display log messages - // at this level by default. - JOB_MESSAGE_DEBUG = 1; - - // The message is at the 'detailed' level: somewhat verbose, but - // potentially useful to users. Typically, Dataflow pipeline - // runners do not display log messages at this level by default. - // These messages are displayed by default in the Dataflow - // monitoring UI. - JOB_MESSAGE_DETAILED = 2; - - // The message is at the 'basic' level: useful for keeping - // track of the execution of a Dataflow pipeline. Typically, - // Dataflow pipeline runners display log messages at this level by - // default, and these messages are displayed by default in the - // Dataflow monitoring UI. - JOB_MESSAGE_BASIC = 5; - - // The message is at the 'warning' level: indicating a condition - // pertaining to a job which may require human intervention. - // Typically, Dataflow pipeline runners display log messages at this - // level by default, and these messages are displayed by default in - // the Dataflow monitoring UI. - JOB_MESSAGE_WARNING = 3; - - // The message is at the 'error' level: indicating a condition - // preventing a job from succeeding. Typically, Dataflow pipeline - // runners display log messages at this level by default, and these - // messages are displayed by default in the Dataflow monitoring UI. - JOB_MESSAGE_ERROR = 4; -} - -// A rich message format, including a human readable string, a key for -// identifying the message, and structured data associated with the message for -// programmatic consumption. -message StructuredMessage { - // Structured data associated with this message. - message Parameter { - // Key or name for this parameter. - string key = 1; - - // Value for this parameter. - google.protobuf.Value value = 2; - } - - // Human-readable version of message. - string message_text = 1; - - // Identifier for this message type. Used by external systems to - // internationalize or personalize message. - string message_key = 2; - - // The structured data associated with this message. - repeated Parameter parameters = 3; -} - -// A structured message reporting an autoscaling decision made by the Dataflow -// service. -message AutoscalingEvent { - // Indicates the type of autoscaling event. - enum AutoscalingEventType { - // Default type for the enum. Value should never be returned. - TYPE_UNKNOWN = 0; - - // The TARGET_NUM_WORKERS_CHANGED type should be used when the target - // worker pool size has changed at the start of an actuation. An event - // should always be specified as TARGET_NUM_WORKERS_CHANGED if it reflects - // a change in the target_num_workers. - TARGET_NUM_WORKERS_CHANGED = 1; - - // The CURRENT_NUM_WORKERS_CHANGED type should be used when actual worker - // pool size has been changed, but the target_num_workers has not changed. - CURRENT_NUM_WORKERS_CHANGED = 2; - - // The ACTUATION_FAILURE type should be used when we want to report - // an error to the user indicating why the current number of workers - // in the pool could not be changed. - // Displayed in the current status and history widgets. - ACTUATION_FAILURE = 3; - - // Used when we want to report to the user a reason why we are - // not currently adjusting the number of workers. - // Should specify both target_num_workers, current_num_workers and a - // decision_message. - NO_CHANGE = 4; - } - - // The current number of workers the job has. - int64 current_num_workers = 1; - - // The target number of workers the worker pool wants to resize to use. - int64 target_num_workers = 2; - - // The type of autoscaling event to report. - AutoscalingEventType event_type = 3; - - // A message describing why the system decided to adjust the current - // number of workers, why it failed, or why the system decided to - // not make any changes to the number of workers. - StructuredMessage description = 4; - - // The time this event was emitted to indicate a new target or current - // num_workers value. - google.protobuf.Timestamp time = 5; - - // A short and friendly name for the worker pool this event refers to. - string worker_pool = 7; -} - -// Request to list job messages. -// Up to max_results messages will be returned in the time range specified -// starting with the oldest messages first. If no time range is specified -// the results with start with the oldest message. -message ListJobMessagesRequest { - // A project id. - string project_id = 1; - - // The job to get messages about. - string job_id = 2; - - // Filter to only get messages with importance >= level - JobMessageImportance minimum_importance = 3; - - // If specified, determines the maximum number of messages to - // return. If unspecified, the service may choose an appropriate - // default, or may return an arbitrarily large number of results. - int32 page_size = 4; - - // If supplied, this should be the value of next_page_token returned - // by an earlier call. This will cause the next page of results to - // be returned. - string page_token = 5; - - // If specified, return only messages with timestamps >= start_time. - // The default is the job creation time (i.e. beginning of messages). - google.protobuf.Timestamp start_time = 6; - - // Return only messages with timestamps < end_time. The default is now - // (i.e. return up to the latest messages available). - google.protobuf.Timestamp end_time = 7; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - // contains the job specified by job_id. - string location = 8; -} - -// Response to a request to list job messages. -message ListJobMessagesResponse { - // Messages in ascending timestamp order. - repeated JobMessage job_messages = 1; - - // The token to obtain the next page of results if there are more. - string next_page_token = 2; - - // Autoscaling events in ascending timestamp order. - repeated AutoscalingEvent autoscaling_events = 3; -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/metrics.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/metrics.proto deleted file mode 100644 index 554af43fe3f..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/metrics.proto +++ /dev/null @@ -1,369 +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.dataflow.v1beta3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; -option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; -option java_multiple_files = true; -option java_outer_classname = "MetricsProto"; -option java_package = "com.google.dataflow.v1beta3"; -option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; -option ruby_package = "Google::Cloud::Dataflow::V1beta3"; - -// The Dataflow Metrics API lets you monitor the progress of Dataflow -// jobs. -service MetricsV1Beta3 { - option (google.api.default_host) = "dataflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/compute.readonly," - "https://www.googleapis.com/auth/userinfo.email"; - - // Request the job status. - // - // To request the status of a job, we recommend using - // `projects.locations.jobs.getMetrics` with a [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using - // `projects.jobs.getMetrics` is not recommended, as you can only request the - // status of jobs that are running in `us-central1`. - rpc GetJobMetrics(GetJobMetricsRequest) returns (JobMetrics) { - option (google.api.http) = { - get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/metrics" - additional_bindings { - get: "/v1b3/projects/{project_id}/jobs/{job_id}/metrics" - } - }; - } - - // Request detailed information about the execution status of the job. - // - // EXPERIMENTAL. This API is subject to change or removal without notice. - rpc GetJobExecutionDetails(GetJobExecutionDetailsRequest) returns (JobExecutionDetails) { - option (google.api.http) = { - get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/executionDetails" - }; - } - - // Request detailed information about the execution status of a stage of the - // job. - // - // EXPERIMENTAL. This API is subject to change or removal without notice. - rpc GetStageExecutionDetails(GetStageExecutionDetailsRequest) returns (StageExecutionDetails) { - option (google.api.http) = { - get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/stages/{stage_id}/executionDetails" - }; - } -} - -// Identifies a metric, by describing the source which generated the -// metric. -message MetricStructuredName { - // Origin (namespace) of metric name. May be blank for user-define metrics; - // will be "dataflow" for metrics defined by the Dataflow service or SDK. - string origin = 1; - - // Worker-defined metric name. - string name = 2; - - // Zero or more labeled fields which identify the part of the job this - // metric is associated with, such as the name of a step or collection. - // - // For example, built-in counters associated with steps will have - // context['step'] = . Counters associated with PCollections - // in the SDK will have context['pcollection'] = . - map context = 3; -} - -// Describes the state of a metric. -message MetricUpdate { - // Name of the metric. - MetricStructuredName name = 1; - - // Metric aggregation kind. The possible metric aggregation kinds are - // "Sum", "Max", "Min", "Mean", "Set", "And", "Or", and "Distribution". - // The specified aggregation kind is case-insensitive. - // - // If omitted, this is not an aggregated value but instead - // a single metric sample value. - string kind = 2; - - // True if this metric is reported as the total cumulative aggregate - // value accumulated since the worker started working on this WorkItem. - // By default this is false, indicating that this metric is reported - // as a delta that is not associated with any WorkItem. - bool cumulative = 3; - - // Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min", - // "And", and "Or". The possible value types are Long, Double, and Boolean. - google.protobuf.Value scalar = 4; - - // Worker-computed aggregate value for the "Mean" aggregation kind. - // This holds the sum of the aggregated values and is used in combination - // with mean_count below to obtain the actual mean aggregate value. - // The only possible value types are Long and Double. - google.protobuf.Value mean_sum = 5; - - // Worker-computed aggregate value for the "Mean" aggregation kind. - // This holds the count of the aggregated values and is used in combination - // with mean_sum above to obtain the actual mean aggregate value. - // The only possible value type is Long. - google.protobuf.Value mean_count = 6; - - // Worker-computed aggregate value for the "Set" aggregation kind. The only - // possible value type is a list of Values whose type can be Long, Double, - // or String, according to the metric's type. All Values in the list must - // be of the same type. - google.protobuf.Value set = 7; - - // A struct value describing properties of a distribution of numeric values. - google.protobuf.Value distribution = 11; - - // A struct value describing properties of a Gauge. - // Metrics of gauge type show the value of a metric across time, and is - // aggregated based on the newest value. - google.protobuf.Value gauge = 12; - - // Worker-computed aggregate value for internal use by the Dataflow - // service. - google.protobuf.Value internal = 8; - - // Timestamp associated with the metric value. Optional when workers are - // reporting work progress; it will be filled in responses from the - // metrics API. - google.protobuf.Timestamp update_time = 9; -} - -// Request to get job metrics. -message GetJobMetricsRequest { - // A project id. - string project_id = 1; - - // The job to get metrics for. - string job_id = 2; - - // Return only metric data that has changed since this time. - // Default is to return all information about all metrics for the job. - google.protobuf.Timestamp start_time = 3; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - // contains the job specified by job_id. - string location = 4; -} - -// JobMetrics contains a collection of metrics describing the detailed progress -// of a Dataflow job. Metrics correspond to user-defined and system-defined -// metrics in the job. -// -// This resource captures only the most recent values of each metric; -// time-series data can be queried for them (under the same metric names) -// from Cloud Monitoring. -message JobMetrics { - // Timestamp as of which metric values are current. - google.protobuf.Timestamp metric_time = 1; - - // All metrics for this job. - repeated MetricUpdate metrics = 2; -} - -// Request to get job execution details. -message GetJobExecutionDetailsRequest { - // A project id. - string project_id = 1; - - // The job to get execution details for. - string job_id = 2; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - // contains the job specified by job_id. - string location = 3; - - // If specified, determines the maximum number of stages to - // return. If unspecified, the service may choose an appropriate - // default, or may return an arbitrarily large number of results. - int32 page_size = 4; - - // If supplied, this should be the value of next_page_token returned - // by an earlier call. This will cause the next page of results to - // be returned. - string page_token = 5; -} - -// Information about the progress of some component of job execution. -message ProgressTimeseries { - // A point in the timeseries. - message Point { - // The timestamp of the point. - google.protobuf.Timestamp time = 1; - - // The value of the point. - double value = 2; - } - - // The current progress of the component, in the range [0,1]. - double current_progress = 1; - - // History of progress for the component. - // - // Points are sorted by time. - repeated Point data_points = 2; -} - -// The state of some component of job execution. -enum ExecutionState { - // The component state is unknown or unspecified. - EXECUTION_STATE_UNKNOWN = 0; - - // The component is not yet running. - EXECUTION_STATE_NOT_STARTED = 1; - - // The component is currently running. - EXECUTION_STATE_RUNNING = 2; - - // The component succeeded. - EXECUTION_STATE_SUCCEEDED = 3; - - // The component failed. - EXECUTION_STATE_FAILED = 4; - - // Execution of the component was cancelled. - EXECUTION_STATE_CANCELLED = 5; -} - -// Information about a particular execution stage of a job. -message StageSummary { - // ID of this stage - string stage_id = 1; - - // State of this stage. - ExecutionState state = 2; - - // Start time of this stage. - google.protobuf.Timestamp start_time = 3; - - // End time of this stage. - // - // If the work item is completed, this is the actual end time of the stage. - // Otherwise, it is the predicted end time. - google.protobuf.Timestamp end_time = 4; - - // Progress for this stage. - // Only applicable to Batch jobs. - ProgressTimeseries progress = 5; - - // Metrics for this stage. - repeated MetricUpdate metrics = 6; -} - -// Information about the execution of a job. -message JobExecutionDetails { - // The stages of the job execution. - repeated StageSummary stages = 1; - - // If present, this response does not contain all requested tasks. To obtain - // the next page of results, repeat the request with page_token set to this - // value. - string next_page_token = 2; -} - -// Request to get information about a particular execution stage of a job. -// Currently only tracked for Batch jobs. -message GetStageExecutionDetailsRequest { - // A project id. - string project_id = 1; - - // The job to get execution details for. - string job_id = 2; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - // contains the job specified by job_id. - string location = 3; - - // The stage for which to fetch information. - string stage_id = 4; - - // If specified, determines the maximum number of work items to - // return. If unspecified, the service may choose an appropriate - // default, or may return an arbitrarily large number of results. - int32 page_size = 5; - - // If supplied, this should be the value of next_page_token returned - // by an earlier call. This will cause the next page of results to - // be returned. - string page_token = 6; - - // Lower time bound of work items to include, by start time. - google.protobuf.Timestamp start_time = 7; - - // Upper time bound of work items to include, by start time. - google.protobuf.Timestamp end_time = 8; -} - -// Information about an individual work item execution. -message WorkItemDetails { - // Name of this work item. - string task_id = 1; - - // Attempt ID of this work item - string attempt_id = 2; - - // Start time of this work item attempt. - google.protobuf.Timestamp start_time = 3; - - // End time of this work item attempt. - // - // If the work item is completed, this is the actual end time of the work - // item. Otherwise, it is the predicted end time. - google.protobuf.Timestamp end_time = 4; - - // State of this work item. - ExecutionState state = 5; - - // Progress of this work item. - ProgressTimeseries progress = 6; - - // Metrics for this work item. - repeated MetricUpdate metrics = 7; -} - -// Information about a worker -message WorkerDetails { - // Name of this worker - string worker_name = 1; - - // Work items processed by this worker, sorted by time. - repeated WorkItemDetails work_items = 2; -} - -// Information about the workers and work items within a stage. -message StageExecutionDetails { - // Workers that have done work on the stage. - repeated WorkerDetails workers = 1; - - // If present, this response does not contain all requested tasks. To obtain - // the next page of results, repeat the request with page_token set to this - // value. - string next_page_token = 2; -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/snapshots.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/snapshots.proto deleted file mode 100644 index 5335fec664d..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/snapshots.proto +++ /dev/null @@ -1,188 +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.dataflow.v1beta3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; -option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; -option java_multiple_files = true; -option java_outer_classname = "SnapshotsProto"; -option java_package = "com.google.dataflow.v1beta3"; -option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; -option ruby_package = "Google::Cloud::Dataflow::V1beta3"; - -// Provides methods to manage snapshots of Google Cloud Dataflow jobs. -service SnapshotsV1Beta3 { - option (google.api.default_host) = "dataflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/compute.readonly," - "https://www.googleapis.com/auth/userinfo.email"; - - // Gets information about a snapshot. - rpc GetSnapshot(GetSnapshotRequest) returns (Snapshot) { - option (google.api.http) = { - get: "/v1b3/projects/{project_id}/locations/{location}/snapshots/{snapshot_id}" - additional_bindings { - get: "/v1b3/projects/{project_id}/snapshots/{snapshot_id}" - } - }; - } - - // Deletes a snapshot. - rpc DeleteSnapshot(DeleteSnapshotRequest) returns (DeleteSnapshotResponse) { - option (google.api.http) = { - delete: "/v1b3/projects/{project_id}/locations/{location}/snapshots/{snapshot_id}" - additional_bindings { - delete: "/v1b3/projects/{project_id}/snapshots" - } - }; - } - - // Lists snapshots. - rpc ListSnapshots(ListSnapshotsRequest) returns (ListSnapshotsResponse) { - option (google.api.http) = { - get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/snapshots" - additional_bindings { - get: "/v1b3/projects/{project_id}/locations/{location}/snapshots" - } - additional_bindings { - get: "/v1b3/projects/{project_id}/snapshots" - } - }; - } -} - -// Snapshot state. -enum SnapshotState { - // Unknown state. - UNKNOWN_SNAPSHOT_STATE = 0; - - // Snapshot intent to create has been persisted, snapshotting of state has not - // yet started. - PENDING = 1; - - // Snapshotting is being performed. - RUNNING = 2; - - // Snapshot has been created and is ready to be used. - READY = 3; - - // Snapshot failed to be created. - FAILED = 4; - - // Snapshot has been deleted. - DELETED = 5; -} - -// Represents a Pubsub snapshot. -message PubsubSnapshotMetadata { - // The name of the Pubsub topic. - string topic_name = 1; - - // The name of the Pubsub snapshot. - string snapshot_name = 2; - - // The expire time of the Pubsub snapshot. - google.protobuf.Timestamp expire_time = 3; -} - -// Represents a snapshot of a job. -message Snapshot { - // The unique ID of this snapshot. - string id = 1; - - // The project this snapshot belongs to. - string project_id = 2; - - // The job this snapshot was created from. - string source_job_id = 3; - - // The time this snapshot was created. - google.protobuf.Timestamp creation_time = 4; - - // The time after which this snapshot will be automatically deleted. - google.protobuf.Duration ttl = 5; - - // State of the snapshot. - SnapshotState state = 6; - - // Pub/Sub snapshot metadata. - repeated PubsubSnapshotMetadata pubsub_metadata = 7; - - // User specified description of the snapshot. Maybe empty. - string description = 8; - - // The disk byte size of the snapshot. Only available for snapshots in READY - // state. - int64 disk_size_bytes = 9; - - // Cloud region where this snapshot lives in, e.g., "us-central1". - string region = 10; -} - -// Request to get information about a snapshot -message GetSnapshotRequest { - // The ID of the Cloud Platform project that the snapshot belongs to. - string project_id = 1; - - // The ID of the snapshot. - string snapshot_id = 2; - - // The location that contains this snapshot. - string location = 3; -} - -// Request to delete a snapshot. -message DeleteSnapshotRequest { - // The ID of the Cloud Platform project that the snapshot belongs to. - string project_id = 1; - - // The ID of the snapshot. - string snapshot_id = 2; - - // The location that contains this snapshot. - string location = 3; -} - -// Response from deleting a snapshot. -message DeleteSnapshotResponse { - -} - -// Request to list snapshots. -message ListSnapshotsRequest { - // The project ID to list snapshots for. - string project_id = 1; - - // If specified, list snapshots created from this job. - string job_id = 3; - - // The location to list snapshots in. - string location = 2; -} - -// List of snapshots. -message ListSnapshotsResponse { - // Returned snapshots. - repeated Snapshot snapshots = 1; -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/streaming.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/streaming.proto deleted file mode 100644 index 17fb84a112f..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/streaming.proto +++ /dev/null @@ -1,231 +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.dataflow.v1beta3; - -option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; -option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; -option java_multiple_files = true; -option java_outer_classname = "StreamingProto"; -option java_package = "com.google.dataflow.v1beta3"; -option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; -option ruby_package = "Google::Cloud::Dataflow::V1beta3"; - -// Global topology of the streaming Dataflow job, including all -// computations and their sharded locations. -message TopologyConfig { - // The computations associated with a streaming Dataflow job. - repeated ComputationTopology computations = 1; - - // The disks assigned to a streaming Dataflow job. - repeated DataDiskAssignment data_disk_assignments = 2; - - // Maps user stage names to stable computation names. - map user_stage_to_computation_name_map = 3; - - // The size (in bits) of keys that will be assigned to source messages. - int32 forwarding_key_bits = 4; - - // Version number for persistent state. - int32 persistent_state_version = 5; -} - -// Identifies a pubsub location to use for transferring data into or -// out of a streaming Dataflow job. -message PubsubLocation { - // A pubsub topic, in the form of - // "pubsub.googleapis.com/topics//" - string topic = 1; - - // A pubsub subscription, in the form of - // "pubsub.googleapis.com/subscriptions//" - string subscription = 2; - - // If set, contains a pubsub label from which to extract record timestamps. - // If left empty, record timestamps will be generated upon arrival. - string timestamp_label = 3; - - // If set, contains a pubsub label from which to extract record ids. - // If left empty, record deduplication will be strictly best effort. - string id_label = 4; - - // Indicates whether the pipeline allows late-arriving data. - bool drop_late_data = 5; - - // If set, specifies the pubsub subscription that will be used for tracking - // custom time timestamps for watermark estimation. - string tracking_subscription = 6; - - // If true, then the client has requested to get pubsub attributes. - bool with_attributes = 7; -} - -// Identifies the location of a streaming computation stage, for -// stage-to-stage communication. -message StreamingStageLocation { - // Identifies the particular stream within the streaming Dataflow - // job. - string stream_id = 1; -} - -// Identifies the location of a streaming side input. -message StreamingSideInputLocation { - // Identifies the particular side input within the streaming Dataflow job. - string tag = 1; - - // Identifies the state family where this side input is stored. - string state_family = 2; -} - -// Identifies the location of a custom souce. -message CustomSourceLocation { - // Whether this source is stateful. - bool stateful = 1; -} - -// Describes a stream of data, either as input to be processed or as -// output of a streaming Dataflow job. -message StreamLocation { - // A specification of a stream's location. - oneof location { - // The stream is part of another computation within the current - // streaming Dataflow job. - StreamingStageLocation streaming_stage_location = 1; - - // The stream is a pubsub stream. - PubsubLocation pubsub_location = 2; - - // The stream is a streaming side input. - StreamingSideInputLocation side_input_location = 3; - - // The stream is a custom source. - CustomSourceLocation custom_source_location = 4; - } -} - -// State family configuration. -message StateFamilyConfig { - // The state family value. - string state_family = 1; - - // If true, this family corresponds to a read operation. - bool is_read = 2; -} - -// All configuration data for a particular Computation. -message ComputationTopology { - // The system stage name. - string system_stage_name = 1; - - // The ID of the computation. - string computation_id = 5; - - // The key ranges processed by the computation. - repeated KeyRangeLocation key_ranges = 2; - - // The inputs to the computation. - repeated StreamLocation inputs = 3; - - // The outputs from the computation. - repeated StreamLocation outputs = 4; - - // The state family values. - repeated StateFamilyConfig state_families = 7; -} - -// Location information for a specific key-range of a sharded computation. -// Currently we only support UTF-8 character splits to simplify encoding into -// JSON. -message KeyRangeLocation { - // The start (inclusive) of the key range. - string start = 1; - - // The end (exclusive) of the key range. - string end = 2; - - // The physical location of this range assignment to be used for - // streaming computation cross-worker message delivery. - string delivery_endpoint = 3; - - // The name of the data disk where data for this range is stored. - // This name is local to the Google Cloud Platform project and uniquely - // identifies the disk within that project, for example - // "myproject-1014-104817-4c2-harness-0-disk-1". - string data_disk = 5; - - // DEPRECATED. The location of the persistent state for this range, as a - // persistent directory in the worker local filesystem. - string deprecated_persistent_directory = 4 [deprecated = true]; -} - -// Describes mounted data disk. -message MountedDataDisk { - // The name of the data disk. - // This name is local to the Google Cloud Platform project and uniquely - // identifies the disk within that project, for example - // "myproject-1014-104817-4c2-harness-0-disk-1". - string data_disk = 1; -} - -// Data disk assignment for a given VM instance. -message DataDiskAssignment { - // VM instance name the data disks mounted to, for example - // "myproject-1014-104817-4c2-harness-0". - string vm_instance = 1; - - // Mounted data disks. The order is important a data disk's 0-based index in - // this list defines which persistent directory the disk is mounted to, for - // example the list of { "myproject-1014-104817-4c2-harness-0-disk-0" }, - // { "myproject-1014-104817-4c2-harness-0-disk-1" }. - repeated string data_disks = 2; -} - -// Data disk assignment information for a specific key-range of a sharded -// computation. -// Currently we only support UTF-8 character splits to simplify encoding into -// JSON. -message KeyRangeDataDiskAssignment { - // The start (inclusive) of the key range. - string start = 1; - - // The end (exclusive) of the key range. - string end = 2; - - // The name of the data disk where data for this range is stored. - // This name is local to the Google Cloud Platform project and uniquely - // identifies the disk within that project, for example - // "myproject-1014-104817-4c2-harness-0-disk-1". - string data_disk = 3; -} - -// Describes full or partial data disk assignment information of the computation -// ranges. -message StreamingComputationRanges { - // The ID of the computation. - string computation_id = 1; - - // Data disk assignments for ranges from this computation. - repeated KeyRangeDataDiskAssignment range_assignments = 2; -} - -// Streaming appliance snapshot configuration. -message StreamingApplianceSnapshotConfig { - // If set, indicates the snapshot id for the snapshot being performed. - string snapshot_id = 1; - - // Indicates which endpoint is used to import appliance state. - string import_state_endpoint = 2; -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/templates.proto b/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/templates.proto deleted file mode 100644 index 7de72626a5f..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/protos/google/dataflow/v1beta3/templates.proto +++ /dev/null @@ -1,632 +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.dataflow.v1beta3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/dataflow/v1beta3/environment.proto"; -import "google/dataflow/v1beta3/jobs.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; -option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; -option java_multiple_files = true; -option java_outer_classname = "TemplatesProto"; -option java_package = "com.google.dataflow.v1beta3"; -option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; -option ruby_package = "Google::Cloud::Dataflow::V1beta3"; - -// Provides a method to create Cloud Dataflow jobs from templates. -service TemplatesService { - option (google.api.default_host) = "dataflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/compute.readonly," - "https://www.googleapis.com/auth/userinfo.email"; - - // Creates a Cloud Dataflow job from a template. - rpc CreateJobFromTemplate(CreateJobFromTemplateRequest) returns (Job) { - option (google.api.http) = { - post: "/v1b3/projects/{project_id}/locations/{location}/templates" - body: "*" - additional_bindings { - post: "/v1b3/projects/{project_id}/templates" - body: "*" - } - }; - } - - // Launch a template. - rpc LaunchTemplate(LaunchTemplateRequest) returns (LaunchTemplateResponse) { - option (google.api.http) = { - post: "/v1b3/projects/{project_id}/locations/{location}/templates:launch" - body: "launch_parameters" - additional_bindings { - post: "/v1b3/projects/{project_id}/templates:launch" - body: "launch_parameters" - } - }; - } - - // Get the template associated with a template. - rpc GetTemplate(GetTemplateRequest) returns (GetTemplateResponse) { - option (google.api.http) = { - get: "/v1b3/projects/{project_id}/locations/{location}/templates:get" - additional_bindings { - get: "/v1b3/projects/{project_id}/templates:get" - } - }; - } -} - -// Provides a service for Flex templates. This feature is not ready yet. -service FlexTemplatesService { - option (google.api.default_host) = "dataflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/compute.readonly," - "https://www.googleapis.com/auth/userinfo.email"; - - // Launch a job with a FlexTemplate. - rpc LaunchFlexTemplate(LaunchFlexTemplateRequest) returns (LaunchFlexTemplateResponse) { - option (google.api.http) = { - post: "/v1b3/projects/{project_id}/locations/{location}/flexTemplates:launch" - body: "*" - }; - } -} - -// Response to the request to launch a job from Flex Template. -message LaunchFlexTemplateResponse { - // The job that was launched, if the request was not a dry run and - // the job was successfully launched. - Job job = 1; -} - -// Container Spec. -message ContainerSpec { - // Name of the docker container image. E.g., gcr.io/project/some-image - string image = 1; - - // Metadata describing a template including description and validation rules. - TemplateMetadata metadata = 2; - - // Required. SDK info of the Flex Template. - SDKInfo sdk_info = 3; - - // Default runtime environment for the job. - FlexTemplateRuntimeEnvironment default_environment = 4; -} - -// Launch FlexTemplate Parameter. -message LaunchFlexTemplateParameter { - // Required. The job name to use for the created job. For update job request, - // job name should be same as the existing running job. - string job_name = 1; - - // Launch Mechanism. - oneof template { - // Spec about the container image to launch. - ContainerSpec container_spec = 4; - - // Cloud Storage path to a file with json serialized ContainerSpec as - // content. - string container_spec_gcs_path = 5; - } - - // The parameters for FlexTemplate. - // Ex. {"num_workers":"5"} - map parameters = 2; - - // Launch options for this flex template job. This is a common set of options - // across languages and templates. This should not be used to pass job - // parameters. - map launch_options = 6; - - // The runtime environment for the FlexTemplate job - FlexTemplateRuntimeEnvironment environment = 7; - - // Set this to true if you are sending a request to update a running - // streaming job. When set, the job name should be the same as the - // running job. - bool update = 8; - - // Use this to pass transform_name_mappings for streaming update jobs. - // Ex:{"oldTransformName":"newTransformName",...}' - map transform_name_mappings = 9; -} - -// The environment values to be set at runtime for flex template. -message FlexTemplateRuntimeEnvironment { - // The initial number of Google Compute Engine instances for the job. - int32 num_workers = 1; - - // The maximum number of Google Compute Engine instances to be made - // available to your pipeline during execution, from 1 to 1000. - int32 max_workers = 2; - - // The Compute Engine [availability - // zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones) - // for launching worker instances to run your pipeline. - // In the future, worker_zone will take precedence. - string zone = 3; - - // The email address of the service account to run the job as. - string service_account_email = 4; - - // The Cloud Storage path to use for temporary files. - // Must be a valid Cloud Storage URL, beginning with `gs://`. - string temp_location = 5; - - // The machine type to use for the job. Defaults to the value from the - // template if not specified. - string machine_type = 6; - - // Additional experiment flags for the job. - repeated string additional_experiments = 7; - - // Network to which VMs will be assigned. If empty or unspecified, - // the service will use the network "default". - string network = 8; - - // Subnetwork to which VMs will be assigned, if desired. You can specify a - // subnetwork using either a complete URL or an abbreviated path. Expected to - // be of the form - // "https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/regions/REGION/subnetworks/SUBNETWORK" - // or "regions/REGION/subnetworks/SUBNETWORK". If the subnetwork is located in - // a Shared VPC network, you must use the complete URL. - string subnetwork = 9; - - // Additional user labels to be specified for the job. - // Keys and values must follow the restrictions specified in the [labeling - // restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions) - // page. - // An object containing a list of "key": value pairs. - // Example: { "name": "wrench", "mass": "1kg", "count": "3" }. - map additional_user_labels = 10; - - // Name for the Cloud KMS key for the job. - // Key format is: - // projects//locations//keyRings//cryptoKeys/ - string kms_key_name = 11; - - // Configuration for VM IPs. - WorkerIPAddressConfiguration ip_configuration = 12; - - // The Compute Engine region - // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in - // which worker processing should occur, e.g. "us-west1". Mutually exclusive - // with worker_zone. If neither worker_region nor worker_zone is specified, - // default to the control plane's region. - string worker_region = 13; - - // The Compute Engine zone - // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in - // which worker processing should occur, e.g. "us-west1-a". Mutually exclusive - // with worker_region. If neither worker_region nor worker_zone is specified, - // a zone in the control plane's region is chosen based on available capacity. - // If both `worker_zone` and `zone` are set, `worker_zone` takes precedence. - string worker_zone = 14; - - // Whether to enable Streaming Engine for the job. - bool enable_streaming_engine = 15; - - // Set FlexRS goal for the job. - // https://cloud.google.com/dataflow/docs/guides/flexrs - FlexResourceSchedulingGoal flexrs_goal = 16; - - // The Cloud Storage path for staging local files. - // Must be a valid Cloud Storage URL, beginning with `gs://`. - string staging_location = 17; - - // Docker registry location of container image to use for the 'worker harness. - // Default is the container for the version of the SDK. Note this field is - // only valid for portable pipelines. - string sdk_container_image = 18; - - // Worker disk size, in gigabytes. - int32 disk_size_gb = 20; - - // The algorithm to use for autoscaling - AutoscalingAlgorithm autoscaling_algorithm = 21; - - // If true, save a heap dump before killing a thread or process which is GC - // thrashing or out of memory. The location of the heap file will either be - // echoed back to the user, or the user will be given the opportunity to - // download the heap file. - bool dump_heap_on_oom = 22; - - // Cloud Storage bucket (directory) to upload heap dumps to the given - // location. Enabling this implies that heap dumps should be generated on OOM - // (dump_heap_on_oom is set to true). - string save_heap_dumps_to_gcs_path = 23; - - // The machine type to use for launching the job. The default is - // n1-standard-1. - string launcher_machine_type = 24; -} - -// A request to launch a Cloud Dataflow job from a FlexTemplate. -message LaunchFlexTemplateRequest { - // Required. The ID of the Cloud Platform project that the job belongs to. - string project_id = 1; - - // Required. Parameter to launch a job form Flex Template. - LaunchFlexTemplateParameter launch_parameter = 2; - - // Required. The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - // which to direct the request. E.g., us-central1, us-west1. - string location = 3; - - // If true, the request is validated but not actually executed. - // Defaults to false. - bool validate_only = 4; -} - -// The environment values to set at runtime. -message RuntimeEnvironment { - // The initial number of Google Compute Engine instnaces for the job. - int32 num_workers = 11; - - // The maximum number of Google Compute Engine instances to be made - // available to your pipeline during execution, from 1 to 1000. - int32 max_workers = 1; - - // The Compute Engine [availability - // zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones) - // for launching worker instances to run your pipeline. - // In the future, worker_zone will take precedence. - string zone = 2; - - // The email address of the service account to run the job as. - string service_account_email = 3; - - // The Cloud Storage path to use for temporary files. - // Must be a valid Cloud Storage URL, beginning with `gs://`. - string temp_location = 4; - - // Whether to bypass the safety checks for the job's temporary directory. - // Use with caution. - bool bypass_temp_dir_validation = 5; - - // The machine type to use for the job. Defaults to the value from the - // template if not specified. - string machine_type = 6; - - // Additional experiment flags for the job, specified with the - // `--experiments` option. - repeated string additional_experiments = 7; - - // Network to which VMs will be assigned. If empty or unspecified, - // the service will use the network "default". - string network = 8; - - // Subnetwork to which VMs will be assigned, if desired. You can specify a - // subnetwork using either a complete URL or an abbreviated path. Expected to - // be of the form - // "https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/regions/REGION/subnetworks/SUBNETWORK" - // or "regions/REGION/subnetworks/SUBNETWORK". If the subnetwork is located in - // a Shared VPC network, you must use the complete URL. - string subnetwork = 9; - - // Additional user labels to be specified for the job. - // Keys and values should follow the restrictions specified in the [labeling - // restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions) - // page. - // An object containing a list of "key": value pairs. - // Example: { "name": "wrench", "mass": "1kg", "count": "3" }. - map additional_user_labels = 10; - - // Name for the Cloud KMS key for the job. - // Key format is: - // projects//locations//keyRings//cryptoKeys/ - string kms_key_name = 12; - - // Configuration for VM IPs. - WorkerIPAddressConfiguration ip_configuration = 14; - - // The Compute Engine region - // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in - // which worker processing should occur, e.g. "us-west1". Mutually exclusive - // with worker_zone. If neither worker_region nor worker_zone is specified, - // default to the control plane's region. - string worker_region = 15; - - // The Compute Engine zone - // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in - // which worker processing should occur, e.g. "us-west1-a". Mutually exclusive - // with worker_region. If neither worker_region nor worker_zone is specified, - // a zone in the control plane's region is chosen based on available capacity. - // If both `worker_zone` and `zone` are set, `worker_zone` takes precedence. - string worker_zone = 16; - - // Whether to enable Streaming Engine for the job. - bool enable_streaming_engine = 17; -} - -// Metadata for a specific parameter. -message ParameterMetadata { - // Required. The name of the parameter. - string name = 1; - - // Required. The label to display for the parameter. - string label = 2; - - // Required. The help text to display for the parameter. - string help_text = 3; - - // Optional. Whether the parameter is optional. Defaults to false. - bool is_optional = 4; - - // Optional. Regexes that the parameter must match. - repeated string regexes = 5; - - // Optional. The type of the parameter. - // Used for selecting input picker. - ParameterType param_type = 6; - - // Optional. Additional metadata for describing this parameter. - map custom_metadata = 7; -} - -// ParameterType specifies what kind of input we need for this parameter. -enum ParameterType { - // Default input type. - DEFAULT = 0; - - // The parameter specifies generic text input. - TEXT = 1; - - // The parameter specifies a Cloud Storage Bucket to read from. - GCS_READ_BUCKET = 2; - - // The parameter specifies a Cloud Storage Bucket to write to. - GCS_WRITE_BUCKET = 3; - - // The parameter specifies a Cloud Storage file path to read from. - GCS_READ_FILE = 4; - - // The parameter specifies a Cloud Storage file path to write to. - GCS_WRITE_FILE = 5; - - // The parameter specifies a Cloud Storage folder path to read from. - GCS_READ_FOLDER = 6; - - // The parameter specifies a Cloud Storage folder to write to. - GCS_WRITE_FOLDER = 7; - - // The parameter specifies a Pub/Sub Topic. - PUBSUB_TOPIC = 8; - - // The parameter specifies a Pub/Sub Subscription. - PUBSUB_SUBSCRIPTION = 9; -} - -// Metadata describing a template. -message TemplateMetadata { - // Required. The name of the template. - string name = 1; - - // Optional. A description of the template. - string description = 2; - - // The parameters for the template. - repeated ParameterMetadata parameters = 3; -} - -// SDK Information. -message SDKInfo { - // SDK Language. - enum Language { - // UNKNOWN Language. - UNKNOWN = 0; - - // Java. - JAVA = 1; - - // Python. - PYTHON = 2; - } - - // Required. The SDK Language. - Language language = 1; - - // Optional. The SDK version. - string version = 2; -} - -// RuntimeMetadata describing a runtime environment. -message RuntimeMetadata { - // SDK Info for the template. - SDKInfo sdk_info = 1; - - // The parameters for the template. - repeated ParameterMetadata parameters = 2; -} - -// A request to create a Cloud Dataflow job from a template. -message CreateJobFromTemplateRequest { - // Required. The ID of the Cloud Platform project that the job belongs to. - string project_id = 1; - - // Required. The job name to use for the created job. - string job_name = 4; - - // The template from which to create the job. - oneof template { - // Required. A Cloud Storage path to the template from which to - // create the job. - // Must be a valid Cloud Storage URL, beginning with `gs://`. - string gcs_path = 2; - } - - // The runtime parameters to pass to the job. - map parameters = 3; - - // The runtime environment for the job. - RuntimeEnvironment environment = 5; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - // which to direct the request. - string location = 6; -} - -// A request to retrieve a Cloud Dataflow job template. -message GetTemplateRequest { - // The various views of a template that may be retrieved. - enum TemplateView { - // Template view that retrieves only the metadata associated with the - // template. - METADATA_ONLY = 0; - } - - // Required. The ID of the Cloud Platform project that the job belongs to. - string project_id = 1; - - // The template from which to create the job. - oneof template { - // Required. A Cloud Storage path to the template from which to - // create the job. - // Must be valid Cloud Storage URL, beginning with 'gs://'. - string gcs_path = 2; - } - - // The view to retrieve. Defaults to METADATA_ONLY. - TemplateView view = 3; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - // which to direct the request. - string location = 4; -} - -// The response to a GetTemplate request. -message GetTemplateResponse { - // Template Type. - enum TemplateType { - // Unknown Template Type. - UNKNOWN = 0; - - // Legacy Template. - LEGACY = 1; - - // Flex Template. - FLEX = 2; - } - - // The status of the get template request. Any problems with the - // request will be indicated in the error_details. - google.rpc.Status status = 1; - - // The template metadata describing the template name, available - // parameters, etc. - TemplateMetadata metadata = 2; - - // Template Type. - TemplateType template_type = 3; - - // Describes the runtime metadata with SDKInfo and available parameters. - RuntimeMetadata runtime_metadata = 4; -} - -// Parameters to provide to the template being launched. -message LaunchTemplateParameters { - // Required. The job name to use for the created job. - string job_name = 1; - - // The runtime parameters to pass to the job. - map parameters = 2; - - // The runtime environment for the job. - RuntimeEnvironment environment = 3; - - // If set, replace the existing pipeline with the name specified by jobName - // with this pipeline, preserving state. - bool update = 4; - - // Only applicable when updating a pipeline. Map of transform name prefixes of - // the job to be replaced to the corresponding name prefixes of the new job. - map transform_name_mapping = 5; -} - -// A request to launch a template. -message LaunchTemplateRequest { - // Required. The ID of the Cloud Platform project that the job belongs to. - string project_id = 1; - - // If true, the request is validated but not actually executed. - // Defaults to false. - bool validate_only = 2; - - // The template from which to create the job. - oneof template { - // A Cloud Storage path to the template from which to create - // the job. - // Must be valid Cloud Storage URL, beginning with 'gs://'. - string gcs_path = 3; - - // Params for launching a dynamic template. - DynamicTemplateLaunchParams dynamic_template = 6; - } - - // The parameters of the template to launch. This should be part of the - // body of the POST request. - LaunchTemplateParameters launch_parameters = 4; - - // The [regional endpoint] - // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - // which to direct the request. - string location = 5; -} - -// Response to the request to launch a template. -message LaunchTemplateResponse { - // The job that was launched, if the request was not a dry run and - // the job was successfully launched. - Job job = 1; -} - -// Used in the error_details field of a google.rpc.Status message, this -// indicates problems with the template parameter. -message InvalidTemplateParameters { - // A specific template-parameter violation. - message ParameterViolation { - // The parameter that failed to validate. - string parameter = 1; - - // A description of why the parameter failed to validate. - string description = 2; - } - - // Describes all parameter violations in a template request. - repeated ParameterViolation parameter_violations = 1; -} - -// Params which should be passed when launching a dynamic template. -message DynamicTemplateLaunchParams { - // Path to dynamic template spec file on Cloud Storage. - // The file must be a Json serialized DynamicTemplateFieSpec object. - string gcs_path = 1; - - // Cloud Storage path for staging dependencies. - // Must be a valid Cloud Storage URL, beginning with `gs://`. - string staging_location = 2; -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/flex_templates_service.launch_flex_template.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/flex_templates_service.launch_flex_template.js deleted file mode 100644 index fed91d36bfa..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/flex_templates_service.launch_flex_template.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() { - // [START dataflow_v1beta3_generated_FlexTemplatesService_LaunchFlexTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ID of the Cloud Platform project that the job belongs to. - */ - // const projectId = 'abc123' - /** - * Required. Parameter to launch a job form Flex Template. - */ - // const launchParameter = {} - /** - * Required. The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - * which to direct the request. E.g., us-central1, us-west1. - */ - // const location = 'abc123' - /** - * If true, the request is validated but not actually executed. - * Defaults to false. - */ - // const validateOnly = true - - // Imports the Dataflow library - const {FlexTemplatesServiceClient} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new FlexTemplatesServiceClient(); - - async function callLaunchFlexTemplate() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.launchFlexTemplate(request); - console.log(response); - } - - callLaunchFlexTemplate(); - // [END dataflow_v1beta3_generated_FlexTemplatesService_LaunchFlexTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.aggregated_list_jobs.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.aggregated_list_jobs.js deleted file mode 100644 index 65103553702..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.aggregated_list_jobs.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() { - // [START dataflow_v1beta3_generated_JobsV1Beta3_AggregatedListJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 kind of filter to use. - */ - // const filter = {} - /** - * The project which owns the jobs. - */ - // const projectId = 'abc123' - /** - * If there are many jobs, limit response to at most this many. - * The actual number of jobs returned will be the lesser of max_responses - * and an unspecified server-defined limit. - */ - // const pageSize = 1234 - /** - * Set this to the 'next_page_token' field of a previous response - * to request additional results in a long list. - */ - // const pageToken = 'abc123' - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new JobsV1Beta3Client(); - - async function callAggregatedListJobs() { - // Construct request - const request = { - }; - - // Run request - const iterable = await dataflowClient.aggregatedListJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callAggregatedListJobs(); - // [END dataflow_v1beta3_generated_JobsV1Beta3_AggregatedListJobs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.check_active_jobs.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.check_active_jobs.js deleted file mode 100644 index 70951894af7..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.check_active_jobs.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically 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 dataflow_v1beta3_generated_JobsV1Beta3_CheckActiveJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 which owns the jobs. - */ - // const projectId = 'abc123' - - // Imports the Dataflow library - const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new JobsV1Beta3Client(); - - async function callCheckActiveJobs() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.checkActiveJobs(request); - console.log(response); - } - - callCheckActiveJobs(); - // [END dataflow_v1beta3_generated_JobsV1Beta3_CheckActiveJobs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.create_job.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.create_job.js deleted file mode 100644 index 2387d386057..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.create_job.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() { - // [START dataflow_v1beta3_generated_JobsV1Beta3_CreateJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 ID of the Cloud Platform project that the job belongs to. - */ - // const projectId = 'abc123' - /** - * The job to create. - */ - // const job = {} - /** - * The level of information requested in response. - */ - // const view = {} - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new JobsV1Beta3Client(); - - async function callCreateJob() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.createJob(request); - console.log(response); - } - - callCreateJob(); - // [END dataflow_v1beta3_generated_JobsV1Beta3_CreateJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.get_job.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.get_job.js deleted file mode 100644 index 83346f10465..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.get_job.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() { - // [START dataflow_v1beta3_generated_JobsV1Beta3_GetJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 ID of the Cloud Platform project that the job belongs to. - */ - // const projectId = 'abc123' - /** - * The job ID. - */ - // const jobId = 'abc123' - /** - * The level of information requested in response. - */ - // const view = {} - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new JobsV1Beta3Client(); - - async function callGetJob() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.getJob(request); - console.log(response); - } - - callGetJob(); - // [END dataflow_v1beta3_generated_JobsV1Beta3_GetJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.list_jobs.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.list_jobs.js deleted file mode 100644 index aba7dec81c5..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.list_jobs.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() { - // [START dataflow_v1beta3_generated_JobsV1Beta3_ListJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 kind of filter to use. - */ - // const filter = {} - /** - * The project which owns the jobs. - */ - // const projectId = 'abc123' - /** - * If there are many jobs, limit response to at most this many. - * The actual number of jobs returned will be the lesser of max_responses - * and an unspecified server-defined limit. - */ - // const pageSize = 1234 - /** - * Set this to the 'next_page_token' field of a previous response - * to request additional results in a long list. - */ - // const pageToken = 'abc123' - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new JobsV1Beta3Client(); - - async function callListJobs() { - // Construct request - const request = { - }; - - // Run request - const iterable = await dataflowClient.listJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListJobs(); - // [END dataflow_v1beta3_generated_JobsV1Beta3_ListJobs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.snapshot_job.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.snapshot_job.js deleted file mode 100644 index 04cd91e603f..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.snapshot_job.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() { - // [START dataflow_v1beta3_generated_JobsV1Beta3_SnapshotJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 which owns the job to be snapshotted. - */ - // const projectId = 'abc123' - /** - * The job to be snapshotted. - */ - // const jobId = 'abc123' - /** - * TTL for the snapshot. - */ - // const ttl = {} - /** - * The location that contains this job. - */ - // const location = 'abc123' - /** - * If true, perform snapshots for sources which support this. - */ - // const snapshotSources = true - /** - * User specified description of the snapshot. Maybe empty. - */ - // const description = 'abc123' - - // Imports the Dataflow library - const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new JobsV1Beta3Client(); - - async function callSnapshotJob() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.snapshotJob(request); - console.log(response); - } - - callSnapshotJob(); - // [END dataflow_v1beta3_generated_JobsV1Beta3_SnapshotJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.update_job.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.update_job.js deleted file mode 100644 index 4c643f787bf..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/jobs_v1_beta3.update_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() { - // [START dataflow_v1beta3_generated_JobsV1Beta3_UpdateJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 ID of the Cloud Platform project that the job belongs to. - */ - // const projectId = 'abc123' - /** - * The job ID. - */ - // const jobId = 'abc123' - /** - * The updated job. - * Only the job state is updatable; other fields will be ignored. - */ - // const job = {} - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {JobsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new JobsV1Beta3Client(); - - async function callUpdateJob() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.updateJob(request); - console.log(response); - } - - callUpdateJob(); - // [END dataflow_v1beta3_generated_JobsV1Beta3_UpdateJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/messages_v1_beta3.list_job_messages.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/messages_v1_beta3.list_job_messages.js deleted file mode 100644 index 9b5a0b1a456..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/messages_v1_beta3.list_job_messages.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() { - // [START dataflow_v1beta3_generated_MessagesV1Beta3_ListJobMessages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 project id. - */ - // const projectId = 'abc123' - /** - * The job to get messages about. - */ - // const jobId = 'abc123' - /** - * Filter to only get messages with importance >= level - */ - // const minimumImportance = {} - /** - * If specified, determines the maximum number of messages to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - */ - // const pageSize = 1234 - /** - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * be returned. - */ - // const pageToken = 'abc123' - /** - * If specified, return only messages with timestamps >= start_time. - * The default is the job creation time (i.e. beginning of messages). - */ - // const startTime = {} - /** - * Return only messages with timestamps < end_time. The default is now - * (i.e. return up to the latest messages available). - */ - // const endTime = {} - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {MessagesV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new MessagesV1Beta3Client(); - - async function callListJobMessages() { - // Construct request - const request = { - }; - - // Run request - const iterable = await dataflowClient.listJobMessagesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListJobMessages(); - // [END dataflow_v1beta3_generated_MessagesV1Beta3_ListJobMessages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_execution_details.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_execution_details.js deleted file mode 100644 index 526f09466a8..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_execution_details.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 dataflow_v1beta3_generated_MetricsV1Beta3_GetJobExecutionDetails_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 project id. - */ - // const projectId = 'abc123' - /** - * The job to get execution details for. - */ - // const jobId = 'abc123' - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - */ - // const location = 'abc123' - /** - * If specified, determines the maximum number of stages to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - */ - // const pageSize = 1234 - /** - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * be returned. - */ - // const pageToken = 'abc123' - - // Imports the Dataflow library - const {MetricsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new MetricsV1Beta3Client(); - - async function callGetJobExecutionDetails() { - // Construct request - const request = { - }; - - // Run request - const iterable = await dataflowClient.getJobExecutionDetailsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGetJobExecutionDetails(); - // [END dataflow_v1beta3_generated_MetricsV1Beta3_GetJobExecutionDetails_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_metrics.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_metrics.js deleted file mode 100644 index f4537de7451..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_job_metrics.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() { - // [START dataflow_v1beta3_generated_MetricsV1Beta3_GetJobMetrics_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 project id. - */ - // const projectId = 'abc123' - /** - * The job to get metrics for. - */ - // const jobId = 'abc123' - /** - * Return only metric data that has changed since this time. - * Default is to return all information about all metrics for the job. - */ - // const startTime = {} - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {MetricsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new MetricsV1Beta3Client(); - - async function callGetJobMetrics() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.getJobMetrics(request); - console.log(response); - } - - callGetJobMetrics(); - // [END dataflow_v1beta3_generated_MetricsV1Beta3_GetJobMetrics_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_stage_execution_details.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_stage_execution_details.js deleted file mode 100644 index 3a9c51b444e..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/metrics_v1_beta3.get_stage_execution_details.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() { - // [START dataflow_v1beta3_generated_MetricsV1Beta3_GetStageExecutionDetails_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 project id. - */ - // const projectId = 'abc123' - /** - * The job to get execution details for. - */ - // const jobId = 'abc123' - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - */ - // const location = 'abc123' - /** - * The stage for which to fetch information. - */ - // const stageId = 'abc123' - /** - * If specified, determines the maximum number of work items to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - */ - // const pageSize = 1234 - /** - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * be returned. - */ - // const pageToken = 'abc123' - /** - * Lower time bound of work items to include, by start time. - */ - // const startTime = {} - /** - * Upper time bound of work items to include, by start time. - */ - // const endTime = {} - - // Imports the Dataflow library - const {MetricsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new MetricsV1Beta3Client(); - - async function callGetStageExecutionDetails() { - // Construct request - const request = { - }; - - // Run request - const iterable = await dataflowClient.getStageExecutionDetailsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGetStageExecutionDetails(); - // [END dataflow_v1beta3_generated_MetricsV1Beta3_GetStageExecutionDetails_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.delete_snapshot.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.delete_snapshot.js deleted file mode 100644 index 49a878f35cf..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.delete_snapshot.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() { - // [START dataflow_v1beta3_generated_SnapshotsV1Beta3_DeleteSnapshot_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 ID of the Cloud Platform project that the snapshot belongs to. - */ - // const projectId = 'abc123' - /** - * The ID of the snapshot. - */ - // const snapshotId = 'abc123' - /** - * The location that contains this snapshot. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {SnapshotsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new SnapshotsV1Beta3Client(); - - async function callDeleteSnapshot() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.deleteSnapshot(request); - console.log(response); - } - - callDeleteSnapshot(); - // [END dataflow_v1beta3_generated_SnapshotsV1Beta3_DeleteSnapshot_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.get_snapshot.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.get_snapshot.js deleted file mode 100644 index e03ed233c72..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.get_snapshot.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() { - // [START dataflow_v1beta3_generated_SnapshotsV1Beta3_GetSnapshot_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 ID of the Cloud Platform project that the snapshot belongs to. - */ - // const projectId = 'abc123' - /** - * The ID of the snapshot. - */ - // const snapshotId = 'abc123' - /** - * The location that contains this snapshot. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {SnapshotsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new SnapshotsV1Beta3Client(); - - async function callGetSnapshot() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.getSnapshot(request); - console.log(response); - } - - callGetSnapshot(); - // [END dataflow_v1beta3_generated_SnapshotsV1Beta3_GetSnapshot_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.list_snapshots.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.list_snapshots.js deleted file mode 100644 index dfb5c7e713c..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snapshots_v1_beta3.list_snapshots.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() { - // [START dataflow_v1beta3_generated_SnapshotsV1Beta3_ListSnapshots_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 ID to list snapshots for. - */ - // const projectId = 'abc123' - /** - * If specified, list snapshots created from this job. - */ - // const jobId = 'abc123' - /** - * The location to list snapshots in. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {SnapshotsV1Beta3Client} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new SnapshotsV1Beta3Client(); - - async function callListSnapshots() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.listSnapshots(request); - console.log(response); - } - - callListSnapshots(); - // [END dataflow_v1beta3_generated_SnapshotsV1Beta3_ListSnapshots_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snippet_metadata_google.dataflow.v1beta3.json b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snippet_metadata_google.dataflow.v1beta3.json deleted file mode 100644 index d6e58f58bcb..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/snippet_metadata_google.dataflow.v1beta3.json +++ /dev/null @@ -1,1007 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-dataflow", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.dataflow.v1beta3", - "version": "v1beta3" - } - ] - }, - "snippets": [ - { - "regionTag": "dataflow_v1beta3_generated_FlexTemplatesService_LaunchFlexTemplate_async", - "title": "FlexTemplatesService launchFlexTemplate Sample", - "origin": "API_DEFINITION", - "description": " Launch a job with a FlexTemplate.", - "canonical": true, - "file": "flex_templates_service.launch_flex_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "LaunchFlexTemplate", - "fullName": "google.dataflow.v1beta3.FlexTemplatesService.LaunchFlexTemplate", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "launch_parameter", - "type": ".google.dataflow.v1beta3.LaunchFlexTemplateParameter" - }, - { - "name": "location", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.dataflow.v1beta3.LaunchFlexTemplateResponse", - "client": { - "shortName": "FlexTemplatesServiceClient", - "fullName": "google.dataflow.v1beta3.FlexTemplatesServiceClient" - }, - "method": { - "shortName": "LaunchFlexTemplate", - "fullName": "google.dataflow.v1beta3.FlexTemplatesService.LaunchFlexTemplate", - "service": { - "shortName": "FlexTemplatesService", - "fullName": "google.dataflow.v1beta3.FlexTemplatesService" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_CreateJob_async", - "title": "FlexTemplatesService createJob Sample", - "origin": "API_DEFINITION", - "description": " Creates a Cloud Dataflow job. To create a job, we recommend using `projects.locations.jobs.create` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.create` is not recommended, as your job will always start in `us-central1`.", - "canonical": true, - "file": "jobs_v1_beta3.create_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateJob", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.CreateJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job", - "type": ".google.dataflow.v1beta3.Job" - }, - { - "name": "view", - "type": ".google.dataflow.v1beta3.JobView" - }, - { - "name": "replace_job_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.Job", - "client": { - "shortName": "JobsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" - }, - "method": { - "shortName": "CreateJob", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.CreateJob", - "service": { - "shortName": "JobsV1Beta3", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_GetJob_async", - "title": "FlexTemplatesService getJob Sample", - "origin": "API_DEFINITION", - "description": " Gets the state of the specified Cloud Dataflow job. To get the state of a job, we recommend using `projects.locations.jobs.get` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.get` is not recommended, as you can only get the state of jobs that are running in `us-central1`.", - "canonical": true, - "file": "jobs_v1_beta3.get_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJob", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.GetJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.dataflow.v1beta3.JobView" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.Job", - "client": { - "shortName": "JobsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" - }, - "method": { - "shortName": "GetJob", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.GetJob", - "service": { - "shortName": "JobsV1Beta3", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_UpdateJob_async", - "title": "FlexTemplatesService updateJob Sample", - "origin": "API_DEFINITION", - "description": " Updates the state of an existing Cloud Dataflow job. To update the state of an existing job, we recommend using `projects.locations.jobs.update` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.update` is not recommended, as you can only update the state of jobs that are running in `us-central1`.", - "canonical": true, - "file": "jobs_v1_beta3.update_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateJob", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.UpdateJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "job", - "type": ".google.dataflow.v1beta3.Job" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.Job", - "client": { - "shortName": "JobsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" - }, - "method": { - "shortName": "UpdateJob", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.UpdateJob", - "service": { - "shortName": "JobsV1Beta3", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_ListJobs_async", - "title": "FlexTemplatesService listJobs Sample", - "origin": "API_DEFINITION", - "description": " List the jobs of a project. To list the jobs of a project in a region, we recommend using `projects.locations.jobs.list` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). To list the all jobs across all regions, use `projects.jobs.aggregated`. Using `projects.jobs.list` is not recommended, as you can only get the list of jobs that are running in `us-central1`.", - "canonical": true, - "file": "jobs_v1_beta3.list_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListJobs", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.ListJobs", - "async": true, - "parameters": [ - { - "name": "filter", - "type": ".google.dataflow.v1beta3.ListJobsRequest.Filter" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.dataflow.v1beta3.JobView" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.ListJobsResponse", - "client": { - "shortName": "JobsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" - }, - "method": { - "shortName": "ListJobs", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.ListJobs", - "service": { - "shortName": "JobsV1Beta3", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_AggregatedListJobs_async", - "title": "FlexTemplatesService aggregatedListJobs Sample", - "origin": "API_DEFINITION", - "description": " List the jobs of a project across all regions.", - "canonical": true, - "file": "jobs_v1_beta3.aggregated_list_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AggregatedListJobs", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.AggregatedListJobs", - "async": true, - "parameters": [ - { - "name": "filter", - "type": ".google.dataflow.v1beta3.ListJobsRequest.Filter" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.dataflow.v1beta3.JobView" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.ListJobsResponse", - "client": { - "shortName": "JobsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" - }, - "method": { - "shortName": "AggregatedListJobs", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.AggregatedListJobs", - "service": { - "shortName": "JobsV1Beta3", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_CheckActiveJobs_async", - "title": "FlexTemplatesService checkActiveJobs Sample", - "origin": "API_DEFINITION", - "description": " Check for existence of active jobs in the given project across all regions.", - "canonical": true, - "file": "jobs_v1_beta3.check_active_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CheckActiveJobs", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.CheckActiveJobs", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.CheckActiveJobsResponse", - "client": { - "shortName": "JobsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" - }, - "method": { - "shortName": "CheckActiveJobs", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.CheckActiveJobs", - "service": { - "shortName": "JobsV1Beta3", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_JobsV1Beta3_SnapshotJob_async", - "title": "FlexTemplatesService snapshotJob Sample", - "origin": "API_DEFINITION", - "description": " Snapshot the state of a streaming job.", - "canonical": true, - "file": "jobs_v1_beta3.snapshot_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SnapshotJob", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.SnapshotJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "ttl", - "type": ".google.protobuf.Duration" - }, - { - "name": "location", - "type": "TYPE_STRING" - }, - { - "name": "snapshot_sources", - "type": "TYPE_BOOL" - }, - { - "name": "description", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.Snapshot", - "client": { - "shortName": "JobsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3Client" - }, - "method": { - "shortName": "SnapshotJob", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3.SnapshotJob", - "service": { - "shortName": "JobsV1Beta3", - "fullName": "google.dataflow.v1beta3.JobsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_MessagesV1Beta3_ListJobMessages_async", - "title": "FlexTemplatesService listJobMessages Sample", - "origin": "API_DEFINITION", - "description": " Request the job status. To request the status of a job, we recommend using `projects.locations.jobs.messages.list` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.messages.list` is not recommended, as you can only request the status of jobs that are running in `us-central1`.", - "canonical": true, - "file": "messages_v1_beta3.list_job_messages.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 90, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListJobMessages", - "fullName": "google.dataflow.v1beta3.MessagesV1Beta3.ListJobMessages", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "minimum_importance", - "type": ".google.dataflow.v1beta3.JobMessageImportance" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "end_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.ListJobMessagesResponse", - "client": { - "shortName": "MessagesV1Beta3Client", - "fullName": "google.dataflow.v1beta3.MessagesV1Beta3Client" - }, - "method": { - "shortName": "ListJobMessages", - "fullName": "google.dataflow.v1beta3.MessagesV1Beta3.ListJobMessages", - "service": { - "shortName": "MessagesV1Beta3", - "fullName": "google.dataflow.v1beta3.MessagesV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_MetricsV1Beta3_GetJobMetrics_async", - "title": "FlexTemplatesService getJobMetrics Sample", - "origin": "API_DEFINITION", - "description": " Request the job status. To request the status of a job, we recommend using `projects.locations.jobs.getMetrics` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.getMetrics` is not recommended, as you can only request the status of jobs that are running in `us-central1`.", - "canonical": true, - "file": "metrics_v1_beta3.get_job_metrics.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJobMetrics", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetJobMetrics", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.JobMetrics", - "client": { - "shortName": "MetricsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3Client" - }, - "method": { - "shortName": "GetJobMetrics", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetJobMetrics", - "service": { - "shortName": "MetricsV1Beta3", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_MetricsV1Beta3_GetJobExecutionDetails_async", - "title": "FlexTemplatesService getJobExecutionDetails Sample", - "origin": "API_DEFINITION", - "description": " Request detailed information about the execution status of the job. EXPERIMENTAL. This API is subject to change or removal without notice.", - "canonical": true, - "file": "metrics_v1_beta3.get_job_execution_details.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJobExecutionDetails", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetJobExecutionDetails", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.JobExecutionDetails", - "client": { - "shortName": "MetricsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3Client" - }, - "method": { - "shortName": "GetJobExecutionDetails", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetJobExecutionDetails", - "service": { - "shortName": "MetricsV1Beta3", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_MetricsV1Beta3_GetStageExecutionDetails_async", - "title": "FlexTemplatesService getStageExecutionDetails Sample", - "origin": "API_DEFINITION", - "description": " Request detailed information about the execution status of a stage of the job. EXPERIMENTAL. This API is subject to change or removal without notice.", - "canonical": true, - "file": "metrics_v1_beta3.get_stage_execution_details.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 88, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetStageExecutionDetails", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetStageExecutionDetails", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - }, - { - "name": "stage_id", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "end_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.dataflow.v1beta3.StageExecutionDetails", - "client": { - "shortName": "MetricsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3Client" - }, - "method": { - "shortName": "GetStageExecutionDetails", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3.GetStageExecutionDetails", - "service": { - "shortName": "MetricsV1Beta3", - "fullName": "google.dataflow.v1beta3.MetricsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_SnapshotsV1Beta3_GetSnapshot_async", - "title": "FlexTemplatesService getSnapshot Sample", - "origin": "API_DEFINITION", - "description": " Gets information about a snapshot.", - "canonical": true, - "file": "snapshots_v1_beta3.get_snapshot.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSnapshot", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.GetSnapshot", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "snapshot_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.Snapshot", - "client": { - "shortName": "SnapshotsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3Client" - }, - "method": { - "shortName": "GetSnapshot", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.GetSnapshot", - "service": { - "shortName": "SnapshotsV1Beta3", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_SnapshotsV1Beta3_DeleteSnapshot_async", - "title": "FlexTemplatesService deleteSnapshot Sample", - "origin": "API_DEFINITION", - "description": " Deletes a snapshot.", - "canonical": true, - "file": "snapshots_v1_beta3.delete_snapshot.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSnapshot", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.DeleteSnapshot", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "snapshot_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.DeleteSnapshotResponse", - "client": { - "shortName": "SnapshotsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3Client" - }, - "method": { - "shortName": "DeleteSnapshot", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.DeleteSnapshot", - "service": { - "shortName": "SnapshotsV1Beta3", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_SnapshotsV1Beta3_ListSnapshots_async", - "title": "FlexTemplatesService listSnapshots Sample", - "origin": "API_DEFINITION", - "description": " Lists snapshots.", - "canonical": true, - "file": "snapshots_v1_beta3.list_snapshots.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSnapshots", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.ListSnapshots", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.ListSnapshotsResponse", - "client": { - "shortName": "SnapshotsV1Beta3Client", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3Client" - }, - "method": { - "shortName": "ListSnapshots", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3.ListSnapshots", - "service": { - "shortName": "SnapshotsV1Beta3", - "fullName": "google.dataflow.v1beta3.SnapshotsV1Beta3" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_TemplatesService_CreateJobFromTemplate_async", - "title": "FlexTemplatesService createJobFromTemplate Sample", - "origin": "API_DEFINITION", - "description": " Creates a Cloud Dataflow job from a template.", - "canonical": true, - "file": "templates_service.create_job_from_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateJobFromTemplate", - "fullName": "google.dataflow.v1beta3.TemplatesService.CreateJobFromTemplate", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_name", - "type": "TYPE_STRING" - }, - { - "name": "gcs_path", - "type": "TYPE_STRING" - }, - { - "name": "parameters", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "environment", - "type": ".google.dataflow.v1beta3.RuntimeEnvironment" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.Job", - "client": { - "shortName": "TemplatesServiceClient", - "fullName": "google.dataflow.v1beta3.TemplatesServiceClient" - }, - "method": { - "shortName": "CreateJobFromTemplate", - "fullName": "google.dataflow.v1beta3.TemplatesService.CreateJobFromTemplate", - "service": { - "shortName": "TemplatesService", - "fullName": "google.dataflow.v1beta3.TemplatesService" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_TemplatesService_LaunchTemplate_async", - "title": "FlexTemplatesService launchTemplate Sample", - "origin": "API_DEFINITION", - "description": " Launch a template.", - "canonical": true, - "file": "templates_service.launch_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "LaunchTemplate", - "fullName": "google.dataflow.v1beta3.TemplatesService.LaunchTemplate", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "gcs_path", - "type": "TYPE_STRING" - }, - { - "name": "dynamic_template", - "type": ".google.dataflow.v1beta3.DynamicTemplateLaunchParams" - }, - { - "name": "launch_parameters", - "type": ".google.dataflow.v1beta3.LaunchTemplateParameters" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.LaunchTemplateResponse", - "client": { - "shortName": "TemplatesServiceClient", - "fullName": "google.dataflow.v1beta3.TemplatesServiceClient" - }, - "method": { - "shortName": "LaunchTemplate", - "fullName": "google.dataflow.v1beta3.TemplatesService.LaunchTemplate", - "service": { - "shortName": "TemplatesService", - "fullName": "google.dataflow.v1beta3.TemplatesService" - } - } - } - }, - { - "regionTag": "dataflow_v1beta3_generated_TemplatesService_GetTemplate_async", - "title": "FlexTemplatesService getTemplate Sample", - "origin": "API_DEFINITION", - "description": " Get the template associated with a template.", - "canonical": true, - "file": "templates_service.get_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTemplate", - "fullName": "google.dataflow.v1beta3.TemplatesService.GetTemplate", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "gcs_path", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.dataflow.v1beta3.GetTemplateRequest.TemplateView" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.dataflow.v1beta3.GetTemplateResponse", - "client": { - "shortName": "TemplatesServiceClient", - "fullName": "google.dataflow.v1beta3.TemplatesServiceClient" - }, - "method": { - "shortName": "GetTemplate", - "fullName": "google.dataflow.v1beta3.TemplatesService.GetTemplate", - "service": { - "shortName": "TemplatesService", - "fullName": "google.dataflow.v1beta3.TemplatesService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.create_job_from_template.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.create_job_from_template.js deleted file mode 100644 index 293db4e752f..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.create_job_from_template.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 dataflow_v1beta3_generated_TemplatesService_CreateJobFromTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ID of the Cloud Platform project that the job belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The job name to use for the created job. - */ - // const jobName = 'abc123' - /** - * Required. A Cloud Storage path to the template from which to - * create the job. - * Must be a valid Cloud Storage URL, beginning with `gs://`. - */ - // const gcsPath = 'abc123' - /** - * The runtime parameters to pass to the job. - */ - // const parameters = [1,2,3,4] - /** - * The runtime environment for the job. - */ - // const environment = {} - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - * which to direct the request. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {TemplatesServiceClient} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new TemplatesServiceClient(); - - async function callCreateJobFromTemplate() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.createJobFromTemplate(request); - console.log(response); - } - - callCreateJobFromTemplate(); - // [END dataflow_v1beta3_generated_TemplatesService_CreateJobFromTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.get_template.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.get_template.js deleted file mode 100644 index f282ccd18cb..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.get_template.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() { - // [START dataflow_v1beta3_generated_TemplatesService_GetTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ID of the Cloud Platform project that the job belongs to. - */ - // const projectId = 'abc123' - /** - * Required. A Cloud Storage path to the template from which to - * create the job. - * Must be valid Cloud Storage URL, beginning with 'gs://'. - */ - // const gcsPath = 'abc123' - /** - * The view to retrieve. Defaults to METADATA_ONLY. - */ - // const view = {} - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - * which to direct the request. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {TemplatesServiceClient} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new TemplatesServiceClient(); - - async function callGetTemplate() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.getTemplate(request); - console.log(response); - } - - callGetTemplate(); - // [END dataflow_v1beta3_generated_TemplatesService_GetTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.launch_template.js b/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.launch_template.js deleted file mode 100644 index 5b246afee5a..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/samples/generated/v1beta3/templates_service.launch_template.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() { - // [START dataflow_v1beta3_generated_TemplatesService_LaunchTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ID of the Cloud Platform project that the job belongs to. - */ - // const projectId = 'abc123' - /** - * If true, the request is validated but not actually executed. - * Defaults to false. - */ - // const validateOnly = true - /** - * A Cloud Storage path to the template from which to create - * the job. - * Must be valid Cloud Storage URL, beginning with 'gs://'. - */ - // const gcsPath = 'abc123' - /** - * Params for launching a dynamic template. - */ - // const dynamicTemplate = {} - /** - * The parameters of the template to launch. This should be part of the - * body of the POST request. - */ - // const launchParameters = {} - /** - * The regional endpoint - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - * which to direct the request. - */ - // const location = 'abc123' - - // Imports the Dataflow library - const {TemplatesServiceClient} = require('@google-cloud/dataflow').v1beta3; - - // Instantiates a client - const dataflowClient = new TemplatesServiceClient(); - - async function callLaunchTemplate() { - // Construct request - const request = { - }; - - // Run request - const response = await dataflowClient.launchTemplate(request); - console.log(response); - } - - callLaunchTemplate(); - // [END dataflow_v1beta3_generated_TemplatesService_LaunchTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/index.ts b/owl-bot-staging/google-dataflow/v1beta3/src/index.ts deleted file mode 100644 index 1c1ba5827e3..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/index.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 v1beta3 from './v1beta3'; -const FlexTemplatesServiceClient = v1beta3.FlexTemplatesServiceClient; -type FlexTemplatesServiceClient = v1beta3.FlexTemplatesServiceClient; -const JobsV1Beta3Client = v1beta3.JobsV1Beta3Client; -type JobsV1Beta3Client = v1beta3.JobsV1Beta3Client; -const MessagesV1Beta3Client = v1beta3.MessagesV1Beta3Client; -type MessagesV1Beta3Client = v1beta3.MessagesV1Beta3Client; -const MetricsV1Beta3Client = v1beta3.MetricsV1Beta3Client; -type MetricsV1Beta3Client = v1beta3.MetricsV1Beta3Client; -const SnapshotsV1Beta3Client = v1beta3.SnapshotsV1Beta3Client; -type SnapshotsV1Beta3Client = v1beta3.SnapshotsV1Beta3Client; -const TemplatesServiceClient = v1beta3.TemplatesServiceClient; -type TemplatesServiceClient = v1beta3.TemplatesServiceClient; -export {v1beta3, FlexTemplatesServiceClient, JobsV1Beta3Client, MessagesV1Beta3Client, MetricsV1Beta3Client, SnapshotsV1Beta3Client, TemplatesServiceClient}; -export default {v1beta3, FlexTemplatesServiceClient, JobsV1Beta3Client, MessagesV1Beta3Client, MetricsV1Beta3Client, SnapshotsV1Beta3Client, TemplatesServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client.ts deleted file mode 100644 index bf89f3844fa..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client.ts +++ /dev/null @@ -1,389 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1beta3/flex_templates_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './flex_templates_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Provides a service for Flex templates. This feature is not ready yet. - * @class - * @memberof v1beta3 - */ -export class FlexTemplatesServiceClient { - 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}; - flexTemplatesServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of FlexTemplatesServiceClient. - * - * @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 FlexTemplatesServiceClient({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 FlexTemplatesServiceClient; - 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.dataflow.v1beta3.FlexTemplatesService', 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.flexTemplatesServiceStub) { - return this.flexTemplatesServiceStub; - } - - // Put together the "service stub" for - // google.dataflow.v1beta3.FlexTemplatesService. - this.flexTemplatesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.FlexTemplatesService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.dataflow.v1beta3.FlexTemplatesService, - 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 flexTemplatesServiceStubMethods = - ['launchFlexTemplate']; - for (const methodName of flexTemplatesServiceStubMethods) { - const callPromise = this.flexTemplatesServiceStub.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.flexTemplatesServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataflow.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 'dataflow.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/compute', - 'https://www.googleapis.com/auth/compute.readonly', - 'https://www.googleapis.com/auth/userinfo.email' - ]; - } - - 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 -- - // ------------------- -/** - * Launch a job with a FlexTemplate. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Cloud Platform project that the job belongs to. - * @param {google.dataflow.v1beta3.LaunchFlexTemplateParameter} request.launchParameter - * Required. Parameter to launch a job form Flex Template. - * @param {string} request.location - * Required. The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - * which to direct the request. E.g., us-central1, us-west1. - * @param {boolean} request.validateOnly - * If true, the request is validated but not actually executed. - * Defaults to 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.dataflow.v1beta3.LaunchFlexTemplateResponse|LaunchFlexTemplateResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/flex_templates_service.launch_flex_template.js - * region_tag:dataflow_v1beta3_generated_FlexTemplatesService_LaunchFlexTemplate_async - */ - launchFlexTemplate( - request?: protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|undefined, {}|undefined - ]>; - launchFlexTemplate( - request: protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|null|undefined, - {}|null|undefined>): void; - launchFlexTemplate( - request: protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest, - callback: Callback< - protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|null|undefined, - {}|null|undefined>): void; - launchFlexTemplate( - request?: protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchFlexTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - }); - this.initialize(); - return this.innerApiCalls.launchFlexTemplate(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.flexTemplatesServiceStub && !this._terminated) { - return this.flexTemplatesServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client_config.json deleted file mode 100644 index 030c5540a61..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_client_config.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.dataflow.v1beta3.FlexTemplatesService": { - "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": { - "LaunchFlexTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_proto_list.json deleted file mode 100644 index cd5511e4fd8..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/flex_templates_service_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/dataflow/v1beta3/environment.proto", - "../../protos/google/dataflow/v1beta3/jobs.proto", - "../../protos/google/dataflow/v1beta3/messages.proto", - "../../protos/google/dataflow/v1beta3/metrics.proto", - "../../protos/google/dataflow/v1beta3/snapshots.proto", - "../../protos/google/dataflow/v1beta3/streaming.proto", - "../../protos/google/dataflow/v1beta3/templates.proto" -] diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/gapic_metadata.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/gapic_metadata.json deleted file mode 100644 index 44fe73585b4..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/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.dataflow.v1beta3", - "libraryPackage": "@google-cloud/dataflow", - "services": { - "FlexTemplatesService": { - "clients": { - "grpc": { - "libraryClient": "FlexTemplatesServiceClient", - "rpcs": { - "LaunchFlexTemplate": { - "methods": [ - "launchFlexTemplate" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "FlexTemplatesServiceClient", - "rpcs": { - "LaunchFlexTemplate": { - "methods": [ - "launchFlexTemplate" - ] - } - } - } - } - }, - "JobsV1Beta3": { - "clients": { - "grpc": { - "libraryClient": "JobsV1Beta3Client", - "rpcs": { - "CreateJob": { - "methods": [ - "createJob" - ] - }, - "GetJob": { - "methods": [ - "getJob" - ] - }, - "UpdateJob": { - "methods": [ - "updateJob" - ] - }, - "CheckActiveJobs": { - "methods": [ - "checkActiveJobs" - ] - }, - "SnapshotJob": { - "methods": [ - "snapshotJob" - ] - }, - "ListJobs": { - "methods": [ - "listJobs", - "listJobsStream", - "listJobsAsync" - ] - }, - "AggregatedListJobs": { - "methods": [ - "aggregatedListJobs", - "aggregatedListJobsStream", - "aggregatedListJobsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "JobsV1Beta3Client", - "rpcs": { - "CreateJob": { - "methods": [ - "createJob" - ] - }, - "GetJob": { - "methods": [ - "getJob" - ] - }, - "UpdateJob": { - "methods": [ - "updateJob" - ] - }, - "CheckActiveJobs": { - "methods": [ - "checkActiveJobs" - ] - }, - "SnapshotJob": { - "methods": [ - "snapshotJob" - ] - }, - "ListJobs": { - "methods": [ - "listJobs", - "listJobsStream", - "listJobsAsync" - ] - }, - "AggregatedListJobs": { - "methods": [ - "aggregatedListJobs", - "aggregatedListJobsStream", - "aggregatedListJobsAsync" - ] - } - } - } - } - }, - "MessagesV1Beta3": { - "clients": { - "grpc": { - "libraryClient": "MessagesV1Beta3Client", - "rpcs": { - "ListJobMessages": { - "methods": [ - "listJobMessages", - "listJobMessagesStream", - "listJobMessagesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "MessagesV1Beta3Client", - "rpcs": { - "ListJobMessages": { - "methods": [ - "listJobMessages", - "listJobMessagesStream", - "listJobMessagesAsync" - ] - } - } - } - } - }, - "MetricsV1Beta3": { - "clients": { - "grpc": { - "libraryClient": "MetricsV1Beta3Client", - "rpcs": { - "GetJobMetrics": { - "methods": [ - "getJobMetrics" - ] - }, - "GetJobExecutionDetails": { - "methods": [ - "getJobExecutionDetails", - "getJobExecutionDetailsStream", - "getJobExecutionDetailsAsync" - ] - }, - "GetStageExecutionDetails": { - "methods": [ - "getStageExecutionDetails", - "getStageExecutionDetailsStream", - "getStageExecutionDetailsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "MetricsV1Beta3Client", - "rpcs": { - "GetJobMetrics": { - "methods": [ - "getJobMetrics" - ] - }, - "GetJobExecutionDetails": { - "methods": [ - "getJobExecutionDetails", - "getJobExecutionDetailsStream", - "getJobExecutionDetailsAsync" - ] - }, - "GetStageExecutionDetails": { - "methods": [ - "getStageExecutionDetails", - "getStageExecutionDetailsStream", - "getStageExecutionDetailsAsync" - ] - } - } - } - } - }, - "SnapshotsV1Beta3": { - "clients": { - "grpc": { - "libraryClient": "SnapshotsV1Beta3Client", - "rpcs": { - "GetSnapshot": { - "methods": [ - "getSnapshot" - ] - }, - "DeleteSnapshot": { - "methods": [ - "deleteSnapshot" - ] - }, - "ListSnapshots": { - "methods": [ - "listSnapshots" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SnapshotsV1Beta3Client", - "rpcs": { - "GetSnapshot": { - "methods": [ - "getSnapshot" - ] - }, - "DeleteSnapshot": { - "methods": [ - "deleteSnapshot" - ] - }, - "ListSnapshots": { - "methods": [ - "listSnapshots" - ] - } - } - } - } - }, - "TemplatesService": { - "clients": { - "grpc": { - "libraryClient": "TemplatesServiceClient", - "rpcs": { - "CreateJobFromTemplate": { - "methods": [ - "createJobFromTemplate" - ] - }, - "LaunchTemplate": { - "methods": [ - "launchTemplate" - ] - }, - "GetTemplate": { - "methods": [ - "getTemplate" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "TemplatesServiceClient", - "rpcs": { - "CreateJobFromTemplate": { - "methods": [ - "createJobFromTemplate" - ] - }, - "LaunchTemplate": { - "methods": [ - "launchTemplate" - ] - }, - "GetTemplate": { - "methods": [ - "getTemplate" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/index.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/index.ts deleted file mode 100644 index a91617a0bc5..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 {FlexTemplatesServiceClient} from './flex_templates_service_client'; -export {JobsV1Beta3Client} from './jobs_v1_beta3_client'; -export {MessagesV1Beta3Client} from './messages_v1_beta3_client'; -export {MetricsV1Beta3Client} from './metrics_v1_beta3_client'; -export {SnapshotsV1Beta3Client} from './snapshots_v1_beta3_client'; -export {TemplatesServiceClient} from './templates_service_client'; diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client.ts deleted file mode 100644 index 3ff5a4216f6..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client.ts +++ /dev/null @@ -1,1150 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1beta3/jobs_v1_beta3_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './jobs_v1_beta3_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Provides a method to create and modify Google Cloud Dataflow jobs. - * A Job is a multi-stage computation graph run by the Cloud Dataflow service. - * @class - * @memberof v1beta3 - */ -export class JobsV1Beta3Client { - 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}; - jobsV1Beta3Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of JobsV1Beta3Client. - * - * @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 JobsV1Beta3Client({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 JobsV1Beta3Client; - 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 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 = { - listJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs'), - aggregatedListJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.dataflow.v1beta3.JobsV1Beta3', 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.jobsV1Beta3Stub) { - return this.jobsV1Beta3Stub; - } - - // Put together the "service stub" for - // google.dataflow.v1beta3.JobsV1Beta3. - this.jobsV1Beta3Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.JobsV1Beta3') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.dataflow.v1beta3.JobsV1Beta3, - 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 jobsV1Beta3StubMethods = - ['createJob', 'getJob', 'updateJob', 'listJobs', 'aggregatedListJobs', 'checkActiveJobs', 'snapshotJob']; - for (const methodName of jobsV1Beta3StubMethods) { - const callPromise = this.jobsV1Beta3Stub.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.jobsV1Beta3Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataflow.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 'dataflow.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/compute', - 'https://www.googleapis.com/auth/compute.readonly', - 'https://www.googleapis.com/auth/userinfo.email' - ]; - } - - 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 Cloud Dataflow job. - * - * To create a job, we recommend using `projects.locations.jobs.create` with a - * [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using - * `projects.jobs.create` is not recommended, as your job will always start - * in `us-central1`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * The ID of the Cloud Platform project that the job belongs to. - * @param {google.dataflow.v1beta3.Job} request.job - * The job to create. - * @param {google.dataflow.v1beta3.JobView} request.view - * The level of information requested in response. - * @param {string} request.replaceJobId - * Deprecated. This field is now in the Job message. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/jobs_v1_beta3.create_job.js - * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_CreateJob_async - */ - createJob( - request?: protos.google.dataflow.v1beta3.ICreateJobRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobRequest|undefined, {}|undefined - ]>; - createJob( - request: protos.google.dataflow.v1beta3.ICreateJobRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobRequest|null|undefined, - {}|null|undefined>): void; - createJob( - request: protos.google.dataflow.v1beta3.ICreateJobRequest, - callback: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobRequest|null|undefined, - {}|null|undefined>): void; - createJob( - request?: protos.google.dataflow.v1beta3.ICreateJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - }); - this.initialize(); - return this.innerApiCalls.createJob(request, options, callback); - } -/** - * Gets the state of the specified Cloud Dataflow job. - * - * To get the state of a job, we recommend using `projects.locations.jobs.get` - * with a [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using - * `projects.jobs.get` is not recommended, as you can only get the state of - * jobs that are running in `us-central1`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * The ID of the Cloud Platform project that the job belongs to. - * @param {string} request.jobId - * The job ID. - * @param {google.dataflow.v1beta3.JobView} request.view - * The level of information requested in response. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/jobs_v1_beta3.get_job.js - * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_GetJob_async - */ - getJob( - request?: protos.google.dataflow.v1beta3.IGetJobRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IGetJobRequest|undefined, {}|undefined - ]>; - getJob( - request: protos.google.dataflow.v1beta3.IGetJobRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request: protos.google.dataflow.v1beta3.IGetJobRequest, - callback: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request?: protos.google.dataflow.v1beta3.IGetJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IGetJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IGetJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IGetJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getJob(request, options, callback); - } -/** - * Updates the state of an existing Cloud Dataflow job. - * - * To update the state of an existing job, we recommend using - * `projects.locations.jobs.update` with a [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using - * `projects.jobs.update` is not recommended, as you can only update the state - * of jobs that are running in `us-central1`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * The ID of the Cloud Platform project that the job belongs to. - * @param {string} request.jobId - * The job ID. - * @param {google.dataflow.v1beta3.Job} request.job - * The updated job. - * Only the job state is updatable; other fields will be ignored. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/jobs_v1_beta3.update_job.js - * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_UpdateJob_async - */ - updateJob( - request?: protos.google.dataflow.v1beta3.IUpdateJobRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IUpdateJobRequest|undefined, {}|undefined - ]>; - updateJob( - request: protos.google.dataflow.v1beta3.IUpdateJobRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IUpdateJobRequest|null|undefined, - {}|null|undefined>): void; - updateJob( - request: protos.google.dataflow.v1beta3.IUpdateJobRequest, - callback: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IUpdateJobRequest|null|undefined, - {}|null|undefined>): void; - updateJob( - request?: protos.google.dataflow.v1beta3.IUpdateJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IUpdateJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IUpdateJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.IUpdateJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateJob(request, options, callback); - } -/** - * Check for existence of active jobs in the given project across all regions. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * The project which owns the jobs. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.CheckActiveJobsResponse|CheckActiveJobsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/jobs_v1_beta3.check_active_jobs.js - * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_CheckActiveJobs_async - */ - checkActiveJobs( - request?: protos.google.dataflow.v1beta3.ICheckActiveJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, - protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|undefined, {}|undefined - ]>; - checkActiveJobs( - request: protos.google.dataflow.v1beta3.ICheckActiveJobsRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, - protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|null|undefined, - {}|null|undefined>): void; - checkActiveJobs( - request: protos.google.dataflow.v1beta3.ICheckActiveJobsRequest, - callback: Callback< - protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, - protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|null|undefined, - {}|null|undefined>): void; - checkActiveJobs( - request?: protos.google.dataflow.v1beta3.ICheckActiveJobsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, - protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, - protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.ICheckActiveJobsResponse, - protos.google.dataflow.v1beta3.ICheckActiveJobsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.checkActiveJobs(request, options, callback); - } -/** - * Snapshot the state of a streaming job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * The project which owns the job to be snapshotted. - * @param {string} request.jobId - * The job to be snapshotted. - * @param {google.protobuf.Duration} request.ttl - * TTL for the snapshot. - * @param {string} request.location - * The location that contains this job. - * @param {boolean} request.snapshotSources - * If true, perform snapshots for sources which support this. - * @param {string} request.description - * User specified description of the snapshot. Maybe empty. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.Snapshot|Snapshot}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/jobs_v1_beta3.snapshot_job.js - * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_SnapshotJob_async - */ - snapshotJob( - request?: protos.google.dataflow.v1beta3.ISnapshotJobRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.ISnapshotJobRequest|undefined, {}|undefined - ]>; - snapshotJob( - request: protos.google.dataflow.v1beta3.ISnapshotJobRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.ISnapshotJobRequest|null|undefined, - {}|null|undefined>): void; - snapshotJob( - request: protos.google.dataflow.v1beta3.ISnapshotJobRequest, - callback: Callback< - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.ISnapshotJobRequest|null|undefined, - {}|null|undefined>): void; - snapshotJob( - request?: protos.google.dataflow.v1beta3.ISnapshotJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.ISnapshotJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.ISnapshotJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.ISnapshotJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - }); - this.initialize(); - return this.innerApiCalls.snapshotJob(request, options, callback); - } - - /** - * List the jobs of a project. - * - * To list the jobs of a project in a region, we recommend using - * `projects.locations.jobs.list` with a [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). To - * list the all jobs across all regions, use `projects.jobs.aggregated`. Using - * `projects.jobs.list` is not recommended, as you can only get the list of - * jobs that are running in `us-central1`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter - * The kind of filter to use. - * @param {string} request.projectId - * The project which owns the jobs. - * @param {google.dataflow.v1beta3.JobView} request.view - * Deprecated. ListJobs always returns summaries now. - * Use GetJob for other JobViews. - * @param {number} request.pageSize - * If there are many jobs, limit response to at most this many. - * The actual number of jobs returned will be the lesser of max_responses - * and an unspecified server-defined limit. - * @param {string} request.pageToken - * Set this to the 'next_page_token' field of a previous response - * to request additional results in a long list. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.dataflow.v1beta3.Job|Job}. - * 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 `listJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listJobs( - request?: protos.google.dataflow.v1beta3.IListJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IJob[], - protos.google.dataflow.v1beta3.IListJobsRequest|null, - protos.google.dataflow.v1beta3.IListJobsResponse - ]>; - listJobs( - request: protos.google.dataflow.v1beta3.IListJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.dataflow.v1beta3.IListJobsRequest, - protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, - protos.google.dataflow.v1beta3.IJob>): void; - listJobs( - request: protos.google.dataflow.v1beta3.IListJobsRequest, - callback: PaginationCallback< - protos.google.dataflow.v1beta3.IListJobsRequest, - protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, - protos.google.dataflow.v1beta3.IJob>): void; - listJobs( - request?: protos.google.dataflow.v1beta3.IListJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.dataflow.v1beta3.IListJobsRequest, - protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, - protos.google.dataflow.v1beta3.IJob>, - callback?: PaginationCallback< - protos.google.dataflow.v1beta3.IListJobsRequest, - protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, - protos.google.dataflow.v1beta3.IJob>): - Promise<[ - protos.google.dataflow.v1beta3.IJob[], - protos.google.dataflow.v1beta3.IListJobsRequest|null, - protos.google.dataflow.v1beta3.IListJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - }); - this.initialize(); - return this.innerApiCalls.listJobs(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 {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter - * The kind of filter to use. - * @param {string} request.projectId - * The project which owns the jobs. - * @param {google.dataflow.v1beta3.JobView} request.view - * Deprecated. ListJobs always returns summaries now. - * Use GetJob for other JobViews. - * @param {number} request.pageSize - * If there are many jobs, limit response to at most this many. - * The actual number of jobs returned will be the lesser of max_responses - * and an unspecified server-defined limit. - * @param {string} request.pageToken - * Set this to the 'next_page_token' field of a previous response - * to request additional results in a long list. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - * @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.dataflow.v1beta3.Job|Job} 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 `listJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listJobsStream( - request?: protos.google.dataflow.v1beta3.IListJobsRequest, - 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({ - 'project_id': request.projectId ?? '', - 'location': request.location ?? '', - }); - const defaultCallSettings = this._defaults['listJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobs.createStream( - this.innerApiCalls.listJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobs`, 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 {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter - * The kind of filter to use. - * @param {string} request.projectId - * The project which owns the jobs. - * @param {google.dataflow.v1beta3.JobView} request.view - * Deprecated. ListJobs always returns summaries now. - * Use GetJob for other JobViews. - * @param {number} request.pageSize - * If there are many jobs, limit response to at most this many. - * The actual number of jobs returned will be the lesser of max_responses - * and an unspecified server-defined limit. - * @param {string} request.pageToken - * Set this to the 'next_page_token' field of a previous response - * to request additional results in a long list. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - * @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.dataflow.v1beta3.Job|Job}. 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/v1beta3/jobs_v1_beta3.list_jobs.js - * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_ListJobs_async - */ - listJobsAsync( - request?: protos.google.dataflow.v1beta3.IListJobsRequest, - 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({ - 'project_id': request.projectId ?? '', - 'location': request.location ?? '', - }); - const defaultCallSettings = this._defaults['listJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobs.asyncIterate( - this.innerApiCalls['listJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List the jobs of a project across all regions. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter - * The kind of filter to use. - * @param {string} request.projectId - * The project which owns the jobs. - * @param {google.dataflow.v1beta3.JobView} request.view - * Deprecated. ListJobs always returns summaries now. - * Use GetJob for other JobViews. - * @param {number} request.pageSize - * If there are many jobs, limit response to at most this many. - * The actual number of jobs returned will be the lesser of max_responses - * and an unspecified server-defined limit. - * @param {string} request.pageToken - * Set this to the 'next_page_token' field of a previous response - * to request additional results in a long list. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.dataflow.v1beta3.Job|Job}. - * 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 `aggregatedListJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - aggregatedListJobs( - request?: protos.google.dataflow.v1beta3.IListJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IJob[], - protos.google.dataflow.v1beta3.IListJobsRequest|null, - protos.google.dataflow.v1beta3.IListJobsResponse - ]>; - aggregatedListJobs( - request: protos.google.dataflow.v1beta3.IListJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.dataflow.v1beta3.IListJobsRequest, - protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, - protos.google.dataflow.v1beta3.IJob>): void; - aggregatedListJobs( - request: protos.google.dataflow.v1beta3.IListJobsRequest, - callback: PaginationCallback< - protos.google.dataflow.v1beta3.IListJobsRequest, - protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, - protos.google.dataflow.v1beta3.IJob>): void; - aggregatedListJobs( - request?: protos.google.dataflow.v1beta3.IListJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.dataflow.v1beta3.IListJobsRequest, - protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, - protos.google.dataflow.v1beta3.IJob>, - callback?: PaginationCallback< - protos.google.dataflow.v1beta3.IListJobsRequest, - protos.google.dataflow.v1beta3.IListJobsResponse|null|undefined, - protos.google.dataflow.v1beta3.IJob>): - Promise<[ - protos.google.dataflow.v1beta3.IJob[], - protos.google.dataflow.v1beta3.IListJobsRequest|null, - protos.google.dataflow.v1beta3.IListJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - }); - this.initialize(); - return this.innerApiCalls.aggregatedListJobs(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 {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter - * The kind of filter to use. - * @param {string} request.projectId - * The project which owns the jobs. - * @param {google.dataflow.v1beta3.JobView} request.view - * Deprecated. ListJobs always returns summaries now. - * Use GetJob for other JobViews. - * @param {number} request.pageSize - * If there are many jobs, limit response to at most this many. - * The actual number of jobs returned will be the lesser of max_responses - * and an unspecified server-defined limit. - * @param {string} request.pageToken - * Set this to the 'next_page_token' field of a previous response - * to request additional results in a long list. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - * @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.dataflow.v1beta3.Job|Job} 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 `aggregatedListJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - aggregatedListJobsStream( - request?: protos.google.dataflow.v1beta3.IListJobsRequest, - 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({ - 'project_id': request.projectId ?? '', - }); - const defaultCallSettings = this._defaults['aggregatedListJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.aggregatedListJobs.createStream( - this.innerApiCalls.aggregatedListJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `aggregatedListJobs`, 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 {google.dataflow.v1beta3.ListJobsRequest.Filter} request.filter - * The kind of filter to use. - * @param {string} request.projectId - * The project which owns the jobs. - * @param {google.dataflow.v1beta3.JobView} request.view - * Deprecated. ListJobs always returns summaries now. - * Use GetJob for other JobViews. - * @param {number} request.pageSize - * If there are many jobs, limit response to at most this many. - * The actual number of jobs returned will be the lesser of max_responses - * and an unspecified server-defined limit. - * @param {string} request.pageToken - * Set this to the 'next_page_token' field of a previous response - * to request additional results in a long list. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains this job. - * @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.dataflow.v1beta3.Job|Job}. 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/v1beta3/jobs_v1_beta3.aggregated_list_jobs.js - * region_tag:dataflow_v1beta3_generated_JobsV1Beta3_AggregatedListJobs_async - */ - aggregatedListJobsAsync( - request?: protos.google.dataflow.v1beta3.IListJobsRequest, - 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({ - 'project_id': request.projectId ?? '', - }); - const defaultCallSettings = this._defaults['aggregatedListJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.aggregatedListJobs.asyncIterate( - this.innerApiCalls['aggregatedListJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * 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.jobsV1Beta3Stub && !this._terminated) { - return this.jobsV1Beta3Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client_config.json deleted file mode 100644 index 1365d3fd6ed..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_client_config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "interfaces": { - "google.dataflow.v1beta3.JobsV1Beta3": { - "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": { - "CreateJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListJobs": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AggregatedListJobs": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CheckActiveJobs": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SnapshotJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_proto_list.json deleted file mode 100644 index cd5511e4fd8..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/jobs_v1_beta3_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/dataflow/v1beta3/environment.proto", - "../../protos/google/dataflow/v1beta3/jobs.proto", - "../../protos/google/dataflow/v1beta3/messages.proto", - "../../protos/google/dataflow/v1beta3/metrics.proto", - "../../protos/google/dataflow/v1beta3/snapshots.proto", - "../../protos/google/dataflow/v1beta3/streaming.proto", - "../../protos/google/dataflow/v1beta3/templates.proto" -] diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client.ts deleted file mode 100644 index 94f1100e817..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client.ts +++ /dev/null @@ -1,555 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1beta3/messages_v1_beta3_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './messages_v1_beta3_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Dataflow Messages API is used for monitoring the progress of - * Dataflow jobs. - * @class - * @memberof v1beta3 - */ -export class MessagesV1Beta3Client { - 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}; - messagesV1Beta3Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MessagesV1Beta3Client. - * - * @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 MessagesV1Beta3Client({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 MessagesV1Beta3Client; - 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 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 = { - listJobMessages: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobMessages') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.dataflow.v1beta3.MessagesV1Beta3', 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.messagesV1Beta3Stub) { - return this.messagesV1Beta3Stub; - } - - // Put together the "service stub" for - // google.dataflow.v1beta3.MessagesV1Beta3. - this.messagesV1Beta3Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.MessagesV1Beta3') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.dataflow.v1beta3.MessagesV1Beta3, - 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 messagesV1Beta3StubMethods = - ['listJobMessages']; - for (const methodName of messagesV1Beta3StubMethods) { - const callPromise = this.messagesV1Beta3Stub.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.messagesV1Beta3Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataflow.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 'dataflow.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/compute', - 'https://www.googleapis.com/auth/compute.readonly', - 'https://www.googleapis.com/auth/userinfo.email' - ]; - } - - 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 -- - // ------------------- - - /** - * Request the job status. - * - * To request the status of a job, we recommend using - * `projects.locations.jobs.messages.list` with a [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using - * `projects.jobs.messages.list` is not recommended, as you can only request - * the status of jobs that are running in `us-central1`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * A project id. - * @param {string} request.jobId - * The job to get messages about. - * @param {google.dataflow.v1beta3.JobMessageImportance} request.minimumImportance - * Filter to only get messages with importance >= level - * @param {number} request.pageSize - * If specified, determines the maximum number of messages to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - * @param {string} request.pageToken - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * be returned. - * @param {google.protobuf.Timestamp} request.startTime - * If specified, return only messages with timestamps >= start_time. - * The default is the job creation time (i.e. beginning of messages). - * @param {google.protobuf.Timestamp} request.endTime - * Return only messages with timestamps < end_time. The default is now - * (i.e. return up to the latest messages available). - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_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 Array of {@link protos.google.dataflow.v1beta3.JobMessage|JobMessage}. - * 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 `listJobMessagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listJobMessages( - request?: protos.google.dataflow.v1beta3.IListJobMessagesRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IJobMessage[], - protos.google.dataflow.v1beta3.IListJobMessagesRequest|null, - protos.google.dataflow.v1beta3.IListJobMessagesResponse - ]>; - listJobMessages( - request: protos.google.dataflow.v1beta3.IListJobMessagesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.dataflow.v1beta3.IListJobMessagesRequest, - protos.google.dataflow.v1beta3.IListJobMessagesResponse|null|undefined, - protos.google.dataflow.v1beta3.IJobMessage>): void; - listJobMessages( - request: protos.google.dataflow.v1beta3.IListJobMessagesRequest, - callback: PaginationCallback< - protos.google.dataflow.v1beta3.IListJobMessagesRequest, - protos.google.dataflow.v1beta3.IListJobMessagesResponse|null|undefined, - protos.google.dataflow.v1beta3.IJobMessage>): void; - listJobMessages( - request?: protos.google.dataflow.v1beta3.IListJobMessagesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.dataflow.v1beta3.IListJobMessagesRequest, - protos.google.dataflow.v1beta3.IListJobMessagesResponse|null|undefined, - protos.google.dataflow.v1beta3.IJobMessage>, - callback?: PaginationCallback< - protos.google.dataflow.v1beta3.IListJobMessagesRequest, - protos.google.dataflow.v1beta3.IListJobMessagesResponse|null|undefined, - protos.google.dataflow.v1beta3.IJobMessage>): - Promise<[ - protos.google.dataflow.v1beta3.IJobMessage[], - protos.google.dataflow.v1beta3.IListJobMessagesRequest|null, - protos.google.dataflow.v1beta3.IListJobMessagesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - }); - this.initialize(); - return this.innerApiCalls.listJobMessages(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.projectId - * A project id. - * @param {string} request.jobId - * The job to get messages about. - * @param {google.dataflow.v1beta3.JobMessageImportance} request.minimumImportance - * Filter to only get messages with importance >= level - * @param {number} request.pageSize - * If specified, determines the maximum number of messages to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - * @param {string} request.pageToken - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * be returned. - * @param {google.protobuf.Timestamp} request.startTime - * If specified, return only messages with timestamps >= start_time. - * The default is the job creation time (i.e. beginning of messages). - * @param {google.protobuf.Timestamp} request.endTime - * Return only messages with timestamps < end_time. The default is now - * (i.e. return up to the latest messages available). - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - * @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.dataflow.v1beta3.JobMessage|JobMessage} 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 `listJobMessagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listJobMessagesStream( - request?: protos.google.dataflow.v1beta3.IListJobMessagesRequest, - 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({ - 'project_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - }); - const defaultCallSettings = this._defaults['listJobMessages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobMessages.createStream( - this.innerApiCalls.listJobMessages as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobMessages`, 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.projectId - * A project id. - * @param {string} request.jobId - * The job to get messages about. - * @param {google.dataflow.v1beta3.JobMessageImportance} request.minimumImportance - * Filter to only get messages with importance >= level - * @param {number} request.pageSize - * If specified, determines the maximum number of messages to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - * @param {string} request.pageToken - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * be returned. - * @param {google.protobuf.Timestamp} request.startTime - * If specified, return only messages with timestamps >= start_time. - * The default is the job creation time (i.e. beginning of messages). - * @param {google.protobuf.Timestamp} request.endTime - * Return only messages with timestamps < end_time. The default is now - * (i.e. return up to the latest messages available). - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - * @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.dataflow.v1beta3.JobMessage|JobMessage}. 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/v1beta3/messages_v1_beta3.list_job_messages.js - * region_tag:dataflow_v1beta3_generated_MessagesV1Beta3_ListJobMessages_async - */ - listJobMessagesAsync( - request?: protos.google.dataflow.v1beta3.IListJobMessagesRequest, - 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({ - 'project_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - }); - const defaultCallSettings = this._defaults['listJobMessages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobMessages.asyncIterate( - this.innerApiCalls['listJobMessages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * 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.messagesV1Beta3Stub && !this._terminated) { - return this.messagesV1Beta3Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client_config.json deleted file mode 100644 index bed4b6c3449..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_client_config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.dataflow.v1beta3.MessagesV1Beta3": { - "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": { - "ListJobMessages": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_proto_list.json deleted file mode 100644 index cd5511e4fd8..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/messages_v1_beta3_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/dataflow/v1beta3/environment.proto", - "../../protos/google/dataflow/v1beta3/jobs.proto", - "../../protos/google/dataflow/v1beta3/messages.proto", - "../../protos/google/dataflow/v1beta3/metrics.proto", - "../../protos/google/dataflow/v1beta3/snapshots.proto", - "../../protos/google/dataflow/v1beta3/streaming.proto", - "../../protos/google/dataflow/v1beta3/templates.proto" -] diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client.ts deleted file mode 100644 index 090d6b93800..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client.ts +++ /dev/null @@ -1,846 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1beta3/metrics_v1_beta3_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './metrics_v1_beta3_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Dataflow Metrics API lets you monitor the progress of Dataflow - * jobs. - * @class - * @memberof v1beta3 - */ -export class MetricsV1Beta3Client { - 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}; - metricsV1Beta3Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MetricsV1Beta3Client. - * - * @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 MetricsV1Beta3Client({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 MetricsV1Beta3Client; - 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 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 = { - getJobExecutionDetails: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'stages'), - getStageExecutionDetails: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workers') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.dataflow.v1beta3.MetricsV1Beta3', 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.metricsV1Beta3Stub) { - return this.metricsV1Beta3Stub; - } - - // Put together the "service stub" for - // google.dataflow.v1beta3.MetricsV1Beta3. - this.metricsV1Beta3Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.MetricsV1Beta3') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.dataflow.v1beta3.MetricsV1Beta3, - 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 metricsV1Beta3StubMethods = - ['getJobMetrics', 'getJobExecutionDetails', 'getStageExecutionDetails']; - for (const methodName of metricsV1Beta3StubMethods) { - const callPromise = this.metricsV1Beta3Stub.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.metricsV1Beta3Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataflow.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 'dataflow.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/compute', - 'https://www.googleapis.com/auth/compute.readonly', - 'https://www.googleapis.com/auth/userinfo.email' - ]; - } - - 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 -- - // ------------------- -/** - * Request the job status. - * - * To request the status of a job, we recommend using - * `projects.locations.jobs.getMetrics` with a [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using - * `projects.jobs.getMetrics` is not recommended, as you can only request the - * status of jobs that are running in `us-central1`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * A project id. - * @param {string} request.jobId - * The job to get metrics for. - * @param {google.protobuf.Timestamp} request.startTime - * Return only metric data that has changed since this time. - * Default is to return all information about all metrics for the job. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_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.dataflow.v1beta3.JobMetrics|JobMetrics}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/metrics_v1_beta3.get_job_metrics.js - * region_tag:dataflow_v1beta3_generated_MetricsV1Beta3_GetJobMetrics_async - */ - getJobMetrics( - request?: protos.google.dataflow.v1beta3.IGetJobMetricsRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IJobMetrics, - protos.google.dataflow.v1beta3.IGetJobMetricsRequest|undefined, {}|undefined - ]>; - getJobMetrics( - request: protos.google.dataflow.v1beta3.IGetJobMetricsRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.IJobMetrics, - protos.google.dataflow.v1beta3.IGetJobMetricsRequest|null|undefined, - {}|null|undefined>): void; - getJobMetrics( - request: protos.google.dataflow.v1beta3.IGetJobMetricsRequest, - callback: Callback< - protos.google.dataflow.v1beta3.IJobMetrics, - protos.google.dataflow.v1beta3.IGetJobMetricsRequest|null|undefined, - {}|null|undefined>): void; - getJobMetrics( - request?: protos.google.dataflow.v1beta3.IGetJobMetricsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.IJobMetrics, - protos.google.dataflow.v1beta3.IGetJobMetricsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.IJobMetrics, - protos.google.dataflow.v1beta3.IGetJobMetricsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.IJobMetrics, - protos.google.dataflow.v1beta3.IGetJobMetricsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getJobMetrics(request, options, callback); - } - - /** - * Request detailed information about the execution status of the job. - * - * EXPERIMENTAL. This API is subject to change or removal without notice. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * A project id. - * @param {string} request.jobId - * The job to get execution details for. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - * @param {number} request.pageSize - * If specified, determines the maximum number of stages to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - * @param {string} request.pageToken - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * 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.dataflow.v1beta3.StageSummary|StageSummary}. - * 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 `getJobExecutionDetailsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - getJobExecutionDetails( - request?: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IStageSummary[], - protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest|null, - protos.google.dataflow.v1beta3.IJobExecutionDetails - ]>; - getJobExecutionDetails( - request: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, - protos.google.dataflow.v1beta3.IJobExecutionDetails|null|undefined, - protos.google.dataflow.v1beta3.IStageSummary>): void; - getJobExecutionDetails( - request: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, - callback: PaginationCallback< - protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, - protos.google.dataflow.v1beta3.IJobExecutionDetails|null|undefined, - protos.google.dataflow.v1beta3.IStageSummary>): void; - getJobExecutionDetails( - request?: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, - protos.google.dataflow.v1beta3.IJobExecutionDetails|null|undefined, - protos.google.dataflow.v1beta3.IStageSummary>, - callback?: PaginationCallback< - protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, - protos.google.dataflow.v1beta3.IJobExecutionDetails|null|undefined, - protos.google.dataflow.v1beta3.IStageSummary>): - Promise<[ - protos.google.dataflow.v1beta3.IStageSummary[], - protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest|null, - protos.google.dataflow.v1beta3.IJobExecutionDetails - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getJobExecutionDetails(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.projectId - * A project id. - * @param {string} request.jobId - * The job to get execution details for. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - * @param {number} request.pageSize - * If specified, determines the maximum number of stages to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - * @param {string} request.pageToken - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * 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.dataflow.v1beta3.StageSummary|StageSummary} 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 `getJobExecutionDetailsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - getJobExecutionDetailsStream( - request?: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, - 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({ - 'project_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - }); - const defaultCallSettings = this._defaults['getJobExecutionDetails']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.getJobExecutionDetails.createStream( - this.innerApiCalls.getJobExecutionDetails as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `getJobExecutionDetails`, 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.projectId - * A project id. - * @param {string} request.jobId - * The job to get execution details for. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - * @param {number} request.pageSize - * If specified, determines the maximum number of stages to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - * @param {string} request.pageToken - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * 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.dataflow.v1beta3.StageSummary|StageSummary}. 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/v1beta3/metrics_v1_beta3.get_job_execution_details.js - * region_tag:dataflow_v1beta3_generated_MetricsV1Beta3_GetJobExecutionDetails_async - */ - getJobExecutionDetailsAsync( - request?: protos.google.dataflow.v1beta3.IGetJobExecutionDetailsRequest, - 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({ - 'project_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - }); - const defaultCallSettings = this._defaults['getJobExecutionDetails']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.getJobExecutionDetails.asyncIterate( - this.innerApiCalls['getJobExecutionDetails'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Request detailed information about the execution status of a stage of the - * job. - * - * EXPERIMENTAL. This API is subject to change or removal without notice. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * A project id. - * @param {string} request.jobId - * The job to get execution details for. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - * @param {string} request.stageId - * The stage for which to fetch information. - * @param {number} request.pageSize - * If specified, determines the maximum number of work items to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - * @param {string} request.pageToken - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * be returned. - * @param {google.protobuf.Timestamp} request.startTime - * Lower time bound of work items to include, by start time. - * @param {google.protobuf.Timestamp} request.endTime - * Upper time bound of work items to include, by start 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 Array of {@link protos.google.dataflow.v1beta3.WorkerDetails|WorkerDetails}. - * 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 `getStageExecutionDetailsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - getStageExecutionDetails( - request?: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IWorkerDetails[], - protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest|null, - protos.google.dataflow.v1beta3.IStageExecutionDetails - ]>; - getStageExecutionDetails( - request: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, - protos.google.dataflow.v1beta3.IStageExecutionDetails|null|undefined, - protos.google.dataflow.v1beta3.IWorkerDetails>): void; - getStageExecutionDetails( - request: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, - callback: PaginationCallback< - protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, - protos.google.dataflow.v1beta3.IStageExecutionDetails|null|undefined, - protos.google.dataflow.v1beta3.IWorkerDetails>): void; - getStageExecutionDetails( - request?: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, - protos.google.dataflow.v1beta3.IStageExecutionDetails|null|undefined, - protos.google.dataflow.v1beta3.IWorkerDetails>, - callback?: PaginationCallback< - protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, - protos.google.dataflow.v1beta3.IStageExecutionDetails|null|undefined, - protos.google.dataflow.v1beta3.IWorkerDetails>): - Promise<[ - protos.google.dataflow.v1beta3.IWorkerDetails[], - protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest|null, - protos.google.dataflow.v1beta3.IStageExecutionDetails - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - 'stage_id': request.stageId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getStageExecutionDetails(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.projectId - * A project id. - * @param {string} request.jobId - * The job to get execution details for. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - * @param {string} request.stageId - * The stage for which to fetch information. - * @param {number} request.pageSize - * If specified, determines the maximum number of work items to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - * @param {string} request.pageToken - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * be returned. - * @param {google.protobuf.Timestamp} request.startTime - * Lower time bound of work items to include, by start time. - * @param {google.protobuf.Timestamp} request.endTime - * Upper time bound of work items to include, by start time. - * @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.dataflow.v1beta3.WorkerDetails|WorkerDetails} 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 `getStageExecutionDetailsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - getStageExecutionDetailsStream( - request?: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, - 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({ - 'project_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - 'stage_id': request.stageId ?? '', - }); - const defaultCallSettings = this._defaults['getStageExecutionDetails']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.getStageExecutionDetails.createStream( - this.innerApiCalls.getStageExecutionDetails as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `getStageExecutionDetails`, 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.projectId - * A project id. - * @param {string} request.jobId - * The job to get execution details for. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that - * contains the job specified by job_id. - * @param {string} request.stageId - * The stage for which to fetch information. - * @param {number} request.pageSize - * If specified, determines the maximum number of work items to - * return. If unspecified, the service may choose an appropriate - * default, or may return an arbitrarily large number of results. - * @param {string} request.pageToken - * If supplied, this should be the value of next_page_token returned - * by an earlier call. This will cause the next page of results to - * be returned. - * @param {google.protobuf.Timestamp} request.startTime - * Lower time bound of work items to include, by start time. - * @param {google.protobuf.Timestamp} request.endTime - * Upper time bound of work items to include, by start time. - * @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.dataflow.v1beta3.WorkerDetails|WorkerDetails}. 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/v1beta3/metrics_v1_beta3.get_stage_execution_details.js - * region_tag:dataflow_v1beta3_generated_MetricsV1Beta3_GetStageExecutionDetails_async - */ - getStageExecutionDetailsAsync( - request?: protos.google.dataflow.v1beta3.IGetStageExecutionDetailsRequest, - 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({ - 'project_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - 'stage_id': request.stageId ?? '', - }); - const defaultCallSettings = this._defaults['getStageExecutionDetails']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.getStageExecutionDetails.asyncIterate( - this.innerApiCalls['getStageExecutionDetails'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * 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.metricsV1Beta3Stub && !this._terminated) { - return this.metricsV1Beta3Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client_config.json deleted file mode 100644 index 3495334a569..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_client_config.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "interfaces": { - "google.dataflow.v1beta3.MetricsV1Beta3": { - "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": { - "GetJobMetrics": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetJobExecutionDetails": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetStageExecutionDetails": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_proto_list.json deleted file mode 100644 index cd5511e4fd8..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/metrics_v1_beta3_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/dataflow/v1beta3/environment.proto", - "../../protos/google/dataflow/v1beta3/jobs.proto", - "../../protos/google/dataflow/v1beta3/messages.proto", - "../../protos/google/dataflow/v1beta3/metrics.proto", - "../../protos/google/dataflow/v1beta3/snapshots.proto", - "../../protos/google/dataflow/v1beta3/streaming.proto", - "../../protos/google/dataflow/v1beta3/templates.proto" -] diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client.ts deleted file mode 100644 index cbc6cfb9df4..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client.ts +++ /dev/null @@ -1,537 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1beta3/snapshots_v1_beta3_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './snapshots_v1_beta3_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Provides methods to manage snapshots of Google Cloud Dataflow jobs. - * @class - * @memberof v1beta3 - */ -export class SnapshotsV1Beta3Client { - 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}; - snapshotsV1Beta3Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SnapshotsV1Beta3Client. - * - * @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 SnapshotsV1Beta3Client({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 SnapshotsV1Beta3Client; - 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.dataflow.v1beta3.SnapshotsV1Beta3', 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.snapshotsV1Beta3Stub) { - return this.snapshotsV1Beta3Stub; - } - - // Put together the "service stub" for - // google.dataflow.v1beta3.SnapshotsV1Beta3. - this.snapshotsV1Beta3Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.SnapshotsV1Beta3') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.dataflow.v1beta3.SnapshotsV1Beta3, - 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 snapshotsV1Beta3StubMethods = - ['getSnapshot', 'deleteSnapshot', 'listSnapshots']; - for (const methodName of snapshotsV1Beta3StubMethods) { - const callPromise = this.snapshotsV1Beta3Stub.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.snapshotsV1Beta3Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataflow.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 'dataflow.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/compute', - 'https://www.googleapis.com/auth/compute.readonly', - 'https://www.googleapis.com/auth/userinfo.email' - ]; - } - - 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 information about a snapshot. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * The ID of the Cloud Platform project that the snapshot belongs to. - * @param {string} request.snapshotId - * The ID of the snapshot. - * @param {string} request.location - * The location that contains this snapshot. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.Snapshot|Snapshot}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/snapshots_v1_beta3.get_snapshot.js - * region_tag:dataflow_v1beta3_generated_SnapshotsV1Beta3_GetSnapshot_async - */ - getSnapshot( - request?: protos.google.dataflow.v1beta3.IGetSnapshotRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.IGetSnapshotRequest|undefined, {}|undefined - ]>; - getSnapshot( - request: protos.google.dataflow.v1beta3.IGetSnapshotRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.IGetSnapshotRequest|null|undefined, - {}|null|undefined>): void; - getSnapshot( - request: protos.google.dataflow.v1beta3.IGetSnapshotRequest, - callback: Callback< - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.IGetSnapshotRequest|null|undefined, - {}|null|undefined>): void; - getSnapshot( - request?: protos.google.dataflow.v1beta3.IGetSnapshotRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.IGetSnapshotRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.IGetSnapshotRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.ISnapshot, - protos.google.dataflow.v1beta3.IGetSnapshotRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - 'snapshot_id': request.snapshotId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSnapshot(request, options, callback); - } -/** - * Deletes a snapshot. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * The ID of the Cloud Platform project that the snapshot belongs to. - * @param {string} request.snapshotId - * The ID of the snapshot. - * @param {string} request.location - * The location that contains this snapshot. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.DeleteSnapshotResponse|DeleteSnapshotResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/snapshots_v1_beta3.delete_snapshot.js - * region_tag:dataflow_v1beta3_generated_SnapshotsV1Beta3_DeleteSnapshot_async - */ - deleteSnapshot( - request?: protos.google.dataflow.v1beta3.IDeleteSnapshotRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, - protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|undefined, {}|undefined - ]>; - deleteSnapshot( - request: protos.google.dataflow.v1beta3.IDeleteSnapshotRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, - protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|null|undefined, - {}|null|undefined>): void; - deleteSnapshot( - request: protos.google.dataflow.v1beta3.IDeleteSnapshotRequest, - callback: Callback< - protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, - protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|null|undefined, - {}|null|undefined>): void; - deleteSnapshot( - request?: protos.google.dataflow.v1beta3.IDeleteSnapshotRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, - protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, - protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.IDeleteSnapshotResponse, - protos.google.dataflow.v1beta3.IDeleteSnapshotRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - 'snapshot_id': request.snapshotId ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSnapshot(request, options, callback); - } -/** - * Lists snapshots. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * The project ID to list snapshots for. - * @param {string} request.jobId - * If specified, list snapshots created from this job. - * @param {string} request.location - * The location to list snapshots in. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.dataflow.v1beta3.ListSnapshotsResponse|ListSnapshotsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/snapshots_v1_beta3.list_snapshots.js - * region_tag:dataflow_v1beta3_generated_SnapshotsV1Beta3_ListSnapshots_async - */ - listSnapshots( - request?: protos.google.dataflow.v1beta3.IListSnapshotsRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IListSnapshotsResponse, - protos.google.dataflow.v1beta3.IListSnapshotsRequest|undefined, {}|undefined - ]>; - listSnapshots( - request: protos.google.dataflow.v1beta3.IListSnapshotsRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.IListSnapshotsResponse, - protos.google.dataflow.v1beta3.IListSnapshotsRequest|null|undefined, - {}|null|undefined>): void; - listSnapshots( - request: protos.google.dataflow.v1beta3.IListSnapshotsRequest, - callback: Callback< - protos.google.dataflow.v1beta3.IListSnapshotsResponse, - protos.google.dataflow.v1beta3.IListSnapshotsRequest|null|undefined, - {}|null|undefined>): void; - listSnapshots( - request?: protos.google.dataflow.v1beta3.IListSnapshotsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.IListSnapshotsResponse, - protos.google.dataflow.v1beta3.IListSnapshotsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.IListSnapshotsResponse, - protos.google.dataflow.v1beta3.IListSnapshotsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.IListSnapshotsResponse, - protos.google.dataflow.v1beta3.IListSnapshotsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - 'job_id': request.jobId ?? '', - }); - this.initialize(); - return this.innerApiCalls.listSnapshots(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.snapshotsV1Beta3Stub && !this._terminated) { - return this.snapshotsV1Beta3Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client_config.json deleted file mode 100644 index 8ef03a6abc4..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_client_config.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "interfaces": { - "google.dataflow.v1beta3.SnapshotsV1Beta3": { - "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": { - "GetSnapshot": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSnapshot": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSnapshots": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_proto_list.json deleted file mode 100644 index cd5511e4fd8..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/snapshots_v1_beta3_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/dataflow/v1beta3/environment.proto", - "../../protos/google/dataflow/v1beta3/jobs.proto", - "../../protos/google/dataflow/v1beta3/messages.proto", - "../../protos/google/dataflow/v1beta3/metrics.proto", - "../../protos/google/dataflow/v1beta3/snapshots.proto", - "../../protos/google/dataflow/v1beta3/streaming.proto", - "../../protos/google/dataflow/v1beta3/templates.proto" -] diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client.ts b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client.ts deleted file mode 100644 index f367f4ec913..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client.ts +++ /dev/null @@ -1,562 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1beta3/templates_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './templates_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Provides a method to create Cloud Dataflow jobs from templates. - * @class - * @memberof v1beta3 - */ -export class TemplatesServiceClient { - 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}; - templatesServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TemplatesServiceClient. - * - * @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 TemplatesServiceClient({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 TemplatesServiceClient; - 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.dataflow.v1beta3.TemplatesService', 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.templatesServiceStub) { - return this.templatesServiceStub; - } - - // Put together the "service stub" for - // google.dataflow.v1beta3.TemplatesService. - this.templatesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.dataflow.v1beta3.TemplatesService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.dataflow.v1beta3.TemplatesService, - 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 templatesServiceStubMethods = - ['createJobFromTemplate', 'launchTemplate', 'getTemplate']; - for (const methodName of templatesServiceStubMethods) { - const callPromise = this.templatesServiceStub.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.templatesServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataflow.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 'dataflow.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/compute', - 'https://www.googleapis.com/auth/compute.readonly', - 'https://www.googleapis.com/auth/userinfo.email' - ]; - } - - 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 Cloud Dataflow job from a template. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Cloud Platform project that the job belongs to. - * @param {string} request.jobName - * Required. The job name to use for the created job. - * @param {string} request.gcsPath - * Required. A Cloud Storage path to the template from which to - * create the job. - * Must be a valid Cloud Storage URL, beginning with `gs://`. - * @param {number[]} request.parameters - * The runtime parameters to pass to the job. - * @param {google.dataflow.v1beta3.RuntimeEnvironment} request.environment - * The runtime environment for the job. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - * which to direct the 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.dataflow.v1beta3.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/templates_service.create_job_from_template.js - * region_tag:dataflow_v1beta3_generated_TemplatesService_CreateJobFromTemplate_async - */ - createJobFromTemplate( - request?: protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|undefined, {}|undefined - ]>; - createJobFromTemplate( - request: protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|null|undefined, - {}|null|undefined>): void; - createJobFromTemplate( - request: protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest, - callback: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|null|undefined, - {}|null|undefined>): void; - createJobFromTemplate( - request?: protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.IJob, - protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - }); - this.initialize(); - return this.innerApiCalls.createJobFromTemplate(request, options, callback); - } -/** - * Launch a template. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Cloud Platform project that the job belongs to. - * @param {boolean} request.validateOnly - * If true, the request is validated but not actually executed. - * Defaults to false. - * @param {string} request.gcsPath - * A Cloud Storage path to the template from which to create - * the job. - * Must be valid Cloud Storage URL, beginning with 'gs://'. - * @param {google.dataflow.v1beta3.DynamicTemplateLaunchParams} request.dynamicTemplate - * Params for launching a dynamic template. - * @param {google.dataflow.v1beta3.LaunchTemplateParameters} request.launchParameters - * The parameters of the template to launch. This should be part of the - * body of the POST request. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - * which to direct the 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.dataflow.v1beta3.LaunchTemplateResponse|LaunchTemplateResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/templates_service.launch_template.js - * region_tag:dataflow_v1beta3_generated_TemplatesService_LaunchTemplate_async - */ - launchTemplate( - request?: protos.google.dataflow.v1beta3.ILaunchTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.ILaunchTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchTemplateRequest|undefined, {}|undefined - ]>; - launchTemplate( - request: protos.google.dataflow.v1beta3.ILaunchTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.ILaunchTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchTemplateRequest|null|undefined, - {}|null|undefined>): void; - launchTemplate( - request: protos.google.dataflow.v1beta3.ILaunchTemplateRequest, - callback: Callback< - protos.google.dataflow.v1beta3.ILaunchTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchTemplateRequest|null|undefined, - {}|null|undefined>): void; - launchTemplate( - request?: protos.google.dataflow.v1beta3.ILaunchTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.ILaunchTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.ILaunchTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.ILaunchTemplateResponse, - protos.google.dataflow.v1beta3.ILaunchTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - }); - this.initialize(); - return this.innerApiCalls.launchTemplate(request, options, callback); - } -/** - * Get the template associated with a template. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Cloud Platform project that the job belongs to. - * @param {string} request.gcsPath - * Required. A Cloud Storage path to the template from which to - * create the job. - * Must be valid Cloud Storage URL, beginning with 'gs://'. - * @param {google.dataflow.v1beta3.GetTemplateRequest.TemplateView} request.view - * The view to retrieve. Defaults to METADATA_ONLY. - * @param {string} request.location - * The [regional endpoint] - * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to - * which to direct the 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.dataflow.v1beta3.GetTemplateResponse|GetTemplateResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta3/templates_service.get_template.js - * region_tag:dataflow_v1beta3_generated_TemplatesService_GetTemplate_async - */ - getTemplate( - request?: protos.google.dataflow.v1beta3.IGetTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.dataflow.v1beta3.IGetTemplateResponse, - protos.google.dataflow.v1beta3.IGetTemplateRequest|undefined, {}|undefined - ]>; - getTemplate( - request: protos.google.dataflow.v1beta3.IGetTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.dataflow.v1beta3.IGetTemplateResponse, - protos.google.dataflow.v1beta3.IGetTemplateRequest|null|undefined, - {}|null|undefined>): void; - getTemplate( - request: protos.google.dataflow.v1beta3.IGetTemplateRequest, - callback: Callback< - protos.google.dataflow.v1beta3.IGetTemplateResponse, - protos.google.dataflow.v1beta3.IGetTemplateRequest|null|undefined, - {}|null|undefined>): void; - getTemplate( - request?: protos.google.dataflow.v1beta3.IGetTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.dataflow.v1beta3.IGetTemplateResponse, - protos.google.dataflow.v1beta3.IGetTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.dataflow.v1beta3.IGetTemplateResponse, - protos.google.dataflow.v1beta3.IGetTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.dataflow.v1beta3.IGetTemplateResponse, - protos.google.dataflow.v1beta3.IGetTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'location': request.location ?? '', - }); - this.initialize(); - return this.innerApiCalls.getTemplate(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.templatesServiceStub && !this._terminated) { - return this.templatesServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client_config.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client_config.json deleted file mode 100644 index eb6364e00fd..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_client_config.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "interfaces": { - "google.dataflow.v1beta3.TemplatesService": { - "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": { - "CreateJobFromTemplate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "LaunchTemplate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetTemplate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_proto_list.json b/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_proto_list.json deleted file mode 100644 index cd5511e4fd8..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/src/v1beta3/templates_service_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/dataflow/v1beta3/environment.proto", - "../../protos/google/dataflow/v1beta3/jobs.proto", - "../../protos/google/dataflow/v1beta3/messages.proto", - "../../protos/google/dataflow/v1beta3/metrics.proto", - "../../protos/google/dataflow/v1beta3/snapshots.proto", - "../../protos/google/dataflow/v1beta3/streaming.proto", - "../../protos/google/dataflow/v1beta3/templates.proto" -] diff --git a/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.js deleted file mode 100644 index dbccacefab2..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.js +++ /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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const dataflow = require('@google-cloud/dataflow'); - -function main() { - const flexTemplatesServiceClient = new dataflow.FlexTemplatesServiceClient(); - const jobsV1Beta3Client = new dataflow.JobsV1Beta3Client(); - const messagesV1Beta3Client = new dataflow.MessagesV1Beta3Client(); - const metricsV1Beta3Client = new dataflow.MetricsV1Beta3Client(); - const snapshotsV1Beta3Client = new dataflow.SnapshotsV1Beta3Client(); - const templatesServiceClient = new dataflow.TemplatesServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index c6b4898e028..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/system-test/fixtures/sample/src/index.ts +++ /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. ** - -import {FlexTemplatesServiceClient, JobsV1Beta3Client, MessagesV1Beta3Client, MetricsV1Beta3Client, SnapshotsV1Beta3Client, TemplatesServiceClient} from '@google-cloud/dataflow'; - -// check that the client class type name can be used -function doStuffWithFlexTemplatesServiceClient(client: FlexTemplatesServiceClient) { - client.close(); -} -function doStuffWithJobsV1Beta3Client(client: JobsV1Beta3Client) { - client.close(); -} -function doStuffWithMessagesV1Beta3Client(client: MessagesV1Beta3Client) { - client.close(); -} -function doStuffWithMetricsV1Beta3Client(client: MetricsV1Beta3Client) { - client.close(); -} -function doStuffWithSnapshotsV1Beta3Client(client: SnapshotsV1Beta3Client) { - client.close(); -} -function doStuffWithTemplatesServiceClient(client: TemplatesServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const flexTemplatesServiceClient = new FlexTemplatesServiceClient(); - doStuffWithFlexTemplatesServiceClient(flexTemplatesServiceClient); - // check that the client instance can be created - const jobsV1Beta3Client = new JobsV1Beta3Client(); - doStuffWithJobsV1Beta3Client(jobsV1Beta3Client); - // check that the client instance can be created - const messagesV1Beta3Client = new MessagesV1Beta3Client(); - doStuffWithMessagesV1Beta3Client(messagesV1Beta3Client); - // check that the client instance can be created - const metricsV1Beta3Client = new MetricsV1Beta3Client(); - doStuffWithMetricsV1Beta3Client(metricsV1Beta3Client); - // check that the client instance can be created - const snapshotsV1Beta3Client = new SnapshotsV1Beta3Client(); - doStuffWithSnapshotsV1Beta3Client(snapshotsV1Beta3Client); - // check that the client instance can be created - const templatesServiceClient = new TemplatesServiceClient(); - doStuffWithTemplatesServiceClient(templatesServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-dataflow/v1beta3/system-test/install.ts b/owl-bot-staging/google-dataflow/v1beta3/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/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-dataflow/v1beta3/test/gapic_flex_templates_service_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_flex_templates_service_v1beta3.ts deleted file mode 100644 index 0a9d1a7e75a..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_flex_templates_service_v1beta3.ts +++ /dev/null @@ -1,270 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 flextemplatesserviceModule 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('v1beta3.FlexTemplatesServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.flexTemplatesServiceStub, undefined); - await client.initialize(); - assert(client.flexTemplatesServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.flexTemplatesServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.flexTemplatesServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ - 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 flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ - 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('launchFlexTemplate', () => { - it('invokes launchFlexTemplate without error', async () => { - const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchFlexTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchFlexTemplateResponse() - ); - client.innerApiCalls.launchFlexTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.launchFlexTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.launchFlexTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.launchFlexTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes launchFlexTemplate without error using callback', async () => { - const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchFlexTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchFlexTemplateResponse() - ); - client.innerApiCalls.launchFlexTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.launchFlexTemplate( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.ILaunchFlexTemplateResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.launchFlexTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.launchFlexTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes launchFlexTemplate with error', async () => { - const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchFlexTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.launchFlexTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.launchFlexTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.launchFlexTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.launchFlexTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes launchFlexTemplate with closed client', async () => { - const client = new flextemplatesserviceModule.v1beta3.FlexTemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchFlexTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchFlexTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.launchFlexTemplate(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_jobs_v1_beta3_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_jobs_v1_beta3_v1beta3.ts deleted file mode 100644 index a10d5f193aa..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_jobs_v1_beta3_v1beta3.ts +++ /dev/null @@ -1,1299 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 jobsv1beta3Module 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('v1beta3.JobsV1Beta3Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = jobsv1beta3Module.v1beta3.JobsV1Beta3Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = jobsv1beta3Module.v1beta3.JobsV1Beta3Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = jobsv1beta3Module.v1beta3.JobsV1Beta3Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.jobsV1Beta3Stub, undefined); - await client.initialize(); - assert(client.jobsV1Beta3Stub); - }); - - it('has close method for the initialized client', done => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.jobsV1Beta3Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.jobsV1Beta3Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - 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 jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - 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('createJob', () => { - it('invokes createJob without error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CreateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Job() - ); - client.innerApiCalls.createJob = stubSimpleCall(expectedResponse); - const [response] = await client.createJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJob without error using callback', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CreateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Job() - ); - client.innerApiCalls.createJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createJob( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJob with error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CreateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createJob(request), expectedError); - const actualRequest = (client.innerApiCalls.createJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJob with closed client', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CreateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobRequest', ['location']); - request.location = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createJob(request), expectedError); - }); - }); - - describe('getJob', () => { - it('invokes getJob without error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Job() - ); - client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); - const [response] = await client.getJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob without error using callback', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Job() - ); - client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJob( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob with error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob with closed client', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getJob(request), expectedError); - }); - }); - - describe('updateJob', () => { - it('invokes updateJob without error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.UpdateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Job() - ); - client.innerApiCalls.updateJob = stubSimpleCall(expectedResponse); - const [response] = await client.updateJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJob without error using callback', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.UpdateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Job() - ); - client.innerApiCalls.updateJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateJob( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJob with error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.UpdateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateJob(request), expectedError); - const actualRequest = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJob with closed client', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.UpdateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.UpdateJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateJob(request), expectedError); - }); - }); - - describe('checkActiveJobs', () => { - it('invokes checkActiveJobs without error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CheckActiveJobsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.CheckActiveJobsResponse() - ); - client.innerApiCalls.checkActiveJobs = stubSimpleCall(expectedResponse); - const [response] = await client.checkActiveJobs(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes checkActiveJobs without error using callback', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CheckActiveJobsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.CheckActiveJobsResponse() - ); - client.innerApiCalls.checkActiveJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.checkActiveJobs( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.ICheckActiveJobsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes checkActiveJobs with error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CheckActiveJobsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.checkActiveJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkActiveJobs(request), expectedError); - }); - - it('invokes checkActiveJobs with closed client', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CheckActiveJobsRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.checkActiveJobs(request), expectedError); - }); - }); - - describe('snapshotJob', () => { - it('invokes snapshotJob without error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.SnapshotJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Snapshot() - ); - client.innerApiCalls.snapshotJob = stubSimpleCall(expectedResponse); - const [response] = await client.snapshotJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.snapshotJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.snapshotJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes snapshotJob without error using callback', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.SnapshotJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Snapshot() - ); - client.innerApiCalls.snapshotJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.snapshotJob( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.ISnapshot|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.snapshotJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.snapshotJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes snapshotJob with error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.SnapshotJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.snapshotJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.snapshotJob(request), expectedError); - const actualRequest = (client.innerApiCalls.snapshotJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.snapshotJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes snapshotJob with closed client', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.SnapshotJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.SnapshotJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.snapshotJob(request), expectedError); - }); - }); - - describe('listJobs', () => { - it('invokes listJobs without error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`;const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - ]; - client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobs without error using callback', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`;const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - ]; - client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobs( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobs with error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobsStream without error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - ]; - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.dataflow.v1beta3.Job[] = []; - stream.on('data', (response: protos.google.dataflow.v1beta3.Job) => { - 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.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listJobsStream with error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.dataflow.v1beta3.Job[] = []; - stream.on('data', (response: protos.google.dataflow.v1beta3.Job) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobs without error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - ]; - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.dataflow.v1beta3.IJob[] = []; - const iterable = client.listJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobs with error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.dataflow.v1beta3.IJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('aggregatedListJobs', () => { - it('invokes aggregatedListJobs without error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - ]; - client.innerApiCalls.aggregatedListJobs = stubSimpleCall(expectedResponse); - const [response] = await client.aggregatedListJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.aggregatedListJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.aggregatedListJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes aggregatedListJobs without error using callback', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - ]; - client.innerApiCalls.aggregatedListJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.aggregatedListJobs( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.aggregatedListJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.aggregatedListJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes aggregatedListJobs with error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.aggregatedListJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.aggregatedListJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.aggregatedListJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.aggregatedListJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes aggregatedListJobsStream without error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - ]; - client.descriptors.page.aggregatedListJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.aggregatedListJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.dataflow.v1beta3.Job[] = []; - stream.on('data', (response: protos.google.dataflow.v1beta3.Job) => { - 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.aggregatedListJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.aggregatedListJobs, request)); - assert( - (client.descriptors.page.aggregatedListJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes aggregatedListJobsStream with error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.aggregatedListJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.aggregatedListJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.dataflow.v1beta3.Job[] = []; - stream.on('data', (response: protos.google.dataflow.v1beta3.Job) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.aggregatedListJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.aggregatedListJobs, request)); - assert( - (client.descriptors.page.aggregatedListJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with aggregatedListJobs without error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - generateSampleMessage(new protos.google.dataflow.v1beta3.Job()), - ]; - client.descriptors.page.aggregatedListJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.dataflow.v1beta3.IJob[] = []; - const iterable = client.aggregatedListJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.aggregatedListJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.aggregatedListJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with aggregatedListJobs with error', async () => { - const client = new jobsv1beta3Module.v1beta3.JobsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.aggregatedListJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.aggregatedListJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.dataflow.v1beta3.IJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.aggregatedListJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.aggregatedListJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_messages_v1_beta3_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_messages_v1_beta3_v1beta3.ts deleted file mode 100644 index 00c84afae99..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_messages_v1_beta3_v1beta3.ts +++ /dev/null @@ -1,484 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 messagesv1beta3Module 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('v1beta3.MessagesV1Beta3Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = messagesv1beta3Module.v1beta3.MessagesV1Beta3Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = messagesv1beta3Module.v1beta3.MessagesV1Beta3Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = messagesv1beta3Module.v1beta3.MessagesV1Beta3Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.messagesV1Beta3Stub, undefined); - await client.initialize(); - assert(client.messagesV1Beta3Stub); - }); - - it('has close method for the initialized client', done => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.messagesV1Beta3Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.messagesV1Beta3Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - 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 messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - 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('listJobMessages', () => { - it('invokes listJobMessages without error', async () => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobMessagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`;const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - ]; - client.innerApiCalls.listJobMessages = stubSimpleCall(expectedResponse); - const [response] = await client.listJobMessages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobMessages without error using callback', async () => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobMessagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`;const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - ]; - client.innerApiCalls.listJobMessages = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobMessages( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJobMessage[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobMessages with error', async () => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobMessagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobMessages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobMessages(request), expectedError); - const actualRequest = (client.innerApiCalls.listJobMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobMessagesStream without error', async () => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobMessagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - ]; - client.descriptors.page.listJobMessages.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobMessagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.dataflow.v1beta3.JobMessage[] = []; - stream.on('data', (response: protos.google.dataflow.v1beta3.JobMessage) => { - 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.listJobMessages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobMessages, request)); - assert( - (client.descriptors.page.listJobMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listJobMessagesStream with error', async () => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobMessagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobMessages.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobMessagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.dataflow.v1beta3.JobMessage[] = []; - stream.on('data', (response: protos.google.dataflow.v1beta3.JobMessage) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobMessages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobMessages, request)); - assert( - (client.descriptors.page.listJobMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobMessages without error', async () => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobMessagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - generateSampleMessage(new protos.google.dataflow.v1beta3.JobMessage()), - ]; - client.descriptors.page.listJobMessages.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.dataflow.v1beta3.IJobMessage[] = []; - const iterable = client.listJobMessagesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobMessages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobMessages with error', async () => { - const client = new messagesv1beta3Module.v1beta3.MessagesV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListJobMessagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListJobMessagesRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobMessages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobMessagesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.dataflow.v1beta3.IJobMessage[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobMessages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_metrics_v1_beta3_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_metrics_v1_beta3_v1beta3.ts deleted file mode 100644 index 32c776f40b6..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_metrics_v1_beta3_v1beta3.ts +++ /dev/null @@ -1,924 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 metricsv1beta3Module 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('v1beta3.MetricsV1Beta3Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = metricsv1beta3Module.v1beta3.MetricsV1Beta3Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = metricsv1beta3Module.v1beta3.MetricsV1Beta3Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = metricsv1beta3Module.v1beta3.MetricsV1Beta3Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricsV1Beta3Stub, undefined); - await client.initialize(); - assert(client.metricsV1Beta3Stub); - }); - - it('has close method for the initialized client', done => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.metricsV1Beta3Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricsV1Beta3Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - 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 metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - 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('getJobMetrics', () => { - it('invokes getJobMetrics without error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.JobMetrics() - ); - client.innerApiCalls.getJobMetrics = stubSimpleCall(expectedResponse); - const [response] = await client.getJobMetrics(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJobMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobMetrics without error using callback', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.JobMetrics() - ); - client.innerApiCalls.getJobMetrics = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJobMetrics( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJobMetrics|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJobMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobMetrics with error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getJobMetrics = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJobMetrics(request), expectedError); - const actualRequest = (client.innerApiCalls.getJobMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobMetrics with closed client', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobMetricsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getJobMetrics(request), expectedError); - }); - }); - - describe('getJobExecutionDetails', () => { - it('invokes getJobExecutionDetails without error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`;const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - ]; - client.innerApiCalls.getJobExecutionDetails = stubSimpleCall(expectedResponse); - const [response] = await client.getJobExecutionDetails(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJobExecutionDetails as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobExecutionDetails as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobExecutionDetails without error using callback', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`;const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - ]; - client.innerApiCalls.getJobExecutionDetails = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJobExecutionDetails( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IStageSummary[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJobExecutionDetails as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobExecutionDetails as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobExecutionDetails with error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getJobExecutionDetails = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJobExecutionDetails(request), expectedError); - const actualRequest = (client.innerApiCalls.getJobExecutionDetails as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobExecutionDetails as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobExecutionDetailsStream without error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - ]; - client.descriptors.page.getJobExecutionDetails.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.getJobExecutionDetailsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.dataflow.v1beta3.StageSummary[] = []; - stream.on('data', (response: protos.google.dataflow.v1beta3.StageSummary) => { - 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.getJobExecutionDetails.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.getJobExecutionDetails, request)); - assert( - (client.descriptors.page.getJobExecutionDetails.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes getJobExecutionDetailsStream with error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.descriptors.page.getJobExecutionDetails.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.getJobExecutionDetailsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.dataflow.v1beta3.StageSummary[] = []; - stream.on('data', (response: protos.google.dataflow.v1beta3.StageSummary) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.getJobExecutionDetails.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.getJobExecutionDetails, request)); - assert( - (client.descriptors.page.getJobExecutionDetails.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with getJobExecutionDetails without error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - generateSampleMessage(new protos.google.dataflow.v1beta3.StageSummary()), - ]; - client.descriptors.page.getJobExecutionDetails.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.dataflow.v1beta3.IStageSummary[] = []; - const iterable = client.getJobExecutionDetailsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.getJobExecutionDetails.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.getJobExecutionDetails.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with getJobExecutionDetails with error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetJobExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetJobExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.descriptors.page.getJobExecutionDetails.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.getJobExecutionDetailsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.dataflow.v1beta3.IStageSummary[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.getJobExecutionDetails.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.getJobExecutionDetails.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('getStageExecutionDetails', () => { - it('invokes getStageExecutionDetails without error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); - request.stageId = defaultValue4; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`;const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - ]; - client.innerApiCalls.getStageExecutionDetails = stubSimpleCall(expectedResponse); - const [response] = await client.getStageExecutionDetails(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStageExecutionDetails as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStageExecutionDetails as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStageExecutionDetails without error using callback', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); - request.stageId = defaultValue4; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`;const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - ]; - client.innerApiCalls.getStageExecutionDetails = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getStageExecutionDetails( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IWorkerDetails[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStageExecutionDetails as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStageExecutionDetails as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStageExecutionDetails with error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); - request.stageId = defaultValue4; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getStageExecutionDetails = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getStageExecutionDetails(request), expectedError); - const actualRequest = (client.innerApiCalls.getStageExecutionDetails as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStageExecutionDetails as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStageExecutionDetailsStream without error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); - request.stageId = defaultValue4; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - ]; - client.descriptors.page.getStageExecutionDetails.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.getStageExecutionDetailsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.dataflow.v1beta3.WorkerDetails[] = []; - stream.on('data', (response: protos.google.dataflow.v1beta3.WorkerDetails) => { - 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.getStageExecutionDetails.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.getStageExecutionDetails, request)); - assert( - (client.descriptors.page.getStageExecutionDetails.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes getStageExecutionDetailsStream with error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); - request.stageId = defaultValue4; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.descriptors.page.getStageExecutionDetails.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.getStageExecutionDetailsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.dataflow.v1beta3.WorkerDetails[] = []; - stream.on('data', (response: protos.google.dataflow.v1beta3.WorkerDetails) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.getStageExecutionDetails.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.getStageExecutionDetails, request)); - assert( - (client.descriptors.page.getStageExecutionDetails.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with getStageExecutionDetails without error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); - request.stageId = defaultValue4; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - generateSampleMessage(new protos.google.dataflow.v1beta3.WorkerDetails()), - ]; - client.descriptors.page.getStageExecutionDetails.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.dataflow.v1beta3.IWorkerDetails[] = []; - const iterable = client.getStageExecutionDetailsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.getStageExecutionDetails.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.getStageExecutionDetails.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with getStageExecutionDetails with error', async () => { - const client = new metricsv1beta3Module.v1beta3.MetricsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetStageExecutionDetailsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['jobId']); - request.jobId = defaultValue3; - const defaultValue4 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetStageExecutionDetailsRequest', ['stageId']); - request.stageId = defaultValue4; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}&stage_id=${defaultValue4}`; - const expectedError = new Error('expected'); - client.descriptors.page.getStageExecutionDetails.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.getStageExecutionDetailsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.dataflow.v1beta3.IWorkerDetails[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.getStageExecutionDetails.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.getStageExecutionDetails.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_snapshots_v1_beta3_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_snapshots_v1_beta3_v1beta3.ts deleted file mode 100644 index 30d116f9eaf..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_snapshots_v1_beta3_v1beta3.ts +++ /dev/null @@ -1,546 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 snapshotsv1beta3Module 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('v1beta3.SnapshotsV1Beta3Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.snapshotsV1Beta3Stub, undefined); - await client.initialize(); - assert(client.snapshotsV1Beta3Stub); - }); - - it('has close method for the initialized client', done => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.snapshotsV1Beta3Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.snapshotsV1Beta3Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - 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 snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - 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('getSnapshot', () => { - it('invokes getSnapshot without error', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetSnapshotRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['snapshotId']); - request.snapshotId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Snapshot() - ); - client.innerApiCalls.getSnapshot = stubSimpleCall(expectedResponse); - const [response] = await client.getSnapshot(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSnapshot without error using callback', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetSnapshotRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['snapshotId']); - request.snapshotId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Snapshot() - ); - client.innerApiCalls.getSnapshot = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSnapshot( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.ISnapshot|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSnapshot with error', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetSnapshotRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['snapshotId']); - request.snapshotId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSnapshot = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSnapshot(request), expectedError); - const actualRequest = (client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSnapshot with closed client', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetSnapshotRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetSnapshotRequest', ['snapshotId']); - request.snapshotId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSnapshot(request), expectedError); - }); - }); - - describe('deleteSnapshot', () => { - it('invokes deleteSnapshot without error', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.DeleteSnapshotRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['snapshotId']); - request.snapshotId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.DeleteSnapshotResponse() - ); - client.innerApiCalls.deleteSnapshot = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSnapshot(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSnapshot without error using callback', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.DeleteSnapshotRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['snapshotId']); - request.snapshotId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.DeleteSnapshotResponse() - ); - client.innerApiCalls.deleteSnapshot = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSnapshot( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IDeleteSnapshotResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSnapshot with error', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.DeleteSnapshotRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['snapshotId']); - request.snapshotId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&snapshot_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSnapshot = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSnapshot(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSnapshot with closed client', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.DeleteSnapshotRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.DeleteSnapshotRequest', ['snapshotId']); - request.snapshotId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSnapshot(request), expectedError); - }); - }); - - describe('listSnapshots', () => { - it('invokes listSnapshots without error', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListSnapshotsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListSnapshotsResponse() - ); - client.innerApiCalls.listSnapshots = stubSimpleCall(expectedResponse); - const [response] = await client.listSnapshots(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSnapshots without error using callback', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListSnapshotsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListSnapshotsResponse() - ); - client.innerApiCalls.listSnapshots = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSnapshots( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IListSnapshotsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSnapshots with error', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListSnapshotsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSnapshots = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSnapshots(request), expectedError); - const actualRequest = (client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSnapshots with closed client', async () => { - const client = new snapshotsv1beta3Module.v1beta3.SnapshotsV1Beta3Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.ListSnapshotsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['location']); - request.location = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.dataflow.v1beta3.ListSnapshotsRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listSnapshots(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_templates_service_v1beta3.ts b/owl-bot-staging/google-dataflow/v1beta3/test/gapic_templates_service_v1beta3.ts deleted file mode 100644 index bac60f334d6..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/test/gapic_templates_service_v1beta3.ts +++ /dev/null @@ -1,510 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 templatesserviceModule 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('v1beta3.TemplatesServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = templatesserviceModule.v1beta3.TemplatesServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = templatesserviceModule.v1beta3.TemplatesServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = templatesserviceModule.v1beta3.TemplatesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.templatesServiceStub, undefined); - await client.initialize(); - assert(client.templatesServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.templatesServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.templatesServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - 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 templatesserviceModule.v1beta3.TemplatesServiceClient({ - 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('createJobFromTemplate', () => { - it('invokes createJobFromTemplate without error', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CreateJobFromTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Job() - ); - client.innerApiCalls.createJobFromTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.createJobFromTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createJobFromTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobFromTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobFromTemplate without error using callback', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CreateJobFromTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.Job() - ); - client.innerApiCalls.createJobFromTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createJobFromTemplate( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createJobFromTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobFromTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobFromTemplate with error', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CreateJobFromTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createJobFromTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createJobFromTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.createJobFromTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobFromTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobFromTemplate with closed client', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.CreateJobFromTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.CreateJobFromTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createJobFromTemplate(request), expectedError); - }); - }); - - describe('launchTemplate', () => { - it('invokes launchTemplate without error', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchTemplateResponse() - ); - client.innerApiCalls.launchTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.launchTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.launchTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.launchTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes launchTemplate without error using callback', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchTemplateResponse() - ); - client.innerApiCalls.launchTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.launchTemplate( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.ILaunchTemplateResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.launchTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.launchTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes launchTemplate with error', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.launchTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.launchTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.launchTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.launchTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes launchTemplate with closed client', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.LaunchTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.LaunchTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.launchTemplate(request), expectedError); - }); - }); - - describe('getTemplate', () => { - it('invokes getTemplate without error', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetTemplateResponse() - ); - client.innerApiCalls.getTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.getTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTemplate without error using callback', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetTemplateResponse() - ); - client.innerApiCalls.getTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTemplate( - request, - (err?: Error|null, result?: protos.google.dataflow.v1beta3.IGetTemplateResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTemplate with error', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&location=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.getTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTemplate with closed client', async () => { - const client = new templatesserviceModule.v1beta3.TemplatesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.dataflow.v1beta3.GetTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.dataflow.v1beta3.GetTemplateRequest', ['location']); - request.location = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getTemplate(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-dataflow/v1beta3/tsconfig.json b/owl-bot-staging/google-dataflow/v1beta3/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/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-dataflow/v1beta3/webpack.config.js b/owl-bot-staging/google-dataflow/v1beta3/webpack.config.js deleted file mode 100644 index 4b976b9a2bb..00000000000 --- a/owl-bot-staging/google-dataflow/v1beta3/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: 'FlexTemplatesService', - filename: './flex-templates-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-devtools-artifactregistry/v1/.eslintignore b/owl-bot-staging/google-devtools-artifactregistry/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1/.eslintrc.json b/owl-bot-staging/google-devtools-artifactregistry/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/.gitignore b/owl-bot-staging/google-devtools-artifactregistry/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1/.jsdoc.js b/owl-bot-staging/google-devtools-artifactregistry/v1/.jsdoc.js deleted file mode 100644 index 532a80143b5..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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/artifact-registry', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/.mocharc.js b/owl-bot-staging/google-devtools-artifactregistry/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1/.prettierrc.js b/owl-bot-staging/google-devtools-artifactregistry/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1/README.md b/owl-bot-staging/google-devtools-artifactregistry/v1/README.md deleted file mode 100644 index 123ed7c7a23..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Artifactregistry: Nodejs Client diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/package.json b/owl-bot-staging/google-devtools-artifactregistry/v1/package.json deleted file mode 100644 index 6810984ffda..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/artifact-registry", - "version": "0.1.0", - "description": "Artifactregistry client for Node.js", - "repository": "googleapis/nodejs-artifactregistry", - "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 artifactregistry", - "artifactregistry", - "artifact registry" - ], - "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-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/apt_artifact.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/apt_artifact.proto deleted file mode 100644 index 68e63ff42e2..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/apt_artifact.proto +++ /dev/null @@ -1,114 +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.devtools.artifactregistry.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "AptArtifactProto"; -option java_package = "com.google.devtools.artifactregistry.v1"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; - -// A detailed representation of an Apt artifact. Information in the record -// is derived from the archive's control file. -// See https://www.debian.org/doc/debian-policy/ch-controlfields.html -message AptArtifact { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/AptArtifact" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}" - }; - - // Package type is either binary or source. - enum PackageType { - // Package type is not specified. - PACKAGE_TYPE_UNSPECIFIED = 0; - - // Binary package. - BINARY = 1; - - // Source package. - SOURCE = 2; - } - - // Output only. The Artifact Registry resource name of the artifact. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Apt package name of the artifact. - string package_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. An artifact is a binary or source package. - PackageType package_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Operating system architecture of the artifact. - string architecture = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Repository component of the artifact. - string component = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Contents of the artifact's control metadata file. - bytes control_file = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Google Cloud Storage location where the artifacts currently reside. -message ImportAptArtifactsGcsSource { - // Cloud Storage paths URI (e.g., gs://my_bucket//my_object). - repeated string uris = 1; - - // Supports URI wildcards for matching multiple objects from a single URI. - bool use_wildcards = 2; -} - -// The request to import new apt artifacts. -message ImportAptArtifactsRequest { - // The source location of the package binaries. - oneof source { - // Google Cloud Storage location where input content is located. - ImportAptArtifactsGcsSource gcs_source = 2; - } - - // The name of the parent resource where the artifacts will be imported. - string parent = 1; -} - -// Error information explaining why a package was not imported. -message ImportAptArtifactsErrorInfo { - // The source that was not imported. - oneof source { - // Google Cloud Storage location requested. - ImportAptArtifactsGcsSource gcs_source = 1; - } - - // The detailed error status. - google.rpc.Status error = 2; -} - -// The response message from importing APT artifacts. -message ImportAptArtifactsResponse { - // The Apt artifacts imported. - repeated AptArtifact apt_artifacts = 1; - - // Detailed error info for packages that were not imported. - repeated ImportAptArtifactsErrorInfo errors = 2; -} - -// The operation metadata for importing artifacts. -message ImportAptArtifactsMetadata {} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/artifact.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/artifact.proto deleted file mode 100644 index 58b3a480384..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/artifact.proto +++ /dev/null @@ -1,355 +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.devtools.artifactregistry.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "ArtifactProto"; -option java_package = "com.google.devtools.artifactregistry.v1"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; - -// DockerImage represents a docker artifact. -// The following fields are returned as untyped metadata in the Version -// resource, using camelcase keys (i.e. metadata.imageSizeBytes): -// * imageSizeBytes -// * mediaType -// * buildTime -message DockerImage { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/DockerImage" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/dockerImages/{docker_image}" - }; - - // Required. registry_location, project_id, repository_name and image id forms - // a unique image - // name:`projects//locations//repository//dockerImages/`. - // For example, - // "projects/test-project/locations/us-west4/repositories/test-repo/dockerImages/ - // nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf", - // where "us-west4" is the registry_location, "test-project" is the - // project_id, "test-repo" is the repository_name and - // "nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf" - // is the image's digest. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. URL to access the image. - // Example: - // us-west4-docker.pkg.dev/test-project/test-repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - string uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // Tags attached to this image. - repeated string tags = 3; - - // Calculated size of the image. - // This field is returned as the 'metadata.imageSizeBytes' field in the - // Version resource. - int64 image_size_bytes = 4; - - // Time the image was uploaded. - google.protobuf.Timestamp upload_time = 5; - - // Media type of this image, e.g. - // "application/vnd.docker.distribution.manifest.v2+json". - // This field is returned as the 'metadata.mediaType' field in the - // Version resource. - string media_type = 6; - - // The time this image was built. - // This field is returned as the 'metadata.buildTime' field in the - // Version resource. - // The build time is returned to the client as an RFC 3339 string, which can - // be easily used with the JavaScript Date constructor. - google.protobuf.Timestamp build_time = 7; - - // Output only. The time when the docker image was last updated. - google.protobuf.Timestamp update_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request to list docker images. -message ListDockerImagesRequest { - // Required. The name of the parent resource whose docker images will be - // listed. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of artifacts to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; - - // The field to order the results by. - string order_by = 4; -} - -// The response from listing docker images. -message ListDockerImagesResponse { - // The docker images returned. - repeated DockerImage docker_images = 1; - - // The token to retrieve the next page of artifacts, or empty if there are no - // more artifacts to return. - string next_page_token = 2; -} - -// The request to get docker images. -message GetDockerImageRequest { - // Required. The name of the docker images. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/DockerImage" - } - ]; -} - -// MavenArtifact represents a maven artifact. -message MavenArtifact { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/MavenArtifact" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/mavenArtifacts/{maven_artifact}" - }; - - // Required. registry_location, project_id, repository_name and maven_artifact - // forms a unique artifact For example, - // "projects/test-project/locations/us-west4/repositories/test-repo/mavenArtifacts/ - // com.google.guava:guava:31.0-jre", - // where "us-west4" is the registry_location, "test-project" is the - // project_id, "test-repo" is the repository_name and - // "com.google.guava:guava:31.0-jre" - // is the maven artifact. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. URL to access the pom file of the artifact. - // Example: - // us-west4-maven.pkg.dev/test-project/test-repo/com/google/guava/guava/31.0/guava-31.0.pom - string pom_uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // Group ID for the artifact. - // Example: - // com.google.guava - string group_id = 3; - - // Artifact ID for the artifact. - string artifact_id = 4; - - // Version of this artifact. - string version = 5; - - // Output only. Time the artifact was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time the artifact was updated. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request to list maven artifacts. -message ListMavenArtifactsRequest { - // Required. The name of the parent resource whose maven artifacts will be - // listed. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "artifactregistry.googleapis.com/MavenArtifact" - } - ]; - - // The maximum number of artifacts to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; -} - -// The response from listing maven artifacts. -message ListMavenArtifactsResponse { - // The maven artifacts returned. - repeated MavenArtifact maven_artifacts = 1; - - // The token to retrieve the next page of artifacts, or empty if there are no - // more artifacts to return. - string next_page_token = 2; -} - -// The request to get maven artifacts. -message GetMavenArtifactRequest { - // Required. The name of the maven artifact. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/MavenArtifact" - } - ]; -} - -// NpmPackage represents an npm artifact. -message NpmPackage { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/NpmPackage" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/npmPackages/{npm_package}" - }; - - // Required. registry_location, project_id, repository_name and npm_package - // forms a unique package For example, - // "projects/test-project/locations/us-west4/repositories/test-repo/npmPackages/ - // npm_test:1.0.0", - // where "us-west4" is the registry_location, "test-project" is the - // project_id, "test-repo" is the repository_name and - // npm_test:1.0.0" is the npm package. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Package for the artifact. - string package_name = 3; - - // Version of this package. - string version = 4; - - // Tags attached to this package. - repeated string tags = 5; - - // Output only. Time the package was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time the package was updated. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request to list npm packages. -message ListNpmPackagesRequest { - // Required. The name of the parent resource whose npm packages will be - // listed. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "artifactregistry.googleapis.com/NpmPackage" - } - ]; - - // The maximum number of artifacts to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; -} - -// The response from listing npm packages. -message ListNpmPackagesResponse { - // The npm packages returned. - repeated NpmPackage npm_packages = 1; - - // The token to retrieve the next page of artifacts, or empty if there are no - // more artifacts to return. - string next_page_token = 2; -} - -// The request to get npm packages. -message GetNpmPackageRequest { - // Required. The name of the npm package. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/NpmPackage" - } - ]; -} - -// PythonPackage represents a python artifact. -message PythonPackage { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/PythonPackage" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/pythonPackages/{python_package}" - }; - - // Required. registry_location, project_id, repository_name and python_package - // forms a unique package - // name:`projects//locations//repository//pythonPackages/`. - // For example, - // "projects/test-project/locations/us-west4/repositories/test-repo/pythonPackages/ - // python_package:1.0.0", - // where "us-west4" is the registry_location, "test-project" is the - // project_id, "test-repo" is the repository_name and - // python_package:1.0.0" is the python package. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. URL to access the package. - // Example: - // us-west4-python.pkg.dev/test-project/test-repo/python_package/file-name-1.0.0.tar.gz - string uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // Package for the artifact. - string package_name = 3; - - // Version of this package. - string version = 4; - - // Output only. Time the package was created. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time the package was updated. - google.protobuf.Timestamp update_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request to list python packages. -message ListPythonPackagesRequest { - // Required. The name of the parent resource whose python packages will be - // listed. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "artifactregistry.googleapis.com/PythonPackage" - } - ]; - - // The maximum number of artifacts to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; -} - -// The response from listing python packages. -message ListPythonPackagesResponse { - // The python packages returned. - repeated PythonPackage python_packages = 1; - - // The token to retrieve the next page of artifacts, or empty if there are no - // more artifacts to return. - string next_page_token = 2; -} - -// The request to get python packages. -message GetPythonPackageRequest { - // Required. The name of the python package. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/PythonPackage" - } - ]; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/file.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/file.proto deleted file mode 100644 index 69b27297fb8..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/file.proto +++ /dev/null @@ -1,141 +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.devtools.artifactregistry.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "FileProto"; -option java_package = "com.google.devtools.artifactregistry.v1"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; - -// A hash of file content. -message Hash { - // The algorithm used to compute the hash. - enum HashType { - // Unspecified. - HASH_TYPE_UNSPECIFIED = 0; - - // SHA256 hash. - SHA256 = 1; - - // MD5 hash. - MD5 = 2; - } - - // The algorithm used to compute the hash value. - HashType type = 1; - - // The hash value. - bytes value = 2; -} - -// Files store content that is potentially associated with Packages or Versions. -message File { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/File" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/files/{file}" - }; - - // The name of the file, for example: - // "projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt". - // If the file ID part contains slashes, they are escaped. - string name = 1; - - // The size of the File in bytes. - int64 size_bytes = 3; - - // The hashes of the file content. - repeated Hash hashes = 4; - - // Output only. The time when the File was created. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the File was last updated. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The name of the Package or Version that owns this file, if any. - string owner = 7; - - // Output only. The time when the last attempt to refresh the file's data was - // made. Only set when the repository is remote. - google.protobuf.Timestamp fetch_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request to list files. -message ListFilesRequest { - // Required. The name of the repository whose files will be listed. For - // example: "projects/p1/locations/us-central1/repositories/repo1 - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "artifactregistry.googleapis.com/File" - } - ]; - - // An expression for filtering the results of the request. Filter rules are - // case insensitive. The fields eligible for filtering are: - // - // * `name` - // * `owner` - // - // An example of using a filter: - // - // * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an - // ID starting with "a/b/". - // * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> - // Files owned by the version `1.0` in package `pkg1`. - string filter = 4; - - // The maximum number of files to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; - - // The field to order the results by. - string order_by = 5; -} - -// The response from listing files. -message ListFilesResponse { - // The files returned. - repeated File files = 1; - - // The token to retrieve the next page of files, or empty if there are no - // more files to return. - string next_page_token = 2; -} - -// The request to retrieve a file. -message GetFileRequest { - // Required. The name of the file to retrieve. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/File" - } - ]; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/package.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/package.proto deleted file mode 100644 index 0dfdf675264..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/package.proto +++ /dev/null @@ -1,101 +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.devtools.artifactregistry.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "PackageProto"; -option java_package = "com.google.devtools.artifactregistry.v1"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; - -// Packages are named collections of versions. -message Package { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/Package" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}" - }; - - // The name of the package, for example: - // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1". - // If the package ID part contains slashes, the slashes are escaped. - string name = 1; - - // The display name of the package. - string display_name = 2; - - // The time when the package was created. - google.protobuf.Timestamp create_time = 5; - - // The time when the package was last updated. This includes publishing a new - // version of the package. - google.protobuf.Timestamp update_time = 6; -} - -// The request to list packages. -message ListPackagesRequest { - // Required. The name of the parent resource whose packages will be listed. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "artifactregistry.googleapis.com/Package" - } - ]; - - // The maximum number of packages to return. Maximum page size is 1,000. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; -} - -// The response from listing packages. -message ListPackagesResponse { - // The packages returned. - repeated Package packages = 1; - - // The token to retrieve the next page of packages, or empty if there are no - // more packages to return. - string next_page_token = 2; -} - -// The request to retrieve a package. -message GetPackageRequest { - // Required. The name of the package to retrieve. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/Package" - } - ]; -} - -// The request to delete a package. -message DeletePackageRequest { - // Required. The name of the package to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/Package" - } - ]; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/repository.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/repository.proto deleted file mode 100644 index c355852d3dd..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/repository.proto +++ /dev/null @@ -1,201 +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.devtools.artifactregistry.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "RepositoryProto"; -option java_package = "com.google.devtools.artifactregistry.v1"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; - -// A Repository for storing artifacts with a specific format. -message Repository { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/Repository" - pattern: "projects/{project}/locations/{location}/repositories/{repository}" - }; - - // MavenRepositoryConfig is maven related repository details. - // Provides additional configuration details for repositories of the maven - // format type. - message MavenRepositoryConfig { - // VersionPolicy is the version policy for the repository. - enum VersionPolicy { - // VERSION_POLICY_UNSPECIFIED - the version policy is not defined. - // When the version policy is not defined, no validation is performed - // for the versions. - VERSION_POLICY_UNSPECIFIED = 0; - - // RELEASE - repository will accept only Release versions. - RELEASE = 1; - - // SNAPSHOT - repository will accept only Snapshot versions. - SNAPSHOT = 2; - } - - // The repository with this flag will allow publishing - // the same snapshot versions. - bool allow_snapshot_overwrites = 1; - - // Version policy defines the versions that the registry will accept. - VersionPolicy version_policy = 2; - } - - // A package format. - enum Format { - // Unspecified package format. - FORMAT_UNSPECIFIED = 0; - - // Docker package format. - DOCKER = 1; - - // Maven package format. - MAVEN = 2; - - // NPM package format. - NPM = 3; - - // APT package format. - APT = 5; - - // YUM package format. - YUM = 6; - - // Python package format. - PYTHON = 8; - } - - // Repository-specific configurations. - oneof format_config { - // Maven repository config contains repository level configuration - // for the repositories of maven type. - MavenRepositoryConfig maven_config = 9; - } - - // The name of the repository, for example: - // "projects/p1/locations/us-central1/repositories/repo1". - string name = 1; - - // The format of packages that are stored in the repository. - Format format = 2; - - // The user-provided description of the repository. - string description = 3; - - // Labels with user-defined metadata. - // This field may contain up to 64 entries. Label keys and values may be no - // longer than 63 characters. Label keys must begin with a lowercase letter - // and may only contain lowercase letters, numeric characters, underscores, - // and dashes. - map labels = 4; - - // The time when the repository was created. - google.protobuf.Timestamp create_time = 5; - - // The time when the repository was last updated. - google.protobuf.Timestamp update_time = 6; - - // The Cloud KMS resource name of the customer managed encryption key that's - // used to encrypt the contents of the Repository. Has the form: - // `projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key`. - // This value may not be changed after the Repository has been created. - string kms_key_name = 8; -} - -// The request to list repositories. -message ListRepositoriesRequest { - // Required. The name of the parent resource whose repositories will be listed. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "artifactregistry.googleapis.com/Repository" - } - ]; - - // The maximum number of repositories to return. Maximum page size is 1,000. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; -} - -// The response from listing repositories. -message ListRepositoriesResponse { - // The repositories returned. - repeated Repository repositories = 1; - - // The token to retrieve the next page of repositories, or empty if there are - // no more repositories to return. - string next_page_token = 2; -} - -// The request to retrieve a repository. -message GetRepositoryRequest { - // Required. The name of the repository to retrieve. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/Repository" - } - ]; -} - -// The request to create a new repository. -message CreateRepositoryRequest { - // Required. The name of the parent resource where the repository will be created. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "artifactregistry.googleapis.com/Repository" - } - ]; - - // The repository id to use for this repository. - string repository_id = 2; - - // The repository to be created. - Repository repository = 3; -} - -// The request to update a repository. -message UpdateRepositoryRequest { - // The repository that replaces the resource on the server. - Repository repository = 1; - - // The update mask applies to the resource. For the `FieldMask` definition, - // see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 2; -} - -// The request to delete a repository. -message DeleteRepositoryRequest { - // Required. The name of the repository to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/Repository" - } - ]; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/service.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/service.proto deleted file mode 100644 index 5edda67a5dc..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/service.proto +++ /dev/null @@ -1,400 +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.devtools.artifactregistry.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/devtools/artifactregistry/v1/apt_artifact.proto"; -import "google/devtools/artifactregistry/v1/artifact.proto"; -import "google/devtools/artifactregistry/v1/file.proto"; -import "google/devtools/artifactregistry/v1/package.proto"; -import "google/devtools/artifactregistry/v1/repository.proto"; -import "google/devtools/artifactregistry/v1/settings.proto"; -import "google/devtools/artifactregistry/v1/tag.proto"; -import "google/devtools/artifactregistry/v1/version.proto"; -import "google/devtools/artifactregistry/v1/vpcsc_config.proto"; -import "google/devtools/artifactregistry/v1/yum_artifact.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "ServiceProto"; -option java_package = "com.google.devtools.artifactregistry.v1"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; - -// The Artifact Registry API service. -// -// Artifact Registry is an artifact management system for storing artifacts -// from different package management systems. -// -// The resources managed by this API are: -// -// * Repositories, which group packages and their data. -// * Packages, which group versions and their tags. -// * Versions, which are specific forms of a package. -// * Tags, which represent alternative names for versions. -// * Files, which contain content and are optionally associated with a Package -// or Version. -service ArtifactRegistry { - option (google.api.default_host) = "artifactregistry.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Lists docker images. - rpc ListDockerImages(ListDockerImagesRequest) - returns (ListDockerImagesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/repositories/*}/dockerImages" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a docker image. - rpc GetDockerImage(GetDockerImageRequest) returns (DockerImage) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/repositories/*/dockerImages/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists maven artifacts. - rpc ListMavenArtifacts(ListMavenArtifactsRequest) - returns (ListMavenArtifactsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/repositories/*}/mavenArtifacts" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a maven artifact. - rpc GetMavenArtifact(GetMavenArtifactRequest) returns (MavenArtifact) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/repositories/*/mavenArtifacts/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists npm packages. - rpc ListNpmPackages(ListNpmPackagesRequest) - returns (ListNpmPackagesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/repositories/*}/npmPackages" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a npm package. - rpc GetNpmPackage(GetNpmPackageRequest) returns (NpmPackage) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/repositories/*/npmPackages/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists python packages. - rpc ListPythonPackages(ListPythonPackagesRequest) - returns (ListPythonPackagesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/repositories/*}/pythonPackages" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a python package. - rpc GetPythonPackage(GetPythonPackageRequest) returns (PythonPackage) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/repositories/*/pythonPackages/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Imports Apt artifacts. The returned Operation will complete once the - // resources are imported. Package, Version, and File resources are created - // based on the imported artifacts. Imported artifacts that conflict with - // existing resources are ignored. - rpc ImportAptArtifacts(ImportAptArtifactsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/repositories/*}/aptArtifacts:import" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.devtools.artifactregistry.v1.ImportAptArtifactsResponse" - metadata_type: "google.devtools.artifactregistry.v1.ImportAptArtifactsMetadata" - }; - } - - // Imports Yum (RPM) artifacts. The returned Operation will complete once the - // resources are imported. Package, Version, and File resources are created - // based on the imported artifacts. Imported artifacts that conflict with - // existing resources are ignored. - rpc ImportYumArtifacts(ImportYumArtifactsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/repositories/*}/yumArtifacts:import" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.devtools.artifactregistry.v1.ImportYumArtifactsResponse" - metadata_type: "google.devtools.artifactregistry.v1.ImportYumArtifactsMetadata" - }; - } - - // Lists repositories. - rpc ListRepositories(ListRepositoriesRequest) - returns (ListRepositoriesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/repositories" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a repository. - rpc GetRepository(GetRepositoryRequest) returns (Repository) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/repositories/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a repository. The returned Operation will finish once the - // repository has been created. Its response will be the created Repository. - rpc CreateRepository(CreateRepositoryRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/repositories" - body: "repository" - }; - option (google.api.method_signature) = "parent,repository,repository_id"; - option (google.longrunning.operation_info) = { - response_type: "google.devtools.artifactregistry.v1.Repository" - metadata_type: "google.devtools.artifactregistry.v1.OperationMetadata" - }; - } - - // Updates a repository. - rpc UpdateRepository(UpdateRepositoryRequest) returns (Repository) { - option (google.api.http) = { - patch: "/v1/{repository.name=projects/*/locations/*/repositories/*}" - body: "repository" - }; - option (google.api.method_signature) = "repository,update_mask"; - } - - // Deletes a repository and all of its contents. The returned Operation will - // finish once the repository has been deleted. It will not have any Operation - // metadata and will return a google.protobuf.Empty response. - rpc DeleteRepository(DeleteRepositoryRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/repositories/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.devtools.artifactregistry.v1.OperationMetadata" - }; - } - - // Lists packages. - rpc ListPackages(ListPackagesRequest) returns (ListPackagesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/repositories/*}/packages" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a package. - rpc GetPackage(GetPackageRequest) returns (Package) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/repositories/*/packages/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a package and all of its versions and tags. The returned operation - // will complete once the package has been deleted. - rpc DeletePackage(DeletePackageRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/repositories/*/packages/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.devtools.artifactregistry.v1.OperationMetadata" - }; - } - - // Lists versions. - rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/repositories/*/packages/*}/versions" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a version - rpc GetVersion(GetVersionRequest) returns (Version) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/repositories/*/packages/*/versions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a version and all of its content. The returned operation will - // complete once the version has been deleted. - rpc DeleteVersion(DeleteVersionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/repositories/*/packages/*/versions/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.devtools.artifactregistry.v1.OperationMetadata" - }; - } - - // Lists files. - rpc ListFiles(ListFilesRequest) returns (ListFilesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/repositories/*}/files" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a file. - rpc GetFile(GetFileRequest) returns (File) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/repositories/*/files/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists tags. - rpc ListTags(ListTagsRequest) returns (ListTagsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/repositories/*/packages/*}/tags" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a tag. - rpc GetTag(GetTagRequest) returns (Tag) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/repositories/*/packages/*/tags/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a tag. - rpc CreateTag(CreateTagRequest) returns (Tag) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/repositories/*/packages/*}/tags" - body: "tag" - }; - option (google.api.method_signature) = "parent,tag,tag_id"; - } - - // Updates a tag. - rpc UpdateTag(UpdateTagRequest) returns (Tag) { - option (google.api.http) = { - patch: "/v1/{tag.name=projects/*/locations/*/repositories/*/packages/*/tags/*}" - body: "tag" - }; - option (google.api.method_signature) = "tag,update_mask"; - } - - // Deletes a tag. - rpc DeleteTag(DeleteTagRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/repositories/*/packages/*/tags/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the IAM policy for a given resource. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/locations/*/repositories/*}:setIamPolicy" - body: "*" - }; - } - - // Gets the IAM policy for a given resource. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - get: "/v1/{resource=projects/*/locations/*/repositories/*}:getIamPolicy" - }; - } - - // Tests if the caller has a list of permissions on a resource. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) - returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/locations/*/repositories/*}:testIamPermissions" - body: "*" - }; - } - - // Retrieves the Settings for the Project. - rpc GetProjectSettings(GetProjectSettingsRequest) returns (ProjectSettings) { - option (google.api.http) = { - get: "/v1/{name=projects/*/projectSettings}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the Settings for the Project. - rpc UpdateProjectSettings(UpdateProjectSettingsRequest) - returns (ProjectSettings) { - option (google.api.http) = { - patch: "/v1/{project_settings.name=projects/*/projectSettings}" - body: "project_settings" - }; - option (google.api.method_signature) = "project_settings,update_mask"; - } - - // Retrieves the VPCSC Config for the Project. - rpc GetVPCSCConfig(GetVPCSCConfigRequest) returns (VPCSCConfig) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/vpcscConfig}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the VPCSC Config for the Project. - rpc UpdateVPCSCConfig(UpdateVPCSCConfigRequest) returns (VPCSCConfig) { - option (google.api.http) = { - patch: "/v1/{vpcsc_config.name=projects/*/locations/*/vpcscConfig}" - body: "vpcsc_config" - }; - option (google.api.method_signature) = "vpcsc_config,update_mask"; - } -} - -// Metadata type for longrunning-operations, currently empty. -message OperationMetadata {} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/settings.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/settings.proto deleted file mode 100644 index b1f0111e112..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/settings.proto +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.devtools.artifactregistry.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "SettingsProto"; -option java_package = "com.google.devtools.artifactregistry.v1"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; - -// The Artifact Registry settings that apply to a Project. -message ProjectSettings { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/ProjectSettings" - pattern: "projects/{project}/projectSettings" - }; - - // The possible redirection states for legacy repositories. - enum RedirectionState { - // No redirection status has been set. - REDIRECTION_STATE_UNSPECIFIED = 0; - - // Redirection is disabled. - REDIRECTION_FROM_GCR_IO_DISABLED = 1; - - // Redirection is enabled. - REDIRECTION_FROM_GCR_IO_ENABLED = 2; - - // Redirection is enabled, and has been finalized so cannot be reverted. - REDIRECTION_FROM_GCR_IO_FINALIZED = 3 [deprecated = true]; - } - - // The name of the project's settings. - // - // Always of the form: - // projects/{project-id}/projectSettings - // - // In update request: never set - // In response: always set - string name = 1; - - // The redirection state of the legacy repositories in this project. - RedirectionState legacy_redirection_state = 2; -} - -// Gets the redirection status for a project. -message GetProjectSettingsRequest { - // Required. The name of the projectSettings resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/ProjectSettings" - } - ]; -} - -// Sets the settings of the project. -message UpdateProjectSettingsRequest { - // The project settings. - ProjectSettings project_settings = 2; - - // Field mask to support partial updates. - google.protobuf.FieldMask update_mask = 3; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/tag.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/tag.proto deleted file mode 100644 index 818373baf1d..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/tag.proto +++ /dev/null @@ -1,118 +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.devtools.artifactregistry.v1; - -import "google/api/resource.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "TagProto"; -option java_package = "com.google.devtools.artifactregistry.v1"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; - -// Tags point to a version and represent an alternative name that can be used -// to access the version. -message Tag { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/Tag" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}" - }; - - // The name of the tag, for example: - // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". - // If the package part contains slashes, the slashes are escaped. - // The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else - // must be URL encoded. - string name = 1; - - // The name of the version the tag refers to, for example: - // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811" - // If the package or version ID parts contain slashes, the slashes are - // escaped. - string version = 2; -} - -// The request to list tags. -message ListTagsRequest { - // The name of the parent resource whose tags will be listed. - string parent = 1; - - // An expression for filtering the results of the request. Filter rules are - // case insensitive. The fields eligible for filtering are: - // - // * `version` - // - // An example of using a filter: - // - // * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` - // --> Tags that are applied to the version `1.0` in package `pkg1`. - string filter = 4; - - // The maximum number of tags to return. Maximum page size is 10,000. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; -} - -// The response from listing tags. -message ListTagsResponse { - // The tags returned. - repeated Tag tags = 1; - - // The token to retrieve the next page of tags, or empty if there are no - // more tags to return. - string next_page_token = 2; -} - -// The request to retrieve a tag. -message GetTagRequest { - // The name of the tag to retrieve. - string name = 1; -} - -// The request to create a new tag. -message CreateTagRequest { - // The name of the parent resource where the tag will be created. - string parent = 1; - - // The tag id to use for this repository. - string tag_id = 2; - - // The tag to be created. - Tag tag = 3; -} - -// The request to create or update a tag. -message UpdateTagRequest { - // The tag that replaces the resource on the server. - Tag tag = 1; - - // The update mask applies to the resource. For the `FieldMask` definition, - // see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 2; -} - -// The request to delete a tag. -message DeleteTagRequest { - // The name of the tag to delete. - string name = 1; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/version.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/version.proto deleted file mode 100644 index b84d7f276be..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/version.proto +++ /dev/null @@ -1,135 +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.devtools.artifactregistry.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/devtools/artifactregistry/v1/tag.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "VersionProto"; -option java_package = "com.google.devtools.artifactregistry.v1"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; - -// The view, which determines what version information is returned in a -// response. -enum VersionView { - // The default / unset value. - // The API will default to the BASIC view. - VERSION_VIEW_UNSPECIFIED = 0; - - // Includes basic information about the version, but not any related tags. - BASIC = 1; - - // Include everything. - FULL = 2; -} - -// The body of a version resource. A version resource represents a -// collection of components, such as files and other data. This may correspond -// to a version in many package management schemes. -message Version { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/Version" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}" - }; - - // The name of the version, for example: - // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/art1". - // If the package or version ID parts contain slashes, the slashes are - // escaped. - string name = 1; - - // Optional. Description of the version, as specified in its metadata. - string description = 3; - - // The time when the version was created. - google.protobuf.Timestamp create_time = 5; - - // The time when the version was last updated. - google.protobuf.Timestamp update_time = 6; - - // Output only. A list of related tags. Will contain up to 100 tags that - // reference this version. - repeated Tag related_tags = 7; - - // Output only. Repository-specific Metadata stored against this version. - // The fields returned are defined by the underlying repository-specific - // resource. Currently, the resources could be: - // [DockerImage][google.devtools.artifactregistry.v1.DockerImage] - // [MavenArtifact][google.devtools.artifactregistry.v1.MavenArtifact] - google.protobuf.Struct metadata = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request to list versions. -message ListVersionsRequest { - // The name of the parent resource whose versions will be listed. - string parent = 1; - - // The maximum number of versions to return. Maximum page size is 1,000. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; - - // The view that should be returned in the response. - VersionView view = 4; - - // Optional. The field to order the results by. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from listing versions. -message ListVersionsResponse { - // The versions returned. - repeated Version versions = 1; - - // The token to retrieve the next page of versions, or empty if there are no - // more versions to return. - string next_page_token = 2; -} - -// The request to retrieve a version. -message GetVersionRequest { - // The name of the version to retrieve. - string name = 1; - - // The view that should be returned in the response. - VersionView view = 2; -} - -// The request to delete a version. -message DeleteVersionRequest { - // The name of the version to delete. - string name = 1; - - // By default, a version that is tagged may not be deleted. If force=true, the - // version and any tags pointing to the version are deleted. - bool force = 2; -} - -// The metadata of an LRO from deleting multiple versions. -message BatchDeleteVersionsMetadata { - // The versions the operation failed to delete. - repeated string failed_versions = 2; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/vpcsc_config.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/vpcsc_config.proto deleted file mode 100644 index 575e03a76f6..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/vpcsc_config.proto +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.devtools.artifactregistry.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "VPCSCConfigProto"; -option java_package = "com.google.devtools.artifactregistry.v1"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; - -// The Artifact Registry VPC SC config that apply to a Project. -message VPCSCConfig { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/VpcscConfig" - pattern: "projects/{project}/locations/{location}/vpcscConfig" - }; - - // VPCSCPolicy is the VPC SC policy for project and location. - enum VPCSCPolicy { - // VPCSC_POLICY_UNSPECIFIED - the VPS SC policy is not defined. - // When VPS SC policy is not defined - the Service will use the default - // behavior (VPCSC_DENY). - VPCSC_POLICY_UNSPECIFIED = 0; - - // VPCSC_DENY - repository will block the requests to the Upstreams for the - // Remote Repositories if the resource is in the perimeter. - DENY = 1; - - // VPCSC_ALLOW - repository will allow the requests to the Upstreams for the - // Remote Repositories if the resource is in the perimeter. - ALLOW = 2; - } - - // The name of the project's VPC SC Config. - // - // Always of the form: - // projects/{projectID}/locations/{location}/vpcscConfig - // - // In update request: never set - // In response: always set - string name = 1; - - // The project per location VPC SC policy that defines the VPC SC behavior for - // the Remote Repository (Allow/Deny). - VPCSCPolicy vpcsc_policy = 2; -} - -// Gets the VPC SC config for a project. -message GetVPCSCConfigRequest { - // Required. The name of the VPCSCConfig resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/VpcscConfig" - } - ]; -} - -// Sets the VPCSC config of the project. -message UpdateVPCSCConfigRequest { - // The project config. - VPCSCConfig vpcsc_config = 1; - - // Field mask to support partial updates. - google.protobuf.FieldMask update_mask = 2; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/yum_artifact.proto b/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/yum_artifact.proto deleted file mode 100644 index f55332ae4bb..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/protos/google/devtools/artifactregistry/v1/yum_artifact.proto +++ /dev/null @@ -1,106 +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.devtools.artifactregistry.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "YumArtifactProto"; -option java_package = "com.google.devtools.artifactregistry.v1"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1"; - -// A detailed representation of a Yum artifact. -message YumArtifact { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/YumArtifact" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/yumArtifacts/{yum_artifact}" - }; - - // Package type is either binary or source. - enum PackageType { - // Package type is not specified. - PACKAGE_TYPE_UNSPECIFIED = 0; - - // Binary package (.rpm). - BINARY = 1; - - // Source package (.srpm). - SOURCE = 2; - } - - // Output only. The Artifact Registry resource name of the artifact. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The yum package name of the artifact. - string package_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. An artifact is a binary or source package. - PackageType package_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Operating system architecture of the artifact. - string architecture = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Google Cloud Storage location where the artifacts currently reside. -message ImportYumArtifactsGcsSource { - // Cloud Storage paths URI (e.g., gs://my_bucket//my_object). - repeated string uris = 1; - - // Supports URI wildcards for matching multiple objects from a single URI. - bool use_wildcards = 2; -} - -// The request to import new yum artifacts. -message ImportYumArtifactsRequest { - // The source location of the package binaries. - oneof source { - // Google Cloud Storage location where input content is located. - ImportYumArtifactsGcsSource gcs_source = 2; - } - - // The name of the parent resource where the artifacts will be imported. - string parent = 1; -} - -// Error information explaining why a package was not imported. -message ImportYumArtifactsErrorInfo { - // The source that was not imported. - oneof source { - // Google Cloud Storage location requested. - ImportYumArtifactsGcsSource gcs_source = 1; - } - - // The detailed error status. - google.rpc.Status error = 2; -} - -// The response message from importing YUM artifacts. -message ImportYumArtifactsResponse { - // The yum artifacts imported. - repeated YumArtifact yum_artifacts = 1; - - // Detailed error info for packages that were not imported. - repeated ImportYumArtifactsErrorInfo errors = 2; -} - -// The operation metadata for importing artifacts. -message ImportYumArtifactsMetadata {} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_repository.js deleted file mode 100644 index 31e4eee5c99..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_repository.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 artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 parent resource where the repository will be created. - */ - // const parent = 'abc123' - /** - * The repository id to use for this repository. - */ - // const repositoryId = 'abc123' - /** - * The repository to be created. - */ - // const repository = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callCreateRepository() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await artifactregistryClient.createRepository(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateRepository(); - // [END artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_tag.js deleted file mode 100644 index 65e179892da..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.create_tag.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() { - // [START artifactregistry_v1_generated_ArtifactRegistry_CreateTag_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the parent resource where the tag will be created. - */ - // const parent = 'abc123' - /** - * The tag id to use for this repository. - */ - // const tagId = 'abc123' - /** - * The tag to be created. - */ - // const tag = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callCreateTag() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.createTag(request); - console.log(response); - } - - callCreateTag(); - // [END artifactregistry_v1_generated_ArtifactRegistry_CreateTag_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_package.js deleted file mode 100644 index 3182dfcaafc..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_package.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 artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 package to delete. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callDeletePackage() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await artifactregistryClient.deletePackage(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeletePackage(); - // [END artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_repository.js deleted file mode 100644 index 417477c2e77..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_repository.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 artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 repository to delete. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callDeleteRepository() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await artifactregistryClient.deleteRepository(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteRepository(); - // [END artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_tag.js deleted file mode 100644 index 848398d4313..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_tag.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically 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 artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the tag to delete. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callDeleteTag() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.deleteTag(request); - console.log(response); - } - - callDeleteTag(); - // [END artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_version.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_version.js deleted file mode 100644 index 89e0fe6f0bb..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.delete_version.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 artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the version to delete. - */ - // const name = 'abc123' - /** - * By default, a version that is tagged may not be deleted. If force=true, the - * version and any tags pointing to the version are deleted. - */ - // const force = true - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callDeleteVersion() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await artifactregistryClient.deleteVersion(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteVersion(); - // [END artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_docker_image.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_docker_image.js deleted file mode 100644 index c5ec14d2069..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_docker_image.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 artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 docker images. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetDockerImage() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await artifactregistryClient.getDockerImage(request); - console.log(response); - } - - callGetDockerImage(); - // [END artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_file.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_file.js deleted file mode 100644 index 3b743520431..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_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 artifactregistry_v1_generated_ArtifactRegistry_GetFile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 file to retrieve. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetFile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await artifactregistryClient.getFile(request); - console.log(response); - } - - callGetFile(); - // [END artifactregistry_v1_generated_ArtifactRegistry_GetFile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_iam_policy.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_iam_policy.js deleted file mode 100644 index 94c86686012..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.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 artifactregistry_v1_generated_ArtifactRegistry_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 Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await artifactregistryClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END artifactregistry_v1_generated_ArtifactRegistry_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-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_maven_artifact.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_maven_artifact.js deleted file mode 100644 index 235629b118f..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_maven_artifact.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 artifactregistry_v1_generated_ArtifactRegistry_GetMavenArtifact_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 maven artifact. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetMavenArtifact() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await artifactregistryClient.getMavenArtifact(request); - console.log(response); - } - - callGetMavenArtifact(); - // [END artifactregistry_v1_generated_ArtifactRegistry_GetMavenArtifact_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_npm_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_npm_package.js deleted file mode 100644 index 8bc36d342c8..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_npm_package.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 artifactregistry_v1_generated_ArtifactRegistry_GetNpmPackage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 npm package. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetNpmPackage() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await artifactregistryClient.getNpmPackage(request); - console.log(response); - } - - callGetNpmPackage(); - // [END artifactregistry_v1_generated_ArtifactRegistry_GetNpmPackage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_package.js deleted file mode 100644 index 904ad1c01fb..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_package.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 artifactregistry_v1_generated_ArtifactRegistry_GetPackage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 package to retrieve. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetPackage() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await artifactregistryClient.getPackage(request); - console.log(response); - } - - callGetPackage(); - // [END artifactregistry_v1_generated_ArtifactRegistry_GetPackage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_project_settings.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_project_settings.js deleted file mode 100644 index f35139db26e..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_project_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 artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 projectSettings resource. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetProjectSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await artifactregistryClient.getProjectSettings(request); - console.log(response); - } - - callGetProjectSettings(); - // [END artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_python_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_python_package.js deleted file mode 100644 index 6faa0e3bb4b..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_python_package.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 artifactregistry_v1_generated_ArtifactRegistry_GetPythonPackage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 python package. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetPythonPackage() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await artifactregistryClient.getPythonPackage(request); - console.log(response); - } - - callGetPythonPackage(); - // [END artifactregistry_v1_generated_ArtifactRegistry_GetPythonPackage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_repository.js deleted file mode 100644 index 19e29582166..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_repository.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 artifactregistry_v1_generated_ArtifactRegistry_GetRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 repository to retrieve. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetRepository() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await artifactregistryClient.getRepository(request); - console.log(response); - } - - callGetRepository(); - // [END artifactregistry_v1_generated_ArtifactRegistry_GetRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_tag.js deleted file mode 100644 index 7075a8d6c4c..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_tag.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically 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 artifactregistry_v1_generated_ArtifactRegistry_GetTag_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the tag to retrieve. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetTag() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.getTag(request); - console.log(response); - } - - callGetTag(); - // [END artifactregistry_v1_generated_ArtifactRegistry_GetTag_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_v_p_c_s_c_config.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_v_p_c_s_c_config.js deleted file mode 100644 index 04bc879360b..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_v_p_c_s_c_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 artifactregistry_v1_generated_ArtifactRegistry_GetVPCSCConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 VPCSCConfig resource. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetVPCSCConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await artifactregistryClient.getVPCSCConfig(request); - console.log(response); - } - - callGetVPCSCConfig(); - // [END artifactregistry_v1_generated_ArtifactRegistry_GetVPCSCConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_version.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_version.js deleted file mode 100644 index 8197ba8371a..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.get_version.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() { - // [START artifactregistry_v1_generated_ArtifactRegistry_GetVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the version to retrieve. - */ - // const name = 'abc123' - /** - * The view that should be returned in the response. - */ - // const view = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.getVersion(request); - console.log(response); - } - - callGetVersion(); - // [END artifactregistry_v1_generated_ArtifactRegistry_GetVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_apt_artifacts.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_apt_artifacts.js deleted file mode 100644 index 7777baeabe5..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_apt_artifacts.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() { - // [START artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Google Cloud Storage location where input content is located. - */ - // const gcsSource = {} - /** - * The name of the parent resource where the artifacts will be imported. - */ - // const parent = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callImportAptArtifacts() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await artifactregistryClient.importAptArtifacts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportAptArtifacts(); - // [END artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_yum_artifacts.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_yum_artifacts.js deleted file mode 100644 index 4d8d43fbeab..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.import_yum_artifacts.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() { - // [START artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Google Cloud Storage location where input content is located. - */ - // const gcsSource = {} - /** - * The name of the parent resource where the artifacts will be imported. - */ - // const parent = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callImportYumArtifacts() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await artifactregistryClient.importYumArtifacts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportYumArtifacts(); - // [END artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_docker_images.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_docker_images.js deleted file mode 100644 index 2ac1b250990..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_docker_images.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) { - // [START artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 parent resource whose docker images will be - * listed. - */ - // const parent = 'abc123' - /** - * The maximum number of artifacts to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - /** - * The field to order the results by. - */ - // const orderBy = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListDockerImages() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await artifactregistryClient.listDockerImagesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDockerImages(); - // [END artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_files.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_files.js deleted file mode 100644 index 2cb4afca10f..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_files.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) { - // [START artifactregistry_v1_generated_ArtifactRegistry_ListFiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 repository whose files will be listed. For - * example: "projects/p1/locations/us-central1/repositories/repo1 - */ - // const parent = 'abc123' - /** - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `name` - * * `owner` - * An example of using a filter: - * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an - * ID starting with "a/b/". - * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> - * Files owned by the version `1.0` in package `pkg1`. - */ - // const filter = 'abc123' - /** - * The maximum number of files to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - /** - * The field to order the results by. - */ - // const orderBy = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListFiles() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await artifactregistryClient.listFilesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFiles(); - // [END artifactregistry_v1_generated_ArtifactRegistry_ListFiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_maven_artifacts.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_maven_artifacts.js deleted file mode 100644 index 6255484ab26..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_maven_artifacts.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(parent) { - // [START artifactregistry_v1_generated_ArtifactRegistry_ListMavenArtifacts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 parent resource whose maven artifacts will be - * listed. - */ - // const parent = 'abc123' - /** - * The maximum number of artifacts to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListMavenArtifacts() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await artifactregistryClient.listMavenArtifactsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMavenArtifacts(); - // [END artifactregistry_v1_generated_ArtifactRegistry_ListMavenArtifacts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_npm_packages.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_npm_packages.js deleted file mode 100644 index 64046e6bf3f..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_npm_packages.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(parent) { - // [START artifactregistry_v1_generated_ArtifactRegistry_ListNpmPackages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 parent resource whose npm packages will be - * listed. - */ - // const parent = 'abc123' - /** - * The maximum number of artifacts to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListNpmPackages() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await artifactregistryClient.listNpmPackagesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNpmPackages(); - // [END artifactregistry_v1_generated_ArtifactRegistry_ListNpmPackages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_packages.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_packages.js deleted file mode 100644 index dea1563b637..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_packages.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(parent) { - // [START artifactregistry_v1_generated_ArtifactRegistry_ListPackages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 parent resource whose packages will be listed. - */ - // const parent = 'abc123' - /** - * The maximum number of packages to return. Maximum page size is 1,000. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListPackages() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await artifactregistryClient.listPackagesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListPackages(); - // [END artifactregistry_v1_generated_ArtifactRegistry_ListPackages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_python_packages.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_python_packages.js deleted file mode 100644 index 704b4e59d6d..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_python_packages.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(parent) { - // [START artifactregistry_v1_generated_ArtifactRegistry_ListPythonPackages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 parent resource whose python packages will be - * listed. - */ - // const parent = 'abc123' - /** - * The maximum number of artifacts to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListPythonPackages() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await artifactregistryClient.listPythonPackagesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListPythonPackages(); - // [END artifactregistry_v1_generated_ArtifactRegistry_ListPythonPackages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_repositories.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_repositories.js deleted file mode 100644 index a9ae7e7d5af..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_repositories.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(parent) { - // [START artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 parent resource whose repositories will be listed. - */ - // const parent = 'abc123' - /** - * The maximum number of repositories to return. Maximum page size is 1,000. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListRepositories() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await artifactregistryClient.listRepositoriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRepositories(); - // [END artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_tags.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_tags.js deleted file mode 100644 index aaae98758ba..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_tags.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 artifactregistry_v1_generated_ArtifactRegistry_ListTags_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the parent resource whose tags will be listed. - */ - // const parent = 'abc123' - /** - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `version` - * An example of using a filter: - * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` - * --> Tags that are applied to the version `1.0` in package `pkg1`. - */ - // const filter = 'abc123' - /** - * The maximum number of tags to return. Maximum page size is 10,000. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListTags() { - // Construct request - const request = { - }; - - // Run request - const iterable = await artifactregistryClient.listTagsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTags(); - // [END artifactregistry_v1_generated_ArtifactRegistry_ListTags_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_versions.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_versions.js deleted file mode 100644 index 42cfc63bca5..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.list_versions.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 artifactregistry_v1_generated_ArtifactRegistry_ListVersions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the parent resource whose versions will be listed. - */ - // const parent = 'abc123' - /** - * The maximum number of versions to return. Maximum page size is 1,000. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - /** - * The view that should be returned in the response. - */ - // const view = {} - /** - * Optional. The field to order the results by. - */ - // const orderBy = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListVersions() { - // Construct request - const request = { - }; - - // Run request - const iterable = await artifactregistryClient.listVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListVersions(); - // [END artifactregistry_v1_generated_ArtifactRegistry_ListVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.set_iam_policy.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.set_iam_policy.js deleted file mode 100644 index 224d684e33c..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.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 artifactregistry_v1_generated_ArtifactRegistry_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 Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await artifactregistryClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END artifactregistry_v1_generated_ArtifactRegistry_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-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.test_iam_permissions.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.test_iam_permissions.js deleted file mode 100644 index 56096a196b1..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.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 artifactregistry_v1_generated_ArtifactRegistry_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 Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await artifactregistryClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END artifactregistry_v1_generated_ArtifactRegistry_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-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_project_settings.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_project_settings.js deleted file mode 100644 index 3129244d36f..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_project_settings.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() { - // [START artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 settings. - */ - // const projectSettings = {} - /** - * Field mask to support partial updates. - */ - // const updateMask = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callUpdateProjectSettings() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.updateProjectSettings(request); - console.log(response); - } - - callUpdateProjectSettings(); - // [END artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_repository.js deleted file mode 100644 index 5183bf67ae5..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_repository.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 artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 repository that replaces the resource on the server. - */ - // const repository = {} - /** - * The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callUpdateRepository() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.updateRepository(request); - console.log(response); - } - - callUpdateRepository(); - // [END artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_tag.js deleted file mode 100644 index 9e3b8ae13c1..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_tag.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 artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 tag that replaces the resource on the server. - */ - // const tag = {} - /** - * The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callUpdateTag() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.updateTag(request); - console.log(response); - } - - callUpdateTag(); - // [END artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_v_p_c_s_c_config.js b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_v_p_c_s_c_config.js deleted file mode 100644 index c8118387998..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/artifact_registry.update_v_p_c_s_c_config.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() { - // [START artifactregistry_v1_generated_ArtifactRegistry_UpdateVPCSCConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 config. - */ - // const vpcscConfig = {} - /** - * Field mask to support partial updates. - */ - // const updateMask = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callUpdateVPCSCConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.updateVPCSCConfig(request); - console.log(response); - } - - callUpdateVPCSCConfig(); - // [END artifactregistry_v1_generated_ArtifactRegistry_UpdateVPCSCConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/snippet_metadata_google.devtools.artifactregistry.v1.json b/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/snippet_metadata_google.devtools.artifactregistry.v1.json deleted file mode 100644 index 9ebb95b1173..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/samples/generated/v1/snippet_metadata_google.devtools.artifactregistry.v1.json +++ /dev/null @@ -1,1575 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-artifactregistry", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.devtools.artifactregistry.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_async", - "title": "ArtifactRegistry listDockerImages Sample", - "origin": "API_DEFINITION", - "description": " Lists docker images.", - "canonical": true, - "file": "artifact_registry.list_docker_images.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDockerImages", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListDockerImages", - "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.devtools.artifactregistry.v1.ListDockerImagesResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListDockerImages", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListDockerImages", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_async", - "title": "ArtifactRegistry getDockerImage Sample", - "origin": "API_DEFINITION", - "description": " Gets a docker image.", - "canonical": true, - "file": "artifact_registry.get_docker_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDockerImage", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetDockerImage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.DockerImage", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetDockerImage", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetDockerImage", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListMavenArtifacts_async", - "title": "ArtifactRegistry listMavenArtifacts Sample", - "origin": "API_DEFINITION", - "description": " Lists maven artifacts.", - "canonical": true, - "file": "artifact_registry.list_maven_artifacts.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMavenArtifacts", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListMavenArtifacts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.ListMavenArtifactsResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListMavenArtifacts", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListMavenArtifacts", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetMavenArtifact_async", - "title": "ArtifactRegistry getMavenArtifact Sample", - "origin": "API_DEFINITION", - "description": " Gets a maven artifact.", - "canonical": true, - "file": "artifact_registry.get_maven_artifact.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMavenArtifact", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetMavenArtifact", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.MavenArtifact", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetMavenArtifact", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetMavenArtifact", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListNpmPackages_async", - "title": "ArtifactRegistry listNpmPackages Sample", - "origin": "API_DEFINITION", - "description": " Lists npm packages.", - "canonical": true, - "file": "artifact_registry.list_npm_packages.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNpmPackages", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListNpmPackages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.ListNpmPackagesResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListNpmPackages", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListNpmPackages", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetNpmPackage_async", - "title": "ArtifactRegistry getNpmPackage Sample", - "origin": "API_DEFINITION", - "description": " Gets a npm package.", - "canonical": true, - "file": "artifact_registry.get_npm_package.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNpmPackage", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetNpmPackage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.NpmPackage", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetNpmPackage", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetNpmPackage", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListPythonPackages_async", - "title": "ArtifactRegistry listPythonPackages Sample", - "origin": "API_DEFINITION", - "description": " Lists python packages.", - "canonical": true, - "file": "artifact_registry.list_python_packages.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListPythonPackages", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListPythonPackages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.ListPythonPackagesResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListPythonPackages", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListPythonPackages", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetPythonPackage_async", - "title": "ArtifactRegistry getPythonPackage Sample", - "origin": "API_DEFINITION", - "description": " Gets a python package.", - "canonical": true, - "file": "artifact_registry.get_python_package.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPythonPackage", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetPythonPackage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.PythonPackage", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetPythonPackage", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetPythonPackage", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async", - "title": "ArtifactRegistry importAptArtifacts Sample", - "origin": "API_DEFINITION", - "description": " Imports Apt artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.", - "canonical": true, - "file": "artifact_registry.import_apt_artifacts.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportAptArtifacts", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportAptArtifacts", - "async": true, - "parameters": [ - { - "name": "gcs_source", - "type": ".google.devtools.artifactregistry.v1.ImportAptArtifactsGcsSource" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "ImportAptArtifacts", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportAptArtifacts", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async", - "title": "ArtifactRegistry importYumArtifacts Sample", - "origin": "API_DEFINITION", - "description": " Imports Yum (RPM) artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.", - "canonical": true, - "file": "artifact_registry.import_yum_artifacts.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportYumArtifacts", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportYumArtifacts", - "async": true, - "parameters": [ - { - "name": "gcs_source", - "type": ".google.devtools.artifactregistry.v1.ImportYumArtifactsGcsSource" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "ImportYumArtifacts", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportYumArtifacts", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_async", - "title": "ArtifactRegistry listRepositories Sample", - "origin": "API_DEFINITION", - "description": " Lists repositories.", - "canonical": true, - "file": "artifact_registry.list_repositories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRepositories", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListRepositories", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.ListRepositoriesResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListRepositories", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListRepositories", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetRepository_async", - "title": "ArtifactRegistry getRepository Sample", - "origin": "API_DEFINITION", - "description": " Gets a repository.", - "canonical": true, - "file": "artifact_registry.get_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRepository", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetRepository", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.Repository", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetRepository", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetRepository", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async", - "title": "ArtifactRegistry createRepository Sample", - "origin": "API_DEFINITION", - "description": " Creates a repository. The returned Operation will finish once the repository has been created. Its response will be the created Repository.", - "canonical": true, - "file": "artifact_registry.create_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateRepository", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateRepository", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "repository_id", - "type": "TYPE_STRING" - }, - { - "name": "repository", - "type": ".google.devtools.artifactregistry.v1.Repository" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "CreateRepository", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateRepository", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_async", - "title": "ArtifactRegistry updateRepository Sample", - "origin": "API_DEFINITION", - "description": " Updates a repository.", - "canonical": true, - "file": "artifact_registry.update_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateRepository", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateRepository", - "async": true, - "parameters": [ - { - "name": "repository", - "type": ".google.devtools.artifactregistry.v1.Repository" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.Repository", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "UpdateRepository", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateRepository", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async", - "title": "ArtifactRegistry deleteRepository Sample", - "origin": "API_DEFINITION", - "description": " Deletes a repository and all of its contents. The returned Operation will finish once the repository has been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response.", - "canonical": true, - "file": "artifact_registry.delete_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteRepository", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteRepository", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "DeleteRepository", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteRepository", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListPackages_async", - "title": "ArtifactRegistry listPackages Sample", - "origin": "API_DEFINITION", - "description": " Lists packages.", - "canonical": true, - "file": "artifact_registry.list_packages.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListPackages", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListPackages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.ListPackagesResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListPackages", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListPackages", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetPackage_async", - "title": "ArtifactRegistry getPackage Sample", - "origin": "API_DEFINITION", - "description": " Gets a package.", - "canonical": true, - "file": "artifact_registry.get_package.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPackage", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetPackage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.Package", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetPackage", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetPackage", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async", - "title": "ArtifactRegistry deletePackage Sample", - "origin": "API_DEFINITION", - "description": " Deletes a package and all of its versions and tags. The returned operation will complete once the package has been deleted.", - "canonical": true, - "file": "artifact_registry.delete_package.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeletePackage", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeletePackage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "DeletePackage", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeletePackage", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListVersions_async", - "title": "ArtifactRegistry listVersions Sample", - "origin": "API_DEFINITION", - "description": " Lists versions.", - "canonical": true, - "file": "artifact_registry.list_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListVersions", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListVersions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.devtools.artifactregistry.v1.VersionView" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.ListVersionsResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListVersions", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListVersions", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetVersion_async", - "title": "ArtifactRegistry getVersion Sample", - "origin": "API_DEFINITION", - "description": " Gets a version", - "canonical": true, - "file": "artifact_registry.get_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetVersion", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.devtools.artifactregistry.v1.VersionView" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.Version", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetVersion", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetVersion", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async", - "title": "ArtifactRegistry deleteVersion Sample", - "origin": "API_DEFINITION", - "description": " Deletes a version and all of its content. The returned operation will complete once the version has been deleted.", - "canonical": true, - "file": "artifact_registry.delete_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteVersion", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "DeleteVersion", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteVersion", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListFiles_async", - "title": "ArtifactRegistry listFiles Sample", - "origin": "API_DEFINITION", - "description": " Lists files.", - "canonical": true, - "file": "artifact_registry.list_files.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFiles", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListFiles", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.ListFilesResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListFiles", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListFiles", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetFile_async", - "title": "ArtifactRegistry getFile Sample", - "origin": "API_DEFINITION", - "description": " Gets a file.", - "canonical": true, - "file": "artifact_registry.get_file.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFile", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetFile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.File", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetFile", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetFile", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListTags_async", - "title": "ArtifactRegistry listTags Sample", - "origin": "API_DEFINITION", - "description": " Lists tags.", - "canonical": true, - "file": "artifact_registry.list_tags.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTags", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListTags", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.ListTagsResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListTags", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListTags", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetTag_async", - "title": "ArtifactRegistry getTag Sample", - "origin": "API_DEFINITION", - "description": " Gets a tag.", - "canonical": true, - "file": "artifact_registry.get_tag.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTag", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetTag", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.Tag", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetTag", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetTag", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_CreateTag_async", - "title": "ArtifactRegistry createTag Sample", - "origin": "API_DEFINITION", - "description": " Creates a tag.", - "canonical": true, - "file": "artifact_registry.create_tag.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateTag", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateTag", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "tag_id", - "type": "TYPE_STRING" - }, - { - "name": "tag", - "type": ".google.devtools.artifactregistry.v1.Tag" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.Tag", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "CreateTag", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateTag", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_async", - "title": "ArtifactRegistry updateTag Sample", - "origin": "API_DEFINITION", - "description": " Updates a tag.", - "canonical": true, - "file": "artifact_registry.update_tag.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateTag", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateTag", - "async": true, - "parameters": [ - { - "name": "tag", - "type": ".google.devtools.artifactregistry.v1.Tag" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.Tag", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "UpdateTag", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateTag", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_async", - "title": "ArtifactRegistry deleteTag Sample", - "origin": "API_DEFINITION", - "description": " Deletes a tag.", - "canonical": true, - "file": "artifact_registry.delete_tag.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteTag", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteTag", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "DeleteTag", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteTag", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_SetIamPolicy_async", - "title": "ArtifactRegistry setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Updates the IAM policy for a given resource.", - "canonical": true, - "file": "artifact_registry.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.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": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.SetIamPolicy", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetIamPolicy_async", - "title": "ArtifactRegistry getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the IAM policy for a given resource.", - "canonical": true, - "file": "artifact_registry.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetIamPolicy", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_TestIamPermissions_async", - "title": "ArtifactRegistry testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Tests if the caller has a list of permissions on a resource.", - "canonical": true, - "file": "artifact_registry.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.TestIamPermissions", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_async", - "title": "ArtifactRegistry getProjectSettings Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the Settings for the Project.", - "canonical": true, - "file": "artifact_registry.get_project_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProjectSettings", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetProjectSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.ProjectSettings", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetProjectSettings", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetProjectSettings", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_async", - "title": "ArtifactRegistry updateProjectSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the Settings for the Project.", - "canonical": true, - "file": "artifact_registry.update_project_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProjectSettings", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateProjectSettings", - "async": true, - "parameters": [ - { - "name": "project_settings", - "type": ".google.devtools.artifactregistry.v1.ProjectSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.ProjectSettings", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "UpdateProjectSettings", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateProjectSettings", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetVPCSCConfig_async", - "title": "ArtifactRegistry getVPCSCConfig Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the VPCSC Config for the Project.", - "canonical": true, - "file": "artifact_registry.get_v_p_c_s_c_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetVPCSCConfig", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetVPCSCConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.VPCSCConfig", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetVPCSCConfig", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetVPCSCConfig", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateVPCSCConfig_async", - "title": "ArtifactRegistry updateVPCSCConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the VPCSC Config for the Project.", - "canonical": true, - "file": "artifact_registry.update_v_p_c_s_c_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateVPCSCConfig", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateVPCSCConfig", - "async": true, - "parameters": [ - { - "name": "vpcsc_config", - "type": ".google.devtools.artifactregistry.v1.VPCSCConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.devtools.artifactregistry.v1.VPCSCConfig", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistryClient" - }, - "method": { - "shortName": "UpdateVPCSCConfig", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateVPCSCConfig", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/src/index.ts deleted file mode 100644 index 932c99cbf24..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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 ArtifactRegistryClient = v1.ArtifactRegistryClient; -type ArtifactRegistryClient = v1.ArtifactRegistryClient; -export {v1, ArtifactRegistryClient}; -export default {v1, ArtifactRegistryClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client.ts deleted file mode 100644 index 8e570781f1b..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client.ts +++ /dev/null @@ -1,5109 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/artifact_registry_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './artifact_registry_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Artifact Registry API service. - * - * Artifact Registry is an artifact management system for storing artifacts - * from different package management systems. - * - * The resources managed by this API are: - * - * * Repositories, which group packages and their data. - * * Packages, which group versions and their tags. - * * Versions, which are specific forms of a package. - * * Tags, which represent alternative names for versions. - * * Files, which contain content and are optionally associated with a Package - * or Version. - * @class - * @memberof v1 - */ -export class ArtifactRegistryClient { - 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; - artifactRegistryStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ArtifactRegistryClient. - * - * @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 ArtifactRegistryClient({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 ArtifactRegistryClient; - 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 = { - aptArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}' - ), - dockerImagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/dockerImages/{docker_image}' - ), - filePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/files/{file}' - ), - mavenArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/mavenArtifacts/{maven_artifact}' - ), - npmPackagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/npmPackages/{npm_package}' - ), - packagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/packages/{package}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/projectSettings' - ), - pythonPackagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/pythonPackages/{python_package}' - ), - repositoryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}' - ), - tagPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}' - ), - versionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}' - ), - vpcscConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/vpcscConfig' - ), - yumArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/yumArtifacts/{yum_artifact}' - ), - }; - - // 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 = { - listDockerImages: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'dockerImages'), - listMavenArtifacts: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mavenArtifacts'), - listNpmPackages: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'npmPackages'), - listPythonPackages: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'pythonPackages'), - listRepositories: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories'), - listPackages: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'packages'), - listVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'versions'), - listFiles: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'files'), - listTags: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tags') - }; - - 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.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const importAptArtifactsResponse = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1.ImportAptArtifactsResponse') as gax.protobuf.Type; - const importAptArtifactsMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1.ImportAptArtifactsMetadata') as gax.protobuf.Type; - const importYumArtifactsResponse = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1.ImportYumArtifactsResponse') as gax.protobuf.Type; - const importYumArtifactsMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1.ImportYumArtifactsMetadata') as gax.protobuf.Type; - const createRepositoryResponse = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1.Repository') as gax.protobuf.Type; - const createRepositoryMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1.OperationMetadata') as gax.protobuf.Type; - const deleteRepositoryResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteRepositoryMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1.OperationMetadata') as gax.protobuf.Type; - const deletePackageResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deletePackageMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1.OperationMetadata') as gax.protobuf.Type; - const deleteVersionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteVersionMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - importAptArtifacts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importAptArtifactsResponse.decode.bind(importAptArtifactsResponse), - importAptArtifactsMetadata.decode.bind(importAptArtifactsMetadata)), - importYumArtifacts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importYumArtifactsResponse.decode.bind(importYumArtifactsResponse), - importYumArtifactsMetadata.decode.bind(importYumArtifactsMetadata)), - createRepository: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createRepositoryResponse.decode.bind(createRepositoryResponse), - createRepositoryMetadata.decode.bind(createRepositoryMetadata)), - deleteRepository: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteRepositoryResponse.decode.bind(deleteRepositoryResponse), - deleteRepositoryMetadata.decode.bind(deleteRepositoryMetadata)), - deletePackage: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deletePackageResponse.decode.bind(deletePackageResponse), - deletePackageMetadata.decode.bind(deletePackageMetadata)), - deleteVersion: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteVersionResponse.decode.bind(deleteVersionResponse), - deleteVersionMetadata.decode.bind(deleteVersionMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.devtools.artifactregistry.v1.ArtifactRegistry', 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.artifactRegistryStub) { - return this.artifactRegistryStub; - } - - // Put together the "service stub" for - // google.devtools.artifactregistry.v1.ArtifactRegistry. - this.artifactRegistryStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devtools.artifactregistry.v1.ArtifactRegistry') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devtools.artifactregistry.v1.ArtifactRegistry, - 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 artifactRegistryStubMethods = - ['listDockerImages', 'getDockerImage', 'listMavenArtifacts', 'getMavenArtifact', 'listNpmPackages', 'getNpmPackage', 'listPythonPackages', 'getPythonPackage', 'importAptArtifacts', 'importYumArtifacts', 'listRepositories', 'getRepository', 'createRepository', 'updateRepository', 'deleteRepository', 'listPackages', 'getPackage', 'deletePackage', 'listVersions', 'getVersion', 'deleteVersion', 'listFiles', 'getFile', 'listTags', 'getTag', 'createTag', 'updateTag', 'deleteTag', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'getProjectSettings', 'updateProjectSettings', 'getVpcscConfig', 'updateVpcscConfig']; - for (const methodName of artifactRegistryStubMethods) { - const callPromise = this.artifactRegistryStub.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.artifactRegistryStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'artifactregistry.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 'artifactregistry.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/cloud-platform.read-only' - ]; - } - - 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 a docker image. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the docker images. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.DockerImage|DockerImage}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.get_docker_image.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_async - */ - getDockerImage( - request?: protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IDockerImage, - protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|undefined, {}|undefined - ]>; - getDockerImage( - request: protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IDockerImage, - protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|null|undefined, - {}|null|undefined>): void; - getDockerImage( - request: protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IDockerImage, - protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|null|undefined, - {}|null|undefined>): void; - getDockerImage( - request?: protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IDockerImage, - protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IDockerImage, - protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IDockerImage, - protos.google.devtools.artifactregistry.v1.IGetDockerImageRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getDockerImage(request, options, callback); - } -/** - * Gets a maven artifact. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the maven artifact. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.MavenArtifact|MavenArtifact}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.get_maven_artifact.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetMavenArtifact_async - */ - getMavenArtifact( - request?: protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IMavenArtifact, - protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|undefined, {}|undefined - ]>; - getMavenArtifact( - request: protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IMavenArtifact, - protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|null|undefined, - {}|null|undefined>): void; - getMavenArtifact( - request: protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IMavenArtifact, - protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|null|undefined, - {}|null|undefined>): void; - getMavenArtifact( - request?: protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IMavenArtifact, - protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IMavenArtifact, - protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IMavenArtifact, - protos.google.devtools.artifactregistry.v1.IGetMavenArtifactRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getMavenArtifact(request, options, callback); - } -/** - * Gets a npm package. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the npm package. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.NpmPackage|NpmPackage}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.get_npm_package.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetNpmPackage_async - */ - getNpmPackage( - request?: protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.INpmPackage, - protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|undefined, {}|undefined - ]>; - getNpmPackage( - request: protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.INpmPackage, - protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|null|undefined, - {}|null|undefined>): void; - getNpmPackage( - request: protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.INpmPackage, - protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|null|undefined, - {}|null|undefined>): void; - getNpmPackage( - request?: protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.INpmPackage, - protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.INpmPackage, - protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.INpmPackage, - protos.google.devtools.artifactregistry.v1.IGetNpmPackageRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getNpmPackage(request, options, callback); - } -/** - * Gets a python package. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the python package. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.PythonPackage|PythonPackage}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.get_python_package.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetPythonPackage_async - */ - getPythonPackage( - request?: protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IPythonPackage, - protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|undefined, {}|undefined - ]>; - getPythonPackage( - request: protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IPythonPackage, - protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|null|undefined, - {}|null|undefined>): void; - getPythonPackage( - request: protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IPythonPackage, - protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|null|undefined, - {}|null|undefined>): void; - getPythonPackage( - request?: protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IPythonPackage, - protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IPythonPackage, - protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IPythonPackage, - protos.google.devtools.artifactregistry.v1.IGetPythonPackageRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getPythonPackage(request, options, callback); - } -/** - * Gets a repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the repository to retrieve. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.Repository|Repository}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.get_repository.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetRepository_async - */ - getRepository( - request?: protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|undefined, {}|undefined - ]>; - getRepository( - request: protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): void; - getRepository( - request: protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): void; - getRepository( - request?: protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getRepository(request, options, callback); - } -/** - * Updates a repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.artifactregistry.v1.Repository} request.repository - * The repository that replaces the resource on the server. - * @param {google.protobuf.FieldMask} request.updateMask - * The update mask applies to the resource. For the `FieldMask` definition, - * 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.devtools.artifactregistry.v1.Repository|Repository}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.update_repository.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_async - */ - updateRepository( - request?: protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|undefined, {}|undefined - ]>; - updateRepository( - request: protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|null|undefined, - {}|null|undefined>): void; - updateRepository( - request: protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|null|undefined, - {}|null|undefined>): void; - updateRepository( - request?: protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IRepository, - protos.google.devtools.artifactregistry.v1.IUpdateRepositoryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'repository.name': request.repository!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateRepository(request, options, callback); - } -/** - * Gets a package. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the package to retrieve. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.Package|Package}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.get_package.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetPackage_async - */ - getPackage( - request?: protos.google.devtools.artifactregistry.v1.IGetPackageRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IPackage, - protos.google.devtools.artifactregistry.v1.IGetPackageRequest|undefined, {}|undefined - ]>; - getPackage( - request: protos.google.devtools.artifactregistry.v1.IGetPackageRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IPackage, - protos.google.devtools.artifactregistry.v1.IGetPackageRequest|null|undefined, - {}|null|undefined>): void; - getPackage( - request: protos.google.devtools.artifactregistry.v1.IGetPackageRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IPackage, - protos.google.devtools.artifactregistry.v1.IGetPackageRequest|null|undefined, - {}|null|undefined>): void; - getPackage( - request?: protos.google.devtools.artifactregistry.v1.IGetPackageRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IPackage, - protos.google.devtools.artifactregistry.v1.IGetPackageRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IPackage, - protos.google.devtools.artifactregistry.v1.IGetPackageRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IPackage, - protos.google.devtools.artifactregistry.v1.IGetPackageRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getPackage(request, options, callback); - } -/** - * Gets a version - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the version to retrieve. - * @param {google.devtools.artifactregistry.v1.VersionView} request.view - * The view that should be returned in the response. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.Version|Version}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.get_version.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetVersion_async - */ - getVersion( - request?: protos.google.devtools.artifactregistry.v1.IGetVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IVersion, - protos.google.devtools.artifactregistry.v1.IGetVersionRequest|undefined, {}|undefined - ]>; - getVersion( - request: protos.google.devtools.artifactregistry.v1.IGetVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IVersion, - protos.google.devtools.artifactregistry.v1.IGetVersionRequest|null|undefined, - {}|null|undefined>): void; - getVersion( - request: protos.google.devtools.artifactregistry.v1.IGetVersionRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IVersion, - protos.google.devtools.artifactregistry.v1.IGetVersionRequest|null|undefined, - {}|null|undefined>): void; - getVersion( - request?: protos.google.devtools.artifactregistry.v1.IGetVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IVersion, - protos.google.devtools.artifactregistry.v1.IGetVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IVersion, - protos.google.devtools.artifactregistry.v1.IGetVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IVersion, - protos.google.devtools.artifactregistry.v1.IGetVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getVersion(request, options, callback); - } -/** - * Gets a file. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the file to retrieve. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.File|File}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.get_file.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetFile_async - */ - getFile( - request?: protos.google.devtools.artifactregistry.v1.IGetFileRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IFile, - protos.google.devtools.artifactregistry.v1.IGetFileRequest|undefined, {}|undefined - ]>; - getFile( - request: protos.google.devtools.artifactregistry.v1.IGetFileRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IFile, - protos.google.devtools.artifactregistry.v1.IGetFileRequest|null|undefined, - {}|null|undefined>): void; - getFile( - request: protos.google.devtools.artifactregistry.v1.IGetFileRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IFile, - protos.google.devtools.artifactregistry.v1.IGetFileRequest|null|undefined, - {}|null|undefined>): void; - getFile( - request?: protos.google.devtools.artifactregistry.v1.IGetFileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IFile, - protos.google.devtools.artifactregistry.v1.IGetFileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IFile, - protos.google.devtools.artifactregistry.v1.IGetFileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IFile, - protos.google.devtools.artifactregistry.v1.IGetFileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFile(request, options, callback); - } -/** - * Gets a tag. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the tag to retrieve. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.Tag|Tag}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.get_tag.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetTag_async - */ - getTag( - request?: protos.google.devtools.artifactregistry.v1.IGetTagRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IGetTagRequest|undefined, {}|undefined - ]>; - getTag( - request: protos.google.devtools.artifactregistry.v1.IGetTagRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IGetTagRequest|null|undefined, - {}|null|undefined>): void; - getTag( - request: protos.google.devtools.artifactregistry.v1.IGetTagRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IGetTagRequest|null|undefined, - {}|null|undefined>): void; - getTag( - request?: protos.google.devtools.artifactregistry.v1.IGetTagRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IGetTagRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IGetTagRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IGetTagRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getTag(request, options, callback); - } -/** - * Creates a tag. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the parent resource where the tag will be created. - * @param {string} request.tagId - * The tag id to use for this repository. - * @param {google.devtools.artifactregistry.v1.Tag} request.tag - * The tag 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.devtools.artifactregistry.v1.Tag|Tag}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.create_tag.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_CreateTag_async - */ - createTag( - request?: protos.google.devtools.artifactregistry.v1.ICreateTagRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.ICreateTagRequest|undefined, {}|undefined - ]>; - createTag( - request: protos.google.devtools.artifactregistry.v1.ICreateTagRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.ICreateTagRequest|null|undefined, - {}|null|undefined>): void; - createTag( - request: protos.google.devtools.artifactregistry.v1.ICreateTagRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.ICreateTagRequest|null|undefined, - {}|null|undefined>): void; - createTag( - request?: protos.google.devtools.artifactregistry.v1.ICreateTagRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.ICreateTagRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.ICreateTagRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.ICreateTagRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createTag(request, options, callback); - } -/** - * Updates a tag. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.artifactregistry.v1.Tag} request.tag - * The tag that replaces the resource on the server. - * @param {google.protobuf.FieldMask} request.updateMask - * The update mask applies to the resource. For the `FieldMask` definition, - * 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.devtools.artifactregistry.v1.Tag|Tag}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.update_tag.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_async - */ - updateTag( - request?: protos.google.devtools.artifactregistry.v1.IUpdateTagRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|undefined, {}|undefined - ]>; - updateTag( - request: protos.google.devtools.artifactregistry.v1.IUpdateTagRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|null|undefined, - {}|null|undefined>): void; - updateTag( - request: protos.google.devtools.artifactregistry.v1.IUpdateTagRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|null|undefined, - {}|null|undefined>): void; - updateTag( - request?: protos.google.devtools.artifactregistry.v1.IUpdateTagRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.ITag, - protos.google.devtools.artifactregistry.v1.IUpdateTagRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'tag.name': request.tag!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateTag(request, options, callback); - } -/** - * Deletes a tag. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the tag to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/artifact_registry.delete_tag.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_async - */ - deleteTag( - request?: protos.google.devtools.artifactregistry.v1.IDeleteTagRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|undefined, {}|undefined - ]>; - deleteTag( - request: protos.google.devtools.artifactregistry.v1.IDeleteTagRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|null|undefined, - {}|null|undefined>): void; - deleteTag( - request: protos.google.devtools.artifactregistry.v1.IDeleteTagRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|null|undefined, - {}|null|undefined>): void; - deleteTag( - request?: protos.google.devtools.artifactregistry.v1.IDeleteTagRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1.IDeleteTagRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteTag(request, options, callback); - } -/** - * Updates the IAM policy for a given resource. - * - * @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/artifact_registry.set_iam_policy.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_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 policy for a given resource. - * - * @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/artifact_registry.get_iam_policy.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_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 if the caller has a list of permissions on a resource. - * - * @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/artifact_registry.test_iam_permissions.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_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); - } -/** - * Retrieves the Settings for the Project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the projectSettings 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.devtools.artifactregistry.v1.ProjectSettings|ProjectSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.get_project_settings.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_async - */ - getProjectSettings( - request?: protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|undefined, {}|undefined - ]>; - getProjectSettings( - request: protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|null|undefined, - {}|null|undefined>): void; - getProjectSettings( - request: protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|null|undefined, - {}|null|undefined>): void; - getProjectSettings( - request?: protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IGetProjectSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getProjectSettings(request, options, callback); - } -/** - * Updates the Settings for the Project. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.artifactregistry.v1.ProjectSettings} request.projectSettings - * The project settings. - * @param {google.protobuf.FieldMask} request.updateMask - * Field mask to support partial updates. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.ProjectSettings|ProjectSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.update_project_settings.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_async - */ - updateProjectSettings( - request?: protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|undefined, {}|undefined - ]>; - updateProjectSettings( - request: protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateProjectSettings( - request: protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateProjectSettings( - request?: protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IProjectSettings, - protos.google.devtools.artifactregistry.v1.IUpdateProjectSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_settings.name': request.projectSettings!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateProjectSettings(request, options, callback); - } -/** - * Retrieves the VPCSC Config for the Project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the VPCSCConfig 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.devtools.artifactregistry.v1.VPCSCConfig|VPCSCConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.get_v_p_c_s_c_config.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_GetVPCSCConfig_async - */ - getVPCSCConfig( - request?: protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|undefined, {}|undefined - ]>; - getVPCSCConfig( - request: protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|null|undefined, - {}|null|undefined>): void; - getVPCSCConfig( - request: protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|null|undefined, - {}|null|undefined>): void; - getVPCSCConfig( - request?: protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IGetVPCSCConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getVpcscConfig(request, options, callback); - } -/** - * Updates the VPCSC Config for the Project. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.artifactregistry.v1.VPCSCConfig} request.vpcscConfig - * The project config. - * @param {google.protobuf.FieldMask} request.updateMask - * Field mask to support partial updates. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1.VPCSCConfig|VPCSCConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.update_v_p_c_s_c_config.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_UpdateVPCSCConfig_async - */ - updateVPCSCConfig( - request?: protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|undefined, {}|undefined - ]>; - updateVPCSCConfig( - request: protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|null|undefined, - {}|null|undefined>): void; - updateVPCSCConfig( - request: protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|null|undefined, - {}|null|undefined>): void; - updateVPCSCConfig( - request?: protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IVPCSCConfig, - protos.google.devtools.artifactregistry.v1.IUpdateVPCSCConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'vpcsc_config.name': request.vpcscConfig!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateVpcscConfig(request, options, callback); - } - -/** - * Imports Apt artifacts. The returned Operation will complete once the - * resources are imported. Package, Version, and File resources are created - * based on the imported artifacts. Imported artifacts that conflict with - * existing resources are ignored. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.artifactregistry.v1.ImportAptArtifactsGcsSource} request.gcsSource - * Google Cloud Storage location where input content is located. - * @param {string} request.parent - * The name of the parent resource where the artifacts will be imported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.import_apt_artifacts.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async - */ - importAptArtifacts( - request?: protos.google.devtools.artifactregistry.v1.IImportAptArtifactsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importAptArtifacts( - request: protos.google.devtools.artifactregistry.v1.IImportAptArtifactsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importAptArtifacts( - request: protos.google.devtools.artifactregistry.v1.IImportAptArtifactsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importAptArtifacts( - request?: protos.google.devtools.artifactregistry.v1.IImportAptArtifactsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.importAptArtifacts(request, options, callback); - } -/** - * Check the status of the long running operation returned by `importAptArtifacts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.import_apt_artifacts.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async - */ - async checkImportAptArtifactsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importAptArtifacts, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Imports Yum (RPM) artifacts. The returned Operation will complete once the - * resources are imported. Package, Version, and File resources are created - * based on the imported artifacts. Imported artifacts that conflict with - * existing resources are ignored. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.artifactregistry.v1.ImportYumArtifactsGcsSource} request.gcsSource - * Google Cloud Storage location where input content is located. - * @param {string} request.parent - * The name of the parent resource where the artifacts will be imported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.import_yum_artifacts.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async - */ - importYumArtifacts( - request?: protos.google.devtools.artifactregistry.v1.IImportYumArtifactsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importYumArtifacts( - request: protos.google.devtools.artifactregistry.v1.IImportYumArtifactsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importYumArtifacts( - request: protos.google.devtools.artifactregistry.v1.IImportYumArtifactsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importYumArtifacts( - request?: protos.google.devtools.artifactregistry.v1.IImportYumArtifactsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.importYumArtifacts(request, options, callback); - } -/** - * Check the status of the long running operation returned by `importYumArtifacts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.import_yum_artifacts.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async - */ - async checkImportYumArtifactsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importYumArtifacts, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a repository. The returned Operation will finish once the - * repository has been created. Its response will be the created Repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource where the repository will be created. - * @param {string} request.repositoryId - * The repository id to use for this repository. - * @param {google.devtools.artifactregistry.v1.Repository} request.repository - * The repository 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/artifact_registry.create_repository.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async - */ - createRepository( - request?: protos.google.devtools.artifactregistry.v1.ICreateRepositoryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createRepository( - request: protos.google.devtools.artifactregistry.v1.ICreateRepositoryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRepository( - request: protos.google.devtools.artifactregistry.v1.ICreateRepositoryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRepository( - request?: protos.google.devtools.artifactregistry.v1.ICreateRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createRepository(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createRepository()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.create_repository.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async - */ - async checkCreateRepositoryProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRepository, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a repository and all of its contents. The returned Operation will - * finish once the repository has been deleted. It will not have any Operation - * metadata and will return a google.protobuf.Empty response. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the repository to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.delete_repository.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async - */ - deleteRepository( - request?: protos.google.devtools.artifactregistry.v1.IDeleteRepositoryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteRepository( - request: protos.google.devtools.artifactregistry.v1.IDeleteRepositoryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRepository( - request: protos.google.devtools.artifactregistry.v1.IDeleteRepositoryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRepository( - request?: protos.google.devtools.artifactregistry.v1.IDeleteRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteRepository(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteRepository()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.delete_repository.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async - */ - async checkDeleteRepositoryProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRepository, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a package and all of its versions and tags. The returned operation - * will complete once the package has been deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the package to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.delete_package.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async - */ - deletePackage( - request?: protos.google.devtools.artifactregistry.v1.IDeletePackageRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deletePackage( - request: protos.google.devtools.artifactregistry.v1.IDeletePackageRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePackage( - request: protos.google.devtools.artifactregistry.v1.IDeletePackageRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePackage( - request?: protos.google.devtools.artifactregistry.v1.IDeletePackageRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deletePackage(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deletePackage()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.delete_package.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async - */ - async checkDeletePackageProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePackage, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a version and all of its content. The returned operation will - * complete once the version has been deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the version to delete. - * @param {boolean} request.force - * By default, a version that is tagged may not be deleted. If force=true, the - * version and any tags pointing to the version are 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/artifact_registry.delete_version.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async - */ - deleteVersion( - request?: protos.google.devtools.artifactregistry.v1.IDeleteVersionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteVersion( - request: protos.google.devtools.artifactregistry.v1.IDeleteVersionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteVersion( - request: protos.google.devtools.artifactregistry.v1.IDeleteVersionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteVersion( - request?: protos.google.devtools.artifactregistry.v1.IDeleteVersionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteVersion(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteVersion()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/artifact_registry.delete_version.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async - */ - async checkDeleteVersionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteVersion, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists docker images. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource whose docker images will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {string} request.orderBy - * The field to order the results by. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.artifactregistry.v1.DockerImage|DockerImage}. - * 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 `listDockerImagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDockerImages( - request?: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IDockerImage[], - protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest|null, - protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse - ]>; - listDockerImages( - request: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, - protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IDockerImage>): void; - listDockerImages( - request: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, - protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IDockerImage>): void; - listDockerImages( - request?: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, - protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IDockerImage>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, - protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IDockerImage>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IDockerImage[], - protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest|null, - protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listDockerImages(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 name of the parent resource whose docker images will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {string} request.orderBy - * The field to order the results by. - * @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.devtools.artifactregistry.v1.DockerImage|DockerImage} 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 `listDockerImagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDockerImagesStream( - request?: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, - 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['listDockerImages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDockerImages.createStream( - this.innerApiCalls.listDockerImages as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDockerImages`, 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 name of the parent resource whose docker images will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {string} request.orderBy - * The field to order the results by. - * @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.devtools.artifactregistry.v1.DockerImage|DockerImage}. 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/artifact_registry.list_docker_images.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_async - */ - listDockerImagesAsync( - request?: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, - 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['listDockerImages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDockerImages.asyncIterate( - this.innerApiCalls['listDockerImages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists maven artifacts. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource whose maven artifacts will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.MavenArtifact|MavenArtifact}. - * 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 `listMavenArtifactsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMavenArtifacts( - request?: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IMavenArtifact[], - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest|null, - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse - ]>; - listMavenArtifacts( - request: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IMavenArtifact>): void; - listMavenArtifacts( - request: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IMavenArtifact>): void; - listMavenArtifacts( - request?: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IMavenArtifact>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IMavenArtifact>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IMavenArtifact[], - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest|null, - protos.google.devtools.artifactregistry.v1.IListMavenArtifactsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listMavenArtifacts(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 name of the parent resource whose maven artifacts will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.MavenArtifact|MavenArtifact} 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 `listMavenArtifactsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listMavenArtifactsStream( - request?: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, - 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['listMavenArtifacts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMavenArtifacts.createStream( - this.innerApiCalls.listMavenArtifacts as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMavenArtifacts`, 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 name of the parent resource whose maven artifacts will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.MavenArtifact|MavenArtifact}. 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/artifact_registry.list_maven_artifacts.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListMavenArtifacts_async - */ - listMavenArtifactsAsync( - request?: protos.google.devtools.artifactregistry.v1.IListMavenArtifactsRequest, - 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['listMavenArtifacts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMavenArtifacts.asyncIterate( - this.innerApiCalls['listMavenArtifacts'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists npm packages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource whose npm packages will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.NpmPackage|NpmPackage}. - * 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 `listNpmPackagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNpmPackages( - request?: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.INpmPackage[], - protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest|null, - protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse - ]>; - listNpmPackages( - request: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.INpmPackage>): void; - listNpmPackages( - request: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.INpmPackage>): void; - listNpmPackages( - request?: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.INpmPackage>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.INpmPackage>): - Promise<[ - protos.google.devtools.artifactregistry.v1.INpmPackage[], - protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest|null, - protos.google.devtools.artifactregistry.v1.IListNpmPackagesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listNpmPackages(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 name of the parent resource whose npm packages will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.NpmPackage|NpmPackage} 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 `listNpmPackagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNpmPackagesStream( - request?: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, - 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['listNpmPackages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNpmPackages.createStream( - this.innerApiCalls.listNpmPackages as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNpmPackages`, 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 name of the parent resource whose npm packages will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.NpmPackage|NpmPackage}. 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/artifact_registry.list_npm_packages.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListNpmPackages_async - */ - listNpmPackagesAsync( - request?: protos.google.devtools.artifactregistry.v1.IListNpmPackagesRequest, - 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['listNpmPackages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNpmPackages.asyncIterate( - this.innerApiCalls['listNpmPackages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists python packages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource whose python packages will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.PythonPackage|PythonPackage}. - * 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 `listPythonPackagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPythonPackages( - request?: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IPythonPackage[], - protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest|null, - protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse - ]>; - listPythonPackages( - request: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IPythonPackage>): void; - listPythonPackages( - request: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IPythonPackage>): void; - listPythonPackages( - request?: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IPythonPackage>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IPythonPackage>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IPythonPackage[], - protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest|null, - protos.google.devtools.artifactregistry.v1.IListPythonPackagesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listPythonPackages(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 name of the parent resource whose python packages will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.PythonPackage|PythonPackage} 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 `listPythonPackagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPythonPackagesStream( - request?: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, - 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['listPythonPackages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPythonPackages.createStream( - this.innerApiCalls.listPythonPackages as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listPythonPackages`, 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 name of the parent resource whose python packages will be - * listed. - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.PythonPackage|PythonPackage}. 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/artifact_registry.list_python_packages.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListPythonPackages_async - */ - listPythonPackagesAsync( - request?: protos.google.devtools.artifactregistry.v1.IListPythonPackagesRequest, - 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['listPythonPackages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPythonPackages.asyncIterate( - this.innerApiCalls['listPythonPackages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists repositories. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource whose repositories will be listed. - * @param {number} request.pageSize - * The maximum number of repositories to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Repository|Repository}. - * 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 `listRepositoriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listRepositories( - request?: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IRepository[], - protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest|null, - protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse - ]>; - listRepositories( - request: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, - protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IRepository>): void; - listRepositories( - request: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, - protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IRepository>): void; - listRepositories( - request?: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, - protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IRepository>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, - protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IRepository>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IRepository[], - protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest|null, - protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listRepositories(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 name of the parent resource whose repositories will be listed. - * @param {number} request.pageSize - * The maximum number of repositories to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Repository|Repository} 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 `listRepositoriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listRepositoriesStream( - request?: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, - 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['listRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRepositories.createStream( - this.innerApiCalls.listRepositories as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRepositories`, 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 name of the parent resource whose repositories will be listed. - * @param {number} request.pageSize - * The maximum number of repositories to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Repository|Repository}. 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/artifact_registry.list_repositories.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_async - */ - listRepositoriesAsync( - request?: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, - 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['listRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRepositories.asyncIterate( - this.innerApiCalls['listRepositories'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists packages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource whose packages will be listed. - * @param {number} request.pageSize - * The maximum number of packages to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Package|Package}. - * 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 `listPackagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPackages( - request?: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IPackage[], - protos.google.devtools.artifactregistry.v1.IListPackagesRequest|null, - protos.google.devtools.artifactregistry.v1.IListPackagesResponse - ]>; - listPackages( - request: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IPackage>): void; - listPackages( - request: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IPackage>): void; - listPackages( - request?: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IPackage>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListPackagesRequest, - protos.google.devtools.artifactregistry.v1.IListPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IPackage>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IPackage[], - protos.google.devtools.artifactregistry.v1.IListPackagesRequest|null, - protos.google.devtools.artifactregistry.v1.IListPackagesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listPackages(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 name of the parent resource whose packages will be listed. - * @param {number} request.pageSize - * The maximum number of packages to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Package|Package} 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 `listPackagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPackagesStream( - request?: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, - 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['listPackages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPackages.createStream( - this.innerApiCalls.listPackages as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listPackages`, 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 name of the parent resource whose packages will be listed. - * @param {number} request.pageSize - * The maximum number of packages to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Package|Package}. 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/artifact_registry.list_packages.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListPackages_async - */ - listPackagesAsync( - request?: protos.google.devtools.artifactregistry.v1.IListPackagesRequest, - 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['listPackages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPackages.asyncIterate( - this.innerApiCalls['listPackages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists versions. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the parent resource whose versions will be listed. - * @param {number} request.pageSize - * The maximum number of versions to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {google.devtools.artifactregistry.v1.VersionView} request.view - * The view that should be returned in the response. - * @param {string} [request.orderBy] - * Optional. The field to order the results by. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.artifactregistry.v1.Version|Version}. - * 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 `listVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listVersions( - request?: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IVersion[], - protos.google.devtools.artifactregistry.v1.IListVersionsRequest|null, - protos.google.devtools.artifactregistry.v1.IListVersionsResponse - ]>; - listVersions( - request: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListVersionsRequest, - protos.google.devtools.artifactregistry.v1.IListVersionsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IVersion>): void; - listVersions( - request: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListVersionsRequest, - protos.google.devtools.artifactregistry.v1.IListVersionsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IVersion>): void; - listVersions( - request?: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListVersionsRequest, - protos.google.devtools.artifactregistry.v1.IListVersionsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IVersion>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListVersionsRequest, - protos.google.devtools.artifactregistry.v1.IListVersionsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IVersion>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IVersion[], - protos.google.devtools.artifactregistry.v1.IListVersionsRequest|null, - protos.google.devtools.artifactregistry.v1.IListVersionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listVersions(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 name of the parent resource whose versions will be listed. - * @param {number} request.pageSize - * The maximum number of versions to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {google.devtools.artifactregistry.v1.VersionView} request.view - * The view that should be returned in the response. - * @param {string} [request.orderBy] - * Optional. The field to order the results by. - * @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.devtools.artifactregistry.v1.Version|Version} 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 `listVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listVersionsStream( - request?: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, - 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['listVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVersions.createStream( - this.innerApiCalls.listVersions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listVersions`, 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 name of the parent resource whose versions will be listed. - * @param {number} request.pageSize - * The maximum number of versions to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {google.devtools.artifactregistry.v1.VersionView} request.view - * The view that should be returned in the response. - * @param {string} [request.orderBy] - * Optional. The field to order the results by. - * @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.devtools.artifactregistry.v1.Version|Version}. 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/artifact_registry.list_versions.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListVersions_async - */ - listVersionsAsync( - request?: protos.google.devtools.artifactregistry.v1.IListVersionsRequest, - 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['listVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVersions.asyncIterate( - this.innerApiCalls['listVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists files. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the repository whose files will be listed. For - * example: "projects/p1/locations/us-central1/repositories/repo1 - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `name` - * * `owner` - * - * An example of using a filter: - * - * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an - * ID starting with "a/b/". - * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> - * Files owned by the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of files to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {string} request.orderBy - * The field to order the results by. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.artifactregistry.v1.File|File}. - * 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 `listFilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFiles( - request?: protos.google.devtools.artifactregistry.v1.IListFilesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.IFile[], - protos.google.devtools.artifactregistry.v1.IListFilesRequest|null, - protos.google.devtools.artifactregistry.v1.IListFilesResponse - ]>; - listFiles( - request: protos.google.devtools.artifactregistry.v1.IListFilesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListFilesRequest, - protos.google.devtools.artifactregistry.v1.IListFilesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IFile>): void; - listFiles( - request: protos.google.devtools.artifactregistry.v1.IListFilesRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListFilesRequest, - protos.google.devtools.artifactregistry.v1.IListFilesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IFile>): void; - listFiles( - request?: protos.google.devtools.artifactregistry.v1.IListFilesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListFilesRequest, - protos.google.devtools.artifactregistry.v1.IListFilesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IFile>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListFilesRequest, - protos.google.devtools.artifactregistry.v1.IListFilesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.IFile>): - Promise<[ - protos.google.devtools.artifactregistry.v1.IFile[], - protos.google.devtools.artifactregistry.v1.IListFilesRequest|null, - protos.google.devtools.artifactregistry.v1.IListFilesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFiles(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 name of the repository whose files will be listed. For - * example: "projects/p1/locations/us-central1/repositories/repo1 - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `name` - * * `owner` - * - * An example of using a filter: - * - * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an - * ID starting with "a/b/". - * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> - * Files owned by the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of files to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {string} request.orderBy - * The field to order the results by. - * @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.devtools.artifactregistry.v1.File|File} 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 `listFilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFilesStream( - request?: protos.google.devtools.artifactregistry.v1.IListFilesRequest, - 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['listFiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFiles.createStream( - this.innerApiCalls.listFiles as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFiles`, 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 name of the repository whose files will be listed. For - * example: "projects/p1/locations/us-central1/repositories/repo1 - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `name` - * * `owner` - * - * An example of using a filter: - * - * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an - * ID starting with "a/b/". - * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> - * Files owned by the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of files to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {string} request.orderBy - * The field to order the results by. - * @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.devtools.artifactregistry.v1.File|File}. 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/artifact_registry.list_files.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListFiles_async - */ - listFilesAsync( - request?: protos.google.devtools.artifactregistry.v1.IListFilesRequest, - 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['listFiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFiles.asyncIterate( - this.innerApiCalls['listFiles'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists tags. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the parent resource whose tags will be listed. - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `version` - * - * An example of using a filter: - * - * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` - * --> Tags that are applied to the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of tags to return. Maximum page size is 10,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Tag|Tag}. - * 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 `listTagsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTags( - request?: protos.google.devtools.artifactregistry.v1.IListTagsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1.ITag[], - protos.google.devtools.artifactregistry.v1.IListTagsRequest|null, - protos.google.devtools.artifactregistry.v1.IListTagsResponse - ]>; - listTags( - request: protos.google.devtools.artifactregistry.v1.IListTagsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListTagsRequest, - protos.google.devtools.artifactregistry.v1.IListTagsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.ITag>): void; - listTags( - request: protos.google.devtools.artifactregistry.v1.IListTagsRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListTagsRequest, - protos.google.devtools.artifactregistry.v1.IListTagsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.ITag>): void; - listTags( - request?: protos.google.devtools.artifactregistry.v1.IListTagsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListTagsRequest, - protos.google.devtools.artifactregistry.v1.IListTagsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.ITag>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1.IListTagsRequest, - protos.google.devtools.artifactregistry.v1.IListTagsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1.ITag>): - Promise<[ - protos.google.devtools.artifactregistry.v1.ITag[], - protos.google.devtools.artifactregistry.v1.IListTagsRequest|null, - protos.google.devtools.artifactregistry.v1.IListTagsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listTags(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 name of the parent resource whose tags will be listed. - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `version` - * - * An example of using a filter: - * - * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` - * --> Tags that are applied to the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of tags to return. Maximum page size is 10,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Tag|Tag} 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 `listTagsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTagsStream( - request?: protos.google.devtools.artifactregistry.v1.IListTagsRequest, - 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['listTags']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTags.createStream( - this.innerApiCalls.listTags as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTags`, 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 name of the parent resource whose tags will be listed. - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `version` - * - * An example of using a filter: - * - * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` - * --> Tags that are applied to the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of tags to return. Maximum page size is 10,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1.Tag|Tag}. 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/artifact_registry.list_tags.js - * region_tag:artifactregistry_v1_generated_ArtifactRegistry_ListTags_async - */ - listTagsAsync( - request?: protos.google.devtools.artifactregistry.v1.IListTagsRequest, - 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['listTags']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTags.asyncIterate( - this.innerApiCalls['listTags'] 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 aptArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} apt_artifact - * @returns {string} Resource name string. - */ - aptArtifactPath(project:string,location:string,repository:string,aptArtifact:string) { - return this.pathTemplates.aptArtifactPathTemplate.render({ - project: project, - location: location, - repository: repository, - apt_artifact: aptArtifact, - }); - } - - /** - * Parse the project from AptArtifact resource. - * - * @param {string} aptArtifactName - * A fully-qualified path representing AptArtifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAptArtifactName(aptArtifactName: string) { - return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).project; - } - - /** - * Parse the location from AptArtifact resource. - * - * @param {string} aptArtifactName - * A fully-qualified path representing AptArtifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAptArtifactName(aptArtifactName: string) { - return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).location; - } - - /** - * Parse the repository from AptArtifact resource. - * - * @param {string} aptArtifactName - * A fully-qualified path representing AptArtifact resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromAptArtifactName(aptArtifactName: string) { - return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).repository; - } - - /** - * Parse the apt_artifact from AptArtifact resource. - * - * @param {string} aptArtifactName - * A fully-qualified path representing AptArtifact resource. - * @returns {string} A string representing the apt_artifact. - */ - matchAptArtifactFromAptArtifactName(aptArtifactName: string) { - return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).apt_artifact; - } - - /** - * Return a fully-qualified dockerImage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} docker_image - * @returns {string} Resource name string. - */ - dockerImagePath(project:string,location:string,repository:string,dockerImage:string) { - return this.pathTemplates.dockerImagePathTemplate.render({ - project: project, - location: location, - repository: repository, - docker_image: dockerImage, - }); - } - - /** - * Parse the project from DockerImage resource. - * - * @param {string} dockerImageName - * A fully-qualified path representing DockerImage resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDockerImageName(dockerImageName: string) { - return this.pathTemplates.dockerImagePathTemplate.match(dockerImageName).project; - } - - /** - * Parse the location from DockerImage resource. - * - * @param {string} dockerImageName - * A fully-qualified path representing DockerImage resource. - * @returns {string} A string representing the location. - */ - matchLocationFromDockerImageName(dockerImageName: string) { - return this.pathTemplates.dockerImagePathTemplate.match(dockerImageName).location; - } - - /** - * Parse the repository from DockerImage resource. - * - * @param {string} dockerImageName - * A fully-qualified path representing DockerImage resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromDockerImageName(dockerImageName: string) { - return this.pathTemplates.dockerImagePathTemplate.match(dockerImageName).repository; - } - - /** - * Parse the docker_image from DockerImage resource. - * - * @param {string} dockerImageName - * A fully-qualified path representing DockerImage resource. - * @returns {string} A string representing the docker_image. - */ - matchDockerImageFromDockerImageName(dockerImageName: string) { - return this.pathTemplates.dockerImagePathTemplate.match(dockerImageName).docker_image; - } - - /** - * Return a fully-qualified file resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} file - * @returns {string} Resource name string. - */ - filePath(project:string,location:string,repository:string,file:string) { - return this.pathTemplates.filePathTemplate.render({ - project: project, - location: location, - repository: repository, - file: file, - }); - } - - /** - * Parse the project from File resource. - * - * @param {string} fileName - * A fully-qualified path representing File resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFileName(fileName: string) { - return this.pathTemplates.filePathTemplate.match(fileName).project; - } - - /** - * Parse the location from File resource. - * - * @param {string} fileName - * A fully-qualified path representing File resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFileName(fileName: string) { - return this.pathTemplates.filePathTemplate.match(fileName).location; - } - - /** - * Parse the repository from File resource. - * - * @param {string} fileName - * A fully-qualified path representing File resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromFileName(fileName: string) { - return this.pathTemplates.filePathTemplate.match(fileName).repository; - } - - /** - * Parse the file from File resource. - * - * @param {string} fileName - * A fully-qualified path representing File resource. - * @returns {string} A string representing the file. - */ - matchFileFromFileName(fileName: string) { - return this.pathTemplates.filePathTemplate.match(fileName).file; - } - - /** - * Return a fully-qualified mavenArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} maven_artifact - * @returns {string} Resource name string. - */ - mavenArtifactPath(project:string,location:string,repository:string,mavenArtifact:string) { - return this.pathTemplates.mavenArtifactPathTemplate.render({ - project: project, - location: location, - repository: repository, - maven_artifact: mavenArtifact, - }); - } - - /** - * Parse the project from MavenArtifact resource. - * - * @param {string} mavenArtifactName - * A fully-qualified path representing MavenArtifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMavenArtifactName(mavenArtifactName: string) { - return this.pathTemplates.mavenArtifactPathTemplate.match(mavenArtifactName).project; - } - - /** - * Parse the location from MavenArtifact resource. - * - * @param {string} mavenArtifactName - * A fully-qualified path representing MavenArtifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMavenArtifactName(mavenArtifactName: string) { - return this.pathTemplates.mavenArtifactPathTemplate.match(mavenArtifactName).location; - } - - /** - * Parse the repository from MavenArtifact resource. - * - * @param {string} mavenArtifactName - * A fully-qualified path representing MavenArtifact resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromMavenArtifactName(mavenArtifactName: string) { - return this.pathTemplates.mavenArtifactPathTemplate.match(mavenArtifactName).repository; - } - - /** - * Parse the maven_artifact from MavenArtifact resource. - * - * @param {string} mavenArtifactName - * A fully-qualified path representing MavenArtifact resource. - * @returns {string} A string representing the maven_artifact. - */ - matchMavenArtifactFromMavenArtifactName(mavenArtifactName: string) { - return this.pathTemplates.mavenArtifactPathTemplate.match(mavenArtifactName).maven_artifact; - } - - /** - * Return a fully-qualified npmPackage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} npm_package - * @returns {string} Resource name string. - */ - npmPackagePath(project:string,location:string,repository:string,npmPackage:string) { - return this.pathTemplates.npmPackagePathTemplate.render({ - project: project, - location: location, - repository: repository, - npm_package: npmPackage, - }); - } - - /** - * Parse the project from NpmPackage resource. - * - * @param {string} npmPackageName - * A fully-qualified path representing NpmPackage resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNpmPackageName(npmPackageName: string) { - return this.pathTemplates.npmPackagePathTemplate.match(npmPackageName).project; - } - - /** - * Parse the location from NpmPackage resource. - * - * @param {string} npmPackageName - * A fully-qualified path representing NpmPackage resource. - * @returns {string} A string representing the location. - */ - matchLocationFromNpmPackageName(npmPackageName: string) { - return this.pathTemplates.npmPackagePathTemplate.match(npmPackageName).location; - } - - /** - * Parse the repository from NpmPackage resource. - * - * @param {string} npmPackageName - * A fully-qualified path representing NpmPackage resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromNpmPackageName(npmPackageName: string) { - return this.pathTemplates.npmPackagePathTemplate.match(npmPackageName).repository; - } - - /** - * Parse the npm_package from NpmPackage resource. - * - * @param {string} npmPackageName - * A fully-qualified path representing NpmPackage resource. - * @returns {string} A string representing the npm_package. - */ - matchNpmPackageFromNpmPackageName(npmPackageName: string) { - return this.pathTemplates.npmPackagePathTemplate.match(npmPackageName).npm_package; - } - - /** - * Return a fully-qualified package resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} packageParam - * @returns {string} Resource name string. - */ - packagePath(project:string,location:string,repository:string,packageParam:string) { - return this.pathTemplates.packagePathTemplate.render({ - project: project, - location: location, - repository: repository, - package: packageParam, - }); - } - - /** - * Parse the project from Package resource. - * - * @param {string} packageName - * A fully-qualified path representing Package resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPackageName(packageName: string) { - return this.pathTemplates.packagePathTemplate.match(packageName).project; - } - - /** - * Parse the location from Package resource. - * - * @param {string} packageName - * A fully-qualified path representing Package resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPackageName(packageName: string) { - return this.pathTemplates.packagePathTemplate.match(packageName).location; - } - - /** - * Parse the repository from Package resource. - * - * @param {string} packageName - * A fully-qualified path representing Package resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromPackageName(packageName: string) { - return this.pathTemplates.packagePathTemplate.match(packageName).repository; - } - - /** - * Parse the package from Package resource. - * - * @param {string} packageName - * A fully-qualified path representing Package resource. - * @returns {string} A string representing the package. - */ - matchPackageFromPackageName(packageName: string) { - return this.pathTemplates.packagePathTemplate.match(packageName).package; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing ProjectSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified pythonPackage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} python_package - * @returns {string} Resource name string. - */ - pythonPackagePath(project:string,location:string,repository:string,pythonPackage:string) { - return this.pathTemplates.pythonPackagePathTemplate.render({ - project: project, - location: location, - repository: repository, - python_package: pythonPackage, - }); - } - - /** - * Parse the project from PythonPackage resource. - * - * @param {string} pythonPackageName - * A fully-qualified path representing PythonPackage resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPythonPackageName(pythonPackageName: string) { - return this.pathTemplates.pythonPackagePathTemplate.match(pythonPackageName).project; - } - - /** - * Parse the location from PythonPackage resource. - * - * @param {string} pythonPackageName - * A fully-qualified path representing PythonPackage resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPythonPackageName(pythonPackageName: string) { - return this.pathTemplates.pythonPackagePathTemplate.match(pythonPackageName).location; - } - - /** - * Parse the repository from PythonPackage resource. - * - * @param {string} pythonPackageName - * A fully-qualified path representing PythonPackage resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromPythonPackageName(pythonPackageName: string) { - return this.pathTemplates.pythonPackagePathTemplate.match(pythonPackageName).repository; - } - - /** - * Parse the python_package from PythonPackage resource. - * - * @param {string} pythonPackageName - * A fully-qualified path representing PythonPackage resource. - * @returns {string} A string representing the python_package. - */ - matchPythonPackageFromPythonPackageName(pythonPackageName: string) { - return this.pathTemplates.pythonPackagePathTemplate.match(pythonPackageName).python_package; - } - - /** - * 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 tag resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} packageParam - * @param {string} tag - * @returns {string} Resource name string. - */ - tagPath(project:string,location:string,repository:string,packageParam:string,tag:string) { - return this.pathTemplates.tagPathTemplate.render({ - project: project, - location: location, - repository: repository, - package: packageParam, - tag: tag, - }); - } - - /** - * Parse the project from Tag resource. - * - * @param {string} tagName - * A fully-qualified path representing Tag resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTagName(tagName: string) { - return this.pathTemplates.tagPathTemplate.match(tagName).project; - } - - /** - * Parse the location from Tag resource. - * - * @param {string} tagName - * A fully-qualified path representing Tag resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTagName(tagName: string) { - return this.pathTemplates.tagPathTemplate.match(tagName).location; - } - - /** - * Parse the repository from Tag resource. - * - * @param {string} tagName - * A fully-qualified path representing Tag resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromTagName(tagName: string) { - return this.pathTemplates.tagPathTemplate.match(tagName).repository; - } - - /** - * Parse the package from Tag resource. - * - * @param {string} tagName - * A fully-qualified path representing Tag resource. - * @returns {string} A string representing the package. - */ - matchPackageFromTagName(tagName: string) { - return this.pathTemplates.tagPathTemplate.match(tagName).package; - } - - /** - * Parse the tag from Tag resource. - * - * @param {string} tagName - * A fully-qualified path representing Tag resource. - * @returns {string} A string representing the tag. - */ - matchTagFromTagName(tagName: string) { - return this.pathTemplates.tagPathTemplate.match(tagName).tag; - } - - /** - * Return a fully-qualified version resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} packageParam - * @param {string} version - * @returns {string} Resource name string. - */ - versionPath(project:string,location:string,repository:string,packageParam:string,version:string) { - return this.pathTemplates.versionPathTemplate.render({ - project: project, - location: location, - repository: repository, - package: packageParam, - version: version, - }); - } - - /** - * Parse the project from Version resource. - * - * @param {string} versionName - * A fully-qualified path representing Version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromVersionName(versionName: string) { - return this.pathTemplates.versionPathTemplate.match(versionName).project; - } - - /** - * Parse the location from Version resource. - * - * @param {string} versionName - * A fully-qualified path representing Version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromVersionName(versionName: string) { - return this.pathTemplates.versionPathTemplate.match(versionName).location; - } - - /** - * Parse the repository from Version resource. - * - * @param {string} versionName - * A fully-qualified path representing Version resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromVersionName(versionName: string) { - return this.pathTemplates.versionPathTemplate.match(versionName).repository; - } - - /** - * Parse the package from Version resource. - * - * @param {string} versionName - * A fully-qualified path representing Version resource. - * @returns {string} A string representing the package. - */ - matchPackageFromVersionName(versionName: string) { - return this.pathTemplates.versionPathTemplate.match(versionName).package; - } - - /** - * Parse the version from Version resource. - * - * @param {string} versionName - * A fully-qualified path representing Version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromVersionName(versionName: string) { - return this.pathTemplates.versionPathTemplate.match(versionName).version; - } - - /** - * Return a fully-qualified vpcscConfig resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - vpcscConfigPath(project:string,location:string) { - return this.pathTemplates.vpcscConfigPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from VpcscConfig resource. - * - * @param {string} vpcscConfigName - * A fully-qualified path representing VpcscConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromVpcscConfigName(vpcscConfigName: string) { - return this.pathTemplates.vpcscConfigPathTemplate.match(vpcscConfigName).project; - } - - /** - * Parse the location from VpcscConfig resource. - * - * @param {string} vpcscConfigName - * A fully-qualified path representing VpcscConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromVpcscConfigName(vpcscConfigName: string) { - return this.pathTemplates.vpcscConfigPathTemplate.match(vpcscConfigName).location; - } - - /** - * Return a fully-qualified yumArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} yum_artifact - * @returns {string} Resource name string. - */ - yumArtifactPath(project:string,location:string,repository:string,yumArtifact:string) { - return this.pathTemplates.yumArtifactPathTemplate.render({ - project: project, - location: location, - repository: repository, - yum_artifact: yumArtifact, - }); - } - - /** - * Parse the project from YumArtifact resource. - * - * @param {string} yumArtifactName - * A fully-qualified path representing YumArtifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromYumArtifactName(yumArtifactName: string) { - return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).project; - } - - /** - * Parse the location from YumArtifact resource. - * - * @param {string} yumArtifactName - * A fully-qualified path representing YumArtifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromYumArtifactName(yumArtifactName: string) { - return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).location; - } - - /** - * Parse the repository from YumArtifact resource. - * - * @param {string} yumArtifactName - * A fully-qualified path representing YumArtifact resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromYumArtifactName(yumArtifactName: string) { - return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).repository; - } - - /** - * Parse the yum_artifact from YumArtifact resource. - * - * @param {string} yumArtifactName - * A fully-qualified path representing YumArtifact resource. - * @returns {string} A string representing the yum_artifact. - */ - matchYumArtifactFromYumArtifactName(yumArtifactName: string) { - return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).yum_artifact; - } - - /** - * 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.artifactRegistryStub && !this._terminated) { - return this.artifactRegistryStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client_config.json b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client_config.json deleted file mode 100644 index c37497cdfbe..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_client_config.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "interfaces": { - "google.devtools.artifactregistry.v1.ArtifactRegistry": { - "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": { - "ListDockerImages": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDockerImage": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListMavenArtifacts": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetMavenArtifact": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListNpmPackages": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNpmPackage": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListPythonPackages": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetPythonPackage": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ImportAptArtifacts": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ImportYumArtifacts": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRepositories": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetRepository": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateRepository": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateRepository": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteRepository": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListPackages": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetPackage": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeletePackage": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListVersions": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetVersion": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteVersion": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListFiles": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetFile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTags": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetTag": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateTag": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateTag": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTag": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "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" - }, - "GetProjectSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateProjectSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetVPCSCConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateVPCSCConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_proto_list.json b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_proto_list.json deleted file mode 100644 index 9d786848a4a..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/artifact_registry_proto_list.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - "../../protos/google/devtools/artifactregistry/v1/apt_artifact.proto", - "../../protos/google/devtools/artifactregistry/v1/artifact.proto", - "../../protos/google/devtools/artifactregistry/v1/file.proto", - "../../protos/google/devtools/artifactregistry/v1/package.proto", - "../../protos/google/devtools/artifactregistry/v1/repository.proto", - "../../protos/google/devtools/artifactregistry/v1/service.proto", - "../../protos/google/devtools/artifactregistry/v1/settings.proto", - "../../protos/google/devtools/artifactregistry/v1/tag.proto", - "../../protos/google/devtools/artifactregistry/v1/version.proto", - "../../protos/google/devtools/artifactregistry/v1/vpcsc_config.proto", - "../../protos/google/devtools/artifactregistry/v1/yum_artifact.proto" -] diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/gapic_metadata.json deleted file mode 100644 index e4b40dec5c2..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,409 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.devtools.artifactregistry.v1", - "libraryPackage": "@google-cloud/artifact-registry", - "services": { - "ArtifactRegistry": { - "clients": { - "grpc": { - "libraryClient": "ArtifactRegistryClient", - "rpcs": { - "GetDockerImage": { - "methods": [ - "getDockerImage" - ] - }, - "GetMavenArtifact": { - "methods": [ - "getMavenArtifact" - ] - }, - "GetNpmPackage": { - "methods": [ - "getNpmPackage" - ] - }, - "GetPythonPackage": { - "methods": [ - "getPythonPackage" - ] - }, - "GetRepository": { - "methods": [ - "getRepository" - ] - }, - "UpdateRepository": { - "methods": [ - "updateRepository" - ] - }, - "GetPackage": { - "methods": [ - "getPackage" - ] - }, - "GetVersion": { - "methods": [ - "getVersion" - ] - }, - "GetFile": { - "methods": [ - "getFile" - ] - }, - "GetTag": { - "methods": [ - "getTag" - ] - }, - "CreateTag": { - "methods": [ - "createTag" - ] - }, - "UpdateTag": { - "methods": [ - "updateTag" - ] - }, - "DeleteTag": { - "methods": [ - "deleteTag" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "GetProjectSettings": { - "methods": [ - "getProjectSettings" - ] - }, - "UpdateProjectSettings": { - "methods": [ - "updateProjectSettings" - ] - }, - "GetVPCSCConfig": { - "methods": [ - "getVPCSCConfig" - ] - }, - "UpdateVPCSCConfig": { - "methods": [ - "updateVPCSCConfig" - ] - }, - "ImportAptArtifacts": { - "methods": [ - "importAptArtifacts" - ] - }, - "ImportYumArtifacts": { - "methods": [ - "importYumArtifacts" - ] - }, - "CreateRepository": { - "methods": [ - "createRepository" - ] - }, - "DeleteRepository": { - "methods": [ - "deleteRepository" - ] - }, - "DeletePackage": { - "methods": [ - "deletePackage" - ] - }, - "DeleteVersion": { - "methods": [ - "deleteVersion" - ] - }, - "ListDockerImages": { - "methods": [ - "listDockerImages", - "listDockerImagesStream", - "listDockerImagesAsync" - ] - }, - "ListMavenArtifacts": { - "methods": [ - "listMavenArtifacts", - "listMavenArtifactsStream", - "listMavenArtifactsAsync" - ] - }, - "ListNpmPackages": { - "methods": [ - "listNpmPackages", - "listNpmPackagesStream", - "listNpmPackagesAsync" - ] - }, - "ListPythonPackages": { - "methods": [ - "listPythonPackages", - "listPythonPackagesStream", - "listPythonPackagesAsync" - ] - }, - "ListRepositories": { - "methods": [ - "listRepositories", - "listRepositoriesStream", - "listRepositoriesAsync" - ] - }, - "ListPackages": { - "methods": [ - "listPackages", - "listPackagesStream", - "listPackagesAsync" - ] - }, - "ListVersions": { - "methods": [ - "listVersions", - "listVersionsStream", - "listVersionsAsync" - ] - }, - "ListFiles": { - "methods": [ - "listFiles", - "listFilesStream", - "listFilesAsync" - ] - }, - "ListTags": { - "methods": [ - "listTags", - "listTagsStream", - "listTagsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ArtifactRegistryClient", - "rpcs": { - "GetDockerImage": { - "methods": [ - "getDockerImage" - ] - }, - "GetMavenArtifact": { - "methods": [ - "getMavenArtifact" - ] - }, - "GetNpmPackage": { - "methods": [ - "getNpmPackage" - ] - }, - "GetPythonPackage": { - "methods": [ - "getPythonPackage" - ] - }, - "GetRepository": { - "methods": [ - "getRepository" - ] - }, - "UpdateRepository": { - "methods": [ - "updateRepository" - ] - }, - "GetPackage": { - "methods": [ - "getPackage" - ] - }, - "GetVersion": { - "methods": [ - "getVersion" - ] - }, - "GetFile": { - "methods": [ - "getFile" - ] - }, - "GetTag": { - "methods": [ - "getTag" - ] - }, - "CreateTag": { - "methods": [ - "createTag" - ] - }, - "UpdateTag": { - "methods": [ - "updateTag" - ] - }, - "DeleteTag": { - "methods": [ - "deleteTag" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "GetProjectSettings": { - "methods": [ - "getProjectSettings" - ] - }, - "UpdateProjectSettings": { - "methods": [ - "updateProjectSettings" - ] - }, - "GetVPCSCConfig": { - "methods": [ - "getVPCSCConfig" - ] - }, - "UpdateVPCSCConfig": { - "methods": [ - "updateVPCSCConfig" - ] - }, - "ImportAptArtifacts": { - "methods": [ - "importAptArtifacts" - ] - }, - "ImportYumArtifacts": { - "methods": [ - "importYumArtifacts" - ] - }, - "CreateRepository": { - "methods": [ - "createRepository" - ] - }, - "DeleteRepository": { - "methods": [ - "deleteRepository" - ] - }, - "DeletePackage": { - "methods": [ - "deletePackage" - ] - }, - "DeleteVersion": { - "methods": [ - "deleteVersion" - ] - }, - "ListDockerImages": { - "methods": [ - "listDockerImages", - "listDockerImagesStream", - "listDockerImagesAsync" - ] - }, - "ListMavenArtifacts": { - "methods": [ - "listMavenArtifacts", - "listMavenArtifactsStream", - "listMavenArtifactsAsync" - ] - }, - "ListNpmPackages": { - "methods": [ - "listNpmPackages", - "listNpmPackagesStream", - "listNpmPackagesAsync" - ] - }, - "ListPythonPackages": { - "methods": [ - "listPythonPackages", - "listPythonPackagesStream", - "listPythonPackagesAsync" - ] - }, - "ListRepositories": { - "methods": [ - "listRepositories", - "listRepositoriesStream", - "listRepositoriesAsync" - ] - }, - "ListPackages": { - "methods": [ - "listPackages", - "listPackagesStream", - "listPackagesAsync" - ] - }, - "ListVersions": { - "methods": [ - "listVersions", - "listVersionsStream", - "listVersionsAsync" - ] - }, - "ListFiles": { - "methods": [ - "listFiles", - "listFilesStream", - "listFilesAsync" - ] - }, - "ListTags": { - "methods": [ - "listTags", - "listTagsStream", - "listTagsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/src/v1/index.ts deleted file mode 100644 index 2491b7166cd..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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 {ArtifactRegistryClient} from './artifact_registry_client'; diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index d87aa817a75..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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 artifactregistry = require('@google-cloud/artifact-registry'); - -function main() { - const artifactRegistryClient = new artifactregistry.ArtifactRegistryClient(); -} - -main(); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index e830f64db5a..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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 {ArtifactRegistryClient} from '@google-cloud/artifact-registry'; - -// check that the client class type name can be used -function doStuffWithArtifactRegistryClient(client: ArtifactRegistryClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const artifactRegistryClient = new ArtifactRegistryClient(); - doStuffWithArtifactRegistryClient(artifactRegistryClient); -} - -main(); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/install.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1/test/gapic_artifact_registry_v1.ts b/owl-bot-staging/google-devtools-artifactregistry/v1/test/gapic_artifact_registry_v1.ts deleted file mode 100644 index b248668eeb1..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1/test/gapic_artifact_registry_v1.ts +++ /dev/null @@ -1,6612 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 artifactregistryModule 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.ArtifactRegistryClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = artifactregistryModule.v1.ArtifactRegistryClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = artifactregistryModule.v1.ArtifactRegistryClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = artifactregistryModule.v1.ArtifactRegistryClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.artifactRegistryStub, undefined); - await client.initialize(); - assert(client.artifactRegistryStub); - }); - - it('has close method for the initialized client', done => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.artifactRegistryStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.artifactRegistryStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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('getDockerImage', () => { - it('invokes getDockerImage without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetDockerImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetDockerImageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DockerImage() - ); - client.innerApiCalls.getDockerImage = stubSimpleCall(expectedResponse); - const [response] = await client.getDockerImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDockerImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDockerImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDockerImage without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetDockerImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetDockerImageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DockerImage() - ); - client.innerApiCalls.getDockerImage = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDockerImage( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IDockerImage|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDockerImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDockerImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDockerImage with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetDockerImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetDockerImageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDockerImage = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDockerImage(request), expectedError); - const actualRequest = (client.innerApiCalls.getDockerImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDockerImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDockerImage with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetDockerImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetDockerImageRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDockerImage(request), expectedError); - }); - }); - - describe('getMavenArtifact', () => { - it('invokes getMavenArtifact without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetMavenArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetMavenArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.MavenArtifact() - ); - client.innerApiCalls.getMavenArtifact = stubSimpleCall(expectedResponse); - const [response] = await client.getMavenArtifact(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMavenArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMavenArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMavenArtifact without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetMavenArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetMavenArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.MavenArtifact() - ); - client.innerApiCalls.getMavenArtifact = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMavenArtifact( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IMavenArtifact|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMavenArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMavenArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMavenArtifact with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetMavenArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetMavenArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMavenArtifact = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMavenArtifact(request), expectedError); - const actualRequest = (client.innerApiCalls.getMavenArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMavenArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMavenArtifact with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetMavenArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetMavenArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMavenArtifact(request), expectedError); - }); - }); - - describe('getNpmPackage', () => { - it('invokes getNpmPackage without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetNpmPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetNpmPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.NpmPackage() - ); - client.innerApiCalls.getNpmPackage = stubSimpleCall(expectedResponse); - const [response] = await client.getNpmPackage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNpmPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNpmPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNpmPackage without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetNpmPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetNpmPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.NpmPackage() - ); - client.innerApiCalls.getNpmPackage = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNpmPackage( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.INpmPackage|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNpmPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNpmPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNpmPackage with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetNpmPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetNpmPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNpmPackage = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNpmPackage(request), expectedError); - const actualRequest = (client.innerApiCalls.getNpmPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNpmPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNpmPackage with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetNpmPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetNpmPackageRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNpmPackage(request), expectedError); - }); - }); - - describe('getPythonPackage', () => { - it('invokes getPythonPackage without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetPythonPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPythonPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.PythonPackage() - ); - client.innerApiCalls.getPythonPackage = stubSimpleCall(expectedResponse); - const [response] = await client.getPythonPackage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPythonPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPythonPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPythonPackage without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetPythonPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPythonPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.PythonPackage() - ); - client.innerApiCalls.getPythonPackage = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPythonPackage( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IPythonPackage|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPythonPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPythonPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPythonPackage with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetPythonPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPythonPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPythonPackage = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPythonPackage(request), expectedError); - const actualRequest = (client.innerApiCalls.getPythonPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPythonPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPythonPackage with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetPythonPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPythonPackageRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getPythonPackage(request), expectedError); - }); - }); - - describe('getRepository', () => { - it('invokes getRepository without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Repository() - ); - client.innerApiCalls.getRepository = stubSimpleCall(expectedResponse); - const [response] = await client.getRepository(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Repository() - ); - client.innerApiCalls.getRepository = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRepository( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IRepository|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRepository = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getRepository(request), expectedError); - }); - }); - - describe('updateRepository', () => { - it('invokes updateRepository without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateRepositoryRequest() - ); - request.repository ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateRepositoryRequest', ['repository', 'name']); - request.repository.name = defaultValue1; - const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Repository() - ); - client.innerApiCalls.updateRepository = stubSimpleCall(expectedResponse); - const [response] = await client.updateRepository(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRepository without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateRepositoryRequest() - ); - request.repository ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateRepositoryRequest', ['repository', 'name']); - request.repository.name = defaultValue1; - const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Repository() - ); - client.innerApiCalls.updateRepository = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateRepository( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IRepository|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRepository with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateRepositoryRequest() - ); - request.repository ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateRepositoryRequest', ['repository', 'name']); - request.repository.name = defaultValue1; - const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRepository = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRepository with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateRepositoryRequest() - ); - request.repository ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateRepositoryRequest', ['repository', 'name']); - request.repository.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateRepository(request), expectedError); - }); - }); - - describe('getPackage', () => { - it('invokes getPackage without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Package() - ); - client.innerApiCalls.getPackage = stubSimpleCall(expectedResponse); - const [response] = await client.getPackage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPackage without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Package() - ); - client.innerApiCalls.getPackage = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPackage( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IPackage|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPackage with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPackage = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPackage(request), expectedError); - const actualRequest = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPackage with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetPackageRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getPackage(request), expectedError); - }); - }); - - describe('getVersion', () => { - it('invokes getVersion without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Version() - ); - client.innerApiCalls.getVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVersion without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Version() - ); - client.innerApiCalls.getVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getVersion( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVersion with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVersion with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getVersion(request), expectedError); - }); - }); - - describe('getFile', () => { - it('invokes getFile without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.File() - ); - client.innerApiCalls.getFile = stubSimpleCall(expectedResponse); - const [response] = await client.getFile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFile without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.File() - ); - client.innerApiCalls.getFile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFile( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IFile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFile with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFile(request), expectedError); - const actualRequest = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFile with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetFileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFile(request), expectedError); - }); - }); - - describe('getTag', () => { - it('invokes getTag without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Tag() - ); - client.innerApiCalls.getTag = stubSimpleCall(expectedResponse); - const [response] = await client.getTag(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTag without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Tag() - ); - client.innerApiCalls.getTag = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTag( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.ITag|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTag with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTag = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTag(request), expectedError); - const actualRequest = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTag with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetTagRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getTag(request), expectedError); - }); - }); - - describe('createTag', () => { - it('invokes createTag without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.CreateTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateTagRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Tag() - ); - client.innerApiCalls.createTag = stubSimpleCall(expectedResponse); - const [response] = await client.createTag(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTag without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.CreateTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateTagRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Tag() - ); - client.innerApiCalls.createTag = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTag( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.ITag|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTag with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.CreateTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateTagRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTag = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createTag(request), expectedError); - const actualRequest = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTag with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.CreateTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateTagRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createTag(request), expectedError); - }); - }); - - describe('updateTag', () => { - it('invokes updateTag without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateTagRequest() - ); - request.tag ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateTagRequest', ['tag', 'name']); - request.tag.name = defaultValue1; - const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Tag() - ); - client.innerApiCalls.updateTag = stubSimpleCall(expectedResponse); - const [response] = await client.updateTag(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTag without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateTagRequest() - ); - request.tag ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateTagRequest', ['tag', 'name']); - request.tag.name = defaultValue1; - const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.Tag() - ); - client.innerApiCalls.updateTag = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateTag( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.ITag|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTag with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateTagRequest() - ); - request.tag ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateTagRequest', ['tag', 'name']); - request.tag.name = defaultValue1; - const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTag = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateTag(request), expectedError); - const actualRequest = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTag with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateTagRequest() - ); - request.tag ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateTagRequest', ['tag', 'name']); - request.tag.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateTag(request), expectedError); - }); - }); - - describe('deleteTag', () => { - it('invokes deleteTag without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTag = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTag(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTag without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTag = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTag( - 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.deleteTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTag with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTag = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTag(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTag with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteTagRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteTag(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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('getProjectSettings', () => { - it('invokes getProjectSettings without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetProjectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetProjectSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ProjectSettings() - ); - client.innerApiCalls.getProjectSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getProjectSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProjectSettings without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetProjectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetProjectSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ProjectSettings() - ); - client.innerApiCalls.getProjectSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProjectSettings( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IProjectSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProjectSettings with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetProjectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetProjectSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProjectSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProjectSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProjectSettings with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetProjectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetProjectSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getProjectSettings(request), expectedError); - }); - }); - - describe('updateProjectSettings', () => { - it('invokes updateProjectSettings without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest() - ); - request.projectSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest', ['projectSettings', 'name']); - request.projectSettings.name = defaultValue1; - const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ProjectSettings() - ); - client.innerApiCalls.updateProjectSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateProjectSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProjectSettings without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest() - ); - request.projectSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest', ['projectSettings', 'name']); - request.projectSettings.name = defaultValue1; - const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ProjectSettings() - ); - client.innerApiCalls.updateProjectSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProjectSettings( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IProjectSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProjectSettings with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest() - ); - request.projectSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest', ['projectSettings', 'name']); - request.projectSettings.name = defaultValue1; - const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProjectSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateProjectSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProjectSettings with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest() - ); - request.projectSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateProjectSettingsRequest', ['projectSettings', 'name']); - request.projectSettings.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateProjectSettings(request), expectedError); - }); - }); - - describe('getVPCSCConfig', () => { - it('invokes getVPCSCConfig without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.VPCSCConfig() - ); - client.innerApiCalls.getVpcscConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getVPCSCConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVpcscConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVpcscConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVPCSCConfig without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.VPCSCConfig() - ); - client.innerApiCalls.getVpcscConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getVPCSCConfig( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IVPCSCConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVpcscConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVpcscConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVPCSCConfig with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getVpcscConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVPCSCConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getVpcscConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVpcscConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVPCSCConfig with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.GetVPCSCConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getVPCSCConfig(request), expectedError); - }); - }); - - describe('updateVPCSCConfig', () => { - it('invokes updateVPCSCConfig without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest() - ); - request.vpcscConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest', ['vpcscConfig', 'name']); - request.vpcscConfig.name = defaultValue1; - const expectedHeaderRequestParams = `vpcsc_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.VPCSCConfig() - ); - client.innerApiCalls.updateVpcscConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateVPCSCConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateVpcscConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVpcscConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateVPCSCConfig without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest() - ); - request.vpcscConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest', ['vpcscConfig', 'name']); - request.vpcscConfig.name = defaultValue1; - const expectedHeaderRequestParams = `vpcsc_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.VPCSCConfig() - ); - client.innerApiCalls.updateVpcscConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateVPCSCConfig( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IVPCSCConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateVpcscConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVpcscConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateVPCSCConfig with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest() - ); - request.vpcscConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest', ['vpcscConfig', 'name']); - request.vpcscConfig.name = defaultValue1; - const expectedHeaderRequestParams = `vpcsc_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateVpcscConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateVPCSCConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateVpcscConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVpcscConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateVPCSCConfig with closed client', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest() - ); - request.vpcscConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.UpdateVPCSCConfigRequest', ['vpcscConfig', 'name']); - request.vpcscConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateVPCSCConfig(request), expectedError); - }); - }); - - describe('importAptArtifacts', () => { - it('invokes importAptArtifacts without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importAptArtifacts = stubLongRunningCall(expectedResponse); - const [operation] = await client.importAptArtifacts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importAptArtifacts without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importAptArtifacts = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importAptArtifacts( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importAptArtifacts with call error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAptArtifacts = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importAptArtifacts(request), expectedError); - const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importAptArtifacts with LRO error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportAptArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAptArtifacts = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importAptArtifacts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportAptArtifactsProgress without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportAptArtifactsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportAptArtifactsProgress with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportAptArtifactsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importYumArtifacts', () => { - it('invokes importYumArtifacts without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importYumArtifacts = stubLongRunningCall(expectedResponse); - const [operation] = await client.importYumArtifacts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importYumArtifacts without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importYumArtifacts = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importYumArtifacts( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importYumArtifacts with call error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importYumArtifacts = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importYumArtifacts(request), expectedError); - const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importYumArtifacts with LRO error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ImportYumArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importYumArtifacts = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importYumArtifacts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportYumArtifactsProgress without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportYumArtifactsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportYumArtifactsProgress with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportYumArtifactsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createRepository', () => { - it('invokes createRepository without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRepository = stubLongRunningCall(expectedResponse); - const [operation] = await client.createRepository(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRepository = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRepository( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository with call error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRepository = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository with LRO error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRepository = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createRepository(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateRepositoryProgress without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateRepositoryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateRepositoryProgress with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateRepositoryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteRepository', () => { - it('invokes deleteRepository without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRepository = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteRepository(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRepository = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRepository( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository with call error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository with LRO error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteRepository(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteRepositoryProgress without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteRepositoryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteRepositoryProgress with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteRepositoryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deletePackage', () => { - it('invokes deletePackage without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeletePackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeletePackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePackage = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePackage(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePackage without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeletePackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeletePackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePackage = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePackage( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePackage with call error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeletePackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeletePackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePackage = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePackage(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePackage with LRO error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeletePackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeletePackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePackage = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePackage(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeletePackageProgress without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeletePackageProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeletePackageProgress with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeletePackageProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteVersion', () => { - it('invokes deleteVersion without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteVersion = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteVersion(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteVersion without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteVersion = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteVersion( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteVersion with call error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVersion = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteVersion with LRO error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.DeleteVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVersion = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteVersion(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteVersionProgress without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteVersionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteVersionProgress with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteVersionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listDockerImages', () => { - it('invokes listDockerImages without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - ]; - client.innerApiCalls.listDockerImages = stubSimpleCall(expectedResponse); - const [response] = await client.listDockerImages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDockerImages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDockerImages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDockerImages without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - ]; - client.innerApiCalls.listDockerImages = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDockerImages( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IDockerImage[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDockerImages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDockerImages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDockerImages with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDockerImages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDockerImages(request), expectedError); - const actualRequest = (client.innerApiCalls.listDockerImages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDockerImages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDockerImagesStream without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - ]; - client.descriptors.page.listDockerImages.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDockerImagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.DockerImage[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.DockerImage) => { - 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.listDockerImages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDockerImages, request)); - assert( - (client.descriptors.page.listDockerImages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDockerImagesStream with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDockerImages.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDockerImagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.DockerImage[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.DockerImage) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDockerImages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDockerImages, request)); - assert( - (client.descriptors.page.listDockerImages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDockerImages without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.DockerImage()), - ]; - client.descriptors.page.listDockerImages.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1.IDockerImage[] = []; - const iterable = client.listDockerImagesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDockerImages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDockerImages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDockerImages with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListDockerImagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListDockerImagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDockerImages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDockerImagesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1.IDockerImage[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDockerImages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDockerImages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listMavenArtifacts', () => { - it('invokes listMavenArtifacts without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - ]; - client.innerApiCalls.listMavenArtifacts = stubSimpleCall(expectedResponse); - const [response] = await client.listMavenArtifacts(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMavenArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMavenArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMavenArtifacts without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - ]; - client.innerApiCalls.listMavenArtifacts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMavenArtifacts( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IMavenArtifact[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMavenArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMavenArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMavenArtifacts with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMavenArtifacts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMavenArtifacts(request), expectedError); - const actualRequest = (client.innerApiCalls.listMavenArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMavenArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMavenArtifactsStream without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - ]; - client.descriptors.page.listMavenArtifacts.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMavenArtifactsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.MavenArtifact[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.MavenArtifact) => { - 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.listMavenArtifacts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMavenArtifacts, request)); - assert( - (client.descriptors.page.listMavenArtifacts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMavenArtifactsStream with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMavenArtifacts.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMavenArtifactsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.MavenArtifact[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.MavenArtifact) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMavenArtifacts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMavenArtifacts, request)); - assert( - (client.descriptors.page.listMavenArtifacts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMavenArtifacts without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.MavenArtifact()), - ]; - client.descriptors.page.listMavenArtifacts.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1.IMavenArtifact[] = []; - const iterable = client.listMavenArtifactsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMavenArtifacts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMavenArtifacts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMavenArtifacts with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListMavenArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMavenArtifacts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMavenArtifactsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1.IMavenArtifact[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMavenArtifacts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMavenArtifacts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listNpmPackages', () => { - it('invokes listNpmPackages without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - ]; - client.innerApiCalls.listNpmPackages = stubSimpleCall(expectedResponse); - const [response] = await client.listNpmPackages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNpmPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNpmPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNpmPackages without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - ]; - client.innerApiCalls.listNpmPackages = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNpmPackages( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.INpmPackage[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNpmPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNpmPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNpmPackages with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNpmPackages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNpmPackages(request), expectedError); - const actualRequest = (client.innerApiCalls.listNpmPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNpmPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNpmPackagesStream without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - ]; - client.descriptors.page.listNpmPackages.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNpmPackagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.NpmPackage[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.NpmPackage) => { - 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.listNpmPackages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNpmPackages, request)); - assert( - (client.descriptors.page.listNpmPackages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNpmPackagesStream with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNpmPackages.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNpmPackagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.NpmPackage[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.NpmPackage) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNpmPackages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNpmPackages, request)); - assert( - (client.descriptors.page.listNpmPackages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNpmPackages without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.NpmPackage()), - ]; - client.descriptors.page.listNpmPackages.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1.INpmPackage[] = []; - const iterable = client.listNpmPackagesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNpmPackages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNpmPackages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNpmPackages with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListNpmPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListNpmPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNpmPackages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNpmPackagesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1.INpmPackage[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNpmPackages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNpmPackages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listPythonPackages', () => { - it('invokes listPythonPackages without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - ]; - client.innerApiCalls.listPythonPackages = stubSimpleCall(expectedResponse); - const [response] = await client.listPythonPackages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPythonPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPythonPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPythonPackages without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - ]; - client.innerApiCalls.listPythonPackages = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPythonPackages( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IPythonPackage[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPythonPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPythonPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPythonPackages with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPythonPackages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPythonPackages(request), expectedError); - const actualRequest = (client.innerApiCalls.listPythonPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPythonPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPythonPackagesStream without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - ]; - client.descriptors.page.listPythonPackages.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPythonPackagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.PythonPackage[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.PythonPackage) => { - 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.listPythonPackages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPythonPackages, request)); - assert( - (client.descriptors.page.listPythonPackages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPythonPackagesStream with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPythonPackages.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPythonPackagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.PythonPackage[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.PythonPackage) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPythonPackages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPythonPackages, request)); - assert( - (client.descriptors.page.listPythonPackages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPythonPackages without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.PythonPackage()), - ]; - client.descriptors.page.listPythonPackages.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1.IPythonPackage[] = []; - const iterable = client.listPythonPackagesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPythonPackages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPythonPackages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPythonPackages with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPythonPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPythonPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPythonPackages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPythonPackagesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1.IPythonPackage[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPythonPackages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPythonPackages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listRepositories', () => { - it('invokes listRepositories without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - ]; - client.innerApiCalls.listRepositories = stubSimpleCall(expectedResponse); - const [response] = await client.listRepositories(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositories without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - ]; - client.innerApiCalls.listRepositories = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRepositories( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IRepository[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositories with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRepositories = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRepositories(request), expectedError); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositoriesStream without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - ]; - client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.Repository[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Repository) => { - 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.listRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); - assert( - (client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRepositoriesStream with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.Repository[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Repository) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); - assert( - (client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRepositories without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Repository()), - ]; - client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1.IRepository[] = []; - const iterable = client.listRepositoriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRepositories with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRepositoriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1.IRepository[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listPackages', () => { - it('invokes listPackages without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - ]; - client.innerApiCalls.listPackages = stubSimpleCall(expectedResponse); - const [response] = await client.listPackages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPackages without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - ]; - client.innerApiCalls.listPackages = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPackages( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IPackage[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPackages with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPackages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPackages(request), expectedError); - const actualRequest = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPackagesStream without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - ]; - client.descriptors.page.listPackages.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPackagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.Package[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Package) => { - 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.listPackages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPackages, request)); - assert( - (client.descriptors.page.listPackages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPackagesStream with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPackages.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPackagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.Package[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Package) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPackages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPackages, request)); - assert( - (client.descriptors.page.listPackages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPackages without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Package()), - ]; - client.descriptors.page.listPackages.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1.IPackage[] = []; - const iterable = client.listPackagesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPackages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPackages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPackages with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPackages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPackagesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1.IPackage[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPackages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPackages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listVersions', () => { - it('invokes listVersions without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - ]; - client.innerApiCalls.listVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVersions without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - ]; - client.innerApiCalls.listVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listVersions( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVersions with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVersionsStream without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - ]; - client.descriptors.page.listVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.Version[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Version) => { - 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.listVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); - assert( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listVersionsStream with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.Version[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Version) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); - assert( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listVersions without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Version()), - ]; - client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1.IVersion[] = []; - const iterable = client.listVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listVersions with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1.IVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFiles', () => { - it('invokes listFiles without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - ]; - client.innerApiCalls.listFiles = stubSimpleCall(expectedResponse); - const [response] = await client.listFiles(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFiles without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - ]; - client.innerApiCalls.listFiles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFiles( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.IFile[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFiles with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFiles(request), expectedError); - const actualRequest = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFilesStream without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - ]; - client.descriptors.page.listFiles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.File[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.File) => { - 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.listFiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFiles, request)); - assert( - (client.descriptors.page.listFiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFilesStream with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFiles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.File[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.File) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFiles, request)); - assert( - (client.descriptors.page.listFiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFiles without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.File()), - ]; - client.descriptors.page.listFiles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1.IFile[] = []; - const iterable = client.listFilesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFiles with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFilesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1.IFile[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listTags', () => { - it('invokes listTags without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - ]; - client.innerApiCalls.listTags = stubSimpleCall(expectedResponse); - const [response] = await client.listTags(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTags without error using callback', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - ]; - client.innerApiCalls.listTags = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTags( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1.ITag[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTags with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTags = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTags(request), expectedError); - const actualRequest = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTagsStream without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - ]; - client.descriptors.page.listTags.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTagsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.Tag[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Tag) => { - 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.listTags.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTags, request)); - assert( - (client.descriptors.page.listTags.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTagsStream with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listTags.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTagsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1.Tag[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1.Tag) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTags.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTags, request)); - assert( - (client.descriptors.page.listTags.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTags without error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1.Tag()), - ]; - client.descriptors.page.listTags.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1.ITag[] = []; - const iterable = client.listTagsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTags.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTags.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTags with error', async () => { - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listTags.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTagsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1.ITag[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTags.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTags.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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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('aptArtifact', () => { - const fakePath = "/rendered/path/aptArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - apt_artifact: "aptArtifactValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.aptArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.aptArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('aptArtifactPath', () => { - const result = client.aptArtifactPath("projectValue", "locationValue", "repositoryValue", "aptArtifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.aptArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAptArtifactName', () => { - const result = client.matchProjectFromAptArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAptArtifactName', () => { - const result = client.matchLocationFromAptArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromAptArtifactName', () => { - const result = client.matchRepositoryFromAptArtifactName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAptArtifactFromAptArtifactName', () => { - const result = client.matchAptArtifactFromAptArtifactName(fakePath); - assert.strictEqual(result, "aptArtifactValue"); - assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('dockerImage', () => { - const fakePath = "/rendered/path/dockerImage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - docker_image: "dockerImageValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.dockerImagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dockerImagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dockerImagePath', () => { - const result = client.dockerImagePath("projectValue", "locationValue", "repositoryValue", "dockerImageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dockerImagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDockerImageName', () => { - const result = client.matchProjectFromDockerImageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dockerImagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDockerImageName', () => { - const result = client.matchLocationFromDockerImageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dockerImagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromDockerImageName', () => { - const result = client.matchRepositoryFromDockerImageName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.dockerImagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDockerImageFromDockerImageName', () => { - const result = client.matchDockerImageFromDockerImageName(fakePath); - assert.strictEqual(result, "dockerImageValue"); - assert((client.pathTemplates.dockerImagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('file', () => { - const fakePath = "/rendered/path/file"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - file: "fileValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.filePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.filePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('filePath', () => { - const result = client.filePath("projectValue", "locationValue", "repositoryValue", "fileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.filePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFileName', () => { - const result = client.matchProjectFromFileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.filePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFileName', () => { - const result = client.matchLocationFromFileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.filePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromFileName', () => { - const result = client.matchRepositoryFromFileName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.filePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFileFromFileName', () => { - const result = client.matchFileFromFileName(fakePath); - assert.strictEqual(result, "fileValue"); - assert((client.pathTemplates.filePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mavenArtifact', () => { - const fakePath = "/rendered/path/mavenArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - maven_artifact: "mavenArtifactValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.mavenArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mavenArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mavenArtifactPath', () => { - const result = client.mavenArtifactPath("projectValue", "locationValue", "repositoryValue", "mavenArtifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mavenArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMavenArtifactName', () => { - const result = client.matchProjectFromMavenArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mavenArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMavenArtifactName', () => { - const result = client.matchLocationFromMavenArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mavenArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromMavenArtifactName', () => { - const result = client.matchRepositoryFromMavenArtifactName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.mavenArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMavenArtifactFromMavenArtifactName', () => { - const result = client.matchMavenArtifactFromMavenArtifactName(fakePath); - assert.strictEqual(result, "mavenArtifactValue"); - assert((client.pathTemplates.mavenArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('npmPackage', () => { - const fakePath = "/rendered/path/npmPackage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - npm_package: "npmPackageValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.npmPackagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.npmPackagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('npmPackagePath', () => { - const result = client.npmPackagePath("projectValue", "locationValue", "repositoryValue", "npmPackageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.npmPackagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNpmPackageName', () => { - const result = client.matchProjectFromNpmPackageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.npmPackagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromNpmPackageName', () => { - const result = client.matchLocationFromNpmPackageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.npmPackagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromNpmPackageName', () => { - const result = client.matchRepositoryFromNpmPackageName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.npmPackagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNpmPackageFromNpmPackageName', () => { - const result = client.matchNpmPackageFromNpmPackageName(fakePath); - assert.strictEqual(result, "npmPackageValue"); - assert((client.pathTemplates.npmPackagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('package', () => { - const fakePath = "/rendered/path/package"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - package: "packageValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.packagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.packagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('packagePath', () => { - const result = client.packagePath("projectValue", "locationValue", "repositoryValue", "packageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.packagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPackageName', () => { - const result = client.matchProjectFromPackageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.packagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPackageName', () => { - const result = client.matchLocationFromPackageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.packagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromPackageName', () => { - const result = client.matchRepositoryFromPackageName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.packagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPackageFromPackageName', () => { - const result = client.matchPackageFromPackageName(fakePath); - assert.strictEqual(result, "packageValue"); - assert((client.pathTemplates.packagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('pythonPackage', () => { - const fakePath = "/rendered/path/pythonPackage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - python_package: "pythonPackageValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.pythonPackagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.pythonPackagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('pythonPackagePath', () => { - const result = client.pythonPackagePath("projectValue", "locationValue", "repositoryValue", "pythonPackageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.pythonPackagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPythonPackageName', () => { - const result = client.matchProjectFromPythonPackageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.pythonPackagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPythonPackageName', () => { - const result = client.matchLocationFromPythonPackageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.pythonPackagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromPythonPackageName', () => { - const result = client.matchRepositoryFromPythonPackageName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.pythonPackagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPythonPackageFromPythonPackageName', () => { - const result = client.matchPythonPackageFromPythonPackageName(fakePath); - assert.strictEqual(result, "pythonPackageValue"); - assert((client.pathTemplates.pythonPackagePathTemplate.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 artifactregistryModule.v1.ArtifactRegistryClient({ - 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('tag', () => { - const fakePath = "/rendered/path/tag"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - package: "packageValue", - tag: "tagValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tagPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tagPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tagPath', () => { - const result = client.tagPath("projectValue", "locationValue", "repositoryValue", "packageValue", "tagValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tagPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTagName', () => { - const result = client.matchProjectFromTagName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tagPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTagName', () => { - const result = client.matchLocationFromTagName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tagPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromTagName', () => { - const result = client.matchRepositoryFromTagName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.tagPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPackageFromTagName', () => { - const result = client.matchPackageFromTagName(fakePath); - assert.strictEqual(result, "packageValue"); - assert((client.pathTemplates.tagPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTagFromTagName', () => { - const result = client.matchTagFromTagName(fakePath); - assert.strictEqual(result, "tagValue"); - assert((client.pathTemplates.tagPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('version', () => { - const fakePath = "/rendered/path/version"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - package: "packageValue", - version: "versionValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.versionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.versionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('versionPath', () => { - const result = client.versionPath("projectValue", "locationValue", "repositoryValue", "packageValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.versionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromVersionName', () => { - const result = client.matchProjectFromVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.versionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromVersionName', () => { - const result = client.matchLocationFromVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.versionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromVersionName', () => { - const result = client.matchRepositoryFromVersionName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.versionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPackageFromVersionName', () => { - const result = client.matchPackageFromVersionName(fakePath); - assert.strictEqual(result, "packageValue"); - assert((client.pathTemplates.versionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromVersionName', () => { - const result = client.matchVersionFromVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.versionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('vpcscConfig', () => { - const fakePath = "/rendered/path/vpcscConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.vpcscConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.vpcscConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('vpcscConfigPath', () => { - const result = client.vpcscConfigPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.vpcscConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromVpcscConfigName', () => { - const result = client.matchProjectFromVpcscConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.vpcscConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromVpcscConfigName', () => { - const result = client.matchLocationFromVpcscConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.vpcscConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('yumArtifact', () => { - const fakePath = "/rendered/path/yumArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - yum_artifact: "yumArtifactValue", - }; - const client = new artifactregistryModule.v1.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.yumArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.yumArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('yumArtifactPath', () => { - const result = client.yumArtifactPath("projectValue", "locationValue", "repositoryValue", "yumArtifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.yumArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromYumArtifactName', () => { - const result = client.matchProjectFromYumArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromYumArtifactName', () => { - const result = client.matchLocationFromYumArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromYumArtifactName', () => { - const result = client.matchRepositoryFromYumArtifactName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchYumArtifactFromYumArtifactName', () => { - const result = client.matchYumArtifactFromYumArtifactName(fakePath); - assert.strictEqual(result, "yumArtifactValue"); - assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1/tsconfig.json b/owl-bot-staging/google-devtools-artifactregistry/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1/webpack.config.js b/owl-bot-staging/google-devtools-artifactregistry/v1/webpack.config.js deleted file mode 100644 index d7daabc3ee8..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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: 'ArtifactRegistry', - filename: './artifact-registry.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-devtools-artifactregistry/v1beta2/.eslintignore b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1beta2/.eslintrc.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.gitignore b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1beta2/.jsdoc.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.jsdoc.js deleted file mode 100644 index 532a80143b5..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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/artifact-registry', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.mocharc.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1beta2/.prettierrc.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1beta2/README.md b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/README.md deleted file mode 100644 index 123ed7c7a23..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/README.md +++ /dev/null @@ -1 +0,0 @@ -Artifactregistry: Nodejs Client diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/package.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/package.json deleted file mode 100644 index 6810984ffda..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/artifact-registry", - "version": "0.1.0", - "description": "Artifactregistry client for Node.js", - "repository": "googleapis/nodejs-artifactregistry", - "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 artifactregistry", - "artifactregistry", - "artifact registry" - ], - "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-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/apt_artifact.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/apt_artifact.proto deleted file mode 100644 index 4ac8f8f439a..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/apt_artifact.proto +++ /dev/null @@ -1,115 +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.devtools.artifactregistry.v1beta2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "AptArtifactProto"; -option java_package = "com.google.devtools.artifactregistry.v1beta2"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; - -// A detailed representation of an Apt artifact. Information in the record -// is derived from the archive's control file. -// See https://www.debian.org/doc/debian-policy/ch-controlfields.html -message AptArtifact { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/AptArtifact" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}" - }; - - // Package type is either binary or source. - enum PackageType { - // Package type is not specified. - PACKAGE_TYPE_UNSPECIFIED = 0; - - // Binary package. - BINARY = 1; - - // Source package. - SOURCE = 2; - } - - // Output only. The Artifact Registry resource name of the artifact. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Apt package name of the artifact. - string package_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. An artifact is a binary or source package. - PackageType package_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Operating system architecture of the artifact. - string architecture = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Repository component of the artifact. - string component = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Contents of the artifact's control metadata file. - bytes control_file = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Google Cloud Storage location where the artifacts currently reside. -message ImportAptArtifactsGcsSource { - // Cloud Storage paths URI (e.g., gs://my_bucket//my_object). - repeated string uris = 1; - - // Supports URI wildcards for matching multiple objects from a single URI. - bool use_wildcards = 2; -} - -// The request to import new apt artifacts. -message ImportAptArtifactsRequest { - // The source location of the package binaries. - oneof source { - // Google Cloud Storage location where input content is located. - ImportAptArtifactsGcsSource gcs_source = 2; - } - - // The name of the parent resource where the artifacts will be imported. - string parent = 1; -} - -// Error information explaining why a package was not imported. -message ImportAptArtifactsErrorInfo { - // The source that was not imported. - oneof source { - // Google Cloud Storage location requested. - ImportAptArtifactsGcsSource gcs_source = 1; - } - - // The detailed error status. - google.rpc.Status error = 2; -} - -// The response message from importing APT artifacts. -message ImportAptArtifactsResponse { - // The Apt artifacts imported. - repeated AptArtifact apt_artifacts = 1; - - // Detailed error info for artifacts that were not imported. - repeated ImportAptArtifactsErrorInfo errors = 2; -} - -// The operation metadata for importing artifacts. -message ImportAptArtifactsMetadata { -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/file.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/file.proto deleted file mode 100644 index 645ee7ebb13..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/file.proto +++ /dev/null @@ -1,120 +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.devtools.artifactregistry.v1beta2; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "FileProto"; -option java_package = "com.google.devtools.artifactregistry.v1beta2"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; - -// A hash of file content. -message Hash { - // The algorithm used to compute the hash. - enum HashType { - // Unspecified. - HASH_TYPE_UNSPECIFIED = 0; - - // SHA256 hash. - SHA256 = 1; - - // MD5 hash. - MD5 = 2; - } - - // The algorithm used to compute the hash value. - HashType type = 1; - - // The hash value. - bytes value = 2; -} - -// Files store content that is potentially associated with Packages or Versions. -message File { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/File" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/files/{file}" - }; - - // The name of the file, for example: - // "projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt". - // If the file ID part contains slashes, they are escaped. - string name = 1; - - // The size of the File in bytes. - int64 size_bytes = 3; - - // The hashes of the file content. - repeated Hash hashes = 4; - - // The time when the File was created. - google.protobuf.Timestamp create_time = 5; - - // The time when the File was last updated. - google.protobuf.Timestamp update_time = 6; - - // The name of the Package or Version that owns this file, if any. - string owner = 7; -} - -// The request to list files. -message ListFilesRequest { - // The name of the repository whose files will be listed. For example: - // "projects/p1/locations/us-central1/repositories/repo1 - string parent = 1; - - // An expression for filtering the results of the request. Filter rules are - // case insensitive. The fields eligible for filtering are: - // - // * `name` - // * `owner` - // - // An example of using a filter: - // - // * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an - // ID starting with "a/b/". - // * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> - // Files owned by the version `1.0` in package `pkg1`. - string filter = 4; - - // The maximum number of files to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; -} - -// The response from listing files. -message ListFilesResponse { - // The files returned. - repeated File files = 1; - - // The token to retrieve the next page of files, or empty if there are no - // more files to return. - string next_page_token = 2; -} - -// The request to retrieve a file. -message GetFileRequest { - // The name of the file to retrieve. - string name = 1; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/package.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/package.proto deleted file mode 100644 index 0209490ff99..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/package.proto +++ /dev/null @@ -1,79 +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.devtools.artifactregistry.v1beta2; - -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "PackageProto"; -option java_package = "com.google.devtools.artifactregistry.v1beta2"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; - -// Packages are named collections of versions. -message Package { - // The name of the package, for example: - // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1". - string name = 1; - - // The display name of the package. - string display_name = 2; - - // The time when the package was created. - google.protobuf.Timestamp create_time = 5; - - // The time when the package was last updated. This includes publishing a new - // version of the package. - google.protobuf.Timestamp update_time = 6; -} - -// The request to list packages. -message ListPackagesRequest { - // The name of the parent resource whose packages will be listed. - string parent = 1; - - // The maximum number of packages to return. - // Maximum page size is 10,000. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; -} - -// The response from listing packages. -message ListPackagesResponse { - // The packages returned. - repeated Package packages = 1; - - // The token to retrieve the next page of packages, or empty if there are no - // more packages to return. - string next_page_token = 2; -} - -// The request to retrieve a package. -message GetPackageRequest { - // The name of the package to retrieve. - string name = 1; -} - -// The request to delete a package. -message DeletePackageRequest { - // The name of the package to delete. - string name = 1; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/repository.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/repository.proto deleted file mode 100644 index 903ef0290db..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/repository.proto +++ /dev/null @@ -1,201 +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.devtools.artifactregistry.v1beta2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "RepositoryProto"; -option java_package = "com.google.devtools.artifactregistry.v1beta2"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; - -// A Repository for storing artifacts with a specific format. -message Repository { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/Repository" - pattern: "projects/{project}/locations/{location}/repositories/{repository}" - }; - - // MavenRepositoryConfig is maven related repository details. - // Provides additional configuration details for repositories of the maven - // format type. - message MavenRepositoryConfig { - // VersionPolicy is the version policy for the repository. - enum VersionPolicy { - // VERSION_POLICY_UNSPECIFIED - the version policy is not defined. - // When the version policy is not defined, no validation is performed - // for the versions. - VERSION_POLICY_UNSPECIFIED = 0; - - // RELEASE - repository will accept only Release versions. - RELEASE = 1; - - // SNAPSHOT - repository will accept only Snapshot versions. - SNAPSHOT = 2; - } - - // The repository with this flag will allow publishing - // the same snapshot versions. - bool allow_snapshot_overwrites = 1; - - // Version policy defines the versions that the registry will accept. - VersionPolicy version_policy = 2; - } - - // A package format. - enum Format { - // Unspecified package format. - FORMAT_UNSPECIFIED = 0; - - // Docker package format. - DOCKER = 1; - - // Maven package format. - MAVEN = 2; - - // NPM package format. - NPM = 3; - - // APT package format. - APT = 5; - - // YUM package format. - YUM = 6; - - // Python package format. - PYTHON = 8; - } - - // Repository-specific configurations. - oneof format_config { - // Maven repository config contains repository level configuration - // for the repositories of maven type. - MavenRepositoryConfig maven_config = 9; - } - - // The name of the repository, for example: - // "projects/p1/locations/us-central1/repositories/repo1". - string name = 1; - - // The format of packages that are stored in the repository. - Format format = 2; - - // The user-provided description of the repository. - string description = 3; - - // Labels with user-defined metadata. - // This field may contain up to 64 entries. Label keys and values may be no - // longer than 63 characters. Label keys must begin with a lowercase letter - // and may only contain lowercase letters, numeric characters, underscores, - // and dashes. - map labels = 4; - - // The time when the repository was created. - google.protobuf.Timestamp create_time = 5; - - // The time when the repository was last updated. - google.protobuf.Timestamp update_time = 6; - - // The Cloud KMS resource name of the customer managed encryption key that’s - // used to encrypt the contents of the Repository. Has the form: - // `projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key`. - // This value may not be changed after the Repository has been created. - string kms_key_name = 8; -} - -// The request to list repositories. -message ListRepositoriesRequest { - // Required. The name of the parent resource whose repositories will be listed. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "artifactregistry.googleapis.com/Repository" - } - ]; - - // The maximum number of repositories to return. Maximum page size is 1,000. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; -} - -// The response from listing repositories. -message ListRepositoriesResponse { - // The repositories returned. - repeated Repository repositories = 1; - - // The token to retrieve the next page of repositories, or empty if there are - // no more repositories to return. - string next_page_token = 2; -} - -// The request to retrieve a repository. -message GetRepositoryRequest { - // Required. The name of the repository to retrieve. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/Repository" - } - ]; -} - -// The request to create a new repository. -message CreateRepositoryRequest { - // Required. The name of the parent resource where the repository will be created. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "artifactregistry.googleapis.com/Repository" - } - ]; - - // The repository id to use for this repository. - string repository_id = 2; - - // The repository to be created. - Repository repository = 3; -} - -// The request to update a repository. -message UpdateRepositoryRequest { - // The repository that replaces the resource on the server. - Repository repository = 1; - - // The update mask applies to the resource. For the `FieldMask` definition, - // see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 2; -} - -// The request to delete a repository. -message DeleteRepositoryRequest { - // Required. The name of the repository to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/Repository" - } - ]; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/service.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/service.proto deleted file mode 100644 index 976bd6700ad..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/service.proto +++ /dev/null @@ -1,304 +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.devtools.artifactregistry.v1beta2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/devtools/artifactregistry/v1beta2/apt_artifact.proto"; -import "google/devtools/artifactregistry/v1beta2/file.proto"; -import "google/devtools/artifactregistry/v1beta2/package.proto"; -import "google/devtools/artifactregistry/v1beta2/repository.proto"; -import "google/devtools/artifactregistry/v1beta2/settings.proto"; -import "google/devtools/artifactregistry/v1beta2/tag.proto"; -import "google/devtools/artifactregistry/v1beta2/version.proto"; -import "google/devtools/artifactregistry/v1beta2/yum_artifact.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "ServiceProto"; -option java_package = "com.google.devtools.artifactregistry.v1beta2"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; - -// The Artifact Registry API service. -// -// Artifact Registry is an artifact management system for storing artifacts -// from different package management systems. -// -// The resources managed by this API are: -// -// * Repositories, which group packages and their data. -// * Packages, which group versions and their tags. -// * Versions, which are specific forms of a package. -// * Tags, which represent alternative names for versions. -// * Files, which contain content and are optionally associated with a Package -// or Version. -service ArtifactRegistry { - option (google.api.default_host) = "artifactregistry.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Imports Apt artifacts. The returned Operation will complete once the - // resources are imported. Package, Version, and File resources are created - // based on the imported artifacts. Imported artifacts that conflict with - // existing resources are ignored. - rpc ImportAptArtifacts(ImportAptArtifactsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta2/{parent=projects/*/locations/*/repositories/*}/aptArtifacts:import" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.devtools.artifactregistry.v1beta2.ImportAptArtifactsResponse" - metadata_type: "google.devtools.artifactregistry.v1beta2.ImportAptArtifactsMetadata" - }; - } - - // Imports Yum (RPM) artifacts. The returned Operation will complete once the - // resources are imported. Package, Version, and File resources are created - // based on the imported artifacts. Imported artifacts that conflict with - // existing resources are ignored. - rpc ImportYumArtifacts(ImportYumArtifactsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta2/{parent=projects/*/locations/*/repositories/*}/yumArtifacts:import" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.devtools.artifactregistry.v1beta2.ImportYumArtifactsResponse" - metadata_type: "google.devtools.artifactregistry.v1beta2.ImportYumArtifactsMetadata" - }; - } - - // Lists repositories. - rpc ListRepositories(ListRepositoriesRequest) returns (ListRepositoriesResponse) { - option (google.api.http) = { - get: "/v1beta2/{parent=projects/*/locations/*}/repositories" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a repository. - rpc GetRepository(GetRepositoryRequest) returns (Repository) { - option (google.api.http) = { - get: "/v1beta2/{name=projects/*/locations/*/repositories/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a repository. The returned Operation will finish once the - // repository has been created. Its response will be the created Repository. - rpc CreateRepository(CreateRepositoryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta2/{parent=projects/*/locations/*}/repositories" - body: "repository" - }; - option (google.api.method_signature) = "parent,repository,repository_id"; - option (google.longrunning.operation_info) = { - response_type: "google.devtools.artifactregistry.v1beta2.Repository" - metadata_type: "google.devtools.artifactregistry.v1beta2.OperationMetadata" - }; - } - - // Updates a repository. - rpc UpdateRepository(UpdateRepositoryRequest) returns (Repository) { - option (google.api.http) = { - patch: "/v1beta2/{repository.name=projects/*/locations/*/repositories/*}" - body: "repository" - }; - option (google.api.method_signature) = "repository,update_mask"; - } - - // Deletes a repository and all of its contents. The returned Operation will - // finish once the repository has been deleted. It will not have any Operation - // metadata and will return a google.protobuf.Empty response. - rpc DeleteRepository(DeleteRepositoryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta2/{name=projects/*/locations/*/repositories/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.devtools.artifactregistry.v1beta2.OperationMetadata" - }; - } - - // Lists packages. - rpc ListPackages(ListPackagesRequest) returns (ListPackagesResponse) { - option (google.api.http) = { - get: "/v1beta2/{parent=projects/*/locations/*/repositories/*}/packages" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a package. - rpc GetPackage(GetPackageRequest) returns (Package) { - option (google.api.http) = { - get: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a package and all of its versions and tags. The returned operation - // will complete once the package has been deleted. - rpc DeletePackage(DeletePackageRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.devtools.artifactregistry.v1beta2.OperationMetadata" - }; - } - - // Lists versions. - rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { - option (google.api.http) = { - get: "/v1beta2/{parent=projects/*/locations/*/repositories/*/packages/*}/versions" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a version - rpc GetVersion(GetVersionRequest) returns (Version) { - option (google.api.http) = { - get: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*/versions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a version and all of its content. The returned operation will - // complete once the version has been deleted. - rpc DeleteVersion(DeleteVersionRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*/versions/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.devtools.artifactregistry.v1beta2.OperationMetadata" - }; - } - - // Lists files. - rpc ListFiles(ListFilesRequest) returns (ListFilesResponse) { - option (google.api.http) = { - get: "/v1beta2/{parent=projects/*/locations/*/repositories/*}/files" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a file. - rpc GetFile(GetFileRequest) returns (File) { - option (google.api.http) = { - get: "/v1beta2/{name=projects/*/locations/*/repositories/*/files/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists tags. - rpc ListTags(ListTagsRequest) returns (ListTagsResponse) { - option (google.api.http) = { - get: "/v1beta2/{parent=projects/*/locations/*/repositories/*/packages/*}/tags" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a tag. - rpc GetTag(GetTagRequest) returns (Tag) { - option (google.api.http) = { - get: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*/tags/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a tag. - rpc CreateTag(CreateTagRequest) returns (Tag) { - option (google.api.http) = { - post: "/v1beta2/{parent=projects/*/locations/*/repositories/*/packages/*}/tags" - body: "tag" - }; - option (google.api.method_signature) = "parent,tag,tag_id"; - } - - // Updates a tag. - rpc UpdateTag(UpdateTagRequest) returns (Tag) { - option (google.api.http) = { - patch: "/v1beta2/{tag.name=projects/*/locations/*/repositories/*/packages/*/tags/*}" - body: "tag" - }; - option (google.api.method_signature) = "tag,update_mask"; - } - - // Deletes a tag. - rpc DeleteTag(DeleteTagRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta2/{name=projects/*/locations/*/repositories/*/packages/*/tags/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the IAM policy for a given resource. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1beta2/{resource=projects/*/locations/*/repositories/*}:setIamPolicy" - body: "*" - }; - } - - // Gets the IAM policy for a given resource. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - get: "/v1beta2/{resource=projects/*/locations/*/repositories/*}:getIamPolicy" - }; - } - - // Tests if the caller has a list of permissions on a resource. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1beta2/{resource=projects/*/locations/*/repositories/*}:testIamPermissions" - body: "*" - }; - } - - // Retrieves the Settings for the Project. - rpc GetProjectSettings(GetProjectSettingsRequest) returns (ProjectSettings) { - option (google.api.http) = { - get: "/v1beta2/{name=projects/*/projectSettings}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the Settings for the Project. - rpc UpdateProjectSettings(UpdateProjectSettingsRequest) returns (ProjectSettings) { - option (google.api.http) = { - patch: "/v1beta2/{project_settings.name=projects/*/projectSettings}" - body: "project_settings" - }; - option (google.api.method_signature) = "project_settings,update_mask"; - } -} - -// Metadata type for longrunning-operations, currently empty. -message OperationMetadata { - -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/settings.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/settings.proto deleted file mode 100644 index 111556f1174..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/settings.proto +++ /dev/null @@ -1,84 +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.devtools.artifactregistry.v1beta2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "SettingsProto"; -option java_package = "com.google.devtools.artifactregistry.v1beta2"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; - -// The Artifact Registry settings that apply to a Project. -message ProjectSettings { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/ProjectSettings" - pattern: "projects/{project}/projectSettings" - }; - - // The possible redirection states for legacy repositories. - enum RedirectionState { - // No redirection status has been set. - REDIRECTION_STATE_UNSPECIFIED = 0; - - // Redirection is disabled. - REDIRECTION_FROM_GCR_IO_DISABLED = 1; - - // Redirection is enabled. - REDIRECTION_FROM_GCR_IO_ENABLED = 2; - - // Redirection is enabled, and has been finalized so cannot be reverted. - REDIRECTION_FROM_GCR_IO_FINALIZED = 3; - } - - // The name of the project's settings. - // - // Always of the form: - // projects/{project-id}/projectSettings - // - // In update request: never set - // In response: always set - string name = 1; - - // The redirection state of the legacy repositories in this project. - RedirectionState legacy_redirection_state = 2; -} - -// Gets the redirection status for a project. -message GetProjectSettingsRequest { - // Required. The name of the projectSettings resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "artifactregistry.googleapis.com/ProjectSettings" - } - ]; -} - -// Sets the settings of the project. -message UpdateProjectSettingsRequest { - // The project settings. - ProjectSettings project_settings = 2; - - // Field mask to support partial updates. - google.protobuf.FieldMask update_mask = 3; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/tag.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/tag.proto deleted file mode 100644 index c969fee4403..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/tag.proto +++ /dev/null @@ -1,118 +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.devtools.artifactregistry.v1beta2; - -import "google/api/resource.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "TagProto"; -option java_package = "com.google.devtools.artifactregistry.v1beta2"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; - -// Tags point to a version and represent an alternative name that can be used -// to access the version. -message Tag { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/Tag" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}" - }; - - // The name of the tag, for example: - // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". - // If the package part contains slashes, the slashes are escaped. - // The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else - // must be URL encoded. - string name = 1; - - // The name of the version the tag refers to, for example: - // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811" - // If the package or version ID parts contain slashes, the slashes are - // escaped. - string version = 2; -} - -// The request to list tags. -message ListTagsRequest { - // The name of the parent resource whose tags will be listed. - string parent = 1; - - // An expression for filtering the results of the request. Filter rules are - // case insensitive. The fields eligible for filtering are: - // - // * `version` - // - // An example of using a filter: - // - // * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` - // --> Tags that are applied to the version `1.0` in package `pkg1`. - string filter = 4; - - // The maximum number of tags to return. Maximum page size is 10,000. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; -} - -// The response from listing tags. -message ListTagsResponse { - // The tags returned. - repeated Tag tags = 1; - - // The token to retrieve the next page of tags, or empty if there are no - // more tags to return. - string next_page_token = 2; -} - -// The request to retrieve a tag. -message GetTagRequest { - // The name of the tag to retrieve. - string name = 1; -} - -// The request to create a new tag. -message CreateTagRequest { - // The name of the parent resource where the tag will be created. - string parent = 1; - - // The tag id to use for this repository. - string tag_id = 2; - - // The tag to be created. - Tag tag = 3; -} - -// The request to create or update a tag. -message UpdateTagRequest { - // The tag that replaces the resource on the server. - Tag tag = 1; - - // The update mask applies to the resource. For the `FieldMask` definition, - // see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 2; -} - -// The request to delete a tag. -message DeleteTagRequest { - // The name of the tag to delete. - string name = 1; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/version.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/version.proto deleted file mode 100644 index a9635c7f4a9..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/version.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.devtools.artifactregistry.v1beta2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/devtools/artifactregistry/v1beta2/tag.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "VersionProto"; -option java_package = "com.google.devtools.artifactregistry.v1beta2"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; - -// The view, which determines what version information is returned in a -// response. -enum VersionView { - // The default / unset value. - // The API will default to the BASIC view. - VERSION_VIEW_UNSPECIFIED = 0; - - // Includes basic information about the version, but not any related tags. - BASIC = 1; - - // Include everything. - FULL = 2; -} - -// The body of a version resource. A version resource represents a -// collection of components, such as files and other data. This may correspond -// to a version in many package management schemes. -message Version { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/Version" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}" - }; - - // The name of the version, for example: - // "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/art1". - // If the package or version ID parts contain slashes, the slashes are - // escaped. - string name = 1; - - // Optional. Description of the version, as specified in its metadata. - string description = 3; - - // The time when the version was created. - google.protobuf.Timestamp create_time = 5; - - // The time when the version was last updated. - google.protobuf.Timestamp update_time = 6; - - // Output only. A list of related tags. Will contain up to 100 tags that - // reference this version. - repeated Tag related_tags = 7; - - // Output only. Repository-specific Metadata stored against this version. - // The fields returned are defined by the underlying repository-specific - // resource. Currently, the only resource in use is - // [DockerImage][google.devtools.artifactregistry.v1.DockerImage] - google.protobuf.Struct metadata = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request to list versions. -message ListVersionsRequest { - // The name of the parent resource whose versions will be listed. - string parent = 1; - - // The maximum number of versions to return. Maximum page size is 1,000. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request, if any. - string page_token = 3; - - // The view that should be returned in the response. - VersionView view = 4; - - // Optional. The field to order the results by. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from listing versions. -message ListVersionsResponse { - // The versions returned. - repeated Version versions = 1; - - // The token to retrieve the next page of versions, or empty if there are no - // more versions to return. - string next_page_token = 2; -} - -// The request to retrieve a version. -message GetVersionRequest { - // The name of the version to retrieve. - string name = 1; - - // The view that should be returned in the response. - VersionView view = 2; -} - -// The request to delete a version. -message DeleteVersionRequest { - // The name of the version to delete. - string name = 1; - - // By default, a version that is tagged may not be deleted. If force=true, the - // version and any tags pointing to the version are deleted. - bool force = 2; -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/yum_artifact.proto b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/yum_artifact.proto deleted file mode 100644 index a4467411db2..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/protos/google/devtools/artifactregistry/v1beta2/yum_artifact.proto +++ /dev/null @@ -1,107 +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.devtools.artifactregistry.v1beta2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2"; -option go_package = "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb;artifactregistrypb"; -option java_multiple_files = true; -option java_outer_classname = "YumArtifactProto"; -option java_package = "com.google.devtools.artifactregistry.v1beta2"; -option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2"; -option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2"; - -// A detailed representation of a Yum artifact. -message YumArtifact { - option (google.api.resource) = { - type: "artifactregistry.googleapis.com/YumArtifact" - pattern: "projects/{project}/locations/{location}/repositories/{repository}/yumArtifacts/{yum_artifact}" - }; - - // Package type is either binary or source. - enum PackageType { - // Package type is not specified. - PACKAGE_TYPE_UNSPECIFIED = 0; - - // Binary package (.rpm). - BINARY = 1; - - // Source package (.srpm). - SOURCE = 2; - } - - // Output only. The Artifact Registry resource name of the artifact. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The yum package name of the artifact. - string package_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. An artifact is a binary or source package. - PackageType package_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Operating system architecture of the artifact. - string architecture = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Google Cloud Storage location where the artifacts currently reside. -message ImportYumArtifactsGcsSource { - // Cloud Storage paths URI (e.g., gs://my_bucket//my_object). - repeated string uris = 1; - - // Supports URI wildcards for matching multiple objects from a single URI. - bool use_wildcards = 2; -} - -// The request to import new yum artifacts. -message ImportYumArtifactsRequest { - // The source location of the package binaries. - oneof source { - // Google Cloud Storage location where input content is located. - ImportYumArtifactsGcsSource gcs_source = 2; - } - - // The name of the parent resource where the artifacts will be imported. - string parent = 1; -} - -// Error information explaining why a package was not imported. -message ImportYumArtifactsErrorInfo { - // The source that was not imported. - oneof source { - // Google Cloud Storage location requested. - ImportYumArtifactsGcsSource gcs_source = 1; - } - - // The detailed error status. - google.rpc.Status error = 2; -} - -// The response message from importing YUM artifacts. -message ImportYumArtifactsResponse { - // The yum artifacts imported. - repeated YumArtifact yum_artifacts = 1; - - // Detailed error info for artifacts that were not imported. - repeated ImportYumArtifactsErrorInfo errors = 2; -} - -// The operation metadata for importing artifacts. -message ImportYumArtifactsMetadata { -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_repository.js deleted file mode 100644 index 9341f250462..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_repository.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 artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 parent resource where the repository will be created. - */ - // const parent = 'abc123' - /** - * The repository id to use for this repository. - */ - // const repositoryId = 'abc123' - /** - * The repository to be created. - */ - // const repository = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callCreateRepository() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await artifactregistryClient.createRepository(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateRepository(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_tag.js deleted file mode 100644 index 8e2e6007230..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.create_tag.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() { - // [START artifactregistry_v1beta2_generated_ArtifactRegistry_CreateTag_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the parent resource where the tag will be created. - */ - // const parent = 'abc123' - /** - * The tag id to use for this repository. - */ - // const tagId = 'abc123' - /** - * The tag to be created. - */ - // const tag = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callCreateTag() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.createTag(request); - console.log(response); - } - - callCreateTag(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_CreateTag_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_package.js deleted file mode 100644 index cdd58e430bf..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_package.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 artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the package to delete. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callDeletePackage() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await artifactregistryClient.deletePackage(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeletePackage(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_repository.js deleted file mode 100644 index 9348b99dcf4..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_repository.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 artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 repository to delete. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callDeleteRepository() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await artifactregistryClient.deleteRepository(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteRepository(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_tag.js deleted file mode 100644 index 925cc99351c..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_tag.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically 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 artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteTag_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the tag to delete. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callDeleteTag() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.deleteTag(request); - console.log(response); - } - - callDeleteTag(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteTag_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_version.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_version.js deleted file mode 100644 index c7200680120..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.delete_version.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 artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the version to delete. - */ - // const name = 'abc123' - /** - * By default, a version that is tagged may not be deleted. If force=true, the - * version and any tags pointing to the version are deleted. - */ - // const force = true - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callDeleteVersion() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await artifactregistryClient.deleteVersion(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteVersion(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_file.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_file.js deleted file mode 100644 index b799deb6d63..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_file.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically 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 artifactregistry_v1beta2_generated_ArtifactRegistry_GetFile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the file to retrieve. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetFile() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.getFile(request); - console.log(response); - } - - callGetFile(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetFile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_iam_policy.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_iam_policy.js deleted file mode 100644 index e59a3b8fd5d..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.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 artifactregistry_v1beta2_generated_ArtifactRegistry_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 Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await artifactregistryClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_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-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_package.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_package.js deleted file mode 100644 index 9c19f11c032..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_package.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically 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 artifactregistry_v1beta2_generated_ArtifactRegistry_GetPackage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the package to retrieve. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetPackage() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.getPackage(request); - console.log(response); - } - - callGetPackage(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetPackage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_project_settings.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_project_settings.js deleted file mode 100644 index d10d842e05e..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_project_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 artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 projectSettings resource. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetProjectSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await artifactregistryClient.getProjectSettings(request); - console.log(response); - } - - callGetProjectSettings(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_repository.js deleted file mode 100644 index 0ddb274a142..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_repository.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 artifactregistry_v1beta2_generated_ArtifactRegistry_GetRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 repository to retrieve. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetRepository() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await artifactregistryClient.getRepository(request); - console.log(response); - } - - callGetRepository(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_tag.js deleted file mode 100644 index 509bc806a28..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_tag.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically 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 artifactregistry_v1beta2_generated_ArtifactRegistry_GetTag_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the tag to retrieve. - */ - // const name = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetTag() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.getTag(request); - console.log(response); - } - - callGetTag(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetTag_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_version.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_version.js deleted file mode 100644 index 9f76a47b6ad..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.get_version.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() { - // [START artifactregistry_v1beta2_generated_ArtifactRegistry_GetVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the version to retrieve. - */ - // const name = 'abc123' - /** - * The view that should be returned in the response. - */ - // const view = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callGetVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.getVersion(request); - console.log(response); - } - - callGetVersion(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_apt_artifacts.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_apt_artifacts.js deleted file mode 100644 index b68e743cf10..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_apt_artifacts.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() { - // [START artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Google Cloud Storage location where input content is located. - */ - // const gcsSource = {} - /** - * The name of the parent resource where the artifacts will be imported. - */ - // const parent = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callImportAptArtifacts() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await artifactregistryClient.importAptArtifacts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportAptArtifacts(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_yum_artifacts.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_yum_artifacts.js deleted file mode 100644 index ac6f7be7cab..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.import_yum_artifacts.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() { - // [START artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Google Cloud Storage location where input content is located. - */ - // const gcsSource = {} - /** - * The name of the parent resource where the artifacts will be imported. - */ - // const parent = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callImportYumArtifacts() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await artifactregistryClient.importYumArtifacts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportYumArtifacts(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_files.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_files.js deleted file mode 100644 index d67e9249ac0..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_files.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() { - // [START artifactregistry_v1beta2_generated_ArtifactRegistry_ListFiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the repository whose files will be listed. For example: - * "projects/p1/locations/us-central1/repositories/repo1 - */ - // const parent = 'abc123' - /** - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `name` - * * `owner` - * An example of using a filter: - * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an - * ID starting with "a/b/". - * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> - * Files owned by the version `1.0` in package `pkg1`. - */ - // const filter = 'abc123' - /** - * The maximum number of files to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListFiles() { - // Construct request - const request = { - }; - - // Run request - const iterable = await artifactregistryClient.listFilesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFiles(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ListFiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_packages.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_packages.js deleted file mode 100644 index 44043b4989b..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_packages.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() { - // [START artifactregistry_v1beta2_generated_ArtifactRegistry_ListPackages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the parent resource whose packages will be listed. - */ - // const parent = 'abc123' - /** - * The maximum number of packages to return. - * Maximum page size is 10,000. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListPackages() { - // Construct request - const request = { - }; - - // Run request - const iterable = await artifactregistryClient.listPackagesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListPackages(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ListPackages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_repositories.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_repositories.js deleted file mode 100644 index e6bca968d90..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_repositories.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(parent) { - // [START artifactregistry_v1beta2_generated_ArtifactRegistry_ListRepositories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 parent resource whose repositories will be listed. - */ - // const parent = 'abc123' - /** - * The maximum number of repositories to return. Maximum page size is 1,000. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListRepositories() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await artifactregistryClient.listRepositoriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRepositories(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ListRepositories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_tags.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_tags.js deleted file mode 100644 index 1a948f679d2..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_tags.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 artifactregistry_v1beta2_generated_ArtifactRegistry_ListTags_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the parent resource whose tags will be listed. - */ - // const parent = 'abc123' - /** - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `version` - * An example of using a filter: - * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` - * --> Tags that are applied to the version `1.0` in package `pkg1`. - */ - // const filter = 'abc123' - /** - * The maximum number of tags to return. Maximum page size is 10,000. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListTags() { - // Construct request - const request = { - }; - - // Run request - const iterable = await artifactregistryClient.listTagsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTags(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ListTags_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_versions.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_versions.js deleted file mode 100644 index 8172e26ca8c..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.list_versions.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 artifactregistry_v1beta2_generated_ArtifactRegistry_ListVersions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the parent resource whose versions will be listed. - */ - // const parent = 'abc123' - /** - * The maximum number of versions to return. Maximum page size is 1,000. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request, if any. - */ - // const pageToken = 'abc123' - /** - * The view that should be returned in the response. - */ - // const view = {} - /** - * Optional. The field to order the results by. - */ - // const orderBy = 'abc123' - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callListVersions() { - // Construct request - const request = { - }; - - // Run request - const iterable = await artifactregistryClient.listVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListVersions(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_ListVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.set_iam_policy.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.set_iam_policy.js deleted file mode 100644 index 98e1c63e556..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.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 artifactregistry_v1beta2_generated_ArtifactRegistry_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 Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await artifactregistryClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_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-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.test_iam_permissions.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.test_iam_permissions.js deleted file mode 100644 index 56088e2484a..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.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 artifactregistry_v1beta2_generated_ArtifactRegistry_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 Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await artifactregistryClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_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-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_project_settings.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_project_settings.js deleted file mode 100644 index 1d5093e9948..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_project_settings.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() { - // [START artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateProjectSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 settings. - */ - // const projectSettings = {} - /** - * Field mask to support partial updates. - */ - // const updateMask = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callUpdateProjectSettings() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.updateProjectSettings(request); - console.log(response); - } - - callUpdateProjectSettings(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateProjectSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_repository.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_repository.js deleted file mode 100644 index d4aa1d3a222..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_repository.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 artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 repository that replaces the resource on the server. - */ - // const repository = {} - /** - * The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callUpdateRepository() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.updateRepository(request); - console.log(response); - } - - callUpdateRepository(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_tag.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_tag.js deleted file mode 100644 index 587b8ffe2f6..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/artifact_registry.update_tag.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 artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateTag_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 tag that replaces the resource on the server. - */ - // const tag = {} - /** - * The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Artifactregistry library - const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1beta2; - - // Instantiates a client - const artifactregistryClient = new ArtifactRegistryClient(); - - async function callUpdateTag() { - // Construct request - const request = { - }; - - // Run request - const response = await artifactregistryClient.updateTag(request); - console.log(response); - } - - callUpdateTag(); - // [END artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateTag_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/snippet_metadata_google.devtools.artifactregistry.v1beta2.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/snippet_metadata_google.devtools.artifactregistry.v1beta2.json deleted file mode 100644 index e51d58b7b1b..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/samples/generated/v1beta2/snippet_metadata_google.devtools.artifactregistry.v1beta2.json +++ /dev/null @@ -1,1131 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-artifactregistry", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.devtools.artifactregistry.v1beta2", - "version": "v1beta2" - } - ] - }, - "snippets": [ - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_async", - "title": "ArtifactRegistry importAptArtifacts Sample", - "origin": "API_DEFINITION", - "description": " Imports Apt artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.", - "canonical": true, - "file": "artifact_registry.import_apt_artifacts.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportAptArtifacts", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportAptArtifacts", - "async": true, - "parameters": [ - { - "name": "gcs_source", - "type": ".google.devtools.artifactregistry.v1beta2.ImportAptArtifactsGcsSource" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "ImportAptArtifacts", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportAptArtifacts", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_async", - "title": "ArtifactRegistry importYumArtifacts Sample", - "origin": "API_DEFINITION", - "description": " Imports Yum (RPM) artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.", - "canonical": true, - "file": "artifact_registry.import_yum_artifacts.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportYumArtifacts", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportYumArtifacts", - "async": true, - "parameters": [ - { - "name": "gcs_source", - "type": ".google.devtools.artifactregistry.v1beta2.ImportYumArtifactsGcsSource" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "ImportYumArtifacts", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportYumArtifacts", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListRepositories_async", - "title": "ArtifactRegistry listRepositories Sample", - "origin": "API_DEFINITION", - "description": " Lists repositories.", - "canonical": true, - "file": "artifact_registry.list_repositories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRepositories", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListRepositories", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.ListRepositoriesResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListRepositories", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListRepositories", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetRepository_async", - "title": "ArtifactRegistry getRepository Sample", - "origin": "API_DEFINITION", - "description": " Gets a repository.", - "canonical": true, - "file": "artifact_registry.get_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRepository", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetRepository", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.Repository", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetRepository", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetRepository", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_async", - "title": "ArtifactRegistry createRepository Sample", - "origin": "API_DEFINITION", - "description": " Creates a repository. The returned Operation will finish once the repository has been created. Its response will be the created Repository.", - "canonical": true, - "file": "artifact_registry.create_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateRepository", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateRepository", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "repository_id", - "type": "TYPE_STRING" - }, - { - "name": "repository", - "type": ".google.devtools.artifactregistry.v1beta2.Repository" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "CreateRepository", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateRepository", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateRepository_async", - "title": "ArtifactRegistry updateRepository Sample", - "origin": "API_DEFINITION", - "description": " Updates a repository.", - "canonical": true, - "file": "artifact_registry.update_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateRepository", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateRepository", - "async": true, - "parameters": [ - { - "name": "repository", - "type": ".google.devtools.artifactregistry.v1beta2.Repository" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.Repository", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "UpdateRepository", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateRepository", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_async", - "title": "ArtifactRegistry deleteRepository Sample", - "origin": "API_DEFINITION", - "description": " Deletes a repository and all of its contents. The returned Operation will finish once the repository has been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response.", - "canonical": true, - "file": "artifact_registry.delete_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteRepository", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteRepository", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "DeleteRepository", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteRepository", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListPackages_async", - "title": "ArtifactRegistry listPackages Sample", - "origin": "API_DEFINITION", - "description": " Lists packages.", - "canonical": true, - "file": "artifact_registry.list_packages.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListPackages", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListPackages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.ListPackagesResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListPackages", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListPackages", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetPackage_async", - "title": "ArtifactRegistry getPackage Sample", - "origin": "API_DEFINITION", - "description": " Gets a package.", - "canonical": true, - "file": "artifact_registry.get_package.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPackage", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetPackage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.Package", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetPackage", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetPackage", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_async", - "title": "ArtifactRegistry deletePackage Sample", - "origin": "API_DEFINITION", - "description": " Deletes a package and all of its versions and tags. The returned operation will complete once the package has been deleted.", - "canonical": true, - "file": "artifact_registry.delete_package.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeletePackage", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeletePackage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "DeletePackage", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeletePackage", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListVersions_async", - "title": "ArtifactRegistry listVersions Sample", - "origin": "API_DEFINITION", - "description": " Lists versions.", - "canonical": true, - "file": "artifact_registry.list_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListVersions", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListVersions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.devtools.artifactregistry.v1beta2.VersionView" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.ListVersionsResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListVersions", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListVersions", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetVersion_async", - "title": "ArtifactRegistry getVersion Sample", - "origin": "API_DEFINITION", - "description": " Gets a version", - "canonical": true, - "file": "artifact_registry.get_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetVersion", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.devtools.artifactregistry.v1beta2.VersionView" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.Version", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetVersion", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetVersion", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_async", - "title": "ArtifactRegistry deleteVersion Sample", - "origin": "API_DEFINITION", - "description": " Deletes a version and all of its content. The returned operation will complete once the version has been deleted.", - "canonical": true, - "file": "artifact_registry.delete_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteVersion", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "DeleteVersion", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteVersion", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListFiles_async", - "title": "ArtifactRegistry listFiles Sample", - "origin": "API_DEFINITION", - "description": " Lists files.", - "canonical": true, - "file": "artifact_registry.list_files.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFiles", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListFiles", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.ListFilesResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListFiles", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListFiles", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetFile_async", - "title": "ArtifactRegistry getFile Sample", - "origin": "API_DEFINITION", - "description": " Gets a file.", - "canonical": true, - "file": "artifact_registry.get_file.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFile", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetFile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.File", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetFile", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetFile", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListTags_async", - "title": "ArtifactRegistry listTags Sample", - "origin": "API_DEFINITION", - "description": " Lists tags.", - "canonical": true, - "file": "artifact_registry.list_tags.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTags", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListTags", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.ListTagsResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "ListTags", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListTags", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetTag_async", - "title": "ArtifactRegistry getTag Sample", - "origin": "API_DEFINITION", - "description": " Gets a tag.", - "canonical": true, - "file": "artifact_registry.get_tag.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTag", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetTag", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.Tag", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetTag", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetTag", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_CreateTag_async", - "title": "ArtifactRegistry createTag Sample", - "origin": "API_DEFINITION", - "description": " Creates a tag.", - "canonical": true, - "file": "artifact_registry.create_tag.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateTag", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateTag", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "tag_id", - "type": "TYPE_STRING" - }, - { - "name": "tag", - "type": ".google.devtools.artifactregistry.v1beta2.Tag" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.Tag", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "CreateTag", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateTag", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateTag_async", - "title": "ArtifactRegistry updateTag Sample", - "origin": "API_DEFINITION", - "description": " Updates a tag.", - "canonical": true, - "file": "artifact_registry.update_tag.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateTag", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateTag", - "async": true, - "parameters": [ - { - "name": "tag", - "type": ".google.devtools.artifactregistry.v1beta2.Tag" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.Tag", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "UpdateTag", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateTag", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteTag_async", - "title": "ArtifactRegistry deleteTag Sample", - "origin": "API_DEFINITION", - "description": " Deletes a tag.", - "canonical": true, - "file": "artifact_registry.delete_tag.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteTag", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteTag", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "DeleteTag", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteTag", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_SetIamPolicy_async", - "title": "ArtifactRegistry setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Updates the IAM policy for a given resource.", - "canonical": true, - "file": "artifact_registry.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.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": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.SetIamPolicy", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetIamPolicy_async", - "title": "ArtifactRegistry getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the IAM policy for a given resource.", - "canonical": true, - "file": "artifact_registry.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetIamPolicy", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_TestIamPermissions_async", - "title": "ArtifactRegistry testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Tests if the caller has a list of permissions on a resource.", - "canonical": true, - "file": "artifact_registry.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.TestIamPermissions", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_async", - "title": "ArtifactRegistry getProjectSettings Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the Settings for the Project.", - "canonical": true, - "file": "artifact_registry.get_project_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProjectSettings", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetProjectSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.ProjectSettings", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "GetProjectSettings", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetProjectSettings", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - }, - { - "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateProjectSettings_async", - "title": "ArtifactRegistry updateProjectSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the Settings for the Project.", - "canonical": true, - "file": "artifact_registry.update_project_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProjectSettings", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateProjectSettings", - "async": true, - "parameters": [ - { - "name": "project_settings", - "type": ".google.devtools.artifactregistry.v1beta2.ProjectSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.devtools.artifactregistry.v1beta2.ProjectSettings", - "client": { - "shortName": "ArtifactRegistryClient", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistryClient" - }, - "method": { - "shortName": "UpdateProjectSettings", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateProjectSettings", - "service": { - "shortName": "ArtifactRegistry", - "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/index.ts deleted file mode 100644 index 099762b291a..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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 ArtifactRegistryClient = v1beta2.ArtifactRegistryClient; -type ArtifactRegistryClient = v1beta2.ArtifactRegistryClient; -export {v1beta2, ArtifactRegistryClient}; -export default {v1beta2, ArtifactRegistryClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client.ts deleted file mode 100644 index bc4a31eee27..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client.ts +++ /dev/null @@ -1,3439 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/artifact_registry_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './artifact_registry_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Artifact Registry API service. - * - * Artifact Registry is an artifact management system for storing artifacts - * from different package management systems. - * - * The resources managed by this API are: - * - * * Repositories, which group packages and their data. - * * Packages, which group versions and their tags. - * * Versions, which are specific forms of a package. - * * Tags, which represent alternative names for versions. - * * Files, which contain content and are optionally associated with a Package - * or Version. - * @class - * @memberof v1beta2 - */ -export class ArtifactRegistryClient { - 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; - artifactRegistryStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ArtifactRegistryClient. - * - * @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 ArtifactRegistryClient({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 ArtifactRegistryClient; - 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 = { - aptArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}' - ), - filePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/files/{file}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/projectSettings' - ), - repositoryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}' - ), - tagPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}' - ), - versionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}' - ), - yumArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/repositories/{repository}/yumArtifacts/{yum_artifact}' - ), - }; - - // 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 = { - listRepositories: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories'), - listPackages: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'packages'), - listVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'versions'), - listFiles: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'files'), - listTags: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tags') - }; - - 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.GetOperation',get: '/v1beta2/{name=projects/*/locations/*/operations/*}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const importAptArtifactsResponse = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsResponse') as gax.protobuf.Type; - const importAptArtifactsMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsMetadata') as gax.protobuf.Type; - const importYumArtifactsResponse = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsResponse') as gax.protobuf.Type; - const importYumArtifactsMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsMetadata') as gax.protobuf.Type; - const createRepositoryResponse = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1beta2.Repository') as gax.protobuf.Type; - const createRepositoryMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1beta2.OperationMetadata') as gax.protobuf.Type; - const deleteRepositoryResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteRepositoryMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1beta2.OperationMetadata') as gax.protobuf.Type; - const deletePackageResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deletePackageMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1beta2.OperationMetadata') as gax.protobuf.Type; - const deleteVersionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteVersionMetadata = protoFilesRoot.lookup( - '.google.devtools.artifactregistry.v1beta2.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - importAptArtifacts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importAptArtifactsResponse.decode.bind(importAptArtifactsResponse), - importAptArtifactsMetadata.decode.bind(importAptArtifactsMetadata)), - importYumArtifacts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importYumArtifactsResponse.decode.bind(importYumArtifactsResponse), - importYumArtifactsMetadata.decode.bind(importYumArtifactsMetadata)), - createRepository: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createRepositoryResponse.decode.bind(createRepositoryResponse), - createRepositoryMetadata.decode.bind(createRepositoryMetadata)), - deleteRepository: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteRepositoryResponse.decode.bind(deleteRepositoryResponse), - deleteRepositoryMetadata.decode.bind(deleteRepositoryMetadata)), - deletePackage: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deletePackageResponse.decode.bind(deletePackageResponse), - deletePackageMetadata.decode.bind(deletePackageMetadata)), - deleteVersion: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteVersionResponse.decode.bind(deleteVersionResponse), - deleteVersionMetadata.decode.bind(deleteVersionMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.devtools.artifactregistry.v1beta2.ArtifactRegistry', 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.artifactRegistryStub) { - return this.artifactRegistryStub; - } - - // Put together the "service stub" for - // google.devtools.artifactregistry.v1beta2.ArtifactRegistry. - this.artifactRegistryStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devtools.artifactregistry.v1beta2.ArtifactRegistry') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devtools.artifactregistry.v1beta2.ArtifactRegistry, - 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 artifactRegistryStubMethods = - ['importAptArtifacts', 'importYumArtifacts', 'listRepositories', 'getRepository', 'createRepository', 'updateRepository', 'deleteRepository', 'listPackages', 'getPackage', 'deletePackage', 'listVersions', 'getVersion', 'deleteVersion', 'listFiles', 'getFile', 'listTags', 'getTag', 'createTag', 'updateTag', 'deleteTag', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'getProjectSettings', 'updateProjectSettings']; - for (const methodName of artifactRegistryStubMethods) { - const callPromise = this.artifactRegistryStub.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.artifactRegistryStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'artifactregistry.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 'artifactregistry.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/cloud-platform.read-only' - ]; - } - - 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 a repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the repository to retrieve. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.Repository|Repository}. - * Please see the {@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/artifact_registry.get_repository.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetRepository_async - */ - getRepository( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|undefined, {}|undefined - ]>; - getRepository( - request: protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): void; - getRepository( - request: protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): void; - getRepository( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IGetRepositoryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getRepository(request, options, callback); - } -/** - * Updates a repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.artifactregistry.v1beta2.Repository} request.repository - * The repository that replaces the resource on the server. - * @param {google.protobuf.FieldMask} request.updateMask - * The update mask applies to the resource. For the `FieldMask` definition, - * 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.devtools.artifactregistry.v1beta2.Repository|Repository}. - * Please see the {@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/artifact_registry.update_repository.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateRepository_async - */ - updateRepository( - request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|undefined, {}|undefined - ]>; - updateRepository( - request: protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|null|undefined, - {}|null|undefined>): void; - updateRepository( - request: protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|null|undefined, - {}|null|undefined>): void; - updateRepository( - request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IRepository, - protos.google.devtools.artifactregistry.v1beta2.IUpdateRepositoryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'repository.name': request.repository!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateRepository(request, options, callback); - } -/** - * Gets a package. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the package to retrieve. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.Package|Package}. - * Please see the {@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/artifact_registry.get_package.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetPackage_async - */ - getPackage( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IPackage, - protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|undefined, {}|undefined - ]>; - getPackage( - request: protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IPackage, - protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|null|undefined, - {}|null|undefined>): void; - getPackage( - request: protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IPackage, - protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|null|undefined, - {}|null|undefined>): void; - getPackage( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1beta2.IPackage, - protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1beta2.IPackage, - protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IPackage, - protos.google.devtools.artifactregistry.v1beta2.IGetPackageRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getPackage(request, options, callback); - } -/** - * Gets a version - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the version to retrieve. - * @param {google.devtools.artifactregistry.v1beta2.VersionView} request.view - * The view that should be returned in the response. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.Version|Version}. - * Please see the {@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/artifact_registry.get_version.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetVersion_async - */ - getVersion( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IVersion, - protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|undefined, {}|undefined - ]>; - getVersion( - request: protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IVersion, - protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|null|undefined, - {}|null|undefined>): void; - getVersion( - request: protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IVersion, - protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|null|undefined, - {}|null|undefined>): void; - getVersion( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1beta2.IVersion, - protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1beta2.IVersion, - protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IVersion, - protos.google.devtools.artifactregistry.v1beta2.IGetVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getVersion(request, options, callback); - } -/** - * Gets a file. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the file to retrieve. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.File|File}. - * Please see the {@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/artifact_registry.get_file.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetFile_async - */ - getFile( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IFile, - protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|undefined, {}|undefined - ]>; - getFile( - request: protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IFile, - protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|null|undefined, - {}|null|undefined>): void; - getFile( - request: protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IFile, - protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|null|undefined, - {}|null|undefined>): void; - getFile( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1beta2.IFile, - protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1beta2.IFile, - protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IFile, - protos.google.devtools.artifactregistry.v1beta2.IGetFileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFile(request, options, callback); - } -/** - * Gets a tag. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the tag to retrieve. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.Tag|Tag}. - * Please see the {@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/artifact_registry.get_tag.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetTag_async - */ - getTag( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|undefined, {}|undefined - ]>; - getTag( - request: protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|null|undefined, - {}|null|undefined>): void; - getTag( - request: protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|null|undefined, - {}|null|undefined>): void; - getTag( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IGetTagRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getTag(request, options, callback); - } -/** - * Creates a tag. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the parent resource where the tag will be created. - * @param {string} request.tagId - * The tag id to use for this repository. - * @param {google.devtools.artifactregistry.v1beta2.Tag} request.tag - * The tag 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.devtools.artifactregistry.v1beta2.Tag|Tag}. - * Please see the {@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/artifact_registry.create_tag.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_CreateTag_async - */ - createTag( - request?: protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|undefined, {}|undefined - ]>; - createTag( - request: protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|null|undefined, - {}|null|undefined>): void; - createTag( - request: protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|null|undefined, - {}|null|undefined>): void; - createTag( - request?: protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.ICreateTagRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createTag(request, options, callback); - } -/** - * Updates a tag. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.artifactregistry.v1beta2.Tag} request.tag - * The tag that replaces the resource on the server. - * @param {google.protobuf.FieldMask} request.updateMask - * The update mask applies to the resource. For the `FieldMask` definition, - * 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.devtools.artifactregistry.v1beta2.Tag|Tag}. - * Please see the {@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/artifact_registry.update_tag.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateTag_async - */ - updateTag( - request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|undefined, {}|undefined - ]>; - updateTag( - request: protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|null|undefined, - {}|null|undefined>): void; - updateTag( - request: protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|null|undefined, - {}|null|undefined>): void; - updateTag( - request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.ITag, - protos.google.devtools.artifactregistry.v1beta2.IUpdateTagRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'tag.name': request.tag!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateTag(request, options, callback); - } -/** - * Deletes a tag. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the tag to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1beta2/artifact_registry.delete_tag.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteTag_async - */ - deleteTag( - request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|undefined, {}|undefined - ]>; - deleteTag( - request: protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|null|undefined, - {}|null|undefined>): void; - deleteTag( - request: protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|null|undefined, - {}|null|undefined>): void; - deleteTag( - request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.devtools.artifactregistry.v1beta2.IDeleteTagRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteTag(request, options, callback); - } -/** - * Updates the IAM policy for a given resource. - * - * @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/v1beta2/artifact_registry.set_iam_policy.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_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 policy for a given resource. - * - * @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/v1beta2/artifact_registry.get_iam_policy.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_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 if the caller has a list of permissions on a resource. - * - * @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/v1beta2/artifact_registry.test_iam_permissions.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_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); - } -/** - * Retrieves the Settings for the Project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the projectSettings 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.devtools.artifactregistry.v1beta2.ProjectSettings|ProjectSettings}. - * Please see the {@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/artifact_registry.get_project_settings.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_async - */ - getProjectSettings( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|undefined, {}|undefined - ]>; - getProjectSettings( - request: protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|null|undefined, - {}|null|undefined>): void; - getProjectSettings( - request: protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|null|undefined, - {}|null|undefined>): void; - getProjectSettings( - request?: protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IGetProjectSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getProjectSettings(request, options, callback); - } -/** - * Updates the Settings for the Project. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.artifactregistry.v1beta2.ProjectSettings} request.projectSettings - * The project settings. - * @param {google.protobuf.FieldMask} request.updateMask - * Field mask to support partial updates. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.artifactregistry.v1beta2.ProjectSettings|ProjectSettings}. - * Please see the {@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/artifact_registry.update_project_settings.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateProjectSettings_async - */ - updateProjectSettings( - request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|undefined, {}|undefined - ]>; - updateProjectSettings( - request: protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateProjectSettings( - request: protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest, - callback: Callback< - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateProjectSettings( - request?: protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IProjectSettings, - protos.google.devtools.artifactregistry.v1beta2.IUpdateProjectSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_settings.name': request.projectSettings!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateProjectSettings(request, options, callback); - } - -/** - * Imports Apt artifacts. The returned Operation will complete once the - * resources are imported. Package, Version, and File resources are created - * based on the imported artifacts. Imported artifacts that conflict with - * existing resources are ignored. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.artifactregistry.v1beta2.ImportAptArtifactsGcsSource} request.gcsSource - * Google Cloud Storage location where input content is located. - * @param {string} request.parent - * The name of the parent resource where the artifacts will be imported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/artifact_registry.import_apt_artifacts.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_async - */ - importAptArtifacts( - request?: protos.google.devtools.artifactregistry.v1beta2.IImportAptArtifactsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importAptArtifacts( - request: protos.google.devtools.artifactregistry.v1beta2.IImportAptArtifactsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importAptArtifacts( - request: protos.google.devtools.artifactregistry.v1beta2.IImportAptArtifactsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importAptArtifacts( - request?: protos.google.devtools.artifactregistry.v1beta2.IImportAptArtifactsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.importAptArtifacts(request, options, callback); - } -/** - * Check the status of the long running operation returned by `importAptArtifacts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/artifact_registry.import_apt_artifacts.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_async - */ - async checkImportAptArtifactsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importAptArtifacts, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Imports Yum (RPM) artifacts. The returned Operation will complete once the - * resources are imported. Package, Version, and File resources are created - * based on the imported artifacts. Imported artifacts that conflict with - * existing resources are ignored. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.artifactregistry.v1beta2.ImportYumArtifactsGcsSource} request.gcsSource - * Google Cloud Storage location where input content is located. - * @param {string} request.parent - * The name of the parent resource where the artifacts will be imported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/artifact_registry.import_yum_artifacts.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_async - */ - importYumArtifacts( - request?: protos.google.devtools.artifactregistry.v1beta2.IImportYumArtifactsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importYumArtifacts( - request: protos.google.devtools.artifactregistry.v1beta2.IImportYumArtifactsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importYumArtifacts( - request: protos.google.devtools.artifactregistry.v1beta2.IImportYumArtifactsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importYumArtifacts( - request?: protos.google.devtools.artifactregistry.v1beta2.IImportYumArtifactsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.importYumArtifacts(request, options, callback); - } -/** - * Check the status of the long running operation returned by `importYumArtifacts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/artifact_registry.import_yum_artifacts.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_async - */ - async checkImportYumArtifactsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importYumArtifacts, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a repository. The returned Operation will finish once the - * repository has been created. Its response will be the created Repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource where the repository will be created. - * @param {string} request.repositoryId - * The repository id to use for this repository. - * @param {google.devtools.artifactregistry.v1beta2.Repository} request.repository - * The repository 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/v1beta2/artifact_registry.create_repository.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_async - */ - createRepository( - request?: protos.google.devtools.artifactregistry.v1beta2.ICreateRepositoryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createRepository( - request: protos.google.devtools.artifactregistry.v1beta2.ICreateRepositoryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRepository( - request: protos.google.devtools.artifactregistry.v1beta2.ICreateRepositoryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRepository( - request?: protos.google.devtools.artifactregistry.v1beta2.ICreateRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createRepository(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createRepository()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/artifact_registry.create_repository.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_async - */ - async checkCreateRepositoryProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRepository, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a repository and all of its contents. The returned Operation will - * finish once the repository has been deleted. It will not have any Operation - * metadata and will return a google.protobuf.Empty response. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the repository to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/artifact_registry.delete_repository.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_async - */ - deleteRepository( - request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteRepositoryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteRepository( - request: protos.google.devtools.artifactregistry.v1beta2.IDeleteRepositoryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRepository( - request: protos.google.devtools.artifactregistry.v1beta2.IDeleteRepositoryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRepository( - request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteRepository(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteRepository()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/artifact_registry.delete_repository.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_async - */ - async checkDeleteRepositoryProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRepository, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a package and all of its versions and tags. The returned operation - * will complete once the package has been deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the package to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/artifact_registry.delete_package.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_async - */ - deletePackage( - request?: protos.google.devtools.artifactregistry.v1beta2.IDeletePackageRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deletePackage( - request: protos.google.devtools.artifactregistry.v1beta2.IDeletePackageRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePackage( - request: protos.google.devtools.artifactregistry.v1beta2.IDeletePackageRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePackage( - request?: protos.google.devtools.artifactregistry.v1beta2.IDeletePackageRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deletePackage(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deletePackage()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/artifact_registry.delete_package.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_async - */ - async checkDeletePackageProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePackage, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a version and all of its content. The returned operation will - * complete once the version has been deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the version to delete. - * @param {boolean} request.force - * By default, a version that is tagged may not be deleted. If force=true, the - * version and any tags pointing to the version are 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/v1beta2/artifact_registry.delete_version.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_async - */ - deleteVersion( - request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteVersionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteVersion( - request: protos.google.devtools.artifactregistry.v1beta2.IDeleteVersionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteVersion( - request: protos.google.devtools.artifactregistry.v1beta2.IDeleteVersionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteVersion( - request?: protos.google.devtools.artifactregistry.v1beta2.IDeleteVersionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteVersion(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteVersion()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/artifact_registry.delete_version.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_async - */ - async checkDeleteVersionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteVersion, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists repositories. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource whose repositories will be listed. - * @param {number} request.pageSize - * The maximum number of repositories to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Repository|Repository}. - * 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 `listRepositoriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listRepositories( - request?: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IRepository[], - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest|null, - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse - ]>; - listRepositories( - request: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IRepository>): void; - listRepositories( - request: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IRepository>): void; - listRepositories( - request?: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IRepository>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IRepository>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IRepository[], - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest|null, - protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listRepositories(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 name of the parent resource whose repositories will be listed. - * @param {number} request.pageSize - * The maximum number of repositories to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Repository|Repository} 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 `listRepositoriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listRepositoriesStream( - request?: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, - 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['listRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRepositories.createStream( - this.innerApiCalls.listRepositories as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRepositories`, 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 name of the parent resource whose repositories will be listed. - * @param {number} request.pageSize - * The maximum number of repositories to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Repository|Repository}. 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/artifact_registry.list_repositories.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ListRepositories_async - */ - listRepositoriesAsync( - request?: protos.google.devtools.artifactregistry.v1beta2.IListRepositoriesRequest, - 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['listRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRepositories.asyncIterate( - this.innerApiCalls['listRepositories'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists packages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the parent resource whose packages will be listed. - * @param {number} request.pageSize - * The maximum number of packages to return. - * Maximum page size is 10,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Package|Package}. - * 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 `listPackagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPackages( - request?: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IPackage[], - protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest|null, - protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse - ]>; - listPackages( - request: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IPackage>): void; - listPackages( - request: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IPackage>): void; - listPackages( - request?: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IPackage>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IPackage>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IPackage[], - protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest|null, - protos.google.devtools.artifactregistry.v1beta2.IListPackagesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listPackages(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 name of the parent resource whose packages will be listed. - * @param {number} request.pageSize - * The maximum number of packages to return. - * Maximum page size is 10,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Package|Package} 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 `listPackagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPackagesStream( - request?: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, - 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['listPackages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPackages.createStream( - this.innerApiCalls.listPackages as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listPackages`, 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 name of the parent resource whose packages will be listed. - * @param {number} request.pageSize - * The maximum number of packages to return. - * Maximum page size is 10,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Package|Package}. 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/artifact_registry.list_packages.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ListPackages_async - */ - listPackagesAsync( - request?: protos.google.devtools.artifactregistry.v1beta2.IListPackagesRequest, - 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['listPackages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPackages.asyncIterate( - this.innerApiCalls['listPackages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists versions. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the parent resource whose versions will be listed. - * @param {number} request.pageSize - * The maximum number of versions to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {google.devtools.artifactregistry.v1beta2.VersionView} request.view - * The view that should be returned in the response. - * @param {string} [request.orderBy] - * Optional. The field to order the results by. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.artifactregistry.v1beta2.Version|Version}. - * 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 `listVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listVersions( - request?: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IVersion[], - protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest|null, - protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse - ]>; - listVersions( - request: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, - protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IVersion>): void; - listVersions( - request: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, - protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IVersion>): void; - listVersions( - request?: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, - protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IVersion>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, - protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IVersion>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IVersion[], - protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest|null, - protos.google.devtools.artifactregistry.v1beta2.IListVersionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listVersions(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 name of the parent resource whose versions will be listed. - * @param {number} request.pageSize - * The maximum number of versions to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {google.devtools.artifactregistry.v1beta2.VersionView} request.view - * The view that should be returned in the response. - * @param {string} [request.orderBy] - * Optional. The field to order the results by. - * @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.devtools.artifactregistry.v1beta2.Version|Version} 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 `listVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listVersionsStream( - request?: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, - 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['listVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVersions.createStream( - this.innerApiCalls.listVersions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listVersions`, 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 name of the parent resource whose versions will be listed. - * @param {number} request.pageSize - * The maximum number of versions to return. Maximum page size is 1,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request, if any. - * @param {google.devtools.artifactregistry.v1beta2.VersionView} request.view - * The view that should be returned in the response. - * @param {string} [request.orderBy] - * Optional. The field to order the results by. - * @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.devtools.artifactregistry.v1beta2.Version|Version}. 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/artifact_registry.list_versions.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ListVersions_async - */ - listVersionsAsync( - request?: protos.google.devtools.artifactregistry.v1beta2.IListVersionsRequest, - 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['listVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVersions.asyncIterate( - this.innerApiCalls['listVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists files. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the repository whose files will be listed. For example: - * "projects/p1/locations/us-central1/repositories/repo1 - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `name` - * * `owner` - * - * An example of using a filter: - * - * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an - * ID starting with "a/b/". - * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> - * Files owned by the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of files to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.File|File}. - * 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 `listFilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFiles( - request?: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IFile[], - protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest|null, - protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse - ]>; - listFiles( - request: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IFile>): void; - listFiles( - request: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IFile>): void; - listFiles( - request?: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IFile>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, - protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.IFile>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.IFile[], - protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest|null, - protos.google.devtools.artifactregistry.v1beta2.IListFilesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFiles(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 name of the repository whose files will be listed. For example: - * "projects/p1/locations/us-central1/repositories/repo1 - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `name` - * * `owner` - * - * An example of using a filter: - * - * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an - * ID starting with "a/b/". - * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> - * Files owned by the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of files to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.File|File} 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 `listFilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listFilesStream( - request?: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, - 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['listFiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFiles.createStream( - this.innerApiCalls.listFiles as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFiles`, 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 name of the repository whose files will be listed. For example: - * "projects/p1/locations/us-central1/repositories/repo1 - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `name` - * * `owner` - * - * An example of using a filter: - * - * * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an - * ID starting with "a/b/". - * * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` --> - * Files owned by the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of files to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.File|File}. 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/artifact_registry.list_files.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ListFiles_async - */ - listFilesAsync( - request?: protos.google.devtools.artifactregistry.v1beta2.IListFilesRequest, - 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['listFiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFiles.asyncIterate( - this.innerApiCalls['listFiles'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists tags. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the parent resource whose tags will be listed. - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `version` - * - * An example of using a filter: - * - * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` - * --> Tags that are applied to the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of tags to return. Maximum page size is 10,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Tag|Tag}. - * 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 `listTagsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTags( - request?: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.ITag[], - protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest|null, - protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse - ]>; - listTags( - request: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, - protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.ITag>): void; - listTags( - request: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, - callback: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, - protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.ITag>): void; - listTags( - request?: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, - protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.ITag>, - callback?: PaginationCallback< - protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, - protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse|null|undefined, - protos.google.devtools.artifactregistry.v1beta2.ITag>): - Promise<[ - protos.google.devtools.artifactregistry.v1beta2.ITag[], - protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest|null, - protos.google.devtools.artifactregistry.v1beta2.IListTagsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listTags(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 name of the parent resource whose tags will be listed. - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `version` - * - * An example of using a filter: - * - * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` - * --> Tags that are applied to the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of tags to return. Maximum page size is 10,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Tag|Tag} 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 `listTagsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTagsStream( - request?: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, - 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['listTags']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTags.createStream( - this.innerApiCalls.listTags as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTags`, 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 name of the parent resource whose tags will be listed. - * @param {string} request.filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `version` - * - * An example of using a filter: - * - * * `version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` - * --> Tags that are applied to the version `1.0` in package `pkg1`. - * @param {number} request.pageSize - * The maximum number of tags to return. Maximum page size is 10,000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous 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.devtools.artifactregistry.v1beta2.Tag|Tag}. 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/artifact_registry.list_tags.js - * region_tag:artifactregistry_v1beta2_generated_ArtifactRegistry_ListTags_async - */ - listTagsAsync( - request?: protos.google.devtools.artifactregistry.v1beta2.IListTagsRequest, - 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['listTags']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTags.asyncIterate( - this.innerApiCalls['listTags'] 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); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified aptArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} apt_artifact - * @returns {string} Resource name string. - */ - aptArtifactPath(project:string,location:string,repository:string,aptArtifact:string) { - return this.pathTemplates.aptArtifactPathTemplate.render({ - project: project, - location: location, - repository: repository, - apt_artifact: aptArtifact, - }); - } - - /** - * Parse the project from AptArtifact resource. - * - * @param {string} aptArtifactName - * A fully-qualified path representing AptArtifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAptArtifactName(aptArtifactName: string) { - return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).project; - } - - /** - * Parse the location from AptArtifact resource. - * - * @param {string} aptArtifactName - * A fully-qualified path representing AptArtifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAptArtifactName(aptArtifactName: string) { - return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).location; - } - - /** - * Parse the repository from AptArtifact resource. - * - * @param {string} aptArtifactName - * A fully-qualified path representing AptArtifact resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromAptArtifactName(aptArtifactName: string) { - return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).repository; - } - - /** - * Parse the apt_artifact from AptArtifact resource. - * - * @param {string} aptArtifactName - * A fully-qualified path representing AptArtifact resource. - * @returns {string} A string representing the apt_artifact. - */ - matchAptArtifactFromAptArtifactName(aptArtifactName: string) { - return this.pathTemplates.aptArtifactPathTemplate.match(aptArtifactName).apt_artifact; - } - - /** - * Return a fully-qualified file resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} file - * @returns {string} Resource name string. - */ - filePath(project:string,location:string,repository:string,file:string) { - return this.pathTemplates.filePathTemplate.render({ - project: project, - location: location, - repository: repository, - file: file, - }); - } - - /** - * Parse the project from File resource. - * - * @param {string} fileName - * A fully-qualified path representing File resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFileName(fileName: string) { - return this.pathTemplates.filePathTemplate.match(fileName).project; - } - - /** - * Parse the location from File resource. - * - * @param {string} fileName - * A fully-qualified path representing File resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFileName(fileName: string) { - return this.pathTemplates.filePathTemplate.match(fileName).location; - } - - /** - * Parse the repository from File resource. - * - * @param {string} fileName - * A fully-qualified path representing File resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromFileName(fileName: string) { - return this.pathTemplates.filePathTemplate.match(fileName).repository; - } - - /** - * Parse the file from File resource. - * - * @param {string} fileName - * A fully-qualified path representing File resource. - * @returns {string} A string representing the file. - */ - matchFileFromFileName(fileName: string) { - return this.pathTemplates.filePathTemplate.match(fileName).file; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing ProjectSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).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 tag resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} packageParam - * @param {string} tag - * @returns {string} Resource name string. - */ - tagPath(project:string,location:string,repository:string,packageParam:string,tag:string) { - return this.pathTemplates.tagPathTemplate.render({ - project: project, - location: location, - repository: repository, - package: packageParam, - tag: tag, - }); - } - - /** - * Parse the project from Tag resource. - * - * @param {string} tagName - * A fully-qualified path representing Tag resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTagName(tagName: string) { - return this.pathTemplates.tagPathTemplate.match(tagName).project; - } - - /** - * Parse the location from Tag resource. - * - * @param {string} tagName - * A fully-qualified path representing Tag resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTagName(tagName: string) { - return this.pathTemplates.tagPathTemplate.match(tagName).location; - } - - /** - * Parse the repository from Tag resource. - * - * @param {string} tagName - * A fully-qualified path representing Tag resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromTagName(tagName: string) { - return this.pathTemplates.tagPathTemplate.match(tagName).repository; - } - - /** - * Parse the package from Tag resource. - * - * @param {string} tagName - * A fully-qualified path representing Tag resource. - * @returns {string} A string representing the package. - */ - matchPackageFromTagName(tagName: string) { - return this.pathTemplates.tagPathTemplate.match(tagName).package; - } - - /** - * Parse the tag from Tag resource. - * - * @param {string} tagName - * A fully-qualified path representing Tag resource. - * @returns {string} A string representing the tag. - */ - matchTagFromTagName(tagName: string) { - return this.pathTemplates.tagPathTemplate.match(tagName).tag; - } - - /** - * Return a fully-qualified version resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} packageParam - * @param {string} version - * @returns {string} Resource name string. - */ - versionPath(project:string,location:string,repository:string,packageParam:string,version:string) { - return this.pathTemplates.versionPathTemplate.render({ - project: project, - location: location, - repository: repository, - package: packageParam, - version: version, - }); - } - - /** - * Parse the project from Version resource. - * - * @param {string} versionName - * A fully-qualified path representing Version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromVersionName(versionName: string) { - return this.pathTemplates.versionPathTemplate.match(versionName).project; - } - - /** - * Parse the location from Version resource. - * - * @param {string} versionName - * A fully-qualified path representing Version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromVersionName(versionName: string) { - return this.pathTemplates.versionPathTemplate.match(versionName).location; - } - - /** - * Parse the repository from Version resource. - * - * @param {string} versionName - * A fully-qualified path representing Version resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromVersionName(versionName: string) { - return this.pathTemplates.versionPathTemplate.match(versionName).repository; - } - - /** - * Parse the package from Version resource. - * - * @param {string} versionName - * A fully-qualified path representing Version resource. - * @returns {string} A string representing the package. - */ - matchPackageFromVersionName(versionName: string) { - return this.pathTemplates.versionPathTemplate.match(versionName).package; - } - - /** - * Parse the version from Version resource. - * - * @param {string} versionName - * A fully-qualified path representing Version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromVersionName(versionName: string) { - return this.pathTemplates.versionPathTemplate.match(versionName).version; - } - - /** - * Return a fully-qualified yumArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} repository - * @param {string} yum_artifact - * @returns {string} Resource name string. - */ - yumArtifactPath(project:string,location:string,repository:string,yumArtifact:string) { - return this.pathTemplates.yumArtifactPathTemplate.render({ - project: project, - location: location, - repository: repository, - yum_artifact: yumArtifact, - }); - } - - /** - * Parse the project from YumArtifact resource. - * - * @param {string} yumArtifactName - * A fully-qualified path representing YumArtifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromYumArtifactName(yumArtifactName: string) { - return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).project; - } - - /** - * Parse the location from YumArtifact resource. - * - * @param {string} yumArtifactName - * A fully-qualified path representing YumArtifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromYumArtifactName(yumArtifactName: string) { - return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).location; - } - - /** - * Parse the repository from YumArtifact resource. - * - * @param {string} yumArtifactName - * A fully-qualified path representing YumArtifact resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromYumArtifactName(yumArtifactName: string) { - return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).repository; - } - - /** - * Parse the yum_artifact from YumArtifact resource. - * - * @param {string} yumArtifactName - * A fully-qualified path representing YumArtifact resource. - * @returns {string} A string representing the yum_artifact. - */ - matchYumArtifactFromYumArtifactName(yumArtifactName: string) { - return this.pathTemplates.yumArtifactPathTemplate.match(yumArtifactName).yum_artifact; - } - - /** - * 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.artifactRegistryStub && !this._terminated) { - return this.artifactRegistryStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client_config.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client_config.json deleted file mode 100644 index 6d2c27103c7..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_client_config.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "interfaces": { - "google.devtools.artifactregistry.v1beta2.ArtifactRegistry": { - "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 - } - }, - "methods": { - "ImportAptArtifacts": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ImportYumArtifacts": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRepositories": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetRepository": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateRepository": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateRepository": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteRepository": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListPackages": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetPackage": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeletePackage": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListVersions": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetVersion": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteVersion": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListFiles": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetFile": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListTags": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetTag": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateTag": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateTag": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTag": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetProjectSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateProjectSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_proto_list.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_proto_list.json deleted file mode 100644 index f32513655ac..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/artifact_registry_proto_list.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - "../../protos/google/devtools/artifactregistry/v1beta2/apt_artifact.proto", - "../../protos/google/devtools/artifactregistry/v1beta2/file.proto", - "../../protos/google/devtools/artifactregistry/v1beta2/package.proto", - "../../protos/google/devtools/artifactregistry/v1beta2/repository.proto", - "../../protos/google/devtools/artifactregistry/v1beta2/service.proto", - "../../protos/google/devtools/artifactregistry/v1beta2/settings.proto", - "../../protos/google/devtools/artifactregistry/v1beta2/tag.proto", - "../../protos/google/devtools/artifactregistry/v1beta2/version.proto", - "../../protos/google/devtools/artifactregistry/v1beta2/yum_artifact.proto" -] diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/gapic_metadata.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/gapic_metadata.json deleted file mode 100644 index a4830e36e2c..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/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.devtools.artifactregistry.v1beta2", - "libraryPackage": "@google-cloud/artifact-registry", - "services": { - "ArtifactRegistry": { - "clients": { - "grpc": { - "libraryClient": "ArtifactRegistryClient", - "rpcs": { - "GetRepository": { - "methods": [ - "getRepository" - ] - }, - "UpdateRepository": { - "methods": [ - "updateRepository" - ] - }, - "GetPackage": { - "methods": [ - "getPackage" - ] - }, - "GetVersion": { - "methods": [ - "getVersion" - ] - }, - "GetFile": { - "methods": [ - "getFile" - ] - }, - "GetTag": { - "methods": [ - "getTag" - ] - }, - "CreateTag": { - "methods": [ - "createTag" - ] - }, - "UpdateTag": { - "methods": [ - "updateTag" - ] - }, - "DeleteTag": { - "methods": [ - "deleteTag" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "GetProjectSettings": { - "methods": [ - "getProjectSettings" - ] - }, - "UpdateProjectSettings": { - "methods": [ - "updateProjectSettings" - ] - }, - "ImportAptArtifacts": { - "methods": [ - "importAptArtifacts" - ] - }, - "ImportYumArtifacts": { - "methods": [ - "importYumArtifacts" - ] - }, - "CreateRepository": { - "methods": [ - "createRepository" - ] - }, - "DeleteRepository": { - "methods": [ - "deleteRepository" - ] - }, - "DeletePackage": { - "methods": [ - "deletePackage" - ] - }, - "DeleteVersion": { - "methods": [ - "deleteVersion" - ] - }, - "ListRepositories": { - "methods": [ - "listRepositories", - "listRepositoriesStream", - "listRepositoriesAsync" - ] - }, - "ListPackages": { - "methods": [ - "listPackages", - "listPackagesStream", - "listPackagesAsync" - ] - }, - "ListVersions": { - "methods": [ - "listVersions", - "listVersionsStream", - "listVersionsAsync" - ] - }, - "ListFiles": { - "methods": [ - "listFiles", - "listFilesStream", - "listFilesAsync" - ] - }, - "ListTags": { - "methods": [ - "listTags", - "listTagsStream", - "listTagsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ArtifactRegistryClient", - "rpcs": { - "GetRepository": { - "methods": [ - "getRepository" - ] - }, - "UpdateRepository": { - "methods": [ - "updateRepository" - ] - }, - "GetPackage": { - "methods": [ - "getPackage" - ] - }, - "GetVersion": { - "methods": [ - "getVersion" - ] - }, - "GetFile": { - "methods": [ - "getFile" - ] - }, - "GetTag": { - "methods": [ - "getTag" - ] - }, - "CreateTag": { - "methods": [ - "createTag" - ] - }, - "UpdateTag": { - "methods": [ - "updateTag" - ] - }, - "DeleteTag": { - "methods": [ - "deleteTag" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "GetProjectSettings": { - "methods": [ - "getProjectSettings" - ] - }, - "UpdateProjectSettings": { - "methods": [ - "updateProjectSettings" - ] - }, - "ImportAptArtifacts": { - "methods": [ - "importAptArtifacts" - ] - }, - "ImportYumArtifacts": { - "methods": [ - "importYumArtifacts" - ] - }, - "CreateRepository": { - "methods": [ - "createRepository" - ] - }, - "DeleteRepository": { - "methods": [ - "deleteRepository" - ] - }, - "DeletePackage": { - "methods": [ - "deletePackage" - ] - }, - "DeleteVersion": { - "methods": [ - "deleteVersion" - ] - }, - "ListRepositories": { - "methods": [ - "listRepositories", - "listRepositoriesStream", - "listRepositoriesAsync" - ] - }, - "ListPackages": { - "methods": [ - "listPackages", - "listPackagesStream", - "listPackagesAsync" - ] - }, - "ListVersions": { - "methods": [ - "listVersions", - "listVersionsStream", - "listVersionsAsync" - ] - }, - "ListFiles": { - "methods": [ - "listFiles", - "listFilesStream", - "listFilesAsync" - ] - }, - "ListTags": { - "methods": [ - "listTags", - "listTagsStream", - "listTagsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/src/v1beta2/index.ts deleted file mode 100644 index 2491b7166cd..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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 {ArtifactRegistryClient} from './artifact_registry_client'; diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index d87aa817a75..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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 artifactregistry = require('@google-cloud/artifact-registry'); - -function main() { - const artifactRegistryClient = new artifactregistry.ArtifactRegistryClient(); -} - -main(); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index e830f64db5a..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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 {ArtifactRegistryClient} from '@google-cloud/artifact-registry'; - -// check that the client class type name can be used -function doStuffWithArtifactRegistryClient(client: ArtifactRegistryClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const artifactRegistryClient = new ArtifactRegistryClient(); - doStuffWithArtifactRegistryClient(artifactRegistryClient); -} - -main(); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/install.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1beta2/test/gapic_artifact_registry_v1beta2.ts b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/test/gapic_artifact_registry_v1beta2.ts deleted file mode 100644 index c4b9d6c28bf..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/test/gapic_artifact_registry_v1beta2.ts +++ /dev/null @@ -1,4417 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 artifactregistryModule 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.ArtifactRegistryClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = artifactregistryModule.v1beta2.ArtifactRegistryClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = artifactregistryModule.v1beta2.ArtifactRegistryClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = artifactregistryModule.v1beta2.ArtifactRegistryClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.artifactRegistryStub, undefined); - await client.initialize(); - assert(client.artifactRegistryStub); - }); - - it('has close method for the initialized client', done => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.artifactRegistryStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.artifactRegistryStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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('getRepository', () => { - it('invokes getRepository without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Repository() - ); - client.innerApiCalls.getRepository = stubSimpleCall(expectedResponse); - const [response] = await client.getRepository(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Repository() - ); - client.innerApiCalls.getRepository = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRepository( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IRepository|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRepository = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository with closed client', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getRepository(request), expectedError); - }); - }); - - describe('updateRepository', () => { - it('invokes updateRepository without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest() - ); - request.repository ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest', ['repository', 'name']); - request.repository.name = defaultValue1; - const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Repository() - ); - client.innerApiCalls.updateRepository = stubSimpleCall(expectedResponse); - const [response] = await client.updateRepository(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRepository without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest() - ); - request.repository ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest', ['repository', 'name']); - request.repository.name = defaultValue1; - const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Repository() - ); - client.innerApiCalls.updateRepository = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateRepository( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IRepository|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRepository with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest() - ); - request.repository ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest', ['repository', 'name']); - request.repository.name = defaultValue1; - const expectedHeaderRequestParams = `repository.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRepository = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRepository with closed client', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest() - ); - request.repository ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateRepositoryRequest', ['repository', 'name']); - request.repository.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateRepository(request), expectedError); - }); - }); - - describe('getPackage', () => { - it('invokes getPackage without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Package() - ); - client.innerApiCalls.getPackage = stubSimpleCall(expectedResponse); - const [response] = await client.getPackage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPackage without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Package() - ); - client.innerApiCalls.getPackage = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPackage( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IPackage|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPackage with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetPackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPackage = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPackage(request), expectedError); - const actualRequest = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPackage with closed client', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetPackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetPackageRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getPackage(request), expectedError); - }); - }); - - describe('getVersion', () => { - it('invokes getVersion without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Version() - ); - client.innerApiCalls.getVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVersion without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Version() - ); - client.innerApiCalls.getVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getVersion( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVersion with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVersion with closed client', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getVersion(request), expectedError); - }); - }); - - describe('getFile', () => { - it('invokes getFile without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.File() - ); - client.innerApiCalls.getFile = stubSimpleCall(expectedResponse); - const [response] = await client.getFile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFile without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.File() - ); - client.innerApiCalls.getFile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFile( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IFile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFile with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetFileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFile(request), expectedError); - const actualRequest = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFile with closed client', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetFileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetFileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFile(request), expectedError); - }); - }); - - describe('getTag', () => { - it('invokes getTag without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Tag() - ); - client.innerApiCalls.getTag = stubSimpleCall(expectedResponse); - const [response] = await client.getTag(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTag without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Tag() - ); - client.innerApiCalls.getTag = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTag( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.ITag|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTag with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTag = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTag(request), expectedError); - const actualRequest = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTag with closed client', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetTagRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getTag(request), expectedError); - }); - }); - - describe('createTag', () => { - it('invokes createTag without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.CreateTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateTagRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Tag() - ); - client.innerApiCalls.createTag = stubSimpleCall(expectedResponse); - const [response] = await client.createTag(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTag without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.CreateTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateTagRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Tag() - ); - client.innerApiCalls.createTag = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTag( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.ITag|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTag with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.CreateTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateTagRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTag = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createTag(request), expectedError); - const actualRequest = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTag with closed client', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.CreateTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateTagRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createTag(request), expectedError); - }); - }); - - describe('updateTag', () => { - it('invokes updateTag without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateTagRequest() - ); - request.tag ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateTagRequest', ['tag', 'name']); - request.tag.name = defaultValue1; - const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Tag() - ); - client.innerApiCalls.updateTag = stubSimpleCall(expectedResponse); - const [response] = await client.updateTag(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTag without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateTagRequest() - ); - request.tag ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateTagRequest', ['tag', 'name']); - request.tag.name = defaultValue1; - const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.Tag() - ); - client.innerApiCalls.updateTag = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateTag( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.ITag|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTag with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateTagRequest() - ); - request.tag ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateTagRequest', ['tag', 'name']); - request.tag.name = defaultValue1; - const expectedHeaderRequestParams = `tag.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTag = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateTag(request), expectedError); - const actualRequest = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTag with closed client', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateTagRequest() - ); - request.tag ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateTagRequest', ['tag', 'name']); - request.tag.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateTag(request), expectedError); - }); - }); - - describe('deleteTag', () => { - it('invokes deleteTag without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTag = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTag(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTag without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTag = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTag( - 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.deleteTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTag with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteTagRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTag = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTag(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTag as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTag as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTag with closed client', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteTagRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteTagRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteTag(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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('getProjectSettings', () => { - it('invokes getProjectSettings without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ProjectSettings() - ); - client.innerApiCalls.getProjectSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getProjectSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProjectSettings without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ProjectSettings() - ); - client.innerApiCalls.getProjectSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProjectSettings( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IProjectSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProjectSettings with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProjectSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProjectSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProjectSettings with closed client', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.GetProjectSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getProjectSettings(request), expectedError); - }); - }); - - describe('updateProjectSettings', () => { - it('invokes updateProjectSettings without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest() - ); - request.projectSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest', ['projectSettings', 'name']); - request.projectSettings.name = defaultValue1; - const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ProjectSettings() - ); - client.innerApiCalls.updateProjectSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateProjectSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProjectSettings without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest() - ); - request.projectSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest', ['projectSettings', 'name']); - request.projectSettings.name = defaultValue1; - const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ProjectSettings() - ); - client.innerApiCalls.updateProjectSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProjectSettings( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IProjectSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProjectSettings with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest() - ); - request.projectSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest', ['projectSettings', 'name']); - request.projectSettings.name = defaultValue1; - const expectedHeaderRequestParams = `project_settings.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProjectSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateProjectSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProjectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProjectSettings with closed client', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest() - ); - request.projectSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.UpdateProjectSettingsRequest', ['projectSettings', 'name']); - request.projectSettings.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateProjectSettings(request), expectedError); - }); - }); - - describe('importAptArtifacts', () => { - it('invokes importAptArtifacts without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importAptArtifacts = stubLongRunningCall(expectedResponse); - const [operation] = await client.importAptArtifacts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importAptArtifacts without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importAptArtifacts = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importAptArtifacts( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importAptArtifacts with call error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAptArtifacts = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importAptArtifacts(request), expectedError); - const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importAptArtifacts with LRO error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportAptArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAptArtifacts = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importAptArtifacts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAptArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportAptArtifactsProgress without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportAptArtifactsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportAptArtifactsProgress with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportAptArtifactsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importYumArtifacts', () => { - it('invokes importYumArtifacts without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importYumArtifacts = stubLongRunningCall(expectedResponse); - const [operation] = await client.importYumArtifacts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importYumArtifacts without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importYumArtifacts = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importYumArtifacts( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importYumArtifacts with call error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importYumArtifacts = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importYumArtifacts(request), expectedError); - const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importYumArtifacts with LRO error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ImportYumArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importYumArtifacts = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importYumArtifacts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importYumArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportYumArtifactsProgress without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportYumArtifactsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportYumArtifactsProgress with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportYumArtifactsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createRepository', () => { - it('invokes createRepository without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRepository = stubLongRunningCall(expectedResponse); - const [operation] = await client.createRepository(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRepository = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRepository( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository with call error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRepository = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository with LRO error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRepository = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createRepository(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateRepositoryProgress without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateRepositoryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateRepositoryProgress with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateRepositoryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteRepository', () => { - it('invokes deleteRepository without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRepository = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteRepository(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRepository = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRepository( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository with call error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository with LRO error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteRepository(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteRepositoryProgress without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteRepositoryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteRepositoryProgress with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteRepositoryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deletePackage', () => { - it('invokes deletePackage without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeletePackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeletePackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePackage = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePackage(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePackage without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeletePackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeletePackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePackage = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePackage( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePackage with call error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeletePackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeletePackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePackage = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePackage(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePackage with LRO error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeletePackageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeletePackageRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePackage = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePackage(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePackage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeletePackageProgress without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeletePackageProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeletePackageProgress with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeletePackageProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteVersion', () => { - it('invokes deleteVersion without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteVersion = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteVersion(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteVersion without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteVersion = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteVersion( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteVersion with call error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVersion = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteVersion with LRO error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVersion = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteVersion(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteVersionProgress without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteVersionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteVersionProgress with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteVersionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listRepositories', () => { - it('invokes listRepositories without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - ]; - client.innerApiCalls.listRepositories = stubSimpleCall(expectedResponse); - const [response] = await client.listRepositories(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositories without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - ]; - client.innerApiCalls.listRepositories = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRepositories( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IRepository[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositories with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRepositories = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRepositories(request), expectedError); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositoriesStream without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - ]; - client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1beta2.Repository[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Repository) => { - 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.listRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); - assert( - (client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRepositoriesStream with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1beta2.Repository[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Repository) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); - assert( - (client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRepositories without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Repository()), - ]; - client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1beta2.IRepository[] = []; - const iterable = client.listRepositoriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRepositories with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRepositoriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1beta2.IRepository[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listPackages', () => { - it('invokes listPackages without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - ]; - client.innerApiCalls.listPackages = stubSimpleCall(expectedResponse); - const [response] = await client.listPackages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPackages without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - ]; - client.innerApiCalls.listPackages = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPackages( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IPackage[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPackages with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPackages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPackages(request), expectedError); - const actualRequest = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPackages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPackagesStream without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - ]; - client.descriptors.page.listPackages.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPackagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1beta2.Package[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Package) => { - 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.listPackages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPackages, request)); - assert( - (client.descriptors.page.listPackages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPackagesStream with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPackages.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPackagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1beta2.Package[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Package) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPackages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPackages, request)); - assert( - (client.descriptors.page.listPackages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPackages without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Package()), - ]; - client.descriptors.page.listPackages.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1beta2.IPackage[] = []; - const iterable = client.listPackagesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPackages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPackages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPackages with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListPackagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListPackagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPackages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPackagesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1beta2.IPackage[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPackages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPackages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listVersions', () => { - it('invokes listVersions without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - ]; - client.innerApiCalls.listVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVersions without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - ]; - client.innerApiCalls.listVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listVersions( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVersions with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listVersionsStream without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - ]; - client.descriptors.page.listVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1beta2.Version[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Version) => { - 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.listVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); - assert( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listVersionsStream with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1beta2.Version[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Version) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); - assert( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listVersions without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Version()), - ]; - client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1beta2.IVersion[] = []; - const iterable = client.listVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listVersions with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1beta2.IVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFiles', () => { - it('invokes listFiles without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - ]; - client.innerApiCalls.listFiles = stubSimpleCall(expectedResponse); - const [response] = await client.listFiles(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFiles without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - ]; - client.innerApiCalls.listFiles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFiles( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.IFile[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFiles with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFiles(request), expectedError); - const actualRequest = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFilesStream without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - ]; - client.descriptors.page.listFiles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1beta2.File[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.File) => { - 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.listFiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFiles, request)); - assert( - (client.descriptors.page.listFiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFilesStream with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFiles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1beta2.File[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.File) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFiles, request)); - assert( - (client.descriptors.page.listFiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFiles without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.File()), - ]; - client.descriptors.page.listFiles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1beta2.IFile[] = []; - const iterable = client.listFilesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFiles with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListFilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListFilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFilesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1beta2.IFile[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listTags', () => { - it('invokes listTags without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - ]; - client.innerApiCalls.listTags = stubSimpleCall(expectedResponse); - const [response] = await client.listTags(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTags without error using callback', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - ]; - client.innerApiCalls.listTags = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTags( - request, - (err?: Error|null, result?: protos.google.devtools.artifactregistry.v1beta2.ITag[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTags with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTags = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTags(request), expectedError); - const actualRequest = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTags as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTagsStream without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - ]; - client.descriptors.page.listTags.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTagsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1beta2.Tag[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Tag) => { - 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.listTags.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTags, request)); - assert( - (client.descriptors.page.listTags.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTagsStream with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listTags.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTagsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.artifactregistry.v1beta2.Tag[] = []; - stream.on('data', (response: protos.google.devtools.artifactregistry.v1beta2.Tag) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTags.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTags, request)); - assert( - (client.descriptors.page.listTags.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTags without error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - generateSampleMessage(new protos.google.devtools.artifactregistry.v1beta2.Tag()), - ]; - client.descriptors.page.listTags.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.artifactregistry.v1beta2.ITag[] = []; - const iterable = client.listTagsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTags.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTags.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTags with error', async () => { - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.artifactregistry.v1beta2.ListTagsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.artifactregistry.v1beta2.ListTagsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listTags.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTagsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.artifactregistry.v1beta2.ITag[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTags.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTags.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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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('aptArtifact', () => { - const fakePath = "/rendered/path/aptArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - apt_artifact: "aptArtifactValue", - }; - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.aptArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.aptArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('aptArtifactPath', () => { - const result = client.aptArtifactPath("projectValue", "locationValue", "repositoryValue", "aptArtifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.aptArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAptArtifactName', () => { - const result = client.matchProjectFromAptArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAptArtifactName', () => { - const result = client.matchLocationFromAptArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromAptArtifactName', () => { - const result = client.matchRepositoryFromAptArtifactName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAptArtifactFromAptArtifactName', () => { - const result = client.matchAptArtifactFromAptArtifactName(fakePath); - assert.strictEqual(result, "aptArtifactValue"); - assert((client.pathTemplates.aptArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('file', () => { - const fakePath = "/rendered/path/file"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - file: "fileValue", - }; - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.filePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.filePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('filePath', () => { - const result = client.filePath("projectValue", "locationValue", "repositoryValue", "fileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.filePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFileName', () => { - const result = client.matchProjectFromFileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.filePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFileName', () => { - const result = client.matchLocationFromFileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.filePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromFileName', () => { - const result = client.matchRepositoryFromFileName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.filePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFileFromFileName', () => { - const result = client.matchFileFromFileName(fakePath); - assert.strictEqual(result, "fileValue"); - assert((client.pathTemplates.filePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.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 artifactregistryModule.v1beta2.ArtifactRegistryClient({ - 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('tag', () => { - const fakePath = "/rendered/path/tag"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - package: "packageValue", - tag: "tagValue", - }; - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tagPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tagPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tagPath', () => { - const result = client.tagPath("projectValue", "locationValue", "repositoryValue", "packageValue", "tagValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tagPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTagName', () => { - const result = client.matchProjectFromTagName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tagPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTagName', () => { - const result = client.matchLocationFromTagName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tagPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromTagName', () => { - const result = client.matchRepositoryFromTagName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.tagPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPackageFromTagName', () => { - const result = client.matchPackageFromTagName(fakePath); - assert.strictEqual(result, "packageValue"); - assert((client.pathTemplates.tagPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTagFromTagName', () => { - const result = client.matchTagFromTagName(fakePath); - assert.strictEqual(result, "tagValue"); - assert((client.pathTemplates.tagPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('version', () => { - const fakePath = "/rendered/path/version"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - package: "packageValue", - version: "versionValue", - }; - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.versionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.versionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('versionPath', () => { - const result = client.versionPath("projectValue", "locationValue", "repositoryValue", "packageValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.versionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromVersionName', () => { - const result = client.matchProjectFromVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.versionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromVersionName', () => { - const result = client.matchLocationFromVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.versionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromVersionName', () => { - const result = client.matchRepositoryFromVersionName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.versionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPackageFromVersionName', () => { - const result = client.matchPackageFromVersionName(fakePath); - assert.strictEqual(result, "packageValue"); - assert((client.pathTemplates.versionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromVersionName', () => { - const result = client.matchVersionFromVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.versionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('yumArtifact', () => { - const fakePath = "/rendered/path/yumArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - repository: "repositoryValue", - yum_artifact: "yumArtifactValue", - }; - const client = new artifactregistryModule.v1beta2.ArtifactRegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.yumArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.yumArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('yumArtifactPath', () => { - const result = client.yumArtifactPath("projectValue", "locationValue", "repositoryValue", "yumArtifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.yumArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromYumArtifactName', () => { - const result = client.matchProjectFromYumArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromYumArtifactName', () => { - const result = client.matchLocationFromYumArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromYumArtifactName', () => { - const result = client.matchRepositoryFromYumArtifactName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchYumArtifactFromYumArtifactName', () => { - const result = client.matchYumArtifactFromYumArtifactName(fakePath); - assert.strictEqual(result, "yumArtifactValue"); - assert((client.pathTemplates.yumArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-devtools-artifactregistry/v1beta2/tsconfig.json b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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-devtools-artifactregistry/v1beta2/webpack.config.js b/owl-bot-staging/google-devtools-artifactregistry/v1beta2/webpack.config.js deleted file mode 100644 index d7daabc3ee8..00000000000 --- a/owl-bot-staging/google-devtools-artifactregistry/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: 'ArtifactRegistry', - filename: './artifact-registry.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-devtools-cloudbuild/v1/.eslintignore b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v1/.eslintrc.json b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore b/owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v1/.jsdoc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.jsdoc.js deleted file mode 100644 index 09c8e7ac916..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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/cloudbuild', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v1/.prettierrc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v1/README.md b/owl-bot-staging/google-devtools-cloudbuild/v1/README.md deleted file mode 100644 index 1e997bef7bc..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Cloudbuild: Nodejs Client diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/package.json b/owl-bot-staging/google-devtools-cloudbuild/v1/package.json deleted file mode 100644 index 7f35e6fcaa7..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/cloudbuild", - "version": "0.1.0", - "description": "Cloudbuild client for Node.js", - "repository": "googleapis/nodejs-cloudbuild", - "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 cloudbuild", - "cloudbuild", - "cloud build" - ], - "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-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto b/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto deleted file mode 100644 index 20f7f3191fa..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto +++ /dev/null @@ -1,2734 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.devtools.cloudbuild.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/httpbody.proto"; -import "google/api/resource.proto"; -import "google/api/routing.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 csharp_namespace = "Google.Cloud.CloudBuild.V1"; -option go_package = "cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb;cloudbuildpb"; -option java_multiple_files = true; -option java_package = "com.google.cloudbuild.v1"; -option objc_class_prefix = "GCB"; -option php_namespace = "Google\\Cloud\\Build\\V1"; -option ruby_package = "Google::Cloud::Build::V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; -option (google.api.resource_definition) = { - type: "iam.googleapis.com/ServiceAccount" - pattern: "projects/{project}/serviceAccounts/{service_account}" -}; -option (google.api.resource_definition) = { - type: "secretmanager.googleapis.com/Secret" - pattern: "projects/{project}/secrets/{secret}" -}; -option (google.api.resource_definition) = { - type: "secretmanager.googleapis.com/SecretVersion" - pattern: "projects/{project}/secrets/{secret}/versions/{version}" -}; -option (google.api.resource_definition) = { - type: "gkehub.googleapis.com/Membership" - pattern: "projects/{project}/locations/{location}/memberships/{cluster_name}" -}; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}" -}; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Subscription" - pattern: "projects/{project}/subscriptions/{subscription}" -}; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; -option (google.api.resource_definition) = { - type: "cloudbuild.googleapis.com/Repository" - pattern: "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}" -}; - -// Creates and manages builds on Google Cloud Platform. -// -// The main concept used by this API is a `Build`, which describes the location -// of the source to build, how to build the source, and where to store the -// built artifacts, if any. -// -// A user can list previously-requested builds or get builds by their ID to -// determine the status of the build. -service CloudBuild { - option (google.api.default_host) = "cloudbuild.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Starts a build with the specified configuration. - // - // This method returns a long-running `Operation`, which includes the build - // ID. Pass the build ID to `GetBuild` to determine the build status (such as - // `SUCCESS` or `FAILURE`). - rpc CreateBuild(CreateBuildRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/builds" - body: "build" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*}/builds" - body: "build" - } - }; - option (google.api.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - option (google.api.method_signature) = "project_id,build"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // Returns information about a previously requested build. - // - // The `Build` that is returned includes its status (such as `SUCCESS`, - // `FAILURE`, or `WORKING`), and timing information. - rpc GetBuild(GetBuildRequest) returns (Build) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/builds/{id}" - additional_bindings { get: "/v1/{name=projects/*/locations/*/builds/*}" } - }; - option (google.api.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/builds/*" - } - }; - option (google.api.method_signature) = "project_id,id"; - } - - // Lists previously requested builds. - // - // Previously requested builds may still be in-progress, or may have finished - // successfully or unsuccessfully. - rpc ListBuilds(ListBuildsRequest) returns (ListBuildsResponse) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/builds" - additional_bindings { get: "/v1/{parent=projects/*/locations/*}/builds" } - }; - option (google.api.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - option (google.api.method_signature) = "project_id,filter"; - } - - // Cancels a build in progress. - rpc CancelBuild(CancelBuildRequest) returns (Build) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/builds/{id}:cancel" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/builds/*}:cancel" - body: "*" - } - }; - option (google.api.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/builds/*" - } - }; - option (google.api.method_signature) = "project_id,id"; - } - - // Creates a new build based on the specified build. - // - // This method creates a new build using the original build request, which may - // or may not result in an identical build. - // - // For triggered builds: - // - // * Triggered builds resolve to a precise revision; therefore a retry of a - // triggered build will result in a build that uses the same revision. - // - // For non-triggered builds that specify `RepoSource`: - // - // * If the original build built from the tip of a branch, the retried build - // will build from the tip of that branch, which may not be the same revision - // as the original build. - // * If the original build specified a commit sha or revision ID, the retried - // build will use the identical source. - // - // For builds that specify `StorageSource`: - // - // * If the original build pulled source from Cloud Storage without - // specifying the generation of the object, the new build will use the current - // object, which may be different from the original build source. - // * If the original build pulled source from Cloud Storage and specified the - // generation of the object, the new build will attempt to use the same - // object, which may or may not be available depending on the bucket's - // lifecycle management settings. - rpc RetryBuild(RetryBuildRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/builds/{id}:retry" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/builds/*}:retry" - body: "*" - } - }; - option (google.api.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/builds/*" - } - }; - option (google.api.method_signature) = "project_id,id"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // Approves or rejects a pending build. - // - // If approved, the returned LRO will be analogous to the LRO returned from - // a CreateBuild call. - // - // If rejected, the returned LRO will be immediately done. - rpc ApproveBuild(ApproveBuildRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/builds/*}:approve" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/builds/*}:approve" - body: "*" - } - }; - option (google.api.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/builds/*" - } - }; - option (google.api.method_signature) = "name,approval_result"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // Creates a new `BuildTrigger`. - // - // This API is experimental. - rpc CreateBuildTrigger(CreateBuildTriggerRequest) returns (BuildTrigger) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/triggers" - body: "trigger" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*}/triggers" - body: "trigger" - } - }; - option (google.api.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - option (google.api.method_signature) = "project_id,trigger"; - } - - // Returns information about a `BuildTrigger`. - // - // This API is experimental. - rpc GetBuildTrigger(GetBuildTriggerRequest) returns (BuildTrigger) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/triggers/{trigger_id}" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/triggers/*}" - } - }; - option (google.api.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/triggers/*" - } - }; - option (google.api.method_signature) = "project_id,trigger_id"; - } - - // Lists existing `BuildTrigger`s. - // - // This API is experimental. - rpc ListBuildTriggers(ListBuildTriggersRequest) - returns (ListBuildTriggersResponse) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/triggers" - additional_bindings { - get: "/v1/{parent=projects/*/locations/*}/triggers" - } - }; - option (google.api.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - option (google.api.method_signature) = "project_id"; - } - - // Deletes a `BuildTrigger` by its project ID and trigger ID. - // - // This API is experimental. - rpc DeleteBuildTrigger(DeleteBuildTriggerRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/projects/{project_id}/triggers/{trigger_id}" - additional_bindings { - delete: "/v1/{name=projects/*/locations/*/triggers/*}" - } - }; - option (google.api.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/triggers/*" - } - }; - option (google.api.method_signature) = "project_id,trigger_id"; - } - - // Updates a `BuildTrigger` by its project ID and trigger ID. - // - // This API is experimental. - rpc UpdateBuildTrigger(UpdateBuildTriggerRequest) returns (BuildTrigger) { - option (google.api.http) = { - patch: "/v1/projects/{project_id}/triggers/{trigger_id}" - body: "trigger" - additional_bindings { - patch: "/v1/{trigger.resource_name=projects/*/locations/*/triggers/*}" - body: "trigger" - } - }; - option (google.api.routing) = { - routing_parameters { - field: "trigger.resource_name" - path_template: "projects/*/locations/{location=*}/triggers/*" - } - }; - option (google.api.method_signature) = "project_id,trigger_id,trigger"; - } - - // Runs a `BuildTrigger` at a particular source revision. - // - // To run a regional or global trigger, use the POST request - // that includes the location endpoint in the path (ex. - // v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The - // POST request that does not include the location endpoint in the path can - // only be used when running global triggers. - rpc RunBuildTrigger(RunBuildTriggerRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/triggers/{trigger_id}:run" - body: "source" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/triggers/*}:run" - body: "*" - } - }; - option (google.api.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/triggers/*" - } - }; - option (google.api.method_signature) = "project_id,trigger_id,source"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // ReceiveTriggerWebhook [Experimental] is called when the API receives a - // webhook request targeted at a specific trigger. - rpc ReceiveTriggerWebhook(ReceiveTriggerWebhookRequest) - returns (ReceiveTriggerWebhookResponse) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/triggers/{trigger}:webhook" - body: "body" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/triggers/*}:webhook" - body: "body" - } - }; - } - - // Creates a `WorkerPool`. - rpc CreateWorkerPool(CreateWorkerPoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/workerPools" - body: "worker_pool" - }; - option (google.api.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - option (google.api.method_signature) = "parent,worker_pool,worker_pool_id"; - option (google.longrunning.operation_info) = { - response_type: "WorkerPool" - metadata_type: "CreateWorkerPoolOperationMetadata" - }; - } - - // Returns details of a `WorkerPool`. - rpc GetWorkerPool(GetWorkerPoolRequest) returns (WorkerPool) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/workerPools/*}" - }; - option (google.api.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/workerPools/*" - } - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a `WorkerPool`. - rpc DeleteWorkerPool(DeleteWorkerPoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/workerPools/*}" - }; - option (google.api.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/workerPools/*" - } - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "DeleteWorkerPoolOperationMetadata" - }; - } - - // Updates a `WorkerPool`. - rpc UpdateWorkerPool(UpdateWorkerPoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{worker_pool.name=projects/*/locations/*/workerPools/*}" - body: "worker_pool" - }; - option (google.api.routing) = { - routing_parameters { - field: "worker_pool.name" - path_template: "projects/*/locations/{location=*}/workerPools/*" - } - }; - option (google.api.method_signature) = "worker_pool,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "WorkerPool" - metadata_type: "UpdateWorkerPoolOperationMetadata" - }; - } - - // Lists `WorkerPool`s. - rpc ListWorkerPools(ListWorkerPoolsRequest) - returns (ListWorkerPoolsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/workerPools" - }; - option (google.api.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - option (google.api.method_signature) = "parent"; - } -} - -// Specifies a build to retry. -message RetryBuildRequest { - // The name of the `Build` to retry. - // Format: `projects/{project}/locations/{location}/builds/{build}` - string name = 3 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Build" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Build ID of the original build. - string id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies a build trigger to run and the source to use. -message RunBuildTriggerRequest { - // The name of the `Trigger` to run. - // Format: `projects/{project}/locations/{location}/triggers/{trigger}` - string name = 4 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the trigger. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Source to build against this trigger. - // Branch and tag names cannot consist of regular expressions. - RepoSource source = 3; -} - -// Location of the source in an archive file in Cloud Storage. -message StorageSource { - // Cloud Storage bucket containing the source (see - // [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - string bucket = 1; - - // Cloud Storage object containing the source. - // - // This object must be a zipped (`.zip`) or gzipped archive file (`.tar.gz`) - // containing source to build. - string object = 2; - - // 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 any accessible Git repository. -message GitSource { - // Location of the Git repo to build. - // - // This will be used as a `git remote`, see - // https://git-scm.com/docs/git-remote. - string url = 1; - - // 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. - string dir = 5; - - // The revision to fetch from the Git repository such as a branch, a tag, a - // commit SHA, or any Git ref. - // - // Cloud Build uses `git fetch` to fetch the revision from the Git - // repository; therefore make sure that the string you provide for `revision` - // is parsable by the command. For information on string values accepted by - // `git fetch`, see - // https://git-scm.com/docs/gitrevisions#_specifying_revisions. For - // information on `git fetch`, see https://git-scm.com/docs/git-fetch. - string revision = 6; -} - -// Location of the source in a Google Cloud Source Repository. -message RepoSource { - // 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; - - // 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; - } - - // 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. - string dir = 7; - - // Only trigger a build if the revision regex does NOT match the revision - // regex. - bool invert_regex = 8; - - // Substitutions to use in a triggered build. - // Should only be used with RunBuildTrigger - map substitutions = 9; -} - -// Location of the source manifest in Cloud Storage. -// This feature is in Preview; see description -// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). -message StorageSourceManifest { - // Cloud Storage bucket containing the source manifest (see [Bucket - // Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - string bucket = 1; - - // Cloud Storage object containing the source manifest. - // - // This object must be a JSON file. - string object = 2; - - // 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 supported storage service. -message Source { - // Location of source. - oneof source { - // If provided, get the source from this location in Cloud Storage. - StorageSource storage_source = 2; - - // If provided, get the source from this location in a Cloud Source - // Repository. - RepoSource repo_source = 3; - - // If provided, get the source from this Git repository. - GitSource git_source = 5; - - // If provided, get the source from this manifest in Cloud Storage. - // This feature is in Preview; see description - // [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). - StorageSourceManifest storage_source_manifest = 8; - } -} - -// An image built by the pipeline. -message BuiltImage { - // Name used to push the container image to Google Container Registry, as - // presented to `docker push`. - string name = 1; - - // Docker Registry 2.0 digest. - string digest = 3; - - // Output only. Stores timing information for pushing the specified image. - TimeSpan push_timing = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Artifact uploaded using the PythonPackage directive. -message UploadedPythonPackage { - // URI of the uploaded artifact. - string uri = 1; - - // Hash types and values of the Python Artifact. - FileHashes file_hashes = 2; - - // Output only. Stores timing information for pushing the specified artifact. - TimeSpan push_timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A Maven artifact uploaded using the MavenArtifact directive. -message UploadedMavenArtifact { - // URI of the uploaded artifact. - string uri = 1; - - // Hash types and values of the Maven Artifact. - FileHashes file_hashes = 2; - - // Output only. Stores timing information for pushing the specified artifact. - TimeSpan push_timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// An npm package uploaded to Artifact Registry using the NpmPackage -// directive. -message UploadedNpmPackage { - // URI of the uploaded npm package. - string uri = 1; - - // Hash types and values of the npm package. - FileHashes file_hashes = 2; - - // Output only. Stores timing information for pushing the specified artifact. - TimeSpan push_timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A step in the build pipeline. -message BuildStep { - // Required. The name of the container image that will run this particular - // build step. - // - // If the image is available in the host's Docker daemon's cache, it - // will be run directly. If not, the host will attempt to pull the image - // first, using the builder service account's credentials if necessary. - // - // The Docker daemon's cache will already have the latest versions of all of - // the officially supported build steps - // ([https://github.com/GoogleCloudPlatform/cloud-builders](https://github.com/GoogleCloudPlatform/cloud-builders)). - // The Docker daemon will also have cached many of the layers for some popular - // images, like "ubuntu", "debian", but they will be refreshed at the time you - // attempt to use them. - // - // If you built an image in a previous build step, it will be stored in the - // host's Docker daemon's cache and is available to use as the name for a - // later build step. - string name = 1; - - // A list of environment variable definitions to be used when running a step. - // - // The elements are of the form "KEY=VALUE" for the environment variable "KEY" - // being given the value "VALUE". - repeated string env = 2; - - // A list of arguments that will be presented to the step when it is started. - // - // If the image used to run the step's container has an entrypoint, the `args` - // are used as arguments to that entrypoint. If the image does not define - // an entrypoint, the first element in args is used as the entrypoint, - // and the remainder will be used as arguments. - repeated string args = 3; - - // Working directory to use when running this step's container. - // - // If this value is a relative path, it is relative to the build's working - // directory. If this value is absolute, it may be outside the build's working - // directory, in which case the contents of the path may not be persisted - // across build step executions, unless a `volume` for that path is specified. - // - // If the build specifies a `RepoSource` with `dir` and a step with a `dir`, - // which specifies an absolute path, the `RepoSource` `dir` is ignored for - // the step's execution. - string dir = 4; - - // Unique identifier for this build step, used in `wait_for` to - // reference this build step as a dependency. - string id = 5; - - // The ID(s) of the step(s) that this build step depends on. - // This build step will not start until all the build steps in `wait_for` - // have completed successfully. If `wait_for` is empty, this build step will - // start when all previous build steps in the `Build.Steps` list have - // completed successfully. - repeated string wait_for = 6; - - // Entrypoint to be used instead of the build step image's default entrypoint. - // If unset, the image's default entrypoint is used. - string entrypoint = 7; - - // A list of environment variables which are encrypted using a Cloud Key - // Management Service crypto key. These values must be specified in the - // build's `Secret`. - repeated string secret_env = 8; - - // List of volumes to mount into the build step. - // - // Each volume is created as an empty volume prior to execution of the - // build step. Upon completion of the build, volumes and their contents are - // discarded. - // - // Using a named volume in only one step is not valid as it is indicative - // of a build request with an incorrect configuration. - repeated Volume volumes = 9; - - // Output only. Stores timing information for executing this build step. - TimeSpan timing = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Stores timing information for pulling this build step's - // builder image only. - TimeSpan pull_timing = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Time limit for executing this build step. If not defined, the step has no - // time limit and will be allowed to continue to run until either it completes - // or the build itself times out. - google.protobuf.Duration timeout = 11; - - // Output only. Status of the build step. At this time, build step status is - // only updated on build completion; step status is not updated in real-time - // as the build progresses. - Build.Status status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allow this build step to fail without failing the entire build. - // - // If false, the entire build will fail if this step fails. Otherwise, the - // build will succeed, but this step will still have a failure status. - // Error information will be reported in the failure_detail field. - bool allow_failure = 14; - - // Output only. Return code from running the step. - int32 exit_code = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allow this build step to fail without failing the entire build if and - // only if the exit code is one of the specified codes. If allow_failure - // is also specified, this field will take precedence. - repeated int32 allow_exit_codes = 18; - - // A shell script to be executed in the step. - // - // When script is provided, the user cannot specify the entrypoint or args. - string script = 19; - - // Option to include built-in and custom substitutions as env variables - // for this build step. This option will override the global option - // in BuildOption. - optional bool automap_substitutions = 20; -} - -// Volume describes a Docker container volume which is mounted into build steps -// in order to persist files across build step execution. -message Volume { - // Name of the volume to mount. - // - // Volume names must be unique per build step and must be valid names for - // Docker volumes. Each named volume must be used by at least two build steps. - string name = 1; - - // Path at which to mount the volume. - // - // Paths must be absolute and cannot conflict with other volume paths on the - // same build step or with certain reserved volume paths. - string path = 2; -} - -// Artifacts created by the build pipeline. -message Results { - // Container images that were built as a part of the build. - repeated BuiltImage images = 2; - - // List of build step digests, in the order corresponding to build step - // indices. - repeated string build_step_images = 3; - - // Path to the artifact manifest for non-container artifacts uploaded to Cloud - // Storage. Only populated when artifacts are uploaded to Cloud Storage. - string artifact_manifest = 4; - - // Number of non-container artifacts uploaded to Cloud Storage. Only populated - // when artifacts are uploaded to Cloud Storage. - int64 num_artifacts = 5; - - // List of build step outputs, produced by builder images, in the order - // corresponding to build step indices. - // - // [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders) - // can produce this output by writing to `$BUILDER_OUTPUT/output`. - // Only the first 4KB of data is stored. - repeated bytes build_step_outputs = 6; - - // Time to push all non-container artifacts to Cloud Storage. - TimeSpan artifact_timing = 7; - - // Python artifacts uploaded to Artifact Registry at the end of the build. - repeated UploadedPythonPackage python_packages = 8; - - // Maven artifacts uploaded to Artifact Registry at the end of the build. - repeated UploadedMavenArtifact maven_artifacts = 9; - - // Npm packages uploaded to Artifact Registry at the end of the build. - repeated UploadedNpmPackage npm_packages = 12; -} - -// An artifact that was uploaded during a build. This -// is a single record in the artifact manifest JSON file. -message ArtifactResult { - // The path of an artifact in a Cloud Storage bucket, with the - // generation number. For example, - // `gs://mybucket/path/to/output.jar#generation`. - string location = 1; - - // The file hash of the artifact. - repeated FileHashes file_hash = 2; -} - -// A build resource in the Cloud Build API. -// -// At a high level, a `Build` describes where to find source code, how to build -// it (for example, the builder image to run on the source), and where to store -// the built artifacts. -// -// Fields can include the following variables, which will be expanded when the -// build is created: -// -// - $PROJECT_ID: the project ID of the build. -// - $PROJECT_NUMBER: the project number of the build. -// - $LOCATION: the location/region of the build. -// - $BUILD_ID: the autogenerated ID of the build. -// - $REPO_NAME: the source repository name specified by RepoSource. -// - $BRANCH_NAME: the branch name specified by RepoSource. -// - $TAG_NAME: the tag name specified by RepoSource. -// - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or -// resolved from the specified branch or tag. -// - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA. -message Build { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/Build" - pattern: "projects/{project}/builds/{build}" - pattern: "projects/{project}/locations/{location}/builds/{build}" - }; - - // Possible status of a build or build step. - enum Status { - // Status of the build is unknown. - STATUS_UNKNOWN = 0; - - // Build has been created and is pending execution and queuing. It has not - // been queued. - PENDING = 10; - - // Build or step is queued; work has not yet begun. - QUEUED = 1; - - // Build or step is being executed. - WORKING = 2; - - // Build or step finished successfully. - SUCCESS = 3; - - // Build or step failed to complete successfully. - FAILURE = 4; - - // Build or step failed due to an internal cause. - INTERNAL_ERROR = 5; - - // Build or step took longer than was allowed. - TIMEOUT = 6; - - // Build or step was canceled by a user. - CANCELLED = 7; - - // Build was enqueued for longer than the value of `queue_ttl`. - EXPIRED = 9; - } - - // A non-fatal problem encountered during the execution of the build. - message Warning { - // The relative importance of this warning. - enum Priority { - // Should not be used. - PRIORITY_UNSPECIFIED = 0; - - // e.g. deprecation warnings and alternative feature highlights. - INFO = 1; - - // e.g. automated detection of possible issues with the build. - WARNING = 2; - - // e.g. alerts that a feature used in the build is pending removal - ALERT = 3; - } - - // Explanation of the warning generated. - string text = 1; - - // The priority for this warning. - Priority priority = 2; - } - - // A fatal problem encountered during the execution of the build. - message FailureInfo { - // The name of a fatal problem encountered during the execution of the - // build. - enum FailureType { - // Type unspecified - FAILURE_TYPE_UNSPECIFIED = 0; - - // Unable to push the image to the repository. - PUSH_FAILED = 1; - - // Final image not found. - PUSH_IMAGE_NOT_FOUND = 2; - - // Unauthorized push of the final image. - PUSH_NOT_AUTHORIZED = 3; - - // Backend logging failures. Should retry. - LOGGING_FAILURE = 4; - - // A build step has failed. - USER_BUILD_STEP = 5; - - // The source fetching has failed. - FETCH_SOURCE_FAILED = 6; - } - - // The name of the failure. - FailureType type = 1; - - // Explains the failure issue in more detail using hard-coded text. - string detail = 2; - } - - // Output only. The 'Build' name with format: - // `projects/{project}/locations/{location}/builds/{build}`, where {build} - // is a unique identifier generated by the service. - string name = 45 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Unique identifier of the build. - string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. ID of the project. - string project_id = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Status of the build. - Status status = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Customer-readable message about the current status. - string status_detail = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The location of the source files to build. - Source source = 3; - - // Required. The operations to be performed on the workspace. - repeated BuildStep steps = 11; - - // Output only. Results of the build. - Results results = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which the request to create the build was received. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which execution of the build was started. - google.protobuf.Timestamp start_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which execution of the build was finished. - // - // The difference between finish_time and start_time is the duration of the - // build's execution. - google.protobuf.Timestamp finish_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Amount of time that this build should be allowed to run, to second - // granularity. If this amount of time elapses, work on the build will cease - // and the build status will be `TIMEOUT`. - // - // `timeout` starts ticking from `startTime`. - // - // Default time is 60 minutes. - google.protobuf.Duration timeout = 12; - - // A list of images to be pushed upon the successful completion of all build - // steps. - // - // The images are pushed using the builder service account's credentials. - // - // The digests of the pushed images will be stored in the `Build` resource's - // results field. - // - // If any of the images fail to be pushed, the build status is marked - // `FAILURE`. - repeated string images = 13; - - // TTL in queue for this build. If provided and the build is enqueued longer - // than this value, the build will expire and the build status will be - // `EXPIRED`. - // - // The TTL starts ticking from create_time. - google.protobuf.Duration queue_ttl = 40; - - // Artifacts produced by the build that should be uploaded upon - // successful completion of all build steps. - Artifacts artifacts = 37; - - // Cloud Storage bucket where logs should be written (see - // [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - // Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`. - string logs_bucket = 19; - - // Output only. A permanent fixed identifier for source. - SourceProvenance source_provenance = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The ID of the `BuildTrigger` that triggered this build, if it - // was triggered automatically. - string build_trigger_id = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Special options for this build. - BuildOptions options = 23; - - // Output only. URL to logs for this build in Google Cloud Console. - string log_url = 25 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Substitutions data for `Build` resource. - map substitutions = 29; - - // Tags for annotation of a `Build`. These are not docker tags. - repeated string tags = 31; - - // Secrets to decrypt using Cloud Key Management Service. - // Note: Secret Manager is the recommended technique - // for managing sensitive data with Cloud Build. Use `available_secrets` to - // configure builds to access secrets from Secret Manager. For instructions, - // see: https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets - repeated Secret secrets = 32; - - // Output only. Stores timing information for phases of the build. Valid keys - // are: - // - // * BUILD: time to execute all build steps. - // * PUSH: time to push all artifacts including docker images and non docker - // artifacts. - // * FETCHSOURCE: time to fetch source. - // * SETUPBUILD: time to set up build. - // - // If the build does not specify source or images, - // these keys will not be included. - map timing = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Describes this build's approval configuration, status, - // and result. - BuildApproval approval = 44 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // IAM service account whose credentials will be used at build runtime. - // Must be of the format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. - // ACCOUNT can be email address or uniqueId of the service account. - // - string service_account = 42 [(google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - }]; - - // Secrets and secret environment variables. - Secrets available_secrets = 47; - - // Output only. Non-fatal problems encountered during the execution of the - // build. - repeated Warning warnings = 49 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Contains information about the build when status=FAILURE. - FailureInfo failure_info = 51 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Artifacts produced by a build that should be uploaded upon -// successful completion of all build steps. -message Artifacts { - // Files in the workspace to upload to Cloud Storage upon successful - // completion of all build steps. - message ArtifactObjects { - // Cloud Storage bucket and optional object path, in the form - // "gs://bucket/path/to/somewhere/". (see [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - // - // Files in the workspace matching any path pattern will be uploaded to - // Cloud Storage with this location as a prefix. - string location = 1; - - // Path globs used to match files in the build's workspace. - repeated string paths = 2; - - // Output only. Stores timing information for pushing all artifact objects. - TimeSpan timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // A Maven artifact to upload to Artifact Registry upon successful completion - // of all build steps. - message MavenArtifact { - // Artifact Registry repository, in the form - // "https://$REGION-maven.pkg.dev/$PROJECT/$REPOSITORY" - // - // Artifact in the workspace specified by path will be uploaded to - // Artifact Registry with this location as a prefix. - string repository = 1; - - // Path to an artifact in the build's workspace to be uploaded to - // Artifact Registry. - // This can be either an absolute path, - // e.g. /workspace/my-app/target/my-app-1.0.SNAPSHOT.jar - // or a relative path from /workspace, - // e.g. my-app/target/my-app-1.0.SNAPSHOT.jar. - string path = 2; - - // Maven `artifactId` value used when uploading the artifact to Artifact - // Registry. - string artifact_id = 3; - - // Maven `groupId` value used when uploading the artifact to Artifact - // Registry. - string group_id = 4; - - // Maven `version` value used when uploading the artifact to Artifact - // Registry. - string version = 5; - } - - // Python package to upload to Artifact Registry upon successful completion - // of all build steps. A package can encapsulate multiple objects to be - // uploaded to a single repository. - message PythonPackage { - // Artifact Registry repository, in the form - // "https://$REGION-python.pkg.dev/$PROJECT/$REPOSITORY" - // - // Files in the workspace matching any path pattern will be uploaded to - // Artifact Registry with this location as a prefix. - string repository = 1; - - // Path globs used to match files in the build's workspace. For Python/ - // Twine, this is usually `dist/*`, and sometimes additionally an `.asc` - // file. - repeated string paths = 2; - } - - // Npm package to upload to Artifact Registry upon successful completion - // of all build steps. - message NpmPackage { - // Artifact Registry repository, in the form - // "https://$REGION-npm.pkg.dev/$PROJECT/$REPOSITORY" - // - // Npm package in the workspace specified by path will be zipped and - // uploaded to Artifact Registry with this location as a prefix. - string repository = 1; - - // Path to the package.json. - // e.g. workspace/path/to/package - string package_path = 2; - } - - // A list of images to be pushed upon the successful completion of all build - // steps. - // - // The images will be pushed using the builder service account's credentials. - // - // The digests of the pushed images will be stored in the Build resource's - // results field. - // - // If any of the images fail to be pushed, the build is marked FAILURE. - repeated string images = 1; - - // A list of objects to be uploaded to Cloud Storage upon successful - // completion of all build steps. - // - // Files in the workspace matching specified paths globs will be uploaded to - // the specified Cloud Storage location using the builder service account's - // credentials. - // - // The location and generation of the uploaded objects will be stored in the - // Build resource's results field. - // - // If any objects fail to be pushed, the build is marked FAILURE. - ArtifactObjects objects = 2; - - // A list of Maven artifacts to be uploaded to Artifact Registry upon - // successful completion of all build steps. - // - // Artifacts in the workspace matching specified paths globs will be uploaded - // to the specified Artifact Registry repository using the builder service - // account's credentials. - // - // If any artifacts fail to be pushed, the build is marked FAILURE. - repeated MavenArtifact maven_artifacts = 3; - - // A list of Python packages to be uploaded to Artifact Registry upon - // successful completion of all build steps. - // - // The build service account credentials will be used to perform the upload. - // - // If any objects fail to be pushed, the build is marked FAILURE. - repeated PythonPackage python_packages = 5; - - // A list of npm packages to be uploaded to Artifact Registry upon - // successful completion of all build steps. - // - // Npm packages in the specified paths will be uploaded - // to the specified Artifact Registry repository using the builder service - // account's credentials. - // - // If any packages fail to be pushed, the build is marked FAILURE. - repeated NpmPackage npm_packages = 6; -} - -// Start and end times for a build execution phase. -message TimeSpan { - // Start of time span. - google.protobuf.Timestamp start_time = 1; - - // End of time span. - google.protobuf.Timestamp end_time = 2; -} - -// Metadata for build operations. -message BuildOperationMetadata { - // The build that the operation is tracking. - Build build = 1; -} - -// 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 = 3; - - // A copy of the build's `source.repo_source`, if exists, with any - // revisions resolved. - RepoSource resolved_repo_source = 6; - - // A copy of the build's `source.storage_source_manifest`, if exists, with any - // revisions resolved. - // This feature is in Preview. - StorageSourceManifest resolved_storage_source_manifest = 9; - - // Output only. Hash(es) of the build source, which can be used to verify that - // the original source integrity was maintained in the build. Note that - // `FileHashes` will only be populated if `BuildOptions` has requested a - // `SourceProvenanceHash`. - // - // The keys to this map are file paths used as build source and the values - // contain the hash values for those files. - // - // If the build source came in a single package such as a gzipped tarfile - // (`.tar.gz`), the `FileHash` will be for the single path to that file. - map file_hashes = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Container message for hashes of byte content of files, used in -// SourceProvenance messages to verify integrity of source input to the build. -message FileHashes { - // Collection of file hashes. - repeated Hash file_hash = 1; -} - -// Container message for hash values. -message Hash { - // Specifies the hash algorithm, if any. - enum HashType { - // No hash requested. - NONE = 0; - - // Use a sha256 hash. - SHA256 = 1; - - // Use a md5 hash. - MD5 = 2; - - // Use a sha512 hash. - SHA512 = 4; - } - - // The type of hash that was performed. - HashType type = 1; - - // The hash value. - bytes value = 2; -} - -// Secrets and secret environment variables. -message Secrets { - // Secrets in Secret Manager and associated secret environment variable. - repeated SecretManagerSecret secret_manager = 1; - - // Secrets encrypted with KMS key and the associated secret environment - // variable. - repeated InlineSecret inline = 2; -} - -// Pairs a set of secret environment variables mapped to encrypted -// values with the Cloud KMS key to use to decrypt the value. -message InlineSecret { - // Resource name of Cloud KMS crypto key to decrypt the encrypted value. - // In format: projects/*/locations/*/keyRings/*/cryptoKeys/* - string kms_key_name = 1 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; - - // Map of environment variable name to its encrypted value. - // - // Secret environment variables must be unique across all of a build's - // secrets, and must be used by at least one build step. Values can be at most - // 64 KB in size. There can be at most 100 secret values across all of a - // build's secrets. - map env_map = 2; -} - -// Pairs a secret environment variable with a SecretVersion in Secret Manager. -message SecretManagerSecret { - // Resource name of the SecretVersion. In format: - // projects/*/secrets/*/versions/* - string version_name = 1 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // Environment variable name to associate with the secret. - // Secret environment variables must be unique across all of a build's - // secrets, and must be used by at least one build step. - string env = 2; -} - -// Pairs a set of secret environment variables containing encrypted -// values with the Cloud KMS key to use to decrypt the value. -// Note: Use `kmsKeyName` with `available_secrets` instead of using -// `kmsKeyName` with `secret`. For instructions see: -// https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-credentials. -message Secret { - // Cloud KMS key name to use to decrypt these envs. - string kms_key_name = 1; - - // Map of environment variable name to its encrypted value. - // - // Secret environment variables must be unique across all of a build's - // secrets, and must be used by at least one build step. Values can be at most - // 64 KB in size. There can be at most 100 secret values across all of a - // build's secrets. - map secret_env = 3; -} - -// Request to create a new build. -message CreateBuildRequest { - // The parent resource where this build will be created. - // Format: `projects/{project}/locations/{location}` - string parent = 4 [(google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Build" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Build resource to create. - Build build = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to get a build. -message GetBuildRequest { - // The name of the `Build` to retrieve. - // Format: `projects/{project}/locations/{location}/builds/{build}` - string name = 4 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Build" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the build. - string id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to list builds. -message ListBuildsRequest { - // The parent of the collection of `Builds`. - // Format: `projects/{project}/locations/{location}` - string parent = 9 [(google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Build" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Number of results to return in the list. - int32 page_size = 2; - - // The page token for the next page of Builds. - // - // If unspecified, the first page of results is returned. - // - // If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. - // In this case, the token should be discarded, and pagination should be - // restarted from the first page of results. - // - // See https://google.aip.dev/158 for more. - string page_token = 3; - - // The raw filter text to constrain the results. - string filter = 8; -} - -// Response including listed builds. -message ListBuildsResponse { - // Builds will be sorted by `create_time`, descending. - repeated Build builds = 1; - - // Token to receive the next page of results. - // This will be absent if the end of the response list has been reached. - string next_page_token = 2; -} - -// Request to cancel an ongoing build. -message CancelBuildRequest { - // The name of the `Build` to cancel. - // Format: `projects/{project}/locations/{location}/builds/{build}` - string name = 4 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Build" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the build. - string id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to approve or reject a pending build. -message ApproveBuildRequest { - // Required. Name of the target build. - // For example: "projects/{$project_id}/builds/{$build_id}" - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Approval decision and metadata. - ApprovalResult approval_result = 2; -} - -// BuildApproval describes a build's approval configuration, state, and -// result. -message BuildApproval { - // Specifies the current state of a build's approval. - enum State { - // Default enum type. This should not be used. - STATE_UNSPECIFIED = 0; - - // Build approval is pending. - PENDING = 1; - - // Build approval has been approved. - APPROVED = 2; - - // Build approval has been rejected. - REJECTED = 3; - - // Build was cancelled while it was still pending approval. - CANCELLED = 5; - } - - // Output only. The state of this build's approval. - State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Configuration for manual approval of this build. - ApprovalConfig config = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Result of manual approval for this Build. - ApprovalResult result = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// ApprovalConfig describes configuration for manual approval of a build. -message ApprovalConfig { - // Whether or not approval is needed. If this is set on a build, it will - // become pending when created, and will need to be explicitly approved - // to start. - bool approval_required = 1; -} - -// ApprovalResult describes the decision and associated metadata of a manual -// approval of a build. -message ApprovalResult { - // Specifies whether or not this manual approval result is to approve - // or reject a build. - enum Decision { - // Default enum type. This should not be used. - DECISION_UNSPECIFIED = 0; - - // Build is approved. - APPROVED = 1; - - // Build is rejected. - REJECTED = 2; - } - - // Output only. Email of the user that called the ApproveBuild API to - // approve or reject a build at the time that the API was called. - string approver_account = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the approval decision was made. - google.protobuf.Timestamp approval_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The decision of this manual approval. - Decision decision = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional comment for this manual approval result. - string comment = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional URL tied to this manual approval result. This field - // is essentially the same as comment, except that it will be rendered by the - // UI differently. An example use case is a link to an external job that - // approved this Build. - string url = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// GitRepoSource describes a repo and ref of a code repository. -message GitRepoSource { - // The URI of the repo (e.g. https://github.com/user/repo.git). - // Either `uri` or `repository` can be specified and is required. - string uri = 1; - - // The source of the SCM repo. - oneof source { - // The connected repository resource name, in the format - // `projects/*/locations/*/connections/*/repositories/*`. Either `uri` or - // `repository` can be specified and is required. - string repository = 6 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - }]; - } - - // The branch or tag to use. Must start with "refs/" (required). - string ref = 2; - - // See RepoType below. - GitFileSource.RepoType repo_type = 3; - - // The resource name of the enterprise config that should be applied - // to this source. - oneof enterprise_config { - // The full resource name of the github enterprise config. - // Format: - // `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`. - // `projects/{project}/githubEnterpriseConfigs/{id}`. - string github_enterprise_config = 4 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" - }]; - } -} - -// GitFileSource describes a file within a (possibly remote) code repository. -message GitFileSource { - // The type of the repo, since it may not be explicit from the `repo` field - // (e.g from a URL). - enum RepoType { - // The default, unknown repo type. Don't use it, instead use one of - // the other repo types. - UNKNOWN = 0; - - // A Google Cloud Source Repositories-hosted repo. - CLOUD_SOURCE_REPOSITORIES = 1; - - // A GitHub-hosted repo not necessarily on "github.com" (i.e. GitHub - // Enterprise). - GITHUB = 2; - - // A Bitbucket Server-hosted repo. - BITBUCKET_SERVER = 3; - - // A GitLab-hosted repo. - GITLAB = 4; - } - - // The path of the file, with the repo root as the root of the path. - string path = 1; - - // The URI of the repo. - // Either uri or repository can be specified. - // If unspecified, the repo from which the trigger invocation originated is - // assumed to be the repo from which to read the specified path. - string uri = 2; - - // The source of the SCM repo. - oneof source { - // The fully qualified resource name of the Repos API repository. - // Either URI or repository can be specified. - // If unspecified, the repo from which the trigger invocation originated is - // assumed to be the repo from which to read the specified path. - string repository = 7 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - }]; - } - - // See RepoType above. - RepoType repo_type = 3; - - // The branch, tag, arbitrary ref, or SHA version of the repo to use when - // resolving the filename (optional). - // This field respects the same syntax/resolution as described here: - // https://git-scm.com/docs/gitrevisions - // If unspecified, the revision from which the trigger invocation originated - // is assumed to be the revision from which to read the specified path. - string revision = 4; - - // The resource name of the enterprise config that should be applied - // to this source. - oneof enterprise_config { - // The full resource name of the github enterprise config. - // Format: - // `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`. - // `projects/{project}/githubEnterpriseConfigs/{id}`. - string github_enterprise_config = 5 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" - }]; - } -} - -// Configuration for an automated build in response to source repository -// changes. -message BuildTrigger { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - pattern: "projects/{project}/triggers/{trigger}" - pattern: "projects/{project}/locations/{location}/triggers/{trigger}" - plural: "triggers" - singular: "trigger" - }; - - // The `Trigger` name with format: - // `projects/{project}/locations/{location}/triggers/{trigger}`, where - // {trigger} is a unique identifier generated by the service. - string resource_name = 34; - - // Output only. Unique identifier of the trigger. - string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Human-readable description of this trigger. - string description = 10; - - // User-assigned name of the trigger. Must be unique within the project. - // Trigger names must meet the following requirements: - // - // + They must contain only alphanumeric characters and dashes. - // + They can be 1-64 characters long. - // + They must begin and end with an alphanumeric character. - string name = 21; - - // Tags for annotation of a `BuildTrigger` - repeated string tags = 19; - - // Template describing the types of source changes to trigger a build. - // - // Branch and tag names in trigger templates are interpreted as regular - // expressions. Any branch or tag change that matches that regular expression - // will trigger a build. - // - // Mutually exclusive with `github`. - RepoSource trigger_template = 7; - - // GitHubEventsConfig describes the configuration of a trigger that creates - // a build whenever a GitHub event is received. - // - // Mutually exclusive with `trigger_template`. - GitHubEventsConfig github = 13; - - // PubsubConfig describes the configuration of a trigger that - // creates a build whenever a Pub/Sub message is published. - PubsubConfig pubsub_config = 29; - - // WebhookConfig describes the configuration of a trigger that - // creates a build whenever a webhook is sent to a trigger's webhook URL. - WebhookConfig webhook_config = 31; - - // Template describing the Build request to make when the trigger is matched. - // At least one of the template fields must be provided. - oneof build_template { - // Autodetect build configuration. The following precedence is used (case - // insensitive): - // - // 1. cloudbuild.yaml - // 2. cloudbuild.yml - // 3. cloudbuild.json - // 4. Dockerfile - // - // Currently only available for GitHub App Triggers. - bool autodetect = 18; - - // Contents of the build template. - Build build = 4; - - // Path, from the source root, to the build configuration file - // (i.e. cloudbuild.yaml). - string filename = 8; - - // The file source describing the local or remote Build template. - GitFileSource git_file_source = 24; - } - - // Output only. Time when the trigger was created. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // If true, the trigger will never automatically execute a build. - bool disabled = 9; - - // Substitutions for Build resource. The keys must match the following - // regular expression: `^_[A-Z0-9_]+$`. - map substitutions = 11; - - // ignored_files and included_files are file glob matches using - // https://golang.org/pkg/path/filepath/#Match extended with support for "**". - // - // If ignored_files and changed files are both empty, then they are - // not used to determine whether or not to trigger a build. - // - // If ignored_files is not empty, then we ignore any files that match - // any of the ignored_file globs. If the change has no files that are - // outside of the ignored_files globs, then we do not trigger a build. - repeated string ignored_files = 15; - - // If any of the files altered in the commit pass the ignored_files - // filter and included_files is empty, then as far as this filter is - // concerned, we should trigger the build. - // - // If any of the files altered in the commit pass the ignored_files - // filter and included_files is not empty, then we make sure that at - // least one of those files matches a included_files glob. If not, - // then we do not trigger a build. - repeated string included_files = 16; - - // Optional. A Common Expression Language string. - string filter = 30 [(google.api.field_behavior) = OPTIONAL]; - - // The repo and ref of the repository from which to build. This field - // is used only for those triggers that do not respond to SCM events. - // Triggers that respond to such events build source at whatever commit - // caused the event. - // This field is currently only used by Webhook, Pub/Sub, Manual, and Cron - // triggers. - GitRepoSource source_to_build = 26; - - // The service account used for all user-controlled operations including - // UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild. - // If no service account is set, then the standard Cloud Build service account - // ([PROJECT_NUM]@system.gserviceaccount.com) will be used instead. - // Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}` - string service_account = 33 [(google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - }]; - - // The configuration of a trigger that creates a build whenever an event from - // Repo API is received. - RepositoryEventConfig repository_event_config = 39; -} - -// The configuration of a trigger that creates a build whenever an event from -// Repo API is received. -message RepositoryEventConfig { - // All possible SCM repo types from Repo API. - enum RepositoryType { - // If unspecified, RepositoryType defaults to GITHUB. - REPOSITORY_TYPE_UNSPECIFIED = 0; - - // The SCM repo is GITHUB. - GITHUB = 1; - - // The SCM repo is GITHUB Enterprise. - GITHUB_ENTERPRISE = 2; - - // The SCM repo is GITLAB Enterprise. - GITLAB_ENTERPRISE = 3; - } - - // The resource name of the Repo API resource. - string repository = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - }]; - - // Output only. The type of the SCM vendor the repository points to. - RepositoryType repository_type = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The types of filter to trigger a build. - oneof filter { - // Filter to match changes in pull requests. - PullRequestFilter pull_request = 3; - - // Filter to match changes in refs like branches, tags. - PushFilter push = 4; - } -} - -// GitHubEventsConfig describes the configuration of a trigger that creates a -// build whenever a GitHub event is received. -message GitHubEventsConfig { - // The installationID that emits the GitHub event. - int64 installation_id = 1 [deprecated = true]; - - // Owner of the repository. For example: The owner for - // https://github.com/googlecloudplatform/cloud-builders is - // "googlecloudplatform". - string owner = 6; - - // Name of the repository. For example: The name for - // https://github.com/googlecloudplatform/cloud-builders is "cloud-builders". - string name = 7; - - // Filter describing the types of events to trigger a build. - // Currently supported event types: push, pull_request. - oneof event { - // filter to match changes in pull requests. - PullRequestFilter pull_request = 4; - - // filter to match changes in refs like branches, tags. - PushFilter push = 5; - } -} - -// PubsubConfig describes the configuration of a trigger that -// creates a build whenever a Pub/Sub message is published. -message PubsubConfig { - // Enumerates potential issues with the underlying Pub/Sub subscription - // configuration. - enum State { - // The subscription configuration has not been checked. - STATE_UNSPECIFIED = 0; - - // The Pub/Sub subscription is properly configured. - OK = 1; - - // The subscription has been deleted. - SUBSCRIPTION_DELETED = 2; - - // The topic has been deleted. - TOPIC_DELETED = 3; - - // Some of the subscription's field are misconfigured. - SUBSCRIPTION_MISCONFIGURED = 4; - } - - // Output only. Name of the subscription. Format is - // `projects/{project}/subscriptions/{subscription}`. - string subscription = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // The name of the topic from which this subscription is receiving messages. - // Format is `projects/{project}/topics/{topic}`. - string topic = 2 [ - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Service account that will make the push request. - string service_account_email = 3 [(google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - }]; - - // Potential issues with the underlying Pub/Sub subscription configuration. - // Only populated on get requests. - State state = 4; -} - -// WebhookConfig describes the configuration of a trigger that -// creates a build whenever a webhook is sent to a trigger's webhook URL. -message WebhookConfig { - // Enumerates potential issues with the Secret Manager secret provided by the - // user. - enum State { - // The webhook auth configuration not been checked. - STATE_UNSPECIFIED = 0; - - // The auth configuration is properly setup. - OK = 1; - - // The secret provided in auth_method has been deleted. - SECRET_DELETED = 2; - } - - // Auth method specifies how the webhook authenticates with GCP. - oneof auth_method { - // Required. Resource name for the secret required as a URL parameter. - string secret = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; - } - - // Potential issues with the underlying Pub/Sub subscription configuration. - // Only populated on get requests. - State state = 4; -} - -// PullRequestFilter contains filter properties for matching GitHub Pull -// Requests. -message PullRequestFilter { - // Controls behavior of Pull Request comments. - enum CommentControl { - // Do not require comments on Pull Requests before builds are triggered. - COMMENTS_DISABLED = 0; - - // Enforce that repository owners or collaborators must comment on Pull - // Requests before builds are triggered. - COMMENTS_ENABLED = 1; - - // Enforce that repository owners or collaborators must comment on external - // contributors' Pull Requests before builds are triggered. - COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY = 2; - } - - // Target refs to match. - // A target ref is the git reference where the pull request will be applied. - oneof git_ref { - // Regex of branches to match. - // - // 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 = 2; - } - - // Configure builds to run whether a repository owner or collaborator need to - // comment `/gcbrun`. - CommentControl comment_control = 5; - - // If true, branches that do NOT match the git_ref will trigger a build. - bool invert_regex = 6; -} - -// Push contains filter properties for matching GitHub git pushes. -message PushFilter { - // Modified refs to match. - // A modified refs are the refs modified by a git push operation. - oneof git_ref { - // Regexes 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 = 2; - - // Regexes 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 = 3; - } - - // When true, only trigger a build if the revision regex does NOT match the - // git_ref regex. - bool invert_regex = 4; -} - -// Request to create a new `BuildTrigger`. -message CreateBuildTriggerRequest { - // The parent resource where this trigger will be created. - // Format: `projects/{project}/locations/{location}` - string parent = 3 [(google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project for which to configure automatic builds. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. `BuildTrigger` to create. - BuildTrigger trigger = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Returns the `BuildTrigger` with the specified ID. -message GetBuildTriggerRequest { - // The name of the `Trigger` to retrieve. - // Format: `projects/{project}/locations/{location}/triggers/{trigger}` - string name = 3 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project that owns the trigger. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to list existing `BuildTriggers`. -message ListBuildTriggersRequest { - // The parent of the collection of `Triggers`. - // Format: `projects/{project}/locations/{location}` - string parent = 4 [(google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project for which to list BuildTriggers. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Number of results to return in the list. - int32 page_size = 2; - - // Token to provide to skip to a particular spot in the list. - string page_token = 3; -} - -// Response containing existing `BuildTriggers`. -message ListBuildTriggersResponse { - // `BuildTriggers` for the project, sorted by `create_time` descending. - repeated BuildTrigger triggers = 1; - - // Token to receive the next page of results. - string next_page_token = 2; -} - -// Request to delete a `BuildTrigger`. -message DeleteBuildTriggerRequest { - // The name of the `Trigger` to delete. - // Format: `projects/{project}/locations/{location}/triggers/{trigger}` - string name = 3 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project that owns the trigger. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the `BuildTrigger` to delete. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to update an existing `BuildTrigger`. -message UpdateBuildTriggerRequest { - // Required. ID of the project that owns the trigger. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the `BuildTrigger` to update. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. `BuildTrigger` to update. - BuildTrigger trigger = 3 [(google.api.field_behavior) = REQUIRED]; - - // Update mask for the resource. If this is set, - // the server will only update the fields specified in the field mask. - // Otherwise, a full update of the mutable resource fields will be performed. - google.protobuf.FieldMask update_mask = 5; -} - -// Optional arguments to enable specific features of builds. -message BuildOptions { - // Specifies the manner in which the build should be verified, if at all. - // - // If a verified build is requested, and any part of the process to generate - // and upload provenance fails, the build will also fail. - // - // If the build does not request verification then that process may occur, but - // is not guaranteed to. If it does occur and fails, the build will not fail. - // - // For more information, see [Viewing Build - // Provenance](https://cloud.google.com/build/docs/securing-builds/view-build-provenance). - enum VerifyOption { - // Not a verifiable build (the default). - NOT_VERIFIED = 0; - - // Build must be verified. - VERIFIED = 1; - } - - // Supported Compute Engine machine types. - // For more information, see [Machine - // types](https://cloud.google.com/compute/docs/machine-types). - enum MachineType { - // Standard machine type. - UNSPECIFIED = 0; - - // Highcpu machine with 8 CPUs. - N1_HIGHCPU_8 = 1; - - // Highcpu machine with 32 CPUs. - N1_HIGHCPU_32 = 2; - - // Highcpu e2 machine with 8 CPUs. - E2_HIGHCPU_8 = 5; - - // Highcpu e2 machine with 32 CPUs. - E2_HIGHCPU_32 = 6; - - // E2 machine with 1 CPU. - E2_MEDIUM = 7; - } - - // Specifies the behavior when there is an error in the substitution checks. - enum SubstitutionOption { - // Fails the build if error in substitutions checks, like missing - // a substitution in the template or in the map. - MUST_MATCH = 0; - - // Do not fail the build if error in substitutions checks. - ALLOW_LOOSE = 1; - } - - // Specifies the behavior when writing build logs to Cloud Storage. - enum LogStreamingOption { - // Service may automatically determine build log streaming behavior. - STREAM_DEFAULT = 0; - - // Build logs should be streamed to Cloud Storage. - STREAM_ON = 1; - - // Build logs should not be streamed to Cloud Storage; they will be - // written when the build is completed. - STREAM_OFF = 2; - } - - // Details about how a build should be executed on a `WorkerPool`. - // - // See [running builds in a private - // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) - // for more information. - message PoolOption { - // The `WorkerPool` resource to execute the build on. - // You must have `cloudbuild.workerpools.use` on the project hosting the - // WorkerPool. - // - // Format projects/{project}/locations/{location}/workerPools/{workerPoolId} - string name = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - } - - // Specifies the logging mode. - enum LoggingMode { - // The service determines the logging mode. The default is `LEGACY`. Do not - // rely on the default logging behavior as it may change in the future. - LOGGING_UNSPECIFIED = 0; - - // Build logs are stored in Cloud Logging and Cloud Storage. - LEGACY = 1; - - // Build logs are stored in Cloud Storage. - GCS_ONLY = 2; - - // This option is the same as CLOUD_LOGGING_ONLY. - STACKDRIVER_ONLY = 3 [deprecated = true]; - - // Build logs are stored in Cloud Logging. Selecting this option will not - // allow [logs - // streaming](https://cloud.google.com/sdk/gcloud/reference/builds/log). - CLOUD_LOGGING_ONLY = 5; - - // Turn off all logging. No build logs will be captured. - NONE = 4; - } - - // Default GCS log bucket behavior options. - enum DefaultLogsBucketBehavior { - // Unspecified. - DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED = 0; - - // Bucket is located in user-owned project in the same region as the - // build. The builder service account must have access to create and write - // to GCS buckets in the build project. - REGIONAL_USER_OWNED_BUCKET = 1; - } - - // Requested hash for SourceProvenance. - repeated Hash.HashType source_provenance_hash = 1; - - // Requested verifiability options. - VerifyOption requested_verify_option = 2; - - // Compute Engine machine type on which to run the build. - MachineType machine_type = 3; - - // Requested disk size for the VM that runs the build. Note that this is *NOT* - // "disk free"; some of the space will be used by the operating system and - // build utilities. Also note that this is the minimum disk size that will be - // allocated for the build -- the build may run with a larger disk than - // requested. At present, the maximum disk size is 2000GB; builds that request - // more than the maximum are rejected with an error. - int64 disk_size_gb = 6; - - // Option to specify behavior when there is an error in the substitution - // checks. - // - // NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot - // be overridden in the build configuration file. - SubstitutionOption substitution_option = 4; - - // Option to specify whether or not to apply bash style string - // operations to the substitutions. - // - // NOTE: this is always enabled for triggered builds and cannot be - // overridden in the build configuration file. - bool dynamic_substitutions = 17; - - // Option to include built-in and custom substitutions as env variables - // for all build steps. - bool automap_substitutions = 22; - - // Option to define build log streaming behavior to Cloud - // Storage. - LogStreamingOption log_streaming_option = 5; - - // This field deprecated; please use `pool.name` instead. - string worker_pool = 7 [deprecated = true]; - - // Optional. Specification for execution on a `WorkerPool`. - // - // See [running builds in a private - // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) - // for more information. - PoolOption pool = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Option to specify the logging mode, which determines if and where build - // logs are stored. - LoggingMode logging = 11; - - // A list of global environment variable definitions that will exist for all - // build steps in this build. If a variable is defined in both globally and in - // a build step, the variable will use the build step value. - // - // The elements are of the form "KEY=VALUE" for the environment variable "KEY" - // being given the value "VALUE". - repeated string env = 12; - - // A list of global environment variables, which are encrypted using a Cloud - // Key Management Service crypto key. These values must be specified in the - // build's `Secret`. These variables will be available to all build steps - // in this build. - repeated string secret_env = 13; - - // Global list of volumes to mount for ALL build steps - // - // Each volume is created as an empty volume prior to starting the build - // process. Upon completion of the build, volumes and their contents are - // discarded. Global volume names and paths cannot conflict with the volumes - // defined a build step. - // - // Using a global volume in a build with only one step is not valid as - // it is indicative of a build request with an incorrect configuration. - repeated Volume volumes = 14; - - // Optional. Option to specify how default logs buckets are setup. - DefaultLogsBucketBehavior default_logs_bucket_behavior = 21 - [(google.api.field_behavior) = OPTIONAL]; -} - -// ReceiveTriggerWebhookRequest [Experimental] is the request object accepted by -// the ReceiveTriggerWebhook method. -message ReceiveTriggerWebhookRequest { - // The name of the `ReceiveTriggerWebhook` to retrieve. - // Format: `projects/{project}/locations/{location}/triggers/{trigger}` - string name = 5; - - // HTTP request body. - google.api.HttpBody body = 1; - - // Project in which the specified trigger lives - string project_id = 2; - - // Name of the trigger to run the payload against - string trigger = 3; - - // Secret token used for authorization if an OAuth token isn't provided. - string secret = 4; -} - -// ReceiveTriggerWebhookResponse [Experimental] is the response object for the -// ReceiveTriggerWebhook method. -message ReceiveTriggerWebhookResponse {} - -message GitHubEnterpriseConfig { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" - pattern: "projects/{project}/githubEnterpriseConfigs/{config}" - pattern: "projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}" - }; - - // Optional. The full resource name for the GitHubEnterpriseConfig - // For example: - // "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}" - string name = 7 [(google.api.field_behavior) = OPTIONAL]; - - // The URL of the github enterprise host the configuration is for. - string host_url = 3; - - // Required. The GitHub app id of the Cloud Build app on the GitHub Enterprise - // server. - int64 app_id = 4 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Time when the installation was associated with the project. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The key that should be attached to webhook calls to the ReceiveWebhook - // endpoint. - string webhook_key = 8; - - // Optional. The network to be used when reaching out to the GitHub - // Enterprise server. The VPC network must be enabled for private - // service connection. This should be set if the GitHub Enterprise server is - // hosted on-premises and not reachable by public internet. - // If this field is left empty, no network peering will occur and calls to - // the GitHub Enterprise server will be made over the public internet. - // Must be in the format - // `projects/{project}/global/networks/{network}`, where {project} - // is a project number or id and {network} is the name of a - // VPC network in the project. - string peered_network = 9 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; - - // Names of secrets in Secret Manager. - GitHubEnterpriseSecrets secrets = 10; - - // Name to display for this config. - string display_name = 11; - - // Optional. SSL certificate to use for requests to GitHub Enterprise. - string ssl_ca = 12 [(google.api.field_behavior) = OPTIONAL]; -} - -// GitHubEnterpriseSecrets represents the names of all necessary secrets in -// Secret Manager for a GitHub Enterprise server. -// Format is: projects//secrets/. -message GitHubEnterpriseSecrets { - // The resource name for the private key secret version. - string private_key_version_name = 5 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // The resource name for the webhook secret secret version in Secret Manager. - string webhook_secret_version_name = 6 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // The resource name for the OAuth secret secret version in Secret Manager. - string oauth_secret_version_name = 7 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // The resource name for the OAuth client ID secret version in Secret Manager. - string oauth_client_id_version_name = 8 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; -} - -// Configuration for a `WorkerPool`. -// -// Cloud Build owns and maintains a pool of workers for general use and have no -// access to a project's private network. By default, builds submitted to -// Cloud Build will use a worker from this pool. -// -// If your build needs access to resources on a private network, -// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give -// your builds access to any single VPC network that you -// administer, including any on-prem resources connected to that VPC -// network. For an overview of private pools, see -// [Private pools -// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview). -message WorkerPool { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/WorkerPool" - pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" - plural: "workerPools" - singular: "workerPool" - style: DECLARATIVE_FRIENDLY - }; - - // State of the `WorkerPool`. - enum State { - // State of the `WorkerPool` is unknown. - STATE_UNSPECIFIED = 0; - - // `WorkerPool` is being created. - CREATING = 1; - - // `WorkerPool` is running. - RUNNING = 2; - - // `WorkerPool` is being deleted: cancelling builds and draining workers. - DELETING = 3; - - // `WorkerPool` is deleted. - DELETED = 4; - - // `WorkerPool` is being updated; new builds cannot be run. - UPDATING = 5; - } - - // Output only. The resource name of the `WorkerPool`, with format - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - // The value of `{worker_pool}` is provided by `worker_pool_id` in - // `CreateWorkerPool` request and the value of `{location}` is determined by - // the endpoint accessed. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A user-specified, human-readable name for the `WorkerPool`. If provided, - // this value must be 1-63 characters. - string display_name = 2; - - // Output only. A unique identifier for the `WorkerPool`. - string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User specified annotations. See https://google.aip.dev/128#annotations - // for more details such as format and size limitations. - map annotations = 4; - - // Output only. Time at which the request to create the `WorkerPool` was - // received. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which the request to update the `WorkerPool` was - // received. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which the request to delete the `WorkerPool` was - // received. - google.protobuf.Timestamp delete_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. `WorkerPool` state. - State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Configuration for the `WorkerPool`. - oneof config { - // Legacy Private Pool configuration. - PrivatePoolV1Config private_pool_v1_config = 12; - } - - // Output only. Checksum computed by the server. May be sent on update and - // delete requests to ensure that the client has an up-to-date value before - // proceeding. - string etag = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Configuration for a V1 `PrivatePool`. -message PrivatePoolV1Config { - // Defines the configuration to be used for creating workers in - // the pool. - message WorkerConfig { - // Machine type of a worker, such as `e2-medium`. - // See [Worker pool config - // file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema). - // If left blank, Cloud Build will use a sensible default. - string machine_type = 1; - - // Size of the disk attached to the worker, in GB. - // See [Worker pool config - // file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema). - // Specify a value of up to 2000. If `0` is specified, Cloud Build will use - // a standard disk size. - int64 disk_size_gb = 2; - } - - // Defines the network configuration for the pool. - message NetworkConfig { - // Defines the egress option for the pool. - enum EgressOption { - // If set, defaults to PUBLIC_EGRESS. - EGRESS_OPTION_UNSPECIFIED = 0; - - // If set, workers are created without any public address, which prevents - // network egress to public IPs unless a network proxy is configured. - NO_PUBLIC_EGRESS = 1; - - // If set, workers are created with a public address which allows for - // public internet egress. - PUBLIC_EGRESS = 2; - } - - // Required. Immutable. The network definition that the workers are peered - // to. If this section is left empty, the workers will be peered to - // `WorkerPool.project_id` on the service producer network. Must be in the - // format `projects/{project}/global/networks/{network}`, where `{project}` - // is a project number, such as `12345`, and `{network}` is the name of a - // VPC network in the project. See - // [Understanding network configuration - // options](https://cloud.google.com/build/docs/private-pools/set-up-private-pool-environment) - string peered_network = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Network" - } - ]; - - // Option to configure network egress for the workers. - EgressOption egress_option = 2; - - // Immutable. Subnet IP range within the peered network. This is specified - // in CIDR notation with a slash and the subnet prefix size. You can - // optionally specify an IP address before the subnet prefix value. e.g. - // `192.168.0.0/29` would specify an IP range starting at 192.168.0.0 with a - // prefix size of 29 bits. - // `/16` would specify a prefix size of 16 bits, with an automatically - // determined IP within the peered VPC. - // If unspecified, a value of `/24` will be used. - string peered_network_ip_range = 3 - [(google.api.field_behavior) = IMMUTABLE]; - } - - // Machine configuration for the workers in the pool. - WorkerConfig worker_config = 1; - - // Network configuration for the pool. - NetworkConfig network_config = 2; -} - -// Request to create a new `WorkerPool`. -message CreateWorkerPoolRequest { - // Required. The parent resource where this worker pool will be created. - // Format: `projects/{project}/locations/{location}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. `WorkerPool` resource to create. - WorkerPool worker_pool = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Immutable. The ID to use for the `WorkerPool`, which will become - // the final component of the resource name. - // - // This value should be 1-63 characters, and valid characters - // are /[a-z][0-9]-/. - string worker_pool_id = 3 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = REQUIRED - ]; - - // If set, validate the request and preview the response, but do not actually - // post it. - bool validate_only = 4; -} - -// Request to get a `WorkerPool` with the specified name. -message GetWorkerPoolRequest { - // Required. The name of the `WorkerPool` to retrieve. - // Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - } - ]; -} - -// Request to delete a `WorkerPool`. -message DeleteWorkerPoolRequest { - // Required. The name of the `WorkerPool` to delete. - // Format: - // `projects/{project}/locations/{location}/workerPools/{workerPool}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - } - ]; - - // Optional. If provided, it must match the server's etag on the workerpool - // for the request to be processed. - string etag = 2 [(google.api.field_behavior) = OPTIONAL]; - - // If set to true, and the `WorkerPool` is not found, the request will succeed - // but no action will be taken on the server. - bool allow_missing = 3; - - // If set, validate the request and preview the response, but do not actually - // post it. - bool validate_only = 4; -} - -// Request to update a `WorkerPool`. -message UpdateWorkerPoolRequest { - // Required. The `WorkerPool` to update. - // - // The `name` field is used to identify the `WorkerPool` to update. - // Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - WorkerPool worker_pool = 1 [(google.api.field_behavior) = REQUIRED]; - - // A mask specifying which fields in `worker_pool` to update. - google.protobuf.FieldMask update_mask = 2; - - // If set, validate the request and preview the response, but do not actually - // post it. - bool validate_only = 4; -} - -// Request to list `WorkerPool`s. -message ListWorkerPoolsRequest { - // Required. The parent of the collection of `WorkerPools`. - // Format: `projects/{project}/locations/{location}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of `WorkerPool`s to return. The service may return - // fewer than this value. If omitted, the server will use a sensible default. - int32 page_size = 2; - - // A page token, received from a previous `ListWorkerPools` call. Provide this - // to retrieve the subsequent page. - string page_token = 3; -} - -// Response containing existing `WorkerPools`. -message ListWorkerPoolsResponse { - // `WorkerPools` for the specified project. - repeated WorkerPool worker_pools = 1; - - // Continuation token used to page through large result sets. Provide this - // value in a subsequent ListWorkerPoolsRequest to return the next page of - // results. - string next_page_token = 2; -} - -// Metadata for the `CreateWorkerPool` operation. -message CreateWorkerPoolOperationMetadata { - // The resource name of the `WorkerPool` to create. - // Format: - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - string worker_pool = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // Time the operation was created. - google.protobuf.Timestamp create_time = 2; - - // Time the operation was completed. - google.protobuf.Timestamp complete_time = 3; -} - -// Metadata for the `UpdateWorkerPool` operation. -message UpdateWorkerPoolOperationMetadata { - // The resource name of the `WorkerPool` being updated. - // Format: - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - string worker_pool = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // Time the operation was created. - google.protobuf.Timestamp create_time = 2; - - // Time the operation was completed. - google.protobuf.Timestamp complete_time = 3; -} - -// Metadata for the `DeleteWorkerPool` operation. -message DeleteWorkerPoolOperationMetadata { - // The resource name of the `WorkerPool` being deleted. - // Format: - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - string worker_pool = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // Time the operation was created. - google.protobuf.Timestamp create_time = 2; - - // Time the operation was completed. - google.protobuf.Timestamp complete_time = 3; -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js deleted file mode 100644 index 8b0d3fb6a27..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.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 cloudbuild_v1_generated_CloudBuild_ApproveBuild_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 target build. - * For example: "projects/{$project_id}/builds/{$build_id}" - */ - // const name = 'abc123' - /** - * Approval decision and metadata. - */ - // const approvalResult = {} - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callApproveBuild() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await cloudbuildClient.approveBuild(request); - const [response] = await operation.promise(); - console.log(response); - } - - callApproveBuild(); - // [END cloudbuild_v1_generated_CloudBuild_ApproveBuild_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js deleted file mode 100644 index db4b5cc4a2b..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.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(projectId, id) { - // [START cloudbuild_v1_generated_CloudBuild_CancelBuild_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the `Build` to cancel. - * Format: `projects/{project}/locations/{location}/builds/{build}` - */ - // const name = 'abc123' - /** - * Required. ID of the project. - */ - // const projectId = 'abc123' - /** - * Required. ID of the build. - */ - // const id = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callCancelBuild() { - // Construct request - const request = { - projectId, - id, - }; - - // Run request - const response = await cloudbuildClient.cancelBuild(request); - console.log(response); - } - - callCancelBuild(); - // [END cloudbuild_v1_generated_CloudBuild_CancelBuild_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js deleted file mode 100644 index 4b5eaf08a32..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.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(projectId, build) { - // [START cloudbuild_v1_generated_CloudBuild_CreateBuild_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 resource where this build will be created. - * Format: `projects/{project}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Required. ID of the project. - */ - // const projectId = 'abc123' - /** - * Required. Build resource to create. - */ - // const build = {} - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callCreateBuild() { - // Construct request - const request = { - projectId, - build, - }; - - // Run request - const [operation] = await cloudbuildClient.createBuild(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBuild(); - // [END cloudbuild_v1_generated_CloudBuild_CreateBuild_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js deleted file mode 100644 index 4ecc084fa67..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.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(projectId, trigger) { - // [START cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 resource where this trigger will be created. - * Format: `projects/{project}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Required. ID of the project for which to configure automatic builds. - */ - // const projectId = 'abc123' - /** - * Required. `BuildTrigger` to create. - */ - // const trigger = {} - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callCreateBuildTrigger() { - // Construct request - const request = { - projectId, - trigger, - }; - - // Run request - const response = await cloudbuildClient.createBuildTrigger(request); - console.log(response); - } - - callCreateBuildTrigger(); - // [END cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js deleted file mode 100644 index d06ff8cb64c..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.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, workerPool, workerPoolId) { - // [START cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 where this worker pool will be created. - * Format: `projects/{project}/locations/{location}`. - */ - // const parent = 'abc123' - /** - * Required. `WorkerPool` resource to create. - */ - // const workerPool = {} - /** - * Required. Immutable. The ID to use for the `WorkerPool`, which will become - * the final component of the resource name. - * This value should be 1-63 characters, and valid characters - * are /[a-z][0-9]-/. - */ - // const workerPoolId = 'abc123' - /** - * If set, validate the request and preview the response, but do not actually - * post it. - */ - // const validateOnly = true - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callCreateWorkerPool() { - // Construct request - const request = { - parent, - workerPool, - workerPoolId, - }; - - // Run request - const [operation] = await cloudbuildClient.createWorkerPool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateWorkerPool(); - // [END cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js deleted file mode 100644 index 716af8a093d..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.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(projectId, triggerId) { - // [START cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the `Trigger` to delete. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - */ - // const name = 'abc123' - /** - * Required. ID of the project that owns the trigger. - */ - // const projectId = 'abc123' - /** - * Required. ID of the `BuildTrigger` to delete. - */ - // const triggerId = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callDeleteBuildTrigger() { - // Construct request - const request = { - projectId, - triggerId, - }; - - // Run request - const response = await cloudbuildClient.deleteBuildTrigger(request); - console.log(response); - } - - callDeleteBuildTrigger(); - // [END cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js deleted file mode 100644 index 9475c1af929..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_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(name) { - // [START cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 `WorkerPool` to delete. - * Format: - * `projects/{project}/locations/{location}/workerPools/{workerPool}`. - */ - // const name = 'abc123' - /** - * Optional. If provided, it must match the server's etag on the workerpool - * for the request to be processed. - */ - // const etag = 'abc123' - /** - * If set to true, and the `WorkerPool` is not found, the request will succeed - * but no action will be taken on the server. - */ - // const allowMissing = true - /** - * If set, validate the request and preview the response, but do not actually - * post it. - */ - // const validateOnly = true - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callDeleteWorkerPool() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await cloudbuildClient.deleteWorkerPool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteWorkerPool(); - // [END cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js deleted file mode 100644 index 4a51363d4b5..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.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(projectId, id) { - // [START cloudbuild_v1_generated_CloudBuild_GetBuild_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the `Build` to retrieve. - * Format: `projects/{project}/locations/{location}/builds/{build}` - */ - // const name = 'abc123' - /** - * Required. ID of the project. - */ - // const projectId = 'abc123' - /** - * Required. ID of the build. - */ - // const id = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callGetBuild() { - // Construct request - const request = { - projectId, - id, - }; - - // Run request - const response = await cloudbuildClient.getBuild(request); - console.log(response); - } - - callGetBuild(); - // [END cloudbuild_v1_generated_CloudBuild_GetBuild_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js deleted file mode 100644 index 6a2d62f21b6..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.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(projectId, triggerId) { - // [START cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the `Trigger` to retrieve. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - */ - // const name = 'abc123' - /** - * Required. ID of the project that owns the trigger. - */ - // const projectId = 'abc123' - /** - * Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. - */ - // const triggerId = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callGetBuildTrigger() { - // Construct request - const request = { - projectId, - triggerId, - }; - - // Run request - const response = await cloudbuildClient.getBuildTrigger(request); - console.log(response); - } - - callGetBuildTrigger(); - // [END cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js deleted file mode 100644 index 03a02cb42b7..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.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 cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 `WorkerPool` to retrieve. - * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - */ - // const name = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callGetWorkerPool() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await cloudbuildClient.getWorkerPool(request); - console.log(response); - } - - callGetWorkerPool(); - // [END cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js deleted file mode 100644 index 973a4f720fd..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.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(projectId) { - // [START cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 of the collection of `Triggers`. - * Format: `projects/{project}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Required. ID of the project for which to list BuildTriggers. - */ - // const projectId = 'abc123' - /** - * Number of results to return in the list. - */ - // const pageSize = 1234 - /** - * Token to provide to skip to a particular spot in the list. - */ - // const pageToken = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callListBuildTriggers() { - // Construct request - const request = { - projectId, - }; - - // Run request - const iterable = await cloudbuildClient.listBuildTriggersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBuildTriggers(); - // [END cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js deleted file mode 100644 index a19245f4d07..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.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(projectId) { - // [START cloudbuild_v1_generated_CloudBuild_ListBuilds_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 of the collection of `Builds`. - * Format: `projects/{project}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Required. ID of the project. - */ - // const projectId = 'abc123' - /** - * Number of results to return in the list. - */ - // const pageSize = 1234 - /** - * The page token for the next page of Builds. - * If unspecified, the first page of results is returned. - * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. - * In this case, the token should be discarded, and pagination should be - * restarted from the first page of results. - * See https://google.aip.dev/158 for more. - */ - // const pageToken = 'abc123' - /** - * The raw filter text to constrain the results. - */ - // const filter = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callListBuilds() { - // Construct request - const request = { - projectId, - }; - - // Run request - const iterable = await cloudbuildClient.listBuildsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBuilds(); - // [END cloudbuild_v1_generated_CloudBuild_ListBuilds_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js deleted file mode 100644 index 51cbd24e9fb..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.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) { - // [START cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 of the collection of `WorkerPools`. - * Format: `projects/{project}/locations/{location}`. - */ - // const parent = 'abc123' - /** - * The maximum number of `WorkerPool`s to return. The service may return - * fewer than this value. If omitted, the server will use a sensible default. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListWorkerPools` call. Provide this - * to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callListWorkerPools() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await cloudbuildClient.listWorkerPoolsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListWorkerPools(); - // [END cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js deleted file mode 100644 index 11ca471ed4e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.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 cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the `ReceiveTriggerWebhook` to retrieve. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - */ - // const name = 'abc123' - /** - * HTTP request body. - */ - // const body = {} - /** - * Project in which the specified trigger lives - */ - // const projectId = 'abc123' - /** - * Name of the trigger to run the payload against - */ - // const trigger = 'abc123' - /** - * Secret token used for authorization if an OAuth token isn't provided. - */ - // const secret = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callReceiveTriggerWebhook() { - // Construct request - const request = { - }; - - // Run request - const response = await cloudbuildClient.receiveTriggerWebhook(request); - console.log(response); - } - - callReceiveTriggerWebhook(); - // [END cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js deleted file mode 100644 index 7a3341c3944..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.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(projectId, id) { - // [START cloudbuild_v1_generated_CloudBuild_RetryBuild_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the `Build` to retry. - * Format: `projects/{project}/locations/{location}/builds/{build}` - */ - // const name = 'abc123' - /** - * Required. ID of the project. - */ - // const projectId = 'abc123' - /** - * Required. Build ID of the original build. - */ - // const id = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callRetryBuild() { - // Construct request - const request = { - projectId, - id, - }; - - // Run request - const [operation] = await cloudbuildClient.retryBuild(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRetryBuild(); - // [END cloudbuild_v1_generated_CloudBuild_RetryBuild_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js deleted file mode 100644 index 5ea555bab67..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.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(projectId, triggerId) { - // [START cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the `Trigger` to run. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - */ - // const name = 'abc123' - /** - * Required. ID of the project. - */ - // const projectId = 'abc123' - /** - * Required. ID of the trigger. - */ - // const triggerId = 'abc123' - /** - * Source to build against this trigger. - * Branch and tag names cannot consist of regular expressions. - */ - // const source = {} - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callRunBuildTrigger() { - // Construct request - const request = { - projectId, - triggerId, - }; - - // Run request - const [operation] = await cloudbuildClient.runBuildTrigger(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunBuildTrigger(); - // [END cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js deleted file mode 100644 index b770dfe60e3..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.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(projectId, triggerId, trigger) { - // [START cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. ID of the project that owns the trigger. - */ - // const projectId = 'abc123' - /** - * Required. ID of the `BuildTrigger` to update. - */ - // const triggerId = 'abc123' - /** - * Required. `BuildTrigger` to update. - */ - // const trigger = {} - /** - * Update mask for the resource. If this is set, - * the server will only update the fields specified in the field mask. - * Otherwise, a full update of the mutable resource fields will be performed. - */ - // const updateMask = {} - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callUpdateBuildTrigger() { - // Construct request - const request = { - projectId, - triggerId, - trigger, - }; - - // Run request - const response = await cloudbuildClient.updateBuildTrigger(request); - console.log(response); - } - - callUpdateBuildTrigger(); - // [END cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js deleted file mode 100644 index 5a07273017c..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.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(workerPool) { - // [START cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The `WorkerPool` to update. - * The `name` field is used to identify the `WorkerPool` to update. - * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - */ - // const workerPool = {} - /** - * A mask specifying which fields in `worker_pool` to update. - */ - // const updateMask = {} - /** - * If set, validate the request and preview the response, but do not actually - * post it. - */ - // const validateOnly = true - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callUpdateWorkerPool() { - // Construct request - const request = { - workerPool, - }; - - // Run request - const [operation] = await cloudbuildClient.updateWorkerPool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateWorkerPool(); - // [END cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata_google.devtools.cloudbuild.v1.json b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata_google.devtools.cloudbuild.v1.json deleted file mode 100644 index 294630fc3f9..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata_google.devtools.cloudbuild.v1.json +++ /dev/null @@ -1,903 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-cloudbuild", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.devtools.cloudbuild.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateBuild_async", - "title": "CloudBuild createBuild Sample", - "origin": "API_DEFINITION", - "description": " Starts a build with the specified configuration. This method returns a long-running `Operation`, which includes the build ID. Pass the build ID to `GetBuild` to determine the build status (such as `SUCCESS` or `FAILURE`).", - "canonical": true, - "file": "cloud_build.create_build.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuild", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "build", - "type": ".google.devtools.cloudbuild.v1.Build" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "CreateBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuild", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_GetBuild_async", - "title": "CloudBuild getBuild Sample", - "origin": "API_DEFINITION", - "description": " Returns information about a previously requested build. The `Build` that is returned includes its status (such as `SUCCESS`, `FAILURE`, or `WORKING`), and timing information.", - "canonical": true, - "file": "cloud_build.get_build.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuild", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.Build", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "GetBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuild", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_ListBuilds_async", - "title": "CloudBuild listBuilds Sample", - "origin": "API_DEFINITION", - "description": " Lists previously requested builds. Previously requested builds may still be in-progress, or may have finished successfully or unsuccessfully.", - "canonical": true, - "file": "cloud_build.list_builds.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBuilds", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuilds", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.ListBuildsResponse", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "ListBuilds", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuilds", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_CancelBuild_async", - "title": "CloudBuild cancelBuild Sample", - "origin": "API_DEFINITION", - "description": " Cancels a build in progress.", - "canonical": true, - "file": "cloud_build.cancel_build.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CancelBuild", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.Build", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "CancelBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CancelBuild", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_RetryBuild_async", - "title": "CloudBuild retryBuild Sample", - "origin": "API_DEFINITION", - "description": " Creates a new build based on the specified build. This method creates a new build using the original build request, which may or may not result in an identical build. For triggered builds: * Triggered builds resolve to a precise revision; therefore a retry of a triggered build will result in a build that uses the same revision. For non-triggered builds that specify `RepoSource`: * If the original build built from the tip of a branch, the retried build will build from the tip of that branch, which may not be the same revision as the original build. * If the original build specified a commit sha or revision ID, the retried build will use the identical source. For builds that specify `StorageSource`: * If the original build pulled source from Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source. * If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.", - "canonical": true, - "file": "cloud_build.retry_build.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RetryBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RetryBuild", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "RetryBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RetryBuild", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_ApproveBuild_async", - "title": "CloudBuild approveBuild Sample", - "origin": "API_DEFINITION", - "description": " Approves or rejects a pending build. If approved, the returned LRO will be analogous to the LRO returned from a CreateBuild call. If rejected, the returned LRO will be immediately done.", - "canonical": true, - "file": "cloud_build.approve_build.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ApproveBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ApproveBuild", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "approval_result", - "type": ".google.devtools.cloudbuild.v1.ApprovalResult" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "ApproveBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ApproveBuild", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async", - "title": "CloudBuild createBuildTrigger Sample", - "origin": "API_DEFINITION", - "description": " Creates a new `BuildTrigger`. This API is experimental.", - "canonical": true, - "file": "cloud_build.create_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuildTrigger", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger", - "type": ".google.devtools.cloudbuild.v1.BuildTrigger" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "CreateBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuildTrigger", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async", - "title": "CloudBuild getBuildTrigger Sample", - "origin": "API_DEFINITION", - "description": " Returns information about a `BuildTrigger`. This API is experimental.", - "canonical": true, - "file": "cloud_build.get_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuildTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "GetBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuildTrigger", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async", - "title": "CloudBuild listBuildTriggers Sample", - "origin": "API_DEFINITION", - "description": " Lists existing `BuildTrigger`s. This API is experimental.", - "canonical": true, - "file": "cloud_build.list_build_triggers.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBuildTriggers", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuildTriggers", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.ListBuildTriggersResponse", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "ListBuildTriggers", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuildTriggers", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async", - "title": "CloudBuild deleteBuildTrigger Sample", - "origin": "API_DEFINITION", - "description": " Deletes a `BuildTrigger` by its project ID and trigger ID. This API is experimental.", - "canonical": true, - "file": "cloud_build.delete_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteBuildTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "DeleteBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteBuildTrigger", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async", - "title": "CloudBuild updateBuildTrigger Sample", - "origin": "API_DEFINITION", - "description": " Updates a `BuildTrigger` by its project ID and trigger ID. This API is experimental.", - "canonical": true, - "file": "cloud_build.update_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateBuildTrigger", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger", - "type": ".google.devtools.cloudbuild.v1.BuildTrigger" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "UpdateBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateBuildTrigger", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async", - "title": "CloudBuild runBuildTrigger Sample", - "origin": "API_DEFINITION", - "description": " Runs a `BuildTrigger` at a particular source revision. To run a regional or global trigger, use the POST request that includes the location endpoint in the path (ex. v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The POST request that does not include the location endpoint in the path can only be used when running global triggers.", - "canonical": true, - "file": "cloud_build.run_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RunBuildTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger_id", - "type": "TYPE_STRING" - }, - { - "name": "source", - "type": ".google.devtools.cloudbuild.v1.RepoSource" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "RunBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RunBuildTrigger", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async", - "title": "CloudBuild receiveTriggerWebhook Sample", - "origin": "API_DEFINITION", - "description": " ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted at a specific trigger.", - "canonical": true, - "file": "cloud_build.receive_trigger_webhook.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReceiveTriggerWebhook", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ReceiveTriggerWebhook", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.api.HttpBody" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger", - "type": "TYPE_STRING" - }, - { - "name": "secret", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "ReceiveTriggerWebhook", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ReceiveTriggerWebhook", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async", - "title": "CloudBuild createWorkerPool Sample", - "origin": "API_DEFINITION", - "description": " Creates a `WorkerPool`.", - "canonical": true, - "file": "cloud_build.create_worker_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateWorkerPool", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "worker_pool", - "type": ".google.devtools.cloudbuild.v1.WorkerPool" - }, - { - "name": "worker_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "CreateWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateWorkerPool", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async", - "title": "CloudBuild getWorkerPool Sample", - "origin": "API_DEFINITION", - "description": " Returns details of a `WorkerPool`.", - "canonical": true, - "file": "cloud_build.get_worker_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetWorkerPool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.WorkerPool", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "GetWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetWorkerPool", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async", - "title": "CloudBuild deleteWorkerPool Sample", - "origin": "API_DEFINITION", - "description": " Deletes a `WorkerPool`.", - "canonical": true, - "file": "cloud_build.delete_worker_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteWorkerPool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "DeleteWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteWorkerPool", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async", - "title": "CloudBuild updateWorkerPool Sample", - "origin": "API_DEFINITION", - "description": " Updates a `WorkerPool`.", - "canonical": true, - "file": "cloud_build.update_worker_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateWorkerPool", - "async": true, - "parameters": [ - { - "name": "worker_pool", - "type": ".google.devtools.cloudbuild.v1.WorkerPool" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "UpdateWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateWorkerPool", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async", - "title": "CloudBuild listWorkerPools Sample", - "origin": "API_DEFINITION", - "description": " Lists `WorkerPool`s.", - "canonical": true, - "file": "cloud_build.list_worker_pools.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkerPools", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListWorkerPools", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.ListWorkerPoolsResponse", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "ListWorkerPools", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListWorkerPools", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts deleted file mode 100644 index 68941b8a880..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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 CloudBuildClient = v1.CloudBuildClient; -type CloudBuildClient = v1.CloudBuildClient; -export {v1, CloudBuildClient}; -export default {v1, CloudBuildClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts deleted file mode 100644 index 017c843e596..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts +++ /dev/null @@ -1,3300 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/cloud_build_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cloud_build_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Creates and manages builds on Google Cloud Platform. - * - * The main concept used by this API is a `Build`, which describes the location - * of the source to build, how to build the source, and where to store the - * built artifacts, if any. - * - * A user can list previously-requested builds or get builds by their ID to - * determine the status of the build. - * @class - * @memberof v1 - */ -export class CloudBuildClient { - 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; - cloudBuildStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudBuildClient. - * - * @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 CloudBuildClient({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 CloudBuildClient; - 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/{keyring}/cryptoKeys/{key}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectBuildPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/builds/{build}' - ), - projectConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/githubEnterpriseConfigs/{config}' - ), - projectLocationBuildPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/builds/{build}' - ), - projectLocationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}' - ), - projectLocationTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/triggers/{trigger}' - ), - projectTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/triggers/{trigger}' - ), - repositoryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}' - ), - secretVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/secrets/{secret}/versions/{version}' - ), - serviceAccountPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/serviceAccounts/{service_account}' - ), - subscriptionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/subscriptions/{subscription}' - ), - topicPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/topics/{topic}' - ), - 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 = { - listBuilds: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'builds'), - listBuildTriggers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'triggers'), - listWorkerPools: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workerPools') - }; - - 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=operations/**}:cancel',body: '*',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=operations/**}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createBuildResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; - const createBuildMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; - const retryBuildResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; - const retryBuildMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; - const approveBuildResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; - const approveBuildMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; - const runBuildTriggerResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; - const runBuildTriggerMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; - const createWorkerPoolResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.WorkerPool') as gax.protobuf.Type; - const createWorkerPoolMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata') as gax.protobuf.Type; - const deleteWorkerPoolResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteWorkerPoolMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata') as gax.protobuf.Type; - const updateWorkerPoolResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.WorkerPool') as gax.protobuf.Type; - const updateWorkerPoolMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createBuild: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBuildResponse.decode.bind(createBuildResponse), - createBuildMetadata.decode.bind(createBuildMetadata)), - retryBuild: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - retryBuildResponse.decode.bind(retryBuildResponse), - retryBuildMetadata.decode.bind(retryBuildMetadata)), - approveBuild: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - approveBuildResponse.decode.bind(approveBuildResponse), - approveBuildMetadata.decode.bind(approveBuildMetadata)), - runBuildTrigger: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runBuildTriggerResponse.decode.bind(runBuildTriggerResponse), - runBuildTriggerMetadata.decode.bind(runBuildTriggerMetadata)), - createWorkerPool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createWorkerPoolResponse.decode.bind(createWorkerPoolResponse), - createWorkerPoolMetadata.decode.bind(createWorkerPoolMetadata)), - deleteWorkerPool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteWorkerPoolResponse.decode.bind(deleteWorkerPoolResponse), - deleteWorkerPoolMetadata.decode.bind(deleteWorkerPoolMetadata)), - updateWorkerPool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateWorkerPoolResponse.decode.bind(updateWorkerPoolResponse), - updateWorkerPoolMetadata.decode.bind(updateWorkerPoolMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.devtools.cloudbuild.v1.CloudBuild', 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.cloudBuildStub) { - return this.cloudBuildStub; - } - - // Put together the "service stub" for - // google.devtools.cloudbuild.v1.CloudBuild. - this.cloudBuildStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devtools.cloudbuild.v1.CloudBuild') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devtools.cloudbuild.v1.CloudBuild, - 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 cloudBuildStubMethods = - ['createBuild', 'getBuild', 'listBuilds', 'cancelBuild', 'retryBuild', 'approveBuild', 'createBuildTrigger', 'getBuildTrigger', 'listBuildTriggers', 'deleteBuildTrigger', 'updateBuildTrigger', 'runBuildTrigger', 'receiveTriggerWebhook', 'createWorkerPool', 'getWorkerPool', 'deleteWorkerPool', 'updateWorkerPool', 'listWorkerPools']; - for (const methodName of cloudBuildStubMethods) { - const callPromise = this.cloudBuildStub.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.cloudBuildStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudbuild.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 'cloudbuild.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 information about a previously requested build. - * - * The `Build` that is returned includes its status (such as `SUCCESS`, - * `FAILURE`, or `WORKING`), and timing information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Build` to retrieve. - * Format: `projects/{project}/locations/{location}/builds/{build}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {string} request.id - * Required. ID of the build. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v1.Build|Build}. - * Please see the {@link 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_build.get_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_GetBuild_async - */ - getBuild( - request?: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|undefined, {}|undefined - ]>; - getBuild( - request: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, - {}|null|undefined>): void; - getBuild( - request: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, - {}|null|undefined>): void; - getBuild( - request?: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.getBuild(request, options, callback); - } -/** - * Cancels a build in progress. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Build` to cancel. - * Format: `projects/{project}/locations/{location}/builds/{build}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {string} request.id - * Required. ID of the build. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v1.Build|Build}. - * Please see the {@link 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_build.cancel_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CancelBuild_async - */ - cancelBuild( - request?: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|undefined, {}|undefined - ]>; - cancelBuild( - request: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, - {}|null|undefined>): void; - cancelBuild( - request: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, - {}|null|undefined>): void; - cancelBuild( - request?: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.cancelBuild(request, options, callback); - } -/** - * Creates a new `BuildTrigger`. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource where this trigger will be created. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project for which to configure automatic builds. - * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger - * Required. `BuildTrigger` 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 {@link protos.google.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger}. - * Please see the {@link 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_build.create_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async - */ - createBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|undefined, {}|undefined - ]>; - createBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - createBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - createBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.createBuildTrigger(request, options, callback); - } -/** - * Returns information about a `BuildTrigger`. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Trigger` to retrieve. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {string} request.projectId - * Required. ID of the project that owns the trigger. - * @param {string} request.triggerId - * Required. Identifier (`id` or `name`) of the `BuildTrigger` 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.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger}. - * Please see the {@link 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_build.get_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async - */ - getBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|undefined, {}|undefined - ]>; - getBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - getBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - getBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.getBuildTrigger(request, options, callback); - } -/** - * Deletes a `BuildTrigger` by its project ID and trigger ID. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Trigger` to delete. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {string} request.projectId - * Required. ID of the project that owns the trigger. - * @param {string} request.triggerId - * Required. ID of the `BuildTrigger` to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/cloud_build.delete_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async - */ - deleteBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|undefined, {}|undefined - ]>; - deleteBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - deleteBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - deleteBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.deleteBuildTrigger(request, options, callback); - } -/** - * Updates a `BuildTrigger` by its project ID and trigger ID. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. ID of the project that owns the trigger. - * @param {string} request.triggerId - * Required. ID of the `BuildTrigger` to update. - * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger - * Required. `BuildTrigger` to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Update mask for the resource. If this is set, - * the server will only update the fields specified in the field mask. - * Otherwise, a full update of the mutable resource fields will be performed. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger}. - * Please see the {@link 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_build.update_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async - */ - updateBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|undefined, {}|undefined - ]>; - updateBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - updateBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - updateBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.trigger?.resourceName; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.updateBuildTrigger(request, options, callback); - } -/** - * ReceiveTriggerWebhook [Experimental] is called when the API receives a - * webhook request targeted at a specific trigger. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `ReceiveTriggerWebhook` to retrieve. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {google.api.HttpBody} request.body - * HTTP request body. - * @param {string} request.projectId - * Project in which the specified trigger lives - * @param {string} request.trigger - * Name of the trigger to run the payload against - * @param {string} request.secret - * Secret token used for authorization if an OAuth token isn't provided. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse|ReceiveTriggerWebhookResponse}. - * Please see the {@link 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_build.receive_trigger_webhook.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async - */ - receiveTriggerWebhook( - request?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|undefined, {}|undefined - ]>; - receiveTriggerWebhook( - request: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, - {}|null|undefined>): void; - receiveTriggerWebhook( - request: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, - {}|null|undefined>): void; - receiveTriggerWebhook( - request?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_id': request.projectId ?? '', - 'trigger': request.trigger ?? '', - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.receiveTriggerWebhook(request, options, callback); - } -/** - * Returns details of a `WorkerPool`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the `WorkerPool` to retrieve. - * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v1.WorkerPool|WorkerPool}. - * Please see the {@link 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_build.get_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async - */ - getWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|undefined, {}|undefined - ]>; - getWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, - {}|null|undefined>): void; - getWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, - {}|null|undefined>): void; - getWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.getWorkerPool(request, options, callback); - } - -/** - * Starts a build with the specified configuration. - * - * This method returns a long-running `Operation`, which includes the build - * ID. Pass the build ID to `GetBuild` to determine the build status (such as - * `SUCCESS` or `FAILURE`). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource where this build will be created. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {google.devtools.cloudbuild.v1.Build} request.build - * Required. Build resource 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/v1/cloud_build.create_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async - */ - createBuild( - request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBuild( - request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBuild( - request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBuild( - request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.createBuild(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBuild()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://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_build.create_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async - */ - async checkCreateBuildProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBuild, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new build based on the specified build. - * - * This method creates a new build using the original build request, which may - * or may not result in an identical build. - * - * For triggered builds: - * - * * Triggered builds resolve to a precise revision; therefore a retry of a - * triggered build will result in a build that uses the same revision. - * - * For non-triggered builds that specify `RepoSource`: - * - * * If the original build built from the tip of a branch, the retried build - * will build from the tip of that branch, which may not be the same revision - * as the original build. - * * If the original build specified a commit sha or revision ID, the retried - * build will use the identical source. - * - * For builds that specify `StorageSource`: - * - * * If the original build pulled source from Cloud Storage without - * specifying the generation of the object, the new build will use the current - * object, which may be different from the original build source. - * * If the original build pulled source from Cloud Storage and specified the - * generation of the object, the new build will attempt to use the same - * object, which may or may not be available depending on the bucket's - * lifecycle management settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Build` to retry. - * Format: `projects/{project}/locations/{location}/builds/{build}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {string} request.id - * Required. Build ID of the original build. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://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_build.retry_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async - */ - retryBuild( - request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - retryBuild( - request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - retryBuild( - request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - retryBuild( - request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.retryBuild(request, options, callback); - } -/** - * Check the status of the long running operation returned by `retryBuild()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://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_build.retry_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async - */ - async checkRetryBuildProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.retryBuild, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Approves or rejects a pending build. - * - * If approved, the returned LRO will be analogous to the LRO returned from - * a CreateBuild call. - * - * If rejected, the returned LRO will be immediately done. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the target build. - * For example: "projects/{$project_id}/builds/{$build_id}" - * @param {google.devtools.cloudbuild.v1.ApprovalResult} request.approvalResult - * Approval decision 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://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_build.approve_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ApproveBuild_async - */ - approveBuild( - request?: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - approveBuild( - request: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - approveBuild( - request: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - approveBuild( - request?: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.approveBuild(request, options, callback); - } -/** - * Check the status of the long running operation returned by `approveBuild()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://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_build.approve_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ApproveBuild_async - */ - async checkApproveBuildProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.approveBuild, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Runs a `BuildTrigger` at a particular source revision. - * - * To run a regional or global trigger, use the POST request - * that includes the location endpoint in the path (ex. - * v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The - * POST request that does not include the location endpoint in the path can - * only be used when running global triggers. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Trigger` to run. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {string} request.triggerId - * Required. ID of the trigger. - * @param {google.devtools.cloudbuild.v1.RepoSource} request.source - * Source to build against this trigger. - * Branch and tag names cannot consist of regular expressions. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://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_build.run_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async - */ - runBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.runBuildTrigger(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runBuildTrigger()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://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_build.run_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async - */ - async checkRunBuildTriggerProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runBuildTrigger, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a `WorkerPool`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this worker pool will be created. - * Format: `projects/{project}/locations/{location}`. - * @param {google.devtools.cloudbuild.v1.WorkerPool} request.workerPool - * Required. `WorkerPool` resource to create. - * @param {string} request.workerPoolId - * Required. Immutable. The ID to use for the `WorkerPool`, which will become - * the final component of the resource name. - * - * This value should be 1-63 characters, and valid characters - * are /{@link protos.0-9|a-z}-/. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the response, but do not actually - * post it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://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_build.create_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async - */ - createWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createWorkerPool( - request: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkerPool( - request: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.createWorkerPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createWorkerPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://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_build.create_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async - */ - async checkCreateWorkerPoolProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkerPool, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a `WorkerPool`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the `WorkerPool` to delete. - * Format: - * `projects/{project}/locations/{location}/workerPools/{workerPool}`. - * @param {string} [request.etag] - * Optional. If provided, it must match the server's etag on the workerpool - * for the request to be processed. - * @param {boolean} request.allowMissing - * If set to true, and the `WorkerPool` is not found, the request will succeed - * but no action will be taken on the server. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the response, but do not actually - * post it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://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_build.delete_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async - */ - deleteWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.deleteWorkerPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteWorkerPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://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_build.delete_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async - */ - async checkDeleteWorkerPoolProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkerPool, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a `WorkerPool`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.cloudbuild.v1.WorkerPool} request.workerPool - * Required. The `WorkerPool` to update. - * - * The `name` field is used to identify the `WorkerPool` to update. - * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - * @param {google.protobuf.FieldMask} request.updateMask - * A mask specifying which fields in `worker_pool` to update. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the response, but do not actually - * post it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://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_build.update_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async - */ - updateWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.workerPool?.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.updateWorkerPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateWorkerPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://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_build.update_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async - */ - async checkUpdateWorkerPoolProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkerPool, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists previously requested builds. - * - * Previously requested builds may still be in-progress, or may have finished - * successfully or unsuccessfully. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent of the collection of `Builds`. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * The page token for the next page of Builds. - * - * If unspecified, the first page of results is returned. - * - * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. - * In this case, the token should be discarded, and pagination should be - * restarted from the first page of results. - * - * See https://google.aip.dev/158 for more. - * @param {string} request.filter - * The raw filter text to constrain 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.devtools.cloudbuild.v1.Build|Build}. - * 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 `listBuildsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBuilds( - request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild[], - protos.google.devtools.cloudbuild.v1.IListBuildsRequest|null, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse - ]>; - listBuilds( - request: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuild>): void; - listBuilds( - request: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuild>): void; - listBuilds( - request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuild>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuild>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild[], - protos.google.devtools.cloudbuild.v1.IListBuildsRequest|null, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.listBuilds(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 of the collection of `Builds`. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * The page token for the next page of Builds. - * - * If unspecified, the first page of results is returned. - * - * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. - * In this case, the token should be discarded, and pagination should be - * restarted from the first page of results. - * - * See https://google.aip.dev/158 for more. - * @param {string} request.filter - * The raw filter text to constrain 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.devtools.cloudbuild.v1.Build|Build} 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 `listBuildsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBuildsStream( - request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - const defaultCallSettings = this._defaults['listBuilds']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuilds.createStream( - this.innerApiCalls.listBuilds as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBuilds`, 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 of the collection of `Builds`. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * The page token for the next page of Builds. - * - * If unspecified, the first page of results is returned. - * - * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. - * In this case, the token should be discarded, and pagination should be - * restarted from the first page of results. - * - * See https://google.aip.dev/158 for more. - * @param {string} request.filter - * The raw filter text to constrain 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.devtools.cloudbuild.v1.Build|Build}. 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_build.list_builds.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ListBuilds_async - */ - listBuildsAsync( - request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - const defaultCallSettings = this._defaults['listBuilds']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuilds.asyncIterate( - this.innerApiCalls['listBuilds'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists existing `BuildTrigger`s. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent of the collection of `Triggers`. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project for which to list BuildTriggers. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger}. - * 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 `listBuildTriggersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBuildTriggers( - request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger[], - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest|null, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse - ]>; - listBuildTriggers( - request: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuildTrigger>): void; - listBuildTriggers( - request: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuildTrigger>): void; - listBuildTriggers( - request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuildTrigger>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuildTrigger>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger[], - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest|null, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.listBuildTriggers(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 of the collection of `Triggers`. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project for which to list BuildTriggers. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger} 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 `listBuildTriggersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBuildTriggersStream( - request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - const defaultCallSettings = this._defaults['listBuildTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuildTriggers.createStream( - this.innerApiCalls.listBuildTriggers as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBuildTriggers`, 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 of the collection of `Triggers`. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project for which to list BuildTriggers. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.devtools.cloudbuild.v1.BuildTrigger|BuildTrigger}. 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_build.list_build_triggers.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async - */ - listBuildTriggersAsync( - request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - const defaultCallSettings = this._defaults['listBuildTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuildTriggers.asyncIterate( - this.innerApiCalls['listBuildTriggers'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists `WorkerPool`s. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent of the collection of `WorkerPools`. - * Format: `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * The maximum number of `WorkerPool`s to return. The service may return - * fewer than this value. If omitted, the server will use a sensible default. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkerPools` call. Provide this - * to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.cloudbuild.v1.WorkerPool|WorkerPool}. - * 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 `listWorkerPoolsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkerPools( - request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IWorkerPool[], - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest|null, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse - ]>; - listWorkerPools( - request: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IWorkerPool>): void; - listWorkerPools( - request: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IWorkerPool>): void; - listWorkerPools( - request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IWorkerPool>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IWorkerPool>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IWorkerPool[], - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest|null, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.listWorkerPools(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 of the collection of `WorkerPools`. - * Format: `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * The maximum number of `WorkerPool`s to return. The service may return - * fewer than this value. If omitted, the server will use a sensible default. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkerPools` call. Provide this - * to retrieve the subsequent page. - * @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.devtools.cloudbuild.v1.WorkerPool|WorkerPool} 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 `listWorkerPoolsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkerPoolsStream( - request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - const defaultCallSettings = this._defaults['listWorkerPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkerPools.createStream( - this.innerApiCalls.listWorkerPools as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listWorkerPools`, 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 of the collection of `WorkerPools`. - * Format: `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * The maximum number of `WorkerPool`s to return. The service may return - * fewer than this value. If omitted, the server will use a sensible default. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkerPools` call. Provide this - * to retrieve the subsequent page. - * @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.devtools.cloudbuild.v1.WorkerPool|WorkerPool}. 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_build.list_worker_pools.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async - */ - listWorkerPoolsAsync( - request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - const defaultCallSettings = this._defaults['listWorkerPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkerPools.asyncIterate( - this.innerApiCalls['listWorkerPools'] 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} keyring - * @param {string} key - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyring:string,key:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - keyring: keyring, - key: key, - }); - } - - /** - * 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 keyring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the keyring. - */ - matchKeyringFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).keyring; - } - - /** - * Parse the key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key. - */ - matchKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).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 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 projectBuild resource name string. - * - * @param {string} project - * @param {string} build - * @returns {string} Resource name string. - */ - projectBuildPath(project:string,build:string) { - return this.pathTemplates.projectBuildPathTemplate.render({ - project: project, - build: build, - }); - } - - /** - * Parse the project from ProjectBuild resource. - * - * @param {string} projectBuildName - * A fully-qualified path representing project_build resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectBuildName(projectBuildName: string) { - return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).project; - } - - /** - * Parse the build from ProjectBuild resource. - * - * @param {string} projectBuildName - * A fully-qualified path representing project_build resource. - * @returns {string} A string representing the build. - */ - matchBuildFromProjectBuildName(projectBuildName: string) { - return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).build; - } - - /** - * Return a fully-qualified projectConfig resource name string. - * - * @param {string} project - * @param {string} config - * @returns {string} Resource name string. - */ - projectConfigPath(project:string,config:string) { - return this.pathTemplates.projectConfigPathTemplate.render({ - project: project, - config: config, - }); - } - - /** - * Parse the project from ProjectConfig resource. - * - * @param {string} projectConfigName - * A fully-qualified path representing project_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConfigName(projectConfigName: string) { - return this.pathTemplates.projectConfigPathTemplate.match(projectConfigName).project; - } - - /** - * Parse the config from ProjectConfig resource. - * - * @param {string} projectConfigName - * A fully-qualified path representing project_config resource. - * @returns {string} A string representing the config. - */ - matchConfigFromProjectConfigName(projectConfigName: string) { - return this.pathTemplates.projectConfigPathTemplate.match(projectConfigName).config; - } - - /** - * Return a fully-qualified projectLocationBuild resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} build - * @returns {string} Resource name string. - */ - projectLocationBuildPath(project:string,location:string,build:string) { - return this.pathTemplates.projectLocationBuildPathTemplate.render({ - project: project, - location: location, - build: build, - }); - } - - /** - * Parse the project from ProjectLocationBuild resource. - * - * @param {string} projectLocationBuildName - * A fully-qualified path representing project_location_build resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBuildName(projectLocationBuildName: string) { - return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).project; - } - - /** - * Parse the location from ProjectLocationBuild resource. - * - * @param {string} projectLocationBuildName - * A fully-qualified path representing project_location_build resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBuildName(projectLocationBuildName: string) { - return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).location; - } - - /** - * Parse the build from ProjectLocationBuild resource. - * - * @param {string} projectLocationBuildName - * A fully-qualified path representing project_location_build resource. - * @returns {string} A string representing the build. - */ - matchBuildFromProjectLocationBuildName(projectLocationBuildName: string) { - return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).build; - } - - /** - * Return a fully-qualified projectLocationConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} config - * @returns {string} Resource name string. - */ - projectLocationConfigPath(project:string,location:string,config:string) { - return this.pathTemplates.projectLocationConfigPathTemplate.render({ - project: project, - location: location, - config: config, - }); - } - - /** - * Parse the project from ProjectLocationConfig resource. - * - * @param {string} projectLocationConfigName - * A fully-qualified path representing project_location_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConfigName(projectLocationConfigName: string) { - return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).project; - } - - /** - * Parse the location from ProjectLocationConfig resource. - * - * @param {string} projectLocationConfigName - * A fully-qualified path representing project_location_config resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConfigName(projectLocationConfigName: string) { - return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).location; - } - - /** - * Parse the config from ProjectLocationConfig resource. - * - * @param {string} projectLocationConfigName - * A fully-qualified path representing project_location_config resource. - * @returns {string} A string representing the config. - */ - matchConfigFromProjectLocationConfigName(projectLocationConfigName: string) { - return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).config; - } - - /** - * Return a fully-qualified projectLocationTrigger resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} trigger - * @returns {string} Resource name string. - */ - projectLocationTriggerPath(project:string,location:string,trigger:string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.render({ - project: project, - location: location, - trigger: trigger, - }); - } - - /** - * Parse the project from ProjectLocationTrigger resource. - * - * @param {string} projectLocationTriggerName - * A fully-qualified path representing project_location_trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationTriggerName(projectLocationTriggerName: string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).project; - } - - /** - * Parse the location from ProjectLocationTrigger resource. - * - * @param {string} projectLocationTriggerName - * A fully-qualified path representing project_location_trigger resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationTriggerName(projectLocationTriggerName: string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).location; - } - - /** - * Parse the trigger from ProjectLocationTrigger resource. - * - * @param {string} projectLocationTriggerName - * A fully-qualified path representing project_location_trigger resource. - * @returns {string} A string representing the trigger. - */ - matchTriggerFromProjectLocationTriggerName(projectLocationTriggerName: string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).trigger; - } - - /** - * Return a fully-qualified projectTrigger resource name string. - * - * @param {string} project - * @param {string} trigger - * @returns {string} Resource name string. - */ - projectTriggerPath(project:string,trigger:string) { - return this.pathTemplates.projectTriggerPathTemplate.render({ - project: project, - trigger: trigger, - }); - } - - /** - * Parse the project from ProjectTrigger resource. - * - * @param {string} projectTriggerName - * A fully-qualified path representing project_trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectTriggerName(projectTriggerName: string) { - return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).project; - } - - /** - * Parse the trigger from ProjectTrigger resource. - * - * @param {string} projectTriggerName - * A fully-qualified path representing project_trigger resource. - * @returns {string} A string representing the trigger. - */ - matchTriggerFromProjectTriggerName(projectTriggerName: string) { - return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).trigger; - } - - /** - * Return a fully-qualified repository resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} connection - * @param {string} repository - * @returns {string} Resource name string. - */ - repositoryPath(project:string,location:string,connection:string,repository:string) { - return this.pathTemplates.repositoryPathTemplate.render({ - project: project, - location: location, - connection: connection, - 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 connection from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the connection. - */ - matchConnectionFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).connection; - } - - /** - * 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 secretVersion resource name string. - * - * @param {string} project - * @param {string} secret - * @param {string} version - * @returns {string} Resource name string. - */ - secretVersionPath(project:string,secret:string,version:string) { - return this.pathTemplates.secretVersionPathTemplate.render({ - project: project, - secret: secret, - version: version, - }); - } - - /** - * Parse the project from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).project; - } - - /** - * Parse the secret from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the secret. - */ - matchSecretFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).secret; - } - - /** - * Parse the version from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the version. - */ - matchVersionFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).version; - } - - /** - * Return a fully-qualified serviceAccount resource name string. - * - * @param {string} project - * @param {string} service_account - * @returns {string} Resource name string. - */ - serviceAccountPath(project:string,serviceAccount:string) { - return this.pathTemplates.serviceAccountPathTemplate.render({ - project: project, - service_account: serviceAccount, - }); - } - - /** - * Parse the project from ServiceAccount resource. - * - * @param {string} serviceAccountName - * A fully-qualified path representing ServiceAccount resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceAccountName(serviceAccountName: string) { - return this.pathTemplates.serviceAccountPathTemplate.match(serviceAccountName).project; - } - - /** - * Parse the service_account from ServiceAccount resource. - * - * @param {string} serviceAccountName - * A fully-qualified path representing ServiceAccount resource. - * @returns {string} A string representing the service_account. - */ - matchServiceAccountFromServiceAccountName(serviceAccountName: string) { - return this.pathTemplates.serviceAccountPathTemplate.match(serviceAccountName).service_account; - } - - /** - * Return a fully-qualified subscription resource name string. - * - * @param {string} project - * @param {string} subscription - * @returns {string} Resource name string. - */ - subscriptionPath(project:string,subscription:string) { - return this.pathTemplates.subscriptionPathTemplate.render({ - project: project, - subscription: subscription, - }); - } - - /** - * Parse the project from Subscription resource. - * - * @param {string} subscriptionName - * A fully-qualified path representing Subscription resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSubscriptionName(subscriptionName: string) { - return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName).project; - } - - /** - * Parse the subscription from Subscription resource. - * - * @param {string} subscriptionName - * A fully-qualified path representing Subscription resource. - * @returns {string} A string representing the subscription. - */ - matchSubscriptionFromSubscriptionName(subscriptionName: string) { - return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName).subscription; - } - - /** - * 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 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.cloudBuildStub && !this._terminated) { - return this.cloudBuildStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json deleted file mode 100644 index c677cba6cb7..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "interfaces": { - "google.devtools.cloudbuild.v1.CloudBuild": { - "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": { - "CreateBuild": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBuild": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListBuilds": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CancelBuild": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RetryBuild": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ApproveBuild": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBuildTrigger": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBuildTrigger": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListBuildTriggers": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteBuildTrigger": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateBuildTrigger": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RunBuildTrigger": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReceiveTriggerWebhook": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateWorkerPool": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetWorkerPool": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteWorkerPool": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateWorkerPool": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListWorkerPools": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json deleted file mode 100644 index ef522572f3b..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/devtools/cloudbuild/v1/cloudbuild.proto" -] diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 33226421337..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.devtools.cloudbuild.v1", - "libraryPackage": "@google-cloud/cloudbuild", - "services": { - "CloudBuild": { - "clients": { - "grpc": { - "libraryClient": "CloudBuildClient", - "rpcs": { - "GetBuild": { - "methods": [ - "getBuild" - ] - }, - "CancelBuild": { - "methods": [ - "cancelBuild" - ] - }, - "CreateBuildTrigger": { - "methods": [ - "createBuildTrigger" - ] - }, - "GetBuildTrigger": { - "methods": [ - "getBuildTrigger" - ] - }, - "DeleteBuildTrigger": { - "methods": [ - "deleteBuildTrigger" - ] - }, - "UpdateBuildTrigger": { - "methods": [ - "updateBuildTrigger" - ] - }, - "ReceiveTriggerWebhook": { - "methods": [ - "receiveTriggerWebhook" - ] - }, - "GetWorkerPool": { - "methods": [ - "getWorkerPool" - ] - }, - "CreateBuild": { - "methods": [ - "createBuild" - ] - }, - "RetryBuild": { - "methods": [ - "retryBuild" - ] - }, - "ApproveBuild": { - "methods": [ - "approveBuild" - ] - }, - "RunBuildTrigger": { - "methods": [ - "runBuildTrigger" - ] - }, - "CreateWorkerPool": { - "methods": [ - "createWorkerPool" - ] - }, - "DeleteWorkerPool": { - "methods": [ - "deleteWorkerPool" - ] - }, - "UpdateWorkerPool": { - "methods": [ - "updateWorkerPool" - ] - }, - "ListBuilds": { - "methods": [ - "listBuilds", - "listBuildsStream", - "listBuildsAsync" - ] - }, - "ListBuildTriggers": { - "methods": [ - "listBuildTriggers", - "listBuildTriggersStream", - "listBuildTriggersAsync" - ] - }, - "ListWorkerPools": { - "methods": [ - "listWorkerPools", - "listWorkerPoolsStream", - "listWorkerPoolsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "CloudBuildClient", - "rpcs": { - "GetBuild": { - "methods": [ - "getBuild" - ] - }, - "CancelBuild": { - "methods": [ - "cancelBuild" - ] - }, - "CreateBuildTrigger": { - "methods": [ - "createBuildTrigger" - ] - }, - "GetBuildTrigger": { - "methods": [ - "getBuildTrigger" - ] - }, - "DeleteBuildTrigger": { - "methods": [ - "deleteBuildTrigger" - ] - }, - "UpdateBuildTrigger": { - "methods": [ - "updateBuildTrigger" - ] - }, - "ReceiveTriggerWebhook": { - "methods": [ - "receiveTriggerWebhook" - ] - }, - "GetWorkerPool": { - "methods": [ - "getWorkerPool" - ] - }, - "CreateBuild": { - "methods": [ - "createBuild" - ] - }, - "RetryBuild": { - "methods": [ - "retryBuild" - ] - }, - "ApproveBuild": { - "methods": [ - "approveBuild" - ] - }, - "RunBuildTrigger": { - "methods": [ - "runBuildTrigger" - ] - }, - "CreateWorkerPool": { - "methods": [ - "createWorkerPool" - ] - }, - "DeleteWorkerPool": { - "methods": [ - "deleteWorkerPool" - ] - }, - "UpdateWorkerPool": { - "methods": [ - "updateWorkerPool" - ] - }, - "ListBuilds": { - "methods": [ - "listBuilds", - "listBuildsStream", - "listBuildsAsync" - ] - }, - "ListBuildTriggers": { - "methods": [ - "listBuildTriggers", - "listBuildTriggersStream", - "listBuildTriggersAsync" - ] - }, - "ListWorkerPools": { - "methods": [ - "listWorkerPools", - "listWorkerPoolsStream", - "listWorkerPoolsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts deleted file mode 100644 index f01e5acb61b..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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 {CloudBuildClient} from './cloud_build_client'; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 21a069f2aec..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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 cloudbuild = require('@google-cloud/cloudbuild'); - -function main() { - const cloudBuildClient = new cloudbuild.CloudBuildClient(); -} - -main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 9d43cef7252..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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 {CloudBuildClient} from '@google-cloud/cloudbuild'; - -// check that the client class type name can be used -function doStuffWithCloudBuildClient(client: CloudBuildClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudBuildClient = new CloudBuildClient(); - doStuffWithCloudBuildClient(cloudBuildClient); -} - -main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts deleted file mode 100644 index e3376f4a516..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts +++ /dev/null @@ -1,3520 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 cloudbuildModule 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.CloudBuildClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = cloudbuildModule.v1.CloudBuildClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudbuildModule.v1.CloudBuildClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudbuildModule.v1.CloudBuildClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudbuildModule.v1.CloudBuildClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudBuildStub, undefined); - await client.initialize(); - assert(client.cloudBuildStub); - }); - - it('has close method for the initialized client', done => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.cloudBuildStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudBuildStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudbuildModule.v1.CloudBuildClient({ - 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 cloudbuildModule.v1.CloudBuildClient({ - 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('getBuild', () => { - it('invokes getBuild without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.Build() - ); - client.innerApiCalls.getBuild = stubSimpleCall(expectedResponse); - const [response] = await client.getBuild(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBuild without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.Build() - ); - client.innerApiCalls.getBuild = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBuild( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBuild with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.getBuild = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBuild(request), expectedError); - const actualRequest = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBuild with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBuild(request), expectedError); - }); - }); - - describe('cancelBuild', () => { - it('invokes cancelBuild without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.Build() - ); - client.innerApiCalls.cancelBuild = stubSimpleCall(expectedResponse); - const [response] = await client.cancelBuild(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelBuild without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.Build() - ); - client.innerApiCalls.cancelBuild = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelBuild( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelBuild with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelBuild = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelBuild(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelBuild with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelBuild(request), expectedError); - }); - }); - - describe('createBuildTrigger', () => { - it('invokes createBuildTrigger without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.BuildTrigger() - ); - client.innerApiCalls.createBuildTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.createBuildTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBuildTrigger without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.BuildTrigger() - ); - client.innerApiCalls.createBuildTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBuildTrigger( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBuildTrigger with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.createBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBuildTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBuildTrigger with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createBuildTrigger(request), expectedError); - }); - }); - - describe('getBuildTrigger', () => { - it('invokes getBuildTrigger without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.BuildTrigger() - ); - client.innerApiCalls.getBuildTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.getBuildTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBuildTrigger without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.BuildTrigger() - ); - client.innerApiCalls.getBuildTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBuildTrigger( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBuildTrigger with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.getBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBuildTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBuildTrigger with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBuildTrigger(request), expectedError); - }); - }); - - describe('deleteBuildTrigger', () => { - it('invokes deleteBuildTrigger without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBuildTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBuildTrigger without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBuildTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBuildTrigger( - 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.deleteBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBuildTrigger with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBuildTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBuildTrigger with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteBuildTrigger(request), expectedError); - }); - }); - - describe('updateBuildTrigger', () => { - it('invokes updateBuildTrigger without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() - ); - request.trigger = {}; - // path template: projects/*/locations/{location=*}/triggers/* - request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.BuildTrigger() - ); - client.innerApiCalls.updateBuildTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.updateBuildTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBuildTrigger without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() - ); - request.trigger = {}; - // path template: projects/*/locations/{location=*}/triggers/* - request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.BuildTrigger() - ); - client.innerApiCalls.updateBuildTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBuildTrigger( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBuildTrigger with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() - ); - request.trigger = {}; - // path template: projects/*/locations/{location=*}/triggers/* - request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBuildTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBuildTrigger with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() - ); - request.trigger = {}; - // path template: projects/*/locations/{location=*}/triggers/* - request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateBuildTrigger(request), expectedError); - }); - }); - - describe('receiveTriggerWebhook', () => { - it('invokes receiveTriggerWebhook without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); - request.trigger = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse() - ); - client.innerApiCalls.receiveTriggerWebhook = stubSimpleCall(expectedResponse); - const [response] = await client.receiveTriggerWebhook(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes receiveTriggerWebhook without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); - request.trigger = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse() - ); - client.innerApiCalls.receiveTriggerWebhook = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.receiveTriggerWebhook( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes receiveTriggerWebhook with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); - request.trigger = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.receiveTriggerWebhook = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.receiveTriggerWebhook(request), expectedError); - const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes receiveTriggerWebhook with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); - request.trigger = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); - request.name = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.receiveTriggerWebhook(request), expectedError); - }); - }); - - describe('getWorkerPool', () => { - it('invokes getWorkerPool without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.WorkerPool() - ); - client.innerApiCalls.getWorkerPool = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkerPool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkerPool without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.WorkerPool() - ); - client.innerApiCalls.getWorkerPool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkerPool( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IWorkerPool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkerPool with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkerPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkerPool(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkerPool with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkerPool(request), expectedError); - }); - }); - - describe('createBuild', () => { - it('invokes createBuild without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateBuildRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBuild = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBuild(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBuild without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateBuildRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBuild = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBuild( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBuild with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateBuildRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.createBuild = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBuild(request), expectedError); - const actualRequest = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBuild with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateBuildRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.createBuild = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBuild(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBuildProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBuildProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBuildProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBuildProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('retryBuild', () => { - it('invokes retryBuild without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.retryBuild = stubLongRunningCall(expectedResponse); - const [operation] = await client.retryBuild(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes retryBuild without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.retryBuild = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.retryBuild( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes retryBuild with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.retryBuild(request), expectedError); - const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes retryBuild with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.retryBuild(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRetryBuildProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRetryBuildProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRetryBuildProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRetryBuildProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('approveBuild', () => { - it('invokes approveBuild without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.approveBuild = stubLongRunningCall(expectedResponse); - const [operation] = await client.approveBuild(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes approveBuild without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.approveBuild = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.approveBuild( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes approveBuild with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.approveBuild(request), expectedError); - const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes approveBuild with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.approveBuild(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkApproveBuildProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkApproveBuildProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkApproveBuildProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkApproveBuildProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('runBuildTrigger', () => { - it('invokes runBuildTrigger without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runBuildTrigger = stubLongRunningCall(expectedResponse); - const [operation] = await client.runBuildTrigger(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runBuildTrigger without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runBuildTrigger = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runBuildTrigger( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runBuildTrigger with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runBuildTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runBuildTrigger with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runBuildTrigger(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRunBuildTriggerProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunBuildTriggerProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunBuildTriggerProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunBuildTriggerProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createWorkerPool', () => { - it('invokes createWorkerPool without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkerPool = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkerPool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkerPool without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkerPool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkerPool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkerPool with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkerPool(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkerPool with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkerPool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateWorkerPoolProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkerPoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateWorkerPoolProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkerPoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteWorkerPool', () => { - it('invokes deleteWorkerPool without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkerPool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkerPool without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkerPool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkerPool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkerPool with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkerPool(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkerPool with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkerPool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteWorkerPoolProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkerPoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteWorkerPoolProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkerPoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateWorkerPool', () => { - it('invokes updateWorkerPool without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest() - ); - request.workerPool = {}; - // path template: projects/*/locations/{location=*}/workerPools/* - request.workerPool.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkerPool = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkerPool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkerPool without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest() - ); - request.workerPool = {}; - // path template: projects/*/locations/{location=*}/workerPools/* - request.workerPool.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkerPool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkerPool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkerPool with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest() - ); - request.workerPool = {}; - // path template: projects/*/locations/{location=*}/workerPools/* - request.workerPool.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkerPool(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkerPool with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest() - ); - request.workerPool = {}; - // path template: projects/*/locations/{location=*}/workerPools/* - request.workerPool.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkerPool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateWorkerPoolProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkerPoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateWorkerPoolProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkerPoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listBuilds', () => { - it('invokes listBuilds without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - ]; - client.innerApiCalls.listBuilds = stubSimpleCall(expectedResponse); - const [response] = await client.listBuilds(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuilds without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - ]; - client.innerApiCalls.listBuilds = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBuilds( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuilds with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.listBuilds = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBuilds(request), expectedError); - const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuildsStream without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - ]; - client.descriptors.page.listBuilds.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBuildsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.Build[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.Build) => { - 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.listBuilds.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuilds, request)); - assert( - (client.descriptors.page.listBuilds.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBuildsStream with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.descriptors.page.listBuilds.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBuildsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.Build[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.Build) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBuilds.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuilds, request)); - assert( - (client.descriptors.page.listBuilds.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuilds without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - ]; - client.descriptors.page.listBuilds.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v1.IBuild[] = []; - const iterable = client.listBuildsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBuilds.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuilds.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuilds with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.descriptors.page.listBuilds.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBuildsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v1.IBuild[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBuilds.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuilds.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listBuildTriggers', () => { - it('invokes listBuildTriggers without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - ]; - client.innerApiCalls.listBuildTriggers = stubSimpleCall(expectedResponse); - const [response] = await client.listBuildTriggers(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuildTriggers without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - ]; - client.innerApiCalls.listBuildTriggers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBuildTriggers( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuildTriggers with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.listBuildTriggers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBuildTriggers(request), expectedError); - const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuildTriggersStream without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - ]; - client.descriptors.page.listBuildTriggers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBuildTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.BuildTrigger[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.BuildTrigger) => { - 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.listBuildTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuildTriggers, request)); - assert( - (client.descriptors.page.listBuildTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBuildTriggersStream with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.descriptors.page.listBuildTriggers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBuildTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.BuildTrigger[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.BuildTrigger) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBuildTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuildTriggers, request)); - assert( - (client.descriptors.page.listBuildTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuildTriggers without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - ]; - client.descriptors.page.listBuildTriggers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v1.IBuildTrigger[] = []; - const iterable = client.listBuildTriggersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuildTriggers with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.descriptors.page.listBuildTriggers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBuildTriggersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v1.IBuildTrigger[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listWorkerPools', () => { - it('invokes listWorkerPools without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - ]; - client.innerApiCalls.listWorkerPools = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkerPools(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkerPools without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - ]; - client.innerApiCalls.listWorkerPools = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkerPools( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IWorkerPool[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkerPools with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkerPools = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkerPools(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkerPoolsStream without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - ]; - client.descriptors.page.listWorkerPools.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkerPoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.WorkerPool[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.WorkerPool) => { - 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.listWorkerPools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkerPools, request)); - assert( - (client.descriptors.page.listWorkerPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listWorkerPoolsStream with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkerPools.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkerPoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.WorkerPool[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.WorkerPool) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkerPools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkerPools, request)); - assert( - (client.descriptors.page.listWorkerPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkerPools without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - ]; - client.descriptors.page.listWorkerPools.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v1.IWorkerPool[] = []; - const iterable = client.listWorkerPoolsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkerPools with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkerPools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkerPoolsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v1.IWorkerPool[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkerPools.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", - keyring: "keyringValue", - key: "keyValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - 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", "keyValue"); - 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('matchKeyFromCryptoKeyName', () => { - const result = client.matchKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyValue"); - 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 cloudbuildModule.v1.CloudBuildClient({ - 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", - network: "networkValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - 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 cloudbuildModule.v1.CloudBuildClient({ - 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('projectBuild', () => { - const fakePath = "/rendered/path/projectBuild"; - const expectedParameters = { - project: "projectValue", - build: "buildValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectBuildPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectBuildPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectBuildPath', () => { - const result = client.projectBuildPath("projectValue", "buildValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectBuildPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectBuildName', () => { - const result = client.matchProjectFromProjectBuildName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBuildFromProjectBuildName', () => { - const result = client.matchBuildFromProjectBuildName(fakePath); - assert.strictEqual(result, "buildValue"); - assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConfig', () => { - const fakePath = "/rendered/path/projectConfig"; - const expectedParameters = { - project: "projectValue", - config: "configValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConfigPath', () => { - const result = client.projectConfigPath("projectValue", "configValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConfigName', () => { - const result = client.matchProjectFromProjectConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConfigFromProjectConfigName', () => { - const result = client.matchConfigFromProjectConfigName(fakePath); - assert.strictEqual(result, "configValue"); - assert((client.pathTemplates.projectConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBuild', () => { - const fakePath = "/rendered/path/projectLocationBuild"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - build: "buildValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBuildPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBuildPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBuildPath', () => { - const result = client.projectLocationBuildPath("projectValue", "locationValue", "buildValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBuildPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBuildName', () => { - const result = client.matchProjectFromProjectLocationBuildName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBuildName', () => { - const result = client.matchLocationFromProjectLocationBuildName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBuildFromProjectLocationBuildName', () => { - const result = client.matchBuildFromProjectLocationBuildName(fakePath); - assert.strictEqual(result, "buildValue"); - assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConfig', () => { - const fakePath = "/rendered/path/projectLocationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - config: "configValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConfigPath', () => { - const result = client.projectLocationConfigPath("projectValue", "locationValue", "configValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConfigName', () => { - const result = client.matchProjectFromProjectLocationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConfigName', () => { - const result = client.matchLocationFromProjectLocationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConfigFromProjectLocationConfigName', () => { - const result = client.matchConfigFromProjectLocationConfigName(fakePath); - assert.strictEqual(result, "configValue"); - assert((client.pathTemplates.projectLocationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationTrigger', () => { - const fakePath = "/rendered/path/projectLocationTrigger"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - trigger: "triggerValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationTriggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationTriggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationTriggerPath', () => { - const result = client.projectLocationTriggerPath("projectValue", "locationValue", "triggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationTriggerName', () => { - const result = client.matchProjectFromProjectLocationTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationTriggerName', () => { - const result = client.matchLocationFromProjectLocationTriggerName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTriggerFromProjectLocationTriggerName', () => { - const result = client.matchTriggerFromProjectLocationTriggerName(fakePath); - assert.strictEqual(result, "triggerValue"); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectTrigger', () => { - const fakePath = "/rendered/path/projectTrigger"; - const expectedParameters = { - project: "projectValue", - trigger: "triggerValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectTriggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectTriggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectTriggerPath', () => { - const result = client.projectTriggerPath("projectValue", "triggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectTriggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectTriggerName', () => { - const result = client.matchProjectFromProjectTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTriggerFromProjectTriggerName', () => { - const result = client.matchTriggerFromProjectTriggerName(fakePath); - assert.strictEqual(result, "triggerValue"); - assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('repository', () => { - const fakePath = "/rendered/path/repository"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connection: "connectionValue", - repository: "repositoryValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - 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", "connectionValue", "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('matchConnectionFromRepositoryName', () => { - const result = client.matchConnectionFromRepositoryName(fakePath); - assert.strictEqual(result, "connectionValue"); - 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('secretVersion', () => { - const fakePath = "/rendered/path/secretVersion"; - const expectedParameters = { - project: "projectValue", - secret: "secretValue", - version: "versionValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.secretVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.secretVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('secretVersionPath', () => { - const result = client.secretVersionPath("projectValue", "secretValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.secretVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSecretVersionName', () => { - const result = client.matchProjectFromSecretVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecretFromSecretVersionName', () => { - const result = client.matchSecretFromSecretVersionName(fakePath); - assert.strictEqual(result, "secretValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromSecretVersionName', () => { - const result = client.matchVersionFromSecretVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('serviceAccount', () => { - const fakePath = "/rendered/path/serviceAccount"; - const expectedParameters = { - project: "projectValue", - service_account: "serviceAccountValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.serviceAccountPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serviceAccountPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serviceAccountPath', () => { - const result = client.serviceAccountPath("projectValue", "serviceAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serviceAccountPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceAccountName', () => { - const result = client.matchProjectFromServiceAccountName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceAccountFromServiceAccountName', () => { - const result = client.matchServiceAccountFromServiceAccountName(fakePath); - assert.strictEqual(result, "serviceAccountValue"); - assert((client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('subscription', () => { - const fakePath = "/rendered/path/subscription"; - const expectedParameters = { - project: "projectValue", - subscription: "subscriptionValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.subscriptionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.subscriptionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('subscriptionPath', () => { - const result = client.subscriptionPath("projectValue", "subscriptionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.subscriptionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSubscriptionName', () => { - const result = client.matchProjectFromSubscriptionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.subscriptionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSubscriptionFromSubscriptionName', () => { - const result = client.matchSubscriptionFromSubscriptionName(fakePath); - assert.strictEqual(result, "subscriptionValue"); - assert((client.pathTemplates.subscriptionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('topic', () => { - const fakePath = "/rendered/path/topic"; - const expectedParameters = { - project: "projectValue", - topic: "topicValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - 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('workerPool', () => { - const fakePath = "/rendered/path/workerPool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - worker_pool: "workerPoolValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - 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-devtools-cloudbuild/v1/tsconfig.json b/owl-bot-staging/google-devtools-cloudbuild/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v1/webpack.config.js b/owl-bot-staging/google-devtools-cloudbuild/v1/webpack.config.js deleted file mode 100644 index f667feb1580..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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: 'CloudBuild', - filename: './cloud-build.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-devtools-cloudbuild/v2/.eslintignore b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v2/.eslintrc.json b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore b/owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v2/.jsdoc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.jsdoc.js deleted file mode 100644 index 09c8e7ac916..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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/cloudbuild', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v2/.prettierrc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v2/README.md b/owl-bot-staging/google-devtools-cloudbuild/v2/README.md deleted file mode 100644 index 1e997bef7bc..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Cloudbuild: Nodejs Client diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/package.json b/owl-bot-staging/google-devtools-cloudbuild/v2/package.json deleted file mode 100644 index 3d2b92e0fa5..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/cloudbuild", - "version": "0.1.0", - "description": "Cloudbuild client for Node.js", - "repository": "googleapis/nodejs-cloudbuild", - "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 cloudbuild", - "cloudbuild", - "repository 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-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto deleted file mode 100644 index 8a2fb350d39..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto +++ /dev/null @@ -1,112 +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.devtools.cloudbuild.v2; - -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 csharp_namespace = "Google.Cloud.CloudBuild.V2"; -option go_package = "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb;cloudbuildpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudBuildProto"; -option java_package = "com.google.cloudbuild.v2"; -option objc_class_prefix = "GCB"; -option php_namespace = "Google\\Cloud\\Build\\V2"; -option ruby_package = "Google::Cloud::Build::V2"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; -option (google.api.resource_definition) = { - type: "iam.googleapis.com/ServiceAccount" - pattern: "projects/{project}/serviceAccounts/{service_account}" -}; -option (google.api.resource_definition) = { - type: "secretmanager.googleapis.com/Secret" - pattern: "projects/{project}/secrets/{secret}" -}; -option (google.api.resource_definition) = { - type: "secretmanager.googleapis.com/SecretVersion" - pattern: "projects/{project}/secrets/{secret}/versions/{version}" -}; -option (google.api.resource_definition) = { - type: "cloudbuild.googleapis.com/githubEnterpriseConfig" - pattern: "projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}" -}; - -// 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]; -} - -// Represents the custom metadata of the RunWorkflow long-running operation. -message RunWorkflowCustomOperationMetadata { - // 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. Name of the verb executed by the operation. - string verb = 3 [(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 = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. ID of the pipeline run created by RunWorkflow. - string pipeline_run_id = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto deleted file mode 100644 index 41583e70d4e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto +++ /dev/null @@ -1,802 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.devtools.cloudbuild.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/httpbody.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"; - -option csharp_namespace = "Google.Cloud.CloudBuild.V2"; -option go_package = "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb;cloudbuildpb"; -option java_multiple_files = true; -option java_outer_classname = "RepositoryManagerProto"; -option java_package = "com.google.cloudbuild.v2"; -option objc_class_prefix = "GCB"; -option php_namespace = "Google\\Cloud\\Build\\V2"; -option ruby_package = "Google::Cloud::Build::V2"; -option (google.api.resource_definition) = { - type: "servicedirectory.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}" -}; - -// Manages connections to source code repositories. -service RepositoryManager { - option (google.api.default_host) = "cloudbuild.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a Connection. - rpc CreateConnection(CreateConnectionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*}/connections" - body: "connection" - }; - option (google.api.method_signature) = "parent,connection,connection_id"; - option (google.longrunning.operation_info) = { - response_type: "Connection" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Gets details of a single connection. - rpc GetConnection(GetConnectionRequest) returns (Connection) { - option (google.api.http) = { - get: "/v2/{name=projects/*/locations/*/connections/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists Connections in a given project and location. - rpc ListConnections(ListConnectionsRequest) - returns (ListConnectionsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/locations/*}/connections" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates a single connection. - rpc UpdateConnection(UpdateConnectionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v2/{connection.name=projects/*/locations/*/connections/*}" - body: "connection" - }; - option (google.api.method_signature) = "connection,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Connection" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Deletes a single connection. - rpc DeleteConnection(DeleteConnectionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/locations/*/connections/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Creates a Repository. - rpc CreateRepository(CreateRepositoryRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*/connections/*}/repositories" - body: "repository" - }; - option (google.api.method_signature) = "parent,repository,repository_id"; - option (google.longrunning.operation_info) = { - response_type: "Repository" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Creates multiple repositories inside a connection. - rpc BatchCreateRepositories(BatchCreateRepositoriesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*/connections/*}/repositories:batchCreate" - body: "*" - }; - option (google.api.method_signature) = "parent,requests"; - option (google.longrunning.operation_info) = { - response_type: "BatchCreateRepositoriesResponse" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Gets details of a single repository. - rpc GetRepository(GetRepositoryRequest) returns (Repository) { - option (google.api.http) = { - get: "/v2/{name=projects/*/locations/*/connections/*/repositories/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists Repositories in a given connection. - rpc ListRepositories(ListRepositoriesRequest) - returns (ListRepositoriesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/locations/*/connections/*}/repositories" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a single repository. - rpc DeleteRepository(DeleteRepositoryRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/locations/*/connections/*/repositories/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Fetches read/write token of a given repository. - rpc FetchReadWriteToken(FetchReadWriteTokenRequest) - returns (FetchReadWriteTokenResponse) { - option (google.api.http) = { - post: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:accessReadWriteToken" - body: "*" - }; - option (google.api.method_signature) = "repository"; - } - - // Fetches read token of a given repository. - rpc FetchReadToken(FetchReadTokenRequest) returns (FetchReadTokenResponse) { - option (google.api.http) = { - post: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:accessReadToken" - body: "*" - }; - option (google.api.method_signature) = "repository"; - } - - // FetchLinkableRepositories get repositories from SCM that are - // accessible and could be added to the connection. - rpc FetchLinkableRepositories(FetchLinkableRepositoriesRequest) - returns (FetchLinkableRepositoriesResponse) { - option (google.api.http) = { - get: "/v2/{connection=projects/*/locations/*/connections/*}:fetchLinkableRepositories" - }; - } - - // Fetch the list of branches or tags for a given repository. - rpc FetchGitRefs(FetchGitRefsRequest) returns (FetchGitRefsResponse) { - option (google.api.http) = { - get: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:fetchGitRefs" - }; - option (google.api.method_signature) = "repository"; - } -} - -// A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Server or -// GitLab. -message Connection { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/Connection" - pattern: "projects/{project}/locations/{location}/connections/{connection}" - plural: "connections" - singular: "connection" - style: DECLARATIVE_FRIENDLY - }; - - // Immutable. The resource name of the connection, in the format - // `projects/{project}/locations/{location}/connections/{connection_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. Server assigned timestamp for when the connection was created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server assigned timestamp for when the connection was updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Configuration for the connection depending on the type of provider. - oneof connection_config { - // Configuration for connections to github.com. - GitHubConfig github_config = 5; - - // Configuration for connections to an instance of GitHub Enterprise. - GitHubEnterpriseConfig github_enterprise_config = 6; - - // Configuration for connections to gitlab.com or an instance of GitLab - // Enterprise. - GitLabConfig gitlab_config = 7; - } - - // Output only. Installation state of the Connection. - InstallationState installation_state = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // If disabled is set to true, functionality is disabled for this connection. - // Repository based API methods and webhooks processing for repositories in - // this connection will be disabled. - bool disabled = 13; - - // Output only. Set to true when the connection is being set up or updated in - // the background. - bool reconciling = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allows clients to store small amounts of arbitrary data. - map annotations = 15; - - // This checksum is computed by the server based on the value of other - // fields, and may be sent on update and delete requests to ensure the - // client has an up-to-date value before proceeding. - string etag = 16; -} - -// Describes stage and necessary actions to be taken by the -// user to complete the installation. Used for GitHub and GitHub Enterprise -// based connections. -message InstallationState { - // Stage of the installation process. - enum Stage { - // No stage specified. - STAGE_UNSPECIFIED = 0; - - // Only for GitHub Enterprise. An App creation has been requested. - // The user needs to confirm the creation in their GitHub enterprise host. - PENDING_CREATE_APP = 1; - - // User needs to authorize the GitHub (or Enterprise) App via OAuth. - PENDING_USER_OAUTH = 2; - - // User needs to follow the link to install the GitHub (or Enterprise) App. - PENDING_INSTALL_APP = 3; - - // Installation process has been completed. - COMPLETE = 10; - } - - // Output only. Current step of the installation process. - Stage stage = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Message of what the user should do next to continue the - // installation. Empty string if the installation is already complete. - string message = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Link to follow for next action. Empty string if the - // installation is already complete. - string action_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for FetchLinkableRepositories. -message FetchLinkableRepositoriesRequest { - // Required. The name of the Connection. - // Format: `projects/*/locations/*/connections/*`. - string connection = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // Number of results to return in the list. Default to 20. - int32 page_size = 2; - - // Page start. - string page_token = 3; -} - -// Response message for FetchLinkableRepositories. -message FetchLinkableRepositoriesResponse { - // repositories ready to be created. - repeated Repository repositories = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; -} - -// Configuration for connections to github.com. -message GitHubConfig { - // OAuth credential of the account that authorized the Cloud Build GitHub App. - // It is recommended to use a robot account instead of a human user account. - // The OAuth token must be tied to the Cloud Build GitHub App. - OAuthCredential authorizer_credential = 1; - - // GitHub App installation id. - int64 app_installation_id = 2; -} - -// Configuration for connections to an instance of GitHub Enterprise. -message GitHubEnterpriseConfig { - // Required. The URI of the GitHub Enterprise host this connection is for. - string host_uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. API Key used for authentication of webhook events. - string api_key = 12 [(google.api.field_behavior) = REQUIRED]; - - // Id of the GitHub App created from the manifest. - int64 app_id = 2; - - // The URL-friendly name of the GitHub App. - string app_slug = 13; - - // SecretManager resource containing the private key of the GitHub App, - // formatted as `projects/*/secrets/*/versions/*`. - string private_key_secret_version = 4 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // SecretManager resource containing the webhook secret of the GitHub App, - // formatted as `projects/*/secrets/*/versions/*`. - string webhook_secret_secret_version = 5 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // ID of the installation of the GitHub App. - int64 app_installation_id = 9; - - // Configuration for using Service Directory to privately connect to a GitHub - // Enterprise server. This should only be set if the GitHub Enterprise server - // is hosted on-premises and not reachable by public internet. If this field - // is left empty, calls to the GitHub Enterprise server will be made over the - // public internet. - ServiceDirectoryConfig service_directory_config = 10; - - // SSL certificate to use for requests to GitHub Enterprise. - string ssl_ca = 11; - - // Output only. GitHub Enterprise version installed at the host_uri. - string server_version = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Configuration for connections to gitlab.com or an instance of GitLab -// Enterprise. -message GitLabConfig { - // The URI of the GitLab Enterprise host this connection is for. - // If not specified, the default value is https://gitlab.com. - string host_uri = 1; - - // Required. Immutable. SecretManager resource containing the webhook secret - // of a GitLab Enterprise project, formatted as - // `projects/*/secrets/*/versions/*`. - string webhook_secret_secret_version = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; - - // Required. A GitLab personal access token with the minimum `read_api` scope - // access. - UserCredential read_authorizer_credential = 3 - [(google.api.field_behavior) = REQUIRED]; - - // Required. A GitLab personal access token with the `api` scope access. - UserCredential authorizer_credential = 4 - [(google.api.field_behavior) = REQUIRED]; - - // Configuration for using Service Directory to privately connect to a GitLab - // Enterprise server. This should only be set if the GitLab Enterprise server - // is hosted on-premises and not reachable by public internet. If this field - // is left empty, calls to the GitLab Enterprise server will be made over the - // public internet. - ServiceDirectoryConfig service_directory_config = 5; - - // SSL certificate to use for requests to GitLab Enterprise. - string ssl_ca = 6; - - // Output only. Version of the GitLab Enterprise server running on the - // `host_uri`. - string server_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// ServiceDirectoryConfig represents Service Directory configuration for a -// connection. -message ServiceDirectoryConfig { - // Required. The Service Directory service name. - // Format: - // projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "servicedirectory.googleapis.com/Service" - } - ]; -} - -// A repository associated to a parent connection. -message Repository { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/Repository" - pattern: "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}" - plural: "repositories" - singular: "repository" - style: DECLARATIVE_FRIENDLY - }; - - // Immutable. Resource name of the repository, in the format - // `projects/*/locations/*/connections/*/repositories/*`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Required. Git Clone HTTPS URI. - string remote_uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Server assigned timestamp for when the connection was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server assigned timestamp for when the connection was updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allows clients to store small amounts of arbitrary data. - map annotations = 6; - - // This checksum is computed by the server based on the value of other - // fields, and may be sent on update and delete requests to ensure the - // client has an up-to-date value before proceeding. - string etag = 7; - - // Output only. External ID of the webhook created for the repository. - string webhook_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents an OAuth token of the account that authorized the Connection, -// and associated metadata. -message OAuthCredential { - // A SecretManager resource containing the OAuth token that authorizes - // the Cloud Build connection. Format: `projects/*/secrets/*/versions/*`. - string oauth_token_secret_version = 1 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // Output only. The username associated to this token. - string username = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a personal access token that authorized the Connection, -// and associated metadata. -message UserCredential { - // Required. A SecretManager resource containing the user token that - // authorizes the Cloud Build connection. Format: - // `projects/*/secrets/*/versions/*`. - string user_token_secret_version = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; - - // Output only. The username associated to this token. - string username = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Message for creating a Connection -message CreateConnectionRequest { - // Required. Project and location where the connection will be created. - // Format: `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // Required. The Connection to create. - Connection connection = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the Connection, which will become the final - // component of the Connection's resource name. Names must be unique - // per-project per-location. Allows alphanumeric characters and any of - // -._~%!$&'()*+,;=@. - string connection_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Message for getting the details of a Connection. -message GetConnectionRequest { - // Required. The name of the Connection to retrieve. - // Format: `projects/*/locations/*/connections/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Connection" - } - ]; -} - -// Message for requesting list of Connections. -message ListConnectionsRequest { - // Required. The parent, which owns this collection of Connections. - // Format: `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // Number of results to return in the list. - int32 page_size = 2; - - // Page start. - string page_token = 3; -} - -// Message for response to listing Connections. -message ListConnectionsResponse { - // The list of Connections. - repeated Connection connections = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; -} - -// Message for updating a Connection. -message UpdateConnectionRequest { - // Required. The Connection to update. - Connection connection = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the connection is not found a new connection - // will be created. In this situation `update_mask` is ignored. - // The creation will succeed only if the input connection has all the - // necessary information (e.g a github_config with both user_oauth_token and - // installation_id properties). - bool allow_missing = 3; - - // The current etag of the connection. - // If an etag is provided and does not match the current etag of the - // connection, update will be blocked and an ABORTED error will be returned. - string etag = 4; -} - -// Message for deleting a Connection. -message DeleteConnectionRequest { - // Required. The name of the Connection to delete. - // Format: `projects/*/locations/*/connections/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // The current etag of the connection. - // If an etag is provided and does not match the current etag of the - // connection, deletion will be blocked and an ABORTED error will be returned. - string etag = 2; - - // If set, validate the request, but do not actually post it. - bool validate_only = 3; -} - -// Message for creating a Repository. -message CreateRepositoryRequest { - // Required. The connection to contain the repository. If the request is part - // of a BatchCreateRepositoriesRequest, this field should be empty or match - // the parent specified there. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // Required. The repository to create. - Repository repository = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the repository, which will become the final - // component of the repository's resource name. This ID should be unique in - // the connection. Allows alphanumeric characters and any of - // -._~%!$&'()*+,;=@. - string repository_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Message for creating repositoritories in batch. -message BatchCreateRepositoriesRequest { - // Required. The connection to contain all the repositories being created. - // Format: projects/*/locations/*/connections/* - // The parent field in the CreateRepositoryRequest messages - // must either be empty or match this field. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // Required. The request messages specifying the repositories to create. - repeated CreateRepositoryRequest requests = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Message for response of creating repositories in batch. -message BatchCreateRepositoriesResponse { - // Repository resources created. - repeated Repository repositories = 1; -} - -// Message for getting the details of a Repository. -message GetRepositoryRequest { - // Required. The name of the Repository to retrieve. - // Format: `projects/*/locations/*/connections/*/repositories/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - } - ]; -} - -// Message for requesting list of Repositories. -message ListRepositoriesRequest { - // Required. The parent, which owns this collection of Repositories. - // Format: `projects/*/locations/*/connections/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Repository" - } - ]; - - // Number of results to return in the list. - int32 page_size = 2; - - // Page start. - string page_token = 3; - - // A filter expression that filters resources listed in the response. - // Expressions must follow API improvement proposal - // [AIP-160](https://google.aip.dev/160). e.g. - // `remote_uri:"https://github.com*"`. - string filter = 4; -} - -// Message for response to listing Repositories. -message ListRepositoriesResponse { - // The list of Repositories. - repeated Repository repositories = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; -} - -// Message for deleting a Repository. -message DeleteRepositoryRequest { - // Required. The name of the Repository to delete. - // Format: `projects/*/locations/*/connections/*/repositories/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - } - ]; - - // The current etag of the repository. - // If an etag is provided and does not match the current etag of the - // repository, deletion will be blocked and an ABORTED error will be returned. - string etag = 2; - - // If set, validate the request, but do not actually post it. - bool validate_only = 3; -} - -// Message for fetching SCM read/write token. -message FetchReadWriteTokenRequest { - // Required. The resource name of the repository in the format - // `projects/*/locations/*/connections/*/repositories/*`. - string repository = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - } - ]; -} - -// Message for fetching SCM read token. -message FetchReadTokenRequest { - // Required. The resource name of the repository in the format - // `projects/*/locations/*/connections/*/repositories/*`. - string repository = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - } - ]; -} - -// Message for responding to get read token. -message FetchReadTokenResponse { - // The token content. - string token = 1; - - // Expiration timestamp. Can be empty if unknown or non-expiring. - google.protobuf.Timestamp expiration_time = 2; -} - -// Message for responding to get read/write token. -message FetchReadWriteTokenResponse { - // The token content. - string token = 1; - - // Expiration timestamp. Can be empty if unknown or non-expiring. - google.protobuf.Timestamp expiration_time = 2; -} - -// RPC request object accepted by the ProcessWebhook RPC method. -message ProcessWebhookRequest { - // Required. Project and location where the webhook will be received. - // Format: `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // HTTP request body. - google.api.HttpBody body = 2; - - // Arbitrary additional key to find the maching repository for a webhook event - // if needed. - string webhook_key = 3; -} - -// Request for fetching git refs -message FetchGitRefsRequest { - // Type of refs - enum RefType { - // No type specified. - REF_TYPE_UNSPECIFIED = 0; - - // To fetch tags. - TAG = 1; - - // To fetch branches. - BRANCH = 2; - } - - // Required. The resource name of the repository in the format - // `projects/*/locations/*/connections/*/repositories/*`. - string repository = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - } - ]; - - // Type of refs to fetch - RefType ref_type = 2; -} - -// Response for fetching git refs -message FetchGitRefsResponse { - // Name of the refs fetched. - repeated string ref_names = 1; -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js deleted file mode 100644 index 9bdc0b8d979..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.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, requests) { - // [START cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The connection to contain all the repositories being created. - * Format: projects/* /locations/* /connections/* - * The parent field in the CreateRepositoryRequest messages - * must either be empty or match this field. - */ - // const parent = 'abc123' - /** - * Required. The request messages specifying the repositories to create. - */ - // const requests = [1,2,3,4] - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callBatchCreateRepositories() { - // Construct request - const request = { - parent, - requests, - }; - - // Run request - const [operation] = await cloudbuildClient.batchCreateRepositories(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchCreateRepositories(); - // [END cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js deleted file mode 100644 index 1ff4f1186b5..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.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, connection, connectionId) { - // [START cloudbuild_v2_generated_RepositoryManager_CreateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project and location where the connection will be created. - * Format: `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Required. The Connection to create. - */ - // const connection = {} - /** - * Required. The ID to use for the Connection, which will become the final - * component of the Connection's resource name. Names must be unique - * per-project per-location. Allows alphanumeric characters and any of - * -._~%!$&'()*+,;=@. - */ - // const connectionId = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callCreateConnection() { - // Construct request - const request = { - parent, - connection, - connectionId, - }; - - // Run request - const [operation] = await cloudbuildClient.createConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateConnection(); - // [END cloudbuild_v2_generated_RepositoryManager_CreateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js deleted file mode 100644 index d4def936139..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.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, repository, repositoryId) { - // [START cloudbuild_v2_generated_RepositoryManager_CreateRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The connection to contain the repository. If the request is part - * of a BatchCreateRepositoriesRequest, this field should be empty or match - * the parent specified there. - */ - // const parent = 'abc123' - /** - * Required. The repository to create. - */ - // const repository = {} - /** - * Required. The ID to use for the repository, which will become the final - * component of the repository's resource name. This ID should be unique in - * the connection. Allows alphanumeric characters and any of - * -._~%!$&'()*+,;=@. - */ - // const repositoryId = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callCreateRepository() { - // Construct request - const request = { - parent, - repository, - repositoryId, - }; - - // Run request - const [operation] = await cloudbuildClient.createRepository(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateRepository(); - // [END cloudbuild_v2_generated_RepositoryManager_CreateRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js deleted file mode 100644 index 46a5ff3ce9a..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.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 cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Connection to delete. - * Format: `projects/* /locations/* /connections/*`. - */ - // const name = 'abc123' - /** - * The current etag of the connection. - * If an etag is provided and does not match the current etag of the - * connection, deletion will be blocked and an ABORTED error will be returned. - */ - // const etag = 'abc123' - /** - * If set, validate the request, but do not actually post it. - */ - // const validateOnly = true - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callDeleteConnection() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await cloudbuildClient.deleteConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteConnection(); - // [END cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js deleted file mode 100644 index 42194417a03..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.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 cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Repository to delete. - * Format: `projects/* /locations/* /connections/* /repositories/*`. - */ - // const name = 'abc123' - /** - * The current etag of the repository. - * If an etag is provided and does not match the current etag of the - * repository, deletion will be blocked and an ABORTED error will be returned. - */ - // const etag = 'abc123' - /** - * If set, validate the request, but do not actually post it. - */ - // const validateOnly = true - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callDeleteRepository() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await cloudbuildClient.deleteRepository(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteRepository(); - // [END cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js deleted file mode 100644 index 96728361b81..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.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(repository) { - // [START cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - */ - // const repository = 'abc123' - /** - * Type of refs to fetch - */ - // const refType = {} - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callFetchGitRefs() { - // Construct request - const request = { - repository, - }; - - // Run request - const response = await cloudbuildClient.fetchGitRefs(request); - console.log(response); - } - - callFetchGitRefs(); - // [END cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js deleted file mode 100644 index 3d722ecc9ac..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.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(connection) { - // [START cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Connection. - * Format: `projects/* /locations/* /connections/*`. - */ - // const connection = 'abc123' - /** - * Number of results to return in the list. Default to 20. - */ - // const pageSize = 1234 - /** - * Page start. - */ - // const pageToken = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callFetchLinkableRepositories() { - // Construct request - const request = { - connection, - }; - - // Run request - const iterable = await cloudbuildClient.fetchLinkableRepositoriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callFetchLinkableRepositories(); - // [END cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js deleted file mode 100644 index 623c8b64bc2..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.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(repository) { - // [START cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - */ - // const repository = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callFetchReadToken() { - // Construct request - const request = { - repository, - }; - - // Run request - const response = await cloudbuildClient.fetchReadToken(request); - console.log(response); - } - - callFetchReadToken(); - // [END cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js deleted file mode 100644 index 8aaabdabd84..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.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(repository) { - // [START cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - */ - // const repository = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callFetchReadWriteToken() { - // Construct request - const request = { - repository, - }; - - // Run request - const response = await cloudbuildClient.fetchReadWriteToken(request); - console.log(response); - } - - callFetchReadWriteToken(); - // [END cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js deleted file mode 100644 index f4146b898e5..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_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 cloudbuild_v2_generated_RepositoryManager_GetConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Connection to retrieve. - * Format: `projects/* /locations/* /connections/*`. - */ - // const name = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callGetConnection() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await cloudbuildClient.getConnection(request); - console.log(response); - } - - callGetConnection(); - // [END cloudbuild_v2_generated_RepositoryManager_GetConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js deleted file mode 100644 index deca8de40e8..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.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 cloudbuild_v2_generated_RepositoryManager_GetRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Repository to retrieve. - * Format: `projects/* /locations/* /connections/* /repositories/*`. - */ - // const name = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callGetRepository() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await cloudbuildClient.getRepository(request); - console.log(response); - } - - callGetRepository(); - // [END cloudbuild_v2_generated_RepositoryManager_GetRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js deleted file mode 100644 index 63a97011b65..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.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(parent) { - // [START cloudbuild_v2_generated_RepositoryManager_ListConnections_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Connections. - * Format: `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Number of results to return in the list. - */ - // const pageSize = 1234 - /** - * Page start. - */ - // const pageToken = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callListConnections() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await cloudbuildClient.listConnectionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConnections(); - // [END cloudbuild_v2_generated_RepositoryManager_ListConnections_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js deleted file mode 100644 index fc2a8e319b2..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.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 cloudbuild_v2_generated_RepositoryManager_ListRepositories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Repositories. - * Format: `projects/* /locations/* /connections/*`. - */ - // const parent = 'abc123' - /** - * Number of results to return in the list. - */ - // const pageSize = 1234 - /** - * Page start. - */ - // const pageToken = 'abc123' - /** - * A filter expression that filters resources listed in the response. - * Expressions must follow API improvement proposal - * AIP-160 (https://google.aip.dev/160). e.g. - * `remote_uri:"https://github.com*"`. - */ - // const filter = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callListRepositories() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await cloudbuildClient.listRepositoriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRepositories(); - // [END cloudbuild_v2_generated_RepositoryManager_ListRepositories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js deleted file mode 100644 index 4525a347001..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.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(connection) { - // [START cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Connection to update. - */ - // const connection = {} - /** - * The list of fields to be updated. - */ - // const updateMask = {} - /** - * If set to true, and the connection is not found a new connection - * will be created. In this situation `update_mask` is ignored. - * The creation will succeed only if the input connection has all the - * necessary information (e.g a github_config with both user_oauth_token and - * installation_id properties). - */ - // const allowMissing = true - /** - * The current etag of the connection. - * If an etag is provided and does not match the current etag of the - * connection, update will be blocked and an ABORTED error will be returned. - */ - // const etag = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callUpdateConnection() { - // Construct request - const request = { - connection, - }; - - // Run request - const [operation] = await cloudbuildClient.updateConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateConnection(); - // [END cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata_google.devtools.cloudbuild.v2.json b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata_google.devtools.cloudbuild.v2.json deleted file mode 100644 index bf929148640..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata_google.devtools.cloudbuild.v2.json +++ /dev/null @@ -1,655 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-cloudbuild", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.devtools.cloudbuild.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_CreateConnection_async", - "title": "RepositoryManager createConnection Sample", - "origin": "API_DEFINITION", - "description": " Creates a Connection.", - "canonical": true, - "file": "repository_manager.create_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateConnection", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "connection", - "type": ".google.devtools.cloudbuild.v2.Connection" - }, - { - "name": "connection_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "CreateConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateConnection", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_GetConnection_async", - "title": "RepositoryManager getConnection Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single connection.", - "canonical": true, - "file": "repository_manager.get_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetConnection", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.Connection", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "GetConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetConnection", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_ListConnections_async", - "title": "RepositoryManager listConnections Sample", - "origin": "API_DEFINITION", - "description": " Lists Connections in a given project and location.", - "canonical": true, - "file": "repository_manager.list_connections.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConnections", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListConnections", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.ListConnectionsResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "ListConnections", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListConnections", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async", - "title": "RepositoryManager updateConnection Sample", - "origin": "API_DEFINITION", - "description": " Updates a single connection.", - "canonical": true, - "file": "repository_manager.update_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.UpdateConnection", - "async": true, - "parameters": [ - { - "name": "connection", - "type": ".google.devtools.cloudbuild.v2.Connection" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "UpdateConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.UpdateConnection", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async", - "title": "RepositoryManager deleteConnection Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single connection.", - "canonical": true, - "file": "repository_manager.delete_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteConnection", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "DeleteConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteConnection", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_CreateRepository_async", - "title": "RepositoryManager createRepository Sample", - "origin": "API_DEFINITION", - "description": " Creates a Repository.", - "canonical": true, - "file": "repository_manager.create_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateRepository", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "repository", - "type": ".google.devtools.cloudbuild.v2.Repository" - }, - { - "name": "repository_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "CreateRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateRepository", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async", - "title": "RepositoryManager batchCreateRepositories Sample", - "origin": "API_DEFINITION", - "description": " Creates multiple repositories inside a connection.", - "canonical": true, - "file": "repository_manager.batch_create_repositories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchCreateRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.BatchCreateRepositories", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "BatchCreateRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.BatchCreateRepositories", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_GetRepository_async", - "title": "RepositoryManager getRepository Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single repository.", - "canonical": true, - "file": "repository_manager.get_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetRepository", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.Repository", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "GetRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetRepository", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_ListRepositories_async", - "title": "RepositoryManager listRepositories Sample", - "origin": "API_DEFINITION", - "description": " Lists Repositories in a given connection.", - "canonical": true, - "file": "repository_manager.list_repositories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListRepositories", - "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" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.ListRepositoriesResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "ListRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListRepositories", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async", - "title": "RepositoryManager deleteRepository Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single repository.", - "canonical": true, - "file": "repository_manager.delete_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteRepository", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "DeleteRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteRepository", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async", - "title": "RepositoryManager fetchReadWriteToken Sample", - "origin": "API_DEFINITION", - "description": " Fetches read/write token of a given repository.", - "canonical": true, - "file": "repository_manager.fetch_read_write_token.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchReadWriteToken", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadWriteToken", - "async": true, - "parameters": [ - { - "name": "repository", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "FetchReadWriteToken", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadWriteToken", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async", - "title": "RepositoryManager fetchReadToken Sample", - "origin": "API_DEFINITION", - "description": " Fetches read token of a given repository.", - "canonical": true, - "file": "repository_manager.fetch_read_token.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchReadToken", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadToken", - "async": true, - "parameters": [ - { - "name": "repository", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.FetchReadTokenResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "FetchReadToken", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadToken", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async", - "title": "RepositoryManager fetchLinkableRepositories Sample", - "origin": "API_DEFINITION", - "description": " FetchLinkableRepositories get repositories from SCM that are accessible and could be added to the connection.", - "canonical": true, - "file": "repository_manager.fetch_linkable_repositories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchLinkableRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchLinkableRepositories", - "async": true, - "parameters": [ - { - "name": "connection", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.FetchLinkableRepositoriesResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "FetchLinkableRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchLinkableRepositories", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async", - "title": "RepositoryManager fetchGitRefs Sample", - "origin": "API_DEFINITION", - "description": " Fetch the list of branches or tags for a given repository.", - "canonical": true, - "file": "repository_manager.fetch_git_refs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchGitRefs", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchGitRefs", - "async": true, - "parameters": [ - { - "name": "repository", - "type": "TYPE_STRING" - }, - { - "name": "ref_type", - "type": ".google.devtools.cloudbuild.v2.FetchGitRefsRequest.RefType" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.FetchGitRefsResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "FetchGitRefs", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchGitRefs", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts deleted file mode 100644 index 87935397b2a..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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 RepositoryManagerClient = v2.RepositoryManagerClient; -type RepositoryManagerClient = v2.RepositoryManagerClient; -export {v2, RepositoryManagerClient}; -export default {v2, RepositoryManagerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json deleted file mode 100644 index e99fba47b64..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.devtools.cloudbuild.v2", - "libraryPackage": "@google-cloud/cloudbuild", - "services": { - "RepositoryManager": { - "clients": { - "grpc": { - "libraryClient": "RepositoryManagerClient", - "rpcs": { - "GetConnection": { - "methods": [ - "getConnection" - ] - }, - "GetRepository": { - "methods": [ - "getRepository" - ] - }, - "FetchReadWriteToken": { - "methods": [ - "fetchReadWriteToken" - ] - }, - "FetchReadToken": { - "methods": [ - "fetchReadToken" - ] - }, - "FetchGitRefs": { - "methods": [ - "fetchGitRefs" - ] - }, - "CreateConnection": { - "methods": [ - "createConnection" - ] - }, - "UpdateConnection": { - "methods": [ - "updateConnection" - ] - }, - "DeleteConnection": { - "methods": [ - "deleteConnection" - ] - }, - "CreateRepository": { - "methods": [ - "createRepository" - ] - }, - "BatchCreateRepositories": { - "methods": [ - "batchCreateRepositories" - ] - }, - "DeleteRepository": { - "methods": [ - "deleteRepository" - ] - }, - "ListConnections": { - "methods": [ - "listConnections", - "listConnectionsStream", - "listConnectionsAsync" - ] - }, - "ListRepositories": { - "methods": [ - "listRepositories", - "listRepositoriesStream", - "listRepositoriesAsync" - ] - }, - "FetchLinkableRepositories": { - "methods": [ - "fetchLinkableRepositories", - "fetchLinkableRepositoriesStream", - "fetchLinkableRepositoriesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "RepositoryManagerClient", - "rpcs": { - "GetConnection": { - "methods": [ - "getConnection" - ] - }, - "GetRepository": { - "methods": [ - "getRepository" - ] - }, - "FetchReadWriteToken": { - "methods": [ - "fetchReadWriteToken" - ] - }, - "FetchReadToken": { - "methods": [ - "fetchReadToken" - ] - }, - "FetchGitRefs": { - "methods": [ - "fetchGitRefs" - ] - }, - "CreateConnection": { - "methods": [ - "createConnection" - ] - }, - "UpdateConnection": { - "methods": [ - "updateConnection" - ] - }, - "DeleteConnection": { - "methods": [ - "deleteConnection" - ] - }, - "CreateRepository": { - "methods": [ - "createRepository" - ] - }, - "BatchCreateRepositories": { - "methods": [ - "batchCreateRepositories" - ] - }, - "DeleteRepository": { - "methods": [ - "deleteRepository" - ] - }, - "ListConnections": { - "methods": [ - "listConnections", - "listConnectionsStream", - "listConnectionsAsync" - ] - }, - "ListRepositories": { - "methods": [ - "listRepositories", - "listRepositoriesStream", - "listRepositoriesAsync" - ] - }, - "FetchLinkableRepositories": { - "methods": [ - "fetchLinkableRepositories", - "fetchLinkableRepositoriesStream", - "fetchLinkableRepositoriesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts deleted file mode 100644 index 026d90530f0..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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 {RepositoryManagerClient} from './repository_manager_client'; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts deleted file mode 100644 index 2970f3599f0..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts +++ /dev/null @@ -1,2572 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/repository_manager_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './repository_manager_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Manages connections to source code repositories. - * @class - * @memberof v2 - */ -export class RepositoryManagerClient { - 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; - repositoryManagerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of RepositoryManagerClient. - * - * @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 RepositoryManagerClient({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 RepositoryManagerClient; - 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 = { - connectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connections/{connection}' - ), - 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}/connections/{connection}/repositories/{repository}' - ), - secretVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/secrets/{secret}/versions/{version}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/namespaces/{namespace}/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 = { - listConnections: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'connections'), - listRepositories: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories'), - fetchLinkableRepositories: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories') - }; - - 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.iam.v1.IAMPolicy.GetIamPolicy',get: '/v2/{resource=projects/*/locations/*/connections/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v2/{resource=projects/*/locations/*/connections/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v2/{resource=projects/*/locations/*/connections/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/locations/*/operations/*}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createConnectionResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.Connection') as gax.protobuf.Type; - const createConnectionMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - const updateConnectionResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.Connection') as gax.protobuf.Type; - const updateConnectionMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - const deleteConnectionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteConnectionMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - const createRepositoryResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.Repository') as gax.protobuf.Type; - const createRepositoryMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - const batchCreateRepositoriesResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.BatchCreateRepositoriesResponse') as gax.protobuf.Type; - const batchCreateRepositoriesMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - const deleteRepositoryResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteRepositoryMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createConnectionResponse.decode.bind(createConnectionResponse), - createConnectionMetadata.decode.bind(createConnectionMetadata)), - updateConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateConnectionResponse.decode.bind(updateConnectionResponse), - updateConnectionMetadata.decode.bind(updateConnectionMetadata)), - deleteConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteConnectionResponse.decode.bind(deleteConnectionResponse), - deleteConnectionMetadata.decode.bind(deleteConnectionMetadata)), - createRepository: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createRepositoryResponse.decode.bind(createRepositoryResponse), - createRepositoryMetadata.decode.bind(createRepositoryMetadata)), - batchCreateRepositories: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchCreateRepositoriesResponse.decode.bind(batchCreateRepositoriesResponse), - batchCreateRepositoriesMetadata.decode.bind(batchCreateRepositoriesMetadata)), - deleteRepository: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteRepositoryResponse.decode.bind(deleteRepositoryResponse), - deleteRepositoryMetadata.decode.bind(deleteRepositoryMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.devtools.cloudbuild.v2.RepositoryManager', 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.repositoryManagerStub) { - return this.repositoryManagerStub; - } - - // Put together the "service stub" for - // google.devtools.cloudbuild.v2.RepositoryManager. - this.repositoryManagerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devtools.cloudbuild.v2.RepositoryManager') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devtools.cloudbuild.v2.RepositoryManager, - 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 repositoryManagerStubMethods = - ['createConnection', 'getConnection', 'listConnections', 'updateConnection', 'deleteConnection', 'createRepository', 'batchCreateRepositories', 'getRepository', 'listRepositories', 'deleteRepository', 'fetchReadWriteToken', 'fetchReadToken', 'fetchLinkableRepositories', 'fetchGitRefs']; - for (const methodName of repositoryManagerStubMethods) { - const callPromise = this.repositoryManagerStub.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.repositoryManagerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudbuild.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 'cloudbuild.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 connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Connection to retrieve. - * Format: `projects/* /locations/* /connections/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v2.Connection|Connection}. - * Please see the {@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/repository_manager.get_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_GetConnection_async - */ - getConnection( - request?: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|undefined, {}|undefined - ]>; - getConnection( - request: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, - {}|null|undefined>): void; - getConnection( - request: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, - {}|null|undefined>): void; - getConnection( - request?: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConnection(request, options, callback); - } -/** - * Gets details of a single repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Repository to retrieve. - * Format: `projects/* /locations/* /connections/* /repositories/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v2.Repository|Repository}. - * Please see the {@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/repository_manager.get_repository.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_GetRepository_async - */ - getRepository( - request?: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|undefined, {}|undefined - ]>; - getRepository( - request: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): void; - getRepository( - request: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): void; - getRepository( - request?: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getRepository(request, options, callback); - } -/** - * Fetches read/write token of a given repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.repository - * Required. The resource name of the repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse|FetchReadWriteTokenResponse}. - * Please see the {@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/repository_manager.fetch_read_write_token.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async - */ - fetchReadWriteToken( - request?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|undefined, {}|undefined - ]>; - fetchReadWriteToken( - request: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, - {}|null|undefined>): void; - fetchReadWriteToken( - request: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, - {}|null|undefined>): void; - fetchReadWriteToken( - request?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'repository': request.repository ?? '', - }); - this.initialize(); - return this.innerApiCalls.fetchReadWriteToken(request, options, callback); - } -/** - * Fetches read token of a given repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.repository - * Required. The resource name of the repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v2.FetchReadTokenResponse|FetchReadTokenResponse}. - * Please see the {@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/repository_manager.fetch_read_token.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async - */ - fetchReadToken( - request?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|undefined, {}|undefined - ]>; - fetchReadToken( - request: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, - {}|null|undefined>): void; - fetchReadToken( - request: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, - {}|null|undefined>): void; - fetchReadToken( - request?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'repository': request.repository ?? '', - }); - this.initialize(); - return this.innerApiCalls.fetchReadToken(request, options, callback); - } -/** - * Fetch the list of branches or tags for a given repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.repository - * Required. The resource name of the repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - * @param {google.devtools.cloudbuild.v2.FetchGitRefsRequest.RefType} request.refType - * Type of refs to fetch - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.cloudbuild.v2.FetchGitRefsResponse|FetchGitRefsResponse}. - * Please see the {@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/repository_manager.fetch_git_refs.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async - */ - fetchGitRefs( - request?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|undefined, {}|undefined - ]>; - fetchGitRefs( - request: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, - {}|null|undefined>): void; - fetchGitRefs( - request: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, - {}|null|undefined>): void; - fetchGitRefs( - request?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'repository': request.repository ?? '', - }); - this.initialize(); - return this.innerApiCalls.fetchGitRefs(request, options, callback); - } - -/** - * Creates a Connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location where the connection will be created. - * Format: `projects/* /locations/*`. - * @param {google.devtools.cloudbuild.v2.Connection} request.connection - * Required. The Connection to create. - * @param {string} request.connectionId - * Required. The ID to use for the Connection, which will become the final - * component of the Connection's resource name. Names must be unique - * per-project per-location. Allows alphanumeric characters and any of - * -._~%!$&'()*+,;=@. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/repository_manager.create_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateConnection_async - */ - createConnection( - request?: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createConnection( - request: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnection( - request: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnection( - request?: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/repository_manager.create_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateConnection_async - */ - async checkCreateConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a single connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.cloudbuild.v2.Connection} request.connection - * Required. The Connection to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * @param {boolean} request.allowMissing - * If set to true, and the connection is not found a new connection - * will be created. In this situation `update_mask` is ignored. - * The creation will succeed only if the input connection has all the - * necessary information (e.g a github_config with both user_oauth_token and - * installation_id properties). - * @param {string} request.etag - * The current etag of the connection. - * If an etag is provided and does not match the current etag of the - * connection, update will be blocked 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/v2/repository_manager.update_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async - */ - updateConnection( - request?: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateConnection( - request: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnection( - request: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnection( - request?: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'connection.name': request.connection!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/repository_manager.update_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async - */ - async checkUpdateConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Connection to delete. - * Format: `projects/* /locations/* /connections/*`. - * @param {string} request.etag - * The current etag of the connection. - * If an etag is provided and does not match the current etag of the - * connection, deletion will be blocked and an ABORTED error will be returned. - * @param {boolean} request.validateOnly - * If set, validate the request, but do not actually post it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/repository_manager.delete_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async - */ - deleteConnection( - request?: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteConnection( - request: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnection( - request: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnection( - request?: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/repository_manager.delete_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async - */ - async checkDeleteConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a Repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The connection to contain the repository. If the request is part - * of a BatchCreateRepositoriesRequest, this field should be empty or match - * the parent specified there. - * @param {google.devtools.cloudbuild.v2.Repository} request.repository - * Required. The repository to create. - * @param {string} request.repositoryId - * Required. The ID to use for the repository, which will become the final - * component of the repository's resource name. This ID should be unique in - * the connection. Allows alphanumeric characters and any of - * -._~%!$&'()*+,;=@. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/repository_manager.create_repository.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateRepository_async - */ - createRepository( - request?: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createRepository( - request: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRepository( - request: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRepository( - request?: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createRepository(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createRepository()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/repository_manager.create_repository.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateRepository_async - */ - async checkCreateRepositoryProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRepository, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates multiple repositories inside a connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The connection to contain all the repositories being created. - * Format: projects/* /locations/* /connections/* - * The parent field in the CreateRepositoryRequest messages - * must either be empty or match this field. - * @param {number[]} request.requests - * Required. The request messages specifying the repositories 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/v2/repository_manager.batch_create_repositories.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async - */ - batchCreateRepositories( - request?: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchCreateRepositories( - request: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchCreateRepositories( - request: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchCreateRepositories( - request?: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.batchCreateRepositories(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchCreateRepositories()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/repository_manager.batch_create_repositories.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async - */ - async checkBatchCreateRepositoriesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchCreateRepositories, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Repository to delete. - * Format: `projects/* /locations/* /connections/* /repositories/*`. - * @param {string} request.etag - * The current etag of the repository. - * If an etag is provided and does not match the current etag of the - * repository, deletion will be blocked and an ABORTED error will be returned. - * @param {boolean} request.validateOnly - * If set, validate the request, but do not actually post it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/repository_manager.delete_repository.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async - */ - deleteRepository( - request?: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteRepository( - request: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRepository( - request: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRepository( - request?: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteRepository(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteRepository()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/repository_manager.delete_repository.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async - */ - async checkDeleteRepositoryProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRepository, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Connections 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 Connections. - * Format: `projects/* /locations/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.cloudbuild.v2.Connection|Connection}. - * 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 `listConnectionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listConnections( - request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IConnection[], - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest|null, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse - ]>; - listConnections( - request: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IConnection>): void; - listConnections( - request: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IConnection>): void; - listConnections( - request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IConnection>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IConnection>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IConnection[], - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest|null, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listConnections(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 Connections. - * Format: `projects/* /locations/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @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.devtools.cloudbuild.v2.Connection|Connection} 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 `listConnectionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listConnectionsStream( - request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - 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['listConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnections.createStream( - this.innerApiCalls.listConnections as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConnections`, 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 Connections. - * Format: `projects/* /locations/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @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.devtools.cloudbuild.v2.Connection|Connection}. 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/repository_manager.list_connections.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_ListConnections_async - */ - listConnectionsAsync( - request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - 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['listConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnections.asyncIterate( - this.innerApiCalls['listConnections'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists Repositories in a given connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of Repositories. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. - * Expressions must follow API improvement proposal - * [AIP-160](https://google.aip.dev/160). e.g. - * `remote_uri:"https://github.com*"`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.cloudbuild.v2.Repository|Repository}. - * 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 `listRepositoriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listRepositories( - request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository[], - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest|null, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse - ]>; - listRepositories( - request: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): void; - listRepositories( - request: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): void; - listRepositories( - request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository[], - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest|null, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listRepositories(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 Repositories. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. - * Expressions must follow API improvement proposal - * [AIP-160](https://google.aip.dev/160). e.g. - * `remote_uri:"https://github.com*"`. - * @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.devtools.cloudbuild.v2.Repository|Repository} 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 `listRepositoriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listRepositoriesStream( - request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - 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['listRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRepositories.createStream( - this.innerApiCalls.listRepositories as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRepositories`, 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 Repositories. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. - * Expressions must follow API improvement proposal - * [AIP-160](https://google.aip.dev/160). e.g. - * `remote_uri:"https://github.com*"`. - * @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.devtools.cloudbuild.v2.Repository|Repository}. 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/repository_manager.list_repositories.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_ListRepositories_async - */ - listRepositoriesAsync( - request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - 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['listRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRepositories.asyncIterate( - this.innerApiCalls['listRepositories'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * FetchLinkableRepositories get repositories from SCM that are - * accessible and could be added to the connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.connection - * Required. The name of the Connection. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. Default to 20. - * @param {string} request.pageToken - * Page start. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.devtools.cloudbuild.v2.Repository|Repository}. - * 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 `fetchLinkableRepositoriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - fetchLinkableRepositories( - request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository[], - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest|null, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse - ]>; - fetchLinkableRepositories( - request: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): void; - fetchLinkableRepositories( - request: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): void; - fetchLinkableRepositories( - request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository[], - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest|null, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'connection': request.connection ?? '', - }); - this.initialize(); - return this.innerApiCalls.fetchLinkableRepositories(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.connection - * Required. The name of the Connection. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. Default to 20. - * @param {string} request.pageToken - * Page start. - * @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.devtools.cloudbuild.v2.Repository|Repository} 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 `fetchLinkableRepositoriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - fetchLinkableRepositoriesStream( - request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - 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({ - 'connection': request.connection ?? '', - }); - const defaultCallSettings = this._defaults['fetchLinkableRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.fetchLinkableRepositories.createStream( - this.innerApiCalls.fetchLinkableRepositories as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `fetchLinkableRepositories`, 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.connection - * Required. The name of the Connection. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. Default to 20. - * @param {string} request.pageToken - * Page start. - * @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.devtools.cloudbuild.v2.Repository|Repository}. 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/repository_manager.fetch_linkable_repositories.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async - */ - fetchLinkableRepositoriesAsync( - request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - 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({ - 'connection': request.connection ?? '', - }); - const defaultCallSettings = this._defaults['fetchLinkableRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.fetchLinkableRepositories.asyncIterate( - this.innerApiCalls['fetchLinkableRepositories'] 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 connection resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} connection - * @returns {string} Resource name string. - */ - connectionPath(project:string,location:string,connection:string) { - return this.pathTemplates.connectionPathTemplate.render({ - project: project, - location: location, - connection: connection, - }); - } - - /** - * Parse the project from Connection resource. - * - * @param {string} connectionName - * A fully-qualified path representing Connection resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConnectionName(connectionName: string) { - return this.pathTemplates.connectionPathTemplate.match(connectionName).project; - } - - /** - * Parse the location from Connection resource. - * - * @param {string} connectionName - * A fully-qualified path representing Connection resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConnectionName(connectionName: string) { - return this.pathTemplates.connectionPathTemplate.match(connectionName).location; - } - - /** - * Parse the connection from Connection resource. - * - * @param {string} connectionName - * A fully-qualified path representing Connection resource. - * @returns {string} A string representing the connection. - */ - matchConnectionFromConnectionName(connectionName: string) { - return this.pathTemplates.connectionPathTemplate.match(connectionName).connection; - } - - /** - * 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} connection - * @param {string} repository - * @returns {string} Resource name string. - */ - repositoryPath(project:string,location:string,connection:string,repository:string) { - return this.pathTemplates.repositoryPathTemplate.render({ - project: project, - location: location, - connection: connection, - 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 connection from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the connection. - */ - matchConnectionFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).connection; - } - - /** - * 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 secretVersion resource name string. - * - * @param {string} project - * @param {string} secret - * @param {string} version - * @returns {string} Resource name string. - */ - secretVersionPath(project:string,secret:string,version:string) { - return this.pathTemplates.secretVersionPathTemplate.render({ - project: project, - secret: secret, - version: version, - }); - } - - /** - * Parse the project from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).project; - } - - /** - * Parse the secret from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the secret. - */ - matchSecretFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).secret; - } - - /** - * Parse the version from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the version. - */ - matchVersionFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).version; - } - - /** - * Return a fully-qualified service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} namespace - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,namespace:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - namespace: namespace, - 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 namespace from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the namespace. - */ - matchNamespaceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).namespace; - } - - /** - * 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.repositoryManagerStub && !this._terminated) { - return this.repositoryManagerStub.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-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json deleted file mode 100644 index 6049df136e9..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "interfaces": { - "google.devtools.cloudbuild.v2.RepositoryManager": { - "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": { - "CreateConnection": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetConnection": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListConnections": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateConnection": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteConnection": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateRepository": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchCreateRepositories": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetRepository": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListRepositories": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteRepository": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "FetchReadWriteToken": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "FetchReadToken": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "FetchLinkableRepositories": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "FetchGitRefs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json deleted file mode 100644 index 12097f770a6..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/devtools/cloudbuild/v2/cloudbuild.proto", - "../../protos/google/devtools/cloudbuild/v2/repositories.proto" -] diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 20dca8dade6..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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 cloudbuild = require('@google-cloud/cloudbuild'); - -function main() { - const repositoryManagerClient = new cloudbuild.RepositoryManagerClient(); -} - -main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 8c673824940..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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 {RepositoryManagerClient} from '@google-cloud/cloudbuild'; - -// check that the client class type name can be used -function doStuffWithRepositoryManagerClient(client: RepositoryManagerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const repositoryManagerClient = new RepositoryManagerClient(); - doStuffWithRepositoryManagerClient(repositoryManagerClient); -} - -main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts deleted file mode 100644 index da45ca63502..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts +++ /dev/null @@ -1,3384 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 repositorymanagerModule 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.RepositoryManagerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = repositorymanagerModule.v2.RepositoryManagerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = repositorymanagerModule.v2.RepositoryManagerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = repositorymanagerModule.v2.RepositoryManagerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.repositoryManagerStub, undefined); - await client.initialize(); - assert(client.repositoryManagerStub); - }); - - it('has close method for the initialized client', done => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.repositoryManagerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.repositoryManagerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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('getConnection', () => { - it('invokes getConnection without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.Connection() - ); - client.innerApiCalls.getConnection = stubSimpleCall(expectedResponse); - const [response] = await client.getConnection(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnection without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.Connection() - ); - client.innerApiCalls.getConnection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnection( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IConnection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnection with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnection with closed client', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConnection(request), expectedError); - }); - }); - - describe('getRepository', () => { - it('invokes getRepository without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.Repository() - ); - client.innerApiCalls.getRepository = stubSimpleCall(expectedResponse); - const [response] = await client.getRepository(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.Repository() - ); - client.innerApiCalls.getRepository = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRepository( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRepository = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository with closed client', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getRepository(request), expectedError); - }); - }); - - describe('fetchReadWriteToken', () => { - it('invokes fetchReadWriteToken without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse() - ); - client.innerApiCalls.fetchReadWriteToken = stubSimpleCall(expectedResponse); - const [response] = await client.fetchReadWriteToken(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadWriteToken without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse() - ); - client.innerApiCalls.fetchReadWriteToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchReadWriteToken( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadWriteToken with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchReadWriteToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchReadWriteToken(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadWriteToken with closed client', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.fetchReadWriteToken(request), expectedError); - }); - }); - - describe('fetchReadToken', () => { - it('invokes fetchReadToken without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenResponse() - ); - client.innerApiCalls.fetchReadToken = stubSimpleCall(expectedResponse); - const [response] = await client.fetchReadToken(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadToken without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenResponse() - ); - client.innerApiCalls.fetchReadToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchReadToken( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadToken with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchReadToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchReadToken(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadToken with closed client', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.fetchReadToken(request), expectedError); - }); - }); - - describe('fetchGitRefs', () => { - it('invokes fetchGitRefs without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsResponse() - ); - client.innerApiCalls.fetchGitRefs = stubSimpleCall(expectedResponse); - const [response] = await client.fetchGitRefs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchGitRefs without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsResponse() - ); - client.innerApiCalls.fetchGitRefs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchGitRefs( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchGitRefs with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchGitRefs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchGitRefs(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchGitRefs with closed client', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); - request.repository = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.fetchGitRefs(request), expectedError); - }); - }); - - describe('createConnection', () => { - it('invokes createConnection without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.createConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnection without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnection with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnection with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateConnectionProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateConnectionProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateConnection', () => { - it('invokes updateConnection without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() - ); - request.connection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); - request.connection.name = defaultValue1; - const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnection without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() - ); - request.connection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); - request.connection.name = defaultValue1; - const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnection with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() - ); - request.connection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); - request.connection.name = defaultValue1; - const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnection with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() - ); - request.connection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); - request.connection.name = defaultValue1; - const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateConnectionProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateConnectionProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteConnection', () => { - it('invokes deleteConnection without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnection without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnection with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnection with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteConnectionProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteConnectionProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createRepository', () => { - it('invokes createRepository without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRepository = stubLongRunningCall(expectedResponse); - const [operation] = await client.createRepository(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRepository = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRepository( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRepository = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRepository = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createRepository(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateRepositoryProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateRepositoryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateRepositoryProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateRepositoryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchCreateRepositories', () => { - it('invokes batchCreateRepositories without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchCreateRepositories(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateRepositories without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchCreateRepositories = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchCreateRepositories( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateRepositories with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchCreateRepositories(request), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateRepositories with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchCreateRepositories(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkBatchCreateRepositoriesProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchCreateRepositoriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchCreateRepositoriesProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchCreateRepositoriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteRepository', () => { - it('invokes deleteRepository without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRepository = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteRepository(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRepository = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRepository( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteRepository(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteRepositoryProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteRepositoryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteRepositoryProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteRepositoryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listConnections', () => { - it('invokes listConnections without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - ]; - client.innerApiCalls.listConnections = stubSimpleCall(expectedResponse); - const [response] = await client.listConnections(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnections without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - ]; - client.innerApiCalls.listConnections = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConnections( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IConnection[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnections with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConnections = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConnections(request), expectedError); - const actualRequest = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectionsStream without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - ]; - client.descriptors.page.listConnections.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Connection[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Connection) => { - 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.listConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnections, request)); - assert( - (client.descriptors.page.listConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listConnectionsStream with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnections.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Connection[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Connection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnections, request)); - assert( - (client.descriptors.page.listConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnections without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - ]; - client.descriptors.page.listConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v2.IConnection[] = []; - const iterable = client.listConnectionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnections with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConnectionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v2.IConnection[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listRepositories', () => { - it('invokes listRepositories without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.innerApiCalls.listRepositories = stubSimpleCall(expectedResponse); - const [response] = await client.listRepositories(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositories without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.innerApiCalls.listRepositories = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRepositories( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositories with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRepositories = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRepositories(request), expectedError); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositoriesStream without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { - 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.listRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); - assert( - (client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRepositoriesStream with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); - assert( - (client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRepositories without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; - const iterable = client.listRepositoriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRepositories with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRepositoriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('fetchLinkableRepositories', () => { - it('invokes fetchLinkableRepositories without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.innerApiCalls.fetchLinkableRepositories = stubSimpleCall(expectedResponse); - const [response] = await client.fetchLinkableRepositories(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchLinkableRepositories without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.innerApiCalls.fetchLinkableRepositories = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchLinkableRepositories( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchLinkableRepositories with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchLinkableRepositories = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchLinkableRepositories(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchLinkableRepositoriesStream without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.descriptors.page.fetchLinkableRepositories.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.fetchLinkableRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { - 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.fetchLinkableRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchLinkableRepositories, request)); - assert( - (client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes fetchLinkableRepositoriesStream with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchLinkableRepositories.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.fetchLinkableRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchLinkableRepositories, request)); - assert( - (client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with fetchLinkableRepositories without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.descriptors.page.fetchLinkableRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; - const iterable = client.fetchLinkableRepositoriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with fetchLinkableRepositories with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchLinkableRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.fetchLinkableRepositoriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchLinkableRepositories.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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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('connection', () => { - const fakePath = "/rendered/path/connection"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connection: "connectionValue", - }; - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.connectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.connectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('connectionPath', () => { - const result = client.connectionPath("projectValue", "locationValue", "connectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.connectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConnectionName', () => { - const result = client.matchProjectFromConnectionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConnectionName', () => { - const result = client.matchLocationFromConnectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConnectionFromConnectionName', () => { - const result = client.matchConnectionFromConnectionName(fakePath); - assert.strictEqual(result, "connectionValue"); - assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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", - connection: "connectionValue", - repository: "repositoryValue", - }; - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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", "connectionValue", "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('matchConnectionFromRepositoryName', () => { - const result = client.matchConnectionFromRepositoryName(fakePath); - assert.strictEqual(result, "connectionValue"); - 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('secretVersion', () => { - const fakePath = "/rendered/path/secretVersion"; - const expectedParameters = { - project: "projectValue", - secret: "secretValue", - version: "versionValue", - }; - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.secretVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.secretVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('secretVersionPath', () => { - const result = client.secretVersionPath("projectValue", "secretValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.secretVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSecretVersionName', () => { - const result = client.matchProjectFromSecretVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecretFromSecretVersionName', () => { - const result = client.matchSecretFromSecretVersionName(fakePath); - assert.strictEqual(result, "secretValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromSecretVersionName', () => { - const result = client.matchVersionFromSecretVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - namespace: "namespaceValue", - service: "serviceValue", - }; - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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", "namespaceValue", "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('matchNamespaceFromServiceName', () => { - const result = client.matchNamespaceFromServiceName(fakePath); - assert.strictEqual(result, "namespaceValue"); - 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-devtools-cloudbuild/v2/tsconfig.json b/owl-bot-staging/google-devtools-cloudbuild/v2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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-devtools-cloudbuild/v2/webpack.config.js b/owl-bot-staging/google-devtools-cloudbuild/v2/webpack.config.js deleted file mode 100644 index 0c12d4dc6a9..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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: 'RepositoryManager', - filename: './repository-manager.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-devtools-containeranalysis/v1/.eslintignore b/owl-bot-staging/google-devtools-containeranalysis/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1/.eslintrc.json b/owl-bot-staging/google-devtools-containeranalysis/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/.gitignore b/owl-bot-staging/google-devtools-containeranalysis/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1/.jsdoc.js b/owl-bot-staging/google-devtools-containeranalysis/v1/.jsdoc.js deleted file mode 100644 index bc16644d92f..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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/containeranalysis', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/.mocharc.js b/owl-bot-staging/google-devtools-containeranalysis/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1/.prettierrc.js b/owl-bot-staging/google-devtools-containeranalysis/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1/README.md b/owl-bot-staging/google-devtools-containeranalysis/v1/README.md deleted file mode 100644 index dc843b72155..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Containeranalysis: Nodejs Client diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/package.json b/owl-bot-staging/google-devtools-containeranalysis/v1/package.json deleted file mode 100644 index da07327d309..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@google-cloud/containeranalysis", - "version": "0.1.0", - "description": "Containeranalysis client for Node.js", - "repository": "googleapis/nodejs-containeranalysis", - "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 containeranalysis", - "containeranalysis", - "container analysis", - "grafeas" - ], - "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-devtools-containeranalysis/v1/protos/google/devtools/containeranalysis/v1/containeranalysis.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/google/devtools/containeranalysis/v1/containeranalysis.proto deleted file mode 100644 index c1bda557cd6..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/google/devtools/containeranalysis/v1/containeranalysis.proto +++ /dev/null @@ -1,156 +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.devtools.containeranalysis.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 "grafeas/v1/severity.proto"; - -option csharp_namespace = "Google.Cloud.DevTools.ContainerAnalysis.V1"; -option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis"; -option java_multiple_files = true; -option java_package = "com.google.containeranalysis.v1"; -option objc_class_prefix = "GCA"; -option ruby_package = "Google::Cloud::ContainerAnalysis::V1"; -option php_namespace = "Google\\Cloud\\ContainerAnalysis\\V1"; - -// Retrieves analysis results of Cloud components such as Docker container -// images. The Container Analysis API is an implementation of the -// [Grafeas](https://grafeas.io) API. -// -// Analysis results are stored as a series of occurrences. An `Occurrence` -// contains information about a specific analysis instance on a resource. An -// occurrence refers to a `Note`. A note contains details describing the -// analysis and is generally stored in a separate project, called a `Provider`. -// Multiple occurrences can refer to the same note. -// -// For example, an SSL vulnerability could affect multiple images. In this case, -// there would be one note for the vulnerability and an occurrence for each -// image with the vulnerability referring to that note. -service ContainerAnalysis { - option (google.api.default_host) = "containeranalysis.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Sets the access control policy on the specified note or occurrence. - // Requires `containeranalysis.notes.setIamPolicy` or - // `containeranalysis.occurrences.setIamPolicy` permission if the resource is - // a note or an occurrence, respectively. - // - // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - // occurrences. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/notes/*}:setIamPolicy" - body: "*" - additional_bindings { - post: "/v1/{resource=projects/*/occurrences/*}:setIamPolicy" - body: "*" - } - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Gets the access control policy for a note or an occurrence resource. - // Requires `containeranalysis.notes.setIamPolicy` or - // `containeranalysis.occurrences.setIamPolicy` permission if the resource is - // a note or occurrence, respectively. - // - // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - // occurrences. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/notes/*}:getIamPolicy" - body: "*" - additional_bindings { - post: "/v1/{resource=projects/*/occurrences/*}:getIamPolicy" - body: "*" - } - }; - option (google.api.method_signature) = "resource"; - } - - // Returns the permissions that a caller has on the specified note or - // occurrence. Requires list permission on the project (for example, - // `containeranalysis.notes.list`). - // - // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - // occurrences. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/notes/*}:testIamPermissions" - body: "*" - additional_bindings { - post: "/v1/{resource=projects/*/occurrences/*}:testIamPermissions" - body: "*" - } - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Gets a summary of the number and severity of occurrences. - rpc GetVulnerabilityOccurrencesSummary(GetVulnerabilityOccurrencesSummaryRequest) returns (VulnerabilityOccurrencesSummary) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/occurrences:vulnerabilitySummary" - }; - option (google.api.method_signature) = "parent,filter"; - } -} - -// Request to get a vulnerability summary for some set of occurrences. -message GetVulnerabilityOccurrencesSummaryRequest { - // Required. The name of the project to get a vulnerability summary for in the form of - // `projects/[PROJECT_ID]`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // The filter expression. - string filter = 2; -} - -// A summary of how many vulnerability occurrences there are per resource and -// severity type. -message VulnerabilityOccurrencesSummary { - // Per resource and severity counts of fixable and total vulnerabilities. - message FixableTotalByDigest { - // The affected resource. - string resource_uri = 1; - - // The severity for this count. SEVERITY_UNSPECIFIED indicates total across - // all severities. - grafeas.v1.Severity severity = 2; - - // The number of fixable vulnerabilities associated with this resource. - int64 fixable_count = 3; - - // The total number of vulnerabilities associated with this resource. - int64 total_count = 4; - } - - // A listing by resource of the number of fixable and total vulnerabilities. - repeated FixableTotalByDigest counts = 1; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/attestation.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/attestation.proto deleted file mode 100644 index f2854fe686b..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/attestation.proto +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "grafeas/v1/common.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// An attestation wrapper with a PGP-compatible signature. This message only -// supports `ATTACHED` signatures, where the payload that is signed is included -// alongside the signature itself in the same file. - -// Note kind that represents a logical attestation "role" or "authority". For -// example, an organization might have one `Authority` for "QA" and one for -// "build". This note is intended to act strictly as a grouping mechanism for -// the attached occurrences (Attestations). This grouping mechanism also -// provides a security boundary, since IAM ACLs gate the ability for a principle -// to attach an occurrence to a given note. It also provides a single point of -// lookup to find all attached attestation occurrences, even if they don't all -// live in the same project. -message AttestationNote { - // This submessage provides human-readable hints about the purpose of the - // authority. Because the name of a note acts as its resource reference, it is - // important to disambiguate the canonical name of the Note (which might be a - // UUID for security purposes) from "readable" names more suitable for debug - // output. Note that these hints should not be used to look up authorities in - // security sensitive contexts, such as when looking up attestations to - // verify. - message Hint { - // Required. The human readable name of this attestation authority, for - // example "qa". - string human_readable_name = 1; - } - - // Hint hints at the purpose of the attestation authority. - Hint hint = 1; -} - -message Jwt { - // The compact encoding of a JWS, which is always three base64 encoded strings - // joined by periods. For details, see: - // https://tools.ietf.org/html/rfc7515.html#section-3.1 - string compact_jwt = 1; -} - -// Occurrence that represents a single "attestation". The authenticity of an -// attestation can be verified using the attached signature. If the verifier -// trusts the public key of the signer, then verifying the signature is -// sufficient to establish trust. In this circumstance, the authority to which -// this attestation is attached is primarily useful for lookup (how to find -// this attestation if you already know the authority and artifact to be -// verified) and intent (for which authority this attestation was intended to -// sign. -message AttestationOccurrence { - // Required. The serialized payload that is verified by one or more - // `signatures`. - bytes serialized_payload = 1; - // One or more signatures over `serialized_payload`. Verifier implementations - // should consider this attestation message verified if at least one - // `signature` verifies `serialized_payload`. See `Signature` in common.proto - // for more details on signature structure and verification. - repeated Signature signatures = 2; - // One or more JWTs encoding a self-contained attestation. - // Each JWT encodes the payload that it verifies within the JWT itself. - // Verifier implementation SHOULD ignore the `serialized_payload` field - // when verifying these JWTs. - // If only JWTs are present on this AttestationOccurrence, then the - // `serialized_payload` SHOULD be left empty. - // Each JWT SHOULD encode a claim specific to the `resource_uri` of this - // Occurrence, but this is not validated by Grafeas metadata API - // implementations. The JWT itself is opaque to Grafeas. - repeated Jwt jwts = 3; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/build.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/build.proto deleted file mode 100644 index 172637fd459..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/build.proto +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "grafeas/v1/intoto_provenance.proto"; -import "grafeas/v1/intoto_statement.proto"; -import "grafeas/v1/provenance.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// Note holding the version of the provider's builder and the signature of the -// provenance message in the build details occurrence. -message BuildNote { - // Required. Immutable. Version of the builder which produced this build. - string builder_version = 1; -} - -// Details of a build occurrence. -message BuildOccurrence { - // The actual provenance for the build. - grafeas.v1.BuildProvenance provenance = 1; - - // Serialized JSON representation of the provenance, used in generating the - // build signature in the corresponding build note. After verifying the - // signature, `provenance_bytes` can be unmarshalled and compared to the - // provenance to confirm that it is unchanged. A base64-encoded string - // representation of the provenance bytes is used for the signature in order - // to interoperate with openssl which expects this format for signature - // verification. - // - // The serialized form is captured both to avoid ambiguity in how the - // provenance is marshalled to json as well to prevent incompatibilities with - // future changes. - string provenance_bytes = 2; - - // Deprecated. See InTotoStatement for the replacement. - // In-toto Provenance representation as defined in spec. - InTotoProvenance intoto_provenance = 3; - - // In-toto Statement representation as defined in spec. - // The intoto_statement can contain any type of provenance. The serialized - // payload of the statement can be stored and signed in the Occurrence's - // envelope. - InTotoStatement intoto_statement = 4; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/common.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/common.proto deleted file mode 100644 index 1464ecc9be2..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/common.proto +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// Kind represents the kinds of notes supported. -enum NoteKind { - // Default value. This value is unused. - NOTE_KIND_UNSPECIFIED = 0; - // The note and occurrence represent a package vulnerability. - VULNERABILITY = 1; - // The note and occurrence assert build provenance. - BUILD = 2; - // This represents an image basis relationship. - IMAGE = 3; - // This represents a package installed via a package manager. - PACKAGE = 4; - // The note and occurrence track deployment events. - DEPLOYMENT = 5; - // The note and occurrence track the initial discovery status of a resource. - DISCOVERY = 6; - // This represents a logical "role" that can attest to artifacts. - ATTESTATION = 7; - // This represents an available package upgrade. - UPGRADE = 8; - // This represents a Compliance Note - COMPLIANCE = 9; - // This represents a DSSE attestation Note - DSSE_ATTESTATION = 10; - // This represents a Vulnerability Assessment. - VULNERABILITY_ASSESSMENT = 11; -} - -// Metadata for any related URL information. -message RelatedUrl { - // Specific URL associated with the resource. - string url = 1; - // Label to describe usage of the URL. - string label = 2; -} - -// Verifiers (e.g. Kritis implementations) MUST verify signatures -// with respect to the trust anchors defined in policy (e.g. a Kritis policy). -// Typically this means that the verifier has been configured with a map from -// `public_key_id` to public key material (and any required parameters, e.g. -// signing algorithm). -// -// In particular, verification implementations MUST NOT treat the signature -// `public_key_id` as anything more than a key lookup hint. The `public_key_id` -// DOES NOT validate or authenticate a public key; it only provides a mechanism -// for quickly selecting a public key ALREADY CONFIGURED on the verifier through -// a trusted channel. Verification implementations MUST reject signatures in any -// of the following circumstances: -// * The `public_key_id` is not recognized by the verifier. -// * The public key that `public_key_id` refers to does not verify the -// signature with respect to the payload. -// -// The `signature` contents SHOULD NOT be "attached" (where the payload is -// included with the serialized `signature` bytes). Verifiers MUST ignore any -// "attached" payload and only verify signatures with respect to explicitly -// provided payload (e.g. a `payload` field on the proto message that holds -// this Signature, or the canonical serialization of the proto message that -// holds this signature). -message Signature { - // The content of the signature, an opaque bytestring. - // The payload that this signature verifies MUST be unambiguously provided - // with the Signature during verification. A wrapper message might provide - // the payload explicitly. Alternatively, a message might have a canonical - // serialization that can always be unambiguously computed to derive the - // payload. - bytes signature = 1; - - // The identifier for the public key that verifies this signature. - // * The `public_key_id` is required. - // * The `public_key_id` SHOULD be an RFC3986 conformant URI. - // * When possible, the `public_key_id` SHOULD be an immutable reference, - // such as a cryptographic digest. - // - // Examples of valid `public_key_id`s: - // - // OpenPGP V4 public key fingerprint: - // * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" - // See https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr for more - // details on this scheme. - // - // RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER - // serialization): - // * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU" - // * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5" - string public_key_id = 2; -} - -// MUST match -// https://github.com/secure-systems-lab/dsse/blob/master/envelope.proto. An -// authenticated message of arbitrary type. -message Envelope { - bytes payload = 1; - string payload_type = 2; - repeated EnvelopeSignature signatures = 3; -} - -message EnvelopeSignature { - bytes sig = 1; - string keyid = 2; -} - -// Indicates the location at which a package was found. -message FileLocation { - // For jars that are contained inside .war files, this filepath - // can indicate the path to war file combined with the path to jar file. - string file_path = 1; -} - -// License information. -message License { - // Often a single license can be used to represent the licensing terms. - // Sometimes it is necessary to include a choice of one or more licenses - // or some combination of license identifiers. - // Examples: "LGPL-2.1-only OR MIT", "LGPL-2.1-only AND MIT", - // "GPL-2.0-or-later WITH Bison-exception-2.2". - string expression = 1; - - // Comments - string comments = 2; -} - -// Digest information. -message Digest { - // `SHA1`, `SHA512` etc. - string algo = 1; - - // Value of the digest. - bytes digest_bytes = 2; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/compliance.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/compliance.proto deleted file mode 100644 index 688fa82596b..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/compliance.proto +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2021 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "grafeas/v1/severity.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -message ComplianceNote { - // The title that identifies this compliance check. - string title = 1; - // A description about this compliance check. - string description = 2; - // The OS and config versions the benchmark applies to. - repeated grafeas.v1.ComplianceVersion version = 3; - // A rationale for the existence of this compliance check. - string rationale = 4; - // A description of remediation steps if the compliance check fails. - string remediation = 5; - // A compliance check that is a CIS benchmark. - message CisBenchmark { - int32 profile_level = 1; - grafeas.v1.Severity severity = 2; - } - oneof compliance_type { - CisBenchmark cis_benchmark = 6; - } - // Serialized scan instructions with a predefined format. - bytes scan_instructions = 7; -} - -// Describes the CIS benchmark version that is applicable to a given OS and -// os version. -message ComplianceVersion { - // The CPE URI (https://cpe.mitre.org/specification/) this benchmark is - // applicable to. - string cpe_uri = 1; - // The name of the document that defines this benchmark, e.g. "CIS - // Container-Optimized OS". - string benchmark_document = 3; - // The version of the benchmark. This is set to the version of the OS-specific - // CIS document the benchmark is defined in. - string version = 2; -} - -// An indication that the compliance checks in the associated ComplianceNote -// were not satisfied for particular resources or a specified reason. -message ComplianceOccurrence { - repeated NonCompliantFile non_compliant_files = 2; - string non_compliance_reason = 3; -} - -// Details about files that caused a compliance check to fail. -message NonCompliantFile { - // display_command is a single command that can be used to display a list of - // non compliant files. When there is no such command, we can also iterate a - // list of non compliant file using 'path'. - - // Empty if `display_command` is set. - string path = 1; - // Command to display the non-compliant files. - string display_command = 2; - // Explains why a file is non compliant for a CIS check. - string reason = 3; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/cvss.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/cvss.proto deleted file mode 100644 index a9d018eee6d..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/cvss.proto +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; -option java_outer_classname = "CVSSProto"; - -// Common Vulnerability Scoring System version 3. -// For details, see https://www.first.org/cvss/specification-document -message CVSSv3 { - // The base score is a function of the base metric scores. - float base_score = 1; - - float exploitability_score = 2; - - float impact_score = 3; - - // Base Metrics - // Represents the intrinsic characteristics of a vulnerability that are - // constant over time and across user environments. - AttackVector attack_vector = 5; - AttackComplexity attack_complexity = 6; - PrivilegesRequired privileges_required = 7; - UserInteraction user_interaction = 8; - Scope scope = 9; - Impact confidentiality_impact = 10; - Impact integrity_impact = 11; - Impact availability_impact = 12; - - enum AttackVector { - ATTACK_VECTOR_UNSPECIFIED = 0; - ATTACK_VECTOR_NETWORK = 1; - ATTACK_VECTOR_ADJACENT = 2; - ATTACK_VECTOR_LOCAL = 3; - ATTACK_VECTOR_PHYSICAL = 4; - } - - enum AttackComplexity { - ATTACK_COMPLEXITY_UNSPECIFIED = 0; - ATTACK_COMPLEXITY_LOW = 1; - ATTACK_COMPLEXITY_HIGH = 2; - } - - enum PrivilegesRequired { - PRIVILEGES_REQUIRED_UNSPECIFIED = 0; - PRIVILEGES_REQUIRED_NONE = 1; - PRIVILEGES_REQUIRED_LOW = 2; - PRIVILEGES_REQUIRED_HIGH = 3; - } - - enum UserInteraction { - USER_INTERACTION_UNSPECIFIED = 0; - USER_INTERACTION_NONE = 1; - USER_INTERACTION_REQUIRED = 2; - } - - enum Scope { - SCOPE_UNSPECIFIED = 0; - SCOPE_UNCHANGED = 1; - SCOPE_CHANGED = 2; - } - - enum Impact { - IMPACT_UNSPECIFIED = 0; - IMPACT_HIGH = 1; - IMPACT_LOW = 2; - IMPACT_NONE = 3; - } -} - -// Common Vulnerability Scoring System. -// For details, see https://www.first.org/cvss/specification-document -// This is a message we will try to use for storing various versions of CVSS -// rather than making a separate proto for storing a specific version. -message CVSS { - // The base score is a function of the base metric scores. - float base_score = 1; - - float exploitability_score = 2; - - float impact_score = 3; - - // Base Metrics - // Represents the intrinsic characteristics of a vulnerability that are - // constant over time and across user environments. - AttackVector attack_vector = 4; - AttackComplexity attack_complexity = 5; - Authentication authentication = 6; - PrivilegesRequired privileges_required = 7; - UserInteraction user_interaction = 8; - Scope scope = 9; - Impact confidentiality_impact = 10; - Impact integrity_impact = 11; - Impact availability_impact = 12; - - enum AttackVector { - ATTACK_VECTOR_UNSPECIFIED = 0; - ATTACK_VECTOR_NETWORK = 1; - ATTACK_VECTOR_ADJACENT = 2; - ATTACK_VECTOR_LOCAL = 3; - ATTACK_VECTOR_PHYSICAL = 4; - } - - enum AttackComplexity { - ATTACK_COMPLEXITY_UNSPECIFIED = 0; - ATTACK_COMPLEXITY_LOW = 1; - ATTACK_COMPLEXITY_HIGH = 2; - ATTACK_COMPLEXITY_MEDIUM = 3; - } - - enum Authentication { - AUTHENTICATION_UNSPECIFIED = 0; - AUTHENTICATION_MULTIPLE = 1; - AUTHENTICATION_SINGLE = 2; - AUTHENTICATION_NONE = 3; - } - - enum PrivilegesRequired { - PRIVILEGES_REQUIRED_UNSPECIFIED = 0; - PRIVILEGES_REQUIRED_NONE = 1; - PRIVILEGES_REQUIRED_LOW = 2; - PRIVILEGES_REQUIRED_HIGH = 3; - } - - enum UserInteraction { - USER_INTERACTION_UNSPECIFIED = 0; - USER_INTERACTION_NONE = 1; - USER_INTERACTION_REQUIRED = 2; - } - - enum Scope { - SCOPE_UNSPECIFIED = 0; - SCOPE_UNCHANGED = 1; - SCOPE_CHANGED = 2; - } - - enum Impact { - IMPACT_UNSPECIFIED = 0; - IMPACT_HIGH = 1; - IMPACT_LOW = 2; - IMPACT_NONE = 3; - IMPACT_PARTIAL = 4; - IMPACT_COMPLETE = 5; - } -} - -// CVSS Version. -enum CVSSVersion { - CVSS_VERSION_UNSPECIFIED = 0; - CVSS_VERSION_2 = 1; - CVSS_VERSION_3 = 2; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/deployment.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/deployment.proto deleted file mode 100644 index 5204004fd64..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/deployment.proto +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// An artifact that can be deployed in some runtime. -message DeploymentNote { - // Required. Resource URI for the artifact being deployed. - repeated string resource_uri = 1; -} - -// The period during which some deployable was active in a runtime. -message DeploymentOccurrence { - // Identity of the user that triggered this deployment. - string user_email = 1; - - // Required. Beginning of the lifetime of this deployment. - google.protobuf.Timestamp deploy_time = 2; - - // End of the lifetime of this deployment. - google.protobuf.Timestamp undeploy_time = 3; - - // Configuration used to create this deployment. - string config = 4; - - // Address of the runtime element hosting this deployment. - string address = 5; - - // Output only. Resource URI for the artifact being deployed taken from - // the deployable field with the same name. - repeated string resource_uri = 6; - - // Types of platforms. - enum Platform { - // Unknown. - PLATFORM_UNSPECIFIED = 0; - // Google Container Engine. - GKE = 1; - // Google App Engine: Flexible Environment. - FLEX = 2; - // Custom user-defined platform. - CUSTOM = 3; - } - // Platform hosting this deployment. - Platform platform = 7; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/discovery.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/discovery.proto deleted file mode 100644 index bfb94e4a347..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/discovery.proto +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "grafeas/v1/common.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// A note that indicates a type of analysis a provider would perform. This note -// exists in a provider's project. A `Discovery` occurrence is created in a -// consumer's project at the start of analysis. -message DiscoveryNote { - // Required. Immutable. The kind of analysis that is handled by this - // discovery. - grafeas.v1.NoteKind analysis_kind = 1; -} - -// Provides information about the analysis status of a discovered resource. -message DiscoveryOccurrence { - // Whether the resource is continuously analyzed. - enum ContinuousAnalysis { - // Unknown. - CONTINUOUS_ANALYSIS_UNSPECIFIED = 0; - // The resource is continuously analyzed. - ACTIVE = 1; - // The resource is ignored for continuous analysis. - INACTIVE = 2; - } - - // Whether the resource is continuously analyzed. - ContinuousAnalysis continuous_analysis = 1; - - // Analysis status for a resource. Currently for initial analysis only (not - // updated in continuous analysis). - enum AnalysisStatus { - option allow_alias = true; - - // Unknown. - ANALYSIS_STATUS_UNSPECIFIED = 0; - // Resource is known but no action has been taken yet. - PENDING = 1; - // Resource is being analyzed. - SCANNING = 2; - // Analysis has finished successfully. - FINISHED_SUCCESS = 3; - // Analysis has completed. - COMPLETE = 3; - // Analysis has finished unsuccessfully, the analysis itself is in a bad - // state. - FINISHED_FAILED = 4; - // The resource is known not to be supported. - FINISHED_UNSUPPORTED = 5; - } - - // The status of discovery for the resource. - AnalysisStatus analysis_status = 2; - - // Indicates which analysis completed successfully. Multiple types of - // analysis can be performed on a single resource. - message AnalysisCompleted { - repeated string analysis_type = 1; - } - - AnalysisCompleted analysis_completed = 7; - - // Indicates any errors encountered during analysis of a resource. There - // could be 0 or more of these errors. - repeated google.rpc.Status analysis_error = 8; - - // When an error is encountered this will contain a LocalizedMessage under - // details to show to the user. The LocalizedMessage is output only and - // populated by the API. - google.rpc.Status analysis_status_error = 3; - - // The CPE of the resource being scanned. - string cpe = 4; - - // The last time this resource was scanned. - google.protobuf.Timestamp last_scan_time = 5; - - // The time occurrences related to this discovery occurrence were archived. - google.protobuf.Timestamp archive_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/dsse_attestation.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/dsse_attestation.proto deleted file mode 100644 index 34ba3df9f9b..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/dsse_attestation.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2021 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "grafeas/v1/common.proto"; -import "grafeas/v1/intoto_statement.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -message DSSEAttestationNote { - // This submessage provides human-readable hints about the purpose of the - // authority. Because the name of a note acts as its resource reference, it is - // important to disambiguate the canonical name of the Note (which might be a - // UUID for security purposes) from "readable" names more suitable for debug - // output. Note that these hints should not be used to look up authorities in - // security sensitive contexts, such as when looking up attestations to - // verify. - message DSSEHint { - // Required. The human readable name of this attestation authority, for - // example "cloudbuild-prod". - string human_readable_name = 1; - } - // DSSEHint hints at the purpose of the attestation authority. - DSSEHint hint = 1; -} - -// Deprecated. Prefer to use a regular Occurrence, and populate the -// Envelope at the top level of the Occurrence. -message DSSEAttestationOccurrence { - // If doing something security critical, make sure to verify the signatures in - // this metadata. - Envelope envelope = 1; - oneof decoded_payload { - InTotoStatement statement = 2; - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/grafeas.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/grafeas.proto deleted file mode 100644 index 5ec930e6ef3..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/grafeas.proto +++ /dev/null @@ -1,547 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.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/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "grafeas/v1/attestation.proto"; -import "grafeas/v1/build.proto"; -import "grafeas/v1/common.proto"; -import "grafeas/v1/compliance.proto"; -import "grafeas/v1/deployment.proto"; -import "grafeas/v1/discovery.proto"; -import "grafeas/v1/dsse_attestation.proto"; -import "grafeas/v1/image.proto"; -import "grafeas/v1/package.proto"; -import "grafeas/v1/upgrade.proto"; -import "grafeas/v1/vex.proto"; -import "grafeas/v1/vulnerability.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; -option (google.api.resource_definition) = { - type: "grafeas.io/Project" - pattern: "projects/{project}" -}; - -// [Grafeas](https://grafeas.io) API. -// -// Retrieves analysis results of Cloud components such as Docker container -// images. -// -// Analysis results are stored as a series of occurrences. An `Occurrence` -// contains information about a specific analysis instance on a resource. An -// occurrence refers to a `Note`. A note contains details describing the -// analysis and is generally stored in a separate project, called a `Provider`. -// Multiple occurrences can refer to the same note. -// -// For example, an SSL vulnerability could affect multiple images. In this case, -// there would be one note for the vulnerability and an occurrence for each -// image with the vulnerability referring to that note. -service Grafeas { - option (google.api.default_host) = "containeranalysis.googleapis.com"; - - // Gets the specified occurrence. - rpc GetOccurrence(GetOccurrenceRequest) returns (Occurrence) { - option (google.api.http) = { - get: "/v1/{name=projects/*/occurrences/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists occurrences for the specified project. - rpc ListOccurrences(ListOccurrencesRequest) - returns (ListOccurrencesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/occurrences" - }; - option (google.api.method_signature) = "parent,filter"; - } - - // Deletes the specified occurrence. For example, use this method to delete an - // occurrence when the occurrence is no longer applicable for the given - // resource. - rpc DeleteOccurrence(DeleteOccurrenceRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/occurrences/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new occurrence. - rpc CreateOccurrence(CreateOccurrenceRequest) returns (Occurrence) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/occurrences" - body: "occurrence" - }; - option (google.api.method_signature) = "parent,occurrence"; - } - - // Creates new occurrences in batch. - rpc BatchCreateOccurrences(BatchCreateOccurrencesRequest) - returns (BatchCreateOccurrencesResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/occurrences:batchCreate" - body: "*" - }; - option (google.api.method_signature) = "parent,occurrences"; - } - - // Updates the specified occurrence. - rpc UpdateOccurrence(UpdateOccurrenceRequest) returns (Occurrence) { - option (google.api.http) = { - patch: "/v1/{name=projects/*/occurrences/*}" - body: "occurrence" - }; - option (google.api.method_signature) = "name,occurrence,update_mask"; - } - - // Gets the note attached to the specified occurrence. Consumer projects can - // use this method to get a note that belongs to a provider project. - rpc GetOccurrenceNote(GetOccurrenceNoteRequest) returns (Note) { - option (google.api.http) = { - get: "/v1/{name=projects/*/occurrences/*}/notes" - }; - option (google.api.method_signature) = "name"; - } - - // Gets the specified note. - rpc GetNote(GetNoteRequest) returns (Note) { - option (google.api.http) = { - get: "/v1/{name=projects/*/notes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists notes for the specified project. - rpc ListNotes(ListNotesRequest) returns (ListNotesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/notes" - }; - option (google.api.method_signature) = "parent,filter"; - } - - // Deletes the specified note. - rpc DeleteNote(DeleteNoteRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/notes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new note. - rpc CreateNote(CreateNoteRequest) returns (Note) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/notes" - body: "note" - }; - option (google.api.method_signature) = "parent,note_id,note"; - } - - // Creates new notes in batch. - rpc BatchCreateNotes(BatchCreateNotesRequest) - returns (BatchCreateNotesResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/notes:batchCreate" - body: "*" - }; - option (google.api.method_signature) = "parent,notes"; - } - - // Updates the specified note. - rpc UpdateNote(UpdateNoteRequest) returns (Note) { - option (google.api.http) = { - patch: "/v1/{name=projects/*/notes/*}" - body: "note" - }; - option (google.api.method_signature) = "name,note,update_mask"; - } - - // Lists occurrences referencing the specified note. Provider projects can use - // this method to get all occurrences across consumer projects referencing the - // specified note. - rpc ListNoteOccurrences(ListNoteOccurrencesRequest) - returns (ListNoteOccurrencesResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/notes/*}/occurrences" - }; - option (google.api.method_signature) = "name,filter"; - } -} - -// An instance of an analysis type that has been found on a resource. -message Occurrence { - option (google.api.resource) = { - type: "grafeas.io/Occurrence" - pattern: "projects/{project}/occurrences/{occurrence}" - }; - - // Output only. The name of the occurrence in the form of - // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - string name = 1; - - // Required. Immutable. A URI that represents the resource for which the - // occurrence applies. For example, - // `https://gcr.io/project/image@sha256:123abc` for a Docker image. - string resource_uri = 2; - - // Required. Immutable. The analysis note associated with this occurrence, in - // the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be - // used as a filter in list requests. - string note_name = 3; - - // Output only. This explicitly denotes which of the occurrence details are - // specified. This field can be used as a filter in list requests. - grafeas.v1.NoteKind kind = 4; - - // A description of actions that can be taken to remedy the note. - string remediation = 5; - - // Output only. The time this occurrence was created. - google.protobuf.Timestamp create_time = 6; - - // Output only. The time this occurrence was last updated. - google.protobuf.Timestamp update_time = 7; - - // Required. Immutable. Describes the details of the note kind found on this - // resource. - oneof details { - // Describes a security vulnerability. - grafeas.v1.VulnerabilityOccurrence vulnerability = 8; - // Describes a verifiable build. - grafeas.v1.BuildOccurrence build = 9; - // Describes how this resource derives from the basis in the associated - // note. - grafeas.v1.ImageOccurrence image = 10; - // Describes the installation of a package on the linked resource. - grafeas.v1.PackageOccurrence package = 11; - // Describes the deployment of an artifact on a runtime. - grafeas.v1.DeploymentOccurrence deployment = 12; - // Describes when a resource was discovered. - grafeas.v1.DiscoveryOccurrence discovery = 13; - // Describes an attestation of an artifact. - grafeas.v1.AttestationOccurrence attestation = 14; - // Describes an available package upgrade on the linked resource. - grafeas.v1.UpgradeOccurrence upgrade = 15; - // Describes a compliance violation on a linked resource. - grafeas.v1.ComplianceOccurrence compliance = 16; - // Describes an attestation of an artifact using dsse. - grafeas.v1.DSSEAttestationOccurrence dsse_attestation = 17; - } - - // https://github.com/secure-systems-lab/dsse - grafeas.v1.Envelope envelope = 18; -} - -// A type of analysis that can be done for a resource. -message Note { - option (google.api.resource) = { - type: "grafeas.io/Note" - pattern: "projects/{project}/notes/{note}" - }; - - // Output only. The name of the note in the form of - // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - string name = 1; - - // A one sentence description of this note. - string short_description = 2; - - // A detailed description of this note. - string long_description = 3; - - // Output only. The type of analysis. This field can be used as a filter in - // list requests. - grafeas.v1.NoteKind kind = 4; - - // URLs associated with this note. - repeated grafeas.v1.RelatedUrl related_url = 5; - - // Time of expiration for this note. Empty if note does not expire. - google.protobuf.Timestamp expiration_time = 6; - - // Output only. The time this note was created. This field can be used as a - // filter in list requests. - google.protobuf.Timestamp create_time = 7; - - // Output only. The time this note was last updated. This field can be used as - // a filter in list requests. - google.protobuf.Timestamp update_time = 8; - - // Other notes related to this note. - repeated string related_note_names = 9; - - // Required. Immutable. The type of analysis this note represents. - oneof type { - // A note describing a package vulnerability. - grafeas.v1.VulnerabilityNote vulnerability = 10; - // A note describing build provenance for a verifiable build. - grafeas.v1.BuildNote build = 11; - // A note describing a base image. - grafeas.v1.ImageNote image = 12; - // A note describing a package hosted by various package managers. - grafeas.v1.PackageNote package = 13; - // A note describing something that can be deployed. - grafeas.v1.DeploymentNote deployment = 14; - // A note describing the initial analysis of a resource. - grafeas.v1.DiscoveryNote discovery = 15; - // A note describing an attestation role. - grafeas.v1.AttestationNote attestation = 16; - // A note describing available package upgrades. - grafeas.v1.UpgradeNote upgrade = 17; - // A note describing a compliance check. - grafeas.v1.ComplianceNote compliance = 18; - // A note describing a dsse attestation note. - grafeas.v1.DSSEAttestationNote dsse_attestation = 19; - // A note describing a vulnerability assessment. - grafeas.v1.VulnerabilityAssessmentNote vulnerability_assessment = 20; - } -} - -// Request to get an occurrence. -message GetOccurrenceRequest { - // The name of the occurrence in the form of - // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Occurrence" - ]; -} - -// Request to list occurrences. -message ListOccurrencesRequest { - // The name of the project to list occurrences for in the form of - // `projects/[PROJECT_ID]`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Project" - ]; - - // The filter expression. - string filter = 2; - - // Number of occurrences to return in the list. Must be positive. Max allowed - // page size is 1000. If not specified, page size defaults to 20. - int32 page_size = 3; - - // Token to provide to skip to a particular spot in the list. - string page_token = 4; -} - -// Response for listing occurrences. -message ListOccurrencesResponse { - // The occurrences requested. - repeated Occurrence occurrences = 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 - // results. - string next_page_token = 2; -} - -// Request to delete an occurrence. -message DeleteOccurrenceRequest { - // The name of the occurrence in the form of - // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Occurrence" - ]; -} - -// Request to create a new occurrence. -message CreateOccurrenceRequest { - // The name of the project in the form of `projects/[PROJECT_ID]`, under which - // the occurrence is to be created. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Project" - ]; - // The occurrence to create. - Occurrence occurrence = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to update an occurrence. -message UpdateOccurrenceRequest { - // The name of the occurrence in the form of - // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Occurrence" - ]; - // The updated occurrence. - Occurrence occurrence = 2 [(google.api.field_behavior) = REQUIRED]; - // The fields to update. - google.protobuf.FieldMask update_mask = 3; -} - -// Request to get a note. -message GetNoteRequest { - // The name of the note in the form of - // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Note" - ]; -} - -// Request to get the note to which the specified occurrence is attached. -message GetOccurrenceNoteRequest { - // The name of the occurrence in the form of - // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Occurrence" - ]; -} - -// Request to list notes. -message ListNotesRequest { - // The name of the project to list notes for in the form of - // `projects/[PROJECT_ID]`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Project" - ]; - - // The filter expression. - string filter = 2; - - // Number of notes to return in the list. Must be positive. Max allowed page - // size is 1000. If not specified, page size defaults to 20. - int32 page_size = 3; - - // Token to provide to skip to a particular spot in the list. - string page_token = 4; -} - -// Response for listing notes. -message ListNotesResponse { - // The notes requested. - repeated Note notes = 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 - // results. - string next_page_token = 2; -} - -// Request to delete a note. -message DeleteNoteRequest { - // The name of the note in the form of - // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Note" - ]; -} - -// Request to create a new note. -message CreateNoteRequest { - // The name of the project in the form of `projects/[PROJECT_ID]`, under which - // the note is to be created. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Project" - ]; - // The ID to use for this note. - string note_id = 2 [(google.api.field_behavior) = REQUIRED]; - // The note to create. - Note note = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to update a note. -message UpdateNoteRequest { - // The name of the note in the form of - // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Note" - ]; - // The updated note. - Note note = 2 [(google.api.field_behavior) = REQUIRED]; - // The fields to update. - google.protobuf.FieldMask update_mask = 3; -} - -// Request to list occurrences for a note. -message ListNoteOccurrencesRequest { - // The name of the note to list occurrences for in the form of - // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Note" - ]; - // The filter expression. - string filter = 2; - // Number of occurrences to return in the list. - int32 page_size = 3; - // Token to provide to skip to a particular spot in the list. - string page_token = 4; -} - -// Response for listing occurrences for a note. -message ListNoteOccurrencesResponse { - // The occurrences attached to the specified note. - repeated Occurrence occurrences = 1; - // Token to provide to skip to a particular spot in the list. - string next_page_token = 2; -} - -// Request to create notes in batch. -message BatchCreateNotesRequest { - // The name of the project in the form of `projects/[PROJECT_ID]`, under which - // the notes are to be created. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Project" - ]; - - // The notes to create. Max allowed length is 1000. - map notes = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for creating notes in batch. -message BatchCreateNotesResponse { - // The notes that were created. - repeated Note notes = 1; -} - -// Request to create occurrences in batch. -message BatchCreateOccurrencesRequest { - // The name of the project in the form of `projects/[PROJECT_ID]`, under which - // the occurrences are to be created. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "grafeas.io/Project" - ]; - - // The occurrences to create. Max allowed length is 1000. - repeated Occurrence occurrences = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for creating occurrences in batch. -message BatchCreateOccurrencesResponse { - // The occurrences that were created. - repeated Occurrence occurrences = 1; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/image.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/image.proto deleted file mode 100644 index 9ac162cec22..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/image.proto +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// Layer holds metadata specific to a layer of a Docker image. -message Layer { - // Required. The recovered Dockerfile directive used to construct this layer. - // See https://docs.docker.com/engine/reference/builder/ for more information. - string directive = 1; - - // The recovered arguments to the Dockerfile directive. - string arguments = 2; -} - -// A set of properties that uniquely identify a given Docker image. -message Fingerprint { - // Required. The layer ID of the final layer in the Docker image's v1 - // representation. - string v1_name = 1; - - // Required. The ordered list of v2 blobs that represent a given image. - repeated string v2_blob = 2; - - // Output only. The name of the image's v2 blobs computed via: - // [bottom] := v2_blob[bottom] - // [N] := sha256(v2_blob[N] + " " + v2_name[N+1]) - // Only the name of the final blob is kept. - string v2_name = 3; -} - -// Basis describes the base image portion (Note) of the DockerImage -// relationship. Linked occurrences are derived from this or an equivalent image -// via: -// FROM -// Or an equivalent reference, e.g., a tag of the resource_url. -message ImageNote { - // Required. Immutable. The resource_url for the resource representing the - // basis of associated occurrence images. - string resource_url = 1; - - // Required. Immutable. The fingerprint of the base image. - Fingerprint fingerprint = 2; -} - -// Details of the derived image portion of the DockerImage relationship. This -// image would be produced from a Dockerfile with FROM . -message ImageOccurrence { - // Required. The fingerprint of the derived image. - Fingerprint fingerprint = 1; - - // Output only. The number of layers by which this image differs from the - // associated image basis. - int32 distance = 2; - - // This contains layer-specific metadata, if populated it has length - // "distance" and is ordered with [distance] being the layer immediately - // following the base image and [1] being the final layer. - repeated Layer layer_info = 3; - - // Output only. This contains the base image URL for the derived image - // occurrence. - string base_resource_url = 4; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_provenance.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_provenance.proto deleted file mode 100644 index 78886b66e48..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_provenance.proto +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2021 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; -option java_outer_classname = "InTotoProvenanceProto"; - -// Spec defined at -// https://github.com/in-toto/attestation/blob/main/spec/predicates/provenance.md - -// Steps taken to build the artifact. -// For a TaskRun, typically each container corresponds to one step in the -// recipe. -message Recipe { - // URI indicating what type of recipe was performed. It determines the meaning - // of recipe.entryPoint, recipe.arguments, recipe.environment, and materials. - string type = 1; - // Index in materials containing the recipe steps that are not implied by - // recipe.type. For example, if the recipe type were "make", then this would - // point to the source containing the Makefile, not the make program itself. - // Set to -1 if the recipe doesn't come from a material, as zero is default - // unset value for int64. - int64 defined_in_material = 2; - // String identifying the entry point into the build. - // This is often a path to a configuration file and/or a target label within - // that file. The syntax and meaning are defined by recipe.type. For example, - // if the recipe type were "make", then this would reference the directory in - // which to run make as well as which target to use. - string entry_point = 3; - // Collection of all external inputs that influenced the build on top of - // recipe.definedInMaterial and recipe.entryPoint. For example, if the recipe - // type were "make", then this might be the flags passed to make aside from - // the target, which is captured in recipe.entryPoint. Since the arguments - // field can greatly vary in structure, depending on the builder and recipe - // type, this is of form "Any". - repeated google.protobuf.Any arguments = 4; - // Any other builder-controlled inputs necessary for correctly evaluating the - // recipe. Usually only needed for reproducing the build but not evaluated as - // part of policy. Since the environment field can greatly vary in structure, - // depending on the builder and recipe type, this is of form "Any". - repeated google.protobuf.Any environment = 5; -} - -// Indicates that the builder claims certain fields in this message to be -// complete. -message Completeness { - // If true, the builder claims that recipe.arguments is complete, meaning that - // all external inputs are properly captured in the recipe. - bool arguments = 1; - // If true, the builder claims that recipe.environment is claimed to be - // complete. - bool environment = 2; - // If true, the builder claims that materials are complete, usually through - // some controls to prevent network access. Sometimes called "hermetic". - bool materials = 3; -} - -// Other properties of the build. -message Metadata { - // Identifies the particular build invocation, which can be useful for finding - // associated logs or other ad-hoc analysis. The value SHOULD be globally - // unique, per in-toto Provenance spec. - string build_invocation_id = 1; - // The timestamp of when the build started. - google.protobuf.Timestamp build_started_on = 2; - // The timestamp of when the build completed. - google.protobuf.Timestamp build_finished_on = 3; - // Indicates that the builder claims certain fields in this message to be - // complete. - Completeness completeness = 4; - // If true, the builder claims that running the recipe on materials will - // produce bit-for-bit identical output. - bool reproducible = 5; -} - -message BuilderConfig { - string id = 1; -} - -message InTotoProvenance { - BuilderConfig builder_config = 1; // required - // Identifies the configuration used for the build. - // When combined with materials, this SHOULD fully describe the build, - // such that re-running this recipe results in bit-for-bit identical output - // (if the build is reproducible). - Recipe recipe = 2; // required - Metadata metadata = 3; - // The collection of artifacts that influenced the build including sources, - // dependencies, build tools, base images, and so on. This is considered to be - // incomplete unless metadata.completeness.materials is true. Unset or null is - // equivalent to empty. - repeated string materials = 4; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_statement.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_statement.proto deleted file mode 100644 index 1f798d0d65f..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/intoto_statement.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2021 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "grafeas/v1/intoto_provenance.proto"; -import "grafeas/v1/slsa_provenance.proto"; -import "grafeas/v1/slsa_provenance_zero_two.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; -option java_outer_classname = "InTotoStatementProto"; - -// Spec defined at -// https://github.com/in-toto/attestation/tree/main/spec#statement The -// serialized InTotoStatement will be stored as Envelope.payload. -// Envelope.payloadType is always "application/vnd.in-toto+json". -message InTotoStatement { - // Always `https://in-toto.io/Statement/v0.1`. - string type = 1 [json_name = "_type"]; - repeated Subject subject = 2; - // `https://slsa.dev/provenance/v0.1` for SlsaProvenance. - string predicate_type = 3; - oneof predicate { - InTotoProvenance provenance = 4; - SlsaProvenance slsa_provenance = 5; - SlsaProvenanceZeroTwo slsa_provenance_zero_two = 6; - } -} -message Subject { - string name = 1; - // `"": ""` - // Algorithms can be e.g. sha256, sha512 - // See - // https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet - map digest = 2; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/package.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/package.proto deleted file mode 100644 index 61b21dbf032..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/package.proto +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "google/api/field_behavior.proto"; -import "grafeas/v1/common.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// Instruction set architectures supported by various package managers. -enum Architecture { - // Unknown architecture. - ARCHITECTURE_UNSPECIFIED = 0; - // X86 architecture. - X86 = 1; - // X64 architecture. - X64 = 2; -} - -// This represents a particular channel of distribution for a given package. -// E.g., Debian's jessie-backports dpkg mirror. -message Distribution { - // The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) - // denoting the package manager version distributing a package. - string cpe_uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // The CPU architecture for which packages in this distribution channel were - // built. - Architecture architecture = 2; - - // The latest available version of this package in this distribution channel. - Version latest_version = 3; - - // A freeform string denoting the maintainer of this package. - string maintainer = 4; - - // The distribution channel-specific homepage for this package. - string url = 5; - - // The distribution channel-specific description of this package. - string description = 6; -} - -// An occurrence of a particular package installation found within a system's -// filesystem. E.g., glibc was found in `/var/lib/dpkg/status`. -message Location { - // Deprecated. - // The CPE URI in [CPE format](https://cpe.mitre.org/specification/) - string cpe_uri = 1; - - // Deprecated. - // The version installed at this location. - Version version = 2; - - // The path from which we gathered that this package/version is installed. - string path = 3; -} - -// PackageNote represents a particular package version. -message PackageNote { - // The name of the package. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Deprecated. - // The various channels by which a package is distributed. - repeated Distribution distribution = 10; - - // The type of package; whether native or non native (e.g., ruby gems, - // node.js packages, etc.). - string package_type = 11; - - // The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) - // denoting the package manager version distributing a package. - // The cpe_uri will be blank for language packages. - string cpe_uri = 12; - - // The CPU architecture for which packages in this distribution channel were - // built. Architecture will be blank for language packages. - Architecture architecture = 13; - - // The version of the package. - Version version = 14; - - // A freeform text denoting the maintainer of this package. - string maintainer = 15; - - // The homepage for this package. - string url = 16; - - // The description of this package. - string description = 17; - - // Licenses that have been declared by the authors of the package. - License license = 18; - - // Hash value, typically a file digest, that allows unique - // identification a specific package. - repeated Digest digest = 19; -} - -// Details on how a particular software package was installed on a system. -message PackageOccurrence { - // The name of the installed package. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // All of the places within the filesystem versions of this package - // have been found. - repeated Location location = 2; - - // The type of package; whether native or non native (e.g., ruby gems, - // node.js packages, etc.). - string package_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) - // denoting the package manager version distributing a package. - // The cpe_uri will be blank for language packages. - string cpe_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The CPU architecture for which packages in this distribution channel were - // built. Architecture will be blank for language packages. - Architecture architecture = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Licenses that have been declared by the authors of the package. - License license = 6; - - // The version of the package. - Version version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Version contains structured information about the version of a package. -message Version { - // Used to correct mistakes in the version numbering scheme. - int32 epoch = 1; - - // Required only when version kind is NORMAL. The main part of the version - // name. - string name = 2; - - // The iteration of the package build from the above version. - string revision = 3; - - // Whether this version is specifying part of an inclusive range. Grafeas - // does not have the capability to specify version ranges; instead we have - // fields that specify start version and end versions. At times this is - // insufficient - we also need to specify whether the version is included in - // the range or is excluded from the range. This boolean is expected to be set - // to true when the version is included in a range. - bool inclusive = 6; - - // Whether this is an ordinary package version or a sentinel MIN/MAX version. - enum VersionKind { - // Unknown. - VERSION_KIND_UNSPECIFIED = 0; - // A standard package version. - NORMAL = 1; - // A special version representing negative infinity. - MINIMUM = 2; - // A special version representing positive infinity. - MAXIMUM = 3; - } - - // Required. Distinguishes between sentinel MIN/MAX versions and normal - // versions. - VersionKind kind = 4; - - // Human readable version string. This string is of the form - // :- and is only set when kind is NORMAL. - string full_name = 5; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/provenance.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/provenance.proto deleted file mode 100644 index 06b109785f8..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/provenance.proto +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// Provenance of a build. Contains all information needed to verify the full -// details about the build from source to completion. -message BuildProvenance { - // Required. Unique identifier of the build. - string id = 1; - - // ID of the project. - string project_id = 2; - - // Commands requested by the build. - repeated Command commands = 3; - - // Output of the build. - repeated Artifact built_artifacts = 4; - - // Time at which the build was created. - google.protobuf.Timestamp create_time = 5; - - // Time at which execution of the build was started. - google.protobuf.Timestamp start_time = 6; - - // Time at which execution of the build was finished. - google.protobuf.Timestamp end_time = 7; - - // E-mail address of the user who initiated this build. Note that this was the - // user's e-mail address at the time the build was initiated; this address may - // not represent the same end-user for all time. - string creator = 8; - - // URI where any logs for this provenance were written. - string logs_uri = 9; - - // Details of the Source input to the build. - Source source_provenance = 10; - - // Trigger identifier if the build was triggered automatically; empty if not. - string trigger_id = 11; - - // Special options applied to this build. This is a catch-all field where - // build providers can enter any desired additional details. - map build_options = 12; - - // Version string of the builder at the time this build was executed. - string builder_version = 13; -} - -// Source describes the location of the source used for the build. -message Source { - // If provided, the input binary artifacts for the build came from this - // location. - string artifact_storage_source_uri = 1; - - // Hash(es) of the build source, which can be used to verify that the original - // source integrity was maintained in the build. - // - // The keys to this map are file paths used as build source and the values - // contain the hash values for those files. - // - // If the build source came in a single package such as a gzipped tarfile - // (.tar.gz), the FileHash will be for the single path to that file. - map file_hashes = 2; - - // If provided, the source code used for the build came from this location. - SourceContext context = 3; - - // If provided, some of the source code used for the build may be found in - // these locations, in the case where the source repository had multiple - // remotes or submodules. This list will not include the context specified in - // the context field. - repeated SourceContext additional_contexts = 4; -} - -// Container message for hashes of byte content of files, used in source -// messages to verify integrity of source input to the build. -message FileHashes { - // Required. Collection of file hashes. - repeated Hash file_hash = 1; -} - -// Container message for hash values. -message Hash { - // Required. The type of hash that was performed, e.g. "SHA-256". - string type = 1; - // Required. The hash value. - bytes value = 2; -} - -// Command describes a step performed as part of the build pipeline. -message Command { - // Required. Name of the command, as presented on the command line, or if the - // command is packaged as a Docker container, as presented to `docker pull`. - string name = 1; - - // Environment variables set before running this command. - repeated string env = 2; - - // Command-line arguments used when executing this command. - repeated string args = 3; - - // Working directory (relative to project source root) used when running this - // command. - string dir = 4; - - // Optional unique identifier for this command, used in wait_for to reference - // this command as a dependency. - string id = 5; - - // The ID(s) of the command(s) that this command depends on. - repeated string wait_for = 6; -} - -// Artifact describes a build product. -message Artifact { - // Hash or checksum value of a binary, or Docker Registry 2.0 digest of a - // container. - string checksum = 1; - - // Artifact ID, if any; for container images, this will be a URL by digest - // like `gcr.io/projectID/imagename@sha256:123456`. - string id = 2; - - // Related artifact names. This may be the path to a binary or jar file, or in - // the case of a container build, the name used to push the container image to - // Google Container Registry, as presented to `docker push`. Note that a - // single Artifact ID can have multiple names, for example if two tags are - // applied to one image. - repeated string names = 3; -} - -// A SourceContext is a reference to a tree of files. A SourceContext together -// with a path point to a unique revision of a single file or directory. -message SourceContext { - // A SourceContext can refer any one of the following types of repositories. - oneof context { - // A SourceContext referring to a revision in a Google Cloud Source Repo. - CloudRepoSourceContext cloud_repo = 1; - - // A SourceContext referring to a Gerrit project. - GerritSourceContext gerrit = 2; - - // A SourceContext referring to any third party Git repo (e.g., GitHub). - GitSourceContext git = 3; - } - - // Labels with user defined metadata. - map labels = 4; -} - -// An alias to a repo revision. -message AliasContext { - // The type of an alias. - enum Kind { - // Unknown. - KIND_UNSPECIFIED = 0; - // Git tag. - FIXED = 1; - // Git branch. - MOVABLE = 2; - // Used to specify non-standard aliases. For example, if a Git repo has a - // ref named "refs/foo/bar". - OTHER = 4; - } - - // The alias kind. - Kind kind = 1; - - // The alias name. - string name = 2; -} - -// A CloudRepoSourceContext denotes a particular revision in a Google Cloud -// Source Repo. -message CloudRepoSourceContext { - // The ID of the repo. - RepoId repo_id = 1; - - // A revision in a Cloud Repo can be identified by either its revision ID or - // its alias. - oneof revision { - // A revision ID. - string revision_id = 2; - - // An alias, which may be a branch or tag. - AliasContext alias_context = 3; - } -} - -// A SourceContext referring to a Gerrit project. -message GerritSourceContext { - // The URI of a running Gerrit instance. - string host_uri = 1; - - // The full project name within the host. Projects may be nested, so - // "project/subproject" is a valid project name. The "repo name" is the - // hostURI/project. - string gerrit_project = 2; - - // A revision in a Gerrit project can be identified by either its revision ID - // or its alias. - oneof revision { - // A revision (commit) ID. - string revision_id = 3; - - // An alias, which may be a branch or tag. - AliasContext alias_context = 4; - } -} - -// A GitSourceContext denotes a particular revision in a third party Git -// repository (e.g., GitHub). -message GitSourceContext { - // Git repository URL. - string url = 1; - - // Git commit hash. - string revision_id = 2; -} - -// A unique identifier for a Cloud Repo. -message RepoId { - // A cloud repo can be identified by either its project ID and repository name - // combination, or its globally unique identifier. - oneof id { - // A combination of a project ID and a repo name. - ProjectRepoId project_repo_id = 1; - - // A server-assigned, globally unique identifier. - string uid = 2; - } -} - -// Selects a repo using a Google Cloud Platform project ID (e.g., -// winged-cargo-31) and a repo name within that project. -message ProjectRepoId { - // The ID of the project. - string project_id = 1; - - // The name of the repo. Leave empty for the default repo. - string repo_name = 2; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/severity.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/severity.proto deleted file mode 100644 index cc9cc384535..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/severity.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2021 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// Note provider assigned severity/impact ranking. -enum Severity { - // Unknown. - SEVERITY_UNSPECIFIED = 0; - // Minimal severity. - MINIMAL = 1; - // Low severity. - LOW = 2; - // Medium severity. - MEDIUM = 3; - // High severity. - HIGH = 4; - // Critical severity. - CRITICAL = 5; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance.proto deleted file mode 100644 index c038af064e0..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance.proto +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2021 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; -option java_outer_classname = "SlsaProvenanceProto"; - -message SlsaProvenance { - // Steps taken to build the artifact. - // For a TaskRun, typically each container corresponds to one step in the - // recipe. - message SlsaRecipe { - // URI indicating what type of recipe was performed. It determines the - // meaning of recipe.entryPoint, recipe.arguments, recipe.environment, and - // materials. - string type = 1; - // Index in materials containing the recipe steps that are not implied by - // recipe.type. For example, if the recipe type were "make", then this would - // point to the source containing the Makefile, not the make program itself. - // Set to -1 if the recipe doesn't come from a material, as zero is default - // unset value for int64. - int64 defined_in_material = 2; - // String identifying the entry point into the build. - // This is often a path to a configuration file and/or a target label within - // that file. The syntax and meaning are defined by recipe.type. For - // example, if the recipe type were "make", then this would reference the - // directory in which to run make as well as which target to use. - string entry_point = 3; - // Collection of all external inputs that influenced the build on top of - // recipe.definedInMaterial and recipe.entryPoint. For example, if the - // recipe type were "make", then this might be the flags passed to make - // aside from the target, which is captured in recipe.entryPoint. Depending - // on the recipe Type, the structure may be different. - google.protobuf.Any arguments = 4; - // Any other builder-controlled inputs necessary for correctly evaluating - // the recipe. Usually only needed for reproducing the build but not - // evaluated as part of policy. Depending on the recipe Type, the structure - // may be different. - google.protobuf.Any environment = 5; - } - - // Indicates that the builder claims certain fields in this message to be - // complete. - message SlsaCompleteness { - // If true, the builder claims that recipe.arguments is complete, meaning - // that all external inputs are properly captured in the recipe. - bool arguments = 1; - // If true, the builder claims that recipe.environment is claimed to be - // complete. - bool environment = 2; - // If true, the builder claims that materials are complete, usually through - // some controls to prevent network access. Sometimes called "hermetic". - bool materials = 3; - } - - // Other properties of the build. - message SlsaMetadata { - // Identifies the particular build invocation, which can be useful for - // finding associated logs or other ad-hoc analysis. The value SHOULD be - // globally unique, per in-toto Provenance spec. - string build_invocation_id = 1; - // The timestamp of when the build started. - google.protobuf.Timestamp build_started_on = 2; - // The timestamp of when the build completed. - google.protobuf.Timestamp build_finished_on = 3; - // Indicates that the builder claims certain fields in this message to be - // complete. - SlsaCompleteness completeness = 4; - // If true, the builder claims that running the recipe on materials will - // produce bit-for-bit identical output. - bool reproducible = 5; - } - - message SlsaBuilder { - string id = 1; - } - - message Material { - string uri = 1; - map digest = 2; - } - - SlsaBuilder builder = 1; // required - // Identifies the configuration used for the build. - // When combined with materials, this SHOULD fully describe the build, - // such that re-running this recipe results in bit-for-bit identical output - // (if the build is reproducible). - SlsaRecipe recipe = 2; // required - SlsaMetadata metadata = 3; - // The collection of artifacts that influenced the build including sources, - // dependencies, build tools, base images, and so on. This is considered to be - // incomplete unless metadata.completeness.materials is true. Unset or null is - // equivalent to empty. - repeated Material materials = 4; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance_zero_two.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance_zero_two.proto deleted file mode 100644 index 11cdd1c0ba5..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/slsa_provenance_zero_two.proto +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2021 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; -option java_outer_classname = "SlsaProvenanceZeroTwoProto"; - -message SlsaProvenanceZeroTwo { - // See full explanation of fields at slsa.dev/provenance/v0.2. - - // Identifies the entity that executed the recipe, which is trusted to have - // correctly performed the operation and populated this provenance. - message SlsaBuilder { - string id = 1; - } - - // The collection of artifacts that influenced the build including sources, - // dependencies, build tools, base images, and so on. - message SlsaMaterial { - string uri = 1; - map digest = 2; - } - - // Identifies the event that kicked off the build. - message SlsaInvocation { - SlsaConfigSource config_source = 1; - google.protobuf.Struct parameters = 2; - google.protobuf.Struct environment = 3; - } - - // Describes where the config file that kicked off the build came from. - // This is effectively a pointer to the source where buildConfig came from. - message SlsaConfigSource { - string uri = 1; - map digest = 2; - string entry_point = 3; - } - - // Other properties of the build. - message SlsaMetadata { - string build_invocation_id = 1; - google.protobuf.Timestamp build_started_on = 2; - google.protobuf.Timestamp build_finished_on = 3; - SlsaCompleteness completeness = 4; - bool reproducible = 5; - } - - // Indicates that the builder claims certain fields in this message to be - // complete. - message SlsaCompleteness { - bool parameters = 1; - bool environment = 2; - bool materials = 3; - } - - SlsaBuilder builder = 1; - string build_type = 2; - SlsaInvocation invocation = 3; - google.protobuf.Struct build_config = 4; - SlsaMetadata metadata = 5; - repeated SlsaMaterial materials = 6; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/upgrade.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/upgrade.proto deleted file mode 100644 index 89d38929919..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/upgrade.proto +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "google/protobuf/timestamp.proto"; -import "grafeas/v1/package.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// An Upgrade Note represents a potential upgrade of a package to a given -// version. For each package version combination (i.e. bash 4.0, bash 4.1, -// bash 4.1.2), there will be an Upgrade Note. For Windows, windows_update field -// represents the information related to the update. -message UpgradeNote { - // Required for non-Windows OS. The package this Upgrade is for. - string package = 1; - // Required for non-Windows OS. The version of the package in machine + human - // readable form. - grafeas.v1.Version version = 2; - // Metadata about the upgrade for each specific operating system. - repeated UpgradeDistribution distributions = 3; - // Required for Windows OS. Represents the metadata about the Windows update. - WindowsUpdate windows_update = 4; -} - -// The Upgrade Distribution represents metadata about the Upgrade for each -// operating system (CPE). Some distributions have additional metadata around -// updates, classifying them into various categories and severities. -message UpgradeDistribution { - // Required - The specific operating system this metadata applies to. See - // https://cpe.mitre.org/specification/. - string cpe_uri = 1; - // The operating system classification of this Upgrade, as specified by the - // upstream operating system upgrade feed. For Windows the classification is - // one of the category_ids listed at - // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ff357803(v=vs.85) - string classification = 2; - // The severity as specified by the upstream operating system. - string severity = 3; - // The cve tied to this Upgrade. - repeated string cve = 4; -} - -// Windows Update represents the metadata about the update for the Windows -// operating system. The fields in this message come from the Windows Update API -// documented at -// https://docs.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iupdate. -message WindowsUpdate { - // The unique identifier of the update. - message Identity { - // The revision independent identifier of the update. - string update_id = 1; - // The revision number of the update. - int32 revision = 2; - } - // Required - The unique identifier for the update. - Identity identity = 1; - // The localized title of the update. - string title = 2; - // The localized description of the update. - string description = 3; - // The category to which the update belongs. - message Category { - // The identifier of the category. - string category_id = 1; - // The localized name of the category. - string name = 2; - } - // The list of categories to which the update belongs. - repeated Category categories = 4; - // The Microsoft Knowledge Base article IDs that are associated with the - // update. - repeated string kb_article_ids = 5; - // The hyperlink to the support information for the update. - string support_url = 6; - // The last published timestamp of the update. - google.protobuf.Timestamp last_published_timestamp = 7; -} - -// An Upgrade Occurrence represents that a specific resource_url could install a -// specific upgrade. This presence is supplied via local sources (i.e. it is -// present in the mirror and the running system has noticed its availability). -// For Windows, both distribution and windows_update contain information for the -// Windows update. -message UpgradeOccurrence { - // Required for non-Windows OS. The package this Upgrade is for. - string package = 1; - // Required for non-Windows OS. The version of the package in a machine + - // human readable form. - grafeas.v1.Version parsed_version = 3; - // Metadata about the upgrade for available for the specific operating system - // for the resource_url. This allows efficient filtering, as well as - // making it easier to use the occurrence. - UpgradeDistribution distribution = 4; - // Required for Windows OS. Represents the metadata about the Windows update. - WindowsUpdate windows_update = 5; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vex.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vex.proto deleted file mode 100644 index ba53a8438ff..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vex.proto +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright 2023 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "grafeas/v1/common.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// A single VulnerabilityAssessmentNote represents -// one particular product's vulnerability assessment for one CVE. -message VulnerabilityAssessmentNote { - // The title of the note. E.g. `Vex-Debian-11.4` - string title = 1; - - // A one sentence description of this Vex. - string short_description = 2; - - // A detailed description of this Vex. - string long_description = 3; - - // Identifies the language used by this document, - // corresponding to IETF BCP 47 / RFC 5646. - string language_code = 4; - - // Publisher contains information about the publisher of - // this Note. - // (-- api-linter: core::0123::resource-annotation=disabled - // aip.dev/not-precedent: Publisher is not a separate resource. --) - message Publisher { - // Name of the publisher. - // Examples: 'Google', 'Google Cloud Platform'. - string name = 1; - - // Provides information about the authority of the issuing party to - // release the document, in particular, the party's constituency and - // responsibilities or other obligations. - string issuing_authority = 2; - - // The context or namespace. - // Contains a URL which is under control of the issuing party and can - // be used as a globally unique identifier for that issuing party. - // Example: https://csaf.io - string publisher_namespace = 3; - } - - // Publisher details of this Note. - Publisher publisher = 5; - - // Product contains information about a product and how to uniquely identify - // it. - // (-- api-linter: core::0123::resource-annotation=disabled - // aip.dev/not-precedent: Product is not a separate resource. --) - message Product { - // Name of the product. - string name = 1; - - // Token that identifies a product so that it can be referred to from other - // parts in the document. There is no predefined format as long as it - // uniquely identifies a group in the context of the current document. - string id = 2; - - oneof identifier { - // Contains a URI which is vendor-specific. - // Example: The artifact repository URL of an image. - string generic_uri = 3; - } - } - - // The product affected by this vex. - Product product = 6; - - // Assessment provides all information that is related to a single - // vulnerability for this product. - message Assessment { - // Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) - // tracking number for the vulnerability. - string cve = 1; - - // A one sentence description of this Vex. - string short_description = 2; - - // A detailed description of this Vex. - string long_description = 3; - - // Holds a list of references associated with this vulnerability item and - // assessment. These uris have additional information about the - // vulnerability and the assessment itself. E.g. Link to a document which - // details how this assessment concluded the state of this vulnerability. - repeated grafeas.v1.RelatedUrl related_uris = 4; - - // Provides the state of this Vulnerability assessment. - enum State { - // No state is specified. - STATE_UNSPECIFIED = 0; - // This product is known to be affected by this vulnerability. - AFFECTED = 1; - // This product is known to be not affected by this vulnerability. - NOT_AFFECTED = 2; - // This product contains a fix for this vulnerability. - FIXED = 3; - // It is not known yet whether these versions are or are not affected - // by the vulnerability. However, it is still under investigation. - UNDER_INVESTIGATION = 4; - } - - // Provides the state of this Vulnerability assessment. - State state = 5; - - // Contains information about the impact of this vulnerability, - // this will change with time. - repeated string impacts = 6; - - // Justification provides the justification when the state of the - // assessment if NOT_AFFECTED. - message Justification { - // Provides the type of justification. - enum JustificationType { - // JUSTIFICATION_TYPE_UNSPECIFIED. - JUSTIFICATION_TYPE_UNSPECIFIED = 0; - // The vulnerable component is not present in the product. - COMPONENT_NOT_PRESENT = 1; - // The vulnerable code is not present. Typically this case - // occurs when source code is configured or built in a way that excludes - // the vulnerable code. - VULNERABLE_CODE_NOT_PRESENT = 2; - // The vulnerable code can not be executed. - // Typically this case occurs when the product includes the vulnerable - // code but does not call or use the vulnerable code. - VULNERABLE_CODE_NOT_IN_EXECUTE_PATH = 3; - // The vulnerable code cannot be controlled by an attacker to exploit - // the vulnerability. - VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY = 4; - // The product includes built-in protections or features that prevent - // exploitation of the vulnerability. These built-in protections cannot - // be subverted by the attacker and cannot be configured or disabled by - // the user. These mitigations completely prevent exploitation based on - // known attack vectors. - INLINE_MITIGATIONS_ALREADY_EXIST = 5; - } - - // The justification type for this vulnerability. - JustificationType justification_type = 1; - - // Additional details on why this justification was chosen. - string details = 2; - } - - // Justification provides the justification when the state of the - // assessment if NOT_AFFECTED. - Justification justification = 7; - - // Specifies details on how to handle (and presumably, fix) a vulnerability. - message Remediation { - // The type of remediation that can be applied. - enum RemediationType { - // No remediation type specified. - REMEDIATION_TYPE_UNSPECIFIED = 0; - // A MITIGATION is available. - MITIGATION = 1; - // No fix is planned. - NO_FIX_PLANNED = 2; - // Not available. - NONE_AVAILABLE = 3; - // A vendor fix is available. - VENDOR_FIX = 4; - // A workaround is available. - WORKAROUND = 5; - } - - // The type of remediation that can be applied. - RemediationType remediation_type = 1; - - // Contains a comprehensive human-readable discussion of the remediation. - string details = 2; - - // Contains the URL where to obtain the remediation. - grafeas.v1.RelatedUrl remediation_uri = 3; - } - - // Specifies details on how to handle (and presumably, fix) a vulnerability. - repeated Remediation remediations = 8; - } - - // Represents a vulnerability assessment for the product. - Assessment assessment = 7; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vulnerability.proto b/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vulnerability.proto deleted file mode 100644 index 3b316eb8dd3..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/protos/grafeas/v1/vulnerability.proto +++ /dev/null @@ -1,297 +0,0 @@ -// Copyright 2019 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; -import "grafeas/v1/common.proto"; -import "grafeas/v1/cvss.proto"; -import "grafeas/v1/package.proto"; -import "grafeas/v1/severity.proto"; -import "grafeas/v1/vex.proto"; - -option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1"; -option objc_class_prefix = "GRA"; - -// A security vulnerability that can be found in resources. -message VulnerabilityNote { - // The CVSS score of this vulnerability. CVSS score is on a scale of 0 - 10 - // where 0 indicates low severity and 10 indicates high severity. - float cvss_score = 1; - - // The note provider assigned severity of this vulnerability. - grafeas.v1.Severity severity = 2; - - // Details of all known distros and packages affected by this vulnerability. - repeated Detail details = 3; - - // A detail for a distro and package affected by this vulnerability and its - // associated fix (if one is available). - message Detail { - // The distro assigned severity of this vulnerability. - string severity_name = 1; - - // A vendor-specific description of this vulnerability. - string description = 2; - - // The type of package; whether native or non native (e.g., ruby gems, - // node.js packages, etc.). - string package_type = 3; - - // Required. The [CPE URI](https://cpe.mitre.org/specification/) this - // vulnerability affects. - string affected_cpe_uri = 4; - - // Required. The package this vulnerability affects. - string affected_package = 5; - - // The version number at the start of an interval in which this - // vulnerability exists. A vulnerability can affect a package between - // version numbers that are disjoint sets of intervals (example: - // [1.0.0-1.1.0], [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be - // represented in its own Detail. If a specific affected version is provided - // by a vulnerability database, affected_version_start and - // affected_version_end will be the same in that Detail. - grafeas.v1.Version affected_version_start = 6; - - // The version number at the end of an interval in which this vulnerability - // exists. A vulnerability can affect a package between version numbers - // that are disjoint sets of intervals (example: [1.0.0-1.1.0], - // [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be represented in its - // own Detail. If a specific affected version is provided by a vulnerability - // database, affected_version_start and affected_version_end will be the - // same in that Detail. - grafeas.v1.Version affected_version_end = 7; - - // The distro recommended [CPE URI](https://cpe.mitre.org/specification/) - // to update to that contains a fix for this vulnerability. It is possible - // for this to be different from the affected_cpe_uri. - string fixed_cpe_uri = 8; - - // The distro recommended package to update to that contains a fix for this - // vulnerability. It is possible for this to be different from the - // affected_package. - string fixed_package = 9; - - // The distro recommended version to update to that contains a - // fix for this vulnerability. Setting this to VersionKind.MAXIMUM means no - // such version is yet available. - grafeas.v1.Version fixed_version = 10; - - // Whether this detail is obsolete. Occurrences are expected not to point to - // obsolete details. - bool is_obsolete = 11; - - // The time this information was last changed at the source. This is an - // upstream timestamp from the underlying information source - e.g. Ubuntu - // security tracker. - google.protobuf.Timestamp source_update_time = 12; - - // The source from which the information in this Detail was obtained. - string source = 13; - - // The name of the vendor of the product. - string vendor = 14; - } - - // The full description of the CVSSv3 for this vulnerability. - CVSSv3 cvss_v3 = 4; - - // Windows details get their own format because the information format and - // model don't match a normal detail. Specifically Windows updates are done as - // patches, thus Windows vulnerabilities really are a missing package, rather - // than a package being at an incorrect version. - repeated WindowsDetail windows_details = 5; - - message WindowsDetail { - // Required. The [CPE URI](https://cpe.mitre.org/specification/) this - // vulnerability affects. - string cpe_uri = 1; - - // Required. The name of this vulnerability. - string name = 2; - - // The description of this vulnerability. - string description = 3; - - // Required. The names of the KBs which have hotfixes to mitigate this - // vulnerability. Note that there may be multiple hotfixes (and thus - // multiple KBs) that mitigate a given vulnerability. Currently any listed - // KBs presence is considered a fix. - repeated KnowledgeBase fixing_kbs = 4; - - message KnowledgeBase { - // The KB name (generally of the form KB[0-9]+ (e.g., KB123456)). - string name = 1; - // A link to the KB in the [Windows update catalog] - // (https://www.catalog.update.microsoft.com/). - string url = 2; - } - } - - // The time this information was last changed at the source. This is an - // upstream timestamp from the underlying information source - e.g. Ubuntu - // security tracker. - google.protobuf.Timestamp source_update_time = 6; - - // CVSS version used to populate cvss_score and severity. - grafeas.v1.CVSSVersion cvss_version = 7; - - // The full description of the v2 CVSS for this vulnerability. - CVSS cvss_v2 = 8; - - // Next free ID is 9. -} - -// An occurrence of a severity vulnerability on a resource. -message VulnerabilityOccurrence { - // The type of package; whether native or non native (e.g., ruby gems, node.js - // packages, etc.). - string type = 1; - - // Output only. The note provider assigned severity of this vulnerability. - grafeas.v1.Severity severity = 2; - - // Output only. The CVSS score of this vulnerability. CVSS score is on a - // scale of 0 - 10 where 0 indicates low severity and 10 indicates high - // severity. - float cvss_score = 3; - - // The cvss v3 score for the vulnerability. - CVSS cvssv3 = 10; - - // Required. The set of affected locations and their fixes (if available) - // within the associated resource. - repeated PackageIssue package_issue = 4; - - // A detail for a distro and package this vulnerability occurrence was found - // in and its associated fix (if one is available). - message PackageIssue { - // Required. The [CPE URI](https://cpe.mitre.org/specification/) this - // vulnerability was found in. - string affected_cpe_uri = 1; - - // Required. The package this vulnerability was found in. - string affected_package = 2; - - // Required. The version of the package that is installed on the resource - // affected by this vulnerability. - grafeas.v1.Version affected_version = 3; - - // The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability - // was fixed in. It is possible for this to be different from the - // affected_cpe_uri. - string fixed_cpe_uri = 4; - - // The package this vulnerability was fixed in. It is possible for this to - // be different from the affected_package. - string fixed_package = 5; - - // Required. The version of the package this vulnerability was fixed in. - // Setting this to VersionKind.MAXIMUM means no fix is yet available. - grafeas.v1.Version fixed_version = 6; - - // Output only. Whether a fix is available for this package. - bool fix_available = 7; - - // The type of package (e.g. OS, MAVEN, GO). - string package_type = 8; - - // The distro or language system assigned severity for this vulnerability - // when that is available and note provider assigned severity when it is not - // available. - grafeas.v1.Severity effective_severity = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The location at which this package was found. - repeated FileLocation file_location = 10; - } - - // Output only. A one sentence description of this vulnerability. - string short_description = 5; - - // Output only. A detailed description of this vulnerability. - string long_description = 6; - - // Output only. URLs related to this vulnerability. - repeated grafeas.v1.RelatedUrl related_urls = 7; - - // The distro assigned severity for this vulnerability when it is available, - // otherwise this is the note provider assigned severity. - // - // When there are multiple PackageIssues for this vulnerability, they can have - // different effective severities because some might be provided by the distro - // while others are provided by the language ecosystem for a language pack. - // For this reason, it is advised to use the effective severity on the - // PackageIssue level. In the case where multiple PackageIssues have differing - // effective severities, this field should be the highest severity for any of - // the PackageIssues. - grafeas.v1.Severity effective_severity = 8; - - // Output only. Whether at least one of the affected packages has a fix - // available. - bool fix_available = 9; - - // Output only. CVSS version used to populate cvss_score and severity. - grafeas.v1.CVSSVersion cvss_version = 11; - - // The cvss v2 score for the vulnerability. - CVSS cvss_v2 = 12; - - // VexAssessment provides all publisher provided Vex information that is - // related to this vulnerability. - message VexAssessment { - // Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) - // tracking number for the vulnerability. - string cve = 1; - - // Holds a list of references associated with this vulnerability item and - // assessment. - repeated grafeas.v1.RelatedUrl related_uris = 2; - - // The VulnerabilityAssessment note from which this VexAssessment was - // generated. - // This will be of the form: `projects/[PROJECT_ID]/notes/[NOTE_ID]`. - // (-- api-linter: core::0122::name-suffix=disabled - // aip.dev/not-precedent: The suffix is kept for consistency. --) - string note_name = 3; - - // Provides the state of this Vulnerability assessment. - grafeas.v1.VulnerabilityAssessmentNote.Assessment.State state = 4; - - // Contains information about the impact of this vulnerability, - // this will change with time. - repeated string impacts = 5; - - // Specifies details on how to handle (and presumably, fix) a vulnerability. - repeated grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation - remediations = 6; - - // Justification provides the justification when the state of the - // assessment if NOT_AFFECTED. - grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification - justification = 7; - - // Next ID: 8 - } - - VexAssessment vex_assessment = 13; - - // Next free ID is 14. -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_iam_policy.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_iam_policy.js deleted file mode 100644 index c933a75f614..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.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 containeranalysis_v1_generated_ContainerAnalysis_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 Containeranalysis library - const {ContainerAnalysisClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new ContainerAnalysisClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await containeranalysisClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END containeranalysis_v1_generated_ContainerAnalysis_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-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_vulnerability_occurrences_summary.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_vulnerability_occurrences_summary.js deleted file mode 100644 index ff47d3b8766..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.get_vulnerability_occurrences_summary.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(parent) { - // [START containeranalysis_v1_generated_ContainerAnalysis_GetVulnerabilityOccurrencesSummary_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 project to get a vulnerability summary for in the form of - * `projects/[PROJECT_ID]`. - */ - // const parent = 'abc123' - /** - * The filter expression. - */ - // const filter = 'abc123' - - // Imports the Containeranalysis library - const {ContainerAnalysisClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new ContainerAnalysisClient(); - - async function callGetVulnerabilityOccurrencesSummary() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await containeranalysisClient.getVulnerabilityOccurrencesSummary(request); - console.log(response); - } - - callGetVulnerabilityOccurrencesSummary(); - // [END containeranalysis_v1_generated_ContainerAnalysis_GetVulnerabilityOccurrencesSummary_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.set_iam_policy.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.set_iam_policy.js deleted file mode 100644 index 972488ce8f9..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.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 containeranalysis_v1_generated_ContainerAnalysis_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 Containeranalysis library - const {ContainerAnalysisClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new ContainerAnalysisClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await containeranalysisClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END containeranalysis_v1_generated_ContainerAnalysis_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-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.test_iam_permissions.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.test_iam_permissions.js deleted file mode 100644 index 94185903521..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/container_analysis.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 containeranalysis_v1_generated_ContainerAnalysis_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 Containeranalysis library - const {ContainerAnalysisClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new ContainerAnalysisClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await containeranalysisClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END containeranalysis_v1_generated_ContainerAnalysis_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-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_notes.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_notes.js deleted file mode 100644 index 192667e26d5..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_notes.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, notes) { - // [START containeranalysis_v1_generated_Grafeas_BatchCreateNotes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project in the form of `projects/[PROJECT_ID]`, under which - * the notes are to be created. - */ - // const parent = 'abc123' - /** - * The notes to create. Max allowed length is 1000. - */ - // const notes = [1,2,3,4] - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callBatchCreateNotes() { - // Construct request - const request = { - parent, - notes, - }; - - // Run request - const response = await containeranalysisClient.batchCreateNotes(request); - console.log(response); - } - - callBatchCreateNotes(); - // [END containeranalysis_v1_generated_Grafeas_BatchCreateNotes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_occurrences.js deleted file mode 100644 index a04632298f4..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.batch_create_occurrences.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, occurrences) { - // [START containeranalysis_v1_generated_Grafeas_BatchCreateOccurrences_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project in the form of `projects/[PROJECT_ID]`, under which - * the occurrences are to be created. - */ - // const parent = 'abc123' - /** - * The occurrences to create. Max allowed length is 1000. - */ - // const occurrences = [1,2,3,4] - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callBatchCreateOccurrences() { - // Construct request - const request = { - parent, - occurrences, - }; - - // Run request - const response = await containeranalysisClient.batchCreateOccurrences(request); - console.log(response); - } - - callBatchCreateOccurrences(); - // [END containeranalysis_v1_generated_Grafeas_BatchCreateOccurrences_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_note.js deleted file mode 100644 index 2f79faf7ea8..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_note.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(parent, noteId, note) { - // [START containeranalysis_v1_generated_Grafeas_CreateNote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project in the form of `projects/[PROJECT_ID]`, under which - * the note is to be created. - */ - // const parent = 'abc123' - /** - * The ID to use for this note. - */ - // const noteId = 'abc123' - /** - * The note to create. - */ - // const note = {} - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callCreateNote() { - // Construct request - const request = { - parent, - noteId, - note, - }; - - // Run request - const response = await containeranalysisClient.createNote(request); - console.log(response); - } - - callCreateNote(); - // [END containeranalysis_v1_generated_Grafeas_CreateNote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_occurrence.js deleted file mode 100644 index 8e36f36e044..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.create_occurrence.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, occurrence) { - // [START containeranalysis_v1_generated_Grafeas_CreateOccurrence_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project in the form of `projects/[PROJECT_ID]`, under which - * the occurrence is to be created. - */ - // const parent = 'abc123' - /** - * The occurrence to create. - */ - // const occurrence = {} - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callCreateOccurrence() { - // Construct request - const request = { - parent, - occurrence, - }; - - // Run request - const response = await containeranalysisClient.createOccurrence(request); - console.log(response); - } - - callCreateOccurrence(); - // [END containeranalysis_v1_generated_Grafeas_CreateOccurrence_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_note.js deleted file mode 100644 index 40034933871..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_note.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 containeranalysis_v1_generated_Grafeas_DeleteNote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - */ - // const name = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callDeleteNote() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await containeranalysisClient.deleteNote(request); - console.log(response); - } - - callDeleteNote(); - // [END containeranalysis_v1_generated_Grafeas_DeleteNote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_occurrence.js deleted file mode 100644 index f8342ce8c8b..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.delete_occurrence.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 containeranalysis_v1_generated_Grafeas_DeleteOccurrence_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - */ - // const name = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callDeleteOccurrence() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await containeranalysisClient.deleteOccurrence(request); - console.log(response); - } - - callDeleteOccurrence(); - // [END containeranalysis_v1_generated_Grafeas_DeleteOccurrence_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_note.js deleted file mode 100644 index b57805866c3..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_note.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 containeranalysis_v1_generated_Grafeas_GetNote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - */ - // const name = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callGetNote() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await containeranalysisClient.getNote(request); - console.log(response); - } - - callGetNote(); - // [END containeranalysis_v1_generated_Grafeas_GetNote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence.js deleted file mode 100644 index af3812b9910..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence.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 containeranalysis_v1_generated_Grafeas_GetOccurrence_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - */ - // const name = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callGetOccurrence() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await containeranalysisClient.getOccurrence(request); - console.log(response); - } - - callGetOccurrence(); - // [END containeranalysis_v1_generated_Grafeas_GetOccurrence_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence_note.js deleted file mode 100644 index 7c8017e6e1c..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.get_occurrence_note.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 containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - */ - // const name = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callGetOccurrenceNote() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await containeranalysisClient.getOccurrenceNote(request); - console.log(response); - } - - callGetOccurrenceNote(); - // [END containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_note_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_note_occurrences.js deleted file mode 100644 index 253b9ab0955..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_note_occurrences.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 containeranalysis_v1_generated_Grafeas_ListNoteOccurrences_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the note to list occurrences for in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - */ - // const name = 'abc123' - /** - * The filter expression. - */ - // const filter = 'abc123' - /** - * Number of occurrences to return in the list. - */ - // const pageSize = 1234 - /** - * Token to provide to skip to a particular spot in the list. - */ - // const pageToken = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callListNoteOccurrences() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = await containeranalysisClient.listNoteOccurrencesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNoteOccurrences(); - // [END containeranalysis_v1_generated_Grafeas_ListNoteOccurrences_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_notes.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_notes.js deleted file mode 100644 index 103280dd10e..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_notes.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 containeranalysis_v1_generated_Grafeas_ListNotes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project to list notes for in the form of - * `projects/[PROJECT_ID]`. - */ - // const parent = 'abc123' - /** - * The filter expression. - */ - // const filter = 'abc123' - /** - * Number of notes to return in the list. Must be positive. Max allowed page - * size is 1000. If not specified, page size defaults to 20. - */ - // const pageSize = 1234 - /** - * Token to provide to skip to a particular spot in the list. - */ - // const pageToken = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callListNotes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await containeranalysisClient.listNotesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNotes(); - // [END containeranalysis_v1_generated_Grafeas_ListNotes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_occurrences.js deleted file mode 100644 index a3fdab99499..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.list_occurrences.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 containeranalysis_v1_generated_Grafeas_ListOccurrences_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project to list occurrences for in the form of - * `projects/[PROJECT_ID]`. - */ - // const parent = 'abc123' - /** - * The filter expression. - */ - // const filter = 'abc123' - /** - * Number of occurrences to return in the list. Must be positive. Max allowed - * page size is 1000. If not specified, page size defaults to 20. - */ - // const pageSize = 1234 - /** - * Token to provide to skip to a particular spot in the list. - */ - // const pageToken = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callListOccurrences() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await containeranalysisClient.listOccurrencesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListOccurrences(); - // [END containeranalysis_v1_generated_Grafeas_ListOccurrences_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_note.js deleted file mode 100644 index c8f3b365cf3..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_note.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(name, note) { - // [START containeranalysis_v1_generated_Grafeas_UpdateNote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - */ - // const name = 'abc123' - /** - * The updated note. - */ - // const note = {} - /** - * The fields to update. - */ - // const updateMask = {} - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callUpdateNote() { - // Construct request - const request = { - name, - note, - }; - - // Run request - const response = await containeranalysisClient.updateNote(request); - console.log(response); - } - - callUpdateNote(); - // [END containeranalysis_v1_generated_Grafeas_UpdateNote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_occurrence.js deleted file mode 100644 index 27d7f27cdcc..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/grafeas.update_occurrence.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(name, occurrence) { - // [START containeranalysis_v1_generated_Grafeas_UpdateOccurrence_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - */ - // const name = 'abc123' - /** - * The updated occurrence. - */ - // const occurrence = {} - /** - * The fields to update. - */ - // const updateMask = {} - - // Imports the Containeranalysis library - const {GrafeasClient} = require('@google-cloud/containeranalysis').v1; - - // Instantiates a client - const containeranalysisClient = new GrafeasClient(); - - async function callUpdateOccurrence() { - // Construct request - const request = { - name, - occurrence, - }; - - // Run request - const response = await containeranalysisClient.updateOccurrence(request); - console.log(response); - } - - callUpdateOccurrence(); - // [END containeranalysis_v1_generated_Grafeas_UpdateOccurrence_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/snippet_metadata_google.devtools.containeranalysis.v1.json b/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/snippet_metadata_google.devtools.containeranalysis.v1.json deleted file mode 100644 index 04873218834..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/samples/generated/v1/snippet_metadata_google.devtools.containeranalysis.v1.json +++ /dev/null @@ -1,827 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-containeranalysis", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.devtools.containeranalysis.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "containeranalysis_v1_generated_ContainerAnalysis_SetIamPolicy_async", - "title": "containeranalysis setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on the specified note or occurrence. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or an occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", - "canonical": true, - "file": "container_analysis.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.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": "ContainerAnalysisClient", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysisClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.SetIamPolicy", - "service": { - "shortName": "ContainerAnalysis", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_ContainerAnalysis_GetIamPolicy_async", - "title": "containeranalysis getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy for a note or an occurrence resource. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", - "canonical": true, - "file": "container_analysis.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "ContainerAnalysisClient", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysisClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.GetIamPolicy", - "service": { - "shortName": "ContainerAnalysis", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_ContainerAnalysis_TestIamPermissions_async", - "title": "containeranalysis testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, `containeranalysis.notes.list`). The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", - "canonical": true, - "file": "container_analysis.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "ContainerAnalysisClient", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysisClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.TestIamPermissions", - "service": { - "shortName": "ContainerAnalysis", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_ContainerAnalysis_GetVulnerabilityOccurrencesSummary_async", - "title": "containeranalysis getVulnerabilityOccurrencesSummary Sample", - "origin": "API_DEFINITION", - "description": " Gets a summary of the number and severity of occurrences.", - "canonical": true, - "file": "container_analysis.get_vulnerability_occurrences_summary.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetVulnerabilityOccurrencesSummary", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.GetVulnerabilityOccurrencesSummary", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary", - "client": { - "shortName": "ContainerAnalysisClient", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysisClient" - }, - "method": { - "shortName": "GetVulnerabilityOccurrencesSummary", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis.GetVulnerabilityOccurrencesSummary", - "service": { - "shortName": "ContainerAnalysis", - "fullName": "google.devtools.containeranalysis.v1.ContainerAnalysis" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_GetOccurrence_async", - "title": "containeranalysis getOccurrence Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified occurrence.", - "canonical": true, - "file": "grafeas.get_occurrence.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOccurrence", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetOccurrence", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1.Occurrence", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "GetOccurrence", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetOccurrence", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_ListOccurrences_async", - "title": "containeranalysis listOccurrences Sample", - "origin": "API_DEFINITION", - "description": " Lists occurrences for the specified project.", - "canonical": true, - "file": "grafeas.list_occurrences.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListOccurrences", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListOccurrences", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1.ListOccurrencesResponse", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "ListOccurrences", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListOccurrences", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_DeleteOccurrence_async", - "title": "containeranalysis deleteOccurrence Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.", - "canonical": true, - "file": "grafeas.delete_occurrence.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteOccurrence", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.DeleteOccurrence", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "DeleteOccurrence", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.DeleteOccurrence", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_CreateOccurrence_async", - "title": "containeranalysis createOccurrence Sample", - "origin": "API_DEFINITION", - "description": " Creates a new occurrence.", - "canonical": true, - "file": "grafeas.create_occurrence.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateOccurrence", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.CreateOccurrence", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "occurrence", - "type": ".grafeas.v1.Occurrence" - } - ], - "resultType": ".grafeas.v1.Occurrence", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "CreateOccurrence", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.CreateOccurrence", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_BatchCreateOccurrences_async", - "title": "containeranalysis batchCreateOccurrences Sample", - "origin": "API_DEFINITION", - "description": " Creates new occurrences in batch.", - "canonical": true, - "file": "grafeas.batch_create_occurrences.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchCreateOccurrences", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.BatchCreateOccurrences", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "occurrences", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".grafeas.v1.BatchCreateOccurrencesResponse", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "BatchCreateOccurrences", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.BatchCreateOccurrences", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_UpdateOccurrence_async", - "title": "containeranalysis updateOccurrence Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified occurrence.", - "canonical": true, - "file": "grafeas.update_occurrence.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateOccurrence", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.UpdateOccurrence", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "occurrence", - "type": ".grafeas.v1.Occurrence" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".grafeas.v1.Occurrence", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "UpdateOccurrence", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.UpdateOccurrence", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_async", - "title": "containeranalysis getOccurrenceNote Sample", - "origin": "API_DEFINITION", - "description": " Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.", - "canonical": true, - "file": "grafeas.get_occurrence_note.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOccurrenceNote", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetOccurrenceNote", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1.Note", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "GetOccurrenceNote", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetOccurrenceNote", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_GetNote_async", - "title": "containeranalysis getNote Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified note.", - "canonical": true, - "file": "grafeas.get_note.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNote", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetNote", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1.Note", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "GetNote", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.GetNote", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_ListNotes_async", - "title": "containeranalysis listNotes Sample", - "origin": "API_DEFINITION", - "description": " Lists notes for the specified project.", - "canonical": true, - "file": "grafeas.list_notes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNotes", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListNotes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1.ListNotesResponse", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "ListNotes", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListNotes", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_DeleteNote_async", - "title": "containeranalysis deleteNote Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified note.", - "canonical": true, - "file": "grafeas.delete_note.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNote", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.DeleteNote", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "DeleteNote", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.DeleteNote", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_CreateNote_async", - "title": "containeranalysis createNote Sample", - "origin": "API_DEFINITION", - "description": " Creates a new note.", - "canonical": true, - "file": "grafeas.create_note.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNote", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.CreateNote", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "note_id", - "type": "TYPE_STRING" - }, - { - "name": "note", - "type": ".grafeas.v1.Note" - } - ], - "resultType": ".grafeas.v1.Note", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "CreateNote", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.CreateNote", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_BatchCreateNotes_async", - "title": "containeranalysis batchCreateNotes Sample", - "origin": "API_DEFINITION", - "description": " Creates new notes in batch.", - "canonical": true, - "file": "grafeas.batch_create_notes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchCreateNotes", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.BatchCreateNotes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "notes", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".grafeas.v1.BatchCreateNotesResponse", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "BatchCreateNotes", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.BatchCreateNotes", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_UpdateNote_async", - "title": "containeranalysis updateNote Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified note.", - "canonical": true, - "file": "grafeas.update_note.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNote", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.UpdateNote", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "note", - "type": ".grafeas.v1.Note" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".grafeas.v1.Note", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "UpdateNote", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.UpdateNote", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - }, - { - "regionTag": "containeranalysis_v1_generated_Grafeas_ListNoteOccurrences_async", - "title": "containeranalysis listNoteOccurrences Sample", - "origin": "API_DEFINITION", - "description": " Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.", - "canonical": true, - "file": "grafeas.list_note_occurrences.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNoteOccurrences", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListNoteOccurrences", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1.ListNoteOccurrencesResponse", - "client": { - "shortName": "GrafeasClient", - "fullName": "google.devtools.containeranalysis.v1.GrafeasClient" - }, - "method": { - "shortName": "ListNoteOccurrences", - "fullName": "google.devtools.containeranalysis.v1.Grafeas.ListNoteOccurrences", - "service": { - "shortName": "Grafeas", - "fullName": "google.devtools.containeranalysis.v1.Grafeas" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/src/index.ts deleted file mode 100644 index e7c583a367b..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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 ContainerAnalysisClient = v1.ContainerAnalysisClient; -type ContainerAnalysisClient = v1.ContainerAnalysisClient; -const GrafeasClient = v1.GrafeasClient; -type GrafeasClient = v1.GrafeasClient; -export {v1, ContainerAnalysisClient, GrafeasClient}; -export default {v1, ContainerAnalysisClient, GrafeasClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client.ts deleted file mode 100644 index 0a132c96912..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client.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. ** - -/* 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/container_analysis_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './container_analysis_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Retrieves analysis results of Cloud components such as Docker container - * images. The Container Analysis API is an implementation of the - * [Grafeas](https://grafeas.io) API. - * - * Analysis results are stored as a series of occurrences. An `Occurrence` - * contains information about a specific analysis instance on a resource. An - * occurrence refers to a `Note`. A note contains details describing the - * analysis and is generally stored in a separate project, called a `Provider`. - * Multiple occurrences can refer to the same note. - * - * For example, an SSL vulnerability could affect multiple images. In this case, - * there would be one note for the vulnerability and an occurrence for each - * image with the vulnerability referring to that note. - * @class - * @memberof v1 - */ -export class ContainerAnalysisClient { - 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}; - containerAnalysisStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ContainerAnalysisClient. - * - * @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 ContainerAnalysisClient({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 ContainerAnalysisClient; - 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 = { - notePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notes/{note}' - ), - occurrencePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/occurrences/{occurrence}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.devtools.containeranalysis.v1.ContainerAnalysis', 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.containerAnalysisStub) { - return this.containerAnalysisStub; - } - - // Put together the "service stub" for - // google.devtools.containeranalysis.v1.ContainerAnalysis. - this.containerAnalysisStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devtools.containeranalysis.v1.ContainerAnalysis') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devtools.containeranalysis.v1.ContainerAnalysis, - 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 containerAnalysisStubMethods = - ['setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'getVulnerabilityOccurrencesSummary']; - for (const methodName of containerAnalysisStubMethods) { - const callPromise = this.containerAnalysisStub.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.containerAnalysisStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'containeranalysis.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 'containeranalysis.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 on the specified note or occurrence. - * Requires `containeranalysis.notes.setIamPolicy` or - * `containeranalysis.occurrences.setIamPolicy` permission if the resource is - * a note or an occurrence, respectively. - * - * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - * occurrences. - * - * @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/container_analysis.set_iam_policy.js - * region_tag:containeranalysis_v1_generated_ContainerAnalysis_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 note or an occurrence resource. - * Requires `containeranalysis.notes.setIamPolicy` or - * `containeranalysis.occurrences.setIamPolicy` permission if the resource is - * a note or occurrence, respectively. - * - * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - * occurrences. - * - * @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/container_analysis.get_iam_policy.js - * region_tag:containeranalysis_v1_generated_ContainerAnalysis_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 the permissions that a caller has on the specified note or - * occurrence. Requires list permission on the project (for example, - * `containeranalysis.notes.list`). - * - * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - * occurrences. - * - * @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/container_analysis.test_iam_permissions.js - * region_tag:containeranalysis_v1_generated_ContainerAnalysis_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 a summary of the number and severity of occurrences. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project to get a vulnerability summary for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary|VulnerabilityOccurrencesSummary}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/container_analysis.get_vulnerability_occurrences_summary.js - * region_tag:containeranalysis_v1_generated_ContainerAnalysis_GetVulnerabilityOccurrencesSummary_async - */ - getVulnerabilityOccurrencesSummary( - request?: protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, - protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|undefined, {}|undefined - ]>; - getVulnerabilityOccurrencesSummary( - request: protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, - protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, - {}|null|undefined>): void; - getVulnerabilityOccurrencesSummary( - request: protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest, - callback: Callback< - protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, - protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, - {}|null|undefined>): void; - getVulnerabilityOccurrencesSummary( - request?: protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, - protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, - protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary, - protos.google.devtools.containeranalysis.v1.IGetVulnerabilityOccurrencesSummaryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.getVulnerabilityOccurrencesSummary(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified note resource name string. - * - * @param {string} project - * @param {string} note - * @returns {string} Resource name string. - */ - notePath(project:string,note:string) { - return this.pathTemplates.notePathTemplate.render({ - project: project, - note: note, - }); - } - - /** - * Parse the project from Note resource. - * - * @param {string} noteName - * A fully-qualified path representing Note resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNoteName(noteName: string) { - return this.pathTemplates.notePathTemplate.match(noteName).project; - } - - /** - * Parse the note from Note resource. - * - * @param {string} noteName - * A fully-qualified path representing Note resource. - * @returns {string} A string representing the note. - */ - matchNoteFromNoteName(noteName: string) { - return this.pathTemplates.notePathTemplate.match(noteName).note; - } - - /** - * Return a fully-qualified occurrence resource name string. - * - * @param {string} project - * @param {string} occurrence - * @returns {string} Resource name string. - */ - occurrencePath(project:string,occurrence:string) { - return this.pathTemplates.occurrencePathTemplate.render({ - project: project, - occurrence: occurrence, - }); - } - - /** - * Parse the project from Occurrence resource. - * - * @param {string} occurrenceName - * A fully-qualified path representing Occurrence resource. - * @returns {string} A string representing the project. - */ - matchProjectFromOccurrenceName(occurrenceName: string) { - return this.pathTemplates.occurrencePathTemplate.match(occurrenceName).project; - } - - /** - * Parse the occurrence from Occurrence resource. - * - * @param {string} occurrenceName - * A fully-qualified path representing Occurrence resource. - * @returns {string} A string representing the occurrence. - */ - matchOccurrenceFromOccurrenceName(occurrenceName: string) { - return this.pathTemplates.occurrencePathTemplate.match(occurrenceName).occurrence; - } - - /** - * 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.containerAnalysisStub && !this._terminated) { - return this.containerAnalysisStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client_config.json b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client_config.json deleted file mode 100644 index 244ccccd2d3..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_client_config.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "interfaces": { - "google.devtools.containeranalysis.v1.ContainerAnalysis": { - "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": { - "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" - }, - "GetVulnerabilityOccurrencesSummary": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_proto_list.json b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_proto_list.json deleted file mode 100644 index 7def0c8942f..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/container_analysis_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/devtools/containeranalysis/v1/containeranalysis.proto", - "../../protos/grafeas/v1/attestation.proto", - "../../protos/grafeas/v1/build.proto", - "../../protos/grafeas/v1/common.proto", - "../../protos/grafeas/v1/compliance.proto", - "../../protos/grafeas/v1/cvss.proto", - "../../protos/grafeas/v1/deployment.proto", - "../../protos/grafeas/v1/discovery.proto", - "../../protos/grafeas/v1/dsse_attestation.proto", - "../../protos/grafeas/v1/grafeas.proto", - "../../protos/grafeas/v1/image.proto", - "../../protos/grafeas/v1/intoto_provenance.proto", - "../../protos/grafeas/v1/intoto_statement.proto", - "../../protos/grafeas/v1/package.proto", - "../../protos/grafeas/v1/provenance.proto", - "../../protos/grafeas/v1/severity.proto", - "../../protos/grafeas/v1/slsa_provenance.proto", - "../../protos/grafeas/v1/slsa_provenance_zero_two.proto", - "../../protos/grafeas/v1/upgrade.proto", - "../../protos/grafeas/v1/vex.proto", - "../../protos/grafeas/v1/vulnerability.proto" -] diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 322e34eece8..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.devtools.containeranalysis.v1", - "libraryPackage": "@google-cloud/containeranalysis", - "services": { - "ContainerAnalysis": { - "clients": { - "grpc": { - "libraryClient": "ContainerAnalysisClient", - "rpcs": { - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "GetVulnerabilityOccurrencesSummary": { - "methods": [ - "getVulnerabilityOccurrencesSummary" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ContainerAnalysisClient", - "rpcs": { - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "GetVulnerabilityOccurrencesSummary": { - "methods": [ - "getVulnerabilityOccurrencesSummary" - ] - } - } - } - } - }, - "Grafeas": { - "clients": { - "grpc": { - "libraryClient": "GrafeasClient", - "rpcs": { - "GetOccurrence": { - "methods": [ - "getOccurrence" - ] - }, - "DeleteOccurrence": { - "methods": [ - "deleteOccurrence" - ] - }, - "CreateOccurrence": { - "methods": [ - "createOccurrence" - ] - }, - "BatchCreateOccurrences": { - "methods": [ - "batchCreateOccurrences" - ] - }, - "UpdateOccurrence": { - "methods": [ - "updateOccurrence" - ] - }, - "GetOccurrenceNote": { - "methods": [ - "getOccurrenceNote" - ] - }, - "GetNote": { - "methods": [ - "getNote" - ] - }, - "DeleteNote": { - "methods": [ - "deleteNote" - ] - }, - "CreateNote": { - "methods": [ - "createNote" - ] - }, - "BatchCreateNotes": { - "methods": [ - "batchCreateNotes" - ] - }, - "UpdateNote": { - "methods": [ - "updateNote" - ] - }, - "ListOccurrences": { - "methods": [ - "listOccurrences", - "listOccurrencesStream", - "listOccurrencesAsync" - ] - }, - "ListNotes": { - "methods": [ - "listNotes", - "listNotesStream", - "listNotesAsync" - ] - }, - "ListNoteOccurrences": { - "methods": [ - "listNoteOccurrences", - "listNoteOccurrencesStream", - "listNoteOccurrencesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "GrafeasClient", - "rpcs": { - "GetOccurrence": { - "methods": [ - "getOccurrence" - ] - }, - "DeleteOccurrence": { - "methods": [ - "deleteOccurrence" - ] - }, - "CreateOccurrence": { - "methods": [ - "createOccurrence" - ] - }, - "BatchCreateOccurrences": { - "methods": [ - "batchCreateOccurrences" - ] - }, - "UpdateOccurrence": { - "methods": [ - "updateOccurrence" - ] - }, - "GetOccurrenceNote": { - "methods": [ - "getOccurrenceNote" - ] - }, - "GetNote": { - "methods": [ - "getNote" - ] - }, - "DeleteNote": { - "methods": [ - "deleteNote" - ] - }, - "CreateNote": { - "methods": [ - "createNote" - ] - }, - "BatchCreateNotes": { - "methods": [ - "batchCreateNotes" - ] - }, - "UpdateNote": { - "methods": [ - "updateNote" - ] - }, - "ListOccurrences": { - "methods": [ - "listOccurrences", - "listOccurrencesStream", - "listOccurrencesAsync" - ] - }, - "ListNotes": { - "methods": [ - "listNotes", - "listNotesStream", - "listNotesAsync" - ] - }, - "ListNoteOccurrences": { - "methods": [ - "listNoteOccurrences", - "listNoteOccurrencesStream", - "listNoteOccurrencesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client.ts deleted file mode 100644 index a7a4b7176ed..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client.ts +++ /dev/null @@ -1,1791 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/grafeas_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './grafeas_client_config.json'; -const version = require('../../../package.json').version; - -/** - * [Grafeas](https://grafeas.io) API. - * - * Retrieves analysis results of Cloud components such as Docker container - * images. - * - * Analysis results are stored as a series of occurrences. An `Occurrence` - * contains information about a specific analysis instance on a resource. An - * occurrence refers to a `Note`. A note contains details describing the - * analysis and is generally stored in a separate project, called a `Provider`. - * Multiple occurrences can refer to the same note. - * - * For example, an SSL vulnerability could affect multiple images. In this case, - * there would be one note for the vulnerability and an occurrence for each - * image with the vulnerability referring to that note. - * @class - * @memberof v1 - */ -export class GrafeasClient { - 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}; - grafeasStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GrafeasClient. - * - * @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 GrafeasClient({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 GrafeasClient; - 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 = { - notePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notes/{note}' - ), - occurrencePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/occurrences/{occurrence}' - ), - 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 = { - listOccurrences: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'occurrences'), - listNotes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notes'), - listNoteOccurrences: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'occurrences') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.devtools.containeranalysis.v1.Grafeas', 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.grafeasStub) { - return this.grafeasStub; - } - - // Put together the "service stub" for - // google.devtools.containeranalysis.v1.Grafeas. - this.grafeasStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devtools.containeranalysis.v1.Grafeas') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devtools.containeranalysis.v1.Grafeas, - 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 grafeasStubMethods = - ['getOccurrence', 'listOccurrences', 'deleteOccurrence', 'createOccurrence', 'batchCreateOccurrences', 'updateOccurrence', 'getOccurrenceNote', 'getNote', 'listNotes', 'deleteNote', 'createNote', 'batchCreateNotes', 'updateNote', 'listNoteOccurrences']; - for (const methodName of grafeasStubMethods) { - const callPromise = this.grafeasStub.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.grafeasStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'containeranalysis.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 'containeranalysis.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 []; - } - - 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 specified occurrence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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.grafeas.v1.Occurrence|Occurrence}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/grafeas.get_occurrence.js - * region_tag:containeranalysis_v1_generated_Grafeas_GetOccurrence_async - */ - getOccurrence( - request?: protos.grafeas.v1.IGetOccurrenceRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IGetOccurrenceRequest|undefined, {}|undefined - ]>; - getOccurrence( - request: protos.grafeas.v1.IGetOccurrenceRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IGetOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - getOccurrence( - request: protos.grafeas.v1.IGetOccurrenceRequest, - callback: Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IGetOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - getOccurrence( - request?: protos.grafeas.v1.IGetOccurrenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IGetOccurrenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IGetOccurrenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IGetOccurrenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getOccurrence(request, options, callback); - } -/** - * Deletes the specified occurrence. For example, use this method to delete an - * occurrence when the occurrence is no longer applicable for the given - * resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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/grafeas.delete_occurrence.js - * region_tag:containeranalysis_v1_generated_Grafeas_DeleteOccurrence_async - */ - deleteOccurrence( - request?: protos.grafeas.v1.IDeleteOccurrenceRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteOccurrenceRequest|undefined, {}|undefined - ]>; - deleteOccurrence( - request: protos.grafeas.v1.IDeleteOccurrenceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - deleteOccurrence( - request: protos.grafeas.v1.IDeleteOccurrenceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - deleteOccurrence( - request?: protos.grafeas.v1.IDeleteOccurrenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteOccurrenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteOccurrenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteOccurrenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteOccurrence(request, options, callback); - } -/** - * Creates a new occurrence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project in the form of `projects/[PROJECT_ID]`, under which - * the occurrence is to be created. - * @param {grafeas.v1.Occurrence} request.occurrence - * The occurrence 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 {@link protos.grafeas.v1.Occurrence|Occurrence}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/grafeas.create_occurrence.js - * region_tag:containeranalysis_v1_generated_Grafeas_CreateOccurrence_async - */ - createOccurrence( - request?: protos.grafeas.v1.ICreateOccurrenceRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.ICreateOccurrenceRequest|undefined, {}|undefined - ]>; - createOccurrence( - request: protos.grafeas.v1.ICreateOccurrenceRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.ICreateOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - createOccurrence( - request: protos.grafeas.v1.ICreateOccurrenceRequest, - callback: Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.ICreateOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - createOccurrence( - request?: protos.grafeas.v1.ICreateOccurrenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.ICreateOccurrenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.ICreateOccurrenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.ICreateOccurrenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createOccurrence(request, options, callback); - } -/** - * Creates new occurrences in batch. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project in the form of `projects/[PROJECT_ID]`, under which - * the occurrences are to be created. - * @param {number[]} request.occurrences - * The occurrences to create. Max allowed length is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.grafeas.v1.BatchCreateOccurrencesResponse|BatchCreateOccurrencesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/grafeas.batch_create_occurrences.js - * region_tag:containeranalysis_v1_generated_Grafeas_BatchCreateOccurrences_async - */ - batchCreateOccurrences( - request?: protos.grafeas.v1.IBatchCreateOccurrencesRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1.IBatchCreateOccurrencesRequest|undefined, {}|undefined - ]>; - batchCreateOccurrences( - request: protos.grafeas.v1.IBatchCreateOccurrencesRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1.IBatchCreateOccurrencesRequest|null|undefined, - {}|null|undefined>): void; - batchCreateOccurrences( - request: protos.grafeas.v1.IBatchCreateOccurrencesRequest, - callback: Callback< - protos.grafeas.v1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1.IBatchCreateOccurrencesRequest|null|undefined, - {}|null|undefined>): void; - batchCreateOccurrences( - request?: protos.grafeas.v1.IBatchCreateOccurrencesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1.IBatchCreateOccurrencesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1.IBatchCreateOccurrencesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1.IBatchCreateOccurrencesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.batchCreateOccurrences(request, options, callback); - } -/** - * Updates the specified occurrence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - * @param {grafeas.v1.Occurrence} request.occurrence - * The updated occurrence. - * @param {google.protobuf.FieldMask} request.updateMask - * The fields to update. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.grafeas.v1.Occurrence|Occurrence}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/grafeas.update_occurrence.js - * region_tag:containeranalysis_v1_generated_Grafeas_UpdateOccurrence_async - */ - updateOccurrence( - request?: protos.grafeas.v1.IUpdateOccurrenceRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IUpdateOccurrenceRequest|undefined, {}|undefined - ]>; - updateOccurrence( - request: protos.grafeas.v1.IUpdateOccurrenceRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IUpdateOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - updateOccurrence( - request: protos.grafeas.v1.IUpdateOccurrenceRequest, - callback: Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IUpdateOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - updateOccurrence( - request?: protos.grafeas.v1.IUpdateOccurrenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IUpdateOccurrenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IUpdateOccurrenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1.IOccurrence, - protos.grafeas.v1.IUpdateOccurrenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateOccurrence(request, options, callback); - } -/** - * Gets the note attached to the specified occurrence. Consumer projects can - * use this method to get a note that belongs to a provider project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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.grafeas.v1.Note|Note}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/grafeas.get_occurrence_note.js - * region_tag:containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_async - */ - getOccurrenceNote( - request?: protos.grafeas.v1.IGetOccurrenceNoteRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetOccurrenceNoteRequest|undefined, {}|undefined - ]>; - getOccurrenceNote( - request: protos.grafeas.v1.IGetOccurrenceNoteRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetOccurrenceNoteRequest|null|undefined, - {}|null|undefined>): void; - getOccurrenceNote( - request: protos.grafeas.v1.IGetOccurrenceNoteRequest, - callback: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetOccurrenceNoteRequest|null|undefined, - {}|null|undefined>): void; - getOccurrenceNote( - request?: protos.grafeas.v1.IGetOccurrenceNoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetOccurrenceNoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetOccurrenceNoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetOccurrenceNoteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getOccurrenceNote(request, options, callback); - } -/** - * Gets the specified note. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_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.grafeas.v1.Note|Note}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/grafeas.get_note.js - * region_tag:containeranalysis_v1_generated_Grafeas_GetNote_async - */ - getNote( - request?: protos.grafeas.v1.IGetNoteRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetNoteRequest|undefined, {}|undefined - ]>; - getNote( - request: protos.grafeas.v1.IGetNoteRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetNoteRequest|null|undefined, - {}|null|undefined>): void; - getNote( - request: protos.grafeas.v1.IGetNoteRequest, - callback: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetNoteRequest|null|undefined, - {}|null|undefined>): void; - getNote( - request?: protos.grafeas.v1.IGetNoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetNoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetNoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1.INote, - protos.grafeas.v1.IGetNoteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getNote(request, options, callback); - } -/** - * Deletes the specified note. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_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/grafeas.delete_note.js - * region_tag:containeranalysis_v1_generated_Grafeas_DeleteNote_async - */ - deleteNote( - request?: protos.grafeas.v1.IDeleteNoteRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteNoteRequest|undefined, {}|undefined - ]>; - deleteNote( - request: protos.grafeas.v1.IDeleteNoteRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteNoteRequest|null|undefined, - {}|null|undefined>): void; - deleteNote( - request: protos.grafeas.v1.IDeleteNoteRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteNoteRequest|null|undefined, - {}|null|undefined>): void; - deleteNote( - request?: protos.grafeas.v1.IDeleteNoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteNoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteNoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.grafeas.v1.IDeleteNoteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteNote(request, options, callback); - } -/** - * Creates a new note. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project in the form of `projects/[PROJECT_ID]`, under which - * the note is to be created. - * @param {string} request.noteId - * The ID to use for this note. - * @param {grafeas.v1.Note} request.note - * The note 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 {@link protos.grafeas.v1.Note|Note}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/grafeas.create_note.js - * region_tag:containeranalysis_v1_generated_Grafeas_CreateNote_async - */ - createNote( - request?: protos.grafeas.v1.ICreateNoteRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.INote, - protos.grafeas.v1.ICreateNoteRequest|undefined, {}|undefined - ]>; - createNote( - request: protos.grafeas.v1.ICreateNoteRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.ICreateNoteRequest|null|undefined, - {}|null|undefined>): void; - createNote( - request: protos.grafeas.v1.ICreateNoteRequest, - callback: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.ICreateNoteRequest|null|undefined, - {}|null|undefined>): void; - createNote( - request?: protos.grafeas.v1.ICreateNoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.ICreateNoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.ICreateNoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1.INote, - protos.grafeas.v1.ICreateNoteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createNote(request, options, callback); - } -/** - * Creates new notes in batch. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project in the form of `projects/[PROJECT_ID]`, under which - * the notes are to be created. - * @param {number[]} request.notes - * The notes to create. Max allowed length is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.grafeas.v1.BatchCreateNotesResponse|BatchCreateNotesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/grafeas.batch_create_notes.js - * region_tag:containeranalysis_v1_generated_Grafeas_BatchCreateNotes_async - */ - batchCreateNotes( - request?: protos.grafeas.v1.IBatchCreateNotesRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.IBatchCreateNotesResponse, - protos.grafeas.v1.IBatchCreateNotesRequest|undefined, {}|undefined - ]>; - batchCreateNotes( - request: protos.grafeas.v1.IBatchCreateNotesRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1.IBatchCreateNotesResponse, - protos.grafeas.v1.IBatchCreateNotesRequest|null|undefined, - {}|null|undefined>): void; - batchCreateNotes( - request: protos.grafeas.v1.IBatchCreateNotesRequest, - callback: Callback< - protos.grafeas.v1.IBatchCreateNotesResponse, - protos.grafeas.v1.IBatchCreateNotesRequest|null|undefined, - {}|null|undefined>): void; - batchCreateNotes( - request?: protos.grafeas.v1.IBatchCreateNotesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1.IBatchCreateNotesResponse, - protos.grafeas.v1.IBatchCreateNotesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1.IBatchCreateNotesResponse, - protos.grafeas.v1.IBatchCreateNotesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1.IBatchCreateNotesResponse, - protos.grafeas.v1.IBatchCreateNotesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.batchCreateNotes(request, options, callback); - } -/** - * Updates the specified note. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - * @param {grafeas.v1.Note} request.note - * The updated note. - * @param {google.protobuf.FieldMask} request.updateMask - * The fields to update. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.grafeas.v1.Note|Note}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/grafeas.update_note.js - * region_tag:containeranalysis_v1_generated_Grafeas_UpdateNote_async - */ - updateNote( - request?: protos.grafeas.v1.IUpdateNoteRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.INote, - protos.grafeas.v1.IUpdateNoteRequest|undefined, {}|undefined - ]>; - updateNote( - request: protos.grafeas.v1.IUpdateNoteRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IUpdateNoteRequest|null|undefined, - {}|null|undefined>): void; - updateNote( - request: protos.grafeas.v1.IUpdateNoteRequest, - callback: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IUpdateNoteRequest|null|undefined, - {}|null|undefined>): void; - updateNote( - request?: protos.grafeas.v1.IUpdateNoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IUpdateNoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1.INote, - protos.grafeas.v1.IUpdateNoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1.INote, - protos.grafeas.v1.IUpdateNoteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateNote(request, options, callback); - } - - /** - * Lists occurrences for the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project to list occurrences for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. Must be positive. Max allowed - * page size is 1000. If not specified, page size defaults to 20. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence}. - * 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 `listOccurrencesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listOccurrences( - request?: protos.grafeas.v1.IListOccurrencesRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.IOccurrence[], - protos.grafeas.v1.IListOccurrencesRequest|null, - protos.grafeas.v1.IListOccurrencesResponse - ]>; - listOccurrences( - request: protos.grafeas.v1.IListOccurrencesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.grafeas.v1.IListOccurrencesRequest, - protos.grafeas.v1.IListOccurrencesResponse|null|undefined, - protos.grafeas.v1.IOccurrence>): void; - listOccurrences( - request: protos.grafeas.v1.IListOccurrencesRequest, - callback: PaginationCallback< - protos.grafeas.v1.IListOccurrencesRequest, - protos.grafeas.v1.IListOccurrencesResponse|null|undefined, - protos.grafeas.v1.IOccurrence>): void; - listOccurrences( - request?: protos.grafeas.v1.IListOccurrencesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.grafeas.v1.IListOccurrencesRequest, - protos.grafeas.v1.IListOccurrencesResponse|null|undefined, - protos.grafeas.v1.IOccurrence>, - callback?: PaginationCallback< - protos.grafeas.v1.IListOccurrencesRequest, - protos.grafeas.v1.IListOccurrencesResponse|null|undefined, - protos.grafeas.v1.IOccurrence>): - Promise<[ - protos.grafeas.v1.IOccurrence[], - protos.grafeas.v1.IListOccurrencesRequest|null, - protos.grafeas.v1.IListOccurrencesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listOccurrences(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 name of the project to list occurrences for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. Must be positive. Max allowed - * page size is 1000. If not specified, page size defaults to 20. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence} 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 `listOccurrencesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listOccurrencesStream( - request?: protos.grafeas.v1.IListOccurrencesRequest, - 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['listOccurrences']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listOccurrences.createStream( - this.innerApiCalls.listOccurrences as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listOccurrences`, 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 name of the project to list occurrences for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. Must be positive. Max allowed - * page size is 1000. If not specified, page size defaults to 20. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence}. 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/grafeas.list_occurrences.js - * region_tag:containeranalysis_v1_generated_Grafeas_ListOccurrences_async - */ - listOccurrencesAsync( - request?: protos.grafeas.v1.IListOccurrencesRequest, - 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['listOccurrences']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listOccurrences.asyncIterate( - this.innerApiCalls['listOccurrences'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists notes for the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project to list notes for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of notes to return in the list. Must be positive. Max allowed page - * size is 1000. If not specified, page size defaults to 20. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1.Note|Note}. - * 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 `listNotesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNotes( - request?: protos.grafeas.v1.IListNotesRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.INote[], - protos.grafeas.v1.IListNotesRequest|null, - protos.grafeas.v1.IListNotesResponse - ]>; - listNotes( - request: protos.grafeas.v1.IListNotesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.grafeas.v1.IListNotesRequest, - protos.grafeas.v1.IListNotesResponse|null|undefined, - protos.grafeas.v1.INote>): void; - listNotes( - request: protos.grafeas.v1.IListNotesRequest, - callback: PaginationCallback< - protos.grafeas.v1.IListNotesRequest, - protos.grafeas.v1.IListNotesResponse|null|undefined, - protos.grafeas.v1.INote>): void; - listNotes( - request?: protos.grafeas.v1.IListNotesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.grafeas.v1.IListNotesRequest, - protos.grafeas.v1.IListNotesResponse|null|undefined, - protos.grafeas.v1.INote>, - callback?: PaginationCallback< - protos.grafeas.v1.IListNotesRequest, - protos.grafeas.v1.IListNotesResponse|null|undefined, - protos.grafeas.v1.INote>): - Promise<[ - protos.grafeas.v1.INote[], - protos.grafeas.v1.IListNotesRequest|null, - protos.grafeas.v1.IListNotesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listNotes(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 name of the project to list notes for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of notes to return in the list. Must be positive. Max allowed page - * size is 1000. If not specified, page size defaults to 20. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1.Note|Note} 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 `listNotesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNotesStream( - request?: protos.grafeas.v1.IListNotesRequest, - 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['listNotes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotes.createStream( - this.innerApiCalls.listNotes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNotes`, 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 name of the project to list notes for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of notes to return in the list. Must be positive. Max allowed page - * size is 1000. If not specified, page size defaults to 20. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1.Note|Note}. 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/grafeas.list_notes.js - * region_tag:containeranalysis_v1_generated_Grafeas_ListNotes_async - */ - listNotesAsync( - request?: protos.grafeas.v1.IListNotesRequest, - 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['listNotes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotes.asyncIterate( - this.innerApiCalls['listNotes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists occurrences referencing the specified note. Provider projects can use - * this method to get all occurrences across consumer projects referencing the - * specified note. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the note to list occurrences for in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence}. - * 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 `listNoteOccurrencesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNoteOccurrences( - request?: protos.grafeas.v1.IListNoteOccurrencesRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1.IOccurrence[], - protos.grafeas.v1.IListNoteOccurrencesRequest|null, - protos.grafeas.v1.IListNoteOccurrencesResponse - ]>; - listNoteOccurrences( - request: protos.grafeas.v1.IListNoteOccurrencesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.grafeas.v1.IListNoteOccurrencesRequest, - protos.grafeas.v1.IListNoteOccurrencesResponse|null|undefined, - protos.grafeas.v1.IOccurrence>): void; - listNoteOccurrences( - request: protos.grafeas.v1.IListNoteOccurrencesRequest, - callback: PaginationCallback< - protos.grafeas.v1.IListNoteOccurrencesRequest, - protos.grafeas.v1.IListNoteOccurrencesResponse|null|undefined, - protos.grafeas.v1.IOccurrence>): void; - listNoteOccurrences( - request?: protos.grafeas.v1.IListNoteOccurrencesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.grafeas.v1.IListNoteOccurrencesRequest, - protos.grafeas.v1.IListNoteOccurrencesResponse|null|undefined, - protos.grafeas.v1.IOccurrence>, - callback?: PaginationCallback< - protos.grafeas.v1.IListNoteOccurrencesRequest, - protos.grafeas.v1.IListNoteOccurrencesResponse|null|undefined, - protos.grafeas.v1.IOccurrence>): - Promise<[ - protos.grafeas.v1.IOccurrence[], - protos.grafeas.v1.IListNoteOccurrencesRequest|null, - protos.grafeas.v1.IListNoteOccurrencesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.listNoteOccurrences(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.name - * The name of the note to list occurrences for in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence} 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 `listNoteOccurrencesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNoteOccurrencesStream( - request?: protos.grafeas.v1.IListNoteOccurrencesRequest, - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNoteOccurrences']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNoteOccurrences.createStream( - this.innerApiCalls.listNoteOccurrences as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNoteOccurrences`, 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.name - * The name of the note to list occurrences for in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1.Occurrence|Occurrence}. 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/grafeas.list_note_occurrences.js - * region_tag:containeranalysis_v1_generated_Grafeas_ListNoteOccurrences_async - */ - listNoteOccurrencesAsync( - request?: protos.grafeas.v1.IListNoteOccurrencesRequest, - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNoteOccurrences']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNoteOccurrences.asyncIterate( - this.innerApiCalls['listNoteOccurrences'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified note resource name string. - * - * @param {string} project - * @param {string} note - * @returns {string} Resource name string. - */ - notePath(project:string,note:string) { - return this.pathTemplates.notePathTemplate.render({ - project: project, - note: note, - }); - } - - /** - * Parse the project from Note resource. - * - * @param {string} noteName - * A fully-qualified path representing Note resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNoteName(noteName: string) { - return this.pathTemplates.notePathTemplate.match(noteName).project; - } - - /** - * Parse the note from Note resource. - * - * @param {string} noteName - * A fully-qualified path representing Note resource. - * @returns {string} A string representing the note. - */ - matchNoteFromNoteName(noteName: string) { - return this.pathTemplates.notePathTemplate.match(noteName).note; - } - - /** - * Return a fully-qualified occurrence resource name string. - * - * @param {string} project - * @param {string} occurrence - * @returns {string} Resource name string. - */ - occurrencePath(project:string,occurrence:string) { - return this.pathTemplates.occurrencePathTemplate.render({ - project: project, - occurrence: occurrence, - }); - } - - /** - * Parse the project from Occurrence resource. - * - * @param {string} occurrenceName - * A fully-qualified path representing Occurrence resource. - * @returns {string} A string representing the project. - */ - matchProjectFromOccurrenceName(occurrenceName: string) { - return this.pathTemplates.occurrencePathTemplate.match(occurrenceName).project; - } - - /** - * Parse the occurrence from Occurrence resource. - * - * @param {string} occurrenceName - * A fully-qualified path representing Occurrence resource. - * @returns {string} A string representing the occurrence. - */ - matchOccurrenceFromOccurrenceName(occurrenceName: string) { - return this.pathTemplates.occurrencePathTemplate.match(occurrenceName).occurrence; - } - - /** - * 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.grafeasStub && !this._terminated) { - return this.grafeasStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client_config.json b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client_config.json deleted file mode 100644 index 5a325a2642b..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_client_config.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "interfaces": { - "google.devtools.containeranalysis.v1.Grafeas": { - "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": { - "GetOccurrence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListOccurrences": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteOccurrence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateOccurrence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchCreateOccurrences": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateOccurrence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetOccurrenceNote": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNote": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListNotes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNote": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateNote": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchCreateNotes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNote": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListNoteOccurrences": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_proto_list.json b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_proto_list.json deleted file mode 100644 index 7def0c8942f..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/grafeas_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/devtools/containeranalysis/v1/containeranalysis.proto", - "../../protos/grafeas/v1/attestation.proto", - "../../protos/grafeas/v1/build.proto", - "../../protos/grafeas/v1/common.proto", - "../../protos/grafeas/v1/compliance.proto", - "../../protos/grafeas/v1/cvss.proto", - "../../protos/grafeas/v1/deployment.proto", - "../../protos/grafeas/v1/discovery.proto", - "../../protos/grafeas/v1/dsse_attestation.proto", - "../../protos/grafeas/v1/grafeas.proto", - "../../protos/grafeas/v1/image.proto", - "../../protos/grafeas/v1/intoto_provenance.proto", - "../../protos/grafeas/v1/intoto_statement.proto", - "../../protos/grafeas/v1/package.proto", - "../../protos/grafeas/v1/provenance.proto", - "../../protos/grafeas/v1/severity.proto", - "../../protos/grafeas/v1/slsa_provenance.proto", - "../../protos/grafeas/v1/slsa_provenance_zero_two.proto", - "../../protos/grafeas/v1/upgrade.proto", - "../../protos/grafeas/v1/vex.proto", - "../../protos/grafeas/v1/vulnerability.proto" -] diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/src/v1/index.ts deleted file mode 100644 index acbad9d23df..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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 {ContainerAnalysisClient} from './container_analysis_client'; -export {GrafeasClient} from './grafeas_client'; diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index b1e0d92929f..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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 containeranalysis = require('@google-cloud/containeranalysis'); - -function main() { - const containerAnalysisClient = new containeranalysis.ContainerAnalysisClient(); - const grafeasClient = new containeranalysis.GrafeasClient(); -} - -main(); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 06459bfc2e1..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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 {ContainerAnalysisClient, GrafeasClient} from '@google-cloud/containeranalysis'; - -// check that the client class type name can be used -function doStuffWithContainerAnalysisClient(client: ContainerAnalysisClient) { - client.close(); -} -function doStuffWithGrafeasClient(client: GrafeasClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const containerAnalysisClient = new ContainerAnalysisClient(); - doStuffWithContainerAnalysisClient(containerAnalysisClient); - // check that the client instance can be created - const grafeasClient = new GrafeasClient(); - doStuffWithGrafeasClient(grafeasClient); -} - -main(); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/install.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1/test/gapic_container_analysis_v1.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_container_analysis_v1.ts deleted file mode 100644 index 4a04a18a249..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_container_analysis_v1.ts +++ /dev/null @@ -1,691 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 containeranalysisModule 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.ContainerAnalysisClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = containeranalysisModule.v1.ContainerAnalysisClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = containeranalysisModule.v1.ContainerAnalysisClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = containeranalysisModule.v1.ContainerAnalysisClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new containeranalysisModule.v1.ContainerAnalysisClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.containerAnalysisStub, undefined); - await client.initialize(); - assert(client.containerAnalysisStub); - }); - - it('has close method for the initialized client', done => { - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.containerAnalysisStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.containerAnalysisStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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 containeranalysisModule.v1.ContainerAnalysisClient({ - 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('getVulnerabilityOccurrencesSummary', () => { - it('invokes getVulnerabilityOccurrencesSummary without error', async () => { - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary() - ); - client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCall(expectedResponse); - const [response] = await client.getVulnerabilityOccurrencesSummary(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVulnerabilityOccurrencesSummary without error using callback', async () => { - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary() - ); - client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getVulnerabilityOccurrencesSummary( - request, - (err?: Error|null, result?: protos.google.devtools.containeranalysis.v1.IVulnerabilityOccurrencesSummary|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVulnerabilityOccurrencesSummary with error', async () => { - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVulnerabilityOccurrencesSummary(request), expectedError); - const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVulnerabilityOccurrencesSummary with closed client', async () => { - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getVulnerabilityOccurrencesSummary(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('note', () => { - const fakePath = "/rendered/path/note"; - const expectedParameters = { - project: "projectValue", - note: "noteValue", - }; - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.notePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.notePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('notePath', () => { - const result = client.notePath("projectValue", "noteValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.notePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNoteName', () => { - const result = client.matchProjectFromNoteName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.notePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNoteFromNoteName', () => { - const result = client.matchNoteFromNoteName(fakePath); - assert.strictEqual(result, "noteValue"); - assert((client.pathTemplates.notePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('occurrence', () => { - const fakePath = "/rendered/path/occurrence"; - const expectedParameters = { - project: "projectValue", - occurrence: "occurrenceValue", - }; - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.occurrencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.occurrencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('occurrencePath', () => { - const result = client.occurrencePath("projectValue", "occurrenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.occurrencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromOccurrenceName', () => { - const result = client.matchProjectFromOccurrenceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.occurrencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchOccurrenceFromOccurrenceName', () => { - const result = client.matchOccurrenceFromOccurrenceName(fakePath); - assert.strictEqual(result, "occurrenceValue"); - assert((client.pathTemplates.occurrencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new containeranalysisModule.v1.ContainerAnalysisClient({ - 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-devtools-containeranalysis/v1/test/gapic_grafeas_v1.ts b/owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_grafeas_v1.ts deleted file mode 100644 index 3cb11ce1fd7..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1/test/gapic_grafeas_v1.ts +++ /dev/null @@ -1,2229 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 grafeasModule 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.GrafeasClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = grafeasModule.v1.GrafeasClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = grafeasModule.v1.GrafeasClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = grafeasModule.v1.GrafeasClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new grafeasModule.v1.GrafeasClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new grafeasModule.v1.GrafeasClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.grafeasStub, undefined); - await client.initialize(); - assert(client.grafeasStub); - }); - - it('has close method for the initialized client', done => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.grafeasStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.grafeasStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new grafeasModule.v1.GrafeasClient({ - 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 grafeasModule.v1.GrafeasClient({ - 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('getOccurrence', () => { - it('invokes getOccurrence without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Occurrence() - ); - client.innerApiCalls.getOccurrence = stubSimpleCall(expectedResponse); - const [response] = await client.getOccurrence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrence without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Occurrence() - ); - client.innerApiCalls.getOccurrence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOccurrence( - request, - (err?: Error|null, result?: protos.grafeas.v1.IOccurrence|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrence with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getOccurrence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOccurrence(request), expectedError); - const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrence with closed client', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOccurrence(request), expectedError); - }); - }); - - describe('deleteOccurrence', () => { - it('invokes deleteOccurrence without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.DeleteOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.DeleteOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteOccurrence = stubSimpleCall(expectedResponse); - const [response] = await client.deleteOccurrence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteOccurrence without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.DeleteOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.DeleteOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteOccurrence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteOccurrence( - 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.deleteOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteOccurrence with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.DeleteOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.DeleteOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteOccurrence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteOccurrence(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteOccurrence with closed client', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.DeleteOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.DeleteOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteOccurrence(request), expectedError); - }); - }); - - describe('createOccurrence', () => { - it('invokes createOccurrence without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.CreateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.CreateOccurrenceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Occurrence() - ); - client.innerApiCalls.createOccurrence = stubSimpleCall(expectedResponse); - const [response] = await client.createOccurrence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createOccurrence without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.CreateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.CreateOccurrenceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Occurrence() - ); - client.innerApiCalls.createOccurrence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createOccurrence( - request, - (err?: Error|null, result?: protos.grafeas.v1.IOccurrence|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createOccurrence with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.CreateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.CreateOccurrenceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createOccurrence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createOccurrence(request), expectedError); - const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createOccurrence with closed client', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.CreateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.CreateOccurrenceRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createOccurrence(request), expectedError); - }); - }); - - describe('batchCreateOccurrences', () => { - it('invokes batchCreateOccurrences without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.BatchCreateOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.BatchCreateOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.BatchCreateOccurrencesResponse() - ); - client.innerApiCalls.batchCreateOccurrences = stubSimpleCall(expectedResponse); - const [response] = await client.batchCreateOccurrences(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateOccurrences without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.BatchCreateOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.BatchCreateOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.BatchCreateOccurrencesResponse() - ); - client.innerApiCalls.batchCreateOccurrences = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchCreateOccurrences( - request, - (err?: Error|null, result?: protos.grafeas.v1.IBatchCreateOccurrencesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateOccurrences with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.BatchCreateOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.BatchCreateOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateOccurrences = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchCreateOccurrences(request), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateOccurrences with closed client', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.BatchCreateOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.BatchCreateOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchCreateOccurrences(request), expectedError); - }); - }); - - describe('updateOccurrence', () => { - it('invokes updateOccurrence without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.UpdateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.UpdateOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Occurrence() - ); - client.innerApiCalls.updateOccurrence = stubSimpleCall(expectedResponse); - const [response] = await client.updateOccurrence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOccurrence without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.UpdateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.UpdateOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Occurrence() - ); - client.innerApiCalls.updateOccurrence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateOccurrence( - request, - (err?: Error|null, result?: protos.grafeas.v1.IOccurrence|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOccurrence with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.UpdateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.UpdateOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateOccurrence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateOccurrence(request), expectedError); - const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOccurrence with closed client', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.UpdateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.UpdateOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateOccurrence(request), expectedError); - }); - }); - - describe('getOccurrenceNote', () => { - it('invokes getOccurrenceNote without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetOccurrenceNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetOccurrenceNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Note() - ); - client.innerApiCalls.getOccurrenceNote = stubSimpleCall(expectedResponse); - const [response] = await client.getOccurrenceNote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrenceNote without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetOccurrenceNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetOccurrenceNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Note() - ); - client.innerApiCalls.getOccurrenceNote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOccurrenceNote( - request, - (err?: Error|null, result?: protos.grafeas.v1.INote|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrenceNote with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetOccurrenceNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetOccurrenceNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getOccurrenceNote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOccurrenceNote(request), expectedError); - const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrenceNote with closed client', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetOccurrenceNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetOccurrenceNoteRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOccurrenceNote(request), expectedError); - }); - }); - - describe('getNote', () => { - it('invokes getNote without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Note() - ); - client.innerApiCalls.getNote = stubSimpleCall(expectedResponse); - const [response] = await client.getNote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNote without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Note() - ); - client.innerApiCalls.getNote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNote( - request, - (err?: Error|null, result?: protos.grafeas.v1.INote|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNote with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNote(request), expectedError); - const actualRequest = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNote with closed client', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.GetNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.GetNoteRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNote(request), expectedError); - }); - }); - - describe('deleteNote', () => { - it('invokes deleteNote without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.DeleteNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.DeleteNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNote = stubSimpleCall(expectedResponse); - const [response] = await client.deleteNote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNote without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.DeleteNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.DeleteNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNote( - 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.deleteNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNote with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.DeleteNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.DeleteNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteNote(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNote with closed client', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.DeleteNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.DeleteNoteRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteNote(request), expectedError); - }); - }); - - describe('createNote', () => { - it('invokes createNote without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.CreateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.CreateNoteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Note() - ); - client.innerApiCalls.createNote = stubSimpleCall(expectedResponse); - const [response] = await client.createNote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNote without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.CreateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.CreateNoteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Note() - ); - client.innerApiCalls.createNote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNote( - request, - (err?: Error|null, result?: protos.grafeas.v1.INote|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNote with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.CreateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.CreateNoteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createNote(request), expectedError); - const actualRequest = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNote with closed client', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.CreateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.CreateNoteRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createNote(request), expectedError); - }); - }); - - describe('batchCreateNotes', () => { - it('invokes batchCreateNotes without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.BatchCreateNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.BatchCreateNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.BatchCreateNotesResponse() - ); - client.innerApiCalls.batchCreateNotes = stubSimpleCall(expectedResponse); - const [response] = await client.batchCreateNotes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateNotes without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.BatchCreateNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.BatchCreateNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.BatchCreateNotesResponse() - ); - client.innerApiCalls.batchCreateNotes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchCreateNotes( - request, - (err?: Error|null, result?: protos.grafeas.v1.IBatchCreateNotesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateNotes with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.BatchCreateNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.BatchCreateNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateNotes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchCreateNotes(request), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateNotes with closed client', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.BatchCreateNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.BatchCreateNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchCreateNotes(request), expectedError); - }); - }); - - describe('updateNote', () => { - it('invokes updateNote without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.UpdateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.UpdateNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Note() - ); - client.innerApiCalls.updateNote = stubSimpleCall(expectedResponse); - const [response] = await client.updateNote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNote without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.UpdateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.UpdateNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1.Note() - ); - client.innerApiCalls.updateNote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNote( - request, - (err?: Error|null, result?: protos.grafeas.v1.INote|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNote with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.UpdateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.UpdateNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateNote(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNote with closed client', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.UpdateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.UpdateNoteRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateNote(request), expectedError); - }); - }); - - describe('listOccurrences', () => { - it('invokes listOccurrences without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - ]; - client.innerApiCalls.listOccurrences = stubSimpleCall(expectedResponse); - const [response] = await client.listOccurrences(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOccurrences without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - ]; - client.innerApiCalls.listOccurrences = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listOccurrences( - request, - (err?: Error|null, result?: protos.grafeas.v1.IOccurrence[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOccurrences with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listOccurrences = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listOccurrences(request), expectedError); - const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOccurrencesStream without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - ]; - client.descriptors.page.listOccurrences.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listOccurrencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1.Occurrence[] = []; - stream.on('data', (response: protos.grafeas.v1.Occurrence) => { - 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.listOccurrences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listOccurrences, request)); - assert( - (client.descriptors.page.listOccurrences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listOccurrencesStream with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listOccurrences.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listOccurrencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1.Occurrence[] = []; - stream.on('data', (response: protos.grafeas.v1.Occurrence) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listOccurrences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listOccurrences, request)); - assert( - (client.descriptors.page.listOccurrences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listOccurrences without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - ]; - client.descriptors.page.listOccurrences.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.grafeas.v1.IOccurrence[] = []; - const iterable = client.listOccurrencesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listOccurrences with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listOccurrences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listOccurrencesAsync(request); - await assert.rejects(async () => { - const responses: protos.grafeas.v1.IOccurrence[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listNotes', () => { - it('invokes listNotes without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Note()), - generateSampleMessage(new protos.grafeas.v1.Note()), - generateSampleMessage(new protos.grafeas.v1.Note()), - ]; - client.innerApiCalls.listNotes = stubSimpleCall(expectedResponse); - const [response] = await client.listNotes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotes without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Note()), - generateSampleMessage(new protos.grafeas.v1.Note()), - generateSampleMessage(new protos.grafeas.v1.Note()), - ]; - client.innerApiCalls.listNotes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotes( - request, - (err?: Error|null, result?: protos.grafeas.v1.INote[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotes with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotes(request), expectedError); - const actualRequest = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotesStream without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Note()), - generateSampleMessage(new protos.grafeas.v1.Note()), - generateSampleMessage(new protos.grafeas.v1.Note()), - ]; - client.descriptors.page.listNotes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1.Note[] = []; - stream.on('data', (response: protos.grafeas.v1.Note) => { - 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.listNotes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotes, request)); - assert( - (client.descriptors.page.listNotes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNotesStream with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1.Note[] = []; - stream.on('data', (response: protos.grafeas.v1.Note) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotes, request)); - assert( - (client.descriptors.page.listNotes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotes without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Note()), - generateSampleMessage(new protos.grafeas.v1.Note()), - generateSampleMessage(new protos.grafeas.v1.Note()), - ]; - client.descriptors.page.listNotes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.grafeas.v1.INote[] = []; - const iterable = client.listNotesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotes with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotesAsync(request); - await assert.rejects(async () => { - const responses: protos.grafeas.v1.INote[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listNoteOccurrences', () => { - it('invokes listNoteOccurrences without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - ]; - client.innerApiCalls.listNoteOccurrences = stubSimpleCall(expectedResponse); - const [response] = await client.listNoteOccurrences(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNoteOccurrences without error using callback', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - ]; - client.innerApiCalls.listNoteOccurrences = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNoteOccurrences( - request, - (err?: Error|null, result?: protos.grafeas.v1.IOccurrence[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNoteOccurrences with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNoteOccurrences = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNoteOccurrences(request), expectedError); - const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNoteOccurrencesStream without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - ]; - client.descriptors.page.listNoteOccurrences.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNoteOccurrencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1.Occurrence[] = []; - stream.on('data', (response: protos.grafeas.v1.Occurrence) => { - 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.listNoteOccurrences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNoteOccurrences, request)); - assert( - (client.descriptors.page.listNoteOccurrences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNoteOccurrencesStream with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNoteOccurrences.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNoteOccurrencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1.Occurrence[] = []; - stream.on('data', (response: protos.grafeas.v1.Occurrence) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNoteOccurrences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNoteOccurrences, request)); - assert( - (client.descriptors.page.listNoteOccurrences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNoteOccurrences without error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1.Occurrence()), - ]; - client.descriptors.page.listNoteOccurrences.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.grafeas.v1.IOccurrence[] = []; - const iterable = client.listNoteOccurrencesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNoteOccurrences with error', async () => { - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNoteOccurrences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNoteOccurrencesAsync(request); - await assert.rejects(async () => { - const responses: protos.grafeas.v1.IOccurrence[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('note', () => { - const fakePath = "/rendered/path/note"; - const expectedParameters = { - project: "projectValue", - note: "noteValue", - }; - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.notePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.notePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('notePath', () => { - const result = client.notePath("projectValue", "noteValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.notePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNoteName', () => { - const result = client.matchProjectFromNoteName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.notePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNoteFromNoteName', () => { - const result = client.matchNoteFromNoteName(fakePath); - assert.strictEqual(result, "noteValue"); - assert((client.pathTemplates.notePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('occurrence', () => { - const fakePath = "/rendered/path/occurrence"; - const expectedParameters = { - project: "projectValue", - occurrence: "occurrenceValue", - }; - const client = new grafeasModule.v1.GrafeasClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.occurrencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.occurrencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('occurrencePath', () => { - const result = client.occurrencePath("projectValue", "occurrenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.occurrencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromOccurrenceName', () => { - const result = client.matchProjectFromOccurrenceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.occurrencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchOccurrenceFromOccurrenceName', () => { - const result = client.matchOccurrenceFromOccurrenceName(fakePath); - assert.strictEqual(result, "occurrenceValue"); - assert((client.pathTemplates.occurrencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new grafeasModule.v1.GrafeasClient({ - 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-devtools-containeranalysis/v1/tsconfig.json b/owl-bot-staging/google-devtools-containeranalysis/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1/webpack.config.js b/owl-bot-staging/google-devtools-containeranalysis/v1/webpack.config.js deleted file mode 100644 index f9beacf3ce3..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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: 'containeranalysis', - filename: './containeranalysis.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-devtools-containeranalysis/v1beta1/.eslintignore b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1beta1/.eslintrc.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.gitignore b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1beta1/.jsdoc.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.jsdoc.js deleted file mode 100644 index bc16644d92f..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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/containeranalysis', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.mocharc.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1beta1/.prettierrc.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1beta1/README.md b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/README.md deleted file mode 100644 index dc843b72155..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Containeranalysis: Nodejs Client diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/package.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/package.json deleted file mode 100644 index da5dd18c670..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@google-cloud/containeranalysis", - "version": "0.1.0", - "description": "Containeranalysis client for Node.js", - "repository": "googleapis/nodejs-containeranalysis", - "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 containeranalysis", - "containeranalysis", - "container analysis v1 beta1", - "grafeas 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-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto deleted file mode 100644 index 15447183eb0..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.attestation; - -import "google/devtools/containeranalysis/v1beta1/common/common.proto"; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1.attestation"; -option objc_class_prefix = "GRA"; - -// An attestation wrapper with a PGP-compatible signature. This message only -// supports `ATTACHED` signatures, where the payload that is signed is included -// alongside the signature itself in the same file. -message PgpSignedAttestation { - // Required. The raw content of the signature, as output by GNU Privacy Guard - // (GPG) or equivalent. Since this message only supports attached signatures, - // the payload that was signed must be attached. While the signature format - // supported is dependent on the verification implementation, currently only - // ASCII-armored (`--armor` to gpg), non-clearsigned (`--sign` rather than - // `--clearsign` to gpg) are supported. Concretely, `gpg --sign --armor - // --output=signature.gpg payload.json` will create the signature content - // expected in this field in `signature.gpg` for the `payload.json` - // attestation payload. - string signature = 1; - - // Type (for example schema) of the attestation payload that was signed. - enum ContentType { - // `ContentType` is not set. - CONTENT_TYPE_UNSPECIFIED = 0; - // Atomic format attestation signature. See - // https://github.com/containers/image/blob/8a5d2f82a6e3263290c8e0276c3e0f64e77723e7/docs/atomic-signature.md - // The payload extracted from `signature` is a JSON blob conforming to the - // linked schema. - SIMPLE_SIGNING_JSON = 1; - } - - // Type (for example schema) of the attestation payload that was signed. - // The verifier must ensure that the provided type is one that the verifier - // supports, and that the attestation payload is a valid instantiation of that - // type (for example by validating a JSON schema). - ContentType content_type = 3; - - // This field is used by verifiers to select the public key used to validate - // the signature. Note that the policy of the verifier ultimately determines - // which public keys verify a signature based on the context of the - // verification. There is no guarantee validation will succeed if the - // verifier has no key matching this ID, even if it has a key under a - // different ID that would verify the signature. Note that this ID should also - // be present in the signature content above, but that is not expected to be - // used by the verifier. - oneof key_id { - // The cryptographic fingerprint of the key used to generate the signature, - // as output by, e.g. `gpg --list-keys`. This should be the version 4, full - // 160-bit fingerprint, expressed as a 40 character hexidecimal string. See - // https://tools.ietf.org/html/rfc4880#section-12.2 for details. - // Implementations may choose to acknowledge "LONG", "SHORT", or other - // abbreviated key IDs, but only the full fingerprint is guaranteed to work. - // In gpg, the full fingerprint can be retrieved from the `fpr` field - // returned when calling --list-keys with --with-colons. For example: - // ``` - // gpg --with-colons --with-fingerprint --force-v4-certs \ - // --list-keys attester@example.com - // tru::1:1513631572:0:3:1:5 - // pub:...... - // fpr:::::::::24FF6481B76AC91E66A00AC657A93A81EF3AE6FB: - // ``` - // Above, the fingerprint is `24FF6481B76AC91E66A00AC657A93A81EF3AE6FB`. - string pgp_key_id = 2; - } -} - -// An attestation wrapper that uses the Grafeas `Signature` message. -// This attestation must define the `serialized_payload` that the `signatures` -// verify and any metadata necessary to interpret that plaintext. The -// signatures should always be over the `serialized_payload` bytestring. -message GenericSignedAttestation { - // Type of the attestation plaintext that was signed. - enum ContentType { - // `ContentType` is not set. - CONTENT_TYPE_UNSPECIFIED = 0; - // Atomic format attestation signature. See - // https://github.com/containers/image/blob/8a5d2f82a6e3263290c8e0276c3e0f64e77723e7/docs/atomic-signature.md - // The payload extracted in `plaintext` is a JSON blob conforming to the - // linked schema. - SIMPLE_SIGNING_JSON = 1; - } - - // Type (for example schema) of the attestation payload that was signed. - // The verifier must ensure that the provided type is one that the verifier - // supports, and that the attestation payload is a valid instantiation of that - // type (for example by validating a JSON schema). - ContentType content_type = 1; - - // The serialized payload that is verified by one or more `signatures`. - // The encoding and semantic meaning of this payload must match what is set in - // `content_type`. - bytes serialized_payload = 2; - - // One or more signatures over `serialized_payload`. Verifier implementations - // should consider this attestation message verified if at least one - // `signature` verifies `serialized_payload`. See `Signature` in common.proto - // for more details on signature structure and verification. - repeated Signature signatures = 3; -} - -// Note kind that represents a logical attestation "role" or "authority". For -// example, an organization might have one `Authority` for "QA" and one for -// "build". This note is intended to act strictly as a grouping mechanism for -// the attached occurrences (Attestations). This grouping mechanism also -// provides a security boundary, since IAM ACLs gate the ability for a principle -// to attach an occurrence to a given note. It also provides a single point of -// lookup to find all attached attestation occurrences, even if they don't all -// live in the same project. -message Authority { - // This submessage provides human-readable hints about the purpose of the - // authority. Because the name of a note acts as its resource reference, it is - // important to disambiguate the canonical name of the Note (which might be a - // UUID for security purposes) from "readable" names more suitable for debug - // output. Note that these hints should not be used to look up authorities in - // security sensitive contexts, such as when looking up attestations to - // verify. - message Hint { - // Required. The human readable name of this attestation authority, for - // example "qa". - string human_readable_name = 1; - } - - // Hint hints at the purpose of the attestation authority. - Hint hint = 1; -} - -// Details of an attestation occurrence. -message Details { - // Required. Attestation for the resource. - Attestation attestation = 1; -} - -// Occurrence that represents a single "attestation". The authenticity of an -// attestation can be verified using the attached signature. If the verifier -// trusts the public key of the signer, then verifying the signature is -// sufficient to establish trust. In this circumstance, the authority to which -// this attestation is attached is primarily useful for look-up (how to find -// this attestation if you already know the authority and artifact to be -// verified) and intent (which authority was this attestation intended to sign -// for). -message Attestation { - // Required. The signature, generally over the `resource_url`, that verifies - // this attestation. The semantics of the signature veracity are ultimately - // determined by the verification engine. - oneof signature { - // A PGP signed attestation. - PgpSignedAttestation pgp_signed_attestation = 1; - GenericSignedAttestation generic_signed_attestation = 2; - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/build/build.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/build/build.proto deleted file mode 100644 index dc0f2b4e21b..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/build/build.proto +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.build; - -import "google/devtools/containeranalysis/v1beta1/provenance/provenance.proto"; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1.build"; -option objc_class_prefix = "GRA"; - -// Note holding the version of the provider's builder and the signature of the -// provenance message in the build details occurrence. -message Build { - // Required. Immutable. Version of the builder which produced this build. - string builder_version = 1; - - // Signature of the build in occurrences pointing to this build note - // containing build details. - BuildSignature signature = 2; -} - -// Message encapsulating the signature of the verified build. -message BuildSignature { - // Public key of the builder which can be used to verify that the related - // findings are valid and unchanged. If `key_type` is empty, this defaults - // to PEM encoded public keys. - // - // This field may be empty if `key_id` references an external key. - // - // For Cloud Build based signatures, this is a PEM encoded public - // key. To verify the Cloud Build signature, place the contents of - // this field into a file (public.pem). The signature field is base64-decoded - // into its binary representation in signature.bin, and the provenance bytes - // from `BuildDetails` are base64-decoded into a binary representation in - // signed.bin. OpenSSL can then verify the signature: - // `openssl sha256 -verify public.pem -signature signature.bin signed.bin` - string public_key = 1; - - // Required. Signature of the related `BuildProvenance`. In JSON, this is - // base-64 encoded. - bytes signature = 2; - - // An ID for the key used to sign. This could be either an ID for the key - // stored in `public_key` (such as the ID or fingerprint for a PGP key, or the - // CN for a cert), or a reference to an external key (such as a reference to a - // key in Cloud Key Management Service). - string key_id = 3; - - // Public key formats. - enum KeyType { - // `KeyType` is not set. - KEY_TYPE_UNSPECIFIED = 0; - // `PGP ASCII Armored` public key. - PGP_ASCII_ARMORED = 1; - // `PKIX PEM` public key. - PKIX_PEM = 2; - } - - // The type of the key, either stored in `public_key` or referenced in - // `key_id`. - KeyType key_type = 4; -} - -// Details of a build occurrence. -message Details { - // Required. The actual provenance for the build. - grafeas.v1beta1.provenance.BuildProvenance provenance = 1; - - // Serialized JSON representation of the provenance, used in generating the - // build signature in the corresponding build note. After verifying the - // signature, `provenance_bytes` can be unmarshalled and compared to the - // provenance to confirm that it is unchanged. A base64-encoded string - // representation of the provenance bytes is used for the signature in order - // to interoperate with openssl which expects this format for signature - // verification. - // - // The serialized form is captured both to avoid ambiguity in how the - // provenance is marshalled to json as well to prevent incompatibilities with - // future changes. - string provenance_bytes = 2; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/common/common.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/common/common.proto deleted file mode 100644 index fd941c83286..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/common/common.proto +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1.common"; -option objc_class_prefix = "GRA"; - -// Kind represents the kinds of notes supported. -enum NoteKind { - // Unknown. - NOTE_KIND_UNSPECIFIED = 0; - // The note and occurrence represent a package vulnerability. - VULNERABILITY = 1; - // The note and occurrence assert build provenance. - BUILD = 2; - // This represents an image basis relationship. - IMAGE = 3; - // This represents a package installed via a package manager. - PACKAGE = 4; - // The note and occurrence track deployment events. - DEPLOYMENT = 5; - // The note and occurrence track the initial discovery status of a resource. - DISCOVERY = 6; - // This represents a logical "role" that can attest to artifacts. - ATTESTATION = 7; -} - -// Metadata for any related URL information. -message RelatedUrl { - // Specific URL associated with the resource. - string url = 1; - // Label to describe usage of the URL. - string label = 2; -} - -// Verifiers (e.g. Kritis implementations) MUST verify signatures -// with respect to the trust anchors defined in policy (e.g. a Kritis policy). -// Typically this means that the verifier has been configured with a map from -// `public_key_id` to public key material (and any required parameters, e.g. -// signing algorithm). -// -// In particular, verification implementations MUST NOT treat the signature -// `public_key_id` as anything more than a key lookup hint. The `public_key_id` -// DOES NOT validate or authenticate a public key; it only provides a mechanism -// for quickly selecting a public key ALREADY CONFIGURED on the verifier through -// a trusted channel. Verification implementations MUST reject signatures in any -// of the following circumstances: -// * The `public_key_id` is not recognized by the verifier. -// * The public key that `public_key_id` refers to does not verify the -// signature with respect to the payload. -// -// The `signature` contents SHOULD NOT be "attached" (where the payload is -// included with the serialized `signature` bytes). Verifiers MUST ignore any -// "attached" payload and only verify signatures with respect to explicitly -// provided payload (e.g. a `payload` field on the proto message that holds -// this Signature, or the canonical serialization of the proto message that -// holds this signature). -message Signature { - // The content of the signature, an opaque bytestring. - // The payload that this signature verifies MUST be unambiguously provided - // with the Signature during verification. A wrapper message might provide - // the payload explicitly. Alternatively, a message might have a canonical - // serialization that can always be unambiguously computed to derive the - // payload. - bytes signature = 1; - - // The identifier for the public key that verifies this signature. - // * The `public_key_id` is required. - // * The `public_key_id` MUST be an RFC3986 conformant URI. - // * When possible, the `public_key_id` SHOULD be an immutable reference, - // such as a cryptographic digest. - // - // Examples of valid `public_key_id`s: - // - // OpenPGP V4 public key fingerprint: - // * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" - // See https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr for more - // details on this scheme. - // - // RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER - // serialization): - // * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU" - // * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5" - string public_key_id = 2; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto deleted file mode 100644 index b8eacc87543..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.devtools.containeranalysis.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "com.google.containeranalysis.v1beta1"; -option objc_class_prefix = "GCA"; - -// Retrieves analysis results of Cloud components such as Docker container -// images. The Container Analysis API is an implementation of the -// [Grafeas](https://grafeas.io) API. -// -// Analysis results are stored as a series of occurrences. An `Occurrence` -// contains information about a specific analysis instance on a resource. An -// occurrence refers to a `Note`. A note contains details describing the -// analysis and is generally stored in a separate project, called a `Provider`. -// Multiple occurrences can refer to the same note. -// -// For example, an SSL vulnerability could affect multiple images. In this case, -// there would be one note for the vulnerability and an occurrence for each -// image with the vulnerability referring to that note. -service ContainerAnalysisV1Beta1 { - option (google.api.default_host) = "containeranalysis.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Sets the access control policy on the specified note or occurrence. - // Requires `containeranalysis.notes.setIamPolicy` or - // `containeranalysis.occurrences.setIamPolicy` permission if the resource is - // a note or an occurrence, respectively. - // - // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - // occurrences. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1beta1/{resource=projects/*/notes/*}:setIamPolicy" - body: "*" - additional_bindings { - post: "/v1beta1/{resource=projects/*/occurrences/*}:setIamPolicy" - body: "*" - } - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Gets the access control policy for a note or an occurrence resource. - // Requires `containeranalysis.notes.setIamPolicy` or - // `containeranalysis.occurrences.setIamPolicy` permission if the resource is - // a note or occurrence, respectively. - // - // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - // occurrences. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1beta1/{resource=projects/*/notes/*}:getIamPolicy" - body: "*" - additional_bindings { - post: "/v1beta1/{resource=projects/*/occurrences/*}:getIamPolicy" - body: "*" - } - }; - option (google.api.method_signature) = "resource"; - } - - // Returns the permissions that a caller has on the specified note or - // occurrence. Requires list permission on the project (for example, - // `containeranalysis.notes.list`). - // - // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - // occurrences. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) - returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1beta1/{resource=projects/*/notes/*}:testIamPermissions" - body: "*" - additional_bindings { - post: "/v1beta1/{resource=projects/*/occurrences/*}:testIamPermissions" - body: "*" - } - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Gets a summary of the packages within a given resource. - rpc GeneratePackagesSummary(GeneratePackagesSummaryRequest) - returns (PackagesSummaryResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/resources/**}:generatePackagesSummary" - body: "*" - }; - } -} - -// GeneratePackagesSummaryRequest is the request body for the -// GeneratePackagesSummary API method. It just takes a single name argument, -// referring to the resource. -message GeneratePackagesSummaryRequest { - // Required. The name of the resource to get a packages summary for in the - // form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// A summary of the packages found within the given resource. -message PackagesSummaryResponse { - // Per license count - message LicensesSummary { - // The license of the package. Note that the format of this value is not - // guaranteed. It may be nil, an empty string, a boolean value (A | B), a - // differently formed boolean value (A OR B), etc... - string license = 1; - - // The number of fixable vulnerabilities associated with this resource. - int64 count = 2; - } - - // The unique URL of the image or the container for which this summary - // applies. - string resource_url = 1; - - // A listing by license name of each of the licenses and their counts. - repeated LicensesSummary licenses_summary = 2; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto deleted file mode 100644 index 8d78138d19e..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.vulnerability; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1.vulnerability"; -option objc_class_prefix = "GRA"; - -// Common Vulnerability Scoring System version 3. -// For details, see https://www.first.org/cvss/specification-document -message CVSSv3 { - // The base score is a function of the base metric scores. - float base_score = 1; - - float exploitability_score = 2; - - float impact_score = 3; - - // Base Metrics - // Represents the intrinsic characteristics of a vulnerability that are - // constant over time and across user environments. - AttackVector attack_vector = 5; - AttackComplexity attack_complexity = 6; - PrivilegesRequired privileges_required = 7; - UserInteraction user_interaction = 8; - Scope scope = 9; - Impact confidentiality_impact = 10; - Impact integrity_impact = 11; - Impact availability_impact = 12; - - enum AttackVector { - ATTACK_VECTOR_UNSPECIFIED = 0; - ATTACK_VECTOR_NETWORK = 1; - ATTACK_VECTOR_ADJACENT = 2; - ATTACK_VECTOR_LOCAL = 3; - ATTACK_VECTOR_PHYSICAL = 4; - } - - enum AttackComplexity { - ATTACK_COMPLEXITY_UNSPECIFIED = 0; - ATTACK_COMPLEXITY_LOW = 1; - ATTACK_COMPLEXITY_HIGH = 2; - } - - enum PrivilegesRequired { - PRIVILEGES_REQUIRED_UNSPECIFIED = 0; - PRIVILEGES_REQUIRED_NONE = 1; - PRIVILEGES_REQUIRED_LOW = 2; - PRIVILEGES_REQUIRED_HIGH = 3; - } - - enum UserInteraction { - USER_INTERACTION_UNSPECIFIED = 0; - USER_INTERACTION_NONE = 1; - USER_INTERACTION_REQUIRED = 2; - } - - enum Scope { - SCOPE_UNSPECIFIED = 0; - SCOPE_UNCHANGED = 1; - SCOPE_CHANGED = 2; - } - - enum Impact { - IMPACT_UNSPECIFIED = 0; - IMPACT_HIGH = 1; - IMPACT_LOW = 2; - IMPACT_NONE = 3; - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto deleted file mode 100644 index f5e196f67b1..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.deployment; - -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1.deployment"; -option objc_class_prefix = "GRA"; - -// An artifact that can be deployed in some runtime. -message Deployable { - // Required. Resource URI for the artifact being deployed. - repeated string resource_uri = 1; -} - -// Details of a deployment occurrence. -message Details { - // Required. Deployment history for the resource. - Deployment deployment = 1; -} - -// The period during which some deployable was active in a runtime. -message Deployment { - // Identity of the user that triggered this deployment. - string user_email = 1; - - // Required. Beginning of the lifetime of this deployment. - google.protobuf.Timestamp deploy_time = 2; - - // End of the lifetime of this deployment. - google.protobuf.Timestamp undeploy_time = 3; - - // Configuration used to create this deployment. - string config = 4; - - // Address of the runtime element hosting this deployment. - string address = 5; - - // Output only. Resource URI for the artifact being deployed taken from - // the deployable field with the same name. - repeated string resource_uri = 6; - - // Types of platforms. - enum Platform { - // Unknown. - PLATFORM_UNSPECIFIED = 0; - // Google Container Engine. - GKE = 1; - // Google App Engine: Flexible Environment. - FLEX = 2; - // Custom user-defined platform. - CUSTOM = 3; - } - // Platform hosting this deployment. - Platform platform = 7; - - // next_id = 8; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto deleted file mode 100644 index 7e48f772670..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.discovery; - -import "google/devtools/containeranalysis/v1beta1/common/common.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1.discovery"; -option objc_class_prefix = "GRA"; - -// A note that indicates a type of analysis a provider would perform. This note -// exists in a provider's project. A `Discovery` occurrence is created in a -// consumer's project at the start of analysis. -message Discovery { - // Required. Immutable. The kind of analysis that is handled by this - // discovery. - grafeas.v1beta1.NoteKind analysis_kind = 1; -} - -// Details of a discovery occurrence. -message Details { - // Required. Analysis status for the discovered resource. - Discovered discovered = 1; -} - -// Provides information about the analysis status of a discovered resource. -message Discovered { - // Whether the resource is continuously analyzed. - enum ContinuousAnalysis { - // Unknown. - CONTINUOUS_ANALYSIS_UNSPECIFIED = 0; - // The resource is continuously analyzed. - ACTIVE = 1; - // The resource is ignored for continuous analysis. - INACTIVE = 2; - } - - // Whether the resource is continuously analyzed. - ContinuousAnalysis continuous_analysis = 1; - - // The last time continuous analysis was done for this resource. - google.protobuf.Timestamp last_analysis_time = 2; - - // Analysis status for a resource. Currently for initial analysis only (not - // updated in continuous analysis). - enum AnalysisStatus { - // Unknown. - ANALYSIS_STATUS_UNSPECIFIED = 0; - // Resource is known but no action has been taken yet. - PENDING = 1; - // Resource is being analyzed. - SCANNING = 2; - // Analysis has finished successfully. - FINISHED_SUCCESS = 3; - // Analysis has finished unsuccessfully, the analysis itself is in a bad - // state. - FINISHED_FAILED = 4; - // The resource is known not to be supported - FINISHED_UNSUPPORTED = 5; - } - - // The status of discovery for the resource. - AnalysisStatus analysis_status = 3; - - // When an error is encountered this will contain a LocalizedMessage under - // details to show to the user. The LocalizedMessage is output only and - // populated by the API. - google.rpc.Status analysis_status_error = 4; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto deleted file mode 100644 index 8952164eb44..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto +++ /dev/null @@ -1,506 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/devtools/containeranalysis/v1beta1/attestation/attestation.proto"; -import "google/devtools/containeranalysis/v1beta1/build/build.proto"; -import "google/devtools/containeranalysis/v1beta1/common/common.proto"; -import "google/devtools/containeranalysis/v1beta1/deployment/deployment.proto"; -import "google/devtools/containeranalysis/v1beta1/discovery/discovery.proto"; -import "google/devtools/containeranalysis/v1beta1/image/image.proto"; -import "google/devtools/containeranalysis/v1beta1/package/package.proto"; -import "google/devtools/containeranalysis/v1beta1/provenance/provenance.proto"; -import "google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas;grafeas"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1"; -option objc_class_prefix = "GRA"; - -// [Grafeas](grafeas.io) API. -// -// Retrieves analysis results of Cloud components such as Docker container -// images. -// -// Analysis results are stored as a series of occurrences. An `Occurrence` -// contains information about a specific analysis instance on a resource. An -// occurrence refers to a `Note`. A note contains details describing the -// analysis and is generally stored in a separate project, called a `Provider`. -// Multiple occurrences can refer to the same note. -// -// For example, an SSL vulnerability could affect multiple images. In this case, -// there would be one note for the vulnerability and an occurrence for each -// image with the vulnerability referring to that note. -service GrafeasV1Beta1 { - option (google.api.default_host) = "containeranalysis.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Gets the specified occurrence. - rpc GetOccurrence(GetOccurrenceRequest) returns (Occurrence) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/occurrences/*}" - }; - } - - // Lists occurrences for the specified project. - rpc ListOccurrences(ListOccurrencesRequest) - returns (ListOccurrencesResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*}/occurrences" - }; - } - - // Deletes the specified occurrence. For example, use this method to delete an - // occurrence when the occurrence is no longer applicable for the given - // resource. - rpc DeleteOccurrence(DeleteOccurrenceRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/occurrences/*}" - }; - } - - // Creates a new occurrence. - rpc CreateOccurrence(CreateOccurrenceRequest) returns (Occurrence) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*}/occurrences" - body: "occurrence" - }; - } - - // Creates new occurrences in batch. - rpc BatchCreateOccurrences(BatchCreateOccurrencesRequest) - returns (BatchCreateOccurrencesResponse) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*}/occurrences:batchCreate" - body: "*" - }; - } - - // Updates the specified occurrence. - rpc UpdateOccurrence(UpdateOccurrenceRequest) returns (Occurrence) { - option (google.api.http) = { - patch: "/v1beta1/{name=projects/*/occurrences/*}" - body: "occurrence" - }; - } - - // Gets the note attached to the specified occurrence. Consumer projects can - // use this method to get a note that belongs to a provider project. - rpc GetOccurrenceNote(GetOccurrenceNoteRequest) returns (Note) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/occurrences/*}/notes" - }; - } - - // Gets the specified note. - rpc GetNote(GetNoteRequest) returns (Note) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/notes/*}" - }; - } - - // Lists notes for the specified project. - rpc ListNotes(ListNotesRequest) returns (ListNotesResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*}/notes" - }; - } - - // Deletes the specified note. - rpc DeleteNote(DeleteNoteRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/notes/*}" - }; - } - - // Creates a new note. - rpc CreateNote(CreateNoteRequest) returns (Note) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*}/notes" - body: "note" - }; - } - - // Creates new notes in batch. - rpc BatchCreateNotes(BatchCreateNotesRequest) - returns (BatchCreateNotesResponse) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*}/notes:batchCreate" - body: "*" - }; - } - - // Updates the specified note. - rpc UpdateNote(UpdateNoteRequest) returns (Note) { - option (google.api.http) = { - patch: "/v1beta1/{name=projects/*/notes/*}" - body: "note" - }; - } - - // Lists occurrences referencing the specified note. Provider projects can use - // this method to get all occurrences across consumer projects referencing the - // specified note. - rpc ListNoteOccurrences(ListNoteOccurrencesRequest) - returns (ListNoteOccurrencesResponse) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/notes/*}/occurrences" - }; - } - - // Gets a summary of the number and severity of occurrences. - rpc GetVulnerabilityOccurrencesSummary( - GetVulnerabilityOccurrencesSummaryRequest) - returns (VulnerabilityOccurrencesSummary) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*}/occurrences:vulnerabilitySummary" - }; - } -} - -// An instance of an analysis type that has been found on a resource. -message Occurrence { - // Output only. The name of the occurrence in the form of - // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - string name = 1; - - // Required. Immutable. The resource for which the occurrence applies. - Resource resource = 2; - - // Required. Immutable. The analysis note associated with this occurrence, in - // the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be - // used as a filter in list requests. - string note_name = 3; - - // Output only. This explicitly denotes which of the occurrence details are - // specified. This field can be used as a filter in list requests. - grafeas.v1beta1.NoteKind kind = 4; - - // A description of actions that can be taken to remedy the note. - string remediation = 5; - - // Output only. The time this occurrence was created. - google.protobuf.Timestamp create_time = 6; - - // Output only. The time this occurrence was last updated. - google.protobuf.Timestamp update_time = 7; - - // Required. Immutable. Describes the details of the note kind found on this - // resource. - oneof details { - // Describes a security vulnerability. - grafeas.v1beta1.vulnerability.Details vulnerability = 8; - // Describes a verifiable build. - grafeas.v1beta1.build.Details build = 9; - // Describes how this resource derives from the basis in the associated - // note. - grafeas.v1beta1.image.Details derived_image = 10; - // Describes the installation of a package on the linked resource. - grafeas.v1beta1.package.Details installation = 11; - // Describes the deployment of an artifact on a runtime. - grafeas.v1beta1.deployment.Details deployment = 12; - // Describes when a resource was discovered. - grafeas.v1beta1.discovery.Details discovered = 13; - // Describes an attestation of an artifact. - grafeas.v1beta1.attestation.Details attestation = 14; - } - - // next_id = 15; -} - -// An entity that can have metadata. For example, a Docker image. -message Resource { - // The name of the resource. For example, the name of a Docker image - - // "Debian". - string name = 1; - // Required. The unique URI of the resource. For example, - // `https://gcr.io/project/image@sha256:foo` for a Docker image. - string uri = 2; - // The hash of the resource content. For example, the Docker digest. - grafeas.v1beta1.provenance.Hash content_hash = 3; - - // next_id = 4; -} - -// A type of analysis that can be done for a resource. -message Note { - // Output only. The name of the note in the form of - // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - string name = 1; - - // A one sentence description of this note. - string short_description = 2; - - // A detailed description of this note. - string long_description = 3; - - // Output only. The type of analysis. This field can be used as a filter in - // list requests. - grafeas.v1beta1.NoteKind kind = 4; - - // URLs associated with this note. - repeated grafeas.v1beta1.RelatedUrl related_url = 5; - - // Time of expiration for this note. Empty if note does not expire. - google.protobuf.Timestamp expiration_time = 6; - - // Output only. The time this note was created. This field can be used as a - // filter in list requests. - google.protobuf.Timestamp create_time = 7; - - // Output only. The time this note was last updated. This field can be used as - // a filter in list requests. - google.protobuf.Timestamp update_time = 8; - - // Other notes related to this note. - repeated string related_note_names = 9; - - // Required. Immutable. The type of analysis this note represents. - oneof type { - // A note describing a package vulnerability. - grafeas.v1beta1.vulnerability.Vulnerability vulnerability = 10; - // A note describing build provenance for a verifiable build. - grafeas.v1beta1.build.Build build = 11; - // A note describing a base image. - grafeas.v1beta1.image.Basis base_image = 12; - // A note describing a package hosted by various package managers. - grafeas.v1beta1.package.Package package = 13; - // A note describing something that can be deployed. - grafeas.v1beta1.deployment.Deployable deployable = 14; - // A note describing the initial analysis of a resource. - grafeas.v1beta1.discovery.Discovery discovery = 15; - // A note describing an attestation role. - grafeas.v1beta1.attestation.Authority attestation_authority = 16; - } - - // next_id = 17; -} - -// Request to get an occurrence. -message GetOccurrenceRequest { - // The name of the occurrence in the form of - // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - string name = 1; -} - -// Request to list occurrences. -message ListOccurrencesRequest { - // The name of the project to list occurrences for in the form of - // `projects/[PROJECT_ID]`. - string parent = 1; - - // The filter expression. - string filter = 2; - - // Number of occurrences to return in the list. - int32 page_size = 3; - - // Token to provide to skip to a particular spot in the list. - string page_token = 4; - - // next_id = 7; -} - -// Response for listing occurrences. -message ListOccurrencesResponse { - // The occurrences requested. - repeated Occurrence occurrences = 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 - // results. - string next_page_token = 2; -} - -// Request to delete a occurrence. -message DeleteOccurrenceRequest { - // The name of the occurrence in the form of - // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - string name = 1; -} - -// Request to create a new occurrence. -message CreateOccurrenceRequest { - // The name of the project in the form of `projects/[PROJECT_ID]`, under which - // the occurrence is to be created. - string parent = 1; - // The occurrence to create. - Occurrence occurrence = 2; -} - -// Request to update an occurrence. -message UpdateOccurrenceRequest { - // The name of the occurrence in the form of - // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - string name = 1; - // The updated occurrence. - Occurrence occurrence = 2; - // The fields to update. - google.protobuf.FieldMask update_mask = 3; -} - -// Request to get a note. -message GetNoteRequest { - // The name of the note in the form of - // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - string name = 1; -} - -// Request to get the note to which the specified occurrence is attached. -message GetOccurrenceNoteRequest { - // The name of the occurrence in the form of - // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - string name = 1; -} - -// Request to list notes. -message ListNotesRequest { - // The name of the project to list notes for in the form of - // `projects/[PROJECT_ID]`. - string parent = 1; - // The filter expression. - string filter = 2; - // Number of notes to return in the list. - int32 page_size = 3; - // Token to provide to skip to a particular spot in the list. - string page_token = 4; -} - -// Response for listing notes. -message ListNotesResponse { - // The notes requested. - repeated Note notes = 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 - // results. - string next_page_token = 2; -} - -// Request to delete a note. -message DeleteNoteRequest { - // The name of the note in the form of - // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - string name = 1; -} - -// Request to create a new note. -message CreateNoteRequest { - // The name of the project in the form of `projects/[PROJECT_ID]`, under which - // the note is to be created. - string parent = 1; - // The ID to use for this note. - string note_id = 2; - // The note to create. - Note note = 3; -} - -// Request to update a note. -message UpdateNoteRequest { - // The name of the note in the form of - // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - string name = 1; - // The updated note. - Note note = 2; - // The fields to update. - google.protobuf.FieldMask update_mask = 3; -} - -// Request to list occurrences for a note. -message ListNoteOccurrencesRequest { - // The name of the note to list occurrences for in the form of - // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - string name = 1; - // The filter expression. - string filter = 2; - // Number of occurrences to return in the list. - int32 page_size = 3; - // Token to provide to skip to a particular spot in the list. - string page_token = 4; -} - -// Response for listing occurrences for a note. -message ListNoteOccurrencesResponse { - // The occurrences attached to the specified note. - repeated Occurrence occurrences = 1; - // Token to provide to skip to a particular spot in the list. - string next_page_token = 2; -} - -// Request to create notes in batch. -message BatchCreateNotesRequest { - // The name of the project in the form of `projects/[PROJECT_ID]`, under which - // the notes are to be created. - string parent = 1; - - // The notes to create. - map notes = 2; -} - -// Response for creating notes in batch. -message BatchCreateNotesResponse { - // The notes that were created. - repeated Note notes = 1; -} - -// Request to create occurrences in batch. -message BatchCreateOccurrencesRequest { - // The name of the project in the form of `projects/[PROJECT_ID]`, under which - // the occurrences are to be created. - string parent = 1; - // The occurrences to create. - repeated Occurrence occurrences = 2; -} - -// Response for creating occurrences in batch. -message BatchCreateOccurrencesResponse { - // The occurrences that were created. - repeated Occurrence occurrences = 1; -} - -// Request to get a vulnerability summary for some set of occurrences. -message GetVulnerabilityOccurrencesSummaryRequest { - // The name of the project to get a vulnerability summary for in the form of - // `projects/[PROJECT_ID]`. - string parent = 1; - // The filter expression. - string filter = 2; -} - -// A summary of how many vulnerability occurrences there are per resource and -// severity type. -message VulnerabilityOccurrencesSummary { - // A listing by resource of the number of fixable and total vulnerabilities. - repeated FixableTotalByDigest counts = 1; - - // Per resource and severity counts of fixable and total vulnerabilities. - message FixableTotalByDigest { - // The affected resource. - Resource resource = 1; - // The severity for this count. SEVERITY_UNSPECIFIED indicates total across - // all severities. - grafeas.v1beta1.vulnerability.Severity severity = 2; - // The number of fixable vulnerabilities associated with this resource. - int64 fixable_count = 3; - // The total number of vulnerabilities associated with this resource. - int64 total_count = 4; - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/image/image.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/image/image.proto deleted file mode 100644 index 1493c0516b0..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/image/image.proto +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.image; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1.image"; -option objc_class_prefix = "GRA"; - -// Layer holds metadata specific to a layer of a Docker image. -message Layer { - // Instructions from Dockerfile. - enum Directive { - // Default value for unsupported/missing directive. - DIRECTIVE_UNSPECIFIED = 0; - - // https://docs.docker.com/engine/reference/builder/ - MAINTAINER = 1; - - // https://docs.docker.com/engine/reference/builder/ - RUN = 2; - - // https://docs.docker.com/engine/reference/builder/ - CMD = 3; - - // https://docs.docker.com/engine/reference/builder/ - LABEL = 4; - - // https://docs.docker.com/engine/reference/builder/ - EXPOSE = 5; - - // https://docs.docker.com/engine/reference/builder/ - ENV = 6; - - // https://docs.docker.com/engine/reference/builder/ - ADD = 7; - - // https://docs.docker.com/engine/reference/builder/ - COPY = 8; - - // https://docs.docker.com/engine/reference/builder/ - ENTRYPOINT = 9; - - // https://docs.docker.com/engine/reference/builder/ - VOLUME = 10; - - // https://docs.docker.com/engine/reference/builder/ - USER = 11; - - // https://docs.docker.com/engine/reference/builder/ - WORKDIR = 12; - - // https://docs.docker.com/engine/reference/builder/ - ARG = 13; - - // https://docs.docker.com/engine/reference/builder/ - ONBUILD = 14; - - // https://docs.docker.com/engine/reference/builder/ - STOPSIGNAL = 15; - - // https://docs.docker.com/engine/reference/builder/ - HEALTHCHECK = 16; - - // https://docs.docker.com/engine/reference/builder/ - SHELL = 17; - } - - // Required. The recovered Dockerfile directive used to construct this layer. - Directive directive = 1; - - // The recovered arguments to the Dockerfile directive. - string arguments = 2; -} - -// A set of properties that uniquely identify a given Docker image. -message Fingerprint { - // Required. The layer ID of the final layer in the Docker image's v1 - // representation. - string v1_name = 1; - - // Required. The ordered list of v2 blobs that represent a given image. - repeated string v2_blob = 2; - - // Output only. The name of the image's v2 blobs computed via: - // [bottom] := v2_blob[bottom] - // [N] := sha256(v2_blob[N] + " " + v2_name[N+1]) - // Only the name of the final blob is kept. - string v2_name = 3; -} - -// Basis describes the base image portion (Note) of the DockerImage -// relationship. Linked occurrences are derived from this or an -// equivalent image via: -// FROM -// Or an equivalent reference, e.g. a tag of the resource_url. -message Basis { - // Required. Immutable. The resource_url for the resource representing the - // basis of associated occurrence images. - string resource_url = 1; - - // Required. Immutable. The fingerprint of the base image. - Fingerprint fingerprint = 2; -} - -// Details of an image occurrence. -message Details { - // Required. Immutable. The child image derived from the base image. - Derived derived_image = 1; -} - -// Derived describes the derived image portion (Occurrence) of the DockerImage -// relationship. This image would be produced from a Dockerfile with FROM -// . -message Derived { - // Required. The fingerprint of the derived image. - Fingerprint fingerprint = 1; - - // Output only. The number of layers by which this image differs from the - // associated image basis. - int32 distance = 2; - - // This contains layer-specific metadata, if populated it has length - // "distance" and is ordered with [distance] being the layer immediately - // following the base image and [1] being the final layer. - repeated Layer layer_info = 3; - - // Output only. This contains the base image URL for the derived image - // occurrence. - string base_resource_url = 4; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/package/package.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/package/package.proto deleted file mode 100644 index 4bc7c2af1f7..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/package/package.proto +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.package; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1.pkg"; -option objc_class_prefix = "GRA"; - -// Instruction set architectures supported by various package managers. -enum Architecture { - // Unknown architecture. - ARCHITECTURE_UNSPECIFIED = 0; - // X86 architecture. - X86 = 1; - // X64 architecture. - X64 = 2; -} - -// This represents a particular channel of distribution for a given package. -// E.g., Debian's jessie-backports dpkg mirror. -message Distribution { - // Required. The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) - // denoting the package manager version distributing a package. - string cpe_uri = 1; - - // The CPU architecture for which packages in this distribution channel were - // built. - Architecture architecture = 2; - - // The latest available version of this package in this distribution channel. - Version latest_version = 3; - - // A freeform string denoting the maintainer of this package. - string maintainer = 4; - - // The distribution channel-specific homepage for this package. - string url = 5; - - // The distribution channel-specific description of this package. - string description = 6; -} - -// An occurrence of a particular package installation found within a system's -// filesystem. E.g., glibc was found in `/var/lib/dpkg/status`. -message Location { - // Required. The CPE URI in [CPE format](https://cpe.mitre.org/specification/) - // denoting the package manager version distributing a package. - string cpe_uri = 1; - - // The version installed at this location. - Version version = 2; - - // The path from which we gathered that this package/version is installed. - string path = 3; -} - -// This represents a particular package that is distributed over various -// channels. E.g., glibc (aka libc6) is distributed by many, at various -// versions. -message Package { - // Required. Immutable. The name of the package. - string name = 1; - - // The various channels by which a package is distributed. - repeated Distribution distribution = 10; -} - -// Details of a package occurrence. -message Details { - // Required. Where the package was installed. - Installation installation = 1; -} - -// This represents how a particular software package may be installed on a -// system. -message Installation { - // Output only. The name of the installed package. - string name = 1; - - // Required. All of the places within the filesystem versions of this package - // have been found. - repeated Location location = 2; -} - -// Version contains structured information about the version of a package. -message Version { - // Used to correct mistakes in the version numbering scheme. - int32 epoch = 1; - - // Required only when version kind is NORMAL. The main part of the version - // name. - string name = 2; - - // The iteration of the package build from the above version. - string revision = 3; - - // Whether this is an ordinary package version or a sentinel MIN/MAX version. - enum VersionKind { - // Unknown. - VERSION_KIND_UNSPECIFIED = 0; - // A standard package version. - NORMAL = 1; - // A special version representing negative infinity. - MINIMUM = 2; - // A special version representing positive infinity. - MAXIMUM = 3; - }; - - // Required. Distinguishes between sentinel MIN/MAX versions and normal - // versions. - VersionKind kind = 4; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto deleted file mode 100644 index 146915572be..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.provenance; - -import "google/devtools/containeranalysis/v1beta1/source/source.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1.provenance"; -option objc_class_prefix = "GRA"; - -// Provenance of a build. Contains all information needed to verify the full -// details about the build from source to completion. -message BuildProvenance { - // Required. Unique identifier of the build. - string id = 1; - - // ID of the project. - string project_id = 2; - - // Commands requested by the build. - repeated Command commands = 3; - - // Output of the build. - repeated Artifact built_artifacts = 4; - - // Time at which the build was created. - google.protobuf.Timestamp create_time = 5; - - // Time at which execution of the build was started. - google.protobuf.Timestamp start_time = 6; - - // Time at which execution of the build was finished. - google.protobuf.Timestamp end_time = 7; - - // E-mail address of the user who initiated this build. Note that this was the - // user's e-mail address at the time the build was initiated; this address may - // not represent the same end-user for all time. - string creator = 8; - - // URI where any logs for this provenance were written. - string logs_uri = 9; - - // Details of the Source input to the build. - Source source_provenance = 10; - - // Trigger identifier if the build was triggered automatically; empty if not. - string trigger_id = 11; - - // Special options applied to this build. This is a catch-all field where - // build providers can enter any desired additional details. - map build_options = 12; - - // Version string of the builder at the time this build was executed. - string builder_version = 13; - - // next_id = 14 -} - -// Source describes the location of the source used for the build. -message Source { - // If provided, the input binary artifacts for the build came from this - // location. - string artifact_storage_source_uri = 1; - - // Hash(es) of the build source, which can be used to verify that the original - // source integrity was maintained in the build. - // - // The keys to this map are file paths used as build source and the values - // contain the hash values for those files. - // - // If the build source came in a single package such as a gzipped tarfile - // (.tar.gz), the FileHash will be for the single path to that file. - map file_hashes = 2; - - // If provided, the source code used for the build came from this location. - grafeas.v1beta1.source.SourceContext context = 3; - - // If provided, some of the source code used for the build may be found in - // these locations, in the case where the source repository had multiple - // remotes or submodules. This list will not include the context specified in - // the context field. - repeated grafeas.v1beta1.source.SourceContext additional_contexts = 4; -} - -// Container message for hashes of byte content of files, used in source -// messages to verify integrity of source input to the build. -message FileHashes { - // Required. Collection of file hashes. - repeated Hash file_hash = 1; -} - -// Container message for hash values. -message Hash { - // Specifies the hash algorithm. - enum HashType { - // Unknown. - HASH_TYPE_UNSPECIFIED = 0; - // A SHA-256 hash. - SHA256 = 1; - } - - // Required. The type of hash that was performed. - HashType type = 1; - // Required. The hash value. - bytes value = 2; -} - -// Command describes a step performed as part of the build pipeline. -message Command { - // Required. Name of the command, as presented on the command line, or if the - // command is packaged as a Docker container, as presented to `docker pull`. - string name = 1; - - // Environment variables set before running this command. - repeated string env = 2; - - // Command-line arguments used when executing this command. - repeated string args = 3; - - // Working directory (relative to project source root) used when running this - // command. - string dir = 4; - - // Optional unique identifier for this command, used in wait_for to reference - // this command as a dependency. - string id = 5; - - // The ID(s) of the command(s) that this command depends on. - repeated string wait_for = 6; -} - -// Artifact describes a build product. -message Artifact { - // Hash or checksum value of a binary, or Docker Registry 2.0 digest of a - // container. - string checksum = 1; - - // Artifact ID, if any; for container images, this will be a URL by digest - // like `gcr.io/projectID/imagename@sha256:123456`. - string id = 2; - - // Related artifact names. This may be the path to a binary or jar file, or in - // the case of a container build, the name used to push the container image to - // Google Container Registry, as presented to `docker push`. Note that a - // single Artifact ID can have multiple names, for example if two tags are - // applied to one image. - repeated string names = 3; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/source/source.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/source/source.proto deleted file mode 100644 index ff60d7c2303..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/source/source.proto +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.source; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1.source"; -option objc_class_prefix = "GRA"; - -// A SourceContext is a reference to a tree of files. A SourceContext together -// with a path point to a unique revision of a single file or directory. -message SourceContext { - // A SourceContext can refer any one of the following types of repositories. - oneof context { - // A SourceContext referring to a revision in a Google Cloud Source Repo. - CloudRepoSourceContext cloud_repo = 1; - - // A SourceContext referring to a Gerrit project. - GerritSourceContext gerrit = 2; - - // A SourceContext referring to any third party Git repo (e.g., GitHub). - GitSourceContext git = 3; - } - - // Labels with user defined metadata. - map labels = 4; -} - -// An alias to a repo revision. -message AliasContext { - // The type of an alias. - enum Kind { - // Unknown. - KIND_UNSPECIFIED = 0; - // Git tag. - FIXED = 1; - // Git branch. - MOVABLE = 2; - // Used to specify non-standard aliases. For example, if a Git repo has a - // ref named "refs/foo/bar". - OTHER = 4; - } - - // The alias kind. - Kind kind = 1; - - // The alias name. - string name = 2; -} - -// A CloudRepoSourceContext denotes a particular revision in a Google Cloud -// Source Repo. -message CloudRepoSourceContext { - // The ID of the repo. - RepoId repo_id = 1; - - // A revision in a Cloud Repo can be identified by either its revision ID or - // its alias. - oneof revision { - // A revision ID. - string revision_id = 2; - - // An alias, which may be a branch or tag. - AliasContext alias_context = 3; - } -} - -// A SourceContext referring to a Gerrit project. -message GerritSourceContext { - // The URI of a running Gerrit instance. - string host_uri = 1; - - // The full project name within the host. Projects may be nested, so - // "project/subproject" is a valid project name. The "repo name" is the - // hostURI/project. - string gerrit_project = 2; - - // A revision in a Gerrit project can be identified by either its revision ID - // or its alias. - oneof revision { - // A revision (commit) ID. - string revision_id = 3; - - // An alias, which may be a branch or tag. - AliasContext alias_context = 4; - } -} - -// A GitSourceContext denotes a particular revision in a third party Git -// repository (e.g., GitHub). -message GitSourceContext { - // Git repository URL. - string url = 1; - - // Git commit hash. - string revision_id = 2; -} - -// A unique identifier for a Cloud Repo. -message RepoId { - // A cloud repo can be identified by either its project ID and repository name - // combination, or its globally unique identifier. - oneof id { - // A combination of a project ID and a repo name. - ProjectRepoId project_repo_id = 1; - - // A server-assigned, globally unique identifier. - string uid = 2; - } -} - -// Selects a repo using a Google Cloud Platform project ID (e.g., -// winged-cargo-31) and a repo name within that project. -message ProjectRepoId { - // The ID of the project. - string project_id = 1; - - // The name of the repo. Leave empty for the default repo. - string repo_name = 2; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto deleted file mode 100644 index d9c740646a7..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright 2018 The Grafeas Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.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 grafeas.v1beta1.vulnerability; - -import "google/protobuf/timestamp.proto"; -import "google/devtools/containeranalysis/v1beta1/common/common.proto"; -import "google/devtools/containeranalysis/v1beta1/cvss/cvss.proto"; -import "google/devtools/containeranalysis/v1beta1/package/package.proto"; - -option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb"; -option java_multiple_files = true; -option java_package = "io.grafeas.v1beta1.vulnerability"; -option objc_class_prefix = "GRA"; - -// Note provider-assigned severity/impact ranking. -enum Severity { - // Unknown. - SEVERITY_UNSPECIFIED = 0; - // Minimal severity. - MINIMAL = 1; - // Low severity. - LOW = 2; - // Medium severity. - MEDIUM = 3; - // High severity. - HIGH = 4; - // Critical severity. - CRITICAL = 5; -} - -// Vulnerability provides metadata about a security vulnerability in a Note. -message Vulnerability { - // The CVSS score for this vulnerability. - float cvss_score = 1; - - // Note provider assigned impact of the vulnerability. - Severity severity = 2; - - // All information about the package to specifically identify this - // vulnerability. One entry per (version range and cpe_uri) the package - // vulnerability has manifested in. - repeated Detail details = 3; - - // Identifies all appearances of this vulnerability in the package for a - // specific distro/location. For example: glibc in - // cpe:/o:debian:debian_linux:8 for versions 2.1 - 2.2 - message Detail { - // Required. The CPE URI in - // [cpe format](https://cpe.mitre.org/specification/) in which the - // vulnerability manifests. Examples include distro or storage location for - // vulnerable jar. - string cpe_uri = 1; - - // Required. The name of the package where the vulnerability was found. - string package = 2; - - // The min version of the package in which the vulnerability exists. - grafeas.v1beta1.package.Version min_affected_version = 3; - - // The max version of the package in which the vulnerability exists. - grafeas.v1beta1.package.Version max_affected_version = 4; - - // The severity (eg: distro assigned severity) for this vulnerability. - string severity_name = 5; - - // A vendor-specific description of this note. - string description = 6; - - // The fix for this specific package version. - VulnerabilityLocation fixed_location = 7; - - // The type of package; whether native or non native(ruby gems, node.js - // packages etc). - string package_type = 8; - - // Whether this detail is obsolete. Occurrences are expected not to point to - // obsolete details. - bool is_obsolete = 9; - - // The time this information was last changed at the source. This is an - // upstream timestamp from the underlying information source - e.g. Ubuntu - // security tracker. - google.protobuf.Timestamp source_update_time = 10; - } - - // The full description of the CVSSv3. - CVSSv3 cvss_v3 = 4; - - // Windows details get their own format because the information format and - // model don't match a normal detail. Specifically Windows updates are done as - // patches, thus Windows vulnerabilities really are a missing package, rather - // than a package being at an incorrect version. - repeated WindowsDetail windows_details = 5; - - message WindowsDetail { - // Required. The CPE URI in - // [cpe format](https://cpe.mitre.org/specification/) in which the - // vulnerability manifests. Examples include distro or storage location for - // vulnerable jar. - string cpe_uri = 1; - - // Required. The name of the vulnerability. - string name = 2; - - // The description of the vulnerability. - string description = 3; - - // Required. The names of the KBs which have hotfixes to mitigate this - // vulnerability. Note that there may be multiple hotfixes (and thus - // multiple KBs) that mitigate a given vulnerability. Currently any listed - // kb's presence is considered a fix. - repeated KnowledgeBase fixing_kbs = 4; - - message KnowledgeBase { - // The KB name (generally of the form KB[0-9]+ i.e. KB123456). - string name = 1; - // A link to the KB in the Windows update catalog - - // https://www.catalog.update.microsoft.com/ - string url = 2; - } - } - - // The time this information was last changed at the source. This is an - // upstream timestamp from the underlying information source - e.g. Ubuntu - // security tracker. - google.protobuf.Timestamp source_update_time = 6; - - // Next free ID is 7. -} - -// Details of a vulnerability Occurrence. -message Details { - // The type of package; whether native or non native(ruby gems, node.js - // packages etc) - string type = 1; - - // Output only. The note provider assigned Severity of the vulnerability. - Severity severity = 2; - - // Output only. The CVSS score of this vulnerability. CVSS score is on a - // scale of 0-10 where 0 indicates low severity and 10 indicates high - // severity. - float cvss_score = 3; - - // Required. The set of affected locations and their fixes (if available) - // within the associated resource. - repeated PackageIssue package_issue = 4; - - // Output only. A one sentence description of this vulnerability. - string short_description = 5; - - // Output only. A detailed description of this vulnerability. - string long_description = 6; - - // Output only. URLs related to this vulnerability. - repeated grafeas.v1beta1.RelatedUrl related_urls = 7; - - // The distro assigned severity for this vulnerability when it is - // available, and note provider assigned severity when distro has not yet - // assigned a severity for this vulnerability. - Severity effective_severity = 8; -} - -// This message wraps a location affected by a vulnerability and its -// associated fix (if one is available). -message PackageIssue { - // Required. The location of the vulnerability. - VulnerabilityLocation affected_location = 1; - - // The location of the available fix for vulnerability. - VulnerabilityLocation fixed_location = 2; - - // Deprecated, use Details.effective_severity instead - // The severity (e.g., distro assigned severity) for this vulnerability. - string severity_name = 3; -} - -// The location of the vulnerability. -message VulnerabilityLocation { - // Required. The CPE URI in [cpe format](https://cpe.mitre.org/specification/) - // format. Examples include distro or storage location for vulnerable jar. - string cpe_uri = 1; - - // Required. The package being described. - string package = 2; - - // Required. The version of the package being described. - grafeas.v1beta1.package.Version version = 3; -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js deleted file mode 100644 index 33b45f71689..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_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 containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 resource to get a packages summary for in the - * form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`. - */ - // const name = 'abc123' - - // Imports the Containeranalysis library - const {ContainerAnalysisV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new ContainerAnalysisV1Beta1Client(); - - async function callGeneratePackagesSummary() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await containeranalysisClient.generatePackagesSummary(request); - console.log(response); - } - - callGeneratePackagesSummary(); - // [END containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.get_iam_policy.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.get_iam_policy.js deleted file mode 100644 index 8d14e1488fc..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_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 containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 Containeranalysis library - const {ContainerAnalysisV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new ContainerAnalysisV1Beta1Client(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await containeranalysisClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.set_iam_policy.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.set_iam_policy.js deleted file mode 100644 index 68df30f5afe..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_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 containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 Containeranalysis library - const {ContainerAnalysisV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new ContainerAnalysisV1Beta1Client(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await containeranalysisClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.test_iam_permissions.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_v1_beta1.test_iam_permissions.js deleted file mode 100644 index 09c5b3b0223..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/container_analysis_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 containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 Containeranalysis library - const {ContainerAnalysisV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new ContainerAnalysisV1Beta1Client(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await containeranalysisClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_notes.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_notes.js deleted file mode 100644 index ebb0fe289fb..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_notes.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() { - // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateNotes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project in the form of `projects/[PROJECT_ID]`, under which - * the notes are to be created. - */ - // const parent = 'abc123' - /** - * The notes to create. - */ - // const notes = [1,2,3,4] - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callBatchCreateNotes() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.batchCreateNotes(request); - console.log(response); - } - - callBatchCreateNotes(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateNotes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_occurrences.js deleted file mode 100644 index deb937b4301..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.batch_create_occurrences.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() { - // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateOccurrences_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project in the form of `projects/[PROJECT_ID]`, under which - * the occurrences are to be created. - */ - // const parent = 'abc123' - /** - * The occurrences to create. - */ - // const occurrences = [1,2,3,4] - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callBatchCreateOccurrences() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.batchCreateOccurrences(request); - console.log(response); - } - - callBatchCreateOccurrences(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateOccurrences_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_note.js deleted file mode 100644 index 6e64d8e4695..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_note.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateNote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project in the form of `projects/[PROJECT_ID]`, under which - * the note is to be created. - */ - // const parent = 'abc123' - /** - * The ID to use for this note. - */ - // const noteId = 'abc123' - /** - * The note to create. - */ - // const note = {} - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callCreateNote() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.createNote(request); - console.log(response); - } - - callCreateNote(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateNote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_occurrence.js deleted file mode 100644 index 8ca47649de1..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.create_occurrence.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() { - // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateOccurrence_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project in the form of `projects/[PROJECT_ID]`, under which - * the occurrence is to be created. - */ - // const parent = 'abc123' - /** - * The occurrence to create. - */ - // const occurrence = {} - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callCreateOccurrence() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.createOccurrence(request); - console.log(response); - } - - callCreateOccurrence(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateOccurrence_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_note.js deleted file mode 100644 index dfe500ad2cd..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_note.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteNote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - */ - // const name = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callDeleteNote() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.deleteNote(request); - console.log(response); - } - - callDeleteNote(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteNote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_occurrence.js deleted file mode 100644 index 425dde46108..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.delete_occurrence.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteOccurrence_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - */ - // const name = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callDeleteOccurrence() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.deleteOccurrence(request); - console.log(response); - } - - callDeleteOccurrence(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteOccurrence_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_note.js deleted file mode 100644 index c498f1f7948..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_note.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetNote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - */ - // const name = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callGetNote() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.getNote(request); - console.log(response); - } - - callGetNote(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetNote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence.js deleted file mode 100644 index e062f404f9f..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrence_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - */ - // const name = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callGetOccurrence() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.getOccurrence(request); - console.log(response); - } - - callGetOccurrence(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrence_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence_note.js deleted file mode 100644 index 012f47c8b3f..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_occurrence_note.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrenceNote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - */ - // const name = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callGetOccurrenceNote() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.getOccurrenceNote(request); - console.log(response); - } - - callGetOccurrenceNote(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrenceNote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_vulnerability_occurrences_summary.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_vulnerability_occurrences_summary.js deleted file mode 100644 index a95d9608aff..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.get_vulnerability_occurrences_summary.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() { - // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetVulnerabilityOccurrencesSummary_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project to get a vulnerability summary for in the form of - * `projects/[PROJECT_ID]`. - */ - // const parent = 'abc123' - /** - * The filter expression. - */ - // const filter = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callGetVulnerabilityOccurrencesSummary() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.getVulnerabilityOccurrencesSummary(request); - console.log(response); - } - - callGetVulnerabilityOccurrencesSummary(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetVulnerabilityOccurrencesSummary_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_note_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_note_occurrences.js deleted file mode 100644 index fd4d81e0b71..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_note_occurrences.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() { - // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNoteOccurrences_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the note to list occurrences for in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - */ - // const name = 'abc123' - /** - * The filter expression. - */ - // const filter = 'abc123' - /** - * Number of occurrences to return in the list. - */ - // const pageSize = 1234 - /** - * Token to provide to skip to a particular spot in the list. - */ - // const pageToken = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callListNoteOccurrences() { - // Construct request - const request = { - }; - - // Run request - const iterable = await containeranalysisClient.listNoteOccurrencesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNoteOccurrences(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNoteOccurrences_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_notes.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_notes.js deleted file mode 100644 index 8b8a3059e9d..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_notes.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() { - // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNotes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project to list notes for in the form of - * `projects/[PROJECT_ID]`. - */ - // const parent = 'abc123' - /** - * The filter expression. - */ - // const filter = 'abc123' - /** - * Number of notes to return in the list. - */ - // const pageSize = 1234 - /** - * Token to provide to skip to a particular spot in the list. - */ - // const pageToken = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callListNotes() { - // Construct request - const request = { - }; - - // Run request - const iterable = await containeranalysisClient.listNotesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNotes(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNotes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_occurrences.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_occurrences.js deleted file mode 100644 index 548c45904eb..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.list_occurrences.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() { - // [START containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListOccurrences_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the project to list occurrences for in the form of - * `projects/[PROJECT_ID]`. - */ - // const parent = 'abc123' - /** - * The filter expression. - */ - // const filter = 'abc123' - /** - * Number of occurrences to return in the list. - */ - // const pageSize = 1234 - /** - * Token to provide to skip to a particular spot in the list. - */ - // const pageToken = 'abc123' - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callListOccurrences() { - // Construct request - const request = { - }; - - // Run request - const iterable = await containeranalysisClient.listOccurrencesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListOccurrences(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListOccurrences_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_note.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_note.js deleted file mode 100644 index ef54381eb4c..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_note.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateNote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - */ - // const name = 'abc123' - /** - * The updated note. - */ - // const note = {} - /** - * The fields to update. - */ - // const updateMask = {} - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callUpdateNote() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.updateNote(request); - console.log(response); - } - - callUpdateNote(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateNote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_occurrence.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_occurrence.js deleted file mode 100644 index 8ab1ed0fa5e..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/grafeas_v1_beta1.update_occurrence.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 containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateOccurrence_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - */ - // const name = 'abc123' - /** - * The updated occurrence. - */ - // const occurrence = {} - /** - * The fields to update. - */ - // const updateMask = {} - - // Imports the Containeranalysis library - const {GrafeasV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; - - // Instantiates a client - const containeranalysisClient = new GrafeasV1Beta1Client(); - - async function callUpdateOccurrence() { - // Construct request - const request = { - }; - - // Run request - const response = await containeranalysisClient.updateOccurrence(request); - console.log(response); - } - - callUpdateOccurrence(); - // [END containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateOccurrence_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/snippet_metadata_google.devtools.containeranalysis.v1beta1.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/snippet_metadata_google.devtools.containeranalysis.v1beta1.json deleted file mode 100644 index 1f10feb48f8..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/samples/generated/v1beta1/snippet_metadata_google.devtools.containeranalysis.v1beta1.json +++ /dev/null @@ -1,867 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-containeranalysis", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.devtools.containeranalysis.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_SetIamPolicy_async", - "title": "containeranalysis setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on the specified note or occurrence. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or an occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", - "canonical": true, - "file": "container_analysis_v1_beta1.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.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": "ContainerAnalysisV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1Client" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.SetIamPolicy", - "service": { - "shortName": "ContainerAnalysisV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GetIamPolicy_async", - "title": "containeranalysis getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy for a note or an occurrence resource. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", - "canonical": true, - "file": "container_analysis_v1_beta1.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "ContainerAnalysisV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1Client" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GetIamPolicy", - "service": { - "shortName": "ContainerAnalysisV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_TestIamPermissions_async", - "title": "containeranalysis testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, `containeranalysis.notes.list`). The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.", - "canonical": true, - "file": "container_analysis_v1_beta1.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "ContainerAnalysisV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1Client" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.TestIamPermissions", - "service": { - "shortName": "ContainerAnalysisV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async", - "title": "containeranalysis generatePackagesSummary Sample", - "origin": "API_DEFINITION", - "description": " Gets a summary of the packages within a given resource.", - "canonical": true, - "file": "container_analysis_v1_beta1.generate_packages_summary.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GeneratePackagesSummary", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GeneratePackagesSummary", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse", - "client": { - "shortName": "ContainerAnalysisV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1Client" - }, - "method": { - "shortName": "GeneratePackagesSummary", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GeneratePackagesSummary", - "service": { - "shortName": "ContainerAnalysisV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrence_async", - "title": "containeranalysis getOccurrence Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified occurrence.", - "canonical": true, - "file": "grafeas_v1_beta1.get_occurrence.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOccurrence", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetOccurrence", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1beta1.Occurrence", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "GetOccurrence", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetOccurrence", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListOccurrences_async", - "title": "containeranalysis listOccurrences Sample", - "origin": "API_DEFINITION", - "description": " Lists occurrences for the specified project.", - "canonical": true, - "file": "grafeas_v1_beta1.list_occurrences.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListOccurrences", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListOccurrences", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1beta1.ListOccurrencesResponse", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "ListOccurrences", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListOccurrences", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteOccurrence_async", - "title": "containeranalysis deleteOccurrence Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.", - "canonical": true, - "file": "grafeas_v1_beta1.delete_occurrence.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteOccurrence", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.DeleteOccurrence", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "DeleteOccurrence", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.DeleteOccurrence", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateOccurrence_async", - "title": "containeranalysis createOccurrence Sample", - "origin": "API_DEFINITION", - "description": " Creates a new occurrence.", - "canonical": true, - "file": "grafeas_v1_beta1.create_occurrence.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateOccurrence", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.CreateOccurrence", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "occurrence", - "type": ".grafeas.v1beta1.Occurrence" - } - ], - "resultType": ".grafeas.v1beta1.Occurrence", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "CreateOccurrence", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.CreateOccurrence", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateOccurrences_async", - "title": "containeranalysis batchCreateOccurrences Sample", - "origin": "API_DEFINITION", - "description": " Creates new occurrences in batch.", - "canonical": true, - "file": "grafeas_v1_beta1.batch_create_occurrences.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchCreateOccurrences", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.BatchCreateOccurrences", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "occurrences", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".grafeas.v1beta1.BatchCreateOccurrencesResponse", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "BatchCreateOccurrences", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.BatchCreateOccurrences", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateOccurrence_async", - "title": "containeranalysis updateOccurrence Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified occurrence.", - "canonical": true, - "file": "grafeas_v1_beta1.update_occurrence.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateOccurrence", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.UpdateOccurrence", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "occurrence", - "type": ".grafeas.v1beta1.Occurrence" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".grafeas.v1beta1.Occurrence", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "UpdateOccurrence", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.UpdateOccurrence", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrenceNote_async", - "title": "containeranalysis getOccurrenceNote Sample", - "origin": "API_DEFINITION", - "description": " Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.", - "canonical": true, - "file": "grafeas_v1_beta1.get_occurrence_note.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOccurrenceNote", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetOccurrenceNote", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1beta1.Note", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "GetOccurrenceNote", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetOccurrenceNote", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetNote_async", - "title": "containeranalysis getNote Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified note.", - "canonical": true, - "file": "grafeas_v1_beta1.get_note.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNote", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetNote", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1beta1.Note", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "GetNote", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetNote", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNotes_async", - "title": "containeranalysis listNotes Sample", - "origin": "API_DEFINITION", - "description": " Lists notes for the specified project.", - "canonical": true, - "file": "grafeas_v1_beta1.list_notes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNotes", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListNotes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1beta1.ListNotesResponse", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "ListNotes", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListNotes", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteNote_async", - "title": "containeranalysis deleteNote Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified note.", - "canonical": true, - "file": "grafeas_v1_beta1.delete_note.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNote", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.DeleteNote", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "DeleteNote", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.DeleteNote", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateNote_async", - "title": "containeranalysis createNote Sample", - "origin": "API_DEFINITION", - "description": " Creates a new note.", - "canonical": true, - "file": "grafeas_v1_beta1.create_note.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNote", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.CreateNote", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "note_id", - "type": "TYPE_STRING" - }, - { - "name": "note", - "type": ".grafeas.v1beta1.Note" - } - ], - "resultType": ".grafeas.v1beta1.Note", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "CreateNote", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.CreateNote", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateNotes_async", - "title": "containeranalysis batchCreateNotes Sample", - "origin": "API_DEFINITION", - "description": " Creates new notes in batch.", - "canonical": true, - "file": "grafeas_v1_beta1.batch_create_notes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchCreateNotes", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.BatchCreateNotes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "notes", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".grafeas.v1beta1.BatchCreateNotesResponse", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "BatchCreateNotes", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.BatchCreateNotes", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateNote_async", - "title": "containeranalysis updateNote Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified note.", - "canonical": true, - "file": "grafeas_v1_beta1.update_note.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNote", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.UpdateNote", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "note", - "type": ".grafeas.v1beta1.Note" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".grafeas.v1beta1.Note", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "UpdateNote", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.UpdateNote", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNoteOccurrences_async", - "title": "containeranalysis listNoteOccurrences Sample", - "origin": "API_DEFINITION", - "description": " Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.", - "canonical": true, - "file": "grafeas_v1_beta1.list_note_occurrences.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNoteOccurrences", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListNoteOccurrences", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1beta1.ListNoteOccurrencesResponse", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "ListNoteOccurrences", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.ListNoteOccurrences", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - }, - { - "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetVulnerabilityOccurrencesSummary_async", - "title": "containeranalysis getVulnerabilityOccurrencesSummary Sample", - "origin": "API_DEFINITION", - "description": " Gets a summary of the number and severity of occurrences.", - "canonical": true, - "file": "grafeas_v1_beta1.get_vulnerability_occurrences_summary.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetVulnerabilityOccurrencesSummary", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetVulnerabilityOccurrencesSummary", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".grafeas.v1beta1.VulnerabilityOccurrencesSummary", - "client": { - "shortName": "GrafeasV1Beta1Client", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1Client" - }, - "method": { - "shortName": "GetVulnerabilityOccurrencesSummary", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1.GetVulnerabilityOccurrencesSummary", - "service": { - "shortName": "GrafeasV1Beta1", - "fullName": "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/index.ts deleted file mode 100644 index 2a51d901047..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/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 v1beta1 from './v1beta1'; -const ContainerAnalysisV1Beta1Client = v1beta1.ContainerAnalysisV1Beta1Client; -type ContainerAnalysisV1Beta1Client = v1beta1.ContainerAnalysisV1Beta1Client; -const GrafeasV1Beta1Client = v1beta1.GrafeasV1Beta1Client; -type GrafeasV1Beta1Client = v1beta1.GrafeasV1Beta1Client; -export {v1beta1, ContainerAnalysisV1Beta1Client, GrafeasV1Beta1Client}; -export default {v1beta1, ContainerAnalysisV1Beta1Client, GrafeasV1Beta1Client}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client.ts deleted file mode 100644 index f529bd4e4b5..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client.ts +++ /dev/null @@ -1,641 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/container_analysis_v1_beta1_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './container_analysis_v1_beta1_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Retrieves analysis results of Cloud components such as Docker container - * images. The Container Analysis API is an implementation of the - * [Grafeas](https://grafeas.io) API. - * - * Analysis results are stored as a series of occurrences. An `Occurrence` - * contains information about a specific analysis instance on a resource. An - * occurrence refers to a `Note`. A note contains details describing the - * analysis and is generally stored in a separate project, called a `Provider`. - * Multiple occurrences can refer to the same note. - * - * For example, an SSL vulnerability could affect multiple images. In this case, - * there would be one note for the vulnerability and an occurrence for each - * image with the vulnerability referring to that note. - * @class - * @memberof v1beta1 - */ -export class ContainerAnalysisV1Beta1Client { - 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}; - containerAnalysisV1Beta1Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ContainerAnalysisV1Beta1Client. - * - * @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 ContainerAnalysisV1Beta1Client({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 ContainerAnalysisV1Beta1Client; - 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.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1', 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.containerAnalysisV1Beta1Stub) { - return this.containerAnalysisV1Beta1Stub; - } - - // Put together the "service stub" for - // google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1. - this.containerAnalysisV1Beta1Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1, - 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 containerAnalysisV1Beta1StubMethods = - ['setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'generatePackagesSummary']; - for (const methodName of containerAnalysisV1Beta1StubMethods) { - const callPromise = this.containerAnalysisV1Beta1Stub.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.containerAnalysisV1Beta1Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'containeranalysis.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 'containeranalysis.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 on the specified note or occurrence. - * Requires `containeranalysis.notes.setIamPolicy` or - * `containeranalysis.occurrences.setIamPolicy` permission if the resource is - * a note or an occurrence, respectively. - * - * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - * occurrences. - * - * @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/container_analysis_v1_beta1.set_iam_policy.js - * region_tag:containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 note or an occurrence resource. - * Requires `containeranalysis.notes.setIamPolicy` or - * `containeranalysis.occurrences.setIamPolicy` permission if the resource is - * a note or occurrence, respectively. - * - * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - * occurrences. - * - * @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/container_analysis_v1_beta1.get_iam_policy.js - * region_tag:containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 the permissions that a caller has on the specified note or - * occurrence. Requires list permission on the project (for example, - * `containeranalysis.notes.list`). - * - * The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for - * notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for - * occurrences. - * - * @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/container_analysis_v1_beta1.test_iam_permissions.js - * region_tag:containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_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 a summary of the packages within a given resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the resource to get a packages summary for in the - * form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse|PackagesSummaryResponse}. - * Please see the {@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/container_analysis_v1_beta1.generate_packages_summary.js - * region_tag:containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async - */ - generatePackagesSummary( - request?: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, - protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|undefined, {}|undefined - ]>; - generatePackagesSummary( - request: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, - protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|null|undefined, - {}|null|undefined>): void; - generatePackagesSummary( - request: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, - callback: Callback< - protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, - protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|null|undefined, - {}|null|undefined>): void; - generatePackagesSummary( - request?: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, - protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, - protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, - protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.generatePackagesSummary(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.containerAnalysisV1Beta1Stub && !this._terminated) { - return this.containerAnalysisV1Beta1Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client_config.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client_config.json deleted file mode 100644 index cda6d95cb3a..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_client_config.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "interfaces": { - "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1": { - "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": { - "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" - }, - "GeneratePackagesSummary": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_proto_list.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_proto_list.json deleted file mode 100644 index 9ad38a4354a..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/container_analysis_v1_beta1_proto_list.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - "../../protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/build/build.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/common/common.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/image/image.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/package/package.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/source/source.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto" -] diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 7d486f3ad4d..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.devtools.containeranalysis.v1beta1", - "libraryPackage": "@google-cloud/containeranalysis", - "services": { - "ContainerAnalysisV1Beta1": { - "clients": { - "grpc": { - "libraryClient": "ContainerAnalysisV1Beta1Client", - "rpcs": { - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "GeneratePackagesSummary": { - "methods": [ - "generatePackagesSummary" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ContainerAnalysisV1Beta1Client", - "rpcs": { - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "GeneratePackagesSummary": { - "methods": [ - "generatePackagesSummary" - ] - } - } - } - } - }, - "GrafeasV1Beta1": { - "clients": { - "grpc": { - "libraryClient": "GrafeasV1Beta1Client", - "rpcs": { - "GetOccurrence": { - "methods": [ - "getOccurrence" - ] - }, - "DeleteOccurrence": { - "methods": [ - "deleteOccurrence" - ] - }, - "CreateOccurrence": { - "methods": [ - "createOccurrence" - ] - }, - "BatchCreateOccurrences": { - "methods": [ - "batchCreateOccurrences" - ] - }, - "UpdateOccurrence": { - "methods": [ - "updateOccurrence" - ] - }, - "GetOccurrenceNote": { - "methods": [ - "getOccurrenceNote" - ] - }, - "GetNote": { - "methods": [ - "getNote" - ] - }, - "DeleteNote": { - "methods": [ - "deleteNote" - ] - }, - "CreateNote": { - "methods": [ - "createNote" - ] - }, - "BatchCreateNotes": { - "methods": [ - "batchCreateNotes" - ] - }, - "UpdateNote": { - "methods": [ - "updateNote" - ] - }, - "GetVulnerabilityOccurrencesSummary": { - "methods": [ - "getVulnerabilityOccurrencesSummary" - ] - }, - "ListOccurrences": { - "methods": [ - "listOccurrences", - "listOccurrencesStream", - "listOccurrencesAsync" - ] - }, - "ListNotes": { - "methods": [ - "listNotes", - "listNotesStream", - "listNotesAsync" - ] - }, - "ListNoteOccurrences": { - "methods": [ - "listNoteOccurrences", - "listNoteOccurrencesStream", - "listNoteOccurrencesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "GrafeasV1Beta1Client", - "rpcs": { - "GetOccurrence": { - "methods": [ - "getOccurrence" - ] - }, - "DeleteOccurrence": { - "methods": [ - "deleteOccurrence" - ] - }, - "CreateOccurrence": { - "methods": [ - "createOccurrence" - ] - }, - "BatchCreateOccurrences": { - "methods": [ - "batchCreateOccurrences" - ] - }, - "UpdateOccurrence": { - "methods": [ - "updateOccurrence" - ] - }, - "GetOccurrenceNote": { - "methods": [ - "getOccurrenceNote" - ] - }, - "GetNote": { - "methods": [ - "getNote" - ] - }, - "DeleteNote": { - "methods": [ - "deleteNote" - ] - }, - "CreateNote": { - "methods": [ - "createNote" - ] - }, - "BatchCreateNotes": { - "methods": [ - "batchCreateNotes" - ] - }, - "UpdateNote": { - "methods": [ - "updateNote" - ] - }, - "GetVulnerabilityOccurrencesSummary": { - "methods": [ - "getVulnerabilityOccurrencesSummary" - ] - }, - "ListOccurrences": { - "methods": [ - "listOccurrences", - "listOccurrencesStream", - "listOccurrencesAsync" - ] - }, - "ListNotes": { - "methods": [ - "listNotes", - "listNotesStream", - "listNotesAsync" - ] - }, - "ListNoteOccurrences": { - "methods": [ - "listNoteOccurrences", - "listNoteOccurrencesStream", - "listNoteOccurrencesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client.ts deleted file mode 100644 index 39408955b17..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client.ts +++ /dev/null @@ -1,1746 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1beta1/grafeas_v1_beta1_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './grafeas_v1_beta1_client_config.json'; -const version = require('../../../package.json').version; - -/** - * [Grafeas](grafeas.io) API. - * - * Retrieves analysis results of Cloud components such as Docker container - * images. - * - * Analysis results are stored as a series of occurrences. An `Occurrence` - * contains information about a specific analysis instance on a resource. An - * occurrence refers to a `Note`. A note contains details describing the - * analysis and is generally stored in a separate project, called a `Provider`. - * Multiple occurrences can refer to the same note. - * - * For example, an SSL vulnerability could affect multiple images. In this case, - * there would be one note for the vulnerability and an occurrence for each - * image with the vulnerability referring to that note. - * @class - * @memberof v1beta1 - */ -export class GrafeasV1Beta1Client { - 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}; - grafeasV1Beta1Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GrafeasV1Beta1Client. - * - * @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 GrafeasV1Beta1Client({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 GrafeasV1Beta1Client; - 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 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 = { - listOccurrences: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'occurrences'), - listNotes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notes'), - listNoteOccurrences: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'occurrences') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1', 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.grafeasV1Beta1Stub) { - return this.grafeasV1Beta1Stub; - } - - // Put together the "service stub" for - // google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1. - this.grafeasV1Beta1Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1, - 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 grafeasV1Beta1StubMethods = - ['getOccurrence', 'listOccurrences', 'deleteOccurrence', 'createOccurrence', 'batchCreateOccurrences', 'updateOccurrence', 'getOccurrenceNote', 'getNote', 'listNotes', 'deleteNote', 'createNote', 'batchCreateNotes', 'updateNote', 'listNoteOccurrences', 'getVulnerabilityOccurrencesSummary']; - for (const methodName of grafeasV1Beta1StubMethods) { - const callPromise = this.grafeasV1Beta1Stub.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.grafeasV1Beta1Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'containeranalysis.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 'containeranalysis.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 specified occurrence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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.grafeas.v1beta1.Occurrence|Occurrence}. - * Please see the {@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/grafeas_v1_beta1.get_occurrence.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrence_async - */ - getOccurrence( - request?: protos.grafeas.v1beta1.IGetOccurrenceRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IGetOccurrenceRequest|undefined, {}|undefined - ]>; - getOccurrence( - request: protos.grafeas.v1beta1.IGetOccurrenceRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IGetOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - getOccurrence( - request: protos.grafeas.v1beta1.IGetOccurrenceRequest, - callback: Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IGetOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - getOccurrence( - request?: protos.grafeas.v1beta1.IGetOccurrenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IGetOccurrenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IGetOccurrenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IGetOccurrenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getOccurrence(request, options, callback); - } -/** - * Deletes the specified occurrence. For example, use this method to delete an - * occurrence when the occurrence is no longer applicable for the given - * resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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/v1beta1/grafeas_v1_beta1.delete_occurrence.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteOccurrence_async - */ - deleteOccurrence( - request?: protos.grafeas.v1beta1.IDeleteOccurrenceRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteOccurrenceRequest|undefined, {}|undefined - ]>; - deleteOccurrence( - request: protos.grafeas.v1beta1.IDeleteOccurrenceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - deleteOccurrence( - request: protos.grafeas.v1beta1.IDeleteOccurrenceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - deleteOccurrence( - request?: protos.grafeas.v1beta1.IDeleteOccurrenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteOccurrenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteOccurrenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteOccurrenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteOccurrence(request, options, callback); - } -/** - * Creates a new occurrence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project in the form of `projects/[PROJECT_ID]`, under which - * the occurrence is to be created. - * @param {grafeas.v1beta1.Occurrence} request.occurrence - * The occurrence 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 {@link protos.grafeas.v1beta1.Occurrence|Occurrence}. - * Please see the {@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/grafeas_v1_beta1.create_occurrence.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateOccurrence_async - */ - createOccurrence( - request?: protos.grafeas.v1beta1.ICreateOccurrenceRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.ICreateOccurrenceRequest|undefined, {}|undefined - ]>; - createOccurrence( - request: protos.grafeas.v1beta1.ICreateOccurrenceRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.ICreateOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - createOccurrence( - request: protos.grafeas.v1beta1.ICreateOccurrenceRequest, - callback: Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.ICreateOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - createOccurrence( - request?: protos.grafeas.v1beta1.ICreateOccurrenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.ICreateOccurrenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.ICreateOccurrenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.ICreateOccurrenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createOccurrence(request, options, callback); - } -/** - * Creates new occurrences in batch. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project in the form of `projects/[PROJECT_ID]`, under which - * the occurrences are to be created. - * @param {number[]} request.occurrences - * The occurrences 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 {@link protos.grafeas.v1beta1.BatchCreateOccurrencesResponse|BatchCreateOccurrencesResponse}. - * Please see the {@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/grafeas_v1_beta1.batch_create_occurrences.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateOccurrences_async - */ - batchCreateOccurrences( - request?: protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|undefined, {}|undefined - ]>; - batchCreateOccurrences( - request: protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|null|undefined, - {}|null|undefined>): void; - batchCreateOccurrences( - request: protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest, - callback: Callback< - protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|null|undefined, - {}|null|undefined>): void; - batchCreateOccurrences( - request?: protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse, - protos.grafeas.v1beta1.IBatchCreateOccurrencesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.batchCreateOccurrences(request, options, callback); - } -/** - * Updates the specified occurrence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. - * @param {grafeas.v1beta1.Occurrence} request.occurrence - * The updated occurrence. - * @param {google.protobuf.FieldMask} request.updateMask - * The fields to update. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.grafeas.v1beta1.Occurrence|Occurrence}. - * Please see the {@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/grafeas_v1_beta1.update_occurrence.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateOccurrence_async - */ - updateOccurrence( - request?: protos.grafeas.v1beta1.IUpdateOccurrenceRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IUpdateOccurrenceRequest|undefined, {}|undefined - ]>; - updateOccurrence( - request: protos.grafeas.v1beta1.IUpdateOccurrenceRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IUpdateOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - updateOccurrence( - request: protos.grafeas.v1beta1.IUpdateOccurrenceRequest, - callback: Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IUpdateOccurrenceRequest|null|undefined, - {}|null|undefined>): void; - updateOccurrence( - request?: protos.grafeas.v1beta1.IUpdateOccurrenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IUpdateOccurrenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IUpdateOccurrenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1beta1.IOccurrence, - protos.grafeas.v1beta1.IUpdateOccurrenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateOccurrence(request, options, callback); - } -/** - * Gets the note attached to the specified occurrence. Consumer projects can - * use this method to get a note that belongs to a provider project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the occurrence in the form of - * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_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.grafeas.v1beta1.Note|Note}. - * Please see the {@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/grafeas_v1_beta1.get_occurrence_note.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrenceNote_async - */ - getOccurrenceNote( - request?: protos.grafeas.v1beta1.IGetOccurrenceNoteRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|undefined, {}|undefined - ]>; - getOccurrenceNote( - request: protos.grafeas.v1beta1.IGetOccurrenceNoteRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|null|undefined, - {}|null|undefined>): void; - getOccurrenceNote( - request: protos.grafeas.v1beta1.IGetOccurrenceNoteRequest, - callback: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|null|undefined, - {}|null|undefined>): void; - getOccurrenceNote( - request?: protos.grafeas.v1beta1.IGetOccurrenceNoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetOccurrenceNoteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getOccurrenceNote(request, options, callback); - } -/** - * Gets the specified note. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_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.grafeas.v1beta1.Note|Note}. - * Please see the {@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/grafeas_v1_beta1.get_note.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetNote_async - */ - getNote( - request?: protos.grafeas.v1beta1.IGetNoteRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetNoteRequest|undefined, {}|undefined - ]>; - getNote( - request: protos.grafeas.v1beta1.IGetNoteRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetNoteRequest|null|undefined, - {}|null|undefined>): void; - getNote( - request: protos.grafeas.v1beta1.IGetNoteRequest, - callback: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetNoteRequest|null|undefined, - {}|null|undefined>): void; - getNote( - request?: protos.grafeas.v1beta1.IGetNoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetNoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetNoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IGetNoteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getNote(request, options, callback); - } -/** - * Deletes the specified note. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_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/v1beta1/grafeas_v1_beta1.delete_note.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_DeleteNote_async - */ - deleteNote( - request?: protos.grafeas.v1beta1.IDeleteNoteRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteNoteRequest|undefined, {}|undefined - ]>; - deleteNote( - request: protos.grafeas.v1beta1.IDeleteNoteRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteNoteRequest|null|undefined, - {}|null|undefined>): void; - deleteNote( - request: protos.grafeas.v1beta1.IDeleteNoteRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteNoteRequest|null|undefined, - {}|null|undefined>): void; - deleteNote( - request?: protos.grafeas.v1beta1.IDeleteNoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteNoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteNoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.grafeas.v1beta1.IDeleteNoteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteNote(request, options, callback); - } -/** - * Creates a new note. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project in the form of `projects/[PROJECT_ID]`, under which - * the note is to be created. - * @param {string} request.noteId - * The ID to use for this note. - * @param {grafeas.v1beta1.Note} request.note - * The note 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 {@link protos.grafeas.v1beta1.Note|Note}. - * Please see the {@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/grafeas_v1_beta1.create_note.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_CreateNote_async - */ - createNote( - request?: protos.grafeas.v1beta1.ICreateNoteRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.ICreateNoteRequest|undefined, {}|undefined - ]>; - createNote( - request: protos.grafeas.v1beta1.ICreateNoteRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.ICreateNoteRequest|null|undefined, - {}|null|undefined>): void; - createNote( - request: protos.grafeas.v1beta1.ICreateNoteRequest, - callback: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.ICreateNoteRequest|null|undefined, - {}|null|undefined>): void; - createNote( - request?: protos.grafeas.v1beta1.ICreateNoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.ICreateNoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.ICreateNoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.ICreateNoteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createNote(request, options, callback); - } -/** - * Creates new notes in batch. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project in the form of `projects/[PROJECT_ID]`, under which - * the notes are to be created. - * @param {number[]} request.notes - * The notes 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 {@link protos.grafeas.v1beta1.BatchCreateNotesResponse|BatchCreateNotesResponse}. - * Please see the {@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/grafeas_v1_beta1.batch_create_notes.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_BatchCreateNotes_async - */ - batchCreateNotes( - request?: protos.grafeas.v1beta1.IBatchCreateNotesRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.IBatchCreateNotesResponse, - protos.grafeas.v1beta1.IBatchCreateNotesRequest|undefined, {}|undefined - ]>; - batchCreateNotes( - request: protos.grafeas.v1beta1.IBatchCreateNotesRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1beta1.IBatchCreateNotesResponse, - protos.grafeas.v1beta1.IBatchCreateNotesRequest|null|undefined, - {}|null|undefined>): void; - batchCreateNotes( - request: protos.grafeas.v1beta1.IBatchCreateNotesRequest, - callback: Callback< - protos.grafeas.v1beta1.IBatchCreateNotesResponse, - protos.grafeas.v1beta1.IBatchCreateNotesRequest|null|undefined, - {}|null|undefined>): void; - batchCreateNotes( - request?: protos.grafeas.v1beta1.IBatchCreateNotesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1beta1.IBatchCreateNotesResponse, - protos.grafeas.v1beta1.IBatchCreateNotesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1beta1.IBatchCreateNotesResponse, - protos.grafeas.v1beta1.IBatchCreateNotesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1beta1.IBatchCreateNotesResponse, - protos.grafeas.v1beta1.IBatchCreateNotesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.batchCreateNotes(request, options, callback); - } -/** - * Updates the specified note. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the note in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - * @param {grafeas.v1beta1.Note} request.note - * The updated note. - * @param {google.protobuf.FieldMask} request.updateMask - * The fields to update. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.grafeas.v1beta1.Note|Note}. - * Please see the {@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/grafeas_v1_beta1.update_note.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_UpdateNote_async - */ - updateNote( - request?: protos.grafeas.v1beta1.IUpdateNoteRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IUpdateNoteRequest|undefined, {}|undefined - ]>; - updateNote( - request: protos.grafeas.v1beta1.IUpdateNoteRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IUpdateNoteRequest|null|undefined, - {}|null|undefined>): void; - updateNote( - request: protos.grafeas.v1beta1.IUpdateNoteRequest, - callback: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IUpdateNoteRequest|null|undefined, - {}|null|undefined>): void; - updateNote( - request?: protos.grafeas.v1beta1.IUpdateNoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IUpdateNoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IUpdateNoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1beta1.INote, - protos.grafeas.v1beta1.IUpdateNoteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateNote(request, options, callback); - } -/** - * Gets a summary of the number and severity of occurrences. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project to get a vulnerability summary for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.grafeas.v1beta1.VulnerabilityOccurrencesSummary|VulnerabilityOccurrencesSummary}. - * Please see the {@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/grafeas_v1_beta1.get_vulnerability_occurrences_summary.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetVulnerabilityOccurrencesSummary_async - */ - getVulnerabilityOccurrencesSummary( - request?: protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, - protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|undefined, {}|undefined - ]>; - getVulnerabilityOccurrencesSummary( - request: protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest, - options: CallOptions, - callback: Callback< - protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, - protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, - {}|null|undefined>): void; - getVulnerabilityOccurrencesSummary( - request: protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest, - callback: Callback< - protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, - protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, - {}|null|undefined>): void; - getVulnerabilityOccurrencesSummary( - request?: protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, - protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, - protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary, - protos.grafeas.v1beta1.IGetVulnerabilityOccurrencesSummaryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.getVulnerabilityOccurrencesSummary(request, options, callback); - } - - /** - * Lists occurrences for the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project to list occurrences for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence}. - * 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 `listOccurrencesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listOccurrences( - request?: protos.grafeas.v1beta1.IListOccurrencesRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.IOccurrence[], - protos.grafeas.v1beta1.IListOccurrencesRequest|null, - protos.grafeas.v1beta1.IListOccurrencesResponse - ]>; - listOccurrences( - request: protos.grafeas.v1beta1.IListOccurrencesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.grafeas.v1beta1.IListOccurrencesRequest, - protos.grafeas.v1beta1.IListOccurrencesResponse|null|undefined, - protos.grafeas.v1beta1.IOccurrence>): void; - listOccurrences( - request: protos.grafeas.v1beta1.IListOccurrencesRequest, - callback: PaginationCallback< - protos.grafeas.v1beta1.IListOccurrencesRequest, - protos.grafeas.v1beta1.IListOccurrencesResponse|null|undefined, - protos.grafeas.v1beta1.IOccurrence>): void; - listOccurrences( - request?: protos.grafeas.v1beta1.IListOccurrencesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.grafeas.v1beta1.IListOccurrencesRequest, - protos.grafeas.v1beta1.IListOccurrencesResponse|null|undefined, - protos.grafeas.v1beta1.IOccurrence>, - callback?: PaginationCallback< - protos.grafeas.v1beta1.IListOccurrencesRequest, - protos.grafeas.v1beta1.IListOccurrencesResponse|null|undefined, - protos.grafeas.v1beta1.IOccurrence>): - Promise<[ - protos.grafeas.v1beta1.IOccurrence[], - protos.grafeas.v1beta1.IListOccurrencesRequest|null, - protos.grafeas.v1beta1.IListOccurrencesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listOccurrences(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 name of the project to list occurrences for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence} 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 `listOccurrencesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listOccurrencesStream( - request?: protos.grafeas.v1beta1.IListOccurrencesRequest, - 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['listOccurrences']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listOccurrences.createStream( - this.innerApiCalls.listOccurrences as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listOccurrences`, 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 name of the project to list occurrences for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence}. 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/grafeas_v1_beta1.list_occurrences.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListOccurrences_async - */ - listOccurrencesAsync( - request?: protos.grafeas.v1beta1.IListOccurrencesRequest, - 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['listOccurrences']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listOccurrences.asyncIterate( - this.innerApiCalls['listOccurrences'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists notes for the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The name of the project to list notes for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of notes to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Note|Note}. - * 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 `listNotesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNotes( - request?: protos.grafeas.v1beta1.IListNotesRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.INote[], - protos.grafeas.v1beta1.IListNotesRequest|null, - protos.grafeas.v1beta1.IListNotesResponse - ]>; - listNotes( - request: protos.grafeas.v1beta1.IListNotesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.grafeas.v1beta1.IListNotesRequest, - protos.grafeas.v1beta1.IListNotesResponse|null|undefined, - protos.grafeas.v1beta1.INote>): void; - listNotes( - request: protos.grafeas.v1beta1.IListNotesRequest, - callback: PaginationCallback< - protos.grafeas.v1beta1.IListNotesRequest, - protos.grafeas.v1beta1.IListNotesResponse|null|undefined, - protos.grafeas.v1beta1.INote>): void; - listNotes( - request?: protos.grafeas.v1beta1.IListNotesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.grafeas.v1beta1.IListNotesRequest, - protos.grafeas.v1beta1.IListNotesResponse|null|undefined, - protos.grafeas.v1beta1.INote>, - callback?: PaginationCallback< - protos.grafeas.v1beta1.IListNotesRequest, - protos.grafeas.v1beta1.IListNotesResponse|null|undefined, - protos.grafeas.v1beta1.INote>): - Promise<[ - protos.grafeas.v1beta1.INote[], - protos.grafeas.v1beta1.IListNotesRequest|null, - protos.grafeas.v1beta1.IListNotesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listNotes(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 name of the project to list notes for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of notes to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Note|Note} 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 `listNotesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNotesStream( - request?: protos.grafeas.v1beta1.IListNotesRequest, - 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['listNotes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotes.createStream( - this.innerApiCalls.listNotes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNotes`, 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 name of the project to list notes for in the form of - * `projects/[PROJECT_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of notes to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Note|Note}. 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/grafeas_v1_beta1.list_notes.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNotes_async - */ - listNotesAsync( - request?: protos.grafeas.v1beta1.IListNotesRequest, - 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['listNotes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotes.asyncIterate( - this.innerApiCalls['listNotes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists occurrences referencing the specified note. Provider projects can use - * this method to get all occurrences across consumer projects referencing the - * specified note. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the note to list occurrences for in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence}. - * 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 `listNoteOccurrencesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNoteOccurrences( - request?: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, - options?: CallOptions): - Promise<[ - protos.grafeas.v1beta1.IOccurrence[], - protos.grafeas.v1beta1.IListNoteOccurrencesRequest|null, - protos.grafeas.v1beta1.IListNoteOccurrencesResponse - ]>; - listNoteOccurrences( - request: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.grafeas.v1beta1.IListNoteOccurrencesRequest, - protos.grafeas.v1beta1.IListNoteOccurrencesResponse|null|undefined, - protos.grafeas.v1beta1.IOccurrence>): void; - listNoteOccurrences( - request: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, - callback: PaginationCallback< - protos.grafeas.v1beta1.IListNoteOccurrencesRequest, - protos.grafeas.v1beta1.IListNoteOccurrencesResponse|null|undefined, - protos.grafeas.v1beta1.IOccurrence>): void; - listNoteOccurrences( - request?: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.grafeas.v1beta1.IListNoteOccurrencesRequest, - protos.grafeas.v1beta1.IListNoteOccurrencesResponse|null|undefined, - protos.grafeas.v1beta1.IOccurrence>, - callback?: PaginationCallback< - protos.grafeas.v1beta1.IListNoteOccurrencesRequest, - protos.grafeas.v1beta1.IListNoteOccurrencesResponse|null|undefined, - protos.grafeas.v1beta1.IOccurrence>): - Promise<[ - protos.grafeas.v1beta1.IOccurrence[], - protos.grafeas.v1beta1.IListNoteOccurrencesRequest|null, - protos.grafeas.v1beta1.IListNoteOccurrencesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.listNoteOccurrences(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.name - * The name of the note to list occurrences for in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence} 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 `listNoteOccurrencesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listNoteOccurrencesStream( - request?: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNoteOccurrences']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNoteOccurrences.createStream( - this.innerApiCalls.listNoteOccurrences as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNoteOccurrences`, 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.name - * The name of the note to list occurrences for in the form of - * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. - * @param {string} request.filter - * The filter expression. - * @param {number} request.pageSize - * Number of occurrences to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in 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.grafeas.v1beta1.Occurrence|Occurrence}. 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/grafeas_v1_beta1.list_note_occurrences.js - * region_tag:containeranalysis_v1beta1_generated_GrafeasV1Beta1_ListNoteOccurrences_async - */ - listNoteOccurrencesAsync( - request?: protos.grafeas.v1beta1.IListNoteOccurrencesRequest, - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNoteOccurrences']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNoteOccurrences.asyncIterate( - this.innerApiCalls['listNoteOccurrences'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * 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.grafeasV1Beta1Stub && !this._terminated) { - return this.grafeasV1Beta1Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client_config.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client_config.json deleted file mode 100644 index 8c9edc4b411..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_client_config.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "interfaces": { - "google.devtools.containeranalysis.v1beta1.GrafeasV1Beta1": { - "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": { - "GetOccurrence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListOccurrences": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteOccurrence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateOccurrence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchCreateOccurrences": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateOccurrence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetOccurrenceNote": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNote": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListNotes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNote": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateNote": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchCreateNotes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNote": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListNoteOccurrences": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetVulnerabilityOccurrencesSummary": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_proto_list.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_proto_list.json deleted file mode 100644 index 9ad38a4354a..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/grafeas_v1_beta1_proto_list.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - "../../protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/build/build.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/common/common.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/image/image.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/package/package.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/source/source.proto", - "../../protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto" -] diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index 619ba56f58e..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/src/v1beta1/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 {ContainerAnalysisV1Beta1Client} from './container_analysis_v1_beta1_client'; -export {GrafeasV1Beta1Client} from './grafeas_v1_beta1_client'; diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 5470be044e7..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/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 containeranalysis = require('@google-cloud/containeranalysis'); - -function main() { - const containerAnalysisV1Beta1Client = new containeranalysis.ContainerAnalysisV1Beta1Client(); - const grafeasV1Beta1Client = new containeranalysis.GrafeasV1Beta1Client(); -} - -main(); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index c5a91cc661c..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/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 {ContainerAnalysisV1Beta1Client, GrafeasV1Beta1Client} from '@google-cloud/containeranalysis'; - -// check that the client class type name can be used -function doStuffWithContainerAnalysisV1Beta1Client(client: ContainerAnalysisV1Beta1Client) { - client.close(); -} -function doStuffWithGrafeasV1Beta1Client(client: GrafeasV1Beta1Client) { - client.close(); -} - -function main() { - // check that the client instance can be created - const containerAnalysisV1Beta1Client = new ContainerAnalysisV1Beta1Client(); - doStuffWithContainerAnalysisV1Beta1Client(containerAnalysisV1Beta1Client); - // check that the client instance can be created - const grafeasV1Beta1Client = new GrafeasV1Beta1Client(); - doStuffWithGrafeasV1Beta1Client(grafeasV1Beta1Client); -} - -main(); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/install.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1beta1/test/gapic_container_analysis_v1_beta1_v1beta1.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_container_analysis_v1_beta1_v1beta1.ts deleted file mode 100644 index 434cb9e1ee9..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_container_analysis_v1_beta1_v1beta1.ts +++ /dev/null @@ -1,582 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 containeranalysisv1beta1Module 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.ContainerAnalysisV1Beta1Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.containerAnalysisV1Beta1Stub, undefined); - await client.initialize(); - assert(client.containerAnalysisV1Beta1Stub); - }); - - it('has close method for the initialized client', done => { - const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.containerAnalysisV1Beta1Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.containerAnalysisV1Beta1Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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 containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - 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('generatePackagesSummary', () => { - it('invokes generatePackagesSummary without error', async () => { - const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse() - ); - client.innerApiCalls.generatePackagesSummary = stubSimpleCall(expectedResponse); - const [response] = await client.generatePackagesSummary(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generatePackagesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generatePackagesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generatePackagesSummary without error using callback', async () => { - const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse() - ); - client.innerApiCalls.generatePackagesSummary = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generatePackagesSummary( - request, - (err?: Error|null, result?: protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generatePackagesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generatePackagesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generatePackagesSummary with error', async () => { - const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generatePackagesSummary = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generatePackagesSummary(request), expectedError); - const actualRequest = (client.innerApiCalls.generatePackagesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generatePackagesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generatePackagesSummary with closed client', async () => { - const client = new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generatePackagesSummary(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_grafeas_v1_beta1_v1beta1.ts b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_grafeas_v1_beta1_v1beta1.ts deleted file mode 100644 index 1e0db3c9020..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/test/gapic_grafeas_v1_beta1_v1beta1.ts +++ /dev/null @@ -1,2228 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 grafeasv1beta1Module 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('v1beta1.GrafeasV1Beta1Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.grafeasV1Beta1Stub, undefined); - await client.initialize(); - assert(client.grafeasV1Beta1Stub); - }); - - it('has close method for the initialized client', done => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.grafeasV1Beta1Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.grafeasV1Beta1Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - 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 grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - 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('getOccurrence', () => { - it('invokes getOccurrence without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Occurrence() - ); - client.innerApiCalls.getOccurrence = stubSimpleCall(expectedResponse); - const [response] = await client.getOccurrence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrence without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Occurrence() - ); - client.innerApiCalls.getOccurrence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOccurrence( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.IOccurrence|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrence with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getOccurrence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOccurrence(request), expectedError); - const actualRequest = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrence with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOccurrence(request), expectedError); - }); - }); - - describe('deleteOccurrence', () => { - it('invokes deleteOccurrence without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.DeleteOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.DeleteOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteOccurrence = stubSimpleCall(expectedResponse); - const [response] = await client.deleteOccurrence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteOccurrence without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.DeleteOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.DeleteOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteOccurrence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteOccurrence( - 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.deleteOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteOccurrence with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.DeleteOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.DeleteOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteOccurrence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteOccurrence(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteOccurrence with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.DeleteOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.DeleteOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteOccurrence(request), expectedError); - }); - }); - - describe('createOccurrence', () => { - it('invokes createOccurrence without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.CreateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.CreateOccurrenceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Occurrence() - ); - client.innerApiCalls.createOccurrence = stubSimpleCall(expectedResponse); - const [response] = await client.createOccurrence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createOccurrence without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.CreateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.CreateOccurrenceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Occurrence() - ); - client.innerApiCalls.createOccurrence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createOccurrence( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.IOccurrence|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createOccurrence with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.CreateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.CreateOccurrenceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createOccurrence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createOccurrence(request), expectedError); - const actualRequest = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createOccurrence with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.CreateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.CreateOccurrenceRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createOccurrence(request), expectedError); - }); - }); - - describe('batchCreateOccurrences', () => { - it('invokes batchCreateOccurrences without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.BatchCreateOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateOccurrencesResponse() - ); - client.innerApiCalls.batchCreateOccurrences = stubSimpleCall(expectedResponse); - const [response] = await client.batchCreateOccurrences(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateOccurrences without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.BatchCreateOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateOccurrencesResponse() - ); - client.innerApiCalls.batchCreateOccurrences = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchCreateOccurrences( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.IBatchCreateOccurrencesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateOccurrences with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.BatchCreateOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateOccurrences = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchCreateOccurrences(request), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateOccurrences with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.BatchCreateOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchCreateOccurrences(request), expectedError); - }); - }); - - describe('updateOccurrence', () => { - it('invokes updateOccurrence without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.UpdateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.UpdateOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Occurrence() - ); - client.innerApiCalls.updateOccurrence = stubSimpleCall(expectedResponse); - const [response] = await client.updateOccurrence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOccurrence without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.UpdateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.UpdateOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Occurrence() - ); - client.innerApiCalls.updateOccurrence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateOccurrence( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.IOccurrence|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOccurrence with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.UpdateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.UpdateOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateOccurrence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateOccurrence(request), expectedError); - const actualRequest = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOccurrence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOccurrence with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.UpdateOccurrenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.UpdateOccurrenceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateOccurrence(request), expectedError); - }); - }); - - describe('getOccurrenceNote', () => { - it('invokes getOccurrenceNote without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetOccurrenceNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Note() - ); - client.innerApiCalls.getOccurrenceNote = stubSimpleCall(expectedResponse); - const [response] = await client.getOccurrenceNote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrenceNote without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetOccurrenceNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Note() - ); - client.innerApiCalls.getOccurrenceNote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOccurrenceNote( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.INote|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrenceNote with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetOccurrenceNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getOccurrenceNote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOccurrenceNote(request), expectedError); - const actualRequest = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOccurrenceNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOccurrenceNote with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetOccurrenceNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetOccurrenceNoteRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOccurrenceNote(request), expectedError); - }); - }); - - describe('getNote', () => { - it('invokes getNote without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Note() - ); - client.innerApiCalls.getNote = stubSimpleCall(expectedResponse); - const [response] = await client.getNote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNote without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Note() - ); - client.innerApiCalls.getNote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNote( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.INote|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNote with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNote(request), expectedError); - const actualRequest = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNote with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetNoteRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNote(request), expectedError); - }); - }); - - describe('deleteNote', () => { - it('invokes deleteNote without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.DeleteNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.DeleteNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNote = stubSimpleCall(expectedResponse); - const [response] = await client.deleteNote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNote without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.DeleteNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.DeleteNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNote( - 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.deleteNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNote with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.DeleteNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.DeleteNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteNote(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNote with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.DeleteNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.DeleteNoteRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteNote(request), expectedError); - }); - }); - - describe('createNote', () => { - it('invokes createNote without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.CreateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.CreateNoteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Note() - ); - client.innerApiCalls.createNote = stubSimpleCall(expectedResponse); - const [response] = await client.createNote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNote without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.CreateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.CreateNoteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Note() - ); - client.innerApiCalls.createNote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNote( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.INote|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNote with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.CreateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.CreateNoteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createNote(request), expectedError); - const actualRequest = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNote with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.CreateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.CreateNoteRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createNote(request), expectedError); - }); - }); - - describe('batchCreateNotes', () => { - it('invokes batchCreateNotes without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.BatchCreateNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateNotesResponse() - ); - client.innerApiCalls.batchCreateNotes = stubSimpleCall(expectedResponse); - const [response] = await client.batchCreateNotes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateNotes without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.BatchCreateNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateNotesResponse() - ); - client.innerApiCalls.batchCreateNotes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchCreateNotes( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.IBatchCreateNotesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateNotes with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.BatchCreateNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateNotes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchCreateNotes(request), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateNotes with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.BatchCreateNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.BatchCreateNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchCreateNotes(request), expectedError); - }); - }); - - describe('updateNote', () => { - it('invokes updateNote without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.UpdateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.UpdateNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Note() - ); - client.innerApiCalls.updateNote = stubSimpleCall(expectedResponse); - const [response] = await client.updateNote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNote without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.UpdateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.UpdateNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.Note() - ); - client.innerApiCalls.updateNote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNote( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.INote|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNote with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.UpdateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.UpdateNoteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateNote(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNote with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.UpdateNoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.UpdateNoteRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateNote(request), expectedError); - }); - }); - - describe('getVulnerabilityOccurrencesSummary', () => { - it('invokes getVulnerabilityOccurrencesSummary without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.VulnerabilityOccurrencesSummary() - ); - client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCall(expectedResponse); - const [response] = await client.getVulnerabilityOccurrencesSummary(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVulnerabilityOccurrencesSummary without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.grafeas.v1beta1.VulnerabilityOccurrencesSummary() - ); - client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getVulnerabilityOccurrencesSummary( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.IVulnerabilityOccurrencesSummary|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVulnerabilityOccurrencesSummary with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVulnerabilityOccurrencesSummary(request), expectedError); - const actualRequest = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVulnerabilityOccurrencesSummary with closed client', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.GetVulnerabilityOccurrencesSummaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getVulnerabilityOccurrencesSummary(request), expectedError); - }); - }); - - describe('listOccurrences', () => { - it('invokes listOccurrences without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - ]; - client.innerApiCalls.listOccurrences = stubSimpleCall(expectedResponse); - const [response] = await client.listOccurrences(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOccurrences without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - ]; - client.innerApiCalls.listOccurrences = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listOccurrences( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.IOccurrence[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOccurrences with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listOccurrences = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listOccurrences(request), expectedError); - const actualRequest = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listOccurrencesStream without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - ]; - client.descriptors.page.listOccurrences.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listOccurrencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1beta1.Occurrence[] = []; - stream.on('data', (response: protos.grafeas.v1beta1.Occurrence) => { - 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.listOccurrences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listOccurrences, request)); - assert( - (client.descriptors.page.listOccurrences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listOccurrencesStream with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listOccurrences.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listOccurrencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1beta1.Occurrence[] = []; - stream.on('data', (response: protos.grafeas.v1beta1.Occurrence) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listOccurrences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listOccurrences, request)); - assert( - (client.descriptors.page.listOccurrences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listOccurrences without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - ]; - client.descriptors.page.listOccurrences.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.grafeas.v1beta1.IOccurrence[] = []; - const iterable = client.listOccurrencesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listOccurrences with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListOccurrencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listOccurrences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listOccurrencesAsync(request); - await assert.rejects(async () => { - const responses: protos.grafeas.v1beta1.IOccurrence[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listOccurrences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listNotes', () => { - it('invokes listNotes without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - ]; - client.innerApiCalls.listNotes = stubSimpleCall(expectedResponse); - const [response] = await client.listNotes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotes without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - ]; - client.innerApiCalls.listNotes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotes( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.INote[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotes with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotes(request), expectedError); - const actualRequest = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotesStream without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - ]; - client.descriptors.page.listNotes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1beta1.Note[] = []; - stream.on('data', (response: protos.grafeas.v1beta1.Note) => { - 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.listNotes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotes, request)); - assert( - (client.descriptors.page.listNotes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNotesStream with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1beta1.Note[] = []; - stream.on('data', (response: protos.grafeas.v1beta1.Note) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotes, request)); - assert( - (client.descriptors.page.listNotes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotes without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - generateSampleMessage(new protos.grafeas.v1beta1.Note()), - ]; - client.descriptors.page.listNotes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.grafeas.v1beta1.INote[] = []; - const iterable = client.listNotesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotes with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNotesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNotesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotesAsync(request); - await assert.rejects(async () => { - const responses: protos.grafeas.v1beta1.INote[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listNoteOccurrences', () => { - it('invokes listNoteOccurrences without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - ]; - client.innerApiCalls.listNoteOccurrences = stubSimpleCall(expectedResponse); - const [response] = await client.listNoteOccurrences(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNoteOccurrences without error using callback', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - ]; - client.innerApiCalls.listNoteOccurrences = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNoteOccurrences( - request, - (err?: Error|null, result?: protos.grafeas.v1beta1.IOccurrence[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNoteOccurrences with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNoteOccurrences = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNoteOccurrences(request), expectedError); - const actualRequest = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNoteOccurrences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNoteOccurrencesStream without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - ]; - client.descriptors.page.listNoteOccurrences.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNoteOccurrencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1beta1.Occurrence[] = []; - stream.on('data', (response: protos.grafeas.v1beta1.Occurrence) => { - 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.listNoteOccurrences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNoteOccurrences, request)); - assert( - (client.descriptors.page.listNoteOccurrences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNoteOccurrencesStream with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNoteOccurrences.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNoteOccurrencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.grafeas.v1beta1.Occurrence[] = []; - stream.on('data', (response: protos.grafeas.v1beta1.Occurrence) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNoteOccurrences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNoteOccurrences, request)); - assert( - (client.descriptors.page.listNoteOccurrences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNoteOccurrences without error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - generateSampleMessage(new protos.grafeas.v1beta1.Occurrence()), - ]; - client.descriptors.page.listNoteOccurrences.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.grafeas.v1beta1.IOccurrence[] = []; - const iterable = client.listNoteOccurrencesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNoteOccurrences with error', async () => { - const client = new grafeasv1beta1Module.v1beta1.GrafeasV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.grafeas.v1beta1.ListNoteOccurrencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.grafeas.v1beta1.ListNoteOccurrencesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNoteOccurrences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNoteOccurrencesAsync(request); - await assert.rejects(async () => { - const responses: protos.grafeas.v1beta1.IOccurrence[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNoteOccurrences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/owl-bot-staging/google-devtools-containeranalysis/v1beta1/tsconfig.json b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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-devtools-containeranalysis/v1beta1/webpack.config.js b/owl-bot-staging/google-devtools-containeranalysis/v1beta1/webpack.config.js deleted file mode 100644 index f9beacf3ce3..00000000000 --- a/owl-bot-staging/google-devtools-containeranalysis/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: 'containeranalysis', - filename: './containeranalysis.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-iam-credentials/v1/.eslintignore b/owl-bot-staging/google-iam-credentials/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-iam-credentials/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-iam-credentials/v1/.eslintrc.json b/owl-bot-staging/google-iam-credentials/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-iam-credentials/v1/.gitignore b/owl-bot-staging/google-iam-credentials/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-iam-credentials/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-iam-credentials/v1/.jsdoc.js b/owl-bot-staging/google-iam-credentials/v1/.jsdoc.js deleted file mode 100644 index 0c36c8c44aa..00000000000 --- a/owl-bot-staging/google-iam-credentials/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/iam-credentials', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-iam-credentials/v1/.mocharc.js b/owl-bot-staging/google-iam-credentials/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-iam-credentials/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-iam-credentials/v1/.prettierrc.js b/owl-bot-staging/google-iam-credentials/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-iam-credentials/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-iam-credentials/v1/README.md b/owl-bot-staging/google-iam-credentials/v1/README.md deleted file mode 100644 index da07c65a8b1..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Credentials: Nodejs Client diff --git a/owl-bot-staging/google-iam-credentials/v1/package.json b/owl-bot-staging/google-iam-credentials/v1/package.json deleted file mode 100644 index e77115cfa45..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/iam-credentials", - "version": "0.1.0", - "description": "Credentials client for Node.js", - "repository": "googleapis/nodejs-credentials", - "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 credentials", - "credentials", - "i a m credentials" - ], - "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-iam-credentials/v1/protos/google/iam/credentials/v1/common.proto b/owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/common.proto deleted file mode 100644 index 5f2d0fdc735..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/common.proto +++ /dev/null @@ -1,190 +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.iam.credentials.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Iam.Credentials.V1"; -option go_package = "cloud.google.com/go/iam/credentials/apiv1/credentialspb;credentialspb"; -option java_multiple_files = true; -option java_outer_classname = "IAMCredentialsCommonProto"; -option java_package = "com.google.cloud.iam.credentials.v1"; -option php_namespace = "Google\\Cloud\\Iam\\Credentials\\V1"; -option (google.api.resource_definition) = { - type: "iam.googleapis.com/ServiceAccount" - pattern: "projects/{project}/serviceAccounts/{service_account}" -}; - -message GenerateAccessTokenRequest { - // Required. The resource name of the service account for which the credentials - // are requested, in the following format: - // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - // character is required; replacing it with a project ID is invalid. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - } - ]; - - // The sequence of service accounts in a delegation chain. Each service - // account must be granted the `roles/iam.serviceAccountTokenCreator` role - // on its next service account in the chain. The last service account in the - // chain must be granted the `roles/iam.serviceAccountTokenCreator` role - // on the service account that is specified in the `name` field of the - // request. - // - // The delegates must have the following format: - // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - // character is required; replacing it with a project ID is invalid. - repeated string delegates = 2; - - // Required. Code to identify the scopes to be included in the OAuth 2.0 access token. - // See https://developers.google.com/identity/protocols/googlescopes for more - // information. - // At least one value required. - repeated string scope = 4 [(google.api.field_behavior) = REQUIRED]; - - // The desired lifetime duration of the access token in seconds. - // Must be set to a value less than or equal to 3600 (1 hour). If a value is - // not specified, the token's lifetime will be set to a default value of one - // hour. - google.protobuf.Duration lifetime = 7; -} - -message GenerateAccessTokenResponse { - // The OAuth 2.0 access token. - string access_token = 1; - - // Token expiration time. - // The expiration time is always set. - google.protobuf.Timestamp expire_time = 3; -} - -message SignBlobRequest { - // Required. The resource name of the service account for which the credentials - // are requested, in the following format: - // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - // character is required; replacing it with a project ID is invalid. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - } - ]; - - // The sequence of service accounts in a delegation chain. Each service - // account must be granted the `roles/iam.serviceAccountTokenCreator` role - // on its next service account in the chain. The last service account in the - // chain must be granted the `roles/iam.serviceAccountTokenCreator` role - // on the service account that is specified in the `name` field of the - // request. - // - // The delegates must have the following format: - // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - // character is required; replacing it with a project ID is invalid. - repeated string delegates = 3; - - // Required. The bytes to sign. - bytes payload = 5 [(google.api.field_behavior) = REQUIRED]; -} - -message SignBlobResponse { - // The ID of the key used to sign the blob. - string key_id = 1; - - // The signed blob. - bytes signed_blob = 4; -} - -message SignJwtRequest { - // Required. The resource name of the service account for which the credentials - // are requested, in the following format: - // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - // character is required; replacing it with a project ID is invalid. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - } - ]; - - // The sequence of service accounts in a delegation chain. Each service - // account must be granted the `roles/iam.serviceAccountTokenCreator` role - // on its next service account in the chain. The last service account in the - // chain must be granted the `roles/iam.serviceAccountTokenCreator` role - // on the service account that is specified in the `name` field of the - // request. - // - // The delegates must have the following format: - // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - // character is required; replacing it with a project ID is invalid. - repeated string delegates = 3; - - // Required. The JWT payload to sign: a JSON object that contains a JWT Claims Set. - string payload = 5 [(google.api.field_behavior) = REQUIRED]; -} - -message SignJwtResponse { - // The ID of the key used to sign the JWT. - string key_id = 1; - - // The signed JWT. - string signed_jwt = 2; -} - -message GenerateIdTokenRequest { - // Required. The resource name of the service account for which the credentials - // are requested, in the following format: - // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - // character is required; replacing it with a project ID is invalid. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - } - ]; - - // The sequence of service accounts in a delegation chain. Each service - // account must be granted the `roles/iam.serviceAccountTokenCreator` role - // on its next service account in the chain. The last service account in the - // chain must be granted the `roles/iam.serviceAccountTokenCreator` role - // on the service account that is specified in the `name` field of the - // request. - // - // The delegates must have the following format: - // `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - // character is required; replacing it with a project ID is invalid. - repeated string delegates = 2; - - // Required. The audience for the token, such as the API or account that this token - // grants access to. - string audience = 3 [(google.api.field_behavior) = REQUIRED]; - - // Include the service account email in the token. If set to `true`, the - // token will contain `email` and `email_verified` claims. - bool include_email = 4; -} - -message GenerateIdTokenResponse { - // The OpenId Connect ID token. - string token = 1; -} diff --git a/owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/iamcredentials.proto b/owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/iamcredentials.proto deleted file mode 100644 index 4bbd1a16f6c..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/protos/google/iam/credentials/v1/iamcredentials.proto +++ /dev/null @@ -1,79 +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.iam.credentials.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/iam/credentials/v1/common.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Iam.Credentials.V1"; -option go_package = "cloud.google.com/go/iam/credentials/apiv1/credentialspb;credentialspb"; -option java_multiple_files = true; -option java_outer_classname = "IAMCredentialsProto"; -option java_package = "com.google.cloud.iam.credentials.v1"; -option php_namespace = "Google\\Cloud\\Iam\\Credentials\\V1"; - -// A service account is a special type of Google account that belongs to your -// application or a virtual machine (VM), instead of to an individual end user. -// Your application assumes the identity of the service account to call Google -// APIs, so that the users aren't directly involved. -// -// Service account credentials are used to temporarily assume the identity -// of the service account. Supported credential types include OAuth 2.0 access -// tokens, OpenID Connect ID tokens, self-signed JSON Web Tokens (JWTs), and -// more. -service IAMCredentials { - option (google.api.default_host) = "iamcredentials.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Generates an OAuth 2.0 access token for a service account. - rpc GenerateAccessToken(GenerateAccessTokenRequest) returns (GenerateAccessTokenResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/serviceAccounts/*}:generateAccessToken" - body: "*" - }; - option (google.api.method_signature) = "name,delegates,scope,lifetime"; - } - - // Generates an OpenID Connect ID token for a service account. - rpc GenerateIdToken(GenerateIdTokenRequest) returns (GenerateIdTokenResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/serviceAccounts/*}:generateIdToken" - body: "*" - }; - option (google.api.method_signature) = "name,delegates,audience,include_email"; - } - - // Signs a blob using a service account's system-managed private key. - rpc SignBlob(SignBlobRequest) returns (SignBlobResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/serviceAccounts/*}:signBlob" - body: "*" - }; - option (google.api.method_signature) = "name,delegates,payload"; - } - - // Signs a JWT using a service account's system-managed private key. - rpc SignJwt(SignJwtRequest) returns (SignJwtResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/serviceAccounts/*}:signJwt" - body: "*" - }; - option (google.api.method_signature) = "name,delegates,payload"; - } -} diff --git a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_access_token.js b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_access_token.js deleted file mode 100644 index bebdd288dc9..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_access_token.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(name, scope) { - // [START iamcredentials_v1_generated_IAMCredentials_GenerateAccessToken_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 service account for which the credentials - * are requested, in the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - */ - // const name = 'abc123' - /** - * The sequence of service accounts in a delegation chain. Each service - * account must be granted the `roles/iam.serviceAccountTokenCreator` role - * on its next service account in the chain. The last service account in the - * chain must be granted the `roles/iam.serviceAccountTokenCreator` role - * on the service account that is specified in the `name` field of the - * request. - * The delegates must have the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - */ - // const delegates = ['abc','def'] - /** - * Required. Code to identify the scopes to be included in the OAuth 2.0 access token. - * See https://developers.google.com/identity/protocols/googlescopes for more - * information. - * At least one value required. - */ - // const scope = ['abc','def'] - /** - * The desired lifetime duration of the access token in seconds. - * Must be set to a value less than or equal to 3600 (1 hour). If a value is - * not specified, the token's lifetime will be set to a default value of one - * hour. - */ - // const lifetime = {} - - // Imports the Credentials library - const {IAMCredentialsClient} = require('@google-cloud/iam-credentials').v1; - - // Instantiates a client - const credentialsClient = new IAMCredentialsClient(); - - async function callGenerateAccessToken() { - // Construct request - const request = { - name, - scope, - }; - - // Run request - const response = await credentialsClient.generateAccessToken(request); - console.log(response); - } - - callGenerateAccessToken(); - // [END iamcredentials_v1_generated_IAMCredentials_GenerateAccessToken_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_id_token.js b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_id_token.js deleted file mode 100644 index 10f504b98d7..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.generate_id_token.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, audience) { - // [START iamcredentials_v1_generated_IAMCredentials_GenerateIdToken_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 service account for which the credentials - * are requested, in the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - */ - // const name = 'abc123' - /** - * The sequence of service accounts in a delegation chain. Each service - * account must be granted the `roles/iam.serviceAccountTokenCreator` role - * on its next service account in the chain. The last service account in the - * chain must be granted the `roles/iam.serviceAccountTokenCreator` role - * on the service account that is specified in the `name` field of the - * request. - * The delegates must have the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - */ - // const delegates = ['abc','def'] - /** - * Required. The audience for the token, such as the API or account that this token - * grants access to. - */ - // const audience = 'abc123' - /** - * Include the service account email in the token. If set to `true`, the - * token will contain `email` and `email_verified` claims. - */ - // const includeEmail = true - - // Imports the Credentials library - const {IAMCredentialsClient} = require('@google-cloud/iam-credentials').v1; - - // Instantiates a client - const credentialsClient = new IAMCredentialsClient(); - - async function callGenerateIdToken() { - // Construct request - const request = { - name, - audience, - }; - - // Run request - const response = await credentialsClient.generateIdToken(request); - console.log(response); - } - - callGenerateIdToken(); - // [END iamcredentials_v1_generated_IAMCredentials_GenerateIdToken_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_blob.js b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_blob.js deleted file mode 100644 index 47f010b247d..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_blob.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(name, payload) { - // [START iamcredentials_v1_generated_IAMCredentials_SignBlob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 service account for which the credentials - * are requested, in the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - */ - // const name = 'abc123' - /** - * The sequence of service accounts in a delegation chain. Each service - * account must be granted the `roles/iam.serviceAccountTokenCreator` role - * on its next service account in the chain. The last service account in the - * chain must be granted the `roles/iam.serviceAccountTokenCreator` role - * on the service account that is specified in the `name` field of the - * request. - * The delegates must have the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - */ - // const delegates = ['abc','def'] - /** - * Required. The bytes to sign. - */ - // const payload = Buffer.from('string') - - // Imports the Credentials library - const {IAMCredentialsClient} = require('@google-cloud/iam-credentials').v1; - - // Instantiates a client - const credentialsClient = new IAMCredentialsClient(); - - async function callSignBlob() { - // Construct request - const request = { - name, - payload, - }; - - // Run request - const response = await credentialsClient.signBlob(request); - console.log(response); - } - - callSignBlob(); - // [END iamcredentials_v1_generated_IAMCredentials_SignBlob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_jwt.js b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_jwt.js deleted file mode 100644 index 3f0726fff1e..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/i_a_m_credentials.sign_jwt.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(name, payload) { - // [START iamcredentials_v1_generated_IAMCredentials_SignJwt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 service account for which the credentials - * are requested, in the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - */ - // const name = 'abc123' - /** - * The sequence of service accounts in a delegation chain. Each service - * account must be granted the `roles/iam.serviceAccountTokenCreator` role - * on its next service account in the chain. The last service account in the - * chain must be granted the `roles/iam.serviceAccountTokenCreator` role - * on the service account that is specified in the `name` field of the - * request. - * The delegates must have the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - */ - // const delegates = ['abc','def'] - /** - * Required. The JWT payload to sign: a JSON object that contains a JWT Claims Set. - */ - // const payload = 'abc123' - - // Imports the Credentials library - const {IAMCredentialsClient} = require('@google-cloud/iam-credentials').v1; - - // Instantiates a client - const credentialsClient = new IAMCredentialsClient(); - - async function callSignJwt() { - // Construct request - const request = { - name, - payload, - }; - - // Run request - const response = await credentialsClient.signJwt(request); - console.log(response); - } - - callSignJwt(); - // [END iamcredentials_v1_generated_IAMCredentials_SignJwt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/snippet_metadata_google.iam.credentials.v1.json b/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/snippet_metadata_google.iam.credentials.v1.json deleted file mode 100644 index 3810f790eb6..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/samples/generated/v1/snippet_metadata_google.iam.credentials.v1.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-credentials", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.iam.credentials.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "iamcredentials_v1_generated_IAMCredentials_GenerateAccessToken_async", - "title": "IAMCredentials generateAccessToken Sample", - "origin": "API_DEFINITION", - "description": " Generates an OAuth 2.0 access token for a service account.", - "canonical": true, - "file": "i_a_m_credentials.generate_access_token.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateAccessToken", - "fullName": "google.iam.credentials.v1.IAMCredentials.GenerateAccessToken", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "delegates", - "type": "TYPE_STRING[]" - }, - { - "name": "scope", - "type": "TYPE_STRING[]" - }, - { - "name": "lifetime", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.iam.credentials.v1.GenerateAccessTokenResponse", - "client": { - "shortName": "IAMCredentialsClient", - "fullName": "google.iam.credentials.v1.IAMCredentialsClient" - }, - "method": { - "shortName": "GenerateAccessToken", - "fullName": "google.iam.credentials.v1.IAMCredentials.GenerateAccessToken", - "service": { - "shortName": "IAMCredentials", - "fullName": "google.iam.credentials.v1.IAMCredentials" - } - } - } - }, - { - "regionTag": "iamcredentials_v1_generated_IAMCredentials_GenerateIdToken_async", - "title": "IAMCredentials generateIdToken Sample", - "origin": "API_DEFINITION", - "description": " Generates an OpenID Connect ID token for a service account.", - "canonical": true, - "file": "i_a_m_credentials.generate_id_token.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateIdToken", - "fullName": "google.iam.credentials.v1.IAMCredentials.GenerateIdToken", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "delegates", - "type": "TYPE_STRING[]" - }, - { - "name": "audience", - "type": "TYPE_STRING" - }, - { - "name": "include_email", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.iam.credentials.v1.GenerateIdTokenResponse", - "client": { - "shortName": "IAMCredentialsClient", - "fullName": "google.iam.credentials.v1.IAMCredentialsClient" - }, - "method": { - "shortName": "GenerateIdToken", - "fullName": "google.iam.credentials.v1.IAMCredentials.GenerateIdToken", - "service": { - "shortName": "IAMCredentials", - "fullName": "google.iam.credentials.v1.IAMCredentials" - } - } - } - }, - { - "regionTag": "iamcredentials_v1_generated_IAMCredentials_SignBlob_async", - "title": "IAMCredentials signBlob Sample", - "origin": "API_DEFINITION", - "description": " Signs a blob using a service account's system-managed private key.", - "canonical": true, - "file": "i_a_m_credentials.sign_blob.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SignBlob", - "fullName": "google.iam.credentials.v1.IAMCredentials.SignBlob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "delegates", - "type": "TYPE_STRING[]" - }, - { - "name": "payload", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.iam.credentials.v1.SignBlobResponse", - "client": { - "shortName": "IAMCredentialsClient", - "fullName": "google.iam.credentials.v1.IAMCredentialsClient" - }, - "method": { - "shortName": "SignBlob", - "fullName": "google.iam.credentials.v1.IAMCredentials.SignBlob", - "service": { - "shortName": "IAMCredentials", - "fullName": "google.iam.credentials.v1.IAMCredentials" - } - } - } - }, - { - "regionTag": "iamcredentials_v1_generated_IAMCredentials_SignJwt_async", - "title": "IAMCredentials signJwt Sample", - "origin": "API_DEFINITION", - "description": " Signs a JWT using a service account's system-managed private key.", - "canonical": true, - "file": "i_a_m_credentials.sign_jwt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SignJwt", - "fullName": "google.iam.credentials.v1.IAMCredentials.SignJwt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "delegates", - "type": "TYPE_STRING[]" - }, - { - "name": "payload", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.iam.credentials.v1.SignJwtResponse", - "client": { - "shortName": "IAMCredentialsClient", - "fullName": "google.iam.credentials.v1.IAMCredentialsClient" - }, - "method": { - "shortName": "SignJwt", - "fullName": "google.iam.credentials.v1.IAMCredentials.SignJwt", - "service": { - "shortName": "IAMCredentials", - "fullName": "google.iam.credentials.v1.IAMCredentials" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-iam-credentials/v1/src/index.ts b/owl-bot-staging/google-iam-credentials/v1/src/index.ts deleted file mode 100644 index f9b086d4911..00000000000 --- a/owl-bot-staging/google-iam-credentials/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 IAMCredentialsClient = v1.IAMCredentialsClient; -type IAMCredentialsClient = v1.IAMCredentialsClient; -export {v1, IAMCredentialsClient}; -export default {v1, IAMCredentialsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-iam-credentials/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-iam-credentials/v1/src/v1/gapic_metadata.json deleted file mode 100644 index a463d17b104..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.iam.credentials.v1", - "libraryPackage": "@google-cloud/iam-credentials", - "services": { - "IAMCredentials": { - "clients": { - "grpc": { - "libraryClient": "IAMCredentialsClient", - "rpcs": { - "GenerateAccessToken": { - "methods": [ - "generateAccessToken" - ] - }, - "GenerateIdToken": { - "methods": [ - "generateIdToken" - ] - }, - "SignBlob": { - "methods": [ - "signBlob" - ] - }, - "SignJwt": { - "methods": [ - "signJwt" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "IAMCredentialsClient", - "rpcs": { - "GenerateAccessToken": { - "methods": [ - "generateAccessToken" - ] - }, - "GenerateIdToken": { - "methods": [ - "generateIdToken" - ] - }, - "SignBlob": { - "methods": [ - "signBlob" - ] - }, - "SignJwt": { - "methods": [ - "signJwt" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client.ts b/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client.ts deleted file mode 100644 index 7e5f818ae4e..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client.ts +++ /dev/null @@ -1,670 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/i_a_m_credentials_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './i_a_m_credentials_client_config.json'; -const version = require('../../../package.json').version; - -/** - * A service account is a special type of Google account that belongs to your - * application or a virtual machine (VM), instead of to an individual end user. - * Your application assumes the identity of the service account to call Google - * APIs, so that the users aren't directly involved. - * - * Service account credentials are used to temporarily assume the identity - * of the service account. Supported credential types include OAuth 2.0 access - * tokens, OpenID Connect ID tokens, self-signed JSON Web Tokens (JWTs), and - * more. - * @class - * @memberof v1 - */ -export class IAMCredentialsClient { - 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}; - iAMCredentialsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of IAMCredentialsClient. - * - * @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 IAMCredentialsClient({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 IAMCredentialsClient; - 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.iam.credentials.v1.IAMCredentials', 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.iAMCredentialsStub) { - return this.iAMCredentialsStub; - } - - // Put together the "service stub" for - // google.iam.credentials.v1.IAMCredentials. - this.iAMCredentialsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.iam.credentials.v1.IAMCredentials') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.iam.credentials.v1.IAMCredentials, - 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 iAMCredentialsStubMethods = - ['generateAccessToken', 'generateIdToken', 'signBlob', 'signJwt']; - for (const methodName of iAMCredentialsStubMethods) { - const callPromise = this.iAMCredentialsStub.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.iAMCredentialsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'iamcredentials.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 'iamcredentials.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 -- - // ------------------- -/** - * Generates an OAuth 2.0 access token for a service account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the service account for which the credentials - * are requested, in the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - * @param {string[]} request.delegates - * The sequence of service accounts in a delegation chain. Each service - * account must be granted the `roles/iam.serviceAccountTokenCreator` role - * on its next service account in the chain. The last service account in the - * chain must be granted the `roles/iam.serviceAccountTokenCreator` role - * on the service account that is specified in the `name` field of the - * request. - * - * The delegates must have the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - * @param {string[]} request.scope - * Required. Code to identify the scopes to be included in the OAuth 2.0 access token. - * See https://developers.google.com/identity/protocols/googlescopes for more - * information. - * At least one value required. - * @param {google.protobuf.Duration} request.lifetime - * The desired lifetime duration of the access token in seconds. - * Must be set to a value less than or equal to 3600 (1 hour). If a value is - * not specified, the token's lifetime will be set to a default value of one - * hour. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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.credentials.v1.GenerateAccessTokenResponse|GenerateAccessTokenResponse}. - * Please see the {@link 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_a_m_credentials.generate_access_token.js - * region_tag:iamcredentials_v1_generated_IAMCredentials_GenerateAccessToken_async - */ - generateAccessToken( - request?: protos.google.iam.credentials.v1.IGenerateAccessTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, - protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|undefined, {}|undefined - ]>; - generateAccessToken( - request: protos.google.iam.credentials.v1.IGenerateAccessTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, - protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>): void; - generateAccessToken( - request: protos.google.iam.credentials.v1.IGenerateAccessTokenRequest, - callback: Callback< - protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, - protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>): void; - generateAccessToken( - request?: protos.google.iam.credentials.v1.IGenerateAccessTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, - protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, - protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, - protos.google.iam.credentials.v1.IGenerateAccessTokenRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.generateAccessToken(request, options, callback); - } -/** - * Generates an OpenID Connect ID token for a service account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the service account for which the credentials - * are requested, in the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - * @param {string[]} request.delegates - * The sequence of service accounts in a delegation chain. Each service - * account must be granted the `roles/iam.serviceAccountTokenCreator` role - * on its next service account in the chain. The last service account in the - * chain must be granted the `roles/iam.serviceAccountTokenCreator` role - * on the service account that is specified in the `name` field of the - * request. - * - * The delegates must have the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - * @param {string} request.audience - * Required. The audience for the token, such as the API or account that this token - * grants access to. - * @param {boolean} request.includeEmail - * Include the service account email in the token. If set to `true`, the - * token will contain `email` and `email_verified` claims. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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.credentials.v1.GenerateIdTokenResponse|GenerateIdTokenResponse}. - * Please see the {@link 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_a_m_credentials.generate_id_token.js - * region_tag:iamcredentials_v1_generated_IAMCredentials_GenerateIdToken_async - */ - generateIdToken( - request?: protos.google.iam.credentials.v1.IGenerateIdTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.credentials.v1.IGenerateIdTokenResponse, - protos.google.iam.credentials.v1.IGenerateIdTokenRequest|undefined, {}|undefined - ]>; - generateIdToken( - request: protos.google.iam.credentials.v1.IGenerateIdTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.credentials.v1.IGenerateIdTokenResponse, - protos.google.iam.credentials.v1.IGenerateIdTokenRequest|null|undefined, - {}|null|undefined>): void; - generateIdToken( - request: protos.google.iam.credentials.v1.IGenerateIdTokenRequest, - callback: Callback< - protos.google.iam.credentials.v1.IGenerateIdTokenResponse, - protos.google.iam.credentials.v1.IGenerateIdTokenRequest|null|undefined, - {}|null|undefined>): void; - generateIdToken( - request?: protos.google.iam.credentials.v1.IGenerateIdTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.credentials.v1.IGenerateIdTokenResponse, - protos.google.iam.credentials.v1.IGenerateIdTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.credentials.v1.IGenerateIdTokenResponse, - protos.google.iam.credentials.v1.IGenerateIdTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.credentials.v1.IGenerateIdTokenResponse, - protos.google.iam.credentials.v1.IGenerateIdTokenRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.generateIdToken(request, options, callback); - } -/** - * Signs a blob using a service account's system-managed private key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the service account for which the credentials - * are requested, in the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - * @param {string[]} request.delegates - * The sequence of service accounts in a delegation chain. Each service - * account must be granted the `roles/iam.serviceAccountTokenCreator` role - * on its next service account in the chain. The last service account in the - * chain must be granted the `roles/iam.serviceAccountTokenCreator` role - * on the service account that is specified in the `name` field of the - * request. - * - * The delegates must have the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - * @param {Buffer} request.payload - * Required. The bytes to sign. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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.credentials.v1.SignBlobResponse|SignBlobResponse}. - * Please see the {@link 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_a_m_credentials.sign_blob.js - * region_tag:iamcredentials_v1_generated_IAMCredentials_SignBlob_async - */ - signBlob( - request?: protos.google.iam.credentials.v1.ISignBlobRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.credentials.v1.ISignBlobResponse, - protos.google.iam.credentials.v1.ISignBlobRequest|undefined, {}|undefined - ]>; - signBlob( - request: protos.google.iam.credentials.v1.ISignBlobRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.credentials.v1.ISignBlobResponse, - protos.google.iam.credentials.v1.ISignBlobRequest|null|undefined, - {}|null|undefined>): void; - signBlob( - request: protos.google.iam.credentials.v1.ISignBlobRequest, - callback: Callback< - protos.google.iam.credentials.v1.ISignBlobResponse, - protos.google.iam.credentials.v1.ISignBlobRequest|null|undefined, - {}|null|undefined>): void; - signBlob( - request?: protos.google.iam.credentials.v1.ISignBlobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.credentials.v1.ISignBlobResponse, - protos.google.iam.credentials.v1.ISignBlobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.credentials.v1.ISignBlobResponse, - protos.google.iam.credentials.v1.ISignBlobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.credentials.v1.ISignBlobResponse, - protos.google.iam.credentials.v1.ISignBlobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.signBlob(request, options, callback); - } -/** - * Signs a JWT using a service account's system-managed private key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the service account for which the credentials - * are requested, in the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - * @param {string[]} request.delegates - * The sequence of service accounts in a delegation chain. Each service - * account must be granted the `roles/iam.serviceAccountTokenCreator` role - * on its next service account in the chain. The last service account in the - * chain must be granted the `roles/iam.serviceAccountTokenCreator` role - * on the service account that is specified in the `name` field of the - * request. - * - * The delegates must have the following format: - * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard - * character is required; replacing it with a project ID is invalid. - * @param {string} request.payload - * Required. The JWT payload to sign: a JSON object that contains a JWT Claims 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.iam.credentials.v1.SignJwtResponse|SignJwtResponse}. - * Please see the {@link 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_a_m_credentials.sign_jwt.js - * region_tag:iamcredentials_v1_generated_IAMCredentials_SignJwt_async - */ - signJwt( - request?: protos.google.iam.credentials.v1.ISignJwtRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.credentials.v1.ISignJwtResponse, - protos.google.iam.credentials.v1.ISignJwtRequest|undefined, {}|undefined - ]>; - signJwt( - request: protos.google.iam.credentials.v1.ISignJwtRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.credentials.v1.ISignJwtResponse, - protos.google.iam.credentials.v1.ISignJwtRequest|null|undefined, - {}|null|undefined>): void; - signJwt( - request: protos.google.iam.credentials.v1.ISignJwtRequest, - callback: Callback< - protos.google.iam.credentials.v1.ISignJwtResponse, - protos.google.iam.credentials.v1.ISignJwtRequest|null|undefined, - {}|null|undefined>): void; - signJwt( - request?: protos.google.iam.credentials.v1.ISignJwtRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.credentials.v1.ISignJwtResponse, - protos.google.iam.credentials.v1.ISignJwtRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.credentials.v1.ISignJwtResponse, - protos.google.iam.credentials.v1.ISignJwtRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.credentials.v1.ISignJwtResponse, - protos.google.iam.credentials.v1.ISignJwtRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.signJwt(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.iAMCredentialsStub && !this._terminated) { - return this.iAMCredentialsStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client_config.json b/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client_config.json deleted file mode 100644 index 8415ecc505a..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.iam.credentials.v1.IAMCredentials": { - "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": { - "GenerateAccessToken": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GenerateIdToken": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SignBlob": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SignJwt": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_proto_list.json b/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_proto_list.json deleted file mode 100644 index 8cc4ef0beee..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/src/v1/i_a_m_credentials_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/iam/credentials/v1/common.proto", - "../../protos/google/iam/credentials/v1/iamcredentials.proto" -] diff --git a/owl-bot-staging/google-iam-credentials/v1/src/v1/index.ts b/owl-bot-staging/google-iam-credentials/v1/src/v1/index.ts deleted file mode 100644 index 7a588581bf2..00000000000 --- a/owl-bot-staging/google-iam-credentials/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 {IAMCredentialsClient} from './i_a_m_credentials_client'; diff --git a/owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 62a9d42357d..00000000000 --- a/owl-bot-staging/google-iam-credentials/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 credentials = require('@google-cloud/iam-credentials'); - -function main() { - const iAMCredentialsClient = new credentials.IAMCredentialsClient(); -} - -main(); diff --git a/owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-iam-credentials/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index b74908e57a1..00000000000 --- a/owl-bot-staging/google-iam-credentials/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 {IAMCredentialsClient} from '@google-cloud/iam-credentials'; - -// check that the client class type name can be used -function doStuffWithIAMCredentialsClient(client: IAMCredentialsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const iAMCredentialsClient = new IAMCredentialsClient(); - doStuffWithIAMCredentialsClient(iAMCredentialsClient); -} - -main(); diff --git a/owl-bot-staging/google-iam-credentials/v1/system-test/install.ts b/owl-bot-staging/google-iam-credentials/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-iam-credentials/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-iam-credentials/v1/test/gapic_i_a_m_credentials_v1.ts b/owl-bot-staging/google-iam-credentials/v1/test/gapic_i_a_m_credentials_v1.ts deleted file mode 100644 index 3596307a297..00000000000 --- a/owl-bot-staging/google-iam-credentials/v1/test/gapic_i_a_m_credentials_v1.ts +++ /dev/null @@ -1,582 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 iamcredentialsModule 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.IAMCredentialsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = iamcredentialsModule.v1.IAMCredentialsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = iamcredentialsModule.v1.IAMCredentialsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = iamcredentialsModule.v1.IAMCredentialsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.iAMCredentialsStub, undefined); - await client.initialize(); - assert(client.iAMCredentialsStub); - }); - - it('has close method for the initialized client', done => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.iAMCredentialsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.iAMCredentialsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - 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 iamcredentialsModule.v1.IAMCredentialsClient({ - 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('generateAccessToken', () => { - it('invokes generateAccessToken without error', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.GenerateAccessTokenRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateAccessTokenResponse() - ); - client.innerApiCalls.generateAccessToken = stubSimpleCall(expectedResponse); - const [response] = await client.generateAccessToken(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAccessToken without error using callback', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.GenerateAccessTokenRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateAccessTokenResponse() - ); - client.innerApiCalls.generateAccessToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateAccessToken( - request, - (err?: Error|null, result?: protos.google.iam.credentials.v1.IGenerateAccessTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAccessToken with error', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.GenerateAccessTokenRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateAccessToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateAccessToken(request), expectedError); - const actualRequest = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateAccessToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateAccessToken with closed client', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateAccessTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.GenerateAccessTokenRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateAccessToken(request), expectedError); - }); - }); - - describe('generateIdToken', () => { - it('invokes generateIdToken without error', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateIdTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.GenerateIdTokenRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateIdTokenResponse() - ); - client.innerApiCalls.generateIdToken = stubSimpleCall(expectedResponse); - const [response] = await client.generateIdToken(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateIdToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateIdToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateIdToken without error using callback', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateIdTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.GenerateIdTokenRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateIdTokenResponse() - ); - client.innerApiCalls.generateIdToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateIdToken( - request, - (err?: Error|null, result?: protos.google.iam.credentials.v1.IGenerateIdTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateIdToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateIdToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateIdToken with error', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateIdTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.GenerateIdTokenRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateIdToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateIdToken(request), expectedError); - const actualRequest = (client.innerApiCalls.generateIdToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateIdToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateIdToken with closed client', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.GenerateIdTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.GenerateIdTokenRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateIdToken(request), expectedError); - }); - }); - - describe('signBlob', () => { - it('invokes signBlob without error', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.SignBlobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.SignBlobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.credentials.v1.SignBlobResponse() - ); - client.innerApiCalls.signBlob = stubSimpleCall(expectedResponse); - const [response] = await client.signBlob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.signBlob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.signBlob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes signBlob without error using callback', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.SignBlobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.SignBlobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.credentials.v1.SignBlobResponse() - ); - client.innerApiCalls.signBlob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.signBlob( - request, - (err?: Error|null, result?: protos.google.iam.credentials.v1.ISignBlobResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.signBlob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.signBlob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes signBlob with error', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.SignBlobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.SignBlobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.signBlob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.signBlob(request), expectedError); - const actualRequest = (client.innerApiCalls.signBlob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.signBlob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes signBlob with closed client', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.SignBlobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.SignBlobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.signBlob(request), expectedError); - }); - }); - - describe('signJwt', () => { - it('invokes signJwt without error', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.SignJwtRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.SignJwtRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.credentials.v1.SignJwtResponse() - ); - client.innerApiCalls.signJwt = stubSimpleCall(expectedResponse); - const [response] = await client.signJwt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.signJwt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.signJwt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes signJwt without error using callback', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.SignJwtRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.SignJwtRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.credentials.v1.SignJwtResponse() - ); - client.innerApiCalls.signJwt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.signJwt( - request, - (err?: Error|null, result?: protos.google.iam.credentials.v1.ISignJwtResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.signJwt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.signJwt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes signJwt with error', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.SignJwtRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.SignJwtRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.signJwt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.signJwt(request), expectedError); - const actualRequest = (client.innerApiCalls.signJwt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.signJwt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes signJwt with closed client', async () => { - const client = new iamcredentialsModule.v1.IAMCredentialsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.credentials.v1.SignJwtRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.credentials.v1.SignJwtRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.signJwt(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-iam-credentials/v1/tsconfig.json b/owl-bot-staging/google-iam-credentials/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-iam-credentials/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-iam-credentials/v1/webpack.config.js b/owl-bot-staging/google-iam-credentials/v1/webpack.config.js deleted file mode 100644 index 2bd0f07dfee..00000000000 --- a/owl-bot-staging/google-iam-credentials/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: 'IAMCredentials', - filename: './i-a-m-credentials.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-iam/v2/.eslintignore b/owl-bot-staging/google-iam/v2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-iam/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-iam/v2/.eslintrc.json b/owl-bot-staging/google-iam/v2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-iam/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-iam/v2/.gitignore b/owl-bot-staging/google-iam/v2/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-iam/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-iam/v2/.jsdoc.js b/owl-bot-staging/google-iam/v2/.jsdoc.js deleted file mode 100644 index cdc66248f75..00000000000 --- a/owl-bot-staging/google-iam/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/iam', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-iam/v2/.mocharc.js b/owl-bot-staging/google-iam/v2/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-iam/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-iam/v2/.prettierrc.js b/owl-bot-staging/google-iam/v2/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-iam/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-iam/v2/README.md b/owl-bot-staging/google-iam/v2/README.md deleted file mode 100644 index 905fae6bcad..00000000000 --- a/owl-bot-staging/google-iam/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Iam: Nodejs Client diff --git a/owl-bot-staging/google-iam/v2/package.json b/owl-bot-staging/google-iam/v2/package.json deleted file mode 100644 index 46b77b4750e..00000000000 --- a/owl-bot-staging/google-iam/v2/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/iam", - "version": "0.1.0", - "description": "Iam client for Node.js", - "repository": "googleapis/nodejs-iam", - "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 iam", - "iam", - "policies" - ], - "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-iam/v2/protos/google/iam/v2/deny.proto b/owl-bot-staging/google-iam/v2/protos/google/iam/v2/deny.proto deleted file mode 100644 index a3c8ff14e9a..00000000000 --- a/owl-bot-staging/google-iam/v2/protos/google/iam/v2/deny.proto +++ /dev/null @@ -1,109 +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.iam.v2; - -import "google/type/expr.proto"; - -option csharp_namespace = "Google.Cloud.Iam.V2"; -option go_package = "cloud.google.com/go/iam/apiv2/iampb;iampb"; -option java_multiple_files = true; -option java_outer_classname = "DenyRuleProto"; -option java_package = "com.google.iam.v2"; -option php_namespace = "Google\\Cloud\\Iam\\V2"; - -// A deny rule in an IAM deny policy. -message DenyRule { - // The identities that are prevented from using one or more permissions on - // Google Cloud resources. This field can contain the following values: - // - // * `principalSet://goog/public:all`: A special identifier that represents - // any principal that is on the internet, even if they do not have a Google - // Account or are not logged in. - // - // * `principal://goog/subject/{email_id}`: A specific Google Account. - // Includes Gmail, Cloud Identity, and Google Workspace user accounts. For - // example, `principal://goog/subject/alice@example.com`. - // - // * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific - // Google Account that was deleted recently. For example, - // `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If - // the Google Account is recovered, this identifier reverts to the standard - // identifier for a Google Account. - // - // * `principalSet://goog/group/{group_id}`: A Google group. For example, - // `principalSet://goog/group/admins@example.com`. - // - // * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group - // that was deleted recently. For example, - // `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If - // the Google group is restored, this identifier reverts to the standard - // identifier for a Google group. - // - // * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`: - // A Google Cloud service account. For example, - // `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`. - // - // * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`: - // A Google Cloud service account that was deleted recently. For example, - // `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`. - // If the service account is undeleted, this identifier reverts to the - // standard identifier for a service account. - // - // * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the - // principals associated with the specified Google Workspace or Cloud - // Identity customer ID. For example, - // `principalSet://goog/cloudIdentityCustomerId/C01Abc35`. - repeated string denied_principals = 1; - - // The identities that are excluded from the deny rule, even if they are - // listed in the `denied_principals`. For example, you could add a Google - // group to the `denied_principals`, then exclude specific users who belong to - // that group. - // - // This field can contain the same values as the `denied_principals` field, - // excluding `principalSet://goog/public:all`, which represents all users on - // the internet. - repeated string exception_principals = 2; - - // The permissions that are explicitly denied by this rule. Each permission - // uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}` - // is the fully qualified domain name for the service. For example, - // `iam.googleapis.com/roles.list`. - repeated string denied_permissions = 3; - - // Specifies the permissions that this rule excludes from the set of denied - // permissions given by `denied_permissions`. If a permission appears in - // `denied_permissions` _and_ in `exception_permissions` then it will _not_ be - // denied. - // - // The excluded permissions can be specified using the same syntax as - // `denied_permissions`. - repeated string exception_permissions = 4; - - // The condition that determines whether this deny rule applies to a request. - // If the condition expression evaluates to `true`, then the deny rule is - // applied; otherwise, the deny rule is not applied. - // - // Each deny rule is evaluated independently. If this deny rule does not apply - // to a request, other deny rules might still apply. - // - // The condition can use CEL functions that evaluate - // [resource - // tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other - // functions and operators are not supported. - google.type.Expr denial_condition = 5; -} diff --git a/owl-bot-staging/google-iam/v2/protos/google/iam/v2/policy.proto b/owl-bot-staging/google-iam/v2/protos/google/iam/v2/policy.proto deleted file mode 100644 index 56f73da089b..00000000000 --- a/owl-bot-staging/google-iam/v2/protos/google/iam/v2/policy.proto +++ /dev/null @@ -1,287 +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.iam.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/iam/v2/deny.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Iam.V2"; -option go_package = "cloud.google.com/go/iam/apiv2/iampb;iampb"; -option java_multiple_files = true; -option java_outer_classname = "PolicyProto"; -option java_package = "com.google.iam.v2"; -option php_namespace = "Google\\Cloud\\Iam\\V2"; - -// An interface for managing Identity and Access Management (IAM) policies. -service Policies { - option (google.api.default_host) = "iam.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Retrieves the policies of the specified kind that are attached to a - // resource. - // - // The response lists only policy metadata. In particular, policy rules are - // omitted. - rpc ListPolicies(ListPoliciesRequest) returns (ListPoliciesResponse) { - option (google.api.http) = { - get: "/v2/{parent=policies/*/*}" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a policy. - rpc GetPolicy(GetPolicyRequest) returns (Policy) { - option (google.api.http) = { - get: "/v2/{name=policies/*/*/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a policy. - rpc CreatePolicy(CreatePolicyRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=policies/*/*}" - body: "policy" - }; - option (google.api.method_signature) = "parent,policy,policy_id"; - option (google.longrunning.operation_info) = { - response_type: "Policy" - metadata_type: "PolicyOperationMetadata" - }; - } - - // Updates the specified policy. - // - // You can update only the rules and the display name for the policy. - // - // To update a policy, you should use a read-modify-write loop: - // - // 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the policy. - // 2. Modify the policy as needed. - // 3. Use `UpdatePolicy` to write the updated policy. - // - // This pattern helps prevent conflicts between concurrent updates. - rpc UpdatePolicy(UpdatePolicyRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - put: "/v2/{policy.name=policies/*/*/*}" - body: "policy" - }; - option (google.longrunning.operation_info) = { - response_type: "Policy" - metadata_type: "PolicyOperationMetadata" - }; - } - - // Deletes a policy. This action is permanent. - rpc DeletePolicy(DeletePolicyRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2/{name=policies/*/*/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "Policy" - metadata_type: "PolicyOperationMetadata" - }; - } -} - -// Data for an IAM policy. -message Policy { - // Immutable. The resource name of the `Policy`, which must be unique. Format: - // `policies/{attachment_point}/denypolicies/{policy_id}` - // - // - // The attachment point is identified by its URL-encoded full resource name, - // which means that the forward-slash character, `/`, must be written as - // `%2F`. For example, - // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`. - // - // For organizations and folders, use the numeric ID in the full resource - // name. For projects, requests can use the alphanumeric or the numeric ID. - // Responses always contain the numeric ID. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. The globally unique ID of the `Policy`. Assigned automatically when the - // `Policy` is created. - string uid = 2 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The kind of the `Policy`. Always contains the value `DenyPolicy`. - string kind = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A user-specified description of the `Policy`. This value can be up to 63 - // characters. - string display_name = 4; - - // A key-value map to store arbitrary metadata for the `Policy`. Keys - // can be up to 63 characters. Values can be up to 255 characters. - map annotations = 5; - - // An opaque tag that identifies the current version of the `Policy`. IAM uses - // this value to help manage concurrent updates, so they do not cause one - // update to be overwritten by another. - // - // If this field is present in a [CreatePolicy][] request, the value is - // ignored. - string etag = 6; - - // Output only. The time when the `Policy` was created. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the `Policy` was last updated. - google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the `Policy` was deleted. Empty if the policy is not deleted. - google.protobuf.Timestamp delete_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A list of rules that specify the behavior of the `Policy`. All of the rules - // should be of the `kind` specified in the `Policy`. - repeated PolicyRule rules = 10; - - // Immutable. Specifies that this policy is managed by an authority and can only be - // modified by that authority. Usage is restricted. - string managing_authority = 11 [(google.api.field_behavior) = IMMUTABLE]; -} - -// A single rule in a `Policy`. -message PolicyRule { - oneof kind { - // A rule for a deny policy. - DenyRule deny_rule = 2; - } - - // A user-specified description of the rule. This value can be up to 256 - // characters. - string description = 1; -} - -// Request message for `ListPolicies`. -message ListPoliciesRequest { - // Required. The resource that the policy is attached to, along with the kind of policy - // to list. Format: - // `policies/{attachment_point}/denypolicies` - // - // - // The attachment point is identified by its URL-encoded full resource name, - // which means that the forward-slash character, `/`, must be written as - // `%2F`. For example, - // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. - // - // For organizations and folders, use the numeric ID in the full resource - // name. For projects, you can use the alphanumeric or the numeric ID. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of policies to return. IAM ignores this value and uses - // the value 1000. - int32 page_size = 2; - - // A page token received in a [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this token to - // retrieve the next page. - string page_token = 3; -} - -// Response message for `ListPolicies`. -message ListPoliciesResponse { - // Metadata for the policies that are attached to the resource. - repeated Policy policies = 1; - - // A page token that you can use in a [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the - // next page. If this field is omitted, there are no additional pages. - string next_page_token = 2; -} - -// Request message for `GetPolicy`. -message GetPolicyRequest { - // Required. The resource name of the policy to retrieve. Format: - // `policies/{attachment_point}/denypolicies/{policy_id}` - // - // - // Use the URL-encoded full resource name, which means that the forward-slash - // character, `/`, must be written as `%2F`. For example, - // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. - // - // For organizations and folders, use the numeric ID in the full resource - // name. For projects, you can use the alphanumeric or the numeric ID. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `CreatePolicy`. -message CreatePolicyRequest { - // Required. The resource that the policy is attached to, along with the kind of policy - // to create. Format: `policies/{attachment_point}/denypolicies` - // - // - // The attachment point is identified by its URL-encoded full resource name, - // which means that the forward-slash character, `/`, must be written as - // `%2F`. For example, - // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. - // - // For organizations and folders, use the numeric ID in the full resource - // name. For projects, you can use the alphanumeric or the numeric ID. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The policy to create. - Policy policy = 2 [(google.api.field_behavior) = REQUIRED]; - - // The ID to use for this policy, which will become the final component of - // the policy's resource name. The ID must contain 3 to 63 characters. It can - // contain lowercase letters and numbers, as well as dashes (`-`) and periods - // (`.`). The first character must be a lowercase letter. - string policy_id = 3; -} - -// Request message for `UpdatePolicy`. -message UpdatePolicyRequest { - // Required. The policy to update. - // - // To prevent conflicting updates, the `etag` value must match the value that - // is stored in IAM. If the `etag` values do not match, the request fails with - // a `409` error code and `ABORTED` status. - Policy policy = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `DeletePolicy`. -message DeletePolicyRequest { - // Required. The resource name of the policy to delete. Format: - // `policies/{attachment_point}/denypolicies/{policy_id}` - // - // - // Use the URL-encoded full resource name, which means that the forward-slash - // character, `/`, must be written as `%2F`. For example, - // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. - // - // For organizations and folders, use the numeric ID in the full resource - // name. For projects, you can use the alphanumeric or the numeric ID. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The expected `etag` of the policy to delete. If the value does not match - // the value that is stored in IAM, the request fails with a `409` error code - // and `ABORTED` status. - // - // If you omit this field, the policy is deleted regardless of its current - // `etag`. - string etag = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Metadata for long-running `Policy` operations. -message PolicyOperationMetadata { - // Timestamp when the `google.longrunning.Operation` was created. - google.protobuf.Timestamp create_time = 1; -} diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.create_policy.js b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.create_policy.js deleted file mode 100644 index f27ce1187aa..00000000000 --- a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.create_policy.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, policy) { - // [START iam_v2_generated_Policies_CreatePolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 that the policy is attached to, along with the kind of policy - * to create. Format: `policies/{attachment_point}/denypolicies` - * The attachment point is identified by its URL-encoded full resource name, - * which means that the forward-slash character, `/`, must be written as - * `%2F`. For example, - * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. - * For organizations and folders, use the numeric ID in the full resource - * name. For projects, you can use the alphanumeric or the numeric ID. - */ - // const parent = 'abc123' - /** - * Required. The policy to create. - */ - // const policy = {} - /** - * The ID to use for this policy, which will become the final component of - * the policy's resource name. The ID must contain 3 to 63 characters. It can - * contain lowercase letters and numbers, as well as dashes (`-`) and periods - * (`.`). The first character must be a lowercase letter. - */ - // const policyId = 'abc123' - - // Imports the Iam library - const {PoliciesClient} = require('@google-cloud/iam').v2; - - // Instantiates a client - const iamClient = new PoliciesClient(); - - async function callCreatePolicy() { - // Construct request - const request = { - parent, - policy, - }; - - // Run request - const [operation] = await iamClient.createPolicy(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreatePolicy(); - // [END iam_v2_generated_Policies_CreatePolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.delete_policy.js b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.delete_policy.js deleted file mode 100644 index 600b94734cd..00000000000 --- a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.delete_policy.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 iam_v2_generated_Policies_DeletePolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 policy to delete. Format: - * `policies/{attachment_point}/denypolicies/{policy_id}` - * Use the URL-encoded full resource name, which means that the forward-slash - * character, `/`, must be written as `%2F`. For example, - * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. - * For organizations and folders, use the numeric ID in the full resource - * name. For projects, you can use the alphanumeric or the numeric ID. - */ - // const name = 'abc123' - /** - * Optional. The expected `etag` of the policy to delete. If the value does not match - * the value that is stored in IAM, the request fails with a `409` error code - * and `ABORTED` status. - * If you omit this field, the policy is deleted regardless of its current - * `etag`. - */ - // const etag = 'abc123' - - // Imports the Iam library - const {PoliciesClient} = require('@google-cloud/iam').v2; - - // Instantiates a client - const iamClient = new PoliciesClient(); - - async function callDeletePolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await iamClient.deletePolicy(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeletePolicy(); - // [END iam_v2_generated_Policies_DeletePolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.get_policy.js b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.get_policy.js deleted file mode 100644 index 007c04a9db7..00000000000 --- a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.get_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(name) { - // [START iam_v2_generated_Policies_GetPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 policy to retrieve. Format: - * `policies/{attachment_point}/denypolicies/{policy_id}` - * Use the URL-encoded full resource name, which means that the forward-slash - * character, `/`, must be written as `%2F`. For example, - * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. - * For organizations and folders, use the numeric ID in the full resource - * name. For projects, you can use the alphanumeric or the numeric ID. - */ - // const name = 'abc123' - - // Imports the Iam library - const {PoliciesClient} = require('@google-cloud/iam').v2; - - // Instantiates a client - const iamClient = new PoliciesClient(); - - async function callGetPolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iamClient.getPolicy(request); - console.log(response); - } - - callGetPolicy(); - // [END iam_v2_generated_Policies_GetPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.list_policies.js b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.list_policies.js deleted file mode 100644 index 5ea4cc723d6..00000000000 --- a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.list_policies.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 iam_v2_generated_Policies_ListPolicies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 that the policy is attached to, along with the kind of policy - * to list. Format: - * `policies/{attachment_point}/denypolicies` - * The attachment point is identified by its URL-encoded full resource name, - * which means that the forward-slash character, `/`, must be written as - * `%2F`. For example, - * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. - * For organizations and folders, use the numeric ID in the full resource - * name. For projects, you can use the alphanumeric or the numeric ID. - */ - // const parent = 'abc123' - /** - * The maximum number of policies to return. IAM ignores this value and uses - * the value 1000. - */ - // const pageSize = 1234 - /** - * A page token received in a ListPoliciesResponse google.iam.v2.ListPoliciesResponse. Provide this token to - * retrieve the next page. - */ - // const pageToken = 'abc123' - - // Imports the Iam library - const {PoliciesClient} = require('@google-cloud/iam').v2; - - // Instantiates a client - const iamClient = new PoliciesClient(); - - async function callListPolicies() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await iamClient.listPoliciesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListPolicies(); - // [END iam_v2_generated_Policies_ListPolicies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.update_policy.js b/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.update_policy.js deleted file mode 100644 index eba19718d10..00000000000 --- a/owl-bot-staging/google-iam/v2/samples/generated/v2/policies.update_policy.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(policy) { - // [START iam_v2_generated_Policies_UpdatePolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The policy to update. - * To prevent conflicting updates, the `etag` value must match the value that - * is stored in IAM. If the `etag` values do not match, the request fails with - * a `409` error code and `ABORTED` status. - */ - // const policy = {} - - // Imports the Iam library - const {PoliciesClient} = require('@google-cloud/iam').v2; - - // Instantiates a client - const iamClient = new PoliciesClient(); - - async function callUpdatePolicy() { - // Construct request - const request = { - policy, - }; - - // Run request - const [operation] = await iamClient.updatePolicy(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdatePolicy(); - // [END iam_v2_generated_Policies_UpdatePolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-iam/v2/samples/generated/v2/snippet_metadata_google.iam.v2.json b/owl-bot-staging/google-iam/v2/samples/generated/v2/snippet_metadata_google.iam.v2.json deleted file mode 100644 index 7d4d77a9b85..00000000000 --- a/owl-bot-staging/google-iam/v2/samples/generated/v2/snippet_metadata_google.iam.v2.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-iam", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.iam.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "iam_v2_generated_Policies_ListPolicies_async", - "title": "Policies listPolicies Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the policies of the specified kind that are attached to a resource. The response lists only policy metadata. In particular, policy rules are omitted.", - "canonical": true, - "file": "policies.list_policies.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListPolicies", - "fullName": "google.iam.v2.Policies.ListPolicies", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.iam.v2.ListPoliciesResponse", - "client": { - "shortName": "PoliciesClient", - "fullName": "google.iam.v2.PoliciesClient" - }, - "method": { - "shortName": "ListPolicies", - "fullName": "google.iam.v2.Policies.ListPolicies", - "service": { - "shortName": "Policies", - "fullName": "google.iam.v2.Policies" - } - } - } - }, - { - "regionTag": "iam_v2_generated_Policies_GetPolicy_async", - "title": "Policies getPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets a policy.", - "canonical": true, - "file": "policies.get_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPolicy", - "fullName": "google.iam.v2.Policies.GetPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.iam.v2.Policy", - "client": { - "shortName": "PoliciesClient", - "fullName": "google.iam.v2.PoliciesClient" - }, - "method": { - "shortName": "GetPolicy", - "fullName": "google.iam.v2.Policies.GetPolicy", - "service": { - "shortName": "Policies", - "fullName": "google.iam.v2.Policies" - } - } - } - }, - { - "regionTag": "iam_v2_generated_Policies_CreatePolicy_async", - "title": "Policies createPolicy Sample", - "origin": "API_DEFINITION", - "description": " Creates a policy.", - "canonical": true, - "file": "policies.create_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreatePolicy", - "fullName": "google.iam.v2.Policies.CreatePolicy", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v2.Policy" - }, - { - "name": "policy_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "PoliciesClient", - "fullName": "google.iam.v2.PoliciesClient" - }, - "method": { - "shortName": "CreatePolicy", - "fullName": "google.iam.v2.Policies.CreatePolicy", - "service": { - "shortName": "Policies", - "fullName": "google.iam.v2.Policies" - } - } - } - }, - { - "regionTag": "iam_v2_generated_Policies_UpdatePolicy_async", - "title": "Policies updatePolicy Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified policy. You can update only the rules and the display name for the policy. To update a policy, you should use a read-modify-write loop: 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the policy. 2. Modify the policy as needed. 3. Use `UpdatePolicy` to write the updated policy. This pattern helps prevent conflicts between concurrent updates.", - "canonical": true, - "file": "policies.update_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdatePolicy", - "fullName": "google.iam.v2.Policies.UpdatePolicy", - "async": true, - "parameters": [ - { - "name": "policy", - "type": ".google.iam.v2.Policy" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "PoliciesClient", - "fullName": "google.iam.v2.PoliciesClient" - }, - "method": { - "shortName": "UpdatePolicy", - "fullName": "google.iam.v2.Policies.UpdatePolicy", - "service": { - "shortName": "Policies", - "fullName": "google.iam.v2.Policies" - } - } - } - }, - { - "regionTag": "iam_v2_generated_Policies_DeletePolicy_async", - "title": "Policies deletePolicy Sample", - "origin": "API_DEFINITION", - "description": " Deletes a policy. This action is permanent.", - "canonical": true, - "file": "policies.delete_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeletePolicy", - "fullName": "google.iam.v2.Policies.DeletePolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "PoliciesClient", - "fullName": "google.iam.v2.PoliciesClient" - }, - "method": { - "shortName": "DeletePolicy", - "fullName": "google.iam.v2.Policies.DeletePolicy", - "service": { - "shortName": "Policies", - "fullName": "google.iam.v2.Policies" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-iam/v2/src/index.ts b/owl-bot-staging/google-iam/v2/src/index.ts deleted file mode 100644 index 98cfa9dbaf1..00000000000 --- a/owl-bot-staging/google-iam/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 PoliciesClient = v2.PoliciesClient; -type PoliciesClient = v2.PoliciesClient; -export {v2, PoliciesClient}; -export default {v2, PoliciesClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-iam/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-iam/v2/src/v2/gapic_metadata.json deleted file mode 100644 index 5e81e797a26..00000000000 --- a/owl-bot-staging/google-iam/v2/src/v2/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.iam.v2", - "libraryPackage": "@google-cloud/iam", - "services": { - "Policies": { - "clients": { - "grpc": { - "libraryClient": "PoliciesClient", - "rpcs": { - "GetPolicy": { - "methods": [ - "getPolicy" - ] - }, - "CreatePolicy": { - "methods": [ - "createPolicy" - ] - }, - "UpdatePolicy": { - "methods": [ - "updatePolicy" - ] - }, - "DeletePolicy": { - "methods": [ - "deletePolicy" - ] - }, - "ListPolicies": { - "methods": [ - "listPolicies", - "listPoliciesStream", - "listPoliciesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "PoliciesClient", - "rpcs": { - "GetPolicy": { - "methods": [ - "getPolicy" - ] - }, - "CreatePolicy": { - "methods": [ - "createPolicy" - ] - }, - "UpdatePolicy": { - "methods": [ - "updatePolicy" - ] - }, - "DeletePolicy": { - "methods": [ - "deletePolicy" - ] - }, - "ListPolicies": { - "methods": [ - "listPolicies", - "listPoliciesStream", - "listPoliciesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-iam/v2/src/v2/index.ts b/owl-bot-staging/google-iam/v2/src/v2/index.ts deleted file mode 100644 index 3a7592244f8..00000000000 --- a/owl-bot-staging/google-iam/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 {PoliciesClient} from './policies_client'; diff --git a/owl-bot-staging/google-iam/v2/src/v2/policies_client.ts b/owl-bot-staging/google-iam/v2/src/v2/policies_client.ts deleted file mode 100644 index f023bad4a5c..00000000000 --- a/owl-bot-staging/google-iam/v2/src/v2/policies_client.ts +++ /dev/null @@ -1,1140 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v2/policies_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './policies_client_config.json'; -const version = require('../../../package.json').version; - -/** - * An interface for managing Identity and Access Management (IAM) policies. - * @class - * @memberof v2 - */ -export class PoliciesClient { - 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}; - operationsClient: gax.OperationsClient; - policiesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of PoliciesClient. - * - * @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 PoliciesClient({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 PoliciesClient; - 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 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 = { - listPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'policies') - }; - - 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.GetOperation',get: '/v2/{name=policies/*/*/*/operations/*}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createPolicyResponse = protoFilesRoot.lookup( - '.google.iam.v2.Policy') as gax.protobuf.Type; - const createPolicyMetadata = protoFilesRoot.lookup( - '.google.iam.v2.PolicyOperationMetadata') as gax.protobuf.Type; - const updatePolicyResponse = protoFilesRoot.lookup( - '.google.iam.v2.Policy') as gax.protobuf.Type; - const updatePolicyMetadata = protoFilesRoot.lookup( - '.google.iam.v2.PolicyOperationMetadata') as gax.protobuf.Type; - const deletePolicyResponse = protoFilesRoot.lookup( - '.google.iam.v2.Policy') as gax.protobuf.Type; - const deletePolicyMetadata = protoFilesRoot.lookup( - '.google.iam.v2.PolicyOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createPolicy: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createPolicyResponse.decode.bind(createPolicyResponse), - createPolicyMetadata.decode.bind(createPolicyMetadata)), - updatePolicy: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updatePolicyResponse.decode.bind(updatePolicyResponse), - updatePolicyMetadata.decode.bind(updatePolicyMetadata)), - deletePolicy: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deletePolicyResponse.decode.bind(deletePolicyResponse), - deletePolicyMetadata.decode.bind(deletePolicyMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.iam.v2.Policies', 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.policiesStub) { - return this.policiesStub; - } - - // Put together the "service stub" for - // google.iam.v2.Policies. - this.policiesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.iam.v2.Policies') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.iam.v2.Policies, - 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 policiesStubMethods = - ['listPolicies', 'getPolicy', 'createPolicy', 'updatePolicy', 'deletePolicy']; - for (const methodName of policiesStubMethods) { - const callPromise = this.policiesStub.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.policiesStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'iam.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 'iam.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 a policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the policy to retrieve. Format: - * `policies/{attachment_point}/denypolicies/{policy_id}` - * - * - * Use the URL-encoded full resource name, which means that the forward-slash - * character, `/`, must be written as `%2F`. For example, - * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. - * - * For organizations and folders, use the numeric ID in the full resource - * name. For projects, you can use the alphanumeric or the numeric 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.iam.v2.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/v2/policies.get_policy.js - * region_tag:iam_v2_generated_Policies_GetPolicy_async - */ - getPolicy( - request?: protos.google.iam.v2.IGetPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v2.IPolicy, - protos.google.iam.v2.IGetPolicyRequest|undefined, {}|undefined - ]>; - getPolicy( - request: protos.google.iam.v2.IGetPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v2.IPolicy, - protos.google.iam.v2.IGetPolicyRequest|null|undefined, - {}|null|undefined>): void; - getPolicy( - request: protos.google.iam.v2.IGetPolicyRequest, - callback: Callback< - protos.google.iam.v2.IPolicy, - protos.google.iam.v2.IGetPolicyRequest|null|undefined, - {}|null|undefined>): void; - getPolicy( - request?: protos.google.iam.v2.IGetPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v2.IPolicy, - protos.google.iam.v2.IGetPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v2.IPolicy, - protos.google.iam.v2.IGetPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v2.IPolicy, - protos.google.iam.v2.IGetPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getPolicy(request, options, callback); - } - -/** - * Creates a policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource that the policy is attached to, along with the kind of policy - * to create. Format: `policies/{attachment_point}/denypolicies` - * - * - * The attachment point is identified by its URL-encoded full resource name, - * which means that the forward-slash character, `/`, must be written as - * `%2F`. For example, - * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. - * - * For organizations and folders, use the numeric ID in the full resource - * name. For projects, you can use the alphanumeric or the numeric ID. - * @param {google.iam.v2.Policy} request.policy - * Required. The policy to create. - * @param {string} request.policyId - * The ID to use for this policy, which will become the final component of - * the policy's resource name. The ID must contain 3 to 63 characters. It can - * contain lowercase letters and numbers, as well as dashes (`-`) and periods - * (`.`). The first character must be a lowercase letter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/policies.create_policy.js - * region_tag:iam_v2_generated_Policies_CreatePolicy_async - */ - createPolicy( - request?: protos.google.iam.v2.ICreatePolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createPolicy( - request: protos.google.iam.v2.ICreatePolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPolicy( - request: protos.google.iam.v2.ICreatePolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPolicy( - request?: protos.google.iam.v2.ICreatePolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createPolicy(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createPolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/policies.create_policy.js - * region_tag:iam_v2_generated_Policies_CreatePolicy_async - */ - async checkCreatePolicyProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the specified policy. - * - * You can update only the rules and the display name for the policy. - * - * To update a policy, you should use a read-modify-write loop: - * - * 1. Use {@link protos.google.iam.v2.Policies.GetPolicy|GetPolicy} to read the current version of the policy. - * 2. Modify the policy as needed. - * 3. Use `UpdatePolicy` to write the updated policy. - * - * This pattern helps prevent conflicts between concurrent updates. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.iam.v2.Policy} request.policy - * Required. The policy to update. - * - * To prevent conflicting updates, the `etag` value must match the value that - * is stored in IAM. If the `etag` values do not match, the request fails with - * a `409` error code and `ABORTED` status. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/policies.update_policy.js - * region_tag:iam_v2_generated_Policies_UpdatePolicy_async - */ - updatePolicy( - request?: protos.google.iam.v2.IUpdatePolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updatePolicy( - request: protos.google.iam.v2.IUpdatePolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updatePolicy( - request: protos.google.iam.v2.IUpdatePolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updatePolicy( - request?: protos.google.iam.v2.IUpdatePolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'policy.name': request.policy!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updatePolicy(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updatePolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/policies.update_policy.js - * region_tag:iam_v2_generated_Policies_UpdatePolicy_async - */ - async checkUpdatePolicyProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updatePolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a policy. This action is permanent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the policy to delete. Format: - * `policies/{attachment_point}/denypolicies/{policy_id}` - * - * - * Use the URL-encoded full resource name, which means that the forward-slash - * character, `/`, must be written as `%2F`. For example, - * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. - * - * For organizations and folders, use the numeric ID in the full resource - * name. For projects, you can use the alphanumeric or the numeric ID. - * @param {string} [request.etag] - * Optional. The expected `etag` of the policy to delete. If the value does not match - * the value that is stored in IAM, the request fails with a `409` error code - * and `ABORTED` status. - * - * If you omit this field, the policy is deleted regardless of its current - * `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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/policies.delete_policy.js - * region_tag:iam_v2_generated_Policies_DeletePolicy_async - */ - deletePolicy( - request?: protos.google.iam.v2.IDeletePolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deletePolicy( - request: protos.google.iam.v2.IDeletePolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePolicy( - request: protos.google.iam.v2.IDeletePolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePolicy( - request?: protos.google.iam.v2.IDeletePolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deletePolicy(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deletePolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/policies.delete_policy.js - * region_tag:iam_v2_generated_Policies_DeletePolicy_async - */ - async checkDeletePolicyProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Retrieves the policies of the specified kind that are attached to a - * resource. - * - * The response lists only policy metadata. In particular, policy rules are - * omitted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource that the policy is attached to, along with the kind of policy - * to list. Format: - * `policies/{attachment_point}/denypolicies` - * - * - * The attachment point is identified by its URL-encoded full resource name, - * which means that the forward-slash character, `/`, must be written as - * `%2F`. For example, - * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. - * - * For organizations and folders, use the numeric ID in the full resource - * name. For projects, you can use the alphanumeric or the numeric ID. - * @param {number} request.pageSize - * The maximum number of policies to return. IAM ignores this value and uses - * the value 1000. - * @param {string} request.pageToken - * A page token received in a {@link protos.google.iam.v2.ListPoliciesResponse|ListPoliciesResponse}. Provide this token to - * retrieve the next page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.iam.v2.Policy|Policy}. - * 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 `listPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPolicies( - request?: protos.google.iam.v2.IListPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v2.IPolicy[], - protos.google.iam.v2.IListPoliciesRequest|null, - protos.google.iam.v2.IListPoliciesResponse - ]>; - listPolicies( - request: protos.google.iam.v2.IListPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.iam.v2.IListPoliciesRequest, - protos.google.iam.v2.IListPoliciesResponse|null|undefined, - protos.google.iam.v2.IPolicy>): void; - listPolicies( - request: protos.google.iam.v2.IListPoliciesRequest, - callback: PaginationCallback< - protos.google.iam.v2.IListPoliciesRequest, - protos.google.iam.v2.IListPoliciesResponse|null|undefined, - protos.google.iam.v2.IPolicy>): void; - listPolicies( - request?: protos.google.iam.v2.IListPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.iam.v2.IListPoliciesRequest, - protos.google.iam.v2.IListPoliciesResponse|null|undefined, - protos.google.iam.v2.IPolicy>, - callback?: PaginationCallback< - protos.google.iam.v2.IListPoliciesRequest, - protos.google.iam.v2.IListPoliciesResponse|null|undefined, - protos.google.iam.v2.IPolicy>): - Promise<[ - protos.google.iam.v2.IPolicy[], - protos.google.iam.v2.IListPoliciesRequest|null, - protos.google.iam.v2.IListPoliciesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listPolicies(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 that the policy is attached to, along with the kind of policy - * to list. Format: - * `policies/{attachment_point}/denypolicies` - * - * - * The attachment point is identified by its URL-encoded full resource name, - * which means that the forward-slash character, `/`, must be written as - * `%2F`. For example, - * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. - * - * For organizations and folders, use the numeric ID in the full resource - * name. For projects, you can use the alphanumeric or the numeric ID. - * @param {number} request.pageSize - * The maximum number of policies to return. IAM ignores this value and uses - * the value 1000. - * @param {string} request.pageToken - * A page token received in a {@link protos.google.iam.v2.ListPoliciesResponse|ListPoliciesResponse}. Provide this token to - * retrieve the next page. - * @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.iam.v2.Policy|Policy} 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 `listPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listPoliciesStream( - request?: protos.google.iam.v2.IListPoliciesRequest, - 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['listPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPolicies.createStream( - this.innerApiCalls.listPolicies as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listPolicies`, 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 that the policy is attached to, along with the kind of policy - * to list. Format: - * `policies/{attachment_point}/denypolicies` - * - * - * The attachment point is identified by its URL-encoded full resource name, - * which means that the forward-slash character, `/`, must be written as - * `%2F`. For example, - * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. - * - * For organizations and folders, use the numeric ID in the full resource - * name. For projects, you can use the alphanumeric or the numeric ID. - * @param {number} request.pageSize - * The maximum number of policies to return. IAM ignores this value and uses - * the value 1000. - * @param {string} request.pageToken - * A page token received in a {@link protos.google.iam.v2.ListPoliciesResponse|ListPoliciesResponse}. Provide this token to - * retrieve the next page. - * @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.iam.v2.Policy|Policy}. 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/policies.list_policies.js - * region_tag:iam_v2_generated_Policies_ListPolicies_async - */ - listPoliciesAsync( - request?: protos.google.iam.v2.IListPoliciesRequest, - 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['listPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPolicies.asyncIterate( - this.innerApiCalls['listPolicies'] 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); - } - - - /** - * 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.policiesStub && !this._terminated) { - return this.policiesStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-iam/v2/src/v2/policies_client_config.json b/owl-bot-staging/google-iam/v2/src/v2/policies_client_config.json deleted file mode 100644 index 8203a45ed79..00000000000 --- a/owl-bot-staging/google-iam/v2/src/v2/policies_client_config.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "interfaces": { - "google.iam.v2.Policies": { - "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": { - "ListPolicies": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreatePolicy": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdatePolicy": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeletePolicy": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-iam/v2/src/v2/policies_proto_list.json b/owl-bot-staging/google-iam/v2/src/v2/policies_proto_list.json deleted file mode 100644 index d55442fe205..00000000000 --- a/owl-bot-staging/google-iam/v2/src/v2/policies_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/iam/v2/deny.proto", - "../../protos/google/iam/v2/policy.proto" -] diff --git a/owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 4f3724eae54..00000000000 --- a/owl-bot-staging/google-iam/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 iam = require('@google-cloud/iam'); - -function main() { - const policiesClient = new iam.PoliciesClient(); -} - -main(); diff --git a/owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-iam/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index ef513718ec1..00000000000 --- a/owl-bot-staging/google-iam/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 {PoliciesClient} from '@google-cloud/iam'; - -// check that the client class type name can be used -function doStuffWithPoliciesClient(client: PoliciesClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const policiesClient = new PoliciesClient(); - doStuffWithPoliciesClient(policiesClient); -} - -main(); diff --git a/owl-bot-staging/google-iam/v2/system-test/install.ts b/owl-bot-staging/google-iam/v2/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-iam/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-iam/v2/test/gapic_policies_v2.ts b/owl-bot-staging/google-iam/v2/test/gapic_policies_v2.ts deleted file mode 100644 index 08dc181fa40..00000000000 --- a/owl-bot-staging/google-iam/v2/test/gapic_policies_v2.ts +++ /dev/null @@ -1,1287 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 policiesModule 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('v2.PoliciesClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = policiesModule.v2.PoliciesClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = policiesModule.v2.PoliciesClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = policiesModule.v2.PoliciesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new policiesModule.v2.PoliciesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new policiesModule.v2.PoliciesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.policiesStub, undefined); - await client.initialize(); - assert(client.policiesStub); - }); - - it('has close method for the initialized client', done => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.policiesStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.policiesStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new policiesModule.v2.PoliciesClient({ - 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 policiesModule.v2.PoliciesClient({ - 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('getPolicy', () => { - it('invokes getPolicy without error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.GetPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.GetPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v2.Policy() - ); - client.innerApiCalls.getPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPolicy without error using callback', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.GetPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.GetPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v2.Policy() - ); - client.innerApiCalls.getPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v2.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPolicy with error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.GetPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.GetPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPolicy with closed client', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.GetPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.GetPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getPolicy(request), expectedError); - }); - }); - - describe('createPolicy', () => { - it('invokes createPolicy without error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.CreatePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.CreatePolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPolicy without error using callback', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.CreatePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.CreatePolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPolicy with call error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.CreatePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.CreatePolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPolicy with LRO error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.CreatePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.CreatePolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreatePolicyProgress without error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreatePolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreatePolicyProgress with error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreatePolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updatePolicy', () => { - it('invokes updatePolicy without error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.UpdatePolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.UpdatePolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updatePolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePolicy without error using callback', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.UpdatePolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.UpdatePolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updatePolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePolicy with call error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.UpdatePolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.UpdatePolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updatePolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updatePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePolicy with LRO error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.UpdatePolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.UpdatePolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updatePolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updatePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdatePolicyProgress without error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdatePolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdatePolicyProgress with error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdatePolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deletePolicy', () => { - it('invokes deletePolicy without error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.DeletePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.DeletePolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePolicy without error using callback', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.DeletePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.DeletePolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePolicy with call error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.DeletePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.DeletePolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePolicy with LRO error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.DeletePolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.DeletePolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeletePolicyProgress without error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeletePolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeletePolicyProgress with error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeletePolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listPolicies', () => { - it('invokes listPolicies without error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.ListPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.iam.v2.Policy()), - generateSampleMessage(new protos.google.iam.v2.Policy()), - generateSampleMessage(new protos.google.iam.v2.Policy()), - ]; - client.innerApiCalls.listPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPolicies without error using callback', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.ListPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.iam.v2.Policy()), - generateSampleMessage(new protos.google.iam.v2.Policy()), - generateSampleMessage(new protos.google.iam.v2.Policy()), - ]; - client.innerApiCalls.listPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPolicies( - request, - (err?: Error|null, result?: protos.google.iam.v2.IPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPolicies with error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.ListPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPoliciesStream without error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.ListPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.iam.v2.Policy()), - generateSampleMessage(new protos.google.iam.v2.Policy()), - generateSampleMessage(new protos.google.iam.v2.Policy()), - ]; - client.descriptors.page.listPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.iam.v2.Policy[] = []; - stream.on('data', (response: protos.google.iam.v2.Policy) => { - 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.listPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPolicies, request)); - assert( - (client.descriptors.page.listPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPoliciesStream with error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.ListPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.iam.v2.Policy[] = []; - stream.on('data', (response: protos.google.iam.v2.Policy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPolicies, request)); - assert( - (client.descriptors.page.listPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPolicies without error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.ListPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.iam.v2.Policy()), - generateSampleMessage(new protos.google.iam.v2.Policy()), - generateSampleMessage(new protos.google.iam.v2.Policy()), - ]; - client.descriptors.page.listPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.iam.v2.IPolicy[] = []; - const iterable = client.listPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPolicies with error', async () => { - const client = new policiesModule.v2.PoliciesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v2.ListPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v2.ListPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.iam.v2.IPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPolicies.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 policiesModule.v2.PoliciesClient({ - 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 policiesModule.v2.PoliciesClient({ - 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 policiesModule.v2.PoliciesClient({ - 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 policiesModule.v2.PoliciesClient({ - 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 policiesModule.v2.PoliciesClient({ - 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 policiesModule.v2.PoliciesClient({ - 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 policiesModule.v2.PoliciesClient({ - 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 policiesModule.v2.PoliciesClient({ - 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 policiesModule.v2.PoliciesClient({ - 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 policiesModule.v2.PoliciesClient({ - 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 policiesModule.v2.PoliciesClient({ - 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-iam/v2/tsconfig.json b/owl-bot-staging/google-iam/v2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-iam/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-iam/v2/webpack.config.js b/owl-bot-staging/google-iam/v2/webpack.config.js deleted file mode 100644 index f423e0d5294..00000000000 --- a/owl-bot-staging/google-iam/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: 'Policies', - filename: './policies.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-identity-accesscontextmanager/v1/.eslintignore b/owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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-identity-accesscontextmanager/v1/.eslintrc.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/.gitignore b/owl-bot-staging/google-identity-accesscontextmanager/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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-identity-accesscontextmanager/v1/.jsdoc.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/.jsdoc.js deleted file mode 100644 index 4680e389321..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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/access-context-manager', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/.mocharc.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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-identity-accesscontextmanager/v1/.prettierrc.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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-identity-accesscontextmanager/v1/README.md b/owl-bot-staging/google-identity-accesscontextmanager/v1/README.md deleted file mode 100644 index 15e69d163d1..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Accesscontextmanager: Nodejs Client diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/package.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/package.json deleted file mode 100644 index 0ce46b6a858..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/access-context-manager", - "version": "0.1.0", - "description": "Accesscontextmanager client for Node.js", - "repository": "googleapis/nodejs-accesscontextmanager", - "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 accesscontextmanager", - "accesscontextmanager", - "access context 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-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/type/device_resources.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/type/device_resources.proto deleted file mode 100644 index a3f000cf8a0..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/type/device_resources.proto +++ /dev/null @@ -1,83 +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.identity.accesscontextmanager.type; - -option csharp_namespace = "Google.Identity.AccessContextManager.Type"; -option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/type"; -option java_package = "com.google.identity.accesscontextmanager.type"; -option java_multiple_files = true; -option java_outer_classname = "TypeProto"; -option php_namespace = "Google\\Identity\\AccessContextManager\\Type"; -option ruby_package = "Google::Identity::AccessContextManager::Type"; - -// The encryption state of the device. -enum DeviceEncryptionStatus { - // The encryption status of the device is not specified or not known. - ENCRYPTION_UNSPECIFIED = 0; - - // The device does not support encryption. - ENCRYPTION_UNSUPPORTED = 1; - - // The device supports encryption, but is currently unencrypted. - UNENCRYPTED = 2; - - // The device is encrypted. - ENCRYPTED = 3; -} - -// The operating system type of the device. -// Next id: 7 -enum OsType { - // The operating system of the device is not specified or not known. - OS_UNSPECIFIED = 0; - - // A desktop Mac operating system. - DESKTOP_MAC = 1; - - // A desktop Windows operating system. - DESKTOP_WINDOWS = 2; - - // A desktop Linux operating system. - DESKTOP_LINUX = 3; - - // A desktop ChromeOS operating system. - DESKTOP_CHROME_OS = 6; - - // An Android operating system. - ANDROID = 4; - - // An iOS operating system. - IOS = 5; -} - -// The degree to which the device is managed by the Cloud organization. -enum DeviceManagementLevel { - // The device's management level is not specified or not known. - MANAGEMENT_UNSPECIFIED = 0; - - // The device is not managed. - NONE = 1; - - // Basic management is enabled, which is generally limited to monitoring and - // wiping the corporate account. - BASIC = 2; - - // Complete device management. This includes more thorough monitoring and the - // ability to directly manage the device (such as remote wiping). This can be - // enabled through the Android Enterprise Platform. - COMPLETE = 3; -} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_context_manager.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_context_manager.proto deleted file mode 100644 index c2ea6103b21..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_context_manager.proto +++ /dev/null @@ -1,986 +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.identity.accesscontextmanager.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/identity/accesscontextmanager/v1/access_level.proto"; -import "google/identity/accesscontextmanager/v1/access_policy.proto"; -import "google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto"; -import "google/identity/accesscontextmanager/v1/service_perimeter.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.V1"; -option go_package = "cloud.google.com/go/accesscontextmanager/apiv1/accesscontextmanagerpb;accesscontextmanagerpb"; -option java_multiple_files = true; -option java_outer_classname = "AccessContextManagerProto"; -option java_package = "com.google.identity.accesscontextmanager.v1"; -option objc_class_prefix = "GACM"; -option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; -option ruby_package = "Google::Identity::AccessContextManager::V1"; - -// API for setting [access levels] -// [google.identity.accesscontextmanager.v1.AccessLevel] and [service -// perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] -// for Google Cloud projects. Each organization has one [access policy] -// [google.identity.accesscontextmanager.v1.AccessPolicy] that contains the -// [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] -// and [service perimeters] -// [google.identity.accesscontextmanager.v1.ServicePerimeter]. This -// [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] is -// applicable to all resources in the organization. -// AccessPolicies -service AccessContextManager { - option (google.api.default_host) = "accesscontextmanager.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all [access policies] - // [google.identity.accesscontextmanager.v1.AccessPolicy] in an - // organization. - rpc ListAccessPolicies(ListAccessPoliciesRequest) returns (ListAccessPoliciesResponse) { - option (google.api.http) = { - get: "/v1/accessPolicies" - }; - } - - // Returns an [access policy] - // [google.identity.accesscontextmanager.v1.AccessPolicy] based on the name. - rpc GetAccessPolicy(GetAccessPolicyRequest) returns (AccessPolicy) { - option (google.api.http) = { - get: "/v1/{name=accessPolicies/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates an access policy. This method fails if the organization already has - // an access policy. The long-running operation has a successful status - // after the access policy propagates to long-lasting storage. - // Syntactic and basic semantic errors are returned in `metadata` as a - // BadRequest proto. - rpc CreateAccessPolicy(AccessPolicy) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/accessPolicies" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "AccessPolicy" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Updates an [access policy] - // [google.identity.accesscontextmanager.v1.AccessPolicy]. The - // long-running operation from this RPC has a successful status after the - // changes to the [access policy] - // [google.identity.accesscontextmanager.v1.AccessPolicy] propagate - // to long-lasting storage. - rpc UpdateAccessPolicy(UpdateAccessPolicyRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{policy.name=accessPolicies/*}" - body: "policy" - }; - option (google.api.method_signature) = "policy,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "AccessPolicy" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Deletes an [access policy] - // [google.identity.accesscontextmanager.v1.AccessPolicy] based on the - // resource name. The long-running operation has a successful status after the - // [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] - // is removed from long-lasting storage. - rpc DeleteAccessPolicy(DeleteAccessPolicyRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=accessPolicies/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Lists all [access levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] for an access - // policy. - rpc ListAccessLevels(ListAccessLevelsRequest) returns (ListAccessLevelsResponse) { - option (google.api.http) = { - get: "/v1/{parent=accessPolicies/*}/accessLevels" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets an [access level] - // [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource - // name. - rpc GetAccessLevel(GetAccessLevelRequest) returns (AccessLevel) { - option (google.api.http) = { - get: "/v1/{name=accessPolicies/*/accessLevels/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates an [access level] - // [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running - // operation from this RPC has a successful status after the [access - // level] [google.identity.accesscontextmanager.v1.AccessLevel] - // propagates to long-lasting storage. If [access levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] contain - // errors, an error response is returned for the first error encountered. - rpc CreateAccessLevel(CreateAccessLevelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=accessPolicies/*}/accessLevels" - body: "access_level" - }; - option (google.api.method_signature) = "parent,access_level"; - option (google.longrunning.operation_info) = { - response_type: "AccessLevel" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Updates an [access level] - // [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running - // operation from this RPC has a successful status after the changes to - // the [access level] - // [google.identity.accesscontextmanager.v1.AccessLevel] propagate - // to long-lasting storage. If [access levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] contain - // errors, an error response is returned for the first error encountered. - rpc UpdateAccessLevel(UpdateAccessLevelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{access_level.name=accessPolicies/*/accessLevels/*}" - body: "access_level" - }; - option (google.api.method_signature) = "access_level,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "AccessLevel" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Deletes an [access level] - // [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource - // name. The long-running operation from this RPC has a successful status - // after the [access level] - // [google.identity.accesscontextmanager.v1.AccessLevel] has been removed - // from long-lasting storage. - rpc DeleteAccessLevel(DeleteAccessLevelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=accessPolicies/*/accessLevels/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Replaces all existing [access levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] in an [access - // policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with - // the [access levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] provided. This - // is done atomically. The long-running operation from this RPC has a - // successful status after all replacements propagate to long-lasting - // storage. If the replacement contains errors, an error response is returned - // for the first error encountered. Upon error, the replacement is cancelled, - // and existing [access levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] are not - // affected. The Operation.response field contains - // ReplaceAccessLevelsResponse. Removing [access levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] contained in existing - // [service perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] result in an - // error. - rpc ReplaceAccessLevels(ReplaceAccessLevelsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=accessPolicies/*}/accessLevels:replaceAll" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "ReplaceAccessLevelsResponse" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Lists all [service perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] for an - // access policy. - rpc ListServicePerimeters(ListServicePerimetersRequest) returns (ListServicePerimetersResponse) { - option (google.api.http) = { - get: "/v1/{parent=accessPolicies/*}/servicePerimeters" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a [service perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the - // resource name. - rpc GetServicePerimeter(GetServicePerimeterRequest) returns (ServicePerimeter) { - option (google.api.http) = { - get: "/v1/{name=accessPolicies/*/servicePerimeters/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a [service perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter]. The - // long-running operation from this RPC has a successful status after the - // [service perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] - // propagates to long-lasting storage. If a [service perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] contains - // errors, an error response is returned for the first error encountered. - rpc CreateServicePerimeter(CreateServicePerimeterRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=accessPolicies/*}/servicePerimeters" - body: "service_perimeter" - }; - option (google.api.method_signature) = "parent,service_perimeter"; - option (google.longrunning.operation_info) = { - response_type: "ServicePerimeter" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Updates a [service perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter]. The - // long-running operation from this RPC has a successful status after the - // [service perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] - // propagates to long-lasting storage. If a [service perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] contains - // errors, an error response is returned for the first error encountered. - rpc UpdateServicePerimeter(UpdateServicePerimeterRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{service_perimeter.name=accessPolicies/*/servicePerimeters/*}" - body: "service_perimeter" - }; - option (google.api.method_signature) = "service_perimeter,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "ServicePerimeter" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Deletes a [service perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the - // resource name. The long-running operation from this RPC has a successful - // status after the [service perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] is removed from - // long-lasting storage. - rpc DeleteServicePerimeter(DeleteServicePerimeterRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=accessPolicies/*/servicePerimeters/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Replace all existing [service perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] in an [access - // policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with the - // [service perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] provided. This - // is done atomically. The long-running operation from this RPC has a - // successful status after all replacements propagate to long-lasting storage. - // Replacements containing errors result in an error response for the first - // error encountered. Upon an error, replacement are cancelled and existing - // [service perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] are not - // affected. The Operation.response field contains - // ReplaceServicePerimetersResponse. - rpc ReplaceServicePerimeters(ReplaceServicePerimetersRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=accessPolicies/*}/servicePerimeters:replaceAll" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "ReplaceServicePerimetersResponse" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Commits the dry-run specification for all the [service perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] in an - // [access policy][google.identity.accesscontextmanager.v1.AccessPolicy]. - // A commit operation on a service perimeter involves copying its `spec` field - // to the `status` field of the service perimeter. Only [service perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] with - // `use_explicit_dry_run_spec` field set to true are affected by a commit - // operation. The long-running operation from this RPC has a successful - // status after the dry-run specifications for all the [service perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] have been - // committed. If a commit fails, it causes the long-running operation to - // return an error response and the entire commit operation is cancelled. - // When successful, the Operation.response field contains - // CommitServicePerimetersResponse. The `dry_run` and the `spec` fields are - // cleared after a successful commit operation. - rpc CommitServicePerimeters(CommitServicePerimetersRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=accessPolicies/*}/servicePerimeters:commit" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "CommitServicePerimetersResponse" - metadata_type: "AccessContextManagerOperationMetadata" - }; - } - - // Lists all [GcpUserAccessBindings] - // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] for a - // Google Cloud organization. - rpc ListGcpUserAccessBindings(ListGcpUserAccessBindingsRequest) returns (ListGcpUserAccessBindingsResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*}/gcpUserAccessBindings" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the [GcpUserAccessBinding] - // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] with - // the given name. - rpc GetGcpUserAccessBinding(GetGcpUserAccessBindingRequest) returns (GcpUserAccessBinding) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/gcpUserAccessBindings/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a [GcpUserAccessBinding] - // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. If the - // client specifies a [name] - // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.name], - // the server ignores it. Fails if a resource already exists with the same - // [group_key] - // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.group_key]. - // Completion of this long-running operation does not necessarily signify that - // the new binding is deployed onto all affected users, which may take more - // time. - rpc CreateGcpUserAccessBinding(CreateGcpUserAccessBindingRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/gcpUserAccessBindings" - body: "gcp_user_access_binding" - }; - option (google.api.method_signature) = "parent,gcp_user_access_binding"; - option (google.longrunning.operation_info) = { - response_type: "GcpUserAccessBinding" - metadata_type: "GcpUserAccessBindingOperationMetadata" - }; - } - - // Updates a [GcpUserAccessBinding] - // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. - // Completion of this long-running operation does not necessarily signify that - // the changed binding is deployed onto all affected users, which may take - // more time. - rpc UpdateGcpUserAccessBinding(UpdateGcpUserAccessBindingRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{gcp_user_access_binding.name=organizations/*/gcpUserAccessBindings/*}" - body: "gcp_user_access_binding" - }; - option (google.api.method_signature) = "gcp_user_access_binding,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "GcpUserAccessBinding" - metadata_type: "GcpUserAccessBindingOperationMetadata" - }; - } - - // Deletes a [GcpUserAccessBinding] - // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. - // Completion of this long-running operation does not necessarily signify that - // the binding deletion is deployed onto all affected users, which may take - // more time. - rpc DeleteGcpUserAccessBinding(DeleteGcpUserAccessBindingRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=organizations/*/gcpUserAccessBindings/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "GcpUserAccessBindingOperationMetadata" - }; - } - - // Sets the IAM policy for the specified Access Context Manager - // [access policy][google.identity.accesscontextmanager.v1.AccessPolicy]. - // This method replaces the existing IAM policy on the access policy. The IAM - // policy controls the set of users who can perform specific operations on the - // Access Context Manager [access - // policy][google.identity.accesscontextmanager.v1.AccessPolicy]. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=accessPolicies/*}:setIamPolicy" - body: "*" - }; - } - - // Gets the IAM policy for the specified Access Context Manager - // [access policy][google.identity.accesscontextmanager.v1.AccessPolicy]. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=accessPolicies/*}:getIamPolicy" - body: "*" - }; - } - - // Returns the IAM permissions that the caller has on the specified Access - // Context Manager resource. The resource can be an - // [AccessPolicy][google.identity.accesscontextmanager.v1.AccessPolicy], - // [AccessLevel][google.identity.accesscontextmanager.v1.AccessLevel], or - // [ServicePerimeter][google.identity.accesscontextmanager.v1.ServicePerimeter - // ]. This method does not support other resources. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=accessPolicies/*}:testIamPermissions" - body: "*" - additional_bindings { - post: "/v1/{resource=accessPolicies/*/accessLevels/*}:testIamPermissions" - body: "*" - } - additional_bindings { - post: "/v1/{resource=accessPolicies/*/servicePerimeters/*}:testIamPermissions" - body: "*" - } - }; - } -} - -// A request to list all `AccessPolicies` for a container. -message ListAccessPoliciesRequest { - // Required. Resource name for the container to list AccessPolicy instances - // from. - // - // Format: - // `organizations/{org_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Number of AccessPolicy instances to include in the list. Default 100. - int32 page_size = 2; - - // Next page token for the next batch of AccessPolicy instances. Defaults to - // the first page of results. - string page_token = 3; -} - -// A response to `ListAccessPoliciesRequest`. -message ListAccessPoliciesResponse { - // List of the AccessPolicy instances. - repeated AccessPolicy access_policies = 1; - - // The pagination token to retrieve the next page of results. If the value is - // empty, no further results remain. - string next_page_token = 2; -} - -// A request to get a particular `AccessPolicy`. -message GetAccessPolicyRequest { - // Required. Resource name for the access policy to get. - // - // Format `accessPolicies/{policy_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "accesscontextmanager.googleapis.com/AccessPolicy" - } - ]; -} - -// A request to update an `AccessPolicy`. -message UpdateAccessPolicyRequest { - // Required. The updated AccessPolicy. - AccessPolicy policy = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Mask to control which fields get updated. Must be non-empty. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to delete an `AccessPolicy`. -message DeleteAccessPolicyRequest { - // Required. Resource name for the access policy to delete. - // - // Format `accessPolicies/{policy_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "accesscontextmanager.googleapis.com/AccessPolicy" - } - ]; -} - -// A request to list all `AccessLevels` in an `AccessPolicy`. -message ListAccessLevelsRequest { - // Required. Resource name for the access policy to list [Access Levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] from. - // - // Format: - // `accessPolicies/{policy_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "accesscontextmanager.googleapis.com/AccessLevel" - } - ]; - - // Number of [Access Levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] to include in - // the list. Default 100. - int32 page_size = 2; - - // Next page token for the next batch of [Access Level] - // [google.identity.accesscontextmanager.v1.AccessLevel] instances. - // Defaults to the first page of results. - string page_token = 3; - - // Whether to return `BasicLevels` in the Cloud Common Expression language, as - // `CustomLevels`, rather than as `BasicLevels`. Defaults to returning - // `AccessLevels` in the format they were defined. - LevelFormat access_level_format = 4; -} - -// A response to `ListAccessLevelsRequest`. -message ListAccessLevelsResponse { - // List of the [Access Level] - // [google.identity.accesscontextmanager.v1.AccessLevel] instances. - repeated AccessLevel access_levels = 1; - - // The pagination token to retrieve the next page of results. If the value is - // empty, no further results remain. - string next_page_token = 2; -} - -// A request to get a particular `AccessLevel`. -message GetAccessLevelRequest { - // Required. Resource name for the [Access Level] - // [google.identity.accesscontextmanager.v1.AccessLevel]. - // - // Format: - // `accessPolicies/{policy_id}/accessLevels/{access_level_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "accesscontextmanager.googleapis.com/AccessLevel" - } - ]; - - // Whether to return `BasicLevels` in the Cloud Common Expression - // Language rather than as `BasicLevels`. Defaults to AS_DEFINED, where - // [Access Levels] [google.identity.accesscontextmanager.v1.AccessLevel] - // are returned as `BasicLevels` or `CustomLevels` based on how they were - // created. If set to CEL, all [Access Levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] are returned as - // `CustomLevels`. In the CEL case, `BasicLevels` are translated to equivalent - // `CustomLevels`. - LevelFormat access_level_format = 2; -} - -// A request to create an `AccessLevel`. -message CreateAccessLevelRequest { - // Required. Resource name for the access policy which owns this [Access - // Level] [google.identity.accesscontextmanager.v1.AccessLevel]. - // - // Format: `accessPolicies/{policy_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "accesscontextmanager.googleapis.com/AccessLevel" - } - ]; - - // Required. The [Access Level] - // [google.identity.accesscontextmanager.v1.AccessLevel] to create. - // Syntactic correctness of the [Access Level] - // [google.identity.accesscontextmanager.v1.AccessLevel] is a - // precondition for creation. - AccessLevel access_level = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to update an `AccessLevel`. -message UpdateAccessLevelRequest { - // Required. The updated [Access Level] - // [google.identity.accesscontextmanager.v1.AccessLevel]. Syntactic - // correctness of the [Access Level] - // [google.identity.accesscontextmanager.v1.AccessLevel] is a - // precondition for creation. - AccessLevel access_level = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Mask to control which fields get updated. Must be non-empty. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to delete an `AccessLevel`. -message DeleteAccessLevelRequest { - // Required. Resource name for the [Access Level] - // [google.identity.accesscontextmanager.v1.AccessLevel]. - // - // Format: - // `accessPolicies/{policy_id}/accessLevels/{access_level_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "accesscontextmanager.googleapis.com/AccessLevel" - } - ]; -} - -// A request to replace all existing Access Levels in an Access Policy with -// the Access Levels provided. This is done atomically. -message ReplaceAccessLevelsRequest { - // Required. Resource name for the access policy which owns these - // [Access Levels] - // [google.identity.accesscontextmanager.v1.AccessLevel]. - // - // Format: `accessPolicies/{policy_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "accesscontextmanager.googleapis.com/AccessLevel" - } - ]; - - // Required. The desired [Access Levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] that should - // replace all existing [Access Levels] - // [google.identity.accesscontextmanager.v1.AccessLevel] in the - // [Access Policy] - // [google.identity.accesscontextmanager.v1.AccessPolicy]. - repeated AccessLevel access_levels = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The etag for the version of the [Access Policy] - // [google.identity.accesscontextmanager.v1.AccessPolicy] that this - // replace operation is to be performed on. If, at the time of replace, the - // etag for the Access Policy stored in Access Context Manager is different - // from the specified etag, then the replace operation will not be performed - // and the call will fail. This field is not required. If etag is not - // provided, the operation will be performed as if a valid etag is provided. - string etag = 4; -} - -// A response to ReplaceAccessLevelsRequest. This will be put inside of -// Operation.response field. -message ReplaceAccessLevelsResponse { - // List of the [Access Level] - // [google.identity.accesscontextmanager.v1.AccessLevel] instances. - repeated AccessLevel access_levels = 1; -} - -// A request to list all `ServicePerimeters` in an `AccessPolicy`. -message ListServicePerimetersRequest { - // Required. Resource name for the access policy to list [Service Perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] from. - // - // Format: - // `accessPolicies/{policy_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "accesscontextmanager.googleapis.com/ServicePerimeter" - } - ]; - - // Number of [Service Perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] to include - // in the list. Default 100. - int32 page_size = 2; - - // Next page token for the next batch of [Service Perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. - // Defaults to the first page of results. - string page_token = 3; -} - -// A response to `ListServicePerimetersRequest`. -message ListServicePerimetersResponse { - // List of the [Service Perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. - repeated ServicePerimeter service_perimeters = 1; - - // The pagination token to retrieve the next page of results. If the value is - // empty, no further results remain. - string next_page_token = 2; -} - -// A request to get a particular `ServicePerimeter`. -message GetServicePerimeterRequest { - // Required. Resource name for the [Service Perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter]. - // - // Format: - // `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "accesscontextmanager.googleapis.com/ServicePerimeter" - } - ]; -} - -// A request to create a `ServicePerimeter`. -message CreateServicePerimeterRequest { - // Required. Resource name for the access policy which owns this [Service - // Perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter]. - // - // Format: `accessPolicies/{policy_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "accesscontextmanager.googleapis.com/ServicePerimeter" - } - ]; - - // Required. The [Service Perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] to create. - // Syntactic correctness of the [Service Perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] is a - // precondition for creation. - ServicePerimeter service_perimeter = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to update a `ServicePerimeter`. -message UpdateServicePerimeterRequest { - // Required. The updated `ServicePerimeter`. Syntactic correctness of the - // `ServicePerimeter` is a precondition for creation. - ServicePerimeter service_perimeter = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Mask to control which fields get updated. Must be non-empty. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to delete a `ServicePerimeter`. -message DeleteServicePerimeterRequest { - // Required. Resource name for the [Service Perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter]. - // - // Format: - // `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "accesscontextmanager.googleapis.com/ServicePerimeter" - } - ]; -} - -// A request to replace all existing Service Perimeters in an Access Policy -// with the Service Perimeters provided. This is done atomically. -message ReplaceServicePerimetersRequest { - // Required. Resource name for the access policy which owns these - // [Service Perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter]. - // - // Format: `accessPolicies/{policy_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "accesscontextmanager.googleapis.com/ServicePerimeter" - } - ]; - - // Required. The desired [Service Perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] that should - // replace all existing [Service Perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] in the - // [Access Policy] - // [google.identity.accesscontextmanager.v1.AccessPolicy]. - repeated ServicePerimeter service_perimeters = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The etag for the version of the [Access Policy] - // [google.identity.accesscontextmanager.v1.AccessPolicy] that this - // replace operation is to be performed on. If, at the time of replace, the - // etag for the Access Policy stored in Access Context Manager is different - // from the specified etag, then the replace operation will not be performed - // and the call will fail. This field is not required. If etag is not - // provided, the operation will be performed as if a valid etag is provided. - string etag = 3; -} - -// A response to ReplaceServicePerimetersRequest. This will be put inside of -// Operation.response field. -message ReplaceServicePerimetersResponse { - // List of the [Service Perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. - repeated ServicePerimeter service_perimeters = 1; -} - -// A request to commit dry-run specs in all [Service Perimeters] -// [google.identity.accesscontextmanager.v1.ServicePerimeter] belonging to -// an [Access Policy][google.identity.accesscontextmanager.v1.AccessPolicy]. -message CommitServicePerimetersRequest { - // Required. Resource name for the parent [Access Policy] - // [google.identity.accesscontextmanager.v1.AccessPolicy] which owns all - // [Service Perimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] in scope for - // the commit operation. - // - // Format: `accessPolicies/{policy_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "accesscontextmanager.googleapis.com/ServicePerimeter" - } - ]; - - // Optional. The etag for the version of the [Access Policy] - // [google.identity.accesscontextmanager.v1.AccessPolicy] that this - // commit operation is to be performed on. If, at the time of commit, the - // etag for the Access Policy stored in Access Context Manager is different - // from the specified etag, then the commit operation will not be performed - // and the call will fail. This field is not required. If etag is not - // provided, the operation will be performed as if a valid etag is provided. - string etag = 2; -} - -// A response to CommitServicePerimetersRequest. This will be put inside of -// Operation.response field. -message CommitServicePerimetersResponse { - // List of all the [Service Perimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] instances in - // the [Access Policy] - // [google.identity.accesscontextmanager.v1.AccessPolicy]. - repeated ServicePerimeter service_perimeters = 1; -} - -// The format used in an `AccessLevel`. -enum LevelFormat { - // The format was not specified. - LEVEL_FORMAT_UNSPECIFIED = 0; - - // Uses the format the resource was defined in. BasicLevels are returned as - // BasicLevels, CustomLevels are returned as CustomLevels. - AS_DEFINED = 1; - - // Use Cloud Common Expression Language when returning the resource. Both - // BasicLevels and CustomLevels are returned as CustomLevels. - CEL = 2; -} - -// Request of [ListGcpUserAccessBindings] -// [google.identity.accesscontextmanager.v1.AccessContextManager.ListGcpUserAccessBindings]. -message ListGcpUserAccessBindingsRequest { - // Required. Example: "organizations/256" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Optional. Maximum number of items to return. The server may return fewer items. - // If left blank, the server may return any number of items. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If left blank, returns the first page. To enumerate all items, use the - // [next_page_token] - // [google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse.next_page_token] - // from your previous list operation. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response of [ListGcpUserAccessBindings] -// [google.identity.accesscontextmanager.v1.AccessContextManager.ListGcpUserAccessBindings]. -message ListGcpUserAccessBindingsResponse { - // [GcpUserAccessBinding] - // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] - repeated GcpUserAccessBinding gcp_user_access_bindings = 1; - - // Token to get the next page of items. If blank, there are no more items. - string next_page_token = 2; -} - -// Request of [GetGcpUserAccessBinding] -// [google.identity.accesscontextmanager.v1.AccessContextManager.GetGcpUserAccessBinding]. -message GetGcpUserAccessBindingRequest { - // Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "accesscontextmanager.googleapis.com/GcpUserAccessBinding" - } - ]; -} - -// Request of [CreateGcpUserAccessBinding] -// [google.identity.accesscontextmanager.v1.AccessContextManager.CreateGcpUserAccessBinding]. -message CreateGcpUserAccessBindingRequest { - // Required. Example: "organizations/256" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Required. [GcpUserAccessBinding] - // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] - GcpUserAccessBinding gcp_user_access_binding = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request of [UpdateGcpUserAccessBinding] -// [google.identity.accesscontextmanager.v1.AccessContextManager.UpdateGcpUserAccessBinding]. -message UpdateGcpUserAccessBindingRequest { - // Required. [GcpUserAccessBinding] - // [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] - GcpUserAccessBinding gcp_user_access_binding = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only the fields specified in this mask are updated. Because name and - // group_key cannot be changed, update_mask is required and must always be: - // - // update_mask { - // paths: "access_levels" - // } - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request of [DeleteGcpUserAccessBinding] -// [google.identity.accesscontextmanager.v1.AccessContextManager.DeleteGcpUserAccessBinding]. -message DeleteGcpUserAccessBindingRequest { - // Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "accesscontextmanager.googleapis.com/GcpUserAccessBinding" - } - ]; -} - -// Currently, a completed operation means nothing. In the future, this metadata -// and a completed operation may indicate that the binding has taken effect and -// is affecting access decisions for all users. -message GcpUserAccessBindingOperationMetadata { - -} - -// Metadata of Access Context Manager's Long Running Operations. -message AccessContextManagerOperationMetadata { - -} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_level.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_level.proto deleted file mode 100644 index 9c2db6c74b4..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_level.proto +++ /dev/null @@ -1,192 +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.identity.accesscontextmanager.v1; - -import "google/api/resource.proto"; -import "google/identity/accesscontextmanager/type/device_resources.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/expr.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.V1"; -option go_package = "cloud.google.com/go/accesscontextmanager/apiv1/accesscontextmanagerpb;accesscontextmanagerpb"; -option java_multiple_files = true; -option java_outer_classname = "AccessLevelProto"; -option java_package = "com.google.identity.accesscontextmanager.v1"; -option objc_class_prefix = "GACM"; -option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; -option ruby_package = "Google::Identity::AccessContextManager::V1"; - -// An `AccessLevel` is a label that can be applied to requests to Google Cloud -// services, along with a list of requirements necessary for the label to be -// applied. -message AccessLevel { - option (google.api.resource) = { - type: "accesscontextmanager.googleapis.com/AccessLevel" - pattern: "accessPolicies/{access_policy}/accessLevels/{access_level}" - }; - - // Required. Resource name for the Access Level. The `short_name` component - // must begin with a letter and only include alphanumeric and '_'. Format: - // `accessPolicies/{access_policy}/accessLevels/{access_level}`. The maximum - // length of the `access_level` component is 50 characters. - string name = 1; - - // Human readable title. Must be unique within the Policy. - string title = 2; - - // Description of the `AccessLevel` and its use. Does not affect behavior. - string description = 3; - - // Required. Describes the necessary conditions for the level to apply. - oneof level { - // A `BasicLevel` composed of `Conditions`. - BasicLevel basic = 4; - - // A `CustomLevel` written in the Common Expression Language. - CustomLevel custom = 5; - } - - // Output only. Time the `AccessLevel` was created in UTC. - google.protobuf.Timestamp create_time = 6; - - // Output only. Time the `AccessLevel` was updated in UTC. - google.protobuf.Timestamp update_time = 7; -} - -// `BasicLevel` is an `AccessLevel` using a set of recommended features. -message BasicLevel { - // Options for how the `conditions` list should be combined to determine if - // this `AccessLevel` is applied. Default is AND. - enum ConditionCombiningFunction { - // All `Conditions` must be true for the `BasicLevel` to be true. - AND = 0; - - // If at least one `Condition` is true, then the `BasicLevel` is true. - OR = 1; - } - - // Required. A list of requirements for the `AccessLevel` to be granted. - repeated Condition conditions = 1; - - // How the `conditions` list should be combined to determine if a request is - // granted this `AccessLevel`. If AND is used, each `Condition` in - // `conditions` must be satisfied for the `AccessLevel` to be applied. If OR - // is used, at least one `Condition` in `conditions` must be satisfied for the - // `AccessLevel` to be applied. Default behavior is AND. - ConditionCombiningFunction combining_function = 2; -} - -// A condition necessary for an `AccessLevel` to be granted. The Condition is an -// AND over its fields. So a Condition is true if: 1) the request IP is from one -// of the listed subnetworks AND 2) the originating device complies with the -// listed device policy AND 3) all listed access levels are granted AND 4) the -// request was sent at a time allowed by the DateTimeRestriction. -message Condition { - // CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for - // a CIDR IP address block, the specified IP address portion must be properly - // truncated (i.e. all the host bits must be zero) or the input is considered - // malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is - // not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas - // "2001:db8::1/32" is not. The originating IP of a request must be in one of - // the listed subnets in order for this Condition to be true. If empty, all IP - // addresses are allowed. - repeated string ip_subnetworks = 1; - - // Device specific restrictions, all restrictions must hold for the - // Condition to be true. If not specified, all devices are allowed. - DevicePolicy device_policy = 2; - - // A list of other access levels defined in the same `Policy`, referenced by - // resource name. Referencing an `AccessLevel` which does not exist is an - // error. All access levels listed must be granted for the Condition - // to be true. Example: - // "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"` - repeated string required_access_levels = 3; - - // Whether to negate the Condition. If true, the Condition becomes a NAND over - // its non-empty fields, each field must be false for the Condition overall to - // be satisfied. Defaults to false. - bool negate = 5; - - // The request must be made by one of the provided user or service - // accounts. Groups are not supported. - // Syntax: - // `user:{emailid}` - // `serviceAccount:{emailid}` - // If not specified, a request may come from any user. - repeated string members = 6; - - // The request must originate from one of the provided countries/regions. - // Must be valid ISO 3166-1 alpha-2 codes. - repeated string regions = 7; -} - -// `CustomLevel` is an `AccessLevel` using the Cloud Common Expression Language -// to represent the necessary conditions for the level to apply to a request. -// See CEL spec at: https://github.com/google/cel-spec -message CustomLevel { - // Required. A Cloud CEL expression evaluating to a boolean. - google.type.Expr expr = 1; -} - -// `DevicePolicy` specifies device specific restrictions necessary to acquire a -// given access level. A `DevicePolicy` specifies requirements for requests from -// devices to be granted access levels, it does not do any enforcement on the -// device. `DevicePolicy` acts as an AND over all specified fields, and each -// repeated field is an OR over its elements. Any unset fields are ignored. For -// example, if the proto is { os_type : DESKTOP_WINDOWS, os_type : -// DESKTOP_LINUX, encryption_status: ENCRYPTED}, then the DevicePolicy will be -// true for requests originating from encrypted Linux desktops and encrypted -// Windows desktops. -message DevicePolicy { - // Whether or not screenlock is required for the DevicePolicy to be true. - // Defaults to `false`. - bool require_screenlock = 1; - - // Allowed encryptions statuses, an empty list allows all statuses. - repeated google.identity.accesscontextmanager.type.DeviceEncryptionStatus allowed_encryption_statuses = 2; - - // Allowed OS versions, an empty list allows all types and all versions. - repeated OsConstraint os_constraints = 3; - - // Allowed device management levels, an empty list allows all management - // levels. - repeated google.identity.accesscontextmanager.type.DeviceManagementLevel allowed_device_management_levels = 6; - - // Whether the device needs to be approved by the customer admin. - bool require_admin_approval = 7; - - // Whether the device needs to be corp owned. - bool require_corp_owned = 8; -} - -// A restriction on the OS type and version of devices making requests. -message OsConstraint { - // Required. The allowed OS type. - google.identity.accesscontextmanager.type.OsType os_type = 1; - - // The minimum allowed OS version. If not set, any version of this OS - // satisfies the constraint. Format: `"major.minor.patch"`. - // Examples: `"10.5.301"`, `"9.2.1"`. - string minimum_version = 2; - - // Only allows requests from devices with a verified Chrome OS. - // Verifications includes requirements that the device is enterprise-managed, - // conformant to domain policies, and the caller has permission to call - // the API targeted by the request. - bool require_verified_chrome_os = 3; -} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_policy.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_policy.proto deleted file mode 100644 index 86d6541afa1..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/access_policy.proto +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.identity.accesscontextmanager.v1; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.V1"; -option go_package = "cloud.google.com/go/accesscontextmanager/apiv1/accesscontextmanagerpb;accesscontextmanagerpb"; -option java_multiple_files = true; -option java_outer_classname = "PolicyProto"; -option java_package = "com.google.identity.accesscontextmanager.v1"; -option objc_class_prefix = "GACM"; -option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; -option ruby_package = "Google::Identity::AccessContextManager::V1"; - -// `AccessPolicy` is a container for `AccessLevels` (which define the necessary -// attributes to use Google Cloud services) and `ServicePerimeters` (which -// define regions of services able to freely pass data within a perimeter). An -// access policy is globally visible within an organization, and the -// restrictions it specifies apply to all projects within an organization. -message AccessPolicy { - option (google.api.resource) = { - type: "accesscontextmanager.googleapis.com/AccessPolicy" - pattern: "accessPolicies/{access_policy}" - }; - - // Output only. Resource name of the `AccessPolicy`. Format: - // `accessPolicies/{access_policy}` - string name = 1; - - // Required. The parent of this `AccessPolicy` in the Cloud Resource - // Hierarchy. Currently immutable once created. Format: - // `organizations/{organization_id}` - string parent = 2; - - // Required. Human readable title. Does not affect behavior. - string title = 3; - - // The scopes of a policy define which resources an ACM policy can restrict, - // and where ACM resources can be referenced. - // For example, a policy with scopes=["folders/123"] has the following - // behavior: - // - vpcsc perimeters can only restrict projects within folders/123 - // - access levels can only be referenced by resources within folders/123. - // If empty, there are no limitations on which resources can be restricted by - // an ACM policy, and there are no limitations on where ACM resources can be - // referenced. - // Only one policy can include a given scope (attempting to create a second - // policy which includes "folders/123" will result in an error). - // Currently, scopes cannot be modified after a policy is created. - // Currently, policies can only have a single scope. - // Format: list of `folders/{folder_number}` or `projects/{project_number}` - repeated string scopes = 7; - - // Output only. Time the `AccessPolicy` was created in UTC. - google.protobuf.Timestamp create_time = 4; - - // Output only. Time the `AccessPolicy` was updated in UTC. - google.protobuf.Timestamp update_time = 5; - - // Output only. An opaque identifier for the current version of the - // `AccessPolicy`. This will always be a strongly validated etag, meaning that - // two Access Polices will be identical if and only if their etags are - // identical. Clients should not expect this to be in any specific format. - string etag = 6; -} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto deleted file mode 100644 index 4a296d57226..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto +++ /dev/null @@ -1,68 +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.identity.accesscontextmanager.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.V1"; -option go_package = "cloud.google.com/go/accesscontextmanager/apiv1/accesscontextmanagerpb;accesscontextmanagerpb"; -option java_multiple_files = true; -option java_outer_classname = "GcpUserAccessBindingProto"; -option java_package = "com.google.identity.accesscontextmanager.v1"; -option objc_class_prefix = "GACM"; -option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; -option ruby_package = "Google::Identity::AccessContextManager::V1"; - -// Restricts access to Cloud Console and Google Cloud APIs for a set of users -// using Context-Aware Access. -message GcpUserAccessBinding { - option (google.api.resource) = { - type: "accesscontextmanager.googleapis.com/GcpUserAccessBinding" - pattern: "organizations/{organization}/gcpUserAccessBindings/{gcp_user_access_binding}" - }; - - // Immutable. Assigned by the server during creation. The last segment has an arbitrary - // length and has only URI unreserved characters (as defined by - // [RFC 3986 Section 2.3](https://tools.ietf.org/html/rfc3986#section-2.3)). - // Should not be specified by the client during creation. - // Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Required. Immutable. Google Group id whose members are subject to this binding's restrictions. - // See "id" in the [G Suite Directory API's Groups resource] - // (https://developers.google.com/admin-sdk/directory/v1/reference/groups#resource). - // If a group's email address/alias is changed, this resource will continue - // to point at the changed group. This field does not accept group email - // addresses or aliases. - // Example: "01d520gv4vjcrht" - string group_key = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. Access level that a user must have to be granted access. Only one access - // level is supported, not multiple. This repeated field must have exactly - // one element. - // Example: "accessPolicies/9522/accessLevels/device_trusted" - repeated string access_levels = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "accesscontextmanager.googleapis.com/AccessLevel" - } - ]; -} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto b/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto deleted file mode 100644 index 03c324dbf50..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto +++ /dev/null @@ -1,472 +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.identity.accesscontextmanager.v1; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.V1"; -option go_package = "cloud.google.com/go/accesscontextmanager/apiv1/accesscontextmanagerpb;accesscontextmanagerpb"; -option java_multiple_files = true; -option java_outer_classname = "ServicePerimeterProto"; -option java_package = "com.google.identity.accesscontextmanager.v1"; -option objc_class_prefix = "GACM"; -option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; -option ruby_package = "Google::Identity::AccessContextManager::V1"; - -// `ServicePerimeter` describes a set of Google Cloud resources which can freely -// import and export data amongst themselves, but not export outside of the -// `ServicePerimeter`. If a request with a source within this `ServicePerimeter` -// has a target outside of the `ServicePerimeter`, the request will be blocked. -// Otherwise the request is allowed. There are two types of Service Perimeter - -// Regular and Bridge. Regular Service Perimeters cannot overlap, a single -// Google Cloud project can only belong to a single regular Service Perimeter. -// Service Perimeter Bridges can contain only Google Cloud projects as members, -// a single Google Cloud project may belong to multiple Service Perimeter -// Bridges. -message ServicePerimeter { - option (google.api.resource) = { - type: "accesscontextmanager.googleapis.com/ServicePerimeter" - pattern: "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}" - }; - - // Specifies the type of the Perimeter. There are two types: regular and - // bridge. Regular Service Perimeter contains resources, access levels, and - // restricted services. Every resource can be in at most ONE - // regular Service Perimeter. - // - // In addition to being in a regular service perimeter, a resource can also - // be in zero or more perimeter bridges. A perimeter bridge only contains - // resources. Cross project operations are permitted if all effected - // resources share some perimeter (whether bridge or regular). Perimeter - // Bridge does not contain access levels or services: those are governed - // entirely by the regular perimeter that resource is in. - // - // Perimeter Bridges are typically useful when building more complex toplogies - // with many independent perimeters that need to share some data with a common - // perimeter, but should not be able to share data among themselves. - enum PerimeterType { - // Regular Perimeter. - PERIMETER_TYPE_REGULAR = 0; - - // Perimeter Bridge. - PERIMETER_TYPE_BRIDGE = 1; - } - - // Required. Resource name for the ServicePerimeter. The `short_name` - // component must begin with a letter and only include alphanumeric and '_'. - // Format: - // `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}` - string name = 1; - - // Human readable title. Must be unique within the Policy. - string title = 2; - - // Description of the `ServicePerimeter` and its use. Does not affect - // behavior. - string description = 3; - - // Output only. Time the `ServicePerimeter` was created in UTC. - google.protobuf.Timestamp create_time = 4; - - // Output only. Time the `ServicePerimeter` was updated in UTC. - google.protobuf.Timestamp update_time = 5; - - // Perimeter type indicator. A single project is - // allowed to be a member of single regular perimeter, but multiple service - // perimeter bridges. A project cannot be a included in a perimeter bridge - // without being included in regular perimeter. For perimeter bridges, - // the restricted service list as well as access level lists must be - // empty. - PerimeterType perimeter_type = 6; - - // Current ServicePerimeter configuration. Specifies sets of resources, - // restricted services and access levels that determine perimeter - // content and boundaries. - ServicePerimeterConfig status = 7; - - // Proposed (or dry run) ServicePerimeter configuration. This configuration - // allows to specify and test ServicePerimeter configuration without enforcing - // actual access restrictions. Only allowed to be set when the - // "use_explicit_dry_run_spec" flag is set. - ServicePerimeterConfig spec = 8; - - // Use explicit dry run spec flag. Ordinarily, a dry-run spec implicitly - // exists for all Service Perimeters, and that spec is identical to the - // status for those Service Perimeters. When this flag is set, it inhibits the - // generation of the implicit spec, thereby allowing the user to explicitly - // provide a configuration ("spec") to use in a dry-run version of the Service - // Perimeter. This allows the user to test changes to the enforced config - // ("status") without actually enforcing them. This testing is done through - // analyzing the differences between currently enforced and suggested - // restrictions. use_explicit_dry_run_spec must bet set to True if any of the - // fields in the spec are set to non-default values. - bool use_explicit_dry_run_spec = 9; -} - -// `ServicePerimeterConfig` specifies a set of Google Cloud resources that -// describe specific Service Perimeter configuration. -message ServicePerimeterConfig { - // Specifies how APIs are allowed to communicate within the Service - // Perimeter. - message VpcAccessibleServices { - // Whether to restrict API calls within the Service Perimeter to the list of - // APIs specified in 'allowed_services'. - bool enable_restriction = 1; - - // The list of APIs usable within the Service Perimeter. Must be empty - // unless 'enable_restriction' is True. You can specify a list of individual - // services, as well as include the 'RESTRICTED-SERVICES' value, which - // automatically includes all of the services protected by the perimeter. - repeated string allowed_services = 2; - } - - // Specifies the types of identities that are allowed access in either - // [IngressFrom] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressFrom] - // or [EgressFrom] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom] - // rules. - enum IdentityType { - // No blanket identity group specified. - IDENTITY_TYPE_UNSPECIFIED = 0; - - // Authorize access from all identities outside the perimeter. - ANY_IDENTITY = 1; - - // Authorize access from all human users outside the perimeter. - ANY_USER_ACCOUNT = 2; - - // Authorize access from all service accounts outside the perimeter. - ANY_SERVICE_ACCOUNT = 3; - } - - // An allowed method or permission of a service specified in [ApiOperation] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]. - message MethodSelector { - // The API method name or Cloud IAM permission name to allow. - oneof kind { - // Value for `method` should be a valid method name for the corresponding - // `service_name` in [ApiOperation] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]. - // If `*` used as value for `method`, then ALL methods and permissions are - // allowed. - string method = 1; - - // Value for `permission` should be a valid Cloud IAM permission for the - // corresponding `service_name` in [ApiOperation] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]. - string permission = 2; - } - } - - // Identification for an API Operation. - message ApiOperation { - // The name of the API whose methods or permissions the [IngressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // or [EgressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // want to allow. A single [ApiOperation] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] - // with `service_name` field set to `*` will allow all methods AND - // permissions for all services. - string service_name = 1; - - // API methods or permissions to allow. Method or permission must belong to - // the service specified by `service_name` field. A single [MethodSelector] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.MethodSelector] - // entry with `*` specified for the `method` field will allow all methods - // AND permissions for the service specified in `service_name`. - repeated MethodSelector method_selectors = 2; - } - - // The source that [IngressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // authorizes access from. - message IngressSource { - // Allowed ingress source. It can be one of [AccessLevel] - // [google.identity.accesscontextmanager.v1.AccessLevel] or Google - // Cloud resource. - oneof source { - // An [AccessLevel] - // [google.identity.accesscontextmanager.v1.AccessLevel] resource - // name that allow resources within the [ServicePerimeters] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] to be - // accessed from the internet. [AccessLevels] - // [google.identity.accesscontextmanager.v1.AccessLevel] listed must - // be in the same policy as this [ServicePerimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter]. - // Referencing a nonexistent [AccessLevel] - // [google.identity.accesscontextmanager.v1.AccessLevel] will cause - // an error. If no [AccessLevel] - // [google.identity.accesscontextmanager.v1.AccessLevel] names are - // listed, resources within the perimeter can only be accessed via Google - // Cloud calls with request origins within the perimeter. Example: - // `accessPolicies/MY_POLICY/accessLevels/MY_LEVEL`. If a single `*` is - // specified for `access_level`, then all [IngressSources] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressSource] - // will be allowed. - string access_level = 1; - - // A Google Cloud resource that is allowed to ingress the perimeter. - // Requests from these resources will be allowed to access perimeter data. - // Currently only projects are allowed. - // Format: `projects/{project_number}` - // The project may be in any Google Cloud organization, not just the - // organization that the perimeter is defined in. `*` is not allowed, the - // case of allowing all Google Cloud resources only is not supported. - string resource = 2; - } - } - - // Defines the conditions under which an [IngressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // matches a request. Conditions are based on information about the source of - // the request. The request must satisfy what is defined in `sources` AND - // identity related fields in order to match. - message IngressFrom { - // Sources that this [IngressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // authorizes access from. - repeated IngressSource sources = 1; - - // A list of identities that are allowed access through this ingress - // policy. Should be in the format of email address. The email address - // should represent individual user or service account only. - repeated string identities = 2; - - // Specifies the type of identities that are allowed access from outside the - // perimeter. If left unspecified, then members of `identities` field will - // be allowed access. - IdentityType identity_type = 3; - } - - // Defines the conditions under which an [IngressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // matches a request. Conditions are based on information about the - // [ApiOperation] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] - // intended to be performed on the target resource of the request. The request - // must satisfy what is defined in `operations` AND `resources` in order to - // match. - message IngressTo { - // A list of [ApiOperations] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] - // allowed to be performed by the sources specified in corresponding - // [IngressFrom] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressFrom] - // in this [ServicePerimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter]. - repeated ApiOperation operations = 1; - - // A list of resources, currently only projects in the form - // `projects/`, protected by this [ServicePerimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] that are - // allowed to be accessed by sources defined in the corresponding - // [IngressFrom] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressFrom]. - // If a single `*` is specified, then access to all resources inside the - // perimeter are allowed. - repeated string resources = 2; - } - - // Policy for ingress into [ServicePerimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter]. - // - // [IngressPolicies] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // match requests based on `ingress_from` and `ingress_to` stanzas. For an - // ingress policy to match, both the `ingress_from` and `ingress_to` stanzas - // must be matched. If an [IngressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // matches a request, the request is allowed through the perimeter boundary - // from outside the perimeter. - // - // For example, access from the internet can be allowed either - // based on an [AccessLevel] - // [google.identity.accesscontextmanager.v1.AccessLevel] or, for traffic - // hosted on Google Cloud, the project of the source network. For access from - // private networks, using the project of the hosting network is required. - // - // Individual ingress policies can be limited by restricting which - // services and/or actions they match using the `ingress_to` field. - message IngressPolicy { - // Defines the conditions on the source of a request causing this - // [IngressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // to apply. - IngressFrom ingress_from = 1; - - // Defines the conditions on the [ApiOperation] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] - // and request destination that cause this [IngressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // to apply. - IngressTo ingress_to = 2; - } - - // Defines the conditions under which an [EgressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // matches a request. Conditions based on information about the source of the - // request. Note that if the destination of the request is also protected by a - // [ServicePerimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter], then that - // [ServicePerimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] must have - // an [IngressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // which allows access in order for this request to succeed. - message EgressFrom { - // A list of identities that are allowed access through this [EgressPolicy]. - // Should be in the format of email address. The email address should - // represent individual user or service account only. - repeated string identities = 1; - - // Specifies the type of identities that are allowed access to outside the - // perimeter. If left unspecified, then members of `identities` field will - // be allowed access. - IdentityType identity_type = 2; - } - - // Defines the conditions under which an [EgressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // matches a request. Conditions are based on information about the - // [ApiOperation] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] - // intended to be performed on the `resources` specified. Note that if the - // destination of the request is also protected by a [ServicePerimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter], then that - // [ServicePerimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] must have - // an [IngressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // which allows access in order for this request to succeed. The request must - // match `operations` AND `resources` fields in order to be allowed egress out - // of the perimeter. - message EgressTo { - // A list of resources, currently only projects in the form - // `projects/`, that are allowed to be accessed by sources - // defined in the corresponding [EgressFrom] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom]. - // A request matches if it contains a resource in this list. If `*` is - // specified for `resources`, then this [EgressTo] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressTo] - // rule will authorize access to all resources outside the perimeter. - repeated string resources = 1; - - // A list of [ApiOperations] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] - // allowed to be performed by the sources specified in the corresponding - // [EgressFrom] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom]. - // A request matches if it uses an operation/service in this list. - repeated ApiOperation operations = 2; - - // A list of external resources that are allowed to be accessed. Only AWS - // and Azure resources are supported. For Amazon S3, the supported format is - // s3://BUCKET_NAME. For Azure Storage, the supported format is - // azure://myaccount.blob.core.windows.net/CONTAINER_NAME. A request matches - // if it contains an external resource in this list (Example: - // s3://bucket/path). Currently '*' is not allowed. - repeated string external_resources = 3; - } - - // Policy for egress from perimeter. - // - // [EgressPolicies] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // match requests based on `egress_from` and `egress_to` stanzas. For an - // [EgressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // to match, both `egress_from` and `egress_to` stanzas must be matched. If an - // [EgressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // matches a request, the request is allowed to span the [ServicePerimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] boundary. - // For example, an [EgressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // can be used to allow VMs on networks within the [ServicePerimeter] - // [google.identity.accesscontextmanager.v1.ServicePerimeter] to access a - // defined set of projects outside the perimeter in certain contexts (e.g. to - // read data from a Cloud Storage bucket or query against a BigQuery dataset). - // - // [EgressPolicies] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // are concerned with the *resources* that a request relates as well as the - // API services and API actions being used. They do not related to the - // direction of data movement. More detailed documentation for this concept - // can be found in the descriptions of [EgressFrom] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom] - // and [EgressTo] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressTo]. - message EgressPolicy { - // Defines conditions on the source of a request causing this [EgressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // to apply. - EgressFrom egress_from = 1; - - // Defines the conditions on the [ApiOperation] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation] - // and destination resources that cause this [EgressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // to apply. - EgressTo egress_to = 2; - } - - // A list of Google Cloud resources that are inside of the service perimeter. - // Currently only projects are allowed. Format: `projects/{project_number}` - repeated string resources = 1; - - // A list of `AccessLevel` resource names that allow resources within the - // `ServicePerimeter` to be accessed from the internet. `AccessLevels` listed - // must be in the same policy as this `ServicePerimeter`. Referencing a - // nonexistent `AccessLevel` is a syntax error. If no `AccessLevel` names are - // listed, resources within the perimeter can only be accessed via Google - // Cloud calls with request origins within the perimeter. Example: - // `"accessPolicies/MY_POLICY/accessLevels/MY_LEVEL"`. - // For Service Perimeter Bridge, must be empty. - repeated string access_levels = 2; - - // Google Cloud services that are subject to the Service Perimeter - // restrictions. For example, if `storage.googleapis.com` is specified, access - // to the storage buckets inside the perimeter must meet the perimeter's - // access restrictions. - repeated string restricted_services = 4; - - // Configuration for APIs allowed within Perimeter. - VpcAccessibleServices vpc_accessible_services = 10; - - // List of [IngressPolicies] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // to apply to the perimeter. A perimeter may have multiple [IngressPolicies] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy], - // each of which is evaluated separately. Access is granted if any [Ingress - // Policy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy] - // grants it. Must be empty for a perimeter bridge. - repeated IngressPolicy ingress_policies = 8; - - // List of [EgressPolicies] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // to apply to the perimeter. A perimeter may have multiple [EgressPolicies] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy], - // each of which is evaluated separately. Access is granted if any - // [EgressPolicy] - // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy] - // grants it. Must be empty for a perimeter bridge. - repeated EgressPolicy egress_policies = 9; -} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.commit_service_perimeters.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.commit_service_perimeters.js deleted file mode 100644 index 210e7050918..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.commit_service_perimeters.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 accesscontextmanager_v1_generated_AccessContextManager_CommitServicePerimeters_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the parent Access Policy - * google.identity.accesscontextmanager.v1.AccessPolicy which owns all - * Service Perimeters - * google.identity.accesscontextmanager.v1.ServicePerimeter in scope for - * the commit operation. - * Format: `accessPolicies/{policy_id}` - */ - // const parent = 'abc123' - /** - * Optional. The etag for the version of the Access Policy - * google.identity.accesscontextmanager.v1.AccessPolicy that this - * commit operation is to be performed on. If, at the time of commit, the - * etag for the Access Policy stored in Access Context Manager is different - * from the specified etag, then the commit operation will not be performed - * and the call will fail. This field is not required. If etag is not - * provided, the operation will be performed as if a valid etag is provided. - */ - // const etag = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callCommitServicePerimeters() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.commitServicePerimeters(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCommitServicePerimeters(); - // [END accesscontextmanager_v1_generated_AccessContextManager_CommitServicePerimeters_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_level.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_level.js deleted file mode 100644 index 31e72bfd6ee..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_level.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, accessLevel) { - // [START accesscontextmanager_v1_generated_AccessContextManager_CreateAccessLevel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the access policy which owns this Access - * Level google.identity.accesscontextmanager.v1.AccessLevel. - * Format: `accessPolicies/{policy_id}` - */ - // const parent = 'abc123' - /** - * Required. The Access Level - * google.identity.accesscontextmanager.v1.AccessLevel to create. - * Syntactic correctness of the Access Level - * google.identity.accesscontextmanager.v1.AccessLevel is a - * precondition for creation. - */ - // const accessLevel = {} - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callCreateAccessLevel() { - // Construct request - const request = { - parent, - accessLevel, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.createAccessLevel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateAccessLevel(); - // [END accesscontextmanager_v1_generated_AccessContextManager_CreateAccessLevel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_policy.js deleted file mode 100644 index 5dfff5a268a..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_access_policy.js +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically 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 accesscontextmanager_v1_generated_AccessContextManager_CreateAccessPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Output only. Resource name of the `AccessPolicy`. Format: - * `accessPolicies/{access_policy}` - */ - // const name = 'abc123' - /** - * Required. The parent of this `AccessPolicy` in the Cloud Resource - * Hierarchy. Currently immutable once created. Format: - * `organizations/{organization_id}` - */ - // const parent = 'abc123' - /** - * Required. Human readable title. Does not affect behavior. - */ - // const title = 'abc123' - /** - * The scopes of a policy define which resources an ACM policy can restrict, - * and where ACM resources can be referenced. - * For example, a policy with scopes="folders/123" has the following - * behavior: - * - vpcsc perimeters can only restrict projects within folders/123 - * - access levels can only be referenced by resources within folders/123. - * If empty, there are no limitations on which resources can be restricted by - * an ACM policy, and there are no limitations on where ACM resources can be - * referenced. - * Only one policy can include a given scope (attempting to create a second - * policy which includes "folders/123" will result in an error). - * Currently, scopes cannot be modified after a policy is created. - * Currently, policies can only have a single scope. - * Format: list of `folders/{folder_number}` or `projects/{project_number}` - */ - // const scopes = ['abc','def'] - /** - * Output only. Time the `AccessPolicy` was created in UTC. - */ - // const createTime = {} - /** - * Output only. Time the `AccessPolicy` was updated in UTC. - */ - // const updateTime = {} - /** - * Output only. An opaque identifier for the current version of the - * `AccessPolicy`. This will always be a strongly validated etag, meaning that - * two Access Polices will be identical if and only if their etags are - * identical. Clients should not expect this to be in any specific format. - */ - // const etag = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callCreateAccessPolicy() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await accesscontextmanagerClient.createAccessPolicy(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateAccessPolicy(); - // [END accesscontextmanager_v1_generated_AccessContextManager_CreateAccessPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_gcp_user_access_binding.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_gcp_user_access_binding.js deleted file mode 100644 index 02e0848f4a6..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_gcp_user_access_binding.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(parent, gcpUserAccessBinding) { - // [START accesscontextmanager_v1_generated_AccessContextManager_CreateGcpUserAccessBinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Example: "organizations/256" - */ - // const parent = 'abc123' - /** - * Required. GcpUserAccessBinding - * google.identity.accesscontextmanager.v1.GcpUserAccessBinding - */ - // const gcpUserAccessBinding = {} - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callCreateGcpUserAccessBinding() { - // Construct request - const request = { - parent, - gcpUserAccessBinding, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.createGcpUserAccessBinding(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateGcpUserAccessBinding(); - // [END accesscontextmanager_v1_generated_AccessContextManager_CreateGcpUserAccessBinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_service_perimeter.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_service_perimeter.js deleted file mode 100644 index 4a12581b96d..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.create_service_perimeter.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, servicePerimeter) { - // [START accesscontextmanager_v1_generated_AccessContextManager_CreateServicePerimeter_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the access policy which owns this Service - * Perimeter google.identity.accesscontextmanager.v1.ServicePerimeter. - * Format: `accessPolicies/{policy_id}` - */ - // const parent = 'abc123' - /** - * Required. The Service Perimeter - * google.identity.accesscontextmanager.v1.ServicePerimeter to create. - * Syntactic correctness of the Service Perimeter - * google.identity.accesscontextmanager.v1.ServicePerimeter is a - * precondition for creation. - */ - // const servicePerimeter = {} - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callCreateServicePerimeter() { - // Construct request - const request = { - parent, - servicePerimeter, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.createServicePerimeter(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateServicePerimeter(); - // [END accesscontextmanager_v1_generated_AccessContextManager_CreateServicePerimeter_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_level.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_level.js deleted file mode 100644 index 2538dfeef01..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_level.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 accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessLevel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the Access Level - * google.identity.accesscontextmanager.v1.AccessLevel. - * Format: - * `accessPolicies/{policy_id}/accessLevels/{access_level_id}` - */ - // const name = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callDeleteAccessLevel() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.deleteAccessLevel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteAccessLevel(); - // [END accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessLevel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_policy.js deleted file mode 100644 index 7bd92cc2e23..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_access_policy.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 accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the access policy to delete. - * Format `accessPolicies/{policy_id}` - */ - // const name = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callDeleteAccessPolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.deleteAccessPolicy(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteAccessPolicy(); - // [END accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.js deleted file mode 100644 index b3c61f4b2d1..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.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 accesscontextmanager_v1_generated_AccessContextManager_DeleteGcpUserAccessBinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" - */ - // const name = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callDeleteGcpUserAccessBinding() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.deleteGcpUserAccessBinding(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteGcpUserAccessBinding(); - // [END accesscontextmanager_v1_generated_AccessContextManager_DeleteGcpUserAccessBinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_service_perimeter.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_service_perimeter.js deleted file mode 100644 index c8e4c28c416..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.delete_service_perimeter.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 accesscontextmanager_v1_generated_AccessContextManager_DeleteServicePerimeter_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the Service Perimeter - * google.identity.accesscontextmanager.v1.ServicePerimeter. - * Format: - * `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}` - */ - // const name = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callDeleteServicePerimeter() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.deleteServicePerimeter(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteServicePerimeter(); - // [END accesscontextmanager_v1_generated_AccessContextManager_DeleteServicePerimeter_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_level.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_level.js deleted file mode 100644 index c3565fa9d8e..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_level.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 accesscontextmanager_v1_generated_AccessContextManager_GetAccessLevel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the Access Level - * google.identity.accesscontextmanager.v1.AccessLevel. - * Format: - * `accessPolicies/{policy_id}/accessLevels/{access_level_id}` - */ - // const name = 'abc123' - /** - * Whether to return `BasicLevels` in the Cloud Common Expression - * Language rather than as `BasicLevels`. Defaults to AS_DEFINED, where - * Access Levels google.identity.accesscontextmanager.v1.AccessLevel - * are returned as `BasicLevels` or `CustomLevels` based on how they were - * created. If set to CEL, all Access Levels - * google.identity.accesscontextmanager.v1.AccessLevel are returned as - * `CustomLevels`. In the CEL case, `BasicLevels` are translated to equivalent - * `CustomLevels`. - */ - // const accessLevelFormat = {} - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callGetAccessLevel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await accesscontextmanagerClient.getAccessLevel(request); - console.log(response); - } - - callGetAccessLevel(); - // [END accesscontextmanager_v1_generated_AccessContextManager_GetAccessLevel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_policy.js deleted file mode 100644 index 9662e2e2d90..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_access_policy.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 accesscontextmanager_v1_generated_AccessContextManager_GetAccessPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the access policy to get. - * Format `accessPolicies/{policy_id}` - */ - // const name = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callGetAccessPolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await accesscontextmanagerClient.getAccessPolicy(request); - console.log(response); - } - - callGetAccessPolicy(); - // [END accesscontextmanager_v1_generated_AccessContextManager_GetAccessPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_gcp_user_access_binding.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_gcp_user_access_binding.js deleted file mode 100644 index f114b04f82c..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_gcp_user_access_binding.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 accesscontextmanager_v1_generated_AccessContextManager_GetGcpUserAccessBinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" - */ - // const name = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callGetGcpUserAccessBinding() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await accesscontextmanagerClient.getGcpUserAccessBinding(request); - console.log(response); - } - - callGetGcpUserAccessBinding(); - // [END accesscontextmanager_v1_generated_AccessContextManager_GetGcpUserAccessBinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_iam_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_iam_policy.js deleted file mode 100644 index a15dc6fd627..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_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 accesscontextmanager_v1_generated_AccessContextManager_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 Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await accesscontextmanagerClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END accesscontextmanager_v1_generated_AccessContextManager_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-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_service_perimeter.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_service_perimeter.js deleted file mode 100644 index a7a3e04d88a..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.get_service_perimeter.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 accesscontextmanager_v1_generated_AccessContextManager_GetServicePerimeter_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the Service Perimeter - * google.identity.accesscontextmanager.v1.ServicePerimeter. - * Format: - * `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}` - */ - // const name = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callGetServicePerimeter() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await accesscontextmanagerClient.getServicePerimeter(request); - console.log(response); - } - - callGetServicePerimeter(); - // [END accesscontextmanager_v1_generated_AccessContextManager_GetServicePerimeter_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_levels.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_levels.js deleted file mode 100644 index 6ab5cfc5811..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_levels.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 accesscontextmanager_v1_generated_AccessContextManager_ListAccessLevels_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the access policy to list Access Levels - * google.identity.accesscontextmanager.v1.AccessLevel from. - * Format: - * `accessPolicies/{policy_id}` - */ - // const parent = 'abc123' - /** - * Number of Access Levels - * google.identity.accesscontextmanager.v1.AccessLevel to include in - * the list. Default 100. - */ - // const pageSize = 1234 - /** - * Next page token for the next batch of Access Level - * google.identity.accesscontextmanager.v1.AccessLevel instances. - * Defaults to the first page of results. - */ - // const pageToken = 'abc123' - /** - * Whether to return `BasicLevels` in the Cloud Common Expression language, as - * `CustomLevels`, rather than as `BasicLevels`. Defaults to returning - * `AccessLevels` in the format they were defined. - */ - // const accessLevelFormat = {} - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callListAccessLevels() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await accesscontextmanagerClient.listAccessLevelsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAccessLevels(); - // [END accesscontextmanager_v1_generated_AccessContextManager_ListAccessLevels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_policies.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_policies.js deleted file mode 100644 index 42db69d60bc..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_access_policies.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 accesscontextmanager_v1_generated_AccessContextManager_ListAccessPolicies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the container to list AccessPolicy instances - * from. - * Format: - * `organizations/{org_id}` - */ - // const parent = 'abc123' - /** - * Number of AccessPolicy instances to include in the list. Default 100. - */ - // const pageSize = 1234 - /** - * Next page token for the next batch of AccessPolicy instances. Defaults to - * the first page of results. - */ - // const pageToken = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callListAccessPolicies() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await accesscontextmanagerClient.listAccessPoliciesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAccessPolicies(); - // [END accesscontextmanager_v1_generated_AccessContextManager_ListAccessPolicies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_gcp_user_access_bindings.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_gcp_user_access_bindings.js deleted file mode 100644 index 9e8746afca0..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_gcp_user_access_bindings.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 accesscontextmanager_v1_generated_AccessContextManager_ListGcpUserAccessBindings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Example: "organizations/256" - */ - // const parent = 'abc123' - /** - * Optional. Maximum number of items to return. The server may return fewer items. - * If left blank, the server may return any number of items. - */ - // const pageSize = 1234 - /** - * Optional. If left blank, returns the first page. To enumerate all items, use the - * next_page_token - * google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse.next_page_token - * from your previous list operation. - */ - // const pageToken = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callListGcpUserAccessBindings() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await accesscontextmanagerClient.listGcpUserAccessBindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListGcpUserAccessBindings(); - // [END accesscontextmanager_v1_generated_AccessContextManager_ListGcpUserAccessBindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_service_perimeters.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_service_perimeters.js deleted file mode 100644 index 4c1cce77f94..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.list_service_perimeters.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 accesscontextmanager_v1_generated_AccessContextManager_ListServicePerimeters_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the access policy to list Service Perimeters - * google.identity.accesscontextmanager.v1.ServicePerimeter from. - * Format: - * `accessPolicies/{policy_id}` - */ - // const parent = 'abc123' - /** - * Number of Service Perimeters - * google.identity.accesscontextmanager.v1.ServicePerimeter to include - * in the list. Default 100. - */ - // const pageSize = 1234 - /** - * Next page token for the next batch of Service Perimeter - * google.identity.accesscontextmanager.v1.ServicePerimeter instances. - * Defaults to the first page of results. - */ - // const pageToken = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callListServicePerimeters() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await accesscontextmanagerClient.listServicePerimetersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServicePerimeters(); - // [END accesscontextmanager_v1_generated_AccessContextManager_ListServicePerimeters_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_access_levels.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_access_levels.js deleted file mode 100644 index 991b664d369..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_access_levels.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, accessLevels) { - // [START accesscontextmanager_v1_generated_AccessContextManager_ReplaceAccessLevels_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the access policy which owns these - * Access Levels - * google.identity.accesscontextmanager.v1.AccessLevel. - * Format: `accessPolicies/{policy_id}` - */ - // const parent = 'abc123' - /** - * Required. The desired Access Levels - * google.identity.accesscontextmanager.v1.AccessLevel that should - * replace all existing Access Levels - * google.identity.accesscontextmanager.v1.AccessLevel in the - * Access Policy - * google.identity.accesscontextmanager.v1.AccessPolicy. - */ - // const accessLevels = [1,2,3,4] - /** - * Optional. The etag for the version of the Access Policy - * google.identity.accesscontextmanager.v1.AccessPolicy that this - * replace operation is to be performed on. If, at the time of replace, the - * etag for the Access Policy stored in Access Context Manager is different - * from the specified etag, then the replace operation will not be performed - * and the call will fail. This field is not required. If etag is not - * provided, the operation will be performed as if a valid etag is provided. - */ - // const etag = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callReplaceAccessLevels() { - // Construct request - const request = { - parent, - accessLevels, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.replaceAccessLevels(request); - const [response] = await operation.promise(); - console.log(response); - } - - callReplaceAccessLevels(); - // [END accesscontextmanager_v1_generated_AccessContextManager_ReplaceAccessLevels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_service_perimeters.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_service_perimeters.js deleted file mode 100644 index 72b88043e21..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.replace_service_perimeters.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, servicePerimeters) { - // [START accesscontextmanager_v1_generated_AccessContextManager_ReplaceServicePerimeters_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 for the access policy which owns these - * Service Perimeters - * google.identity.accesscontextmanager.v1.ServicePerimeter. - * Format: `accessPolicies/{policy_id}` - */ - // const parent = 'abc123' - /** - * Required. The desired Service Perimeters - * google.identity.accesscontextmanager.v1.ServicePerimeter that should - * replace all existing Service Perimeters - * google.identity.accesscontextmanager.v1.ServicePerimeter in the - * Access Policy - * google.identity.accesscontextmanager.v1.AccessPolicy. - */ - // const servicePerimeters = [1,2,3,4] - /** - * Optional. The etag for the version of the Access Policy - * google.identity.accesscontextmanager.v1.AccessPolicy that this - * replace operation is to be performed on. If, at the time of replace, the - * etag for the Access Policy stored in Access Context Manager is different - * from the specified etag, then the replace operation will not be performed - * and the call will fail. This field is not required. If etag is not - * provided, the operation will be performed as if a valid etag is provided. - */ - // const etag = 'abc123' - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callReplaceServicePerimeters() { - // Construct request - const request = { - parent, - servicePerimeters, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.replaceServicePerimeters(request); - const [response] = await operation.promise(); - console.log(response); - } - - callReplaceServicePerimeters(); - // [END accesscontextmanager_v1_generated_AccessContextManager_ReplaceServicePerimeters_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.set_iam_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.set_iam_policy.js deleted file mode 100644 index c504b30d177..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_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 accesscontextmanager_v1_generated_AccessContextManager_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 Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await accesscontextmanagerClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END accesscontextmanager_v1_generated_AccessContextManager_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-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.test_iam_permissions.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.test_iam_permissions.js deleted file mode 100644 index ef70853583a..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_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 accesscontextmanager_v1_generated_AccessContextManager_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 Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await accesscontextmanagerClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END accesscontextmanager_v1_generated_AccessContextManager_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-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_level.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_level.js deleted file mode 100644 index 8355eb85987..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_level.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(accessLevel, updateMask) { - // [START accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessLevel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The updated Access Level - * google.identity.accesscontextmanager.v1.AccessLevel. Syntactic - * correctness of the Access Level - * google.identity.accesscontextmanager.v1.AccessLevel is a - * precondition for creation. - */ - // const accessLevel = {} - /** - * Required. Mask to control which fields get updated. Must be non-empty. - */ - // const updateMask = {} - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callUpdateAccessLevel() { - // Construct request - const request = { - accessLevel, - updateMask, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.updateAccessLevel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateAccessLevel(); - // [END accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessLevel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_policy.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_policy.js deleted file mode 100644 index 2d29738361c..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_access_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(policy, updateMask) { - // [START accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The updated AccessPolicy. - */ - // const policy = {} - /** - * Required. Mask to control which fields get updated. Must be non-empty. - */ - // const updateMask = {} - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callUpdateAccessPolicy() { - // Construct request - const request = { - policy, - updateMask, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.updateAccessPolicy(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateAccessPolicy(); - // [END accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_gcp_user_access_binding.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_gcp_user_access_binding.js deleted file mode 100644 index 2873107428d..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_gcp_user_access_binding.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(gcpUserAccessBinding, updateMask) { - // [START accesscontextmanager_v1_generated_AccessContextManager_UpdateGcpUserAccessBinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. GcpUserAccessBinding - * google.identity.accesscontextmanager.v1.GcpUserAccessBinding - */ - // const gcpUserAccessBinding = {} - /** - * Required. Only the fields specified in this mask are updated. Because name and - * group_key cannot be changed, update_mask is required and must always be: - * update_mask { - * paths: "access_levels" - * } - */ - // const updateMask = {} - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callUpdateGcpUserAccessBinding() { - // Construct request - const request = { - gcpUserAccessBinding, - updateMask, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.updateGcpUserAccessBinding(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateGcpUserAccessBinding(); - // [END accesscontextmanager_v1_generated_AccessContextManager_UpdateGcpUserAccessBinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_service_perimeter.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_service_perimeter.js deleted file mode 100644 index 5c88f932f93..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/access_context_manager.update_service_perimeter.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(servicePerimeter, updateMask) { - // [START accesscontextmanager_v1_generated_AccessContextManager_UpdateServicePerimeter_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The updated `ServicePerimeter`. Syntactic correctness of the - * `ServicePerimeter` is a precondition for creation. - */ - // const servicePerimeter = {} - /** - * Required. Mask to control which fields get updated. Must be non-empty. - */ - // const updateMask = {} - - // Imports the Accesscontextmanager library - const {AccessContextManagerClient} = require('@google-cloud/access-context-manager').v1; - - // Instantiates a client - const accesscontextmanagerClient = new AccessContextManagerClient(); - - async function callUpdateServicePerimeter() { - // Construct request - const request = { - servicePerimeter, - updateMask, - }; - - // Run request - const [operation] = await accesscontextmanagerClient.updateServicePerimeter(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateServicePerimeter(); - // [END accesscontextmanager_v1_generated_AccessContextManager_UpdateServicePerimeter_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/snippet_metadata_google.identity.accesscontextmanager.v1.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/snippet_metadata_google.identity.accesscontextmanager.v1.json deleted file mode 100644 index 91524c383b0..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/samples/generated/v1/snippet_metadata_google.identity.accesscontextmanager.v1.json +++ /dev/null @@ -1,1183 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-accesscontextmanager", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.identity.accesscontextmanager.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ListAccessPolicies_async", - "title": "AccessContextManager listAccessPolicies Sample", - "origin": "API_DEFINITION", - "description": " Lists all [access policies] [google.identity.accesscontextmanager.v1.AccessPolicy] in an organization.", - "canonical": true, - "file": "access_context_manager.list_access_policies.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAccessPolicies", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListAccessPolicies", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.identity.accesscontextmanager.v1.ListAccessPoliciesResponse", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "ListAccessPolicies", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListAccessPolicies", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_GetAccessPolicy_async", - "title": "AccessContextManager getAccessPolicy Sample", - "origin": "API_DEFINITION", - "description": " Returns an [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] based on the name.", - "canonical": true, - "file": "access_context_manager.get_access_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAccessPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetAccessPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.identity.accesscontextmanager.v1.AccessPolicy", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "GetAccessPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetAccessPolicy", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_CreateAccessPolicy_async", - "title": "AccessContextManager createAccessPolicy Sample", - "origin": "API_DEFINITION", - "description": " Creates an access policy. This method fails if the organization already has an access policy. The long-running operation has a successful status after the access policy propagates to long-lasting storage. Syntactic and basic semantic errors are returned in `metadata` as a BadRequest proto.", - "canonical": true, - "file": "access_context_manager.create_access_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 96, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAccessPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateAccessPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "title", - "type": "TYPE_STRING" - }, - { - "name": "scopes", - "type": "TYPE_STRING[]" - }, - { - "name": "create_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "update_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "CreateAccessPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateAccessPolicy", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessPolicy_async", - "title": "AccessContextManager updateAccessPolicy Sample", - "origin": "API_DEFINITION", - "description": " Updates an [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy]. The long-running operation from this RPC has a successful status after the changes to the [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] propagate to long-lasting storage.", - "canonical": true, - "file": "access_context_manager.update_access_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAccessPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateAccessPolicy", - "async": true, - "parameters": [ - { - "name": "policy", - "type": ".google.identity.accesscontextmanager.v1.AccessPolicy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "UpdateAccessPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateAccessPolicy", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessPolicy_async", - "title": "AccessContextManager deleteAccessPolicy Sample", - "origin": "API_DEFINITION", - "description": " Deletes an [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] based on the resource name. The long-running operation has a successful status after the [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] is removed from long-lasting storage.", - "canonical": true, - "file": "access_context_manager.delete_access_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAccessPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteAccessPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "DeleteAccessPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteAccessPolicy", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ListAccessLevels_async", - "title": "AccessContextManager listAccessLevels Sample", - "origin": "API_DEFINITION", - "description": " Lists all [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] for an access policy.", - "canonical": true, - "file": "access_context_manager.list_access_levels.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAccessLevels", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListAccessLevels", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "access_level_format", - "type": ".google.identity.accesscontextmanager.v1.LevelFormat" - } - ], - "resultType": ".google.identity.accesscontextmanager.v1.ListAccessLevelsResponse", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "ListAccessLevels", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListAccessLevels", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_GetAccessLevel_async", - "title": "AccessContextManager getAccessLevel Sample", - "origin": "API_DEFINITION", - "description": " Gets an [access level] [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource name.", - "canonical": true, - "file": "access_context_manager.get_access_level.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAccessLevel", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetAccessLevel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "access_level_format", - "type": ".google.identity.accesscontextmanager.v1.LevelFormat" - } - ], - "resultType": ".google.identity.accesscontextmanager.v1.AccessLevel", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "GetAccessLevel", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetAccessLevel", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_CreateAccessLevel_async", - "title": "AccessContextManager createAccessLevel Sample", - "origin": "API_DEFINITION", - "description": " Creates an [access level] [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running operation from this RPC has a successful status after the [access level] [google.identity.accesscontextmanager.v1.AccessLevel] propagates to long-lasting storage. If [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] contain errors, an error response is returned for the first error encountered.", - "canonical": true, - "file": "access_context_manager.create_access_level.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAccessLevel", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateAccessLevel", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "access_level", - "type": ".google.identity.accesscontextmanager.v1.AccessLevel" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "CreateAccessLevel", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateAccessLevel", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessLevel_async", - "title": "AccessContextManager updateAccessLevel Sample", - "origin": "API_DEFINITION", - "description": " Updates an [access level] [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running operation from this RPC has a successful status after the changes to the [access level] [google.identity.accesscontextmanager.v1.AccessLevel] propagate to long-lasting storage. If [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] contain errors, an error response is returned for the first error encountered.", - "canonical": true, - "file": "access_context_manager.update_access_level.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAccessLevel", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateAccessLevel", - "async": true, - "parameters": [ - { - "name": "access_level", - "type": ".google.identity.accesscontextmanager.v1.AccessLevel" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "UpdateAccessLevel", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateAccessLevel", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessLevel_async", - "title": "AccessContextManager deleteAccessLevel Sample", - "origin": "API_DEFINITION", - "description": " Deletes an [access level] [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource name. The long-running operation from this RPC has a successful status after the [access level] [google.identity.accesscontextmanager.v1.AccessLevel] has been removed from long-lasting storage.", - "canonical": true, - "file": "access_context_manager.delete_access_level.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAccessLevel", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteAccessLevel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "DeleteAccessLevel", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteAccessLevel", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ReplaceAccessLevels_async", - "title": "AccessContextManager replaceAccessLevels Sample", - "origin": "API_DEFINITION", - "description": " Replaces all existing [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] in an [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with the [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] provided. This is done atomically. The long-running operation from this RPC has a successful status after all replacements propagate to long-lasting storage. If the replacement contains errors, an error response is returned for the first error encountered. Upon error, the replacement is cancelled, and existing [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] are not affected. The Operation.response field contains ReplaceAccessLevelsResponse. Removing [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] contained in existing [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] result in an error.", - "canonical": true, - "file": "access_context_manager.replace_access_levels.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReplaceAccessLevels", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ReplaceAccessLevels", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "access_levels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "ReplaceAccessLevels", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ReplaceAccessLevels", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ListServicePerimeters_async", - "title": "AccessContextManager listServicePerimeters Sample", - "origin": "API_DEFINITION", - "description": " Lists all [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] for an access policy.", - "canonical": true, - "file": "access_context_manager.list_service_perimeters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServicePerimeters", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListServicePerimeters", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.identity.accesscontextmanager.v1.ListServicePerimetersResponse", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "ListServicePerimeters", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListServicePerimeters", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_GetServicePerimeter_async", - "title": "AccessContextManager getServicePerimeter Sample", - "origin": "API_DEFINITION", - "description": " Gets a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the resource name.", - "canonical": true, - "file": "access_context_manager.get_service_perimeter.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetServicePerimeter", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetServicePerimeter", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.identity.accesscontextmanager.v1.ServicePerimeter", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "GetServicePerimeter", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetServicePerimeter", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_CreateServicePerimeter_async", - "title": "AccessContextManager createServicePerimeter Sample", - "origin": "API_DEFINITION", - "description": " Creates a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter]. The long-running operation from this RPC has a successful status after the [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] propagates to long-lasting storage. If a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] contains errors, an error response is returned for the first error encountered.", - "canonical": true, - "file": "access_context_manager.create_service_perimeter.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateServicePerimeter", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateServicePerimeter", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_perimeter", - "type": ".google.identity.accesscontextmanager.v1.ServicePerimeter" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "CreateServicePerimeter", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateServicePerimeter", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_UpdateServicePerimeter_async", - "title": "AccessContextManager updateServicePerimeter Sample", - "origin": "API_DEFINITION", - "description": " Updates a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter]. The long-running operation from this RPC has a successful status after the [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] propagates to long-lasting storage. If a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] contains errors, an error response is returned for the first error encountered.", - "canonical": true, - "file": "access_context_manager.update_service_perimeter.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateServicePerimeter", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateServicePerimeter", - "async": true, - "parameters": [ - { - "name": "service_perimeter", - "type": ".google.identity.accesscontextmanager.v1.ServicePerimeter" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "UpdateServicePerimeter", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateServicePerimeter", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_DeleteServicePerimeter_async", - "title": "AccessContextManager deleteServicePerimeter Sample", - "origin": "API_DEFINITION", - "description": " Deletes a [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the resource name. The long-running operation from this RPC has a successful status after the [service perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter] is removed from long-lasting storage.", - "canonical": true, - "file": "access_context_manager.delete_service_perimeter.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteServicePerimeter", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteServicePerimeter", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "DeleteServicePerimeter", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteServicePerimeter", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ReplaceServicePerimeters_async", - "title": "AccessContextManager replaceServicePerimeters Sample", - "origin": "API_DEFINITION", - "description": " Replace all existing [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] in an [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with the [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] provided. This is done atomically. The long-running operation from this RPC has a successful status after all replacements propagate to long-lasting storage. Replacements containing errors result in an error response for the first error encountered. Upon an error, replacement are cancelled and existing [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] are not affected. The Operation.response field contains ReplaceServicePerimetersResponse.", - "canonical": true, - "file": "access_context_manager.replace_service_perimeters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReplaceServicePerimeters", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ReplaceServicePerimeters", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_perimeters", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "ReplaceServicePerimeters", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ReplaceServicePerimeters", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_CommitServicePerimeters_async", - "title": "AccessContextManager commitServicePerimeters Sample", - "origin": "API_DEFINITION", - "description": " Commits the dry-run specification for all the [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] in an [access policy][google.identity.accesscontextmanager.v1.AccessPolicy]. A commit operation on a service perimeter involves copying its `spec` field to the `status` field of the service perimeter. Only [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] with `use_explicit_dry_run_spec` field set to true are affected by a commit operation. The long-running operation from this RPC has a successful status after the dry-run specifications for all the [service perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] have been committed. If a commit fails, it causes the long-running operation to return an error response and the entire commit operation is cancelled. When successful, the Operation.response field contains CommitServicePerimetersResponse. The `dry_run` and the `spec` fields are cleared after a successful commit operation.", - "canonical": true, - "file": "access_context_manager.commit_service_perimeters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CommitServicePerimeters", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CommitServicePerimeters", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "CommitServicePerimeters", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CommitServicePerimeters", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_ListGcpUserAccessBindings_async", - "title": "AccessContextManager listGcpUserAccessBindings Sample", - "origin": "API_DEFINITION", - "description": " Lists all [GcpUserAccessBindings] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] for a Google Cloud organization.", - "canonical": true, - "file": "access_context_manager.list_gcp_user_access_bindings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListGcpUserAccessBindings", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListGcpUserAccessBindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "ListGcpUserAccessBindings", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.ListGcpUserAccessBindings", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_GetGcpUserAccessBinding_async", - "title": "AccessContextManager getGcpUserAccessBinding Sample", - "origin": "API_DEFINITION", - "description": " Gets the [GcpUserAccessBinding] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] with the given name.", - "canonical": true, - "file": "access_context_manager.get_gcp_user_access_binding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGcpUserAccessBinding", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetGcpUserAccessBinding", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.identity.accesscontextmanager.v1.GcpUserAccessBinding", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "GetGcpUserAccessBinding", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetGcpUserAccessBinding", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_CreateGcpUserAccessBinding_async", - "title": "AccessContextManager createGcpUserAccessBinding Sample", - "origin": "API_DEFINITION", - "description": " Creates a [GcpUserAccessBinding] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. If the client specifies a [name] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.name], the server ignores it. Fails if a resource already exists with the same [group_key] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.group_key]. Completion of this long-running operation does not necessarily signify that the new binding is deployed onto all affected users, which may take more time.", - "canonical": true, - "file": "access_context_manager.create_gcp_user_access_binding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateGcpUserAccessBinding", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateGcpUserAccessBinding", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "gcp_user_access_binding", - "type": ".google.identity.accesscontextmanager.v1.GcpUserAccessBinding" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "CreateGcpUserAccessBinding", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.CreateGcpUserAccessBinding", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_UpdateGcpUserAccessBinding_async", - "title": "AccessContextManager updateGcpUserAccessBinding Sample", - "origin": "API_DEFINITION", - "description": " Updates a [GcpUserAccessBinding] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. Completion of this long-running operation does not necessarily signify that the changed binding is deployed onto all affected users, which may take more time.", - "canonical": true, - "file": "access_context_manager.update_gcp_user_access_binding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateGcpUserAccessBinding", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateGcpUserAccessBinding", - "async": true, - "parameters": [ - { - "name": "gcp_user_access_binding", - "type": ".google.identity.accesscontextmanager.v1.GcpUserAccessBinding" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "UpdateGcpUserAccessBinding", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.UpdateGcpUserAccessBinding", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_DeleteGcpUserAccessBinding_async", - "title": "AccessContextManager deleteGcpUserAccessBinding Sample", - "origin": "API_DEFINITION", - "description": " Deletes a [GcpUserAccessBinding] [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. Completion of this long-running operation does not necessarily signify that the binding deletion is deployed onto all affected users, which may take more time.", - "canonical": true, - "file": "access_context_manager.delete_gcp_user_access_binding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteGcpUserAccessBinding", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteGcpUserAccessBinding", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "DeleteGcpUserAccessBinding", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.DeleteGcpUserAccessBinding", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_SetIamPolicy_async", - "title": "AccessContextManager setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the IAM policy for the specified Access Context Manager [access policy][google.identity.accesscontextmanager.v1.AccessPolicy]. This method replaces the existing IAM policy on the access policy. The IAM policy controls the set of users who can perform specific operations on the Access Context Manager [access policy][google.identity.accesscontextmanager.v1.AccessPolicy].", - "canonical": true, - "file": "access_context_manager.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.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": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.SetIamPolicy", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_GetIamPolicy_async", - "title": "AccessContextManager getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the IAM policy for the specified Access Context Manager [access policy][google.identity.accesscontextmanager.v1.AccessPolicy].", - "canonical": true, - "file": "access_context_manager.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.GetIamPolicy", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - }, - { - "regionTag": "accesscontextmanager_v1_generated_AccessContextManager_TestIamPermissions_async", - "title": "AccessContextManager testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns the IAM permissions that the caller has on the specified Access Context Manager resource. The resource can be an [AccessPolicy][google.identity.accesscontextmanager.v1.AccessPolicy], [AccessLevel][google.identity.accesscontextmanager.v1.AccessLevel], or [ServicePerimeter][google.identity.accesscontextmanager.v1.ServicePerimeter ]. This method does not support other resources.", - "canonical": true, - "file": "access_context_manager.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "AccessContextManagerClient", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManagerClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager.TestIamPermissions", - "service": { - "shortName": "AccessContextManager", - "fullName": "google.identity.accesscontextmanager.v1.AccessContextManager" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/index.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/index.ts deleted file mode 100644 index 110dc64554d..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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 AccessContextManagerClient = v1.AccessContextManagerClient; -type AccessContextManagerClient = v1.AccessContextManagerClient; -export {v1, AccessContextManagerClient}; -export default {v1, AccessContextManagerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client.ts deleted file mode 100644 index 3df0a032f95..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client.ts +++ /dev/null @@ -1,3706 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/access_context_manager_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './access_context_manager_client_config.json'; -const version = require('../../../package.json').version; - -/** - * API for setting [access levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] and [service - * perimeters] [google.identity.accesscontextmanager.v1.ServicePerimeter] - * for Google Cloud projects. Each organization has one [access policy] - * [google.identity.accesscontextmanager.v1.AccessPolicy] that contains the - * [access levels] [google.identity.accesscontextmanager.v1.AccessLevel] - * and [service perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter]. This - * [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] is - * applicable to all resources in the organization. - * AccessPolicies - * @class - * @memberof v1 - */ -export class AccessContextManagerClient { - 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; - accessContextManagerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AccessContextManagerClient. - * - * @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 AccessContextManagerClient({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 AccessContextManagerClient; - 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 = { - accessLevelPathTemplate: new this._gaxModule.PathTemplate( - 'accessPolicies/{access_policy}/accessLevels/{access_level}' - ), - accessPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'accessPolicies/{access_policy}' - ), - gcpUserAccessBindingPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/gcpUserAccessBindings/{gcp_user_access_binding}' - ), - organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' - ), - servicePerimeterPathTemplate: new this._gaxModule.PathTemplate( - 'accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}' - ), - }; - - // 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 = { - listAccessPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'accessPolicies'), - listAccessLevels: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'accessLevels'), - listServicePerimeters: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'servicePerimeters'), - listGcpUserAccessBindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'gcpUserAccessBindings') - }; - - 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.GetOperation',get: '/v1/{name=operations/**}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createAccessPolicyResponse = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessPolicy') as gax.protobuf.Type; - const createAccessPolicyMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const updateAccessPolicyResponse = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessPolicy') as gax.protobuf.Type; - const updateAccessPolicyMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const deleteAccessPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteAccessPolicyMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const createAccessLevelResponse = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessLevel') as gax.protobuf.Type; - const createAccessLevelMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const updateAccessLevelResponse = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessLevel') as gax.protobuf.Type; - const updateAccessLevelMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const deleteAccessLevelResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteAccessLevelMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const replaceAccessLevelsResponse = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsResponse') as gax.protobuf.Type; - const replaceAccessLevelsMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const createServicePerimeterResponse = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.ServicePerimeter') as gax.protobuf.Type; - const createServicePerimeterMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const updateServicePerimeterResponse = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.ServicePerimeter') as gax.protobuf.Type; - const updateServicePerimeterMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const deleteServicePerimeterResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteServicePerimeterMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const replaceServicePerimetersResponse = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersResponse') as gax.protobuf.Type; - const replaceServicePerimetersMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const commitServicePerimetersResponse = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.CommitServicePerimetersResponse') as gax.protobuf.Type; - const commitServicePerimetersMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.AccessContextManagerOperationMetadata') as gax.protobuf.Type; - const createGcpUserAccessBindingResponse = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.GcpUserAccessBinding') as gax.protobuf.Type; - const createGcpUserAccessBindingMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.GcpUserAccessBindingOperationMetadata') as gax.protobuf.Type; - const updateGcpUserAccessBindingResponse = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.GcpUserAccessBinding') as gax.protobuf.Type; - const updateGcpUserAccessBindingMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.GcpUserAccessBindingOperationMetadata') as gax.protobuf.Type; - const deleteGcpUserAccessBindingResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteGcpUserAccessBindingMetadata = protoFilesRoot.lookup( - '.google.identity.accesscontextmanager.v1.GcpUserAccessBindingOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createAccessPolicy: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createAccessPolicyResponse.decode.bind(createAccessPolicyResponse), - createAccessPolicyMetadata.decode.bind(createAccessPolicyMetadata)), - updateAccessPolicy: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateAccessPolicyResponse.decode.bind(updateAccessPolicyResponse), - updateAccessPolicyMetadata.decode.bind(updateAccessPolicyMetadata)), - deleteAccessPolicy: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteAccessPolicyResponse.decode.bind(deleteAccessPolicyResponse), - deleteAccessPolicyMetadata.decode.bind(deleteAccessPolicyMetadata)), - createAccessLevel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createAccessLevelResponse.decode.bind(createAccessLevelResponse), - createAccessLevelMetadata.decode.bind(createAccessLevelMetadata)), - updateAccessLevel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateAccessLevelResponse.decode.bind(updateAccessLevelResponse), - updateAccessLevelMetadata.decode.bind(updateAccessLevelMetadata)), - deleteAccessLevel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteAccessLevelResponse.decode.bind(deleteAccessLevelResponse), - deleteAccessLevelMetadata.decode.bind(deleteAccessLevelMetadata)), - replaceAccessLevels: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - replaceAccessLevelsResponse.decode.bind(replaceAccessLevelsResponse), - replaceAccessLevelsMetadata.decode.bind(replaceAccessLevelsMetadata)), - createServicePerimeter: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createServicePerimeterResponse.decode.bind(createServicePerimeterResponse), - createServicePerimeterMetadata.decode.bind(createServicePerimeterMetadata)), - updateServicePerimeter: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateServicePerimeterResponse.decode.bind(updateServicePerimeterResponse), - updateServicePerimeterMetadata.decode.bind(updateServicePerimeterMetadata)), - deleteServicePerimeter: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteServicePerimeterResponse.decode.bind(deleteServicePerimeterResponse), - deleteServicePerimeterMetadata.decode.bind(deleteServicePerimeterMetadata)), - replaceServicePerimeters: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - replaceServicePerimetersResponse.decode.bind(replaceServicePerimetersResponse), - replaceServicePerimetersMetadata.decode.bind(replaceServicePerimetersMetadata)), - commitServicePerimeters: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - commitServicePerimetersResponse.decode.bind(commitServicePerimetersResponse), - commitServicePerimetersMetadata.decode.bind(commitServicePerimetersMetadata)), - createGcpUserAccessBinding: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createGcpUserAccessBindingResponse.decode.bind(createGcpUserAccessBindingResponse), - createGcpUserAccessBindingMetadata.decode.bind(createGcpUserAccessBindingMetadata)), - updateGcpUserAccessBinding: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateGcpUserAccessBindingResponse.decode.bind(updateGcpUserAccessBindingResponse), - updateGcpUserAccessBindingMetadata.decode.bind(updateGcpUserAccessBindingMetadata)), - deleteGcpUserAccessBinding: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteGcpUserAccessBindingResponse.decode.bind(deleteGcpUserAccessBindingResponse), - deleteGcpUserAccessBindingMetadata.decode.bind(deleteGcpUserAccessBindingMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.identity.accesscontextmanager.v1.AccessContextManager', 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.accessContextManagerStub) { - return this.accessContextManagerStub; - } - - // Put together the "service stub" for - // google.identity.accesscontextmanager.v1.AccessContextManager. - this.accessContextManagerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.identity.accesscontextmanager.v1.AccessContextManager') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.identity.accesscontextmanager.v1.AccessContextManager, - 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 accessContextManagerStubMethods = - ['listAccessPolicies', 'getAccessPolicy', 'createAccessPolicy', 'updateAccessPolicy', 'deleteAccessPolicy', 'listAccessLevels', 'getAccessLevel', 'createAccessLevel', 'updateAccessLevel', 'deleteAccessLevel', 'replaceAccessLevels', 'listServicePerimeters', 'getServicePerimeter', 'createServicePerimeter', 'updateServicePerimeter', 'deleteServicePerimeter', 'replaceServicePerimeters', 'commitServicePerimeters', 'listGcpUserAccessBindings', 'getGcpUserAccessBinding', 'createGcpUserAccessBinding', 'updateGcpUserAccessBinding', 'deleteGcpUserAccessBinding', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions']; - for (const methodName of accessContextManagerStubMethods) { - const callPromise = this.accessContextManagerStub.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.accessContextManagerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'accesscontextmanager.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 'accesscontextmanager.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 an [access policy] - * [google.identity.accesscontextmanager.v1.AccessPolicy] based on the name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name for the access policy to get. - * - * Format `accessPolicies/{policy_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.identity.accesscontextmanager.v1.AccessPolicy|AccessPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.get_access_policy.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_GetAccessPolicy_async - */ - getAccessPolicy( - request?: protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IAccessPolicy, - protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|undefined, {}|undefined - ]>; - getAccessPolicy( - request: protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.identity.accesscontextmanager.v1.IAccessPolicy, - protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|null|undefined, - {}|null|undefined>): void; - getAccessPolicy( - request: protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest, - callback: Callback< - protos.google.identity.accesscontextmanager.v1.IAccessPolicy, - protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|null|undefined, - {}|null|undefined>): void; - getAccessPolicy( - request?: protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.identity.accesscontextmanager.v1.IAccessPolicy, - protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.identity.accesscontextmanager.v1.IAccessPolicy, - protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IAccessPolicy, - protos.google.identity.accesscontextmanager.v1.IGetAccessPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getAccessPolicy(request, options, callback); - } -/** - * Gets an [access level] - * [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource - * name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name for the [Access Level] - * [google.identity.accesscontextmanager.v1.AccessLevel]. - * - * Format: - * `accessPolicies/{policy_id}/accessLevels/{access_level_id}` - * @param {google.identity.accesscontextmanager.v1.LevelFormat} request.accessLevelFormat - * Whether to return `BasicLevels` in the Cloud Common Expression - * Language rather than as `BasicLevels`. Defaults to AS_DEFINED, where - * [Access Levels] [google.identity.accesscontextmanager.v1.AccessLevel] - * are returned as `BasicLevels` or `CustomLevels` based on how they were - * created. If set to CEL, all [Access Levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] are returned as - * `CustomLevels`. In the CEL case, `BasicLevels` are translated to equivalent - * `CustomLevels`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.identity.accesscontextmanager.v1.AccessLevel|AccessLevel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.get_access_level.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_GetAccessLevel_async - */ - getAccessLevel( - request?: protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest, - options?: CallOptions): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IAccessLevel, - protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|undefined, {}|undefined - ]>; - getAccessLevel( - request: protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest, - options: CallOptions, - callback: Callback< - protos.google.identity.accesscontextmanager.v1.IAccessLevel, - protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|null|undefined, - {}|null|undefined>): void; - getAccessLevel( - request: protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest, - callback: Callback< - protos.google.identity.accesscontextmanager.v1.IAccessLevel, - protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|null|undefined, - {}|null|undefined>): void; - getAccessLevel( - request?: protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.identity.accesscontextmanager.v1.IAccessLevel, - protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.identity.accesscontextmanager.v1.IAccessLevel, - protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IAccessLevel, - protos.google.identity.accesscontextmanager.v1.IGetAccessLevelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getAccessLevel(request, options, callback); - } -/** - * Gets a [service perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the - * resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name for the [Service Perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter]. - * - * Format: - * `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_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.identity.accesscontextmanager.v1.ServicePerimeter|ServicePerimeter}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.get_service_perimeter.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_GetServicePerimeter_async - */ - getServicePerimeter( - request?: protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest, - options?: CallOptions): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IServicePerimeter, - protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|undefined, {}|undefined - ]>; - getServicePerimeter( - request: protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest, - options: CallOptions, - callback: Callback< - protos.google.identity.accesscontextmanager.v1.IServicePerimeter, - protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|null|undefined, - {}|null|undefined>): void; - getServicePerimeter( - request: protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest, - callback: Callback< - protos.google.identity.accesscontextmanager.v1.IServicePerimeter, - protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|null|undefined, - {}|null|undefined>): void; - getServicePerimeter( - request?: protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.identity.accesscontextmanager.v1.IServicePerimeter, - protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.identity.accesscontextmanager.v1.IServicePerimeter, - protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IServicePerimeter, - protos.google.identity.accesscontextmanager.v1.IGetServicePerimeterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getServicePerimeter(request, options, callback); - } -/** - * Gets the [GcpUserAccessBinding] - * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] with - * the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding|GcpUserAccessBinding}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.get_gcp_user_access_binding.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_GetGcpUserAccessBinding_async - */ - getGcpUserAccessBinding( - request?: protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest, - options?: CallOptions): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, - protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|undefined, {}|undefined - ]>; - getGcpUserAccessBinding( - request: protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest, - options: CallOptions, - callback: Callback< - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, - protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|null|undefined, - {}|null|undefined>): void; - getGcpUserAccessBinding( - request: protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest, - callback: Callback< - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, - protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|null|undefined, - {}|null|undefined>): void; - getGcpUserAccessBinding( - request?: protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, - protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, - protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding, - protos.google.identity.accesscontextmanager.v1.IGetGcpUserAccessBindingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getGcpUserAccessBinding(request, options, callback); - } -/** - * Sets the IAM policy for the specified Access Context Manager - * {@link protos.google.identity.accesscontextmanager.v1.AccessPolicy|access policy}. - * This method replaces the existing IAM policy on the access policy. The IAM - * policy controls the set of users who can perform specific operations on the - * Access Context Manager [access - * policy][google.identity.accesscontextmanager.v1.AccessPolicy]. - * - * @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/access_context_manager.set_iam_policy.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_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 policy for the specified Access Context Manager - * {@link protos.google.identity.accesscontextmanager.v1.AccessPolicy|access policy}. - * - * @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/access_context_manager.get_iam_policy.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_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 the IAM permissions that the caller has on the specified Access - * Context Manager resource. The resource can be an - * {@link protos.google.identity.accesscontextmanager.v1.AccessPolicy|AccessPolicy}, - * {@link protos.google.identity.accesscontextmanager.v1.AccessLevel|AccessLevel}, or - * [ServicePerimeter][google.identity.accesscontextmanager.v1.ServicePerimeter - * ]. This method does not support other resources. - * - * @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/access_context_manager.test_iam_permissions.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_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 an access policy. This method fails if the organization already has - * an access policy. The long-running operation has a successful status - * after the access policy propagates to long-lasting storage. - * Syntactic and basic semantic errors are returned in `metadata` as a - * BadRequest proto. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Output only. Resource name of the `AccessPolicy`. Format: - * `accessPolicies/{access_policy}` - * @param {string} request.parent - * Required. The parent of this `AccessPolicy` in the Cloud Resource - * Hierarchy. Currently immutable once created. Format: - * `organizations/{organization_id}` - * @param {string} request.title - * Required. Human readable title. Does not affect behavior. - * @param {string[]} request.scopes - * The scopes of a policy define which resources an ACM policy can restrict, - * and where ACM resources can be referenced. - * For example, a policy with scopes=["folders/123"] has the following - * behavior: - * - vpcsc perimeters can only restrict projects within folders/123 - * - access levels can only be referenced by resources within folders/123. - * If empty, there are no limitations on which resources can be restricted by - * an ACM policy, and there are no limitations on where ACM resources can be - * referenced. - * Only one policy can include a given scope (attempting to create a second - * policy which includes "folders/123" will result in an error). - * Currently, scopes cannot be modified after a policy is created. - * Currently, policies can only have a single scope. - * Format: list of `folders/{folder_number}` or `projects/{project_number}` - * @param {google.protobuf.Timestamp} request.createTime - * Output only. Time the `AccessPolicy` was created in UTC. - * @param {google.protobuf.Timestamp} request.updateTime - * Output only. Time the `AccessPolicy` was updated in UTC. - * @param {string} request.etag - * Output only. An opaque identifier for the current version of the - * `AccessPolicy`. This will always be a strongly validated etag, meaning that - * two Access Polices will be identical if and only if their etags are - * identical. Clients should not expect this to be in any specific format. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.create_access_policy.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateAccessPolicy_async - */ - createAccessPolicy( - request?: protos.google.identity.accesscontextmanager.v1.IAccessPolicy, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createAccessPolicy( - request: protos.google.identity.accesscontextmanager.v1.IAccessPolicy, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAccessPolicy( - request: protos.google.identity.accesscontextmanager.v1.IAccessPolicy, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAccessPolicy( - request?: protos.google.identity.accesscontextmanager.v1.IAccessPolicy, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.createAccessPolicy(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createAccessPolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.create_access_policy.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateAccessPolicy_async - */ - async checkCreateAccessPolicyProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAccessPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an [access policy] - * [google.identity.accesscontextmanager.v1.AccessPolicy]. The - * long-running operation from this RPC has a successful status after the - * changes to the [access policy] - * [google.identity.accesscontextmanager.v1.AccessPolicy] propagate - * to long-lasting storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.identity.accesscontextmanager.v1.AccessPolicy} request.policy - * Required. The updated AccessPolicy. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask to control which fields get updated. Must be non-empty. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.update_access_policy.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessPolicy_async - */ - updateAccessPolicy( - request?: protos.google.identity.accesscontextmanager.v1.IUpdateAccessPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateAccessPolicy( - request: protos.google.identity.accesscontextmanager.v1.IUpdateAccessPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAccessPolicy( - request: protos.google.identity.accesscontextmanager.v1.IUpdateAccessPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAccessPolicy( - request?: protos.google.identity.accesscontextmanager.v1.IUpdateAccessPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'policy.name': request.policy!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAccessPolicy(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateAccessPolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.update_access_policy.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessPolicy_async - */ - async checkUpdateAccessPolicyProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAccessPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes an [access policy] - * [google.identity.accesscontextmanager.v1.AccessPolicy] based on the - * resource name. The long-running operation has a successful status after the - * [access policy] [google.identity.accesscontextmanager.v1.AccessPolicy] - * is removed from long-lasting storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name for the access policy to delete. - * - * Format `accessPolicies/{policy_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/access_context_manager.delete_access_policy.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessPolicy_async - */ - deleteAccessPolicy( - request?: protos.google.identity.accesscontextmanager.v1.IDeleteAccessPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteAccessPolicy( - request: protos.google.identity.accesscontextmanager.v1.IDeleteAccessPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAccessPolicy( - request: protos.google.identity.accesscontextmanager.v1.IDeleteAccessPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAccessPolicy( - request?: protos.google.identity.accesscontextmanager.v1.IDeleteAccessPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAccessPolicy(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteAccessPolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.delete_access_policy.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessPolicy_async - */ - async checkDeleteAccessPolicyProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAccessPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates an [access level] - * [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running - * operation from this RPC has a successful status after the [access - * level] [google.identity.accesscontextmanager.v1.AccessLevel] - * propagates to long-lasting storage. If [access levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] contain - * errors, an error response is returned for the first error encountered. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name for the access policy which owns this [Access - * Level] [google.identity.accesscontextmanager.v1.AccessLevel]. - * - * Format: `accessPolicies/{policy_id}` - * @param {google.identity.accesscontextmanager.v1.AccessLevel} request.accessLevel - * Required. The [Access Level] - * [google.identity.accesscontextmanager.v1.AccessLevel] to create. - * Syntactic correctness of the [Access Level] - * [google.identity.accesscontextmanager.v1.AccessLevel] is a - * precondition for creation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.create_access_level.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateAccessLevel_async - */ - createAccessLevel( - request?: protos.google.identity.accesscontextmanager.v1.ICreateAccessLevelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createAccessLevel( - request: protos.google.identity.accesscontextmanager.v1.ICreateAccessLevelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAccessLevel( - request: protos.google.identity.accesscontextmanager.v1.ICreateAccessLevelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAccessLevel( - request?: protos.google.identity.accesscontextmanager.v1.ICreateAccessLevelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createAccessLevel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createAccessLevel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.create_access_level.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateAccessLevel_async - */ - async checkCreateAccessLevelProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAccessLevel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an [access level] - * [google.identity.accesscontextmanager.v1.AccessLevel]. The long-running - * operation from this RPC has a successful status after the changes to - * the [access level] - * [google.identity.accesscontextmanager.v1.AccessLevel] propagate - * to long-lasting storage. If [access levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] contain - * errors, an error response is returned for the first error encountered. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.identity.accesscontextmanager.v1.AccessLevel} request.accessLevel - * Required. The updated [Access Level] - * [google.identity.accesscontextmanager.v1.AccessLevel]. Syntactic - * correctness of the [Access Level] - * [google.identity.accesscontextmanager.v1.AccessLevel] is a - * precondition for creation. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask to control which fields get updated. Must be non-empty. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.update_access_level.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessLevel_async - */ - updateAccessLevel( - request?: protos.google.identity.accesscontextmanager.v1.IUpdateAccessLevelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateAccessLevel( - request: protos.google.identity.accesscontextmanager.v1.IUpdateAccessLevelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAccessLevel( - request: protos.google.identity.accesscontextmanager.v1.IUpdateAccessLevelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAccessLevel( - request?: protos.google.identity.accesscontextmanager.v1.IUpdateAccessLevelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'access_level.name': request.accessLevel!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAccessLevel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateAccessLevel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.update_access_level.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateAccessLevel_async - */ - async checkUpdateAccessLevelProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAccessLevel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes an [access level] - * [google.identity.accesscontextmanager.v1.AccessLevel] based on the resource - * name. The long-running operation from this RPC has a successful status - * after the [access level] - * [google.identity.accesscontextmanager.v1.AccessLevel] has been removed - * from long-lasting storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name for the [Access Level] - * [google.identity.accesscontextmanager.v1.AccessLevel]. - * - * Format: - * `accessPolicies/{policy_id}/accessLevels/{access_level_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/access_context_manager.delete_access_level.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessLevel_async - */ - deleteAccessLevel( - request?: protos.google.identity.accesscontextmanager.v1.IDeleteAccessLevelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteAccessLevel( - request: protos.google.identity.accesscontextmanager.v1.IDeleteAccessLevelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAccessLevel( - request: protos.google.identity.accesscontextmanager.v1.IDeleteAccessLevelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteAccessLevel( - request?: protos.google.identity.accesscontextmanager.v1.IDeleteAccessLevelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAccessLevel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteAccessLevel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.delete_access_level.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteAccessLevel_async - */ - async checkDeleteAccessLevelProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAccessLevel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Replaces all existing [access levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] in an [access - * policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with - * the [access levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] provided. This - * is done atomically. The long-running operation from this RPC has a - * successful status after all replacements propagate to long-lasting - * storage. If the replacement contains errors, an error response is returned - * for the first error encountered. Upon error, the replacement is cancelled, - * and existing [access levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] are not - * affected. The Operation.response field contains - * ReplaceAccessLevelsResponse. Removing [access levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] contained in existing - * [service perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] result in an - * error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name for the access policy which owns these - * [Access Levels] - * [google.identity.accesscontextmanager.v1.AccessLevel]. - * - * Format: `accessPolicies/{policy_id}` - * @param {number[]} request.accessLevels - * Required. The desired [Access Levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] that should - * replace all existing [Access Levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] in the - * [Access Policy] - * [google.identity.accesscontextmanager.v1.AccessPolicy]. - * @param {string} request.etag - * Optional. The etag for the version of the [Access Policy] - * [google.identity.accesscontextmanager.v1.AccessPolicy] that this - * replace operation is to be performed on. If, at the time of replace, the - * etag for the Access Policy stored in Access Context Manager is different - * from the specified etag, then the replace operation will not be performed - * and the call will fail. This field is not required. If etag is not - * provided, the operation will be performed as if a valid etag is provided. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.replace_access_levels.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ReplaceAccessLevels_async - */ - replaceAccessLevels( - request?: protos.google.identity.accesscontextmanager.v1.IReplaceAccessLevelsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - replaceAccessLevels( - request: protos.google.identity.accesscontextmanager.v1.IReplaceAccessLevelsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - replaceAccessLevels( - request: protos.google.identity.accesscontextmanager.v1.IReplaceAccessLevelsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - replaceAccessLevels( - request?: protos.google.identity.accesscontextmanager.v1.IReplaceAccessLevelsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.replaceAccessLevels(request, options, callback); - } -/** - * Check the status of the long running operation returned by `replaceAccessLevels()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.replace_access_levels.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ReplaceAccessLevels_async - */ - async checkReplaceAccessLevelsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.replaceAccessLevels, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a [service perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter]. The - * long-running operation from this RPC has a successful status after the - * [service perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] - * propagates to long-lasting storage. If a [service perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] contains - * errors, an error response is returned for the first error encountered. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name for the access policy which owns this [Service - * Perimeter] [google.identity.accesscontextmanager.v1.ServicePerimeter]. - * - * Format: `accessPolicies/{policy_id}` - * @param {google.identity.accesscontextmanager.v1.ServicePerimeter} request.servicePerimeter - * Required. The [Service Perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] to create. - * Syntactic correctness of the [Service Perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] is a - * precondition for creation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.create_service_perimeter.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateServicePerimeter_async - */ - createServicePerimeter( - request?: protos.google.identity.accesscontextmanager.v1.ICreateServicePerimeterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createServicePerimeter( - request: protos.google.identity.accesscontextmanager.v1.ICreateServicePerimeterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createServicePerimeter( - request: protos.google.identity.accesscontextmanager.v1.ICreateServicePerimeterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createServicePerimeter( - request?: protos.google.identity.accesscontextmanager.v1.ICreateServicePerimeterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createServicePerimeter(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createServicePerimeter()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.create_service_perimeter.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateServicePerimeter_async - */ - async checkCreateServicePerimeterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createServicePerimeter, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a [service perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter]. The - * long-running operation from this RPC has a successful status after the - * [service perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] - * propagates to long-lasting storage. If a [service perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] contains - * errors, an error response is returned for the first error encountered. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.identity.accesscontextmanager.v1.ServicePerimeter} request.servicePerimeter - * Required. The updated `ServicePerimeter`. Syntactic correctness of the - * `ServicePerimeter` is a precondition for creation. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask to control which fields get updated. Must be non-empty. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.update_service_perimeter.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateServicePerimeter_async - */ - updateServicePerimeter( - request?: protos.google.identity.accesscontextmanager.v1.IUpdateServicePerimeterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateServicePerimeter( - request: protos.google.identity.accesscontextmanager.v1.IUpdateServicePerimeterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateServicePerimeter( - request: protos.google.identity.accesscontextmanager.v1.IUpdateServicePerimeterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateServicePerimeter( - request?: protos.google.identity.accesscontextmanager.v1.IUpdateServicePerimeterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as 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_perimeter.name': request.servicePerimeter!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateServicePerimeter(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateServicePerimeter()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.update_service_perimeter.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateServicePerimeter_async - */ - async checkUpdateServicePerimeterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateServicePerimeter, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a [service perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] based on the - * resource name. The long-running operation from this RPC has a successful - * status after the [service perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] is removed from - * long-lasting storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name for the [Service Perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter]. - * - * Format: - * `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_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/access_context_manager.delete_service_perimeter.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteServicePerimeter_async - */ - deleteServicePerimeter( - request?: protos.google.identity.accesscontextmanager.v1.IDeleteServicePerimeterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteServicePerimeter( - request: protos.google.identity.accesscontextmanager.v1.IDeleteServicePerimeterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteServicePerimeter( - request: protos.google.identity.accesscontextmanager.v1.IDeleteServicePerimeterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteServicePerimeter( - request?: protos.google.identity.accesscontextmanager.v1.IDeleteServicePerimeterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteServicePerimeter(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteServicePerimeter()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.delete_service_perimeter.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteServicePerimeter_async - */ - async checkDeleteServicePerimeterProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteServicePerimeter, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Replace all existing [service perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] in an [access - * policy] [google.identity.accesscontextmanager.v1.AccessPolicy] with the - * [service perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] provided. This - * is done atomically. The long-running operation from this RPC has a - * successful status after all replacements propagate to long-lasting storage. - * Replacements containing errors result in an error response for the first - * error encountered. Upon an error, replacement are cancelled and existing - * [service perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] are not - * affected. The Operation.response field contains - * ReplaceServicePerimetersResponse. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name for the access policy which owns these - * [Service Perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter]. - * - * Format: `accessPolicies/{policy_id}` - * @param {number[]} request.servicePerimeters - * Required. The desired [Service Perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] that should - * replace all existing [Service Perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] in the - * [Access Policy] - * [google.identity.accesscontextmanager.v1.AccessPolicy]. - * @param {string} request.etag - * Optional. The etag for the version of the [Access Policy] - * [google.identity.accesscontextmanager.v1.AccessPolicy] that this - * replace operation is to be performed on. If, at the time of replace, the - * etag for the Access Policy stored in Access Context Manager is different - * from the specified etag, then the replace operation will not be performed - * and the call will fail. This field is not required. If etag is not - * provided, the operation will be performed as if a valid etag is provided. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.replace_service_perimeters.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ReplaceServicePerimeters_async - */ - replaceServicePerimeters( - request?: protos.google.identity.accesscontextmanager.v1.IReplaceServicePerimetersRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - replaceServicePerimeters( - request: protos.google.identity.accesscontextmanager.v1.IReplaceServicePerimetersRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - replaceServicePerimeters( - request: protos.google.identity.accesscontextmanager.v1.IReplaceServicePerimetersRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - replaceServicePerimeters( - request?: protos.google.identity.accesscontextmanager.v1.IReplaceServicePerimetersRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.replaceServicePerimeters(request, options, callback); - } -/** - * Check the status of the long running operation returned by `replaceServicePerimeters()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.replace_service_perimeters.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ReplaceServicePerimeters_async - */ - async checkReplaceServicePerimetersProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.replaceServicePerimeters, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Commits the dry-run specification for all the [service perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] in an - * {@link protos.google.identity.accesscontextmanager.v1.AccessPolicy|access policy}. - * A commit operation on a service perimeter involves copying its `spec` field - * to the `status` field of the service perimeter. Only [service perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] with - * `use_explicit_dry_run_spec` field set to true are affected by a commit - * operation. The long-running operation from this RPC has a successful - * status after the dry-run specifications for all the [service perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] have been - * committed. If a commit fails, it causes the long-running operation to - * return an error response and the entire commit operation is cancelled. - * When successful, the Operation.response field contains - * CommitServicePerimetersResponse. The `dry_run` and the `spec` fields are - * cleared after a successful commit operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name for the parent [Access Policy] - * [google.identity.accesscontextmanager.v1.AccessPolicy] which owns all - * [Service Perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] in scope for - * the commit operation. - * - * Format: `accessPolicies/{policy_id}` - * @param {string} request.etag - * Optional. The etag for the version of the [Access Policy] - * [google.identity.accesscontextmanager.v1.AccessPolicy] that this - * commit operation is to be performed on. If, at the time of commit, the - * etag for the Access Policy stored in Access Context Manager is different - * from the specified etag, then the commit operation will not be performed - * and the call will fail. This field is not required. If etag is not - * provided, the operation will be performed as if a valid etag is provided. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.commit_service_perimeters.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CommitServicePerimeters_async - */ - commitServicePerimeters( - request?: protos.google.identity.accesscontextmanager.v1.ICommitServicePerimetersRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - commitServicePerimeters( - request: protos.google.identity.accesscontextmanager.v1.ICommitServicePerimetersRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - commitServicePerimeters( - request: protos.google.identity.accesscontextmanager.v1.ICommitServicePerimetersRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - commitServicePerimeters( - request?: protos.google.identity.accesscontextmanager.v1.ICommitServicePerimetersRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.commitServicePerimeters(request, options, callback); - } -/** - * Check the status of the long running operation returned by `commitServicePerimeters()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.commit_service_perimeters.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CommitServicePerimeters_async - */ - async checkCommitServicePerimetersProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.commitServicePerimeters, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a [GcpUserAccessBinding] - * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. If the - * client specifies a [name] - * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.name], - * the server ignores it. Fails if a resource already exists with the same - * [group_key] - * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding.group_key]. - * Completion of this long-running operation does not necessarily signify that - * the new binding is deployed onto all affected users, which may take more - * time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Example: "organizations/256" - * @param {google.identity.accesscontextmanager.v1.GcpUserAccessBinding} request.gcpUserAccessBinding - * Required. [GcpUserAccessBinding] - * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.create_gcp_user_access_binding.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateGcpUserAccessBinding_async - */ - createGcpUserAccessBinding( - request?: protos.google.identity.accesscontextmanager.v1.ICreateGcpUserAccessBindingRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createGcpUserAccessBinding( - request: protos.google.identity.accesscontextmanager.v1.ICreateGcpUserAccessBindingRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createGcpUserAccessBinding( - request: protos.google.identity.accesscontextmanager.v1.ICreateGcpUserAccessBindingRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createGcpUserAccessBinding( - request?: protos.google.identity.accesscontextmanager.v1.ICreateGcpUserAccessBindingRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createGcpUserAccessBinding(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createGcpUserAccessBinding()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.create_gcp_user_access_binding.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_CreateGcpUserAccessBinding_async - */ - async checkCreateGcpUserAccessBindingProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createGcpUserAccessBinding, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a [GcpUserAccessBinding] - * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. - * Completion of this long-running operation does not necessarily signify that - * the changed binding is deployed onto all affected users, which may take - * more time. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.identity.accesscontextmanager.v1.GcpUserAccessBinding} request.gcpUserAccessBinding - * Required. [GcpUserAccessBinding] - * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Only the fields specified in this mask are updated. Because name and - * group_key cannot be changed, update_mask is required and must always be: - * - * update_mask { - * paths: "access_levels" - * } - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.update_gcp_user_access_binding.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateGcpUserAccessBinding_async - */ - updateGcpUserAccessBinding( - request?: protos.google.identity.accesscontextmanager.v1.IUpdateGcpUserAccessBindingRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateGcpUserAccessBinding( - request: protos.google.identity.accesscontextmanager.v1.IUpdateGcpUserAccessBindingRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateGcpUserAccessBinding( - request: protos.google.identity.accesscontextmanager.v1.IUpdateGcpUserAccessBindingRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateGcpUserAccessBinding( - request?: protos.google.identity.accesscontextmanager.v1.IUpdateGcpUserAccessBindingRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'gcp_user_access_binding.name': request.gcpUserAccessBinding!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateGcpUserAccessBinding(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateGcpUserAccessBinding()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.update_gcp_user_access_binding.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_UpdateGcpUserAccessBinding_async - */ - async checkUpdateGcpUserAccessBindingProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateGcpUserAccessBinding, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a [GcpUserAccessBinding] - * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding]. - * Completion of this long-running operation does not necessarily signify that - * the binding deletion is deployed onto all affected users, which may take - * more time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteGcpUserAccessBinding_async - */ - deleteGcpUserAccessBinding( - request?: protos.google.identity.accesscontextmanager.v1.IDeleteGcpUserAccessBindingRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteGcpUserAccessBinding( - request: protos.google.identity.accesscontextmanager.v1.IDeleteGcpUserAccessBindingRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteGcpUserAccessBinding( - request: protos.google.identity.accesscontextmanager.v1.IDeleteGcpUserAccessBindingRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteGcpUserAccessBinding( - request?: protos.google.identity.accesscontextmanager.v1.IDeleteGcpUserAccessBindingRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteGcpUserAccessBinding(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteGcpUserAccessBinding()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/access_context_manager.delete_gcp_user_access_binding.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_DeleteGcpUserAccessBinding_async - */ - async checkDeleteGcpUserAccessBindingProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteGcpUserAccessBinding, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all [access policies] - * [google.identity.accesscontextmanager.v1.AccessPolicy] in an - * organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name for the container to list AccessPolicy instances - * from. - * - * Format: - * `organizations/{org_id}` - * @param {number} request.pageSize - * Number of AccessPolicy instances to include in the list. Default 100. - * @param {string} request.pageToken - * Next page token for the next batch of AccessPolicy instances. Defaults to - * the first 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.identity.accesscontextmanager.v1.AccessPolicy|AccessPolicy}. - * 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 `listAccessPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAccessPolicies( - request?: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IAccessPolicy[], - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest|null, - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse - ]>; - listAccessPolicies( - request: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IAccessPolicy>): void; - listAccessPolicies( - request: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, - callback: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IAccessPolicy>): void; - listAccessPolicies( - request?: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IAccessPolicy>, - callback?: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IAccessPolicy>): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IAccessPolicy[], - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest|null, - protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.listAccessPolicies(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. Resource name for the container to list AccessPolicy instances - * from. - * - * Format: - * `organizations/{org_id}` - * @param {number} request.pageSize - * Number of AccessPolicy instances to include in the list. Default 100. - * @param {string} request.pageToken - * Next page token for the next batch of AccessPolicy instances. Defaults to - * the first 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.identity.accesscontextmanager.v1.AccessPolicy|AccessPolicy} 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 `listAccessPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAccessPoliciesStream( - request?: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listAccessPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAccessPolicies.createStream( - this.innerApiCalls.listAccessPolicies as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAccessPolicies`, 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. Resource name for the container to list AccessPolicy instances - * from. - * - * Format: - * `organizations/{org_id}` - * @param {number} request.pageSize - * Number of AccessPolicy instances to include in the list. Default 100. - * @param {string} request.pageToken - * Next page token for the next batch of AccessPolicy instances. Defaults to - * the first 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.identity.accesscontextmanager.v1.AccessPolicy|AccessPolicy}. 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/access_context_manager.list_access_policies.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ListAccessPolicies_async - */ - listAccessPoliciesAsync( - request?: protos.google.identity.accesscontextmanager.v1.IListAccessPoliciesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listAccessPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAccessPolicies.asyncIterate( - this.innerApiCalls['listAccessPolicies'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all [access levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] for an access - * policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name for the access policy to list [Access Levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] from. - * - * Format: - * `accessPolicies/{policy_id}` - * @param {number} request.pageSize - * Number of [Access Levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] to include in - * the list. Default 100. - * @param {string} request.pageToken - * Next page token for the next batch of [Access Level] - * [google.identity.accesscontextmanager.v1.AccessLevel] instances. - * Defaults to the first page of results. - * @param {google.identity.accesscontextmanager.v1.LevelFormat} request.accessLevelFormat - * Whether to return `BasicLevels` in the Cloud Common Expression language, as - * `CustomLevels`, rather than as `BasicLevels`. Defaults to returning - * `AccessLevels` in the format they were defined. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.identity.accesscontextmanager.v1.AccessLevel|AccessLevel}. - * 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 `listAccessLevelsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAccessLevels( - request?: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, - options?: CallOptions): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IAccessLevel[], - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest|null, - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse - ]>; - listAccessLevels( - request: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IAccessLevel>): void; - listAccessLevels( - request: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, - callback: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IAccessLevel>): void; - listAccessLevels( - request?: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IAccessLevel>, - callback?: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IAccessLevel>): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IAccessLevel[], - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest|null, - protos.google.identity.accesscontextmanager.v1.IListAccessLevelsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listAccessLevels(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. Resource name for the access policy to list [Access Levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] from. - * - * Format: - * `accessPolicies/{policy_id}` - * @param {number} request.pageSize - * Number of [Access Levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] to include in - * the list. Default 100. - * @param {string} request.pageToken - * Next page token for the next batch of [Access Level] - * [google.identity.accesscontextmanager.v1.AccessLevel] instances. - * Defaults to the first page of results. - * @param {google.identity.accesscontextmanager.v1.LevelFormat} request.accessLevelFormat - * Whether to return `BasicLevels` in the Cloud Common Expression language, as - * `CustomLevels`, rather than as `BasicLevels`. Defaults to returning - * `AccessLevels` in the format they were defined. - * @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.identity.accesscontextmanager.v1.AccessLevel|AccessLevel} 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 `listAccessLevelsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAccessLevelsStream( - request?: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, - 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['listAccessLevels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAccessLevels.createStream( - this.innerApiCalls.listAccessLevels as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAccessLevels`, 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. Resource name for the access policy to list [Access Levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] from. - * - * Format: - * `accessPolicies/{policy_id}` - * @param {number} request.pageSize - * Number of [Access Levels] - * [google.identity.accesscontextmanager.v1.AccessLevel] to include in - * the list. Default 100. - * @param {string} request.pageToken - * Next page token for the next batch of [Access Level] - * [google.identity.accesscontextmanager.v1.AccessLevel] instances. - * Defaults to the first page of results. - * @param {google.identity.accesscontextmanager.v1.LevelFormat} request.accessLevelFormat - * Whether to return `BasicLevels` in the Cloud Common Expression language, as - * `CustomLevels`, rather than as `BasicLevels`. Defaults to returning - * `AccessLevels` in the format they were defined. - * @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.identity.accesscontextmanager.v1.AccessLevel|AccessLevel}. 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/access_context_manager.list_access_levels.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ListAccessLevels_async - */ - listAccessLevelsAsync( - request?: protos.google.identity.accesscontextmanager.v1.IListAccessLevelsRequest, - 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['listAccessLevels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAccessLevels.asyncIterate( - this.innerApiCalls['listAccessLevels'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all [service perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] for an - * access policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name for the access policy to list [Service Perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] from. - * - * Format: - * `accessPolicies/{policy_id}` - * @param {number} request.pageSize - * Number of [Service Perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] to include - * in the list. Default 100. - * @param {string} request.pageToken - * Next page token for the next batch of [Service Perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. - * Defaults to the first 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.identity.accesscontextmanager.v1.ServicePerimeter|ServicePerimeter}. - * 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 `listServicePerimetersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listServicePerimeters( - request?: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, - options?: CallOptions): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IServicePerimeter[], - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest|null, - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse - ]>; - listServicePerimeters( - request: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IServicePerimeter>): void; - listServicePerimeters( - request: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, - callback: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IServicePerimeter>): void; - listServicePerimeters( - request?: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IServicePerimeter>, - callback?: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IServicePerimeter>): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IServicePerimeter[], - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest|null, - protos.google.identity.accesscontextmanager.v1.IListServicePerimetersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listServicePerimeters(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. Resource name for the access policy to list [Service Perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] from. - * - * Format: - * `accessPolicies/{policy_id}` - * @param {number} request.pageSize - * Number of [Service Perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] to include - * in the list. Default 100. - * @param {string} request.pageToken - * Next page token for the next batch of [Service Perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. - * Defaults to the first 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.identity.accesscontextmanager.v1.ServicePerimeter|ServicePerimeter} 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 `listServicePerimetersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listServicePerimetersStream( - request?: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, - 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['listServicePerimeters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServicePerimeters.createStream( - this.innerApiCalls.listServicePerimeters as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServicePerimeters`, 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. Resource name for the access policy to list [Service Perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] from. - * - * Format: - * `accessPolicies/{policy_id}` - * @param {number} request.pageSize - * Number of [Service Perimeters] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] to include - * in the list. Default 100. - * @param {string} request.pageToken - * Next page token for the next batch of [Service Perimeter] - * [google.identity.accesscontextmanager.v1.ServicePerimeter] instances. - * Defaults to the first 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.identity.accesscontextmanager.v1.ServicePerimeter|ServicePerimeter}. 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/access_context_manager.list_service_perimeters.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ListServicePerimeters_async - */ - listServicePerimetersAsync( - request?: protos.google.identity.accesscontextmanager.v1.IListServicePerimetersRequest, - 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['listServicePerimeters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServicePerimeters.asyncIterate( - this.innerApiCalls['listServicePerimeters'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all [GcpUserAccessBindings] - * [google.identity.accesscontextmanager.v1.GcpUserAccessBinding] for a - * Google Cloud organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Example: "organizations/256" - * @param {number} [request.pageSize] - * Optional. Maximum number of items to return. The server may return fewer items. - * If left blank, the server may return any number of items. - * @param {string} [request.pageToken] - * Optional. If left blank, returns the first page. To enumerate all items, use the - * [next_page_token] - * [google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse.next_page_token] - * from your previous list operation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.identity.accesscontextmanager.v1.GcpUserAccessBinding|GcpUserAccessBinding}. - * 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 `listGcpUserAccessBindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listGcpUserAccessBindings( - request?: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding[], - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest|null, - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse - ]>; - listGcpUserAccessBindings( - request: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding>): void; - listGcpUserAccessBindings( - request: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, - callback: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding>): void; - listGcpUserAccessBindings( - request?: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding>, - callback?: PaginationCallback< - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse|null|undefined, - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding>): - Promise<[ - protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding[], - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest|null, - protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listGcpUserAccessBindings(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. Example: "organizations/256" - * @param {number} [request.pageSize] - * Optional. Maximum number of items to return. The server may return fewer items. - * If left blank, the server may return any number of items. - * @param {string} [request.pageToken] - * Optional. If left blank, returns the first page. To enumerate all items, use the - * [next_page_token] - * [google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse.next_page_token] - * from your previous list operation. - * @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.identity.accesscontextmanager.v1.GcpUserAccessBinding|GcpUserAccessBinding} 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 `listGcpUserAccessBindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listGcpUserAccessBindingsStream( - request?: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, - 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['listGcpUserAccessBindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listGcpUserAccessBindings.createStream( - this.innerApiCalls.listGcpUserAccessBindings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listGcpUserAccessBindings`, 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. Example: "organizations/256" - * @param {number} [request.pageSize] - * Optional. Maximum number of items to return. The server may return fewer items. - * If left blank, the server may return any number of items. - * @param {string} [request.pageToken] - * Optional. If left blank, returns the first page. To enumerate all items, use the - * [next_page_token] - * [google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsResponse.next_page_token] - * from your previous list operation. - * @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.identity.accesscontextmanager.v1.GcpUserAccessBinding|GcpUserAccessBinding}. 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/access_context_manager.list_gcp_user_access_bindings.js - * region_tag:accesscontextmanager_v1_generated_AccessContextManager_ListGcpUserAccessBindings_async - */ - listGcpUserAccessBindingsAsync( - request?: protos.google.identity.accesscontextmanager.v1.IListGcpUserAccessBindingsRequest, - 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['listGcpUserAccessBindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listGcpUserAccessBindings.asyncIterate( - this.innerApiCalls['listGcpUserAccessBindings'] 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 accessLevel resource name string. - * - * @param {string} access_policy - * @param {string} access_level - * @returns {string} Resource name string. - */ - accessLevelPath(accessPolicy:string,accessLevel:string) { - return this.pathTemplates.accessLevelPathTemplate.render({ - access_policy: accessPolicy, - access_level: accessLevel, - }); - } - - /** - * Parse the access_policy from AccessLevel resource. - * - * @param {string} accessLevelName - * A fully-qualified path representing AccessLevel resource. - * @returns {string} A string representing the access_policy. - */ - matchAccessPolicyFromAccessLevelName(accessLevelName: string) { - return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_policy; - } - - /** - * Parse the access_level from AccessLevel resource. - * - * @param {string} accessLevelName - * A fully-qualified path representing AccessLevel resource. - * @returns {string} A string representing the access_level. - */ - matchAccessLevelFromAccessLevelName(accessLevelName: string) { - return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_level; - } - - /** - * Return a fully-qualified accessPolicy resource name string. - * - * @param {string} access_policy - * @returns {string} Resource name string. - */ - accessPolicyPath(accessPolicy:string) { - return this.pathTemplates.accessPolicyPathTemplate.render({ - access_policy: accessPolicy, - }); - } - - /** - * Parse the access_policy from AccessPolicy resource. - * - * @param {string} accessPolicyName - * A fully-qualified path representing AccessPolicy resource. - * @returns {string} A string representing the access_policy. - */ - matchAccessPolicyFromAccessPolicyName(accessPolicyName: string) { - return this.pathTemplates.accessPolicyPathTemplate.match(accessPolicyName).access_policy; - } - - /** - * Return a fully-qualified gcpUserAccessBinding resource name string. - * - * @param {string} organization - * @param {string} gcp_user_access_binding - * @returns {string} Resource name string. - */ - gcpUserAccessBindingPath(organization:string,gcpUserAccessBinding:string) { - return this.pathTemplates.gcpUserAccessBindingPathTemplate.render({ - organization: organization, - gcp_user_access_binding: gcpUserAccessBinding, - }); - } - - /** - * Parse the organization from GcpUserAccessBinding resource. - * - * @param {string} gcpUserAccessBindingName - * A fully-qualified path representing GcpUserAccessBinding resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromGcpUserAccessBindingName(gcpUserAccessBindingName: string) { - return this.pathTemplates.gcpUserAccessBindingPathTemplate.match(gcpUserAccessBindingName).organization; - } - - /** - * Parse the gcp_user_access_binding from GcpUserAccessBinding resource. - * - * @param {string} gcpUserAccessBindingName - * A fully-qualified path representing GcpUserAccessBinding resource. - * @returns {string} A string representing the gcp_user_access_binding. - */ - matchGcpUserAccessBindingFromGcpUserAccessBindingName(gcpUserAccessBindingName: string) { - return this.pathTemplates.gcpUserAccessBindingPathTemplate.match(gcpUserAccessBindingName).gcp_user_access_binding; - } - - /** - * 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 servicePerimeter resource name string. - * - * @param {string} access_policy - * @param {string} service_perimeter - * @returns {string} Resource name string. - */ - servicePerimeterPath(accessPolicy:string,servicePerimeter:string) { - return this.pathTemplates.servicePerimeterPathTemplate.render({ - access_policy: accessPolicy, - service_perimeter: servicePerimeter, - }); - } - - /** - * Parse the access_policy from ServicePerimeter resource. - * - * @param {string} servicePerimeterName - * A fully-qualified path representing ServicePerimeter resource. - * @returns {string} A string representing the access_policy. - */ - matchAccessPolicyFromServicePerimeterName(servicePerimeterName: string) { - return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).access_policy; - } - - /** - * Parse the service_perimeter from ServicePerimeter resource. - * - * @param {string} servicePerimeterName - * A fully-qualified path representing ServicePerimeter resource. - * @returns {string} A string representing the service_perimeter. - */ - matchServicePerimeterFromServicePerimeterName(servicePerimeterName: string) { - return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).service_perimeter; - } - - /** - * 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.accessContextManagerStub && !this._terminated) { - return this.accessContextManagerStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client_config.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client_config.json deleted file mode 100644 index ac86647c705..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_client_config.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "interfaces": { - "google.identity.accesscontextmanager.v1.AccessContextManager": { - "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": { - "ListAccessPolicies": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAccessPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateAccessPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAccessPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteAccessPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListAccessLevels": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAccessLevel": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateAccessLevel": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAccessLevel": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteAccessLevel": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReplaceAccessLevels": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListServicePerimeters": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetServicePerimeter": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateServicePerimeter": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateServicePerimeter": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteServicePerimeter": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReplaceServicePerimeters": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CommitServicePerimeters": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListGcpUserAccessBindings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetGcpUserAccessBinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateGcpUserAccessBinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateGcpUserAccessBinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteGcpUserAccessBinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "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-identity-accesscontextmanager/v1/src/v1/access_context_manager_proto_list.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_proto_list.json deleted file mode 100644 index 7ac8f3e0fd9..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/access_context_manager_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/identity/accesscontextmanager/type/device_resources.proto", - "../../protos/google/identity/accesscontextmanager/v1/access_context_manager.proto", - "../../protos/google/identity/accesscontextmanager/v1/access_level.proto", - "../../protos/google/identity/accesscontextmanager/v1/access_policy.proto", - "../../protos/google/identity/accesscontextmanager/v1/gcp_user_access_binding.proto", - "../../protos/google/identity/accesscontextmanager/v1/service_perimeter.proto" -] diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 9a97f9b98ed..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,299 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.identity.accesscontextmanager.v1", - "libraryPackage": "@google-cloud/access-context-manager", - "services": { - "AccessContextManager": { - "clients": { - "grpc": { - "libraryClient": "AccessContextManagerClient", - "rpcs": { - "GetAccessPolicy": { - "methods": [ - "getAccessPolicy" - ] - }, - "GetAccessLevel": { - "methods": [ - "getAccessLevel" - ] - }, - "GetServicePerimeter": { - "methods": [ - "getServicePerimeter" - ] - }, - "GetGcpUserAccessBinding": { - "methods": [ - "getGcpUserAccessBinding" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "CreateAccessPolicy": { - "methods": [ - "createAccessPolicy" - ] - }, - "UpdateAccessPolicy": { - "methods": [ - "updateAccessPolicy" - ] - }, - "DeleteAccessPolicy": { - "methods": [ - "deleteAccessPolicy" - ] - }, - "CreateAccessLevel": { - "methods": [ - "createAccessLevel" - ] - }, - "UpdateAccessLevel": { - "methods": [ - "updateAccessLevel" - ] - }, - "DeleteAccessLevel": { - "methods": [ - "deleteAccessLevel" - ] - }, - "ReplaceAccessLevels": { - "methods": [ - "replaceAccessLevels" - ] - }, - "CreateServicePerimeter": { - "methods": [ - "createServicePerimeter" - ] - }, - "UpdateServicePerimeter": { - "methods": [ - "updateServicePerimeter" - ] - }, - "DeleteServicePerimeter": { - "methods": [ - "deleteServicePerimeter" - ] - }, - "ReplaceServicePerimeters": { - "methods": [ - "replaceServicePerimeters" - ] - }, - "CommitServicePerimeters": { - "methods": [ - "commitServicePerimeters" - ] - }, - "CreateGcpUserAccessBinding": { - "methods": [ - "createGcpUserAccessBinding" - ] - }, - "UpdateGcpUserAccessBinding": { - "methods": [ - "updateGcpUserAccessBinding" - ] - }, - "DeleteGcpUserAccessBinding": { - "methods": [ - "deleteGcpUserAccessBinding" - ] - }, - "ListAccessPolicies": { - "methods": [ - "listAccessPolicies", - "listAccessPoliciesStream", - "listAccessPoliciesAsync" - ] - }, - "ListAccessLevels": { - "methods": [ - "listAccessLevels", - "listAccessLevelsStream", - "listAccessLevelsAsync" - ] - }, - "ListServicePerimeters": { - "methods": [ - "listServicePerimeters", - "listServicePerimetersStream", - "listServicePerimetersAsync" - ] - }, - "ListGcpUserAccessBindings": { - "methods": [ - "listGcpUserAccessBindings", - "listGcpUserAccessBindingsStream", - "listGcpUserAccessBindingsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AccessContextManagerClient", - "rpcs": { - "GetAccessPolicy": { - "methods": [ - "getAccessPolicy" - ] - }, - "GetAccessLevel": { - "methods": [ - "getAccessLevel" - ] - }, - "GetServicePerimeter": { - "methods": [ - "getServicePerimeter" - ] - }, - "GetGcpUserAccessBinding": { - "methods": [ - "getGcpUserAccessBinding" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "CreateAccessPolicy": { - "methods": [ - "createAccessPolicy" - ] - }, - "UpdateAccessPolicy": { - "methods": [ - "updateAccessPolicy" - ] - }, - "DeleteAccessPolicy": { - "methods": [ - "deleteAccessPolicy" - ] - }, - "CreateAccessLevel": { - "methods": [ - "createAccessLevel" - ] - }, - "UpdateAccessLevel": { - "methods": [ - "updateAccessLevel" - ] - }, - "DeleteAccessLevel": { - "methods": [ - "deleteAccessLevel" - ] - }, - "ReplaceAccessLevels": { - "methods": [ - "replaceAccessLevels" - ] - }, - "CreateServicePerimeter": { - "methods": [ - "createServicePerimeter" - ] - }, - "UpdateServicePerimeter": { - "methods": [ - "updateServicePerimeter" - ] - }, - "DeleteServicePerimeter": { - "methods": [ - "deleteServicePerimeter" - ] - }, - "ReplaceServicePerimeters": { - "methods": [ - "replaceServicePerimeters" - ] - }, - "CommitServicePerimeters": { - "methods": [ - "commitServicePerimeters" - ] - }, - "CreateGcpUserAccessBinding": { - "methods": [ - "createGcpUserAccessBinding" - ] - }, - "UpdateGcpUserAccessBinding": { - "methods": [ - "updateGcpUserAccessBinding" - ] - }, - "DeleteGcpUserAccessBinding": { - "methods": [ - "deleteGcpUserAccessBinding" - ] - }, - "ListAccessPolicies": { - "methods": [ - "listAccessPolicies", - "listAccessPoliciesStream", - "listAccessPoliciesAsync" - ] - }, - "ListAccessLevels": { - "methods": [ - "listAccessLevels", - "listAccessLevelsStream", - "listAccessLevelsAsync" - ] - }, - "ListServicePerimeters": { - "methods": [ - "listServicePerimeters", - "listServicePerimetersStream", - "listServicePerimetersAsync" - ] - }, - "ListGcpUserAccessBindings": { - "methods": [ - "listGcpUserAccessBindings", - "listGcpUserAccessBindingsStream", - "listGcpUserAccessBindingsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/index.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/src/v1/index.ts deleted file mode 100644 index 643d738a52f..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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 {AccessContextManagerClient} from './access_context_manager_client'; diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 63ebbe60da3..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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 accesscontextmanager = require('@google-cloud/access-context-manager'); - -function main() { - const accessContextManagerClient = new accesscontextmanager.AccessContextManagerClient(); -} - -main(); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index ececac41a3c..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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 {AccessContextManagerClient} from '@google-cloud/access-context-manager'; - -// check that the client class type name can be used -function doStuffWithAccessContextManagerClient(client: AccessContextManagerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const accessContextManagerClient = new AccessContextManagerClient(); - doStuffWithAccessContextManagerClient(accessContextManagerClient); -} - -main(); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/install.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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-identity-accesscontextmanager/v1/test/gapic_access_context_manager_v1.ts b/owl-bot-staging/google-identity-accesscontextmanager/v1/test/gapic_access_context_manager_v1.ts deleted file mode 100644 index dcb1778ed84..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/v1/test/gapic_access_context_manager_v1.ts +++ /dev/null @@ -1,4597 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 accesscontextmanagerModule 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.AccessContextManagerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = accesscontextmanagerModule.v1.AccessContextManagerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = accesscontextmanagerModule.v1.AccessContextManagerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = accesscontextmanagerModule.v1.AccessContextManagerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.accessContextManagerStub, undefined); - await client.initialize(); - assert(client.accessContextManagerStub); - }); - - it('has close method for the initialized client', done => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.accessContextManagerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.accessContextManagerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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('getAccessPolicy', () => { - it('invokes getAccessPolicy without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.AccessPolicy() - ); - client.innerApiCalls.getAccessPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getAccessPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAccessPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAccessPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAccessPolicy without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.AccessPolicy() - ); - client.innerApiCalls.getAccessPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAccessPolicy( - request, - (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IAccessPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAccessPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAccessPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAccessPolicy with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAccessPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAccessPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getAccessPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAccessPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAccessPolicy with closed client', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAccessPolicy(request), expectedError); - }); - }); - - describe('getAccessLevel', () => { - it('invokes getAccessLevel without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessLevelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.AccessLevel() - ); - client.innerApiCalls.getAccessLevel = stubSimpleCall(expectedResponse); - const [response] = await client.getAccessLevel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAccessLevel without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessLevelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.AccessLevel() - ); - client.innerApiCalls.getAccessLevel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAccessLevel( - request, - (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IAccessLevel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAccessLevel with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessLevelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAccessLevel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAccessLevel(request), expectedError); - const actualRequest = (client.innerApiCalls.getAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAccessLevel with closed client', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetAccessLevelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAccessLevel(request), expectedError); - }); - }); - - describe('getServicePerimeter', () => { - it('invokes getServicePerimeter without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ServicePerimeter() - ); - client.innerApiCalls.getServicePerimeter = stubSimpleCall(expectedResponse); - const [response] = await client.getServicePerimeter(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServicePerimeter without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ServicePerimeter() - ); - client.innerApiCalls.getServicePerimeter = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServicePerimeter( - request, - (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IServicePerimeter|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServicePerimeter with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServicePerimeter = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServicePerimeter(request), expectedError); - const actualRequest = (client.innerApiCalls.getServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServicePerimeter with closed client', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetServicePerimeterRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getServicePerimeter(request), expectedError); - }); - }); - - describe('getGcpUserAccessBinding', () => { - it('invokes getGcpUserAccessBinding without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding() - ); - client.innerApiCalls.getGcpUserAccessBinding = stubSimpleCall(expectedResponse); - const [response] = await client.getGcpUserAccessBinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGcpUserAccessBinding without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding() - ); - client.innerApiCalls.getGcpUserAccessBinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGcpUserAccessBinding( - request, - (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGcpUserAccessBinding with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGcpUserAccessBinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGcpUserAccessBinding(request), expectedError); - const actualRequest = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGcpUserAccessBinding with closed client', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.GetGcpUserAccessBindingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getGcpUserAccessBinding(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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('createAccessPolicy', () => { - it('invokes createAccessPolicy without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.AccessPolicy() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAccessPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAccessPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createAccessPolicy without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.AccessPolicy() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAccessPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAccessPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createAccessPolicy with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.AccessPolicy() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createAccessPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAccessPolicy(request), expectedError); - }); - - it('invokes createAccessPolicy with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.AccessPolicy() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createAccessPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAccessPolicy(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkCreateAccessPolicyProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateAccessPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateAccessPolicyProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAccessPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateAccessPolicy', () => { - it('invokes updateAccessPolicy without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAccessPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAccessPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAccessPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAccessPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAccessPolicy without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAccessPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAccessPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAccessPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAccessPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAccessPolicy with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAccessPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAccessPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAccessPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAccessPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAccessPolicy with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessPolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAccessPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAccessPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAccessPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAccessPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateAccessPolicyProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateAccessPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateAccessPolicyProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAccessPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteAccessPolicy', () => { - it('invokes deleteAccessPolicy without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAccessPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAccessPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAccessPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAccessPolicy without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAccessPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAccessPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAccessPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAccessPolicy with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAccessPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAccessPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAccessPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAccessPolicy with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAccessPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAccessPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAccessPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteAccessPolicyProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteAccessPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteAccessPolicyProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAccessPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createAccessLevel', () => { - it('invokes createAccessLevel without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAccessLevel = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAccessLevel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAccessLevel without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAccessLevel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAccessLevel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAccessLevel with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAccessLevel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAccessLevel(request), expectedError); - const actualRequest = (client.innerApiCalls.createAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAccessLevel with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateAccessLevelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAccessLevel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAccessLevel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateAccessLevelProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateAccessLevelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateAccessLevelProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAccessLevelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateAccessLevel', () => { - it('invokes updateAccessLevel without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest() - ); - request.accessLevel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest', ['accessLevel', 'name']); - request.accessLevel.name = defaultValue1; - const expectedHeaderRequestParams = `access_level.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAccessLevel = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAccessLevel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAccessLevel without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest() - ); - request.accessLevel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest', ['accessLevel', 'name']); - request.accessLevel.name = defaultValue1; - const expectedHeaderRequestParams = `access_level.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAccessLevel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAccessLevel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAccessLevel with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest() - ); - request.accessLevel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest', ['accessLevel', 'name']); - request.accessLevel.name = defaultValue1; - const expectedHeaderRequestParams = `access_level.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAccessLevel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAccessLevel(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAccessLevel with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest() - ); - request.accessLevel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateAccessLevelRequest', ['accessLevel', 'name']); - request.accessLevel.name = defaultValue1; - const expectedHeaderRequestParams = `access_level.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAccessLevel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAccessLevel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateAccessLevelProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateAccessLevelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateAccessLevelProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAccessLevelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteAccessLevel', () => { - it('invokes deleteAccessLevel without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAccessLevel = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAccessLevel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAccessLevel without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAccessLevel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAccessLevel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAccessLevel with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAccessLevel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAccessLevel(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAccessLevel with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteAccessLevelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAccessLevel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAccessLevel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAccessLevel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAccessLevel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteAccessLevelProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteAccessLevelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteAccessLevelProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAccessLevelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('replaceAccessLevels', () => { - it('invokes replaceAccessLevels without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.replaceAccessLevels = stubLongRunningCall(expectedResponse); - const [operation] = await client.replaceAccessLevels(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceAccessLevels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceAccessLevels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceAccessLevels without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.replaceAccessLevels = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.replaceAccessLevels( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceAccessLevels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceAccessLevels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceAccessLevels with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.replaceAccessLevels = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.replaceAccessLevels(request), expectedError); - const actualRequest = (client.innerApiCalls.replaceAccessLevels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceAccessLevels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceAccessLevels with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceAccessLevelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.replaceAccessLevels = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.replaceAccessLevels(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.replaceAccessLevels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceAccessLevels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkReplaceAccessLevelsProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkReplaceAccessLevelsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkReplaceAccessLevelsProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkReplaceAccessLevelsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createServicePerimeter', () => { - it('invokes createServicePerimeter without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createServicePerimeter = stubLongRunningCall(expectedResponse); - const [operation] = await client.createServicePerimeter(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServicePerimeter without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createServicePerimeter = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createServicePerimeter( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServicePerimeter with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServicePerimeter = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createServicePerimeter(request), expectedError); - const actualRequest = (client.innerApiCalls.createServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServicePerimeter with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateServicePerimeterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServicePerimeter = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createServicePerimeter(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateServicePerimeterProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateServicePerimeterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateServicePerimeterProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateServicePerimeterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateServicePerimeter', () => { - it('invokes updateServicePerimeter without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest() - ); - request.servicePerimeter ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest', ['servicePerimeter', 'name']); - request.servicePerimeter.name = defaultValue1; - const expectedHeaderRequestParams = `service_perimeter.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateServicePerimeter = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateServicePerimeter(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServicePerimeter without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest() - ); - request.servicePerimeter ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest', ['servicePerimeter', 'name']); - request.servicePerimeter.name = defaultValue1; - const expectedHeaderRequestParams = `service_perimeter.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateServicePerimeter = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateServicePerimeter( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServicePerimeter with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest() - ); - request.servicePerimeter ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest', ['servicePerimeter', 'name']); - request.servicePerimeter.name = defaultValue1; - const expectedHeaderRequestParams = `service_perimeter.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServicePerimeter = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateServicePerimeter(request), expectedError); - const actualRequest = (client.innerApiCalls.updateServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServicePerimeter with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest() - ); - request.servicePerimeter ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateServicePerimeterRequest', ['servicePerimeter', 'name']); - request.servicePerimeter.name = defaultValue1; - const expectedHeaderRequestParams = `service_perimeter.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServicePerimeter = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateServicePerimeter(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateServicePerimeterProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateServicePerimeterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateServicePerimeterProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateServicePerimeterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteServicePerimeter', () => { - it('invokes deleteServicePerimeter without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteServicePerimeter = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteServicePerimeter(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServicePerimeter without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteServicePerimeter = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteServicePerimeter( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServicePerimeter with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServicePerimeter = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteServicePerimeter(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServicePerimeter with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteServicePerimeterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServicePerimeter = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteServicePerimeter(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteServicePerimeter as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServicePerimeter as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteServicePerimeterProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteServicePerimeterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteServicePerimeterProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteServicePerimeterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('replaceServicePerimeters', () => { - it('invokes replaceServicePerimeters without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.replaceServicePerimeters = stubLongRunningCall(expectedResponse); - const [operation] = await client.replaceServicePerimeters(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceServicePerimeters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceServicePerimeters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceServicePerimeters without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.replaceServicePerimeters = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.replaceServicePerimeters( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceServicePerimeters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceServicePerimeters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceServicePerimeters with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.replaceServicePerimeters = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.replaceServicePerimeters(request), expectedError); - const actualRequest = (client.innerApiCalls.replaceServicePerimeters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceServicePerimeters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceServicePerimeters with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ReplaceServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.replaceServicePerimeters = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.replaceServicePerimeters(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.replaceServicePerimeters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceServicePerimeters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkReplaceServicePerimetersProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkReplaceServicePerimetersProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkReplaceServicePerimetersProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkReplaceServicePerimetersProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('commitServicePerimeters', () => { - it('invokes commitServicePerimeters without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.commitServicePerimeters = stubLongRunningCall(expectedResponse); - const [operation] = await client.commitServicePerimeters(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.commitServicePerimeters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.commitServicePerimeters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes commitServicePerimeters without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.commitServicePerimeters = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.commitServicePerimeters( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.commitServicePerimeters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.commitServicePerimeters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes commitServicePerimeters with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.commitServicePerimeters = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.commitServicePerimeters(request), expectedError); - const actualRequest = (client.innerApiCalls.commitServicePerimeters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.commitServicePerimeters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes commitServicePerimeters with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CommitServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.commitServicePerimeters = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.commitServicePerimeters(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.commitServicePerimeters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.commitServicePerimeters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCommitServicePerimetersProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCommitServicePerimetersProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCommitServicePerimetersProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCommitServicePerimetersProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createGcpUserAccessBinding', () => { - it('invokes createGcpUserAccessBinding without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGcpUserAccessBinding = stubLongRunningCall(expectedResponse); - const [operation] = await client.createGcpUserAccessBinding(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGcpUserAccessBinding without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGcpUserAccessBinding = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGcpUserAccessBinding( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGcpUserAccessBinding with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGcpUserAccessBinding = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createGcpUserAccessBinding(request), expectedError); - const actualRequest = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGcpUserAccessBinding with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.CreateGcpUserAccessBindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGcpUserAccessBinding = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createGcpUserAccessBinding(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateGcpUserAccessBindingProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateGcpUserAccessBindingProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateGcpUserAccessBindingProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateGcpUserAccessBindingProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateGcpUserAccessBinding', () => { - it('invokes updateGcpUserAccessBinding without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest() - ); - request.gcpUserAccessBinding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest', ['gcpUserAccessBinding', 'name']); - request.gcpUserAccessBinding.name = defaultValue1; - const expectedHeaderRequestParams = `gcp_user_access_binding.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGcpUserAccessBinding = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateGcpUserAccessBinding(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGcpUserAccessBinding without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest() - ); - request.gcpUserAccessBinding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest', ['gcpUserAccessBinding', 'name']); - request.gcpUserAccessBinding.name = defaultValue1; - const expectedHeaderRequestParams = `gcp_user_access_binding.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGcpUserAccessBinding = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGcpUserAccessBinding( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGcpUserAccessBinding with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest() - ); - request.gcpUserAccessBinding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest', ['gcpUserAccessBinding', 'name']); - request.gcpUserAccessBinding.name = defaultValue1; - const expectedHeaderRequestParams = `gcp_user_access_binding.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGcpUserAccessBinding = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateGcpUserAccessBinding(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGcpUserAccessBinding with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest() - ); - request.gcpUserAccessBinding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.UpdateGcpUserAccessBindingRequest', ['gcpUserAccessBinding', 'name']); - request.gcpUserAccessBinding.name = defaultValue1; - const expectedHeaderRequestParams = `gcp_user_access_binding.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGcpUserAccessBinding = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateGcpUserAccessBinding(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateGcpUserAccessBindingProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateGcpUserAccessBindingProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateGcpUserAccessBindingProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateGcpUserAccessBindingProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteGcpUserAccessBinding', () => { - it('invokes deleteGcpUserAccessBinding without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGcpUserAccessBinding = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteGcpUserAccessBinding(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGcpUserAccessBinding without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGcpUserAccessBinding = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGcpUserAccessBinding( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGcpUserAccessBinding with call error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGcpUserAccessBinding = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteGcpUserAccessBinding(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGcpUserAccessBinding with LRO error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.DeleteGcpUserAccessBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGcpUserAccessBinding = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteGcpUserAccessBinding(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGcpUserAccessBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteGcpUserAccessBindingProgress without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteGcpUserAccessBindingProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteGcpUserAccessBindingProgress with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteGcpUserAccessBindingProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listAccessPolicies', () => { - it('invokes listAccessPolicies without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - ]; - client.innerApiCalls.listAccessPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listAccessPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listAccessPolicies without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - ]; - client.innerApiCalls.listAccessPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAccessPolicies( - request, - (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IAccessPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listAccessPolicies with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listAccessPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAccessPolicies(request), expectedError); - }); - - it('invokes listAccessPoliciesStream without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - ]; - client.descriptors.page.listAccessPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAccessPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.identity.accesscontextmanager.v1.AccessPolicy[] = []; - stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.AccessPolicy) => { - 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.listAccessPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAccessPolicies, request)); - }); - - it('invokes listAccessPoliciesStream with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listAccessPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAccessPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.identity.accesscontextmanager.v1.AccessPolicy[] = []; - stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.AccessPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAccessPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAccessPolicies, request)); - }); - - it('uses async iteration with listAccessPolicies without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessPolicy()), - ]; - client.descriptors.page.listAccessPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.identity.accesscontextmanager.v1.IAccessPolicy[] = []; - const iterable = client.listAccessPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAccessPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listAccessPolicies with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessPoliciesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listAccessPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAccessPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.identity.accesscontextmanager.v1.IAccessPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAccessPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listAccessLevels', () => { - it('invokes listAccessLevels without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - ]; - client.innerApiCalls.listAccessLevels = stubSimpleCall(expectedResponse); - const [response] = await client.listAccessLevels(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAccessLevels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAccessLevels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAccessLevels without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - ]; - client.innerApiCalls.listAccessLevels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAccessLevels( - request, - (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IAccessLevel[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAccessLevels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAccessLevels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAccessLevels with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAccessLevels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAccessLevels(request), expectedError); - const actualRequest = (client.innerApiCalls.listAccessLevels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAccessLevels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAccessLevelsStream without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - ]; - client.descriptors.page.listAccessLevels.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAccessLevelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.identity.accesscontextmanager.v1.AccessLevel[] = []; - stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.AccessLevel) => { - 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.listAccessLevels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAccessLevels, request)); - assert( - (client.descriptors.page.listAccessLevels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAccessLevelsStream with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAccessLevels.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAccessLevelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.identity.accesscontextmanager.v1.AccessLevel[] = []; - stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.AccessLevel) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAccessLevels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAccessLevels, request)); - assert( - (client.descriptors.page.listAccessLevels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAccessLevels without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.AccessLevel()), - ]; - client.descriptors.page.listAccessLevels.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.identity.accesscontextmanager.v1.IAccessLevel[] = []; - const iterable = client.listAccessLevelsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAccessLevels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAccessLevels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAccessLevels with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListAccessLevelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAccessLevels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAccessLevelsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.identity.accesscontextmanager.v1.IAccessLevel[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAccessLevels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAccessLevels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listServicePerimeters', () => { - it('invokes listServicePerimeters without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - ]; - client.innerApiCalls.listServicePerimeters = stubSimpleCall(expectedResponse); - const [response] = await client.listServicePerimeters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServicePerimeters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServicePerimeters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicePerimeters without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - ]; - client.innerApiCalls.listServicePerimeters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServicePerimeters( - request, - (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IServicePerimeter[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServicePerimeters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServicePerimeters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicePerimeters with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServicePerimeters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServicePerimeters(request), expectedError); - const actualRequest = (client.innerApiCalls.listServicePerimeters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServicePerimeters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicePerimetersStream without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - ]; - client.descriptors.page.listServicePerimeters.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServicePerimetersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.identity.accesscontextmanager.v1.ServicePerimeter[] = []; - stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.ServicePerimeter) => { - 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.listServicePerimeters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServicePerimeters, request)); - assert( - (client.descriptors.page.listServicePerimeters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServicePerimetersStream with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServicePerimeters.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServicePerimetersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.identity.accesscontextmanager.v1.ServicePerimeter[] = []; - stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.ServicePerimeter) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServicePerimeters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServicePerimeters, request)); - assert( - (client.descriptors.page.listServicePerimeters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServicePerimeters without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.ServicePerimeter()), - ]; - client.descriptors.page.listServicePerimeters.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.identity.accesscontextmanager.v1.IServicePerimeter[] = []; - const iterable = client.listServicePerimetersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServicePerimeters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServicePerimeters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServicePerimeters with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListServicePerimetersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServicePerimeters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServicePerimetersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.identity.accesscontextmanager.v1.IServicePerimeter[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServicePerimeters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServicePerimeters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listGcpUserAccessBindings', () => { - it('invokes listGcpUserAccessBindings without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - ]; - client.innerApiCalls.listGcpUserAccessBindings = stubSimpleCall(expectedResponse); - const [response] = await client.listGcpUserAccessBindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGcpUserAccessBindings without error using callback', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - ]; - client.innerApiCalls.listGcpUserAccessBindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGcpUserAccessBindings( - request, - (err?: Error|null, result?: protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGcpUserAccessBindings with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGcpUserAccessBindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGcpUserAccessBindings(request), expectedError); - const actualRequest = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGcpUserAccessBindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGcpUserAccessBindingsStream without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - ]; - client.descriptors.page.listGcpUserAccessBindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGcpUserAccessBindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding[] = []; - stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding) => { - 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.listGcpUserAccessBindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGcpUserAccessBindings, request)); - assert( - (client.descriptors.page.listGcpUserAccessBindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listGcpUserAccessBindingsStream with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listGcpUserAccessBindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGcpUserAccessBindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding[] = []; - stream.on('data', (response: protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGcpUserAccessBindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGcpUserAccessBindings, request)); - assert( - (client.descriptors.page.listGcpUserAccessBindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGcpUserAccessBindings without error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - generateSampleMessage(new protos.google.identity.accesscontextmanager.v1.GcpUserAccessBinding()), - ]; - client.descriptors.page.listGcpUserAccessBindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding[] = []; - const iterable = client.listGcpUserAccessBindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGcpUserAccessBindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGcpUserAccessBindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGcpUserAccessBindings with error', async () => { - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.identity.accesscontextmanager.v1.ListGcpUserAccessBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listGcpUserAccessBindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGcpUserAccessBindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.identity.accesscontextmanager.v1.IGcpUserAccessBinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGcpUserAccessBindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGcpUserAccessBindings.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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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 accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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('accessLevel', () => { - const fakePath = "/rendered/path/accessLevel"; - const expectedParameters = { - access_policy: "accessPolicyValue", - access_level: "accessLevelValue", - }; - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.accessLevelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.accessLevelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('accessLevelPath', () => { - const result = client.accessLevelPath("accessPolicyValue", "accessLevelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.accessLevelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchAccessPolicyFromAccessLevelName', () => { - const result = client.matchAccessPolicyFromAccessLevelName(fakePath); - assert.strictEqual(result, "accessPolicyValue"); - assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAccessLevelFromAccessLevelName', () => { - const result = client.matchAccessLevelFromAccessLevelName(fakePath); - assert.strictEqual(result, "accessLevelValue"); - assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('accessPolicy', () => { - const fakePath = "/rendered/path/accessPolicy"; - const expectedParameters = { - access_policy: "accessPolicyValue", - }; - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.accessPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.accessPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('accessPolicyPath', () => { - const result = client.accessPolicyPath("accessPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.accessPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchAccessPolicyFromAccessPolicyName', () => { - const result = client.matchAccessPolicyFromAccessPolicyName(fakePath); - assert.strictEqual(result, "accessPolicyValue"); - assert((client.pathTemplates.accessPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('gcpUserAccessBinding', () => { - const fakePath = "/rendered/path/gcpUserAccessBinding"; - const expectedParameters = { - organization: "organizationValue", - gcp_user_access_binding: "gcpUserAccessBindingValue", - }; - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.gcpUserAccessBindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gcpUserAccessBindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gcpUserAccessBindingPath', () => { - const result = client.gcpUserAccessBindingPath("organizationValue", "gcpUserAccessBindingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gcpUserAccessBindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromGcpUserAccessBindingName', () => { - const result = client.matchOrganizationFromGcpUserAccessBindingName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.gcpUserAccessBindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGcpUserAccessBindingFromGcpUserAccessBindingName', () => { - const result = client.matchGcpUserAccessBindingFromGcpUserAccessBindingName(fakePath); - assert.strictEqual(result, "gcpUserAccessBindingValue"); - assert((client.pathTemplates.gcpUserAccessBindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - 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('servicePerimeter', () => { - const fakePath = "/rendered/path/servicePerimeter"; - const expectedParameters = { - access_policy: "accessPolicyValue", - service_perimeter: "servicePerimeterValue", - }; - const client = new accesscontextmanagerModule.v1.AccessContextManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePerimeterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePerimeterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePerimeterPath', () => { - const result = client.servicePerimeterPath("accessPolicyValue", "servicePerimeterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePerimeterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchAccessPolicyFromServicePerimeterName', () => { - const result = client.matchAccessPolicyFromServicePerimeterName(fakePath); - assert.strictEqual(result, "accessPolicyValue"); - assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServicePerimeterFromServicePerimeterName', () => { - const result = client.matchServicePerimeterFromServicePerimeterName(fakePath); - assert.strictEqual(result, "servicePerimeterValue"); - assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-identity-accesscontextmanager/v1/tsconfig.json b/owl-bot-staging/google-identity-accesscontextmanager/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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-identity-accesscontextmanager/v1/webpack.config.js b/owl-bot-staging/google-identity-accesscontextmanager/v1/webpack.config.js deleted file mode 100644 index 086c0168554..00000000000 --- a/owl-bot-staging/google-identity-accesscontextmanager/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: 'AccessContextManager', - filename: './access-context-manager.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-maps-addressvalidation/v1/.eslintignore b/owl-bot-staging/google-maps-addressvalidation/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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-maps-addressvalidation/v1/.eslintrc.json b/owl-bot-staging/google-maps-addressvalidation/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/.gitignore b/owl-bot-staging/google-maps-addressvalidation/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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-maps-addressvalidation/v1/.jsdoc.js b/owl-bot-staging/google-maps-addressvalidation/v1/.jsdoc.js deleted file mode 100644 index 8678e46b46a..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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: '@googlemaps/addressvalidation', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/.mocharc.js b/owl-bot-staging/google-maps-addressvalidation/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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-maps-addressvalidation/v1/.prettierrc.js b/owl-bot-staging/google-maps-addressvalidation/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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-maps-addressvalidation/v1/README.md b/owl-bot-staging/google-maps-addressvalidation/v1/README.md deleted file mode 100644 index cc068e17230..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Addressvalidation: Nodejs Client diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/package.json b/owl-bot-staging/google-maps-addressvalidation/v1/package.json deleted file mode 100644 index f1350e5ac08..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@googlemaps/addressvalidation", - "version": "0.1.0", - "description": "Addressvalidation client for Node.js", - "repository": "googleapis/nodejs-addressvalidation", - "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 addressvalidation", - "addressvalidation", - "address validation" - ], - "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-maps-addressvalidation/v1/protos/google/geo/type/viewport.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/geo/type/viewport.proto deleted file mode 100644 index ad5029f8360..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/geo/type/viewport.proto +++ /dev/null @@ -1,69 +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.geo.type; - -import "google/type/latlng.proto"; - -option go_package = "google.golang.org/genproto/googleapis/geo/type/viewport;viewport"; -option java_multiple_files = true; -option java_outer_classname = "ViewportProto"; -option java_package = "com.google.geo.type"; -option objc_class_prefix = "GGTP"; - -// A latitude-longitude viewport, represented as two diagonally opposite `low` -// and `high` points. A viewport is considered a closed region, i.e. it includes -// its boundary. The latitude bounds must range between -90 to 90 degrees -// inclusive, and the longitude bounds must range between -180 to 180 degrees -// inclusive. Various cases include: -// -// - If `low` = `high`, the viewport consists of that single point. -// -// - If `low.longitude` > `high.longitude`, the longitude range is inverted -// (the viewport crosses the 180 degree longitude line). -// -// - If `low.longitude` = -180 degrees and `high.longitude` = 180 degrees, -// the viewport includes all longitudes. -// -// - If `low.longitude` = 180 degrees and `high.longitude` = -180 degrees, -// the longitude range is empty. -// -// - If `low.latitude` > `high.latitude`, the latitude range is empty. -// -// Both `low` and `high` must be populated, and the represented box cannot be -// empty (as specified by the definitions above). An empty viewport will result -// in an error. -// -// For example, this viewport fully encloses New York City: -// -// { -// "low": { -// "latitude": 40.477398, -// "longitude": -74.259087 -// }, -// "high": { -// "latitude": 40.91618, -// "longitude": -73.70018 -// } -// } -message Viewport { - // Required. The low point of the viewport. - google.type.LatLng low = 1; - - // Required. The high point of the viewport. - google.type.LatLng high = 2; -} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address.proto deleted file mode 100644 index c24a3bf9618..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address.proto +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.addressvalidation.v1; - -import "google/api/field_behavior.proto"; -import "google/type/postal_address.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.AddressValidation.V1"; -option go_package = "cloud.google.com/go/maps/addressvalidation/apiv1/addressvalidationpb;addressvalidationpb"; -option java_multiple_files = true; -option java_outer_classname = "AddressProto"; -option java_package = "com.google.maps.addressvalidation.v1"; -option objc_class_prefix = "GMPAVV1"; -option php_namespace = "Google\\Maps\\AddressValidation\\V1"; -option ruby_package = "Google::Maps::AddressValidation::V1"; - -// Details of the post-processed address. Post-processing includes -// correcting misspelled parts of the address, replacing incorrect parts, and -// inferring missing parts. -message Address { - // The post-processed address, formatted as a single-line address following - // the address formatting rules of the region where the address is located. - string formatted_address = 2; - - // The post-processed address represented as a postal address. - google.type.PostalAddress postal_address = 3; - - // Unordered list. The individual address components of the formatted and - // corrected address, along with validation information. This provides - // information on the validation status of the individual components. - // - // Address components are not ordered in a particular way. Do not make any - // assumptions on the ordering of the address components in the list. - repeated AddressComponent address_components = 4 - [(google.api.field_behavior) = UNORDERED_LIST]; - - // The types of components that were expected to be present in a correctly - // formatted mailing address but were not found in the input AND could - // not be inferred. Components of this type are not present in - // `formatted_address`, `postal_address`, or `address_components`. An - // example might be `['street_number', 'route']` for an input like - // "Boulder, Colorado, 80301, USA". The list of possible types can be found - // [here](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). - repeated string missing_component_types = 5; - - // The types of the components that are present in the `address_components` - // but could not be confirmed to be correct. This field is provided for the - // sake of convenience: its contents are equivalent to iterating through the - // `address_components` to find the types of all the components where the - // [confirmation_level][google.maps.addressvalidation.v1.AddressComponent.confirmation_level] - // is not - // [CONFIRMED][google.maps.addressvalidation.v1.AddressComponent.ConfirmationLevel.CONFIRMED] - // or the - // [inferred][google.maps.addressvalidation.v1.AddressComponent.inferred] - // flag is not set to `true`. The list of possible types can be found - // [here](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). - repeated string unconfirmed_component_types = 6; - - // Any tokens in the input that could not be resolved. This might be an - // input that was not recognized as a valid part of an address (for example - // in an input like "123235253253 Main St, San Francisco, CA, 94105", the - // unresolved tokens may look like `["123235253253"]` since that does not - // look like a valid street number. - repeated string unresolved_tokens = 7; -} - -// Represents an address component, such as a street, city, or state. -message AddressComponent { - // The different possible values for confirmation levels. - enum ConfirmationLevel { - // Default value. This value is unused. - CONFIRMATION_LEVEL_UNSPECIFIED = 0; - - // We were able to verify that this component exists and makes sense in the - // context of the rest of the address. - CONFIRMED = 1; - - // This component could not be confirmed, but it is plausible that it - // exists. For example, a street number within a known valid range of - // numbers on a street where specific house numbers are not known. - UNCONFIRMED_BUT_PLAUSIBLE = 2; - - // This component was not confirmed and is likely to be wrong. For - // example, a neighborhood that does not fit the rest of the address. - UNCONFIRMED_AND_SUSPICIOUS = 3; - } - - // The name for this component. - ComponentName component_name = 1; - - // The type of the address component. See - // [Table 2: Additional types returned by the Places - // service](https://developers.google.com/places/web-service/supported_types#table2) - // for a list of possible types. - string component_type = 2; - - // Indicates the level of certainty that we have that the component - // is correct. - ConfirmationLevel confirmation_level = 3; - - // Indicates that the component was not part of the input, but we - // inferred it for the address location and believe it should be provided - // for a complete address. - bool inferred = 4; - - // Indicates the spelling of the component name was corrected in a minor way, - // for example by switching two characters that appeared in the wrong order. - // This indicates a cosmetic change. - bool spell_corrected = 5; - - // Indicates the name of the component was replaced with a completely - // different one, for example a wrong postal code being replaced with one that - // is correct for the address. This is not a cosmetic change, the input - // component has been changed to a different one. - bool replaced = 6; - - // Indicates an address component that is not expected to be present in a - // postal address for the given region. We have retained it only because it - // was part of the input. - bool unexpected = 7; -} - -// A wrapper for the name of the component. -message ComponentName { - // The name text. For example, "5th Avenue" for a street name or "1253" for a - // street number. - string text = 1; - - // The BCP-47 language code. This will not be present if the component name is - // not associated with a language, such as a street number. - string language_code = 2; -} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address_validation_service.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address_validation_service.proto deleted file mode 100644 index ff19440eede..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/address_validation_service.proto +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.addressvalidation.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/maps/addressvalidation/v1/address.proto"; -import "google/maps/addressvalidation/v1/geocode.proto"; -import "google/maps/addressvalidation/v1/metadata.proto"; -import "google/maps/addressvalidation/v1/usps_data.proto"; -import "google/type/postal_address.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.AddressValidation.V1"; -option go_package = "cloud.google.com/go/maps/addressvalidation/apiv1/addressvalidationpb;addressvalidationpb"; -option java_multiple_files = true; -option java_outer_classname = "AddressValidationServiceProto"; -option java_package = "com.google.maps.addressvalidation.v1"; -option objc_class_prefix = "GMPAVV1"; -option php_namespace = "Google\\Maps\\AddressValidation\\V1"; -option ruby_package = "Google::Maps::AddressValidation::V1"; - -// The service for validating addresses. -service AddressValidation { - option (google.api.default_host) = "addressvalidation.googleapis.com"; - - // Validates an address. - rpc ValidateAddress(ValidateAddressRequest) - returns (ValidateAddressResponse) { - option (google.api.http) = { - post: "/v1:validateAddress" - body: "*" - }; - } - - // Feedback about the outcome of the sequence of validation attempts. This - // should be the last call made after a sequence of validation calls for the - // same address, and should be called once the transaction is concluded. This - // should only be sent once for the sequence of `ValidateAddress` requests - // needed to validate an address fully. - rpc ProvideValidationFeedback(ProvideValidationFeedbackRequest) - returns (ProvideValidationFeedbackResponse) { - option (google.api.http) = { - post: "/v1:provideValidationFeedback" - body: "*" - }; - } -} - -// The request for validating an address. -message ValidateAddressRequest { - // Required. The address being validated. Unformatted addresses should be - // submitted via [`address_lines`][google.type.PostalAddress.address_lines]. - // - // The total length of the fields in this input must not exceed 280 - // characters. - // - // Supported regions can be found in the - // [FAQ](https://developers.google.com/maps/documentation/address-validation/faq#which_regions_are_currently_supported). - // - // The [language_code][google.type.PostalAddress.language_code] value in the - // input address is reserved for future uses and is ignored today. The - // validated address result will be populated based on the preferred language - // for the given address, as identified by the system. - // - // The Address Validation API ignores the values in - // [recipients][google.type.PostalAddress.recipients] and - // [organization][google.type.PostalAddress.organization]. Any values in those - // fields will be discarded and not returned. Please do not set them. - google.type.PostalAddress address = 1 - [(google.api.field_behavior) = REQUIRED]; - - // This field must be empty for the first address validation request. If - // more requests are necessary to fully validate a single address (for - // example if the changes the user makes after the initial validation need to - // be re-validated), then each followup request must populate this field with - // the - // [response_id][google.maps.addressvalidation.v1.ValidateAddressResponse.response_id] - // from the very first response in the validation sequence. - string previous_response_id = 2; - - // Enables USPS CASS compatible mode. This affects _only_ the - // [google.maps.addressvalidation.v1.ValidationResult.usps_data] field of - // [google.maps.addressvalidation.v1.ValidationResult]. Note: for USPS CASS - // enabled requests for addresses in Puerto Rico, a - // [google.type.PostalAddress.region_code] of the `address` must be provided - // as "PR", or an [google.type.PostalAddress.administrative_area] of the - // `address` must be provided as "Puerto Rico" (case-insensitive) or "PR". - // - // It's recommended to use a componentized `address`, or alternatively specify - // at least two [google.type.PostalAddress.address_lines] where the first line - // contains the street number and name and the second line contains the city, - // state, and zip code. - bool enable_usps_cass = 3; -} - -// The response to an address validation request. -message ValidateAddressResponse { - // The result of the address validation. - ValidationResult result = 1; - - // The UUID that identifies this response. If the address needs to be - // re-validated, this UUID *must* accompany the new request. - string response_id = 2; -} - -// The request for sending validation feedback. -message ProvideValidationFeedbackRequest { - // The possible final outcomes of the sequence of address validation requests - // needed to validate an address. - enum ValidationConclusion { - // This value is unused. - // If the `ProvideValidationFeedbackRequest.conclusion` field is set to - // `VALIDATION_CONCLUSION_UNSPECIFIED`, an `INVALID_ARGUMENT` error will be - // returned. - VALIDATION_CONCLUSION_UNSPECIFIED = 0; - - // The version of the address returned by the Address Validation API was - // used for the transaction. - VALIDATED_VERSION_USED = 1; - - // The version of the address provided by the user was used for the - // transaction - USER_VERSION_USED = 2; - - // A version of the address that was entered after the last validation - // attempt but that was not re-validated was used for the transaction. - UNVALIDATED_VERSION_USED = 3; - - // The transaction was abandoned and the address was not used. - UNUSED = 4; - } - - // Required. The outcome of the sequence of validation attempts. - // - // If this field is set to `VALIDATION_CONCLUSION_UNSPECIFIED`, an - // `INVALID_ARGUMENT` error will be returned. - ValidationConclusion conclusion = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the response that this feedback is for. This should be - // the - // [response_id][google.maps.addressvalidation.v1.ValidateAddressRequest.response_id] - // from the first response in a series of address validation attempts. - string response_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The response for validation feedback. -// -// The response is empty if the feedback is sent successfully. -message ProvideValidationFeedbackResponse {} - -// The result of validating an address. -message ValidationResult { - // Overall verdict flags - Verdict verdict = 1; - - // Information about the address itself as opposed to the geocode. - Address address = 2; - - // Information about the location and place that the address geocoded to. - Geocode geocode = 3; - - // Other information relevant to deliverability. `metadata` is not guaranteed - // to be fully populated for every address sent to the Address Validation API. - AddressMetadata metadata = 4; - - // Extra deliverability flags provided by USPS. Only provided in region `US` - // and `PR`. - UspsData usps_data = 5; -} - -// High level overview of the address validation result and geocode. -message Verdict { - // The various granularities that an address or a geocode can have. - // When used to indicate granularity for an *address*, these values indicate - // with how fine a granularity the address identifies a mailing destination. - // For example, an address such as "123 Main Street, Redwood City, CA, 94061" - // identifies a `PREMISE` while something like "Redwood City, CA, 94061" - // identifies a `LOCALITY`. However, if we are unable to find a geocode for - // "123 Main Street" in Redwood City, the geocode returned might be of - // `LOCALITY` granularity even though the address is more granular. - enum Granularity { - // Default value. This value is unused. - GRANULARITY_UNSPECIFIED = 0; - - // Below-building level result, such as an apartment. - SUB_PREMISE = 1; - - // Building-level result. - PREMISE = 2; - - // A geocode that should be very close to the building-level location of - // the address. - PREMISE_PROXIMITY = 3; - - // The address or geocode indicates a block. Only used in regions which - // have block-level addressing, such as Japan. - BLOCK = 4; - - // The geocode or address is granular to route, such as a street, road, or - // highway. - ROUTE = 5; - - // All other granularities, which are bucketed together since they are not - // deliverable. - OTHER = 6; - } - - // The granularity of the **input** address. This is the result of parsing the - // input address and does not give any validation signals. For validation - // signals, refer to `validation_granularity` below. - // - // For example, if the input address includes a specific apartment number, - // then the `input_granularity` here will be `SUB_PREMISE`. If we cannot match - // the apartment number in the databases or the apartment number is invalid, - // the `validation_granularity` will likely be `PREMISE` or below. - Granularity input_granularity = 1; - - // The granularity level that the API can fully **validate** the address to. - // For example, an `validation_granularity` of `PREMISE` indicates all address - // components at the level of `PREMISE` or more coarse can be validated. - // - // Per address component validation result can be found in - // [google.maps.addressvalidation.v1.Address.address_components]. - Granularity validation_granularity = 2; - - // Information about the granularity of the - // [`geocode`][google.maps.addressvalidation.v1.ValidationResult.geocode]. - // This can be understood as the semantic meaning of how coarse or fine the - // geocoded location is. - // - // This can differ from the `validation_granularity` above occasionally. For - // example, our database might record the existence of an apartment number but - // do not have a precise location for the apartment within a big apartment - // complex. In that case, the `validation_granularity` will be `SUB_PREMISE` - // but the `geocode_granularity` will be `PREMISE`. - Granularity geocode_granularity = 3; - - // The address is considered complete if there are no unresolved tokens, no - // unexpected or missing address components. See - // [`missing_component_types`][google.maps.addressvalidation.v1.Address.missing_component_types], - // [`unresolved_tokens`][google.maps.addressvalidation.v1.Address.unresolved_tokens] - // or - // [`unexpected`][google.maps.addressvalidation.v1.AddressComponent.unexpected] - // fields for more details. - bool address_complete = 4; - - // At least one address component cannot be categorized or validated, see - // [google.maps.addressvalidation.v1.Address.address_components] for - // details. - bool has_unconfirmed_components = 5; - - // At least one address component was inferred (added) that wasn't in the - // input, see - // [google.maps.addressvalidation.v1.Address.address_components] for - // details. - bool has_inferred_components = 6; - - // At least one address component was replaced, see - // [google.maps.addressvalidation.v1.Address.address_components] for - // details. - bool has_replaced_components = 7; -} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/geocode.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/geocode.proto deleted file mode 100644 index 2caa88a4cd5..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/geocode.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.maps.addressvalidation.v1; - -import "google/geo/type/viewport.proto"; -import "google/type/latlng.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.AddressValidation.V1"; -option go_package = "cloud.google.com/go/maps/addressvalidation/apiv1/addressvalidationpb;addressvalidationpb"; -option java_multiple_files = true; -option java_outer_classname = "GeocodeProto"; -option java_package = "com.google.maps.addressvalidation.v1"; -option objc_class_prefix = "GMPAVV1"; -option php_namespace = "Google\\Maps\\AddressValidation\\V1"; -option ruby_package = "Google::Maps::AddressValidation::V1"; - -// Contains information about the place the input was geocoded to. -message Geocode { - // The geocoded location of the input. - // - // Using place IDs is preferred over using addresses, - // latitude/longitude coordinates, or plus codes. Using coordinates when - // routing or calculating driving directions will always result in the point - // being snapped to the road nearest to those coordinates. This may not be a - // road that will quickly or safely lead to the destination and may not be - // near an access point to the property. Additionally, when a location is - // reverse geocoded, there is no guarantee that the returned address will - // match the original. - google.type.LatLng location = 1; - - // The plus code corresponding to the `location`. - PlusCode plus_code = 2; - - // The bounds of the geocoded place. - google.geo.type.Viewport bounds = 4; - - // The size of the geocoded place, in meters. This is another measure of the - // coarseness of the geocoded location, but in physical size rather than in - // semantic meaning. - float feature_size_meters = 5; - - // The PlaceID of the place this input geocodes to. - // - // For more information about Place IDs see - // [here](https://developers.google.com/maps/documentation/places/web-service/place-id). - string place_id = 6; - - // The type(s) of place that the input geocoded to. For example, - // `['locality', 'political']`. The full list of types can be found - // [here](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). - repeated string place_types = 7; -} - -// Plus code (http://plus.codes) is a location reference with two formats: -// global code defining a 14mx14m (1/8000th of a degree) or smaller rectangle, -// and compound code, replacing the prefix with a reference location. -message PlusCode { - // Place's global (full) code, such as "9FWM33GV+HQ", representing an - // 1/8000 by 1/8000 degree area (~14 by 14 meters). - string global_code = 1; - - // Place's compound code, such as "33GV+HQ, Ramberg, Norway", containing - // the suffix of the global code and replacing the prefix with a formatted - // name of a reference entity. - string compound_code = 2; -} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/metadata.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/metadata.proto deleted file mode 100644 index b65b4984127..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/metadata.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.addressvalidation.v1; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.AddressValidation.V1"; -option go_package = "cloud.google.com/go/maps/addressvalidation/apiv1/addressvalidationpb;addressvalidationpb"; -option java_multiple_files = true; -option java_outer_classname = "MetadataProto"; -option java_package = "com.google.maps.addressvalidation.v1"; -option objc_class_prefix = "GMPAVV1"; -option php_namespace = "Google\\Maps\\AddressValidation\\V1"; -option ruby_package = "Google::Maps::AddressValidation::V1"; - -// The metadata for the address. `metadata` is not guaranteed to be fully -// populated for every address sent to the Address Validation API. -message AddressMetadata { - // Indicates that this is the address of a business. - // If unset, indicates that the value is unknown. - optional bool business = 2; - - // Indicates that the address of a PO box. - // If unset, indicates that the value is unknown. - optional bool po_box = 3; - - // Indicates that this is the address of a residence. - // If unset, indicates that the value is unknown. - optional bool residential = 6; -} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/usps_data.proto b/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/usps_data.proto deleted file mode 100644 index c1680a12779..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/protos/google/maps/addressvalidation/v1/usps_data.proto +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.addressvalidation.v1; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.AddressValidation.V1"; -option go_package = "cloud.google.com/go/maps/addressvalidation/apiv1/addressvalidationpb;addressvalidationpb"; -option java_multiple_files = true; -option java_outer_classname = "UspsDataProto"; -option java_package = "com.google.maps.addressvalidation.v1"; -option objc_class_prefix = "GMPAVV1"; -option php_namespace = "Google\\Maps\\AddressValidation\\V1"; -option ruby_package = "Google::Maps::AddressValidation::V1"; - -// USPS representation of a US address. -message UspsAddress { - // First address line. - string first_address_line = 1; - - // Firm name. - string firm = 2; - - // Second address line. - string second_address_line = 3; - - // Puerto Rican urbanization name. - string urbanization = 4; - - // City + state + postal code. - string city_state_zip_address_line = 5; - - // City name. - string city = 6; - - // 2 letter state code. - string state = 7; - - // Postal code e.g. 10009. - string zip_code = 8; - - // 4-digit postal code extension e.g. 5023. - string zip_code_extension = 9; -} - -// The USPS data for the address. `uspsData` is not guaranteed to be fully -// populated for every US or PR address sent to the Address Validation API. It's -// recommended to integrate the backup address fields in the response if you -// utilize uspsData as the primary part of the response. -message UspsData { - // USPS standardized address. - UspsAddress standardized_address = 1; - - // 2 digit delivery point code - string delivery_point_code = 2; - - // The delivery point check digit. This number is added to the end of the - // delivery_point_barcode for mechanically scanned mail. Adding all the - // digits of the delivery_point_barcode, delivery_point_check_digit, postal - // code, and ZIP+4 together should yield a number divisible by 10. - string delivery_point_check_digit = 3; - - // The possible values for DPV confirmation. Returns a single character. - // - // * `Y`: Address was DPV confirmed for primary and any secondary numbers. - // * `N`: Primary and any secondary number information failed to - // DPV confirm. - // * `S`: Address was DPV confirmed for the primary number only, and the - // secondary number information was present by not confirmed. - // * `D`: Address was DPV confirmed for the primary number only, and the - // secondary number information was missing. - string dpv_confirmation = 4; - - // The footnotes from delivery point validation. - // Multiple footnotes may be strung together in the same string. - // - // * `AA`: Input address matched to the ZIP+4 file - // * `A1`: Input address was not matched to the ZIP+4 file - // * `BB`: Matched to DPV (all components) - // * `CC`: Secondary number not matched (present but invalid) - // * `N1`: High-rise address missing secondary number - // * `M1`: Primary number missing - // * `M3`: Primary number invalid - // * `P1`: Input address RR or HC box number missing - // * `P3`: Input address PO, RR, or HC Box number invalid - // * `F1`: Input address matched to a military address - // * `G1`: Input address matched to a general delivery address - // * `U1`: Input address matched to a unique ZIP code - // * `PB`: Input address matched to PBSA record - // * `RR`: DPV confirmed address with PMB information - // * `R1`: DPV confirmed address without PMB information - // * `R7`: Carrier Route R777 or R779 record - string dpv_footnote = 5; - - // Indicates if the address is a CMRA (Commercial Mail Receiving Agency)--a - // private business receiving mail for clients. Returns a single character. - // - // * `Y`: The address is a CMRA - // * `N`: The address is not a CMRA - string dpv_cmra = 6; - - // Is this place vacant? - // Returns a single character. - // - // * `Y`: The address is vacant - // * `N`: The address is not vacant - string dpv_vacant = 7; - - // Is this a no stat address or an active address? - // No stat addresses are ones which are not continuously occupied or addresses - // that the USPS does not service. Returns a single character. - // - // * `Y`: The address is not active - // * `N`: The address is active - string dpv_no_stat = 8; - - // The carrier route code. - // A four character code consisting of a one letter prefix and a three digit - // route designator. - // - // Prefixes: - // - // * `C`: Carrier route (or city route) - // * `R`: Rural route - // * `H`: Highway Contract Route - // * `B`: Post Office Box Section - // * `G`: General delivery unit - string carrier_route = 9; - - // Carrier route rate sort indicator. - string carrier_route_indicator = 10; - - // The delivery address is matchable, but the EWS file indicates that an exact - // match will be available soon. - bool ews_no_match = 11; - - // Main post office city. - string post_office_city = 12; - - // Main post office state. - string post_office_state = 13; - - // Abbreviated city. - string abbreviated_city = 14; - - // FIPS county code. - string fips_county_code = 15; - - // County name. - string county = 16; - - // Enhanced Line of Travel (eLOT) number. - string elot_number = 17; - - // eLOT Ascending/Descending Flag (A/D). - string elot_flag = 18; - - // LACSLink return code. - string lacs_link_return_code = 19; - - // LACSLink indicator. - string lacs_link_indicator = 20; - - // PO Box only postal code. - bool po_box_only_postal_code = 21; - - // Footnotes from matching a street or highrise record to suite information. - // If business name match is found, the secondary number is returned. - // - // * `A`: SuiteLink record match, business address improved. - // * `00`: No match, business address is not improved. - string suitelink_footnote = 22; - - // PMB (Private Mail Box) unit designator. - string pmb_designator = 23; - - // PMB (Private Mail Box) number; - string pmb_number = 24; - - // Type of the address record that matches the input address. - // - // * `F`: FIRM. This is a match to a Firm Record, which is the finest level of - // match available for an address. - // * `G`: GENERAL DELIVERY. This is a match to a General Delivery record. - // * `H`: BUILDING / APARTMENT. This is a match to a Building or Apartment - // record. - // * `P`: POST OFFICE BOX. This is a match to a Post Office Box. - // * `R`: RURAL ROUTE or HIGHWAY CONTRACT: This is a match to either a Rural - // Route or a Highway Contract record, both of which may have associated Box - // Number ranges. - // * `S`: STREET RECORD: This is a match to a Street record containing a valid - // primary number range. - string address_record_type = 25; - - // Indicator that a default address was found, but more specific addresses - // exists. - bool default_address = 26; - - // Error message for USPS data retrieval. This is populated when USPS - // processing is suspended because of the detection of artificially created - // addresses. - // - // The USPS data fields might not be populated when this error is present. - string error_message = 27; - - // Indicator that the request has been CASS processed. - bool cass_processed = 28; -} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.provide_validation_feedback.js b/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.provide_validation_feedback.js deleted file mode 100644 index 009afa431d0..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.provide_validation_feedback.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(conclusion, responseId) { - // [START addressvalidation_v1_generated_AddressValidation_ProvideValidationFeedback_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The outcome of the sequence of validation attempts. - * If this field is set to `VALIDATION_CONCLUSION_UNSPECIFIED`, an - * `INVALID_ARGUMENT` error will be returned. - */ - // const conclusion = {} - /** - * Required. The ID of the response that this feedback is for. This should be - * the - * response_id google.maps.addressvalidation.v1.ValidateAddressRequest.response_id - * from the first response in a series of address validation attempts. - */ - // const responseId = 'abc123' - - // Imports the Addressvalidation library - const {AddressValidationClient} = require('@googlemaps/addressvalidation').v1; - - // Instantiates a client - const addressvalidationClient = new AddressValidationClient(); - - async function callProvideValidationFeedback() { - // Construct request - const request = { - conclusion, - responseId, - }; - - // Run request - const response = await addressvalidationClient.provideValidationFeedback(request); - console.log(response); - } - - callProvideValidationFeedback(); - // [END addressvalidation_v1_generated_AddressValidation_ProvideValidationFeedback_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.validate_address.js b/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.validate_address.js deleted file mode 100644 index 4fcef6fdc8b..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/address_validation.validate_address.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(address) { - // [START addressvalidation_v1_generated_AddressValidation_ValidateAddress_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The address being validated. Unformatted addresses should be - * submitted via `address_lines` google.type.PostalAddress.address_lines. - * The total length of the fields in this input must not exceed 280 - * characters. - * Supported regions can be found in the - * FAQ (https://developers.google.com/maps/documentation/address-validation/faq#which_regions_are_currently_supported). - * The language_code google.type.PostalAddress.language_code value in the - * input address is reserved for future uses and is ignored today. The - * validated address result will be populated based on the preferred language - * for the given address, as identified by the system. - * The Address Validation API ignores the values in - * recipients google.type.PostalAddress.recipients and - * organization google.type.PostalAddress.organization. Any values in those - * fields will be discarded and not returned. Please do not set them. - */ - // const address = {} - /** - * This field must be empty for the first address validation request. If - * more requests are necessary to fully validate a single address (for - * example if the changes the user makes after the initial validation need to - * be re-validated), then each followup request must populate this field with - * the - * response_id google.maps.addressvalidation.v1.ValidateAddressResponse.response_id - * from the very first response in the validation sequence. - */ - // const previousResponseId = 'abc123' - /** - * Enables USPS CASS compatible mode. This affects _only_ the - * google.maps.addressvalidation.v1.ValidationResult.usps_data field of - * google.maps.addressvalidation.v1.ValidationResult. Note: for USPS CASS - * enabled requests for addresses in Puerto Rico, a - * google.type.PostalAddress.region_code of the `address` must be provided - * as "PR", or an google.type.PostalAddress.administrative_area of the - * `address` must be provided as "Puerto Rico" (case-insensitive) or "PR". - * It's recommended to use a componentized `address`, or alternatively specify - * at least two google.type.PostalAddress.address_lines where the first line - * contains the street number and name and the second line contains the city, - * state, and zip code. - */ - // const enableUspsCass = true - - // Imports the Addressvalidation library - const {AddressValidationClient} = require('@googlemaps/addressvalidation').v1; - - // Instantiates a client - const addressvalidationClient = new AddressValidationClient(); - - async function callValidateAddress() { - // Construct request - const request = { - address, - }; - - // Run request - const response = await addressvalidationClient.validateAddress(request); - console.log(response); - } - - callValidateAddress(); - // [END addressvalidation_v1_generated_AddressValidation_ValidateAddress_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/snippet_metadata_google.maps.addressvalidation.v1.json b/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/snippet_metadata_google.maps.addressvalidation.v1.json deleted file mode 100644 index 12872e9d560..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/samples/generated/v1/snippet_metadata_google.maps.addressvalidation.v1.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-addressvalidation", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.maps.addressvalidation.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "addressvalidation_v1_generated_AddressValidation_ValidateAddress_async", - "title": "AddressValidation validateAddress Sample", - "origin": "API_DEFINITION", - "description": " Validates an address.", - "canonical": true, - "file": "address_validation.validate_address.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 90, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ValidateAddress", - "fullName": "google.maps.addressvalidation.v1.AddressValidation.ValidateAddress", - "async": true, - "parameters": [ - { - "name": "address", - "type": ".google.type.PostalAddress" - }, - { - "name": "previous_response_id", - "type": "TYPE_STRING" - }, - { - "name": "enable_usps_cass", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.maps.addressvalidation.v1.ValidateAddressResponse", - "client": { - "shortName": "AddressValidationClient", - "fullName": "google.maps.addressvalidation.v1.AddressValidationClient" - }, - "method": { - "shortName": "ValidateAddress", - "fullName": "google.maps.addressvalidation.v1.AddressValidation.ValidateAddress", - "service": { - "shortName": "AddressValidation", - "fullName": "google.maps.addressvalidation.v1.AddressValidation" - } - } - } - }, - { - "regionTag": "addressvalidation_v1_generated_AddressValidation_ProvideValidationFeedback_async", - "title": "AddressValidation provideValidationFeedback Sample", - "origin": "API_DEFINITION", - "description": " Feedback about the outcome of the sequence of validation attempts. This should be the last call made after a sequence of validation calls for the same address, and should be called once the transaction is concluded. This should only be sent once for the sequence of `ValidateAddress` requests needed to validate an address fully.", - "canonical": true, - "file": "address_validation.provide_validation_feedback.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ProvideValidationFeedback", - "fullName": "google.maps.addressvalidation.v1.AddressValidation.ProvideValidationFeedback", - "async": true, - "parameters": [ - { - "name": "conclusion", - "type": ".google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest.ValidationConclusion" - }, - { - "name": "response_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.maps.addressvalidation.v1.ProvideValidationFeedbackResponse", - "client": { - "shortName": "AddressValidationClient", - "fullName": "google.maps.addressvalidation.v1.AddressValidationClient" - }, - "method": { - "shortName": "ProvideValidationFeedback", - "fullName": "google.maps.addressvalidation.v1.AddressValidation.ProvideValidationFeedback", - "service": { - "shortName": "AddressValidation", - "fullName": "google.maps.addressvalidation.v1.AddressValidation" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/index.ts b/owl-bot-staging/google-maps-addressvalidation/v1/src/index.ts deleted file mode 100644 index 38af5ee576f..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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 AddressValidationClient = v1.AddressValidationClient; -type AddressValidationClient = v1.AddressValidationClient; -export {v1, AddressValidationClient}; -export default {v1, AddressValidationClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client.ts b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client.ts deleted file mode 100644 index 5797e0352fc..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client.ts +++ /dev/null @@ -1,484 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/address_validation_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './address_validation_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The service for validating addresses. - * @class - * @memberof v1 - */ -export class AddressValidationClient { - 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}; - addressValidationStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AddressValidationClient. - * - * @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 AddressValidationClient({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 AddressValidationClient; - 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.maps.addressvalidation.v1.AddressValidation', 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.addressValidationStub) { - return this.addressValidationStub; - } - - // Put together the "service stub" for - // google.maps.addressvalidation.v1.AddressValidation. - this.addressValidationStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.maps.addressvalidation.v1.AddressValidation') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.maps.addressvalidation.v1.AddressValidation, - 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 addressValidationStubMethods = - ['validateAddress', 'provideValidationFeedback']; - for (const methodName of addressValidationStubMethods) { - const callPromise = this.addressValidationStub.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.addressValidationStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'addressvalidation.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 'addressvalidation.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 []; - } - - 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 -- - // ------------------- -/** - * Validates an address. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.type.PostalAddress} request.address - * Required. The address being validated. Unformatted addresses should be - * submitted via {@link protos.google.type.PostalAddress.address_lines|`address_lines`}. - * - * The total length of the fields in this input must not exceed 280 - * characters. - * - * Supported regions can be found in the - * [FAQ](https://developers.google.com/maps/documentation/address-validation/faq#which_regions_are_currently_supported). - * - * The {@link protos.google.type.PostalAddress.language_code|language_code} value in the - * input address is reserved for future uses and is ignored today. The - * validated address result will be populated based on the preferred language - * for the given address, as identified by the system. - * - * The Address Validation API ignores the values in - * {@link protos.google.type.PostalAddress.recipients|recipients} and - * {@link protos.google.type.PostalAddress.organization|organization}. Any values in those - * fields will be discarded and not returned. Please do not set them. - * @param {string} request.previousResponseId - * This field must be empty for the first address validation request. If - * more requests are necessary to fully validate a single address (for - * example if the changes the user makes after the initial validation need to - * be re-validated), then each followup request must populate this field with - * the - * {@link protos.google.maps.addressvalidation.v1.ValidateAddressResponse.response_id|response_id} - * from the very first response in the validation sequence. - * @param {boolean} request.enableUspsCass - * Enables USPS CASS compatible mode. This affects _only_ the - * [google.maps.addressvalidation.v1.ValidationResult.usps_data] field of - * [google.maps.addressvalidation.v1.ValidationResult]. Note: for USPS CASS - * enabled requests for addresses in Puerto Rico, a - * [google.type.PostalAddress.region_code] of the `address` must be provided - * as "PR", or an [google.type.PostalAddress.administrative_area] of the - * `address` must be provided as "Puerto Rico" (case-insensitive) or "PR". - * - * It's recommended to use a componentized `address`, or alternatively specify - * at least two [google.type.PostalAddress.address_lines] where the first line - * contains the street number and name and the second line contains the city, - * state, and zip code. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.maps.addressvalidation.v1.ValidateAddressResponse|ValidateAddressResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/address_validation.validate_address.js - * region_tag:addressvalidation_v1_generated_AddressValidation_ValidateAddress_async - */ - validateAddress( - request?: protos.google.maps.addressvalidation.v1.IValidateAddressRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.addressvalidation.v1.IValidateAddressResponse, - protos.google.maps.addressvalidation.v1.IValidateAddressRequest|undefined, {}|undefined - ]>; - validateAddress( - request: protos.google.maps.addressvalidation.v1.IValidateAddressRequest, - options: CallOptions, - callback: Callback< - protos.google.maps.addressvalidation.v1.IValidateAddressResponse, - protos.google.maps.addressvalidation.v1.IValidateAddressRequest|null|undefined, - {}|null|undefined>): void; - validateAddress( - request: protos.google.maps.addressvalidation.v1.IValidateAddressRequest, - callback: Callback< - protos.google.maps.addressvalidation.v1.IValidateAddressResponse, - protos.google.maps.addressvalidation.v1.IValidateAddressRequest|null|undefined, - {}|null|undefined>): void; - validateAddress( - request?: protos.google.maps.addressvalidation.v1.IValidateAddressRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.maps.addressvalidation.v1.IValidateAddressResponse, - protos.google.maps.addressvalidation.v1.IValidateAddressRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.maps.addressvalidation.v1.IValidateAddressResponse, - protos.google.maps.addressvalidation.v1.IValidateAddressRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.maps.addressvalidation.v1.IValidateAddressResponse, - protos.google.maps.addressvalidation.v1.IValidateAddressRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.validateAddress(request, options, callback); - } -/** - * Feedback about the outcome of the sequence of validation attempts. This - * should be the last call made after a sequence of validation calls for the - * same address, and should be called once the transaction is concluded. This - * should only be sent once for the sequence of `ValidateAddress` requests - * needed to validate an address fully. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest.ValidationConclusion} request.conclusion - * Required. The outcome of the sequence of validation attempts. - * - * If this field is set to `VALIDATION_CONCLUSION_UNSPECIFIED`, an - * `INVALID_ARGUMENT` error will be returned. - * @param {string} request.responseId - * Required. The ID of the response that this feedback is for. This should be - * the - * {@link protos.google.maps.addressvalidation.v1.ValidateAddressRequest.response_id|response_id} - * from the first response in a series of address validation attempts. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackResponse|ProvideValidationFeedbackResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/address_validation.provide_validation_feedback.js - * region_tag:addressvalidation_v1_generated_AddressValidation_ProvideValidationFeedback_async - */ - provideValidationFeedback( - request?: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|undefined, {}|undefined - ]>; - provideValidationFeedback( - request: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest, - options: CallOptions, - callback: Callback< - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|null|undefined, - {}|null|undefined>): void; - provideValidationFeedback( - request: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest, - callback: Callback< - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|null|undefined, - {}|null|undefined>): void; - provideValidationFeedback( - request?: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, - protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.provideValidationFeedback(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.addressValidationStub && !this._terminated) { - return this.addressValidationStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client_config.json b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client_config.json deleted file mode 100644 index c3dd03edb53..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_client_config.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "interfaces": { - "google.maps.addressvalidation.v1.AddressValidation": { - "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": { - "ValidateAddress": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ProvideValidationFeedback": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_proto_list.json b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_proto_list.json deleted file mode 100644 index 9ab3e6f65b3..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/address_validation_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/geo/type/viewport.proto", - "../../protos/google/maps/addressvalidation/v1/address.proto", - "../../protos/google/maps/addressvalidation/v1/address_validation_service.proto", - "../../protos/google/maps/addressvalidation/v1/geocode.proto", - "../../protos/google/maps/addressvalidation/v1/metadata.proto", - "../../protos/google/maps/addressvalidation/v1/usps_data.proto" -] diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 211049fb088..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.maps.addressvalidation.v1", - "libraryPackage": "@googlemaps/addressvalidation", - "services": { - "AddressValidation": { - "clients": { - "grpc": { - "libraryClient": "AddressValidationClient", - "rpcs": { - "ValidateAddress": { - "methods": [ - "validateAddress" - ] - }, - "ProvideValidationFeedback": { - "methods": [ - "provideValidationFeedback" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AddressValidationClient", - "rpcs": { - "ValidateAddress": { - "methods": [ - "validateAddress" - ] - }, - "ProvideValidationFeedback": { - "methods": [ - "provideValidationFeedback" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/index.ts b/owl-bot-staging/google-maps-addressvalidation/v1/src/v1/index.ts deleted file mode 100644 index cef71fb5605..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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 {AddressValidationClient} from './address_validation_client'; diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 0e1c650f399..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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 addressvalidation = require('@googlemaps/addressvalidation'); - -function main() { - const addressValidationClient = new addressvalidation.AddressValidationClient(); -} - -main(); diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-maps-addressvalidation/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 9ec2e4c7144..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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 {AddressValidationClient} from '@googlemaps/addressvalidation'; - -// check that the client class type name can be used -function doStuffWithAddressValidationClient(client: AddressValidationClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const addressValidationClient = new AddressValidationClient(); - doStuffWithAddressValidationClient(addressValidationClient); -} - -main(); diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/system-test/install.ts b/owl-bot-staging/google-maps-addressvalidation/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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-maps-addressvalidation/v1/test/gapic_address_validation_v1.ts b/owl-bot-staging/google-maps-addressvalidation/v1/test/gapic_address_validation_v1.ts deleted file mode 100644 index a0da41bdf1f..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/v1/test/gapic_address_validation_v1.ts +++ /dev/null @@ -1,300 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 addressvalidationModule 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.AddressValidationClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = addressvalidationModule.v1.AddressValidationClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = addressvalidationModule.v1.AddressValidationClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = addressvalidationModule.v1.AddressValidationClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new addressvalidationModule.v1.AddressValidationClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.addressValidationStub, undefined); - await client.initialize(); - assert(client.addressValidationStub); - }); - - it('has close method for the initialized client', done => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.addressValidationStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.addressValidationStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new addressvalidationModule.v1.AddressValidationClient({ - 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 addressvalidationModule.v1.AddressValidationClient({ - 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('validateAddress', () => { - it('invokes validateAddress without error', async () => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ValidateAddressRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ValidateAddressResponse() - ); - client.innerApiCalls.validateAddress = stubSimpleCall(expectedResponse); - const [response] = await client.validateAddress(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes validateAddress without error using callback', async () => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ValidateAddressRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ValidateAddressResponse() - ); - client.innerApiCalls.validateAddress = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.validateAddress( - request, - (err?: Error|null, result?: protos.google.maps.addressvalidation.v1.IValidateAddressResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes validateAddress with error', async () => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ValidateAddressRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.validateAddress = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.validateAddress(request), expectedError); - }); - - it('invokes validateAddress with closed client', async () => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ValidateAddressRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.validateAddress(request), expectedError); - }); - }); - - describe('provideValidationFeedback', () => { - it('invokes provideValidationFeedback without error', async () => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackResponse() - ); - client.innerApiCalls.provideValidationFeedback = stubSimpleCall(expectedResponse); - const [response] = await client.provideValidationFeedback(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes provideValidationFeedback without error using callback', async () => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackResponse() - ); - client.innerApiCalls.provideValidationFeedback = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.provideValidationFeedback( - request, - (err?: Error|null, result?: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes provideValidationFeedback with error', async () => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.provideValidationFeedback = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.provideValidationFeedback(request), expectedError); - }); - - it('invokes provideValidationFeedback with closed client', async () => { - const client = new addressvalidationModule.v1.AddressValidationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.addressvalidation.v1.ProvideValidationFeedbackRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.provideValidationFeedback(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-maps-addressvalidation/v1/tsconfig.json b/owl-bot-staging/google-maps-addressvalidation/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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-maps-addressvalidation/v1/webpack.config.js b/owl-bot-staging/google-maps-addressvalidation/v1/webpack.config.js deleted file mode 100644 index 2a83cc6ddae..00000000000 --- a/owl-bot-staging/google-maps-addressvalidation/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: 'AddressValidation', - filename: './address-validation.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-maps-mapsplatformdatasets/v1/.eslintignore b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1/.eslintrc.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.gitignore b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1/.jsdoc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.jsdoc.js deleted file mode 100644 index 24b47733dc9..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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: '@googlemaps/maps-platform-datasets', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.mocharc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1/.prettierrc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1/README.md b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/README.md deleted file mode 100644 index e0e26d17fff..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Mapsplatformdatasets: Nodejs Client diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/package.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/package.json deleted file mode 100644 index 407201353ba..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@googlemaps/maps-platform-datasets", - "version": "0.1.0", - "description": "Mapsplatformdatasets client for Node.js", - "repository": "googleapis/nodejs-mapsplatformdatasets", - "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 mapsplatformdatasets", - "mapsplatformdatasets", - "maps platform datasets" - ], - "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-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/data_source.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/data_source.proto deleted file mode 100644 index fc92a0c83a0..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/data_source.proto +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.mapsplatformdatasets.v1; - -option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1"; -option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1/mapsplatformdatasetspb;mapsplatformdatasetspb"; -option java_multiple_files = true; -option java_outer_classname = "DataSourceProto"; -option java_package = "com.google.maps.mapsplatformdatasets.v1"; -option objc_class_prefix = "MDV1"; -option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1"; - -// The details about the data source when it is a local file. -message LocalFileSource { - // The file name of the uploaded file. - string filename = 1; - - // The format of the file that is being uploaded. - FileFormat file_format = 2; -} - -// The details about the data source when it is in Google Cloud Storage. -message GcsSource { - // Source data URI. For example, `gs://my_bucket/my_object`. - string input_uri = 1; - - // The file format of the Google Cloud Storage object. This is used mainly for - // validation. - FileFormat file_format = 2; -} - -// The format of the file being uploaded. -enum FileFormat { - // Unspecified file format. - FILE_FORMAT_UNSPECIFIED = 0; - - // GeoJson file. - FILE_FORMAT_GEOJSON = 1; - - // KML file. - FILE_FORMAT_KML = 2; - - // CSV file. - FILE_FORMAT_CSV = 3; -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/dataset.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/dataset.proto deleted file mode 100644 index 0c9bda17822..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/dataset.proto +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.mapsplatformdatasets.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/maps/mapsplatformdatasets/v1/data_source.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1"; -option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1/mapsplatformdatasetspb;mapsplatformdatasetspb"; -option java_multiple_files = true; -option java_outer_classname = "DatasetProto"; -option java_package = "com.google.maps.mapsplatformdatasets.v1"; -option objc_class_prefix = "MDV1"; -option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1"; - -// A representation of a Maps Dataset resource. -message Dataset { - option (google.api.resource) = { - type: "mapsplatformdatasets.googleapis.com/Dataset" - pattern: "projects/{project}/datasets/{dataset}" - }; - - // Resource name, - // projects/{project}/datasets/{dataset_id} - string name = 1; - - // Human readable name, shown in the console UI . - string display_name = 2; - - // A description of this dataset . - string description = 3; - - // The version ID of the dataset. - string version_id = 4; - - // Specified use case for this dataset. - repeated Usage usage = 5; - - // Details about the source of the data for the dataset. - oneof data_source { - // A local file source for the dataset for a single upload. - LocalFileSource local_file_source = 6; - - // A Google Cloud Storage file source for the dataset for a single upload. - GcsSource gcs_source = 7; - } - - // Output only. The status of this dataset version. - Status status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when the dataset was first created. - google.protobuf.Timestamp create_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when the dataset metadata was last updated. - google.protobuf.Timestamp update_time = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when the data was uploaded. - google.protobuf.Timestamp version_create_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The description for this version of dataset. It is provided - // when importing data to the dataset. - string version_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Status of the dataset. -message Status { - // A list of states for the dataset. - enum State { - // The state of this dataset is not set. - STATE_UNSPECIFIED = 0; - - // Data is being imported to a dataset. - STATE_IMPORTING = 1; - - // Importing data to a dataset succeeded. - STATE_IMPORT_SUCCEEDED = 2; - - // Importing data to a dataset failed. - STATE_IMPORT_FAILED = 3; - - // The dataset is in the process of getting deleted. - STATE_DELETING = 4; - - // The deletion failed state. This state represents that dataset deletion - // has failed. Deletion may be retried. - STATE_DELETION_FAILED = 5; - - // Data is being processed. - STATE_PROCESSING = 6; - - // The processing failed state. This state represents that processing has - // failed and may report errors. - STATE_PROCESSING_FAILED = 7; - - // This state is currently not used. - STATE_NEEDS_REVIEW = 8; - - // The publishing state. This state represents the publishing is in - // progress. - STATE_PUBLISHING = 9; - - // The publishing failed states. This state represents that the - // publishing failed. Publishing may be retried. - STATE_PUBLISHING_FAILED = 10; - - // The completed state. This state represents the dataset being - // available for its specific usage. - STATE_COMPLETED = 11; - } - - // State enum for status. - State state = 1; - - // Error message indicating reason of failure. It is empty if the datasets is - // not in a failed state. - string error_message = 2; -} - -// Usage specifies where the data is intended to be used to inform how to -// process the data. -enum Usage { - // The usage of this dataset is not set. - USAGE_UNSPECIFIED = 0; - - // This dataset will be used for data driven styling. - USAGE_DATA_DRIVEN_STYLING = 1; -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto deleted file mode 100644 index 4202decb0c2..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.mapsplatformdatasets.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/maps/mapsplatformdatasets/v1/data_source.proto"; -import "google/maps/mapsplatformdatasets/v1/dataset.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1"; -option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1/mapsplatformdatasetspb;mapsplatformdatasetspb"; -option java_multiple_files = true; -option java_outer_classname = "MapsPlatformDatasetsProto"; -option java_package = "com.google.maps.mapsplatformdatasets.v1"; -option objc_class_prefix = "MDV1"; -option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1"; - -// Request to create a maps dataset. -message CreateDatasetRequest { - // Required. Parent project that will own the dataset. - // Format: projects/{$project} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The dataset version to create. - Dataset dataset = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to update the metadata fields of the dataset. -message UpdateDatasetMetadataRequest { - // Required. The dataset to update. The dataset's name is used to identify the - // dataset to be updated. The name has the format: - // projects/{project}/datasets/{dataset_id} - Dataset dataset = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. Support the value "*" for full - // replacement. - google.protobuf.FieldMask update_mask = 2; -} - -// Request to get the specified dataset. -message GetDatasetRequest { - // Required. Resource name. projects/{project}/datasets/{dataset_id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "mapsplatformdatasets.googleapis.com/Dataset" - } - ]; -} - -// Request to list datasets for the project. -message ListDatasetsRequest { - // Required. The name of the project to list all the datasets for. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // The maximum number of versions to return per page. - // If unspecified (or zero), all datasets will be returned. - int32 page_size = 2; - - // The page token, received from a previous ListDatasets call. - // Provide this to retrieve the subsequent page. - string page_token = 3; -} - -// Response to list datasets for the project. -message ListDatasetsResponse { - // All the datasets for the project. - repeated Dataset datasets = 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; -} - -// Request to delete a dataset. -// -// The dataset to be deleted. -message DeleteDatasetRequest { - // Required. Format: projects/${project}/datasets/{dataset_id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "mapsplatformdatasets.googleapis.com/Dataset" - } - ]; -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets_service.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets_service.proto deleted file mode 100644 index 1ae92a7c4b4..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets_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.maps.mapsplatformdatasets.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/maps/mapsplatformdatasets/v1/dataset.proto"; -import "google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto"; -import "google/protobuf/empty.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1"; -option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1/mapsplatformdatasetspb;mapsplatformdatasetspb"; -option java_multiple_files = true; -option java_outer_classname = "MapsPlatformDatasetsServiceProto"; -option java_package = "com.google.maps.mapsplatformdatasets.v1"; -option objc_class_prefix = "MDV1"; -option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1"; - -// Service definition for the Maps Platform Datasets API. -service MapsPlatformDatasets { - option (google.api.default_host) = "mapsplatformdatasets.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Create a new dataset for the specified project. - rpc CreateDataset(CreateDatasetRequest) returns (Dataset) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/datasets" - body: "dataset" - }; - option (google.api.method_signature) = "parent,dataset"; - } - - // Update the metadata for the dataset. - rpc UpdateDatasetMetadata(UpdateDatasetMetadataRequest) returns (Dataset) { - option (google.api.http) = { - patch: "/v1/{dataset.name=projects/*/datasets/*}" - body: "dataset" - }; - option (google.api.method_signature) = "dataset,update_mask"; - } - - // Get the dataset. - rpc GetDataset(GetDatasetRequest) returns (Dataset) { - option (google.api.http) = { - get: "/v1/{name=projects/*/datasets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List all the datasets for the specified project. - rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/datasets" - }; - option (google.api.method_signature) = "parent"; - } - - // Delete the specified dataset . - rpc DeleteDataset(DeleteDatasetRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/datasets/*}" - }; - option (google.api.method_signature) = "name"; - } -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.create_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.create_dataset.js deleted file mode 100644 index a927ae6e986..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.create_dataset.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, dataset) { - // [START mapsplatformdatasets_v1_generated_MapsPlatformDatasets_CreateDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 project that will own the dataset. - * Format: projects/{$project} - */ - // const parent = 'abc123' - /** - * Required. The dataset version to create. - */ - // const dataset = {} - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient(); - - async function callCreateDataset() { - // Construct request - const request = { - parent, - dataset, - }; - - // Run request - const response = await mapsplatformdatasetsClient.createDataset(request); - console.log(response); - } - - callCreateDataset(); - // [END mapsplatformdatasets_v1_generated_MapsPlatformDatasets_CreateDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.delete_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.delete_dataset.js deleted file mode 100644 index 9f171eed615..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.delete_dataset.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 mapsplatformdatasets_v1_generated_MapsPlatformDatasets_DeleteDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Format: projects/${project}/datasets/{dataset_id} - */ - // const name = 'abc123' - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient(); - - async function callDeleteDataset() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await mapsplatformdatasetsClient.deleteDataset(request); - console.log(response); - } - - callDeleteDataset(); - // [END mapsplatformdatasets_v1_generated_MapsPlatformDatasets_DeleteDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.get_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.get_dataset.js deleted file mode 100644 index 11aa1f8f40c..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.get_dataset.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 mapsplatformdatasets_v1_generated_MapsPlatformDatasets_GetDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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. projects/{project}/datasets/{dataset_id} - */ - // const name = 'abc123' - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient(); - - async function callGetDataset() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await mapsplatformdatasetsClient.getDataset(request); - console.log(response); - } - - callGetDataset(); - // [END mapsplatformdatasets_v1_generated_MapsPlatformDatasets_GetDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.list_datasets.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.list_datasets.js deleted file mode 100644 index 7244d3f36f5..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.list_datasets.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) { - // [START mapsplatformdatasets_v1_generated_MapsPlatformDatasets_ListDatasets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 project to list all the datasets for. - */ - // const parent = 'abc123' - /** - * The maximum number of versions to return per page. - * If unspecified (or zero), all datasets will be returned. - */ - // const pageSize = 1234 - /** - * The page token, received from a previous ListDatasets call. - * Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient(); - - async function callListDatasets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await mapsplatformdatasetsClient.listDatasetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDatasets(); - // [END mapsplatformdatasets_v1_generated_MapsPlatformDatasets_ListDatasets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.update_dataset_metadata.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.update_dataset_metadata.js deleted file mode 100644 index c7f42ea993c..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/maps_platform_datasets.update_dataset_metadata.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(dataset) { - // [START mapsplatformdatasets_v1_generated_MapsPlatformDatasets_UpdateDatasetMetadata_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The dataset to update. The dataset's name is used to identify the - * dataset to be updated. The name has the format: - * projects/{project}/datasets/{dataset_id} - */ - // const dataset = {} - /** - * The list of fields to be updated. Support the value "*" for full - * replacement. - */ - // const updateMask = {} - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient(); - - async function callUpdateDatasetMetadata() { - // Construct request - const request = { - dataset, - }; - - // Run request - const response = await mapsplatformdatasetsClient.updateDatasetMetadata(request); - console.log(response); - } - - callUpdateDatasetMetadata(); - // [END mapsplatformdatasets_v1_generated_MapsPlatformDatasets_UpdateDatasetMetadata_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/snippet_metadata_google.maps.mapsplatformdatasets.v1.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/snippet_metadata_google.maps.mapsplatformdatasets.v1.json deleted file mode 100644 index a20282f3595..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/samples/generated/v1/snippet_metadata_google.maps.mapsplatformdatasets.v1.json +++ /dev/null @@ -1,231 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-mapsplatformdatasets", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.maps.mapsplatformdatasets.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "mapsplatformdatasets_v1_generated_MapsPlatformDatasets_CreateDataset_async", - "title": "MapsPlatformDatasets createDataset Sample", - "origin": "API_DEFINITION", - "description": " Create a new dataset for the specified project.", - "canonical": true, - "file": "maps_platform_datasets.create_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDataset", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.CreateDataset", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": ".google.maps.mapsplatformdatasets.v1.Dataset" - } - ], - "resultType": ".google.maps.mapsplatformdatasets.v1.Dataset", - "client": { - "shortName": "MapsPlatformDatasetsClient", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasetsClient" - }, - "method": { - "shortName": "CreateDataset", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.CreateDataset", - "service": { - "shortName": "MapsPlatformDatasets", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets" - } - } - } - }, - { - "regionTag": "mapsplatformdatasets_v1_generated_MapsPlatformDatasets_UpdateDatasetMetadata_async", - "title": "MapsPlatformDatasets updateDatasetMetadata Sample", - "origin": "API_DEFINITION", - "description": " Update the metadata for the dataset.", - "canonical": true, - "file": "maps_platform_datasets.update_dataset_metadata.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDatasetMetadata", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.UpdateDatasetMetadata", - "async": true, - "parameters": [ - { - "name": "dataset", - "type": ".google.maps.mapsplatformdatasets.v1.Dataset" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.maps.mapsplatformdatasets.v1.Dataset", - "client": { - "shortName": "MapsPlatformDatasetsClient", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasetsClient" - }, - "method": { - "shortName": "UpdateDatasetMetadata", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.UpdateDatasetMetadata", - "service": { - "shortName": "MapsPlatformDatasets", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets" - } - } - } - }, - { - "regionTag": "mapsplatformdatasets_v1_generated_MapsPlatformDatasets_GetDataset_async", - "title": "MapsPlatformDatasets getDataset Sample", - "origin": "API_DEFINITION", - "description": " Get the dataset.", - "canonical": true, - "file": "maps_platform_datasets.get_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDataset", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.GetDataset", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.maps.mapsplatformdatasets.v1.Dataset", - "client": { - "shortName": "MapsPlatformDatasetsClient", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasetsClient" - }, - "method": { - "shortName": "GetDataset", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.GetDataset", - "service": { - "shortName": "MapsPlatformDatasets", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets" - } - } - } - }, - { - "regionTag": "mapsplatformdatasets_v1_generated_MapsPlatformDatasets_ListDatasets_async", - "title": "MapsPlatformDatasets listDatasets Sample", - "origin": "API_DEFINITION", - "description": " List all the datasets for the specified project.", - "canonical": true, - "file": "maps_platform_datasets.list_datasets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDatasets", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.ListDatasets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.maps.mapsplatformdatasets.v1.ListDatasetsResponse", - "client": { - "shortName": "MapsPlatformDatasetsClient", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasetsClient" - }, - "method": { - "shortName": "ListDatasets", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.ListDatasets", - "service": { - "shortName": "MapsPlatformDatasets", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets" - } - } - } - }, - { - "regionTag": "mapsplatformdatasets_v1_generated_MapsPlatformDatasets_DeleteDataset_async", - "title": "MapsPlatformDatasets deleteDataset Sample", - "origin": "API_DEFINITION", - "description": " Delete the specified dataset .", - "canonical": true, - "file": "maps_platform_datasets.delete_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDataset", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.DeleteDataset", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MapsPlatformDatasetsClient", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasetsClient" - }, - "method": { - "shortName": "DeleteDataset", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets.DeleteDataset", - "service": { - "shortName": "MapsPlatformDatasets", - "fullName": "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/index.ts deleted file mode 100644 index e09c026b0c8..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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 MapsPlatformDatasetsClient = v1.MapsPlatformDatasetsClient; -type MapsPlatformDatasetsClient = v1.MapsPlatformDatasetsClient; -export {v1, MapsPlatformDatasetsClient}; -export default {v1, MapsPlatformDatasetsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 8c635052284..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/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.maps.mapsplatformdatasets.v1", - "libraryPackage": "@googlemaps/maps-platform-datasets", - "services": { - "MapsPlatformDatasets": { - "clients": { - "grpc": { - "libraryClient": "MapsPlatformDatasetsClient", - "rpcs": { - "CreateDataset": { - "methods": [ - "createDataset" - ] - }, - "UpdateDatasetMetadata": { - "methods": [ - "updateDatasetMetadata" - ] - }, - "GetDataset": { - "methods": [ - "getDataset" - ] - }, - "DeleteDataset": { - "methods": [ - "deleteDataset" - ] - }, - "ListDatasets": { - "methods": [ - "listDatasets", - "listDatasetsStream", - "listDatasetsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "MapsPlatformDatasetsClient", - "rpcs": { - "CreateDataset": { - "methods": [ - "createDataset" - ] - }, - "UpdateDatasetMetadata": { - "methods": [ - "updateDatasetMetadata" - ] - }, - "GetDataset": { - "methods": [ - "getDataset" - ] - }, - "DeleteDataset": { - "methods": [ - "deleteDataset" - ] - }, - "ListDatasets": { - "methods": [ - "listDatasets", - "listDatasetsStream", - "listDatasetsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/index.ts deleted file mode 100644 index ca0c9566b16..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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 {MapsPlatformDatasetsClient} from './maps_platform_datasets_client'; diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client.ts deleted file mode 100644 index 04407482f0a..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client.ts +++ /dev/null @@ -1,828 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/maps_platform_datasets_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './maps_platform_datasets_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service definition for the Maps Platform Datasets API. - * @class - * @memberof v1 - */ -export class MapsPlatformDatasetsClient { - 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}; - mapsPlatformDatasetsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MapsPlatformDatasetsClient. - * - * @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 MapsPlatformDatasetsClient({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 MapsPlatformDatasetsClient; - 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 = { - datasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/datasets/{dataset}' - ), - }; - - // 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 = { - listDatasets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'datasets') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets', 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.mapsPlatformDatasetsStub) { - return this.mapsPlatformDatasetsStub; - } - - // Put together the "service stub" for - // google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets. - this.mapsPlatformDatasetsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets, - 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 mapsPlatformDatasetsStubMethods = - ['createDataset', 'updateDatasetMetadata', 'getDataset', 'listDatasets', 'deleteDataset']; - for (const methodName of mapsPlatformDatasetsStubMethods) { - const callPromise = this.mapsPlatformDatasetsStub.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.mapsPlatformDatasetsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'mapsplatformdatasets.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 'mapsplatformdatasets.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Create a new dataset for the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent project that will own the dataset. - * Format: projects/{$project} - * @param {google.maps.mapsplatformdatasets.v1.Dataset} request.dataset - * Required. The dataset version 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 {@link protos.google.maps.mapsplatformdatasets.v1.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/maps_platform_datasets.create_dataset.js - * region_tag:mapsplatformdatasets_v1_generated_MapsPlatformDatasets_CreateDataset_async - */ - createDataset( - request?: protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|undefined, {}|undefined - ]>; - createDataset( - request: protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|null|undefined, - {}|null|undefined>): void; - createDataset( - request: protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|null|undefined, - {}|null|undefined>): void; - createDataset( - request?: protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createDataset(request, options, callback); - } -/** - * Update the metadata for the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.maps.mapsplatformdatasets.v1.Dataset} request.dataset - * Required. The dataset to update. The dataset's name is used to identify the - * dataset to be updated. The name has the format: - * projects/{project}/datasets/{dataset_id} - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. Support the value "*" for full - * replacement. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.maps.mapsplatformdatasets.v1.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/maps_platform_datasets.update_dataset_metadata.js - * region_tag:mapsplatformdatasets_v1_generated_MapsPlatformDatasets_UpdateDatasetMetadata_async - */ - updateDatasetMetadata( - request?: protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|undefined, {}|undefined - ]>; - updateDatasetMetadata( - request: protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest, - options: CallOptions, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|null|undefined, - {}|null|undefined>): void; - updateDatasetMetadata( - request: protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|null|undefined, - {}|null|undefined>): void; - updateDatasetMetadata( - request?: protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'dataset.name': request.dataset!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateDatasetMetadata(request, options, callback); - } -/** - * Get the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name. projects/{project}/datasets/{dataset_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.maps.mapsplatformdatasets.v1.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/maps_platform_datasets.get_dataset.js - * region_tag:mapsplatformdatasets_v1_generated_MapsPlatformDatasets_GetDataset_async - */ - getDataset( - request?: protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|undefined, {}|undefined - ]>; - getDataset( - request: protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|null|undefined, - {}|null|undefined>): void; - getDataset( - request: protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|null|undefined, - {}|null|undefined>): void; - getDataset( - request?: protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1.IDataset, - protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getDataset(request, options, callback); - } -/** - * Delete the specified dataset . - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Format: projects/${project}/datasets/{dataset_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/maps_platform_datasets.delete_dataset.js - * region_tag:mapsplatformdatasets_v1_generated_MapsPlatformDatasets_DeleteDataset_async - */ - deleteDataset( - request?: protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|undefined, {}|undefined - ]>; - deleteDataset( - request: protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - deleteDataset( - request: protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - deleteDataset( - request?: protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteDataset(request, options, callback); - } - - /** - * List all the datasets for the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project to list all the datasets for. - * @param {number} request.pageSize - * The maximum number of versions to return per page. - * If unspecified (or zero), all datasets will be returned. - * @param {string} request.pageToken - * The page token, received from a previous ListDatasets call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.maps.mapsplatformdatasets.v1.Dataset|Dataset}. - * 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 `listDatasetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDatasets( - request?: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1.IDataset[], - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest|null, - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse - ]>; - listDatasets( - request: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1.IDataset>): void; - listDatasets( - request: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, - callback: PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1.IDataset>): void; - listDatasets( - request?: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1.IDataset>, - callback?: PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1.IDataset>): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1.IDataset[], - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest|null, - protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listDatasets(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 name of the project to list all the datasets for. - * @param {number} request.pageSize - * The maximum number of versions to return per page. - * If unspecified (or zero), all datasets will be returned. - * @param {string} request.pageToken - * The page token, received from a previous ListDatasets call. - * Provide this to retrieve the subsequent page. - * @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.maps.mapsplatformdatasets.v1.Dataset|Dataset} 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 `listDatasetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDatasetsStream( - request?: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, - 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['listDatasets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDatasets.createStream( - this.innerApiCalls.listDatasets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDatasets`, 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 name of the project to list all the datasets for. - * @param {number} request.pageSize - * The maximum number of versions to return per page. - * If unspecified (or zero), all datasets will be returned. - * @param {string} request.pageToken - * The page token, received from a previous ListDatasets call. - * Provide this to retrieve the subsequent page. - * @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.maps.mapsplatformdatasets.v1.Dataset|Dataset}. 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/maps_platform_datasets.list_datasets.js - * region_tag:mapsplatformdatasets_v1_generated_MapsPlatformDatasets_ListDatasets_async - */ - listDatasetsAsync( - request?: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, - 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['listDatasets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDatasets.asyncIterate( - this.innerApiCalls['listDatasets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified dataset resource name string. - * - * @param {string} project - * @param {string} dataset - * @returns {string} Resource name string. - */ - datasetPath(project:string,dataset:string) { - return this.pathTemplates.datasetPathTemplate.render({ - project: project, - dataset: dataset, - }); - } - - /** - * Parse the project from Dataset resource. - * - * @param {string} datasetName - * A fully-qualified path representing Dataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDatasetName(datasetName: string) { - return this.pathTemplates.datasetPathTemplate.match(datasetName).project; - } - - /** - * Parse the dataset from Dataset resource. - * - * @param {string} datasetName - * A fully-qualified path representing Dataset resource. - * @returns {string} A string representing the dataset. - */ - matchDatasetFromDatasetName(datasetName: string) { - return this.pathTemplates.datasetPathTemplate.match(datasetName).dataset; - } - - /** - * 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.mapsPlatformDatasetsStub && !this._terminated) { - return this.mapsPlatformDatasetsStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client_config.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client_config.json deleted file mode 100644 index 9a072527d2f..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_client_config.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "interfaces": { - "google.maps.mapsplatformdatasets.v1.MapsPlatformDatasets": { - "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": { - "CreateDataset": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDatasetMetadata": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDataset": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListDatasets": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteDataset": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_proto_list.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_proto_list.json deleted file mode 100644 index 9a8bc9fc147..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/src/v1/maps_platform_datasets_proto_list.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "../../protos/google/maps/mapsplatformdatasets/v1/data_source.proto", - "../../protos/google/maps/mapsplatformdatasets/v1/dataset.proto", - "../../protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets.proto", - "../../protos/google/maps/mapsplatformdatasets/v1/maps_platform_datasets_service.proto" -] diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 38965d3e417..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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 mapsplatformdatasets = require('@googlemaps/maps-platform-datasets'); - -function main() { - const mapsPlatformDatasetsClient = new mapsplatformdatasets.MapsPlatformDatasetsClient(); -} - -main(); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 45508beeb01..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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 {MapsPlatformDatasetsClient} from '@googlemaps/maps-platform-datasets'; - -// check that the client class type name can be used -function doStuffWithMapsPlatformDatasetsClient(client: MapsPlatformDatasetsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const mapsPlatformDatasetsClient = new MapsPlatformDatasetsClient(); - doStuffWithMapsPlatformDatasetsClient(mapsPlatformDatasetsClient); -} - -main(); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/install.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1/test/gapic_maps_platform_datasets_v1.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/test/gapic_maps_platform_datasets_v1.ts deleted file mode 100644 index e0f678f7092..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/test/gapic_maps_platform_datasets_v1.ts +++ /dev/null @@ -1,919 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 mapsplatformdatasetsModule 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.MapsPlatformDatasetsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.mapsPlatformDatasetsStub, undefined); - await client.initialize(); - assert(client.mapsPlatformDatasetsStub); - }); - - it('has close method for the initialized client', done => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.mapsPlatformDatasetsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.mapsPlatformDatasetsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - 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 mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - 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('createDataset', () => { - it('invokes createDataset without error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.Dataset() - ); - client.innerApiCalls.createDataset = stubSimpleCall(expectedResponse); - const [response] = await client.createDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDataset without error using callback', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.Dataset() - ); - client.innerApiCalls.createDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDataset( - request, - (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDataset with error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDataset with closed client', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.CreateDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createDataset(request), expectedError); - }); - }); - - describe('updateDatasetMetadata', () => { - it('invokes updateDatasetMetadata without error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest() - ); - request.dataset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest', ['dataset', 'name']); - request.dataset.name = defaultValue1; - const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.Dataset() - ); - client.innerApiCalls.updateDatasetMetadata = stubSimpleCall(expectedResponse); - const [response] = await client.updateDatasetMetadata(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDatasetMetadata without error using callback', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest() - ); - request.dataset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest', ['dataset', 'name']); - request.dataset.name = defaultValue1; - const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.Dataset() - ); - client.innerApiCalls.updateDatasetMetadata = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDatasetMetadata( - request, - (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDatasetMetadata with error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest() - ); - request.dataset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest', ['dataset', 'name']); - request.dataset.name = defaultValue1; - const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDatasetMetadata = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDatasetMetadata(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDatasetMetadata with closed client', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest() - ); - request.dataset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest', ['dataset', 'name']); - request.dataset.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateDatasetMetadata(request), expectedError); - }); - }); - - describe('getDataset', () => { - it('invokes getDataset without error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.GetDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.Dataset() - ); - client.innerApiCalls.getDataset = stubSimpleCall(expectedResponse); - const [response] = await client.getDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset without error using callback', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.GetDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.Dataset() - ); - client.innerApiCalls.getDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDataset( - request, - (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset with error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.GetDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset with closed client', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.GetDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDataset(request), expectedError); - }); - }); - - describe('deleteDataset', () => { - it('invokes deleteDataset without error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDataset = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset without error using callback', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDataset( - 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.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset with error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset with closed client', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteDataset(request), expectedError); - }); - }); - - describe('listDatasets', () => { - it('invokes listDatasets without error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - ]; - client.innerApiCalls.listDatasets = stubSimpleCall(expectedResponse); - const [response] = await client.listDatasets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasets without error using callback', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - ]; - client.innerApiCalls.listDatasets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDatasets( - request, - (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1.IDataset[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasets with error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDatasets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDatasets(request), expectedError); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasetsStream without error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - ]; - client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDatasetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.maps.mapsplatformdatasets.v1.Dataset[] = []; - stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1.Dataset) => { - 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.listDatasets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); - assert( - (client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDatasetsStream with error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDatasetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.maps.mapsplatformdatasets.v1.Dataset[] = []; - stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1.Dataset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); - assert( - (client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDatasets without error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1.Dataset()), - ]; - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.maps.mapsplatformdatasets.v1.IDataset[] = []; - const iterable = client.listDatasetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDatasets with error', async () => { - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDatasetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.maps.mapsplatformdatasets.v1.IDataset[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('dataset', () => { - const fakePath = "/rendered/path/dataset"; - const expectedParameters = { - project: "projectValue", - dataset: "datasetValue", - }; - const client = new mapsplatformdatasetsModule.v1.MapsPlatformDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.datasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.datasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('datasetPath', () => { - const result = client.datasetPath("projectValue", "datasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.datasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDatasetName', () => { - const result = client.matchProjectFromDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.datasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDatasetFromDatasetName', () => { - const result = client.matchDatasetFromDatasetName(fakePath); - assert.strictEqual(result, "datasetValue"); - assert((client.pathTemplates.datasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1/tsconfig.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1/webpack.config.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1/webpack.config.js deleted file mode 100644 index 3cf4c3f7aa5..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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: 'MapsPlatformDatasets', - filename: './maps-platform-datasets.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-maps-mapsplatformdatasets/v1alpha/.eslintignore b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1alpha/.eslintrc.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.gitignore b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1alpha/.jsdoc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.jsdoc.js deleted file mode 100644 index 24b47733dc9..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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: '@googlemaps/maps-platform-datasets', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.mocharc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1alpha/.prettierrc.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1alpha/README.md b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/README.md deleted file mode 100644 index e0e26d17fff..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/README.md +++ /dev/null @@ -1 +0,0 @@ -Mapsplatformdatasets: Nodejs Client diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/package.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/package.json deleted file mode 100644 index a7b6108c686..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@googlemaps/maps-platform-datasets", - "version": "0.1.0", - "description": "Mapsplatformdatasets client for Node.js", - "repository": "googleapis/nodejs-mapsplatformdatasets", - "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 mapsplatformdatasets", - "mapsplatformdatasets", - "maps platform datasets v1 alpha" - ], - "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-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/data_source.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/data_source.proto deleted file mode 100644 index f6907924164..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/data_source.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.maps.mapsplatformdatasets.v1alpha; - -option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1Alpha"; -option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb;mapsplatformdatasetspb"; -option java_multiple_files = true; -option java_outer_classname = "DataSourceProto"; -option java_package = "com.google.maps.mapsplatformdatasets.v1alpha"; -option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1alpha"; - -// The details about the data source when it is a local file. -message LocalFileSource { - // The file name and extension of the uploaded file. - string filename = 1; - - // The format of the file that is being uploaded. - FileFormat file_format = 2; -} - -// The details about the data source when it is in Google Cloud Storage. -message GcsSource { - // Source data URI. For example, `gs://my_bucket/my_object`. - string input_uri = 1; - - // The file format of the Google Cloud Storage object. This is used mainly for - // validation. - FileFormat file_format = 2; -} - -// The format of the file being uploaded. -enum FileFormat { - // Unspecified file format. - FILE_FORMAT_UNSPECIFIED = 0; - - // GeoJson file. - FILE_FORMAT_GEOJSON = 1; - - // KML file. - FILE_FORMAT_KML = 2; - - // CSV file. - FILE_FORMAT_CSV = 3; - - // Protobuf file. - FILE_FORMAT_PROTO = 4; - - // KMZ file. - FILE_FORMAT_KMZ = 5; -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/dataset.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/dataset.proto deleted file mode 100644 index b078deb55ff..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/dataset.proto +++ /dev/null @@ -1,110 +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.maps.mapsplatformdatasets.v1alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/maps/mapsplatformdatasets/v1alpha/data_source.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1Alpha"; -option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb;mapsplatformdatasetspb"; -option java_multiple_files = true; -option java_outer_classname = "DatasetProto"; -option java_package = "com.google.maps.mapsplatformdatasets.v1alpha"; -option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1alpha"; - -// A representation of a maps platform dataset. -message Dataset { - option (google.api.resource) = { - type: "mapsplatformdatasets.googleapis.com/Dataset" - pattern: "projects/{project}/datasets/{dataset}" - }; - - // Resource name, - // projects/{project}/datasets/{dataset_id} - string name = 1; - - // Human readable name, shown in the console UI. Set by customer. - string display_name = 2; - - // A description of this dataset; set by the customer. - string description = 3; - - // The version of the dataset. - string version_id = 4; - - // Specified use case(s) for this dataset. - repeated Usage usage = 5; - - // Details about the source of the data for the dataset. - oneof data_source { - // A local file source for the dataset for a single upload. - LocalFileSource local_file_source = 6; - - // A Google Cloud Storage file source for the dataset for a single upload. - GcsSource gcs_source = 7; - } - - // The status of the import of the latest dataset version. - State status = 12; - - // Output only. Time when the dataset was first created. - google.protobuf.Timestamp create_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when the dataset metadata was last updated. - google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when this version of dataset was created. (It happened when importing - // data to the dataset) - google.protobuf.Timestamp version_create_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The description for this version of dataset. It is provided when importing - // data to the dataset. - string version_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Usage specifies where the data is intended to be used to inform how to -// process the data. -enum Usage { - // The usage of this dataset is not set. - USAGE_UNSPECIFIED = 0; - - // This dataset will be used for data driven styling. - USAGE_DATA_DRIVEN_STYLING = 1; - - // This dataset will be used for area affordances in routing. - USAGE_AREA_AFFORDANCES = 2; - - // This dataset will be used for assisted driving in routing. - USAGE_ASSISTED_DRIVING = 3; -} - -// State specifies the status of the import of the latest dataset version. -enum State { - // The state of this dataset is not set. - STATE_UNSPECIFIED = 0; - - // The dataset version is getting imported. - STATE_IMPORTING = 1; - - // The dataset version succeeded in getting imported. - STATE_IMPORT_SUCCEEDED = 2; - - // The dataset version failed to get imported. - STATE_IMPORT_FAILED = 3; -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto deleted file mode 100644 index 0a03f5cc6f1..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto +++ /dev/null @@ -1,167 +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.maps.mapsplatformdatasets.v1alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/maps/mapsplatformdatasets/v1alpha/dataset.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1Alpha"; -option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb;mapsplatformdatasetspb"; -option java_multiple_files = true; -option java_outer_classname = "MapsPlatformDatasetsProto"; -option java_package = "com.google.maps.mapsplatformdatasets.v1alpha"; -option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1alpha"; - -// Request to create a maps dataset. -message CreateDatasetRequest { - // Required. Parent project that will own the dataset. - // Format: projects/{$project_number} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The dataset version to create. - Dataset dataset = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to update the metadata fields of the dataset. -message UpdateDatasetMetadataRequest { - // Required. The dataset to update. The dataset's name is used to identify the dataset - // to be updated. The name has the format: - // projects/{project}/datasets/{dataset_id} - Dataset dataset = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. Support the value "*" for full - // replacement. - google.protobuf.FieldMask update_mask = 2; -} - -// Request to get the specified dataset. -message GetDatasetRequest { - // Required. Resource name. Can also fetch a specified version - // projects/{project}/datasets/{dataset_id} - // projects/{project}/datasets/{dataset_id}@{version-id} - // - // In order to retrieve a previous version of the dataset, also provide - // the version ID. - // Example: projects/123/datasets/assisted-driving-preferences@c7cfa2a8 - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "mapsplatformdatasets.googleapis.com/Dataset" - } - ]; - - // If specified, will fetch the dataset details of the version published for - // the specified use case rather than the latest, if one exists. If a - // published version does not exist, will default to getting the dataset - // details of the latest version. - Usage published_usage = 2; -} - -// Request to list of all versions of the dataset. -message ListDatasetVersionsRequest { - // Required. The name of the dataset to list all the versions for. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "mapsplatformdatasets.googleapis.com/Dataset" - } - ]; - - // The maximum number of versions to return per page. - // If unspecified (or zero), at most 1000 versions will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // The page token, received from a previous GetDatasetVersions call. - // Provide this to retrieve the subsequent page. - string page_token = 3; -} - -// Response with list of all versions of the dataset. -message ListDatasetVersionsResponse { - // All the versions of the dataset. - repeated Dataset datasets = 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; -} - -// Request to list datasets for the project. -message ListDatasetsRequest { - // Required. The name of the project to list all the datasets for. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // The maximum number of versions to return per page. - // If unspecified (or zero), at most 1000 datasets will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // The page token, received from a previous GetDatasetVersions call. - // Provide this to retrieve the subsequent page. - string page_token = 3; -} - -// Response to list datasets for the project. -message ListDatasetsResponse { - // All the datasets for the project. - repeated Dataset datasets = 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; -} - -// Request to delete a dataset. -// -// The dataset to be deleted. -message DeleteDatasetRequest { - // Required. Format: projects/${project}/datasets/{dataset_id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "mapsplatformdatasets.googleapis.com/Dataset" - } - ]; - - // If set to true, any dataset version for this dataset will also be deleted. - // (Otherwise, the request will only work if the dataset has no versions.) - bool force = 2; -} - -// Request to delete a version of a dataset. -message DeleteDatasetVersionRequest { - // Required. Format: projects/${project}/datasets/{dataset_id}@{version-id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "mapsplatformdatasets.googleapis.com/Dataset" - } - ]; -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets_alpha_service.proto b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets_alpha_service.proto deleted file mode 100644 index 12478bedd24..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets_alpha_service.proto +++ /dev/null @@ -1,97 +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.maps.mapsplatformdatasets.v1alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/maps/mapsplatformdatasets/v1alpha/dataset.proto"; -import "google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto"; -import "google/protobuf/empty.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1Alpha"; -option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb;mapsplatformdatasetspb"; -option java_multiple_files = true; -option java_outer_classname = "MapsPlatformDatasetsV1AlphaServiceProto"; -option java_package = "com.google.maps.mapsplatformdatasets.v1alpha"; -option objc_class_prefix = "MDV1A"; -option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1alpha"; - -// Service definition for the Maps Platform Datasets API. -service MapsPlatformDatasetsV1Alpha { - option (google.api.default_host) = "mapsplatformdatasets.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Create a new dataset for the specified project. - rpc CreateDataset(CreateDatasetRequest) returns (Dataset) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*}/datasets" - body: "dataset" - }; - option (google.api.method_signature) = "parent,dataset"; - } - - // Update the metadata for the dataset. To update the data use: UploadDataset. - rpc UpdateDatasetMetadata(UpdateDatasetMetadataRequest) returns (Dataset) { - option (google.api.http) = { - patch: "/v1alpha/{dataset.name=projects/*/datasets/*}" - body: "dataset" - }; - option (google.api.method_signature) = "dataset,update_mask"; - } - - // Get the published or latest version of the dataset. - rpc GetDataset(GetDatasetRequest) returns (Dataset) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/datasets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List all the versions of a dataset. - rpc ListDatasetVersions(ListDatasetVersionsRequest) returns (ListDatasetVersionsResponse) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/datasets/*}:listVersions" - }; - option (google.api.method_signature) = "name"; - } - - // List all the datasets for the specified project. - rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*}/datasets" - }; - option (google.api.method_signature) = "parent"; - } - - // Delete the specified dataset and optionally all its corresponding - // versions. - rpc DeleteDataset(DeleteDatasetRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1alpha/{name=projects/*/datasets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Delete a specific version of the dataset. - rpc DeleteDatasetVersion(DeleteDatasetVersionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1alpha/{name=projects/*/datasets/*}:deleteVersion" - }; - option (google.api.method_signature) = "name"; - } -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.create_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.create_dataset.js deleted file mode 100644 index 3f466f5351e..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.create_dataset.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, dataset) { - // [START mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_CreateDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 project that will own the dataset. - * Format: projects/{$project_number} - */ - // const parent = 'abc123' - /** - * Required. The dataset version to create. - */ - // const dataset = {} - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); - - async function callCreateDataset() { - // Construct request - const request = { - parent, - dataset, - }; - - // Run request - const response = await mapsplatformdatasetsClient.createDataset(request); - console.log(response); - } - - callCreateDataset(); - // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_CreateDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset.js deleted file mode 100644 index f44ccd27cdc..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset.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 mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Format: projects/${project}/datasets/{dataset_id} - */ - // const name = 'abc123' - /** - * If set to true, any dataset version for this dataset will also be deleted. - * (Otherwise, the request will only work if the dataset has no versions.) - */ - // const force = true - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); - - async function callDeleteDataset() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await mapsplatformdatasetsClient.deleteDataset(request); - console.log(response); - } - - callDeleteDataset(); - // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset_version.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset_version.js deleted file mode 100644 index a45747897c5..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset_version.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 mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDatasetVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Format: projects/${project}/datasets/{dataset_id}@{version-id} - */ - // const name = 'abc123' - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); - - async function callDeleteDatasetVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await mapsplatformdatasetsClient.deleteDatasetVersion(request); - console.log(response); - } - - callDeleteDatasetVersion(); - // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDatasetVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.get_dataset.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.get_dataset.js deleted file mode 100644 index dd3cf3d5033..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.get_dataset.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 mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_GetDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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. Can also fetch a specified version - * projects/{project}/datasets/{dataset_id} - * projects/{project}/datasets/{dataset_id}@{version-id} - * In order to retrieve a previous version of the dataset, also provide - * the version ID. - * Example: projects/123/datasets/assisted-driving-preferences@c7cfa2a8 - */ - // const name = 'abc123' - /** - * If specified, will fetch the dataset details of the version published for - * the specified use case rather than the latest, if one exists. If a - * published version does not exist, will default to getting the dataset - * details of the latest version. - */ - // const publishedUsage = {} - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); - - async function callGetDataset() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await mapsplatformdatasetsClient.getDataset(request); - console.log(response); - } - - callGetDataset(); - // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_GetDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_dataset_versions.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_dataset_versions.js deleted file mode 100644 index a028467844e..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_dataset_versions.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 mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasetVersions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 dataset to list all the versions for. - */ - // const name = 'abc123' - /** - * The maximum number of versions to return per page. - * If unspecified (or zero), at most 1000 versions will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * The page token, received from a previous GetDatasetVersions call. - * Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); - - async function callListDatasetVersions() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = await mapsplatformdatasetsClient.listDatasetVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDatasetVersions(); - // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasetVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_datasets.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_datasets.js deleted file mode 100644 index c90ed91d61f..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.list_datasets.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) { - // [START mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 project to list all the datasets for. - */ - // const parent = 'abc123' - /** - * The maximum number of versions to return per page. - * If unspecified (or zero), at most 1000 datasets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * The page token, received from a previous GetDatasetVersions call. - * Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); - - async function callListDatasets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await mapsplatformdatasetsClient.listDatasetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDatasets(); - // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.update_dataset_metadata.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.update_dataset_metadata.js deleted file mode 100644 index eb94eb3c53c..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/maps_platform_datasets_v1_alpha.update_dataset_metadata.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(dataset) { - // [START mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_UpdateDatasetMetadata_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The dataset to update. The dataset's name is used to identify the dataset - * to be updated. The name has the format: - * projects/{project}/datasets/{dataset_id} - */ - // const dataset = {} - /** - * The list of fields to be updated. Support the value "*" for full - * replacement. - */ - // const updateMask = {} - - // Imports the Mapsplatformdatasets library - const {MapsPlatformDatasetsV1AlphaClient} = require('@googlemaps/maps-platform-datasets').v1alpha; - - // Instantiates a client - const mapsplatformdatasetsClient = new MapsPlatformDatasetsV1AlphaClient(); - - async function callUpdateDatasetMetadata() { - // Construct request - const request = { - dataset, - }; - - // Run request - const response = await mapsplatformdatasetsClient.updateDatasetMetadata(request); - console.log(response); - } - - callUpdateDatasetMetadata(); - // [END mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_UpdateDatasetMetadata_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/snippet_metadata_google.maps.mapsplatformdatasets.v1alpha.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/snippet_metadata_google.maps.mapsplatformdatasets.v1alpha.json deleted file mode 100644 index 8ce3d287d8f..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/samples/generated/v1alpha/snippet_metadata_google.maps.mapsplatformdatasets.v1alpha.json +++ /dev/null @@ -1,327 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-mapsplatformdatasets", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.maps.mapsplatformdatasets.v1alpha", - "version": "v1alpha" - } - ] - }, - "snippets": [ - { - "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_CreateDataset_async", - "title": "MapsPlatformDatasetsV1Alpha createDataset Sample", - "origin": "API_DEFINITION", - "description": " Create a new dataset for the specified project.", - "canonical": true, - "file": "maps_platform_datasets_v1_alpha.create_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDataset", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.CreateDataset", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": ".google.maps.mapsplatformdatasets.v1alpha.Dataset" - } - ], - "resultType": ".google.maps.mapsplatformdatasets.v1alpha.Dataset", - "client": { - "shortName": "MapsPlatformDatasetsV1AlphaClient", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" - }, - "method": { - "shortName": "CreateDataset", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.CreateDataset", - "service": { - "shortName": "MapsPlatformDatasetsV1Alpha", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" - } - } - } - }, - { - "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_UpdateDatasetMetadata_async", - "title": "MapsPlatformDatasetsV1Alpha updateDatasetMetadata Sample", - "origin": "API_DEFINITION", - "description": " Update the metadata for the dataset. To update the data use: UploadDataset.", - "canonical": true, - "file": "maps_platform_datasets_v1_alpha.update_dataset_metadata.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDatasetMetadata", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.UpdateDatasetMetadata", - "async": true, - "parameters": [ - { - "name": "dataset", - "type": ".google.maps.mapsplatformdatasets.v1alpha.Dataset" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.maps.mapsplatformdatasets.v1alpha.Dataset", - "client": { - "shortName": "MapsPlatformDatasetsV1AlphaClient", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" - }, - "method": { - "shortName": "UpdateDatasetMetadata", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.UpdateDatasetMetadata", - "service": { - "shortName": "MapsPlatformDatasetsV1Alpha", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" - } - } - } - }, - { - "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_GetDataset_async", - "title": "MapsPlatformDatasetsV1Alpha getDataset Sample", - "origin": "API_DEFINITION", - "description": " Get the published or latest version of the dataset.", - "canonical": true, - "file": "maps_platform_datasets_v1_alpha.get_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDataset", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.GetDataset", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "published_usage", - "type": ".google.maps.mapsplatformdatasets.v1alpha.Usage" - } - ], - "resultType": ".google.maps.mapsplatformdatasets.v1alpha.Dataset", - "client": { - "shortName": "MapsPlatformDatasetsV1AlphaClient", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" - }, - "method": { - "shortName": "GetDataset", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.GetDataset", - "service": { - "shortName": "MapsPlatformDatasetsV1Alpha", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" - } - } - } - }, - { - "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasetVersions_async", - "title": "MapsPlatformDatasetsV1Alpha listDatasetVersions Sample", - "origin": "API_DEFINITION", - "description": " List all the versions of a dataset.", - "canonical": true, - "file": "maps_platform_datasets_v1_alpha.list_dataset_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDatasetVersions", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.ListDatasetVersions", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsResponse", - "client": { - "shortName": "MapsPlatformDatasetsV1AlphaClient", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" - }, - "method": { - "shortName": "ListDatasetVersions", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.ListDatasetVersions", - "service": { - "shortName": "MapsPlatformDatasetsV1Alpha", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" - } - } - } - }, - { - "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasets_async", - "title": "MapsPlatformDatasetsV1Alpha listDatasets Sample", - "origin": "API_DEFINITION", - "description": " List all the datasets for the specified project.", - "canonical": true, - "file": "maps_platform_datasets_v1_alpha.list_datasets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDatasets", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.ListDatasets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.maps.mapsplatformdatasets.v1alpha.ListDatasetsResponse", - "client": { - "shortName": "MapsPlatformDatasetsV1AlphaClient", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" - }, - "method": { - "shortName": "ListDatasets", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.ListDatasets", - "service": { - "shortName": "MapsPlatformDatasetsV1Alpha", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" - } - } - } - }, - { - "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDataset_async", - "title": "MapsPlatformDatasetsV1Alpha deleteDataset Sample", - "origin": "API_DEFINITION", - "description": " Delete the specified dataset and optionally all its corresponding versions.", - "canonical": true, - "file": "maps_platform_datasets_v1_alpha.delete_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDataset", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.DeleteDataset", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MapsPlatformDatasetsV1AlphaClient", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" - }, - "method": { - "shortName": "DeleteDataset", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.DeleteDataset", - "service": { - "shortName": "MapsPlatformDatasetsV1Alpha", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" - } - } - } - }, - { - "regionTag": "mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDatasetVersion_async", - "title": "MapsPlatformDatasetsV1Alpha deleteDatasetVersion Sample", - "origin": "API_DEFINITION", - "description": " Delete a specific version of the dataset.", - "canonical": true, - "file": "maps_platform_datasets_v1_alpha.delete_dataset_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDatasetVersion", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.DeleteDatasetVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MapsPlatformDatasetsV1AlphaClient", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClient" - }, - "method": { - "shortName": "DeleteDatasetVersion", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.DeleteDatasetVersion", - "service": { - "shortName": "MapsPlatformDatasetsV1Alpha", - "fullName": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/index.ts deleted file mode 100644 index a03ae68158c..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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 MapsPlatformDatasetsV1AlphaClient = v1alpha.MapsPlatformDatasetsV1AlphaClient; -type MapsPlatformDatasetsV1AlphaClient = v1alpha.MapsPlatformDatasetsV1AlphaClient; -export {v1alpha, MapsPlatformDatasetsV1AlphaClient}; -export default {v1alpha, MapsPlatformDatasetsV1AlphaClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/gapic_metadata.json deleted file mode 100644 index a0ee6a8b453..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/gapic_metadata.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.maps.mapsplatformdatasets.v1alpha", - "libraryPackage": "@googlemaps/maps-platform-datasets", - "services": { - "MapsPlatformDatasetsV1Alpha": { - "clients": { - "grpc": { - "libraryClient": "MapsPlatformDatasetsV1AlphaClient", - "rpcs": { - "CreateDataset": { - "methods": [ - "createDataset" - ] - }, - "UpdateDatasetMetadata": { - "methods": [ - "updateDatasetMetadata" - ] - }, - "GetDataset": { - "methods": [ - "getDataset" - ] - }, - "DeleteDataset": { - "methods": [ - "deleteDataset" - ] - }, - "DeleteDatasetVersion": { - "methods": [ - "deleteDatasetVersion" - ] - }, - "ListDatasetVersions": { - "methods": [ - "listDatasetVersions", - "listDatasetVersionsStream", - "listDatasetVersionsAsync" - ] - }, - "ListDatasets": { - "methods": [ - "listDatasets", - "listDatasetsStream", - "listDatasetsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "MapsPlatformDatasetsV1AlphaClient", - "rpcs": { - "CreateDataset": { - "methods": [ - "createDataset" - ] - }, - "UpdateDatasetMetadata": { - "methods": [ - "updateDatasetMetadata" - ] - }, - "GetDataset": { - "methods": [ - "getDataset" - ] - }, - "DeleteDataset": { - "methods": [ - "deleteDataset" - ] - }, - "DeleteDatasetVersion": { - "methods": [ - "deleteDatasetVersion" - ] - }, - "ListDatasetVersions": { - "methods": [ - "listDatasetVersions", - "listDatasetVersionsStream", - "listDatasetVersionsAsync" - ] - }, - "ListDatasets": { - "methods": [ - "listDatasets", - "listDatasetsStream", - "listDatasetsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/index.ts deleted file mode 100644 index a91f63ad805..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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 {MapsPlatformDatasetsV1AlphaClient} from './maps_platform_datasets_v1_alpha_client'; diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts deleted file mode 100644 index 63bf4a8dbd7..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts +++ /dev/null @@ -1,1097 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v1alpha/maps_platform_datasets_v1_alpha_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './maps_platform_datasets_v1_alpha_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service definition for the Maps Platform Datasets API. - * @class - * @memberof v1alpha - */ -export class MapsPlatformDatasetsV1AlphaClient { - 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}; - mapsPlatformDatasetsV1AlphaStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MapsPlatformDatasetsV1AlphaClient. - * - * @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 MapsPlatformDatasetsV1AlphaClient({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 MapsPlatformDatasetsV1AlphaClient; - 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 = { - datasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/datasets/{dataset}' - ), - }; - - // 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 = { - listDatasetVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'datasets'), - listDatasets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'datasets') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha', 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.mapsPlatformDatasetsV1AlphaStub) { - return this.mapsPlatformDatasetsV1AlphaStub; - } - - // Put together the "service stub" for - // google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha. - this.mapsPlatformDatasetsV1AlphaStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha, - 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 mapsPlatformDatasetsV1AlphaStubMethods = - ['createDataset', 'updateDatasetMetadata', 'getDataset', 'listDatasetVersions', 'listDatasets', 'deleteDataset', 'deleteDatasetVersion']; - for (const methodName of mapsPlatformDatasetsV1AlphaStubMethods) { - const callPromise = this.mapsPlatformDatasetsV1AlphaStub.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.mapsPlatformDatasetsV1AlphaStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'mapsplatformdatasets.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 'mapsplatformdatasets.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Create a new dataset for the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent project that will own the dataset. - * Format: projects/{$project_number} - * @param {google.maps.mapsplatformdatasets.v1alpha.Dataset} request.dataset - * Required. The dataset version 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 {@link protos.google.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. - * Please see the {@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/maps_platform_datasets_v1_alpha.create_dataset.js - * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_CreateDataset_async - */ - createDataset( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|undefined, {}|undefined - ]>; - createDataset( - request: protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|null|undefined, - {}|null|undefined>): void; - createDataset( - request: protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|null|undefined, - {}|null|undefined>): void; - createDataset( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.ICreateDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createDataset(request, options, callback); - } -/** - * Update the metadata for the dataset. To update the data use: UploadDataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.maps.mapsplatformdatasets.v1alpha.Dataset} request.dataset - * Required. The dataset to update. The dataset's name is used to identify the dataset - * to be updated. The name has the format: - * projects/{project}/datasets/{dataset_id} - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. Support the value "*" for full - * replacement. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. - * Please see the {@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/maps_platform_datasets_v1_alpha.update_dataset_metadata.js - * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_UpdateDatasetMetadata_async - */ - updateDatasetMetadata( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|undefined, {}|undefined - ]>; - updateDatasetMetadata( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest, - options: CallOptions, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|null|undefined, - {}|null|undefined>): void; - updateDatasetMetadata( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|null|undefined, - {}|null|undefined>): void; - updateDatasetMetadata( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IUpdateDatasetMetadataRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'dataset.name': request.dataset!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateDatasetMetadata(request, options, callback); - } -/** - * Get the published or latest version of the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name. Can also fetch a specified version - * projects/{project}/datasets/{dataset_id} - * projects/{project}/datasets/{dataset_id}@{version-id} - * - * In order to retrieve a previous version of the dataset, also provide - * the version ID. - * Example: projects/123/datasets/assisted-driving-preferences@c7cfa2a8 - * @param {google.maps.mapsplatformdatasets.v1alpha.Usage} request.publishedUsage - * If specified, will fetch the dataset details of the version published for - * the specified use case rather than the latest, if one exists. If a - * published version does not exist, will default to getting the dataset - * details of the latest version. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. - * Please see the {@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/maps_platform_datasets_v1_alpha.get_dataset.js - * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_GetDataset_async - */ - getDataset( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|undefined, {}|undefined - ]>; - getDataset( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|null|undefined, - {}|null|undefined>): void; - getDataset( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest, - callback: Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|null|undefined, - {}|null|undefined>): void; - getDataset( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset, - protos.google.maps.mapsplatformdatasets.v1alpha.IGetDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getDataset(request, options, callback); - } -/** - * Delete the specified dataset and optionally all its corresponding - * versions. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Format: projects/${project}/datasets/{dataset_id} - * @param {boolean} request.force - * If set to true, any dataset version for this dataset will also be deleted. - * (Otherwise, the request will only work if the dataset has no versions.) - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset.js - * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDataset_async - */ - deleteDataset( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|undefined, {}|undefined - ]>; - deleteDataset( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - deleteDataset( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - deleteDataset( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteDataset(request, options, callback); - } -/** - * Delete a specific version of the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Format: projects/${project}/datasets/{dataset_id}@{version-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/v1alpha/maps_platform_datasets_v1_alpha.delete_dataset_version.js - * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_DeleteDatasetVersion_async - */ - deleteDatasetVersion( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|undefined, {}|undefined - ]>; - deleteDatasetVersion( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|null|undefined, - {}|null|undefined>): void; - deleteDatasetVersion( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|null|undefined, - {}|null|undefined>): void; - deleteDatasetVersion( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.maps.mapsplatformdatasets.v1alpha.IDeleteDatasetVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteDatasetVersion(request, options, callback); - } - - /** - * List all the versions of a dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the dataset to list all the versions for. - * @param {number} request.pageSize - * The maximum number of versions to return per page. - * If unspecified (or zero), at most 1000 versions will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * The page token, received from a previous GetDatasetVersions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. - * 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 `listDatasetVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDatasetVersions( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[], - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest|null, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse - ]>; - listDatasetVersions( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): void; - listDatasetVersions( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, - callback: PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): void; - listDatasetVersions( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>, - callback?: PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[], - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest|null, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.listDatasetVersions(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.name - * Required. The name of the dataset to list all the versions for. - * @param {number} request.pageSize - * The maximum number of versions to return per page. - * If unspecified (or zero), at most 1000 versions will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * The page token, received from a previous GetDatasetVersions call. - * Provide this to retrieve the subsequent page. - * @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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset} 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 `listDatasetVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDatasetVersionsStream( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listDatasetVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDatasetVersions.createStream( - this.innerApiCalls.listDatasetVersions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDatasetVersions`, 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.name - * Required. The name of the dataset to list all the versions for. - * @param {number} request.pageSize - * The maximum number of versions to return per page. - * If unspecified (or zero), at most 1000 versions will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * The page token, received from a previous GetDatasetVersions call. - * Provide this to retrieve the subsequent page. - * @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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. 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/maps_platform_datasets_v1_alpha.list_dataset_versions.js - * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasetVersions_async - */ - listDatasetVersionsAsync( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetVersionsRequest, - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listDatasetVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDatasetVersions.asyncIterate( - this.innerApiCalls['listDatasetVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List all the datasets for the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project to list all the datasets for. - * @param {number} request.pageSize - * The maximum number of versions to return per page. - * If unspecified (or zero), at most 1000 datasets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * The page token, received from a previous GetDatasetVersions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. - * 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 `listDatasetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDatasets( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[], - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest|null, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse - ]>; - listDatasets( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): void; - listDatasets( - request: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, - callback: PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): void; - listDatasets( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>, - callback?: PaginationCallback< - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse|null|undefined, - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset>): - Promise<[ - protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[], - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest|null, - protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listDatasets(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 name of the project to list all the datasets for. - * @param {number} request.pageSize - * The maximum number of versions to return per page. - * If unspecified (or zero), at most 1000 datasets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * The page token, received from a previous GetDatasetVersions call. - * Provide this to retrieve the subsequent page. - * @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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset} 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 `listDatasetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDatasetsStream( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, - 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['listDatasets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDatasets.createStream( - this.innerApiCalls.listDatasets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDatasets`, 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 name of the project to list all the datasets for. - * @param {number} request.pageSize - * The maximum number of versions to return per page. - * If unspecified (or zero), at most 1000 datasets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * The page token, received from a previous GetDatasetVersions call. - * Provide this to retrieve the subsequent page. - * @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.maps.mapsplatformdatasets.v1alpha.Dataset|Dataset}. 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/maps_platform_datasets_v1_alpha.list_datasets.js - * region_tag:mapsplatformdatasets_v1alpha_generated_MapsPlatformDatasetsV1Alpha_ListDatasets_async - */ - listDatasetsAsync( - request?: protos.google.maps.mapsplatformdatasets.v1alpha.IListDatasetsRequest, - 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['listDatasets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDatasets.asyncIterate( - this.innerApiCalls['listDatasets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified dataset resource name string. - * - * @param {string} project - * @param {string} dataset - * @returns {string} Resource name string. - */ - datasetPath(project:string,dataset:string) { - return this.pathTemplates.datasetPathTemplate.render({ - project: project, - dataset: dataset, - }); - } - - /** - * Parse the project from Dataset resource. - * - * @param {string} datasetName - * A fully-qualified path representing Dataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDatasetName(datasetName: string) { - return this.pathTemplates.datasetPathTemplate.match(datasetName).project; - } - - /** - * Parse the dataset from Dataset resource. - * - * @param {string} datasetName - * A fully-qualified path representing Dataset resource. - * @returns {string} A string representing the dataset. - */ - matchDatasetFromDatasetName(datasetName: string) { - return this.pathTemplates.datasetPathTemplate.match(datasetName).dataset; - } - - /** - * 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.mapsPlatformDatasetsV1AlphaStub && !this._terminated) { - return this.mapsPlatformDatasetsV1AlphaStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client_config.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client_config.json deleted file mode 100644 index 9e8456f41a6..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_client_config.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "interfaces": { - "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha": { - "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": { - "CreateDataset": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDatasetMetadata": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDataset": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListDatasetVersions": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListDatasets": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteDataset": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDatasetVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_proto_list.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_proto_list.json deleted file mode 100644 index 07d014af0bc..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/src/v1alpha/maps_platform_datasets_v1_alpha_proto_list.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "../../protos/google/maps/mapsplatformdatasets/v1alpha/data_source.proto", - "../../protos/google/maps/mapsplatformdatasets/v1alpha/dataset.proto", - "../../protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets.proto", - "../../protos/google/maps/mapsplatformdatasets/v1alpha/maps_platform_datasets_alpha_service.proto" -] diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 5a27191f69d..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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 mapsplatformdatasets = require('@googlemaps/maps-platform-datasets'); - -function main() { - const mapsPlatformDatasetsV1AlphaClient = new mapsplatformdatasets.MapsPlatformDatasetsV1AlphaClient(); -} - -main(); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 96ef770fc79..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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 {MapsPlatformDatasetsV1AlphaClient} from '@googlemaps/maps-platform-datasets'; - -// check that the client class type name can be used -function doStuffWithMapsPlatformDatasetsV1AlphaClient(client: MapsPlatformDatasetsV1AlphaClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const mapsPlatformDatasetsV1AlphaClient = new MapsPlatformDatasetsV1AlphaClient(); - doStuffWithMapsPlatformDatasetsV1AlphaClient(mapsPlatformDatasetsV1AlphaClient); -} - -main(); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/install.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1alpha/test/gapic_maps_platform_datasets_v1_alpha_v1alpha.ts b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/test/gapic_maps_platform_datasets_v1_alpha_v1alpha.ts deleted file mode 100644 index cf3fa041dca..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/test/gapic_maps_platform_datasets_v1_alpha_v1alpha.ts +++ /dev/null @@ -1,1272 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 mapsplatformdatasetsv1alphaModule 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('v1alpha.MapsPlatformDatasetsV1AlphaClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.mapsPlatformDatasetsV1AlphaStub, undefined); - await client.initialize(); - assert(client.mapsPlatformDatasetsV1AlphaStub); - }); - - it('has close method for the initialized client', done => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.mapsPlatformDatasetsV1AlphaStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.mapsPlatformDatasetsV1AlphaStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - 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 mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - 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('createDataset', () => { - it('invokes createDataset without error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() - ); - client.innerApiCalls.createDataset = stubSimpleCall(expectedResponse); - const [response] = await client.createDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDataset without error using callback', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() - ); - client.innerApiCalls.createDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDataset( - request, - (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDataset with error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDataset with closed client', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.CreateDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createDataset(request), expectedError); - }); - }); - - describe('updateDatasetMetadata', () => { - it('invokes updateDatasetMetadata without error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest() - ); - request.dataset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest', ['dataset', 'name']); - request.dataset.name = defaultValue1; - const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() - ); - client.innerApiCalls.updateDatasetMetadata = stubSimpleCall(expectedResponse); - const [response] = await client.updateDatasetMetadata(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDatasetMetadata without error using callback', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest() - ); - request.dataset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest', ['dataset', 'name']); - request.dataset.name = defaultValue1; - const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() - ); - client.innerApiCalls.updateDatasetMetadata = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDatasetMetadata( - request, - (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDatasetMetadata with error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest() - ); - request.dataset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest', ['dataset', 'name']); - request.dataset.name = defaultValue1; - const expectedHeaderRequestParams = `dataset.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDatasetMetadata = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDatasetMetadata(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDatasetMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDatasetMetadata with closed client', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest() - ); - request.dataset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.UpdateDatasetMetadataRequest', ['dataset', 'name']); - request.dataset.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateDatasetMetadata(request), expectedError); - }); - }); - - describe('getDataset', () => { - it('invokes getDataset without error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() - ); - client.innerApiCalls.getDataset = stubSimpleCall(expectedResponse); - const [response] = await client.getDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset without error using callback', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset() - ); - client.innerApiCalls.getDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDataset( - request, - (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset with error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset with closed client', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.GetDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDataset(request), expectedError); - }); - }); - - describe('deleteDataset', () => { - it('invokes deleteDataset without error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDataset = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset without error using callback', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDataset( - 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.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset with error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset with closed client', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteDataset(request), expectedError); - }); - }); - - describe('deleteDatasetVersion', () => { - it('invokes deleteDatasetVersion without error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDatasetVersion = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDatasetVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDatasetVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDatasetVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDatasetVersion without error using callback', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDatasetVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDatasetVersion( - 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.deleteDatasetVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDatasetVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDatasetVersion with error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDatasetVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDatasetVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDatasetVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDatasetVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDatasetVersion with closed client', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.DeleteDatasetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteDatasetVersion(request), expectedError); - }); - }); - - describe('listDatasetVersions', () => { - it('invokes listDatasetVersions without error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - ]; - client.innerApiCalls.listDatasetVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listDatasetVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatasetVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasetVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasetVersions without error using callback', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - ]; - client.innerApiCalls.listDatasetVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDatasetVersions( - request, - (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatasetVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasetVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasetVersions with error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDatasetVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDatasetVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listDatasetVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasetVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasetVersionsStream without error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - ]; - client.descriptors.page.listDatasetVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDatasetVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset[] = []; - stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset) => { - 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.listDatasetVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatasetVersions, request)); - assert( - (client.descriptors.page.listDatasetVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDatasetVersionsStream with error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatasetVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDatasetVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset[] = []; - stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDatasetVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatasetVersions, request)); - assert( - (client.descriptors.page.listDatasetVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDatasetVersions without error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - ]; - client.descriptors.page.listDatasetVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[] = []; - const iterable = client.listDatasetVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDatasetVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatasetVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDatasetVersions with error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetVersionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatasetVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDatasetVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDatasetVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatasetVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listDatasets', () => { - it('invokes listDatasets without error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - ]; - client.innerApiCalls.listDatasets = stubSimpleCall(expectedResponse); - const [response] = await client.listDatasets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasets without error using callback', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - ]; - client.innerApiCalls.listDatasets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDatasets( - request, - (err?: Error|null, result?: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasets with error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDatasets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDatasets(request), expectedError); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasetsStream without error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - ]; - client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDatasetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset[] = []; - stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset) => { - 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.listDatasets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); - assert( - (client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDatasetsStream with error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDatasetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset[] = []; - stream.on('data', (response: protos.google.maps.mapsplatformdatasets.v1alpha.Dataset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); - assert( - (client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDatasets without error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - generateSampleMessage(new protos.google.maps.mapsplatformdatasets.v1alpha.Dataset()), - ]; - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[] = []; - const iterable = client.listDatasetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDatasets with error', async () => { - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.maps.mapsplatformdatasets.v1alpha.ListDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDatasetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.maps.mapsplatformdatasets.v1alpha.IDataset[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('dataset', () => { - const fakePath = "/rendered/path/dataset"; - const expectedParameters = { - project: "projectValue", - dataset: "datasetValue", - }; - const client = new mapsplatformdatasetsv1alphaModule.v1alpha.MapsPlatformDatasetsV1AlphaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.datasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.datasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('datasetPath', () => { - const result = client.datasetPath("projectValue", "datasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.datasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDatasetName', () => { - const result = client.matchProjectFromDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.datasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDatasetFromDatasetName', () => { - const result = client.matchDatasetFromDatasetName(fakePath); - assert.strictEqual(result, "datasetValue"); - assert((client.pathTemplates.datasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/tsconfig.json b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/v1alpha/webpack.config.js b/owl-bot-staging/google-maps-mapsplatformdatasets/v1alpha/webpack.config.js deleted file mode 100644 index e1a04f6cee0..00000000000 --- a/owl-bot-staging/google-maps-mapsplatformdatasets/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: 'MapsPlatformDatasetsV1Alpha', - filename: './maps-platform-datasets-v1-alpha.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-maps-places/v1/.eslintignore b/owl-bot-staging/google-maps-places/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-maps-places/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-maps-places/v1/.eslintrc.json b/owl-bot-staging/google-maps-places/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-maps-places/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-maps-places/v1/.gitignore b/owl-bot-staging/google-maps-places/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-maps-places/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-maps-places/v1/.jsdoc.js b/owl-bot-staging/google-maps-places/v1/.jsdoc.js deleted file mode 100644 index ffd96935e51..00000000000 --- a/owl-bot-staging/google-maps-places/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: '@googlemaps/places', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-maps-places/v1/.mocharc.js b/owl-bot-staging/google-maps-places/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-maps-places/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-maps-places/v1/.prettierrc.js b/owl-bot-staging/google-maps-places/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-maps-places/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-maps-places/v1/README.md b/owl-bot-staging/google-maps-places/v1/README.md deleted file mode 100644 index 0e091236257..00000000000 --- a/owl-bot-staging/google-maps-places/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Places: Nodejs Client diff --git a/owl-bot-staging/google-maps-places/v1/package.json b/owl-bot-staging/google-maps-places/v1/package.json deleted file mode 100644 index 48485cfb41d..00000000000 --- a/owl-bot-staging/google-maps-places/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@googlemaps/places", - "version": "0.1.0", - "description": "Places client for Node.js", - "repository": "googleapis/nodejs-places", - "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 places", - "places", - "places" - ], - "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-maps-places/v1/protos/google/geo/type/viewport.proto b/owl-bot-staging/google-maps-places/v1/protos/google/geo/type/viewport.proto deleted file mode 100644 index ad5029f8360..00000000000 --- a/owl-bot-staging/google-maps-places/v1/protos/google/geo/type/viewport.proto +++ /dev/null @@ -1,69 +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.geo.type; - -import "google/type/latlng.proto"; - -option go_package = "google.golang.org/genproto/googleapis/geo/type/viewport;viewport"; -option java_multiple_files = true; -option java_outer_classname = "ViewportProto"; -option java_package = "com.google.geo.type"; -option objc_class_prefix = "GGTP"; - -// A latitude-longitude viewport, represented as two diagonally opposite `low` -// and `high` points. A viewport is considered a closed region, i.e. it includes -// its boundary. The latitude bounds must range between -90 to 90 degrees -// inclusive, and the longitude bounds must range between -180 to 180 degrees -// inclusive. Various cases include: -// -// - If `low` = `high`, the viewport consists of that single point. -// -// - If `low.longitude` > `high.longitude`, the longitude range is inverted -// (the viewport crosses the 180 degree longitude line). -// -// - If `low.longitude` = -180 degrees and `high.longitude` = 180 degrees, -// the viewport includes all longitudes. -// -// - If `low.longitude` = 180 degrees and `high.longitude` = -180 degrees, -// the longitude range is empty. -// -// - If `low.latitude` > `high.latitude`, the latitude range is empty. -// -// Both `low` and `high` must be populated, and the represented box cannot be -// empty (as specified by the definitions above). An empty viewport will result -// in an error. -// -// For example, this viewport fully encloses New York City: -// -// { -// "low": { -// "latitude": 40.477398, -// "longitude": -74.259087 -// }, -// "high": { -// "latitude": 40.91618, -// "longitude": -73.70018 -// } -// } -message Viewport { - // Required. The low point of the viewport. - google.type.LatLng low = 1; - - // Required. The high point of the viewport. - google.type.LatLng high = 2; -} diff --git a/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/geometry.proto b/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/geometry.proto deleted file mode 100644 index 62596e7c2be..00000000000 --- a/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/geometry.proto +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.places.v1; - -import "google/api/field_behavior.proto"; -import "google/type/latlng.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Places.V1"; -option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb"; -option java_multiple_files = true; -option java_outer_classname = "GeometryProto"; -option java_package = "com.google.maps.places.v1"; -option objc_class_prefix = "GMPSV1"; -option php_namespace = "Google\\Maps\\Places\\V1"; - -// Circle with a LatLng as center and radius. -message Circle { - // Required. Center latitude and longitude. - // - // The range of latitude must be within `[-90.0, 90.0]`. The range of the - // longitude must be within `[-180.0, 180.0]`. - google.type.LatLng center = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Radius measured in meters. The radius must be within `[0.0, - // 50000.0]`. - double radius = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/place.proto b/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/place.proto deleted file mode 100644 index 2372f3629dc..00000000000 --- a/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/place.proto +++ /dev/null @@ -1,424 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.places.v1; - -import "google/api/field_behavior.proto"; -import "google/geo/type/viewport.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/date.proto"; -import "google/type/latlng.proto"; -import "google/type/localized_text.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Places.V1"; -option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb"; -option java_multiple_files = true; -option java_outer_classname = "PlaceProto"; -option java_package = "com.google.maps.places.v1"; -option objc_class_prefix = "GMPSV1"; -option php_namespace = "Google\\Maps\\Places\\V1"; - -// All the information representing a Place. -message Place { - // The structured components that form the formatted address, if this - // information is available. - message AddressComponent { - // The full text description or name of the address component. For example, - // an address component for the country Australia may have a long_name of - // "Australia". - string long_text = 1; - - // An abbreviated textual name for the address component, if available. For - // example, an address component for the country of Australia may have a - // short_name of "AU". - string short_text = 2; - - // An array indicating the type(s) of the address component. - repeated string types = 3; - - // The language used to format this components, in CLDR notation. - string language_code = 4; - } - - // Plus code (http://plus.codes) is a location reference with two formats: - // global code defining a 14mx14m (1/8000th of a degree) or smaller rectangle, - // and compound code, replacing the prefix with a reference location. - message PlusCode { - // Place's global (full) code, such as `9FWM33GV+HQ`, representing an - // 1/8000 by 1/8000 degree area (~14 by 14 meters). - string global_code = 1; - - // Place's compound code, such as `33GV+HQ, Ramberg, Norway`, containing - // the suffix of the global code and replacing the prefix with a formatted - // name of a reference entity. - string compound_code = 2; - } - - // Information about a review of the place. - message Review { - // Timestamp for the review, expressed in seconds since epoch. - google.protobuf.Timestamp publish_time = 1; - - // A string of formatted recent time, expressing the review time relative - // to the current time in a form appropriate for the language and country. - string relative_publish_time_description = 2; - - // The localized text of the review. - google.type.LocalizedText text = 9; - - // The name of the review author. - string author = 4; - - // A link to the review author's profile. - string author_uri = 5; - - // The author's profile photo. - string author_photo_uri = 6; - - // A whole number between 1.0 and 5.0, a.k.a. the number of stars. - double rating = 7; - - // A BCP-47 language code indicating the original language of the review. - // If the review has been translated, then original_language != language. - // This field contains the main language tag only, and not the secondary tag - // indicating country or region. For example, all the English reviews are - // tagged as 'en', and not 'en-AU' or 'en-UK' and so on.This field is empty - // if there is only a rating with no review text. - string original_language_code = 10; - - // A boolean value indicating if the review was translated from the original - // language it was written in. If a review has been translated, - // corresponding to a value of true, Google recommends that you indicate - // this to your users. For example, you can add the following string, - // “Translated by Google”, to the review. - bool translated = 11; - } - - // Information about business hour of the place. - message OpeningHours { - // A period the place remains in open_now status. - message OpeningHoursPeriod { - // Status changing points. - message OpeningHoursPoint { - // A day of the week, as an integer in the range 0-6. 0 is Sunday, 1 is - // Monday, etc. - optional int32 day = 1; - - // The hour in 2 digits. Ranges from 00 to 23. - optional int32 hour = 2; - - // The minute in 2 digits. Ranges from 00 to 59. - optional int32 minute = 3; - - // Date of the endpoint expressed in `RFC3339` format in the local - // timezone for the place. For example 2010-12-31. - string date_deprecated = 4 [deprecated = true]; - - // Date in the local timezone for the place. - google.type.Date date = 6; - - // Whether or not this endpoint was truncated. Truncation occurs when - // the real hours are outside the times we are willing to return hours - // between, so we truncate the hours back to these boundaries. This - // ensures that at most `24 * 7` hours from midnight of the day of the - // request are returned. - bool truncated = 5; - } - - // The time that the place starts to be open. - OpeningHoursPoint open = 1; - - // The time that the place starts to be closed. - OpeningHoursPoint close = 2; - } - - // A type used to identify the type of secondary hours. - enum SecondaryHourType { - // Default value when secondary hour type is not specified. - SECONDARY_HOUR_TYPE_UNSPECIFIED = 0; - - // The drive-through hour for banks, restaurants, or pharmacies. - DRIVE_THROUGH = 1; - - // The happy hour. - HAPPY_HOUR = 2; - - // The delivery hour. - DELIVERY = 3; - - // The takeout hour. - TAKEOUT = 4; - - // The kitchen hour. - KITCHEN = 5; - - // The breakfast hour. - BREAKFAST = 6; - - // The lunch hour. - LUNCH = 7; - - // The dinner hour. - DINNER = 8; - - // The brunch hour. - BRUNCH = 9; - - // The pickup hour. - PICKUP = 10; - - // The access hours for storage places. - ACCESS = 11; - - // The special hours for seniors. - SENIOR_HOURS = 12; - - // The online service hours. - ONLINE_SERVICE_HOURS = 13; - } - - // Structured information for special days that fall within the period that - // the returned opening hours cover. Special days are days that could impact - // the business hours of a place, e.g. Christmas day. - message SpecialDay { - // The date of this special day. - google.type.Date date = 1; - } - - // Is this place open right now? Always present unless we lack time-of-day - // or timezone data for these opening hours. - bool open_now = 1; - - // The periods that this place is open during the week. The periods are in - // chronological order, starting with Sunday in the place-local timezone. An - // empty (but not absent) value indicates a place that is never open, e.g. - // because it is closed temporarily for renovations. - repeated OpeningHoursPeriod periods = 2; - - // Localized strings describing the opening hours of this place, one string - // for each day of the week. Will be empty if the hours are unknown or - // could not be converted to localized text. Example: "Sun: 18:00–06:00" - repeated string weekday_descriptions = 3; - - // A type string used to identify the type of secondary hours. - SecondaryHourType secondary_hour_type = 4; - - // Structured information for special days that fall within the period that - // the returned opening hours cover. Special days are days that could impact - // the business hours of a place, e.g. Christmas day. Set for - // current_opening_hours and current_secondary_opening_hours if there are - // exceptional hours. - repeated SpecialDay special_days = 5; - } - - // Business status for the place. - enum BusinessStatus { - // Default value. This value is unused. - BUSINESS_STATUS_UNSPECIFIED = 0; - - // The establishment is operational, not necessarily open now. - OPERATIONAL = 1; - - // The establishment is temporarily closed. - CLOSED_TEMPORARILY = 2; - - // The establishment is permanently closed. - CLOSED_PERMANENTLY = 3; - } - - // Information about data providers of this place. - message Attribution { - // Name of the Place's data provider. - string provider = 1; - - // URI to the Place's data provider. - string provider_uri = 2; - } - - // Contains a summary of the place. - message EditorialSummary { - // A summary is comprised of a textual overview, and also includes the - // language code for these if applicable. Summary text must be presented - // as-is and can not be modified or altered. - google.type.LocalizedText overview = 1; - } - - // Required. The unique identifier of a place. - string id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The localized name of the place, suitable as a short human-readable - // description. For example, "Google Sydney", "Starbucks", "Pyrmont", etc. - google.type.LocalizedText display_name = 31; - - // A set of type tags for this result. For example, "political" and - // "locality". - repeated string types = 5; - - // A human-readable phone number for the place, in national format. - string national_phone_number = 7; - - // A human-readable phone number for the place, in international format. - string international_phone_number = 8; - - // A full, human-readable address for this place. - string formatted_address = 9; - - // Repeated components for each locality level. - repeated AddressComponent address_components = 10; - - // Plus code of the place location lat/long. - PlusCode plus_code = 11; - - // The position of this place. - google.type.LatLng location = 12; - - // A viewport suitable for displaying the place on an average-sized map. - google.geo.type.Viewport viewport = 13; - - // A rating between 1.0 and 5.0, based on user reviews of this place. - double rating = 14; - - // A URL providing more information about this place. - string google_maps_uri = 15; - - // The authoritative website for this place, e.g. a business' homepage. - // Note that for places that are part of a chain (e.g. an IKEA store), this - // will usually be the website for the individual store, not the overall - // chain. - string website_uri = 16; - - // List of reviews about this place. - repeated Review reviews = 20; - - // The regular hours of operation. - OpeningHours opening_hours = 21; - - // Number of minutes this place's timezone is currently offset from UTC. - // This is expressed in minutes to support timezones that are offset by - // fractions of an hour, e.g. X hours and 15 minutes. - int32 utc_offset_minutes = 22; - - // The place's address in adr microformat: http://microformats.org/wiki/adr. - string adr_format_address = 24; - - // The business status for the place. - BusinessStatus business_status = 25; - - // Price level of the place. - PriceLevel price_level = 26; - - // A set of data provider that must be shown with this result. - repeated Attribution attributions = 27; - - // The total number of reviews (with or without text) for this place. - int32 user_rating_count = 28; - - // A truncated URL to an v2 icon mask. User can access different icon type by - // appending type suffix to the end (eg, ".svg" or ".png"). - string icon_mask_base_uri = 29; - - // Background color for icon_mask in hex format, e.g. #909CE1. - string icon_background_color = 30; - - // Specifies if the business supports takeout. - optional bool takeout = 33; - - // Specifies if the business supports delivery. - optional bool delivery = 34; - - // Specifies if the business supports indoor or outdoor seating options. - optional bool dine_in = 35; - - // Specifies if the business supports curbside pickup. - optional bool curbside_pickup = 36; - - // Specifies if the place has an entrance that is wheelchair-accessible. - optional bool wheelchair_accessible_entrance = 37; - - // Specifies if the place supports reservations. - optional bool reservable = 38; - - // Specifies if the place serves breakfast. - optional bool serves_breakfast = 39; - - // Specifies if the place serves lunch. - optional bool serves_lunch = 40; - - // Specifies if the place serves dinner. - optional bool serves_dinner = 41; - - // Specifies if the place serves beer. - optional bool serves_beer = 42; - - // Specifies if the place serves wine. - optional bool serves_wine = 43; - - // Specifies if the place serves brunch. - optional bool serves_brunch = 44; - - // Specifies if the place serves vegetarian food. - optional bool serves_vegetarian_food = 45; - - // The hours of operation for the next seven days (including today). The time - // period starts at midnight on the date of the request and ends at 11:59 pm - // six days later. This field includes the special_days subfield of all hours, - // set for dates that have exceptional hours. - OpeningHours current_opening_hours = 46; - - // Contains an array of entries for the next seven days including information - // about secondary hours of a business. Secondary hours are different from a - // business's main hours. For example, a restaurant can specify drive through - // hours or delivery hours as its secondary hours. This field populates the - // type subfield, which draws from a predefined list of opening hours types - // (such as DRIVE_THROUGH, PICKUP, or TAKEOUT) based on the types of the - // place. This field includes the special_days subfield of all hours, set for - // dates that have exceptional hours. - repeated OpeningHours current_secondary_opening_hours = 47; - - // Contains an array of entries for information about regular secondary hours - // of a business. Secondary hours are different from a business's main hours. - // For example, a restaurant can specify drive through hours or delivery hours - // as its secondary hours. This field populates the type subfield, which draws - // from a predefined list of opening hours types (such as DRIVE_THROUGH, - // PICKUP, or TAKEOUT) based on the types of the place. - repeated OpeningHours secondary_opening_hours = 49; - - // Contains a summary of the place. A summary is comprised of a textual - // overview, and also includes the language code for these if applicable. - // Summary text must be presented as-is and can not be modified or altered. - EditorialSummary editorial_summary = 48; -} - -// Price level of the place. -enum PriceLevel { - // Place price level is unspecified or unknown. - PRICE_LEVEL_UNSPECIFIED = 0; - - FREE = 1; - - // Place provides inexpensive services. - INEXPENSIVE = 2; - - // Place provides moderately priced services. - MODERATE = 3; - - // Place provides expensive services. - EXPENSIVE = 4; - - // Place provides very expensive services. - VERY_EXPENSIVE = 5; -} diff --git a/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/places_service.proto b/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/places_service.proto deleted file mode 100644 index b8b8ab69d98..00000000000 --- a/owl-bot-staging/google-maps-places/v1/protos/google/maps/places/v1/places_service.proto +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.places.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/geo/type/viewport.proto"; -import "google/maps/places/v1/geometry.proto"; -import "google/maps/places/v1/place.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Places.V1"; -option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb"; -option java_multiple_files = true; -option java_outer_classname = "PlacesServiceProto"; -option java_package = "com.google.maps.places.v1"; -option objc_class_prefix = "GMPSV1"; -option php_namespace = "Google\\Maps\\Places\\V1"; - -// Service definition for the Places API. -service Places { - option (google.api.default_host) = "places.googleapis.com"; - - // Text query based place search. - rpc SearchText(SearchTextRequest) returns (SearchTextResponse) { - option (google.api.http) = { - post: "/v1/Text:search" - body: "*" - }; - } -} - -// int 32 range. Both min and max are optional. If only min is set, then the -// range only has a lower bound. If only max is set, then range only has an -// upper bound. At least one of min and max must be set. Values are inclusive. -message Int32Range { - // Lower bound. If unset, behavior is documented on the range field. - optional int32 min = 1; - - // Upper bound. If unset, behavior is documented on the range field. - optional int32 max = 2; -} - -// Request data structure for SearchText. -message SearchTextRequest { - // How results will be ranked in the response. - enum RankPreference { - // RankPreference value not set. Will default to DISTANCE. - RANK_PREFERENCE_UNSPECIFIED = 0; - - // Ranks results by distance. - DISTANCE = 1; - - // Ranks results by relevance. Sort order determined by normal ranking - // stack. See SortRefinement::RELEVANCE. - RELEVANCE = 2; - } - - // The region to search. - // - // Deprecated. Use LocationRestriction or LocationBias instead. - message Location { - oneof type { - // A rectangle box defined by northeast and southwest corner. - google.geo.type.Viewport rectangle = 1; - } - - // Make location field a strict restriction and filter out POIs outside of - // the given location. If location type field is unset this field will have - // no effect. - bool strict_restriction = 2; - } - - // The region to search. This location serves as a bias which means results - // around given location might be returned. - message LocationBias { - oneof type { - // A rectangle box defined by northeast and southwest corner. - google.geo.type.Viewport rectangle = 1; - - // A circle defined by center point and radius. - Circle circle = 2; - } - } - - // The region to search. This location serves as a restriction which means - // results outside given location will not be returned. - message LocationRestriction { - oneof type { - // A rectangle box defined by northeast and southwest corner. - google.geo.type.Viewport rectangle = 1; - } - } - - // Required. The text query for textual search. - string text_query = 1 [(google.api.field_behavior) = REQUIRED]; - - // Place details will be displayed with the preferred language if available. - // If the language code is unspecified or unrecognized, place details of any - // language may be returned, with a preference for English if such details - // exist. - // - // Current list of supported languages: - // https://developers.google.com/maps/faq#languagesupport. - string language_code = 2; - - // The Unicode country/region code (CLDR) of the location where the - // request is coming from. It is used to display the place details, like - // region-specific place name, if available. - // - // For more information, see - // http://www.unicode.org/reports/tr35/#unicode_region_subtag. - // - // - // Note that 3-digit region codes are not currently supported. - string region_code = 3; - - // How results will be ranked in the response. - RankPreference rank_preference = 4; - - // The region to search. Setting location would usually yields - // better results. Recommended to set. This location serves as a bias unless - // strict_restriction is set to true, which turns the location to a strict - // restriction. - // - // Deprecated. Use LocationRestriction or LocationBias instead. - Location location = 5 [deprecated = true]; - - // The requested place type. Full list of types supported: - // https://developers.google.com/places/supported_types. Only support one - // included type. - string included_type = 6; - - // Used to restrict the search to places that are open at a specific time. - // open_now marks if a business is currently open. - bool open_now = 7; - - // [Deprecated!]Used to restrict the search to places that are within a - // certain price range. This is on a scale of 0 to 4. Set a minimum of 0 or - // set a maximum of 4 has no effect on the search results. Min price is - // default to 0 and max price is default to 4. Default value will be used if - // either min or max is unset. - Int32Range price_range = 8 [deprecated = true]; - - // Filter out results whose average user rating is strictly less than this - // limit. A valid value must be an float between 0 and 5 (inclusively) at a - // 0.5 cadence i.e. `[0, 0.5, 1.0, ... , 5.0]` inclusively. This is to keep - // parity with LocalRefinement_UserRating. The input rating will round up to - // the nearest 0.5(ceiling). For instance, a rating of 0.6 will eliminate all - // results with a less than 1.0 rating. - double min_rating = 9; - - // Maximum number of results to return. It must be between 1 and 20, - // inclusively. If the number is unset, it falls back to the upper limit. If - // the number is set to negative or exceeds the upper limit, an - // INVALID_ARGUMENT error is returned. - int32 max_result_count = 10; - - // Used to restrict the search to places that are marked as certain price - // levels. Users can choose any combinations of price levels. Default to - // select all price levels. - repeated PriceLevel price_levels = 11; - - // Used to set strict type filtering for included_type. If set to true, only - // results of the same type will be returned. Default to false. - bool strict_type_filtering = 12; - - // The region to search. This location serves as a bias which means results - // around given location might be returned. Cannot be set along with - // location_restriction. - LocationBias location_bias = 13; - - // The region to search. This location serves as a restriction which means - // results outside given location will not be returned. Cannot be set along - // with location_bias. - LocationRestriction location_restriction = 14; -} - -// Response proto for SearchText. -// -message SearchTextResponse { - // A list of places that meet the user's text search criteria. - repeated Place places = 1; -} diff --git a/owl-bot-staging/google-maps-places/v1/samples/generated/v1/places.search_text.js b/owl-bot-staging/google-maps-places/v1/samples/generated/v1/places.search_text.js deleted file mode 100644 index cd132b6f779..00000000000 --- a/owl-bot-staging/google-maps-places/v1/samples/generated/v1/places.search_text.js +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(textQuery) { - // [START places_v1_generated_Places_SearchText_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The text query for textual search. - */ - // const textQuery = 'abc123' - /** - * Place details will be displayed with the preferred language if available. - * If the language code is unspecified or unrecognized, place details of any - * language may be returned, with a preference for English if such details - * exist. - * Current list of supported languages: - * https://developers.google.com/maps/faq#languagesupport. - */ - // const languageCode = 'abc123' - /** - * The Unicode country/region code (CLDR) of the location where the - * request is coming from. It is used to display the place details, like - * region-specific place name, if available. - * For more information, see - * http://www.unicode.org/reports/tr35/#unicode_region_subtag. - * Note that 3-digit region codes are not currently supported. - */ - // const regionCode = 'abc123' - /** - * How results will be ranked in the response. - */ - // const rankPreference = {} - /** - * The requested place type. Full list of types supported: - * https://developers.google.com/places/supported_types. Only support one - * included type. - */ - // const includedType = 'abc123' - /** - * Used to restrict the search to places that are open at a specific time. - * open_now marks if a business is currently open. - */ - // const openNow = true - /** - * Filter out results whose average user rating is strictly less than this - * limit. A valid value must be an float between 0 and 5 (inclusively) at a - * 0.5 cadence i.e. `[0, 0.5, 1.0, ... , 5.0]` inclusively. This is to keep - * parity with LocalRefinement_UserRating. The input rating will round up to - * the nearest 0.5(ceiling). For instance, a rating of 0.6 will eliminate all - * results with a less than 1.0 rating. - */ - // const minRating = 1234 - /** - * Maximum number of results to return. It must be between 1 and 20, - * inclusively. If the number is unset, it falls back to the upper limit. If - * the number is set to negative or exceeds the upper limit, an - * INVALID_ARGUMENT error is returned. - */ - // const maxResultCount = 1234 - /** - * Used to restrict the search to places that are marked as certain price - * levels. Users can choose any combinations of price levels. Default to - * select all price levels. - */ - // const priceLevels = [1,2,3,4] - /** - * Used to set strict type filtering for included_type. If set to true, only - * results of the same type will be returned. Default to false. - */ - // const strictTypeFiltering = true - /** - * The region to search. This location serves as a bias which means results - * around given location might be returned. Cannot be set along with - * location_restriction. - */ - // const locationBias = {} - /** - * The region to search. This location serves as a restriction which means - * results outside given location will not be returned. Cannot be set along - * with location_bias. - */ - // const locationRestriction = {} - - // Imports the Places library - const {PlacesClient} = require('@googlemaps/places').v1; - - // Instantiates a client - const placesClient = new PlacesClient(); - - async function callSearchText() { - // Construct request - const request = { - textQuery, - }; - - // Run request - const response = await placesClient.searchText(request); - console.log(response); - } - - callSearchText(); - // [END places_v1_generated_Places_SearchText_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-places/v1/samples/generated/v1/snippet_metadata_google.maps.places.v1.json b/owl-bot-staging/google-maps-places/v1/samples/generated/v1/snippet_metadata_google.maps.places.v1.json deleted file mode 100644 index eef96197d9a..00000000000 --- a/owl-bot-staging/google-maps-places/v1/samples/generated/v1/snippet_metadata_google.maps.places.v1.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-places", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.maps.places.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "places_v1_generated_Places_SearchText_async", - "title": "Places searchText Sample", - "origin": "API_DEFINITION", - "description": " Text query based place search.", - "canonical": true, - "file": "places.search_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 125, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SearchText", - "fullName": "google.maps.places.v1.Places.SearchText", - "async": true, - "parameters": [ - { - "name": "text_query", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "region_code", - "type": "TYPE_STRING" - }, - { - "name": "rank_preference", - "type": ".google.maps.places.v1.SearchTextRequest.RankPreference" - }, - { - "name": "location", - "type": ".google.maps.places.v1.SearchTextRequest.Location" - }, - { - "name": "included_type", - "type": "TYPE_STRING" - }, - { - "name": "open_now", - "type": "TYPE_BOOL" - }, - { - "name": "price_range", - "type": ".google.maps.places.v1.Int32Range" - }, - { - "name": "min_rating", - "type": "TYPE_DOUBLE" - }, - { - "name": "max_result_count", - "type": "TYPE_INT32" - }, - { - "name": "price_levels", - "type": "TYPE_ENUM[]" - }, - { - "name": "strict_type_filtering", - "type": "TYPE_BOOL" - }, - { - "name": "location_bias", - "type": ".google.maps.places.v1.SearchTextRequest.LocationBias" - }, - { - "name": "location_restriction", - "type": ".google.maps.places.v1.SearchTextRequest.LocationRestriction" - } - ], - "resultType": ".google.maps.places.v1.SearchTextResponse", - "client": { - "shortName": "PlacesClient", - "fullName": "google.maps.places.v1.PlacesClient" - }, - "method": { - "shortName": "SearchText", - "fullName": "google.maps.places.v1.Places.SearchText", - "service": { - "shortName": "Places", - "fullName": "google.maps.places.v1.Places" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-maps-places/v1/src/index.ts b/owl-bot-staging/google-maps-places/v1/src/index.ts deleted file mode 100644 index 6b7e1657310..00000000000 --- a/owl-bot-staging/google-maps-places/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 PlacesClient = v1.PlacesClient; -type PlacesClient = v1.PlacesClient; -export {v1, PlacesClient}; -export default {v1, PlacesClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-maps-places/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-maps-places/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 827d738ec76..00000000000 --- a/owl-bot-staging/google-maps-places/v1/src/v1/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.maps.places.v1", - "libraryPackage": "@googlemaps/places", - "services": { - "Places": { - "clients": { - "grpc": { - "libraryClient": "PlacesClient", - "rpcs": { - "SearchText": { - "methods": [ - "searchText" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "PlacesClient", - "rpcs": { - "SearchText": { - "methods": [ - "searchText" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-maps-places/v1/src/v1/index.ts b/owl-bot-staging/google-maps-places/v1/src/v1/index.ts deleted file mode 100644 index f135558c071..00000000000 --- a/owl-bot-staging/google-maps-places/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 {PlacesClient} from './places_client'; diff --git a/owl-bot-staging/google-maps-places/v1/src/v1/places_client.ts b/owl-bot-staging/google-maps-places/v1/src/v1/places_client.ts deleted file mode 100644 index 86e697eca4e..00000000000 --- a/owl-bot-staging/google-maps-places/v1/src/v1/places_client.ts +++ /dev/null @@ -1,436 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/places_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './places_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service definition for the Places API. - * @class - * @memberof v1 - */ -export class PlacesClient { - 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}; - placesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of PlacesClient. - * - * @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 PlacesClient({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 PlacesClient; - 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.maps.places.v1.Places', 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.placesStub) { - return this.placesStub; - } - - // Put together the "service stub" for - // google.maps.places.v1.Places. - this.placesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.maps.places.v1.Places') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.maps.places.v1.Places, - 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 placesStubMethods = - ['searchText']; - for (const methodName of placesStubMethods) { - const callPromise = this.placesStub.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.placesStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'places.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 'places.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 []; - } - - 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 -- - // ------------------- -/** - * Text query based place search. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.textQuery - * Required. The text query for textual search. - * @param {string} request.languageCode - * Place details will be displayed with the preferred language if available. - * If the language code is unspecified or unrecognized, place details of any - * language may be returned, with a preference for English if such details - * exist. - * - * Current list of supported languages: - * https://developers.google.com/maps/faq#languagesupport. - * @param {string} request.regionCode - * The Unicode country/region code (CLDR) of the location where the - * request is coming from. It is used to display the place details, like - * region-specific place name, if available. - * - * For more information, see - * http://www.unicode.org/reports/tr35/#unicode_region_subtag. - * - * - * Note that 3-digit region codes are not currently supported. - * @param {google.maps.places.v1.SearchTextRequest.RankPreference} request.rankPreference - * How results will be ranked in the response. - * @param {google.maps.places.v1.SearchTextRequest.Location} request.location - * The region to search. Setting location would usually yields - * better results. Recommended to set. This location serves as a bias unless - * strict_restriction is set to true, which turns the location to a strict - * restriction. - * - * Deprecated. Use LocationRestriction or LocationBias instead. - * @param {string} request.includedType - * The requested place type. Full list of types supported: - * https://developers.google.com/places/supported_types. Only support one - * included type. - * @param {boolean} request.openNow - * Used to restrict the search to places that are open at a specific time. - * open_now marks if a business is currently open. - * @param {google.maps.places.v1.Int32Range} request.priceRange - * [Deprecated!]Used to restrict the search to places that are within a - * certain price range. This is on a scale of 0 to 4. Set a minimum of 0 or - * set a maximum of 4 has no effect on the search results. Min price is - * default to 0 and max price is default to 4. Default value will be used if - * either min or max is unset. - * @param {number} request.minRating - * Filter out results whose average user rating is strictly less than this - * limit. A valid value must be an float between 0 and 5 (inclusively) at a - * 0.5 cadence i.e. `[0, 0.5, 1.0, ... , 5.0]` inclusively. This is to keep - * parity with LocalRefinement_UserRating. The input rating will round up to - * the nearest 0.5(ceiling). For instance, a rating of 0.6 will eliminate all - * results with a less than 1.0 rating. - * @param {number} request.maxResultCount - * Maximum number of results to return. It must be between 1 and 20, - * inclusively. If the number is unset, it falls back to the upper limit. If - * the number is set to negative or exceeds the upper limit, an - * INVALID_ARGUMENT error is returned. - * @param {number[]} request.priceLevels - * Used to restrict the search to places that are marked as certain price - * levels. Users can choose any combinations of price levels. Default to - * select all price levels. - * @param {boolean} request.strictTypeFiltering - * Used to set strict type filtering for included_type. If set to true, only - * results of the same type will be returned. Default to false. - * @param {google.maps.places.v1.SearchTextRequest.LocationBias} request.locationBias - * The region to search. This location serves as a bias which means results - * around given location might be returned. Cannot be set along with - * location_restriction. - * @param {google.maps.places.v1.SearchTextRequest.LocationRestriction} request.locationRestriction - * The region to search. This location serves as a restriction which means - * results outside given location will not be returned. Cannot be set along - * with location_bias. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.maps.places.v1.SearchTextResponse|SearchTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/places.search_text.js - * region_tag:places_v1_generated_Places_SearchText_async - */ - searchText( - request?: protos.google.maps.places.v1.ISearchTextRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.places.v1.ISearchTextResponse, - protos.google.maps.places.v1.ISearchTextRequest|undefined, {}|undefined - ]>; - searchText( - request: protos.google.maps.places.v1.ISearchTextRequest, - options: CallOptions, - callback: Callback< - protos.google.maps.places.v1.ISearchTextResponse, - protos.google.maps.places.v1.ISearchTextRequest|null|undefined, - {}|null|undefined>): void; - searchText( - request: protos.google.maps.places.v1.ISearchTextRequest, - callback: Callback< - protos.google.maps.places.v1.ISearchTextResponse, - protos.google.maps.places.v1.ISearchTextRequest|null|undefined, - {}|null|undefined>): void; - searchText( - request?: protos.google.maps.places.v1.ISearchTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.maps.places.v1.ISearchTextResponse, - protos.google.maps.places.v1.ISearchTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.maps.places.v1.ISearchTextResponse, - protos.google.maps.places.v1.ISearchTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.maps.places.v1.ISearchTextResponse, - protos.google.maps.places.v1.ISearchTextRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.searchText(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.placesStub && !this._terminated) { - return this.placesStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-maps-places/v1/src/v1/places_client_config.json b/owl-bot-staging/google-maps-places/v1/src/v1/places_client_config.json deleted file mode 100644 index dcc25703b98..00000000000 --- a/owl-bot-staging/google-maps-places/v1/src/v1/places_client_config.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.maps.places.v1.Places": { - "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": { - "SearchText": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-maps-places/v1/src/v1/places_proto_list.json b/owl-bot-staging/google-maps-places/v1/src/v1/places_proto_list.json deleted file mode 100644 index ca12c21c188..00000000000 --- a/owl-bot-staging/google-maps-places/v1/src/v1/places_proto_list.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "../../protos/google/geo/type/viewport.proto", - "../../protos/google/maps/places/v1/geometry.proto", - "../../protos/google/maps/places/v1/place.proto", - "../../protos/google/maps/places/v1/places_service.proto" -] diff --git a/owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 79e4ed8f104..00000000000 --- a/owl-bot-staging/google-maps-places/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 places = require('@googlemaps/places'); - -function main() { - const placesClient = new places.PlacesClient(); -} - -main(); diff --git a/owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-maps-places/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 56ce2c77cc4..00000000000 --- a/owl-bot-staging/google-maps-places/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 {PlacesClient} from '@googlemaps/places'; - -// check that the client class type name can be used -function doStuffWithPlacesClient(client: PlacesClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const placesClient = new PlacesClient(); - doStuffWithPlacesClient(placesClient); -} - -main(); diff --git a/owl-bot-staging/google-maps-places/v1/system-test/install.ts b/owl-bot-staging/google-maps-places/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-maps-places/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-maps-places/v1/test/gapic_places_v1.ts b/owl-bot-staging/google-maps-places/v1/test/gapic_places_v1.ts deleted file mode 100644 index 3fde5fedd35..00000000000 --- a/owl-bot-staging/google-maps-places/v1/test/gapic_places_v1.ts +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 placesModule 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.PlacesClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = placesModule.v1.PlacesClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = placesModule.v1.PlacesClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = placesModule.v1.PlacesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new placesModule.v1.PlacesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new placesModule.v1.PlacesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new placesModule.v1.PlacesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.placesStub, undefined); - await client.initialize(); - assert(client.placesStub); - }); - - it('has close method for the initialized client', done => { - const client = new placesModule.v1.PlacesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.placesStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new placesModule.v1.PlacesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.placesStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new placesModule.v1.PlacesClient({ - 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 placesModule.v1.PlacesClient({ - 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('searchText', () => { - it('invokes searchText without error', async () => { - const client = new placesModule.v1.PlacesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.places.v1.SearchTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.maps.places.v1.SearchTextResponse() - ); - client.innerApiCalls.searchText = stubSimpleCall(expectedResponse); - const [response] = await client.searchText(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes searchText without error using callback', async () => { - const client = new placesModule.v1.PlacesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.places.v1.SearchTextRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.maps.places.v1.SearchTextResponse() - ); - client.innerApiCalls.searchText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchText( - request, - (err?: Error|null, result?: protos.google.maps.places.v1.ISearchTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes searchText with error', async () => { - const client = new placesModule.v1.PlacesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.places.v1.SearchTextRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.searchText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchText(request), expectedError); - }); - - it('invokes searchText with closed client', async () => { - const client = new placesModule.v1.PlacesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.places.v1.SearchTextRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.searchText(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-maps-places/v1/tsconfig.json b/owl-bot-staging/google-maps-places/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-maps-places/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-maps-places/v1/webpack.config.js b/owl-bot-staging/google-maps-places/v1/webpack.config.js deleted file mode 100644 index 6f1933d317a..00000000000 --- a/owl-bot-staging/google-maps-places/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: 'Places', - filename: './places.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-maps-routing/v2/.eslintignore b/owl-bot-staging/google-maps-routing/v2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-maps-routing/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-maps-routing/v2/.eslintrc.json b/owl-bot-staging/google-maps-routing/v2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-maps-routing/v2/.gitignore b/owl-bot-staging/google-maps-routing/v2/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-maps-routing/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-maps-routing/v2/.jsdoc.js b/owl-bot-staging/google-maps-routing/v2/.jsdoc.js deleted file mode 100644 index 8a30e43d717..00000000000 --- a/owl-bot-staging/google-maps-routing/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: '@googlemaps/routing', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-maps-routing/v2/.mocharc.js b/owl-bot-staging/google-maps-routing/v2/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-maps-routing/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-maps-routing/v2/.prettierrc.js b/owl-bot-staging/google-maps-routing/v2/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-maps-routing/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-maps-routing/v2/README.md b/owl-bot-staging/google-maps-routing/v2/README.md deleted file mode 100644 index 86d380e7032..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Routing: Nodejs Client diff --git a/owl-bot-staging/google-maps-routing/v2/package.json b/owl-bot-staging/google-maps-routing/v2/package.json deleted file mode 100644 index 8b9a8d4bb1b..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@googlemaps/routing", - "version": "0.1.0", - "description": "Routing client for Node.js", - "repository": "googleapis/nodejs-routing", - "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 routing", - "routing", - "routes" - ], - "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-maps-routing/v2/protos/google/geo/type/viewport.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/geo/type/viewport.proto deleted file mode 100644 index ad5029f8360..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/geo/type/viewport.proto +++ /dev/null @@ -1,69 +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.geo.type; - -import "google/type/latlng.proto"; - -option go_package = "google.golang.org/genproto/googleapis/geo/type/viewport;viewport"; -option java_multiple_files = true; -option java_outer_classname = "ViewportProto"; -option java_package = "com.google.geo.type"; -option objc_class_prefix = "GGTP"; - -// A latitude-longitude viewport, represented as two diagonally opposite `low` -// and `high` points. A viewport is considered a closed region, i.e. it includes -// its boundary. The latitude bounds must range between -90 to 90 degrees -// inclusive, and the longitude bounds must range between -180 to 180 degrees -// inclusive. Various cases include: -// -// - If `low` = `high`, the viewport consists of that single point. -// -// - If `low.longitude` > `high.longitude`, the longitude range is inverted -// (the viewport crosses the 180 degree longitude line). -// -// - If `low.longitude` = -180 degrees and `high.longitude` = 180 degrees, -// the viewport includes all longitudes. -// -// - If `low.longitude` = 180 degrees and `high.longitude` = -180 degrees, -// the longitude range is empty. -// -// - If `low.latitude` > `high.latitude`, the latitude range is empty. -// -// Both `low` and `high` must be populated, and the represented box cannot be -// empty (as specified by the definitions above). An empty viewport will result -// in an error. -// -// For example, this viewport fully encloses New York City: -// -// { -// "low": { -// "latitude": 40.477398, -// "longitude": -74.259087 -// }, -// "high": { -// "latitude": 40.91618, -// "longitude": -73.70018 -// } -// } -message Viewport { - // Required. The low point of the viewport. - google.type.LatLng low = 1; - - // Required. The high point of the viewport. - google.type.LatLng high = 2; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/fallback_info.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/fallback_info.proto deleted file mode 100644 index 3af720b9b8c..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/fallback_info.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.maps.routing.v2; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "FallbackInfoProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Information related to how and why a fallback result was used. If this field -// is set, then it means the server used a different routing mode from your -// preferred mode as fallback. -message FallbackInfo { - // Routing mode used for the response. If fallback was triggered, the mode - // may be different from routing preference set in the original client - // request. - FallbackRoutingMode routing_mode = 1; - - // The reason why fallback response was used instead of the original response. - // This field is only populated when the fallback mode is triggered and the - // fallback response is returned. - FallbackReason reason = 2; -} - -// Reasons for using fallback response. -enum FallbackReason { - // No fallback reason specified. - FALLBACK_REASON_UNSPECIFIED = 0; - - // A server error happened while calculating routes with your preferred - // routing mode, but we were able to return a result calculated by an - // alternative mode. - SERVER_ERROR = 1; - - // We were not able to finish the calculation with your preferred routing mode - // on time, but we were able to return a result calculated by an alternative - // mode. - LATENCY_EXCEEDED = 2; -} - -// Actual routing mode used for returned fallback response. -enum FallbackRoutingMode { - // Not used. - FALLBACK_ROUTING_MODE_UNSPECIFIED = 0; - - // Indicates the `TRAFFIC_UNAWARE` [google.maps.routing.v2.RoutingPreference] - // was used to compute the response. - FALLBACK_TRAFFIC_UNAWARE = 1; - - // Indicates the `TRAFFIC_AWARE` - // [RoutingPreference][google.maps.routing.v2.RoutingPreference] was used to - // compute the response. - FALLBACK_TRAFFIC_AWARE = 2; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/geocoding_results.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/geocoding_results.proto deleted file mode 100644 index 8532119d24a..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/geocoding_results.proto +++ /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 -// -// 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.maps.routing.v2; - -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "GeocodingResultsProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Contains [GeocodedWaypoints][google.maps.routing.v2.GeocodedWaypoint] for -// origin, destination and intermediate waypoints. Only populated for address -// waypoints. -message GeocodingResults { - // Origin geocoded waypoint. - GeocodedWaypoint origin = 1; - - // Destination geocoded waypoint. - GeocodedWaypoint destination = 2; - - // A list of intermediate geocoded waypoints each containing an index field - // that corresponds to the zero-based position of the waypoint in the order - // they were specified in the request. - repeated GeocodedWaypoint intermediates = 3; -} - -// Details about the locations used as waypoints. Only populated for address -// waypoints. Includes details about the geocoding results for the purposes of -// determining what the address was geocoded to. -message GeocodedWaypoint { - // Indicates the status code resulting from the geocoding operation. - google.rpc.Status geocoder_status = 1; - - // The index of the corresponding intermediate waypoint in the request. - // Only populated if the corresponding waypoint is an intermediate - // waypoint. - optional int32 intermediate_waypoint_request_index = 2; - - // The type(s) of the result, in the form of zero or more type tags. - // Supported types: - // https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types - repeated string type = 3; - - // Indicates that the geocoder did not return an exact match for the original - // request, though it was able to match part of the requested address. You may - // wish to examine the original request for misspellings and/or an incomplete - // address. - bool partial_match = 4; - - // The place ID for this result. - string place_id = 5; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/localized_time.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/localized_time.proto deleted file mode 100644 index 1f19ef196c4..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/localized_time.proto +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -import "google/type/localized_text.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "LocalizedTimeProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Localized description of time. -message LocalizedTime { - // The time specified as a string in a given time zone. - google.type.LocalizedText time = 1; - - // Contains the time zone. The value is the name of the time zone as defined - // in the [IANA Time Zone Database](http://www.iana.org/time-zones), e.g. - // "America/New_York". - string time_zone = 2; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/location.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/location.proto deleted file mode 100644 index 8794169d1a1..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/location.proto +++ /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 -// -// 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.maps.routing.v2; - -import "google/protobuf/wrappers.proto"; -import "google/type/latlng.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "LocationProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Encapsulates a location (a geographic point, and an optional heading). -message Location { - // The waypoint's geographic coordinates. - google.type.LatLng lat_lng = 1; - - // The compass heading associated with the direction of the flow of traffic. - // This value specifies the side of the road for pickup and drop-off. Heading - // values can be from 0 to 360, where 0 specifies a heading of due North, 90 - // specifies a heading of due East, and so on. You can use this field only for - // `DRIVE` and `TWO_WHEELER` - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. - google.protobuf.Int32Value heading = 2; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/maneuver.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/maneuver.proto deleted file mode 100644 index dac7b8e3d35..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/maneuver.proto +++ /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 -// -// 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.maps.routing.v2; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "ManeuverProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// A set of values that specify the navigation action to take for the current -// step (e.g., turn left, merge, straight, etc.). -enum Maneuver { - // Not used. - MANEUVER_UNSPECIFIED = 0; - - // Turn slightly to the left. - TURN_SLIGHT_LEFT = 1; - - // Turn sharply to the left. - TURN_SHARP_LEFT = 2; - - // Make a left u-turn. - UTURN_LEFT = 3; - - // Turn left. - TURN_LEFT = 4; - - // Turn slightly to the right. - TURN_SLIGHT_RIGHT = 5; - - // Turn sharply to the right. - TURN_SHARP_RIGHT = 6; - - // Make a right u-turn. - UTURN_RIGHT = 7; - - // Turn right. - TURN_RIGHT = 8; - - // Go straight. - STRAIGHT = 9; - - // Take the left ramp. - RAMP_LEFT = 10; - - // Take the right ramp. - RAMP_RIGHT = 11; - - // Merge into traffic. - MERGE = 12; - - // Take the left fork. - FORK_LEFT = 13; - - // Take the right fork. - FORK_RIGHT = 14; - - // Take the ferry. - FERRY = 15; - - // Take the train leading onto the ferry. - FERRY_TRAIN = 16; - - // Turn left at the roundabout. - ROUNDABOUT_LEFT = 17; - - // Turn right at the roundabout. - ROUNDABOUT_RIGHT = 18; - - // Initial maneuver. - DEPART = 19; - - // Used to indicate a street name change. - NAME_CHANGE = 20; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/navigation_instruction.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/navigation_instruction.proto deleted file mode 100644 index cf66832320d..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/navigation_instruction.proto +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -import "google/maps/routing/v2/maneuver.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "NavigationInstructionProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Encapsulates navigation instructions for a -// [RouteLegStep][google.maps.routing.v2.RouteLegStep] -message NavigationInstruction { - // Encapsulates the navigation instructions for the current step (e.g., turn - // left, merge, straight, etc.). This field determines which icon to display. - Maneuver maneuver = 1; - - // Instructions for navigating this step. - string instructions = 2; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/polyline.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/polyline.proto deleted file mode 100644 index ba3609b2de0..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/polyline.proto +++ /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 -// -// 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.maps.routing.v2; - -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "PolylineProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Encapsulates an encoded polyline. -message Polyline { - // Encapsulates the type of polyline. Defaults to encoded_polyline. - oneof polyline_type { - // The string encoding of the polyline using the [polyline encoding - // algorithm](https://developers.google.com/maps/documentation/utilities/polylinealgorithm) - string encoded_polyline = 1; - - // Specifies a polyline using the [GeoJSON LineString - // format](https://tools.ietf.org/html/rfc7946#section-3.1.4) - google.protobuf.Struct geo_json_linestring = 2; - } -} - -// A set of values that specify the quality of the polyline. -enum PolylineQuality { - // No polyline quality preference specified. Defaults to `OVERVIEW`. - POLYLINE_QUALITY_UNSPECIFIED = 0; - - // Specifies a high-quality polyline - which is composed using more points - // than `OVERVIEW`, at the cost of increased response size. Use this value - // when you need more precision. - HIGH_QUALITY = 1; - - // Specifies an overview polyline - which is composed using a small number of - // points. Use this value when displaying an overview of the route. Using this - // option has a lower request latency compared to using the - // `HIGH_QUALITY` option. - OVERVIEW = 2; -} - -// Specifies the preferred type of polyline to be returned. -enum PolylineEncoding { - // No polyline type preference specified. Defaults to `ENCODED_POLYLINE`. - POLYLINE_ENCODING_UNSPECIFIED = 0; - - // Specifies a polyline encoded using the [polyline encoding - // algorithm](https://developers.google.com/maps/documentation/utilities/polylinealgorithm). - ENCODED_POLYLINE = 1; - - // Specifies a polyline using the [GeoJSON LineString - // format](https://tools.ietf.org/html/rfc7946#section-3.1.4) - GEO_JSON_LINESTRING = 2; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route.proto deleted file mode 100644 index 3a982db04b0..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route.proto +++ /dev/null @@ -1,395 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -import "google/geo/type/viewport.proto"; -import "google/maps/routing/v2/localized_time.proto"; -import "google/maps/routing/v2/location.proto"; -import "google/maps/routing/v2/navigation_instruction.proto"; -import "google/maps/routing/v2/polyline.proto"; -import "google/maps/routing/v2/route_label.proto"; -import "google/maps/routing/v2/route_travel_mode.proto"; -import "google/maps/routing/v2/speed_reading_interval.proto"; -import "google/maps/routing/v2/toll_info.proto"; -import "google/maps/routing/v2/transit.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/localized_text.proto"; -import "google/type/money.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "RouteProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Contains a route, which consists of a series of connected road segments -// that join beginning, ending, and intermediate waypoints. -message Route { - // Text representations of certain properties. - message RouteLocalizedValues { - // Travel distance represented in text form. - google.type.LocalizedText distance = 1; - - // Duration taking traffic conditions into consideration, represented in - // text form. Note: If you did not request traffic information, this value - // will be the same value as static_duration. - google.type.LocalizedText duration = 2; - - // Duration without taking traffic conditions into - // consideration, represented in text form. - google.type.LocalizedText static_duration = 3; - - // Transit fare represented in text form. - google.type.LocalizedText transit_fare = 4; - } - - // Labels for the `Route` that are useful to identify specific properties - // of the route to compare against others. - repeated RouteLabel route_labels = 13; - - // A collection of legs (path segments between waypoints) that make up the - // route. Each leg corresponds to the trip between two non-`via` - // [Waypoints][google.maps.routing.v2.Waypoint]. For example, a route with no - // intermediate waypoints has only one leg. A route that includes one - // non-`via` intermediate waypoint has two legs. A route that includes one - // `via` intermediate waypoint has one leg. The order of the legs matches the - // order of waypoints from `origin` to `intermediates` to `destination`. - repeated RouteLeg legs = 1; - - // The travel distance of the route, in meters. - int32 distance_meters = 2; - - // The length of time needed to navigate the route. If you set the - // `routing_preference` to `TRAFFIC_UNAWARE`, then this value is the same as - // `static_duration`. If you set the `routing_preference` to either - // `TRAFFIC_AWARE` or `TRAFFIC_AWARE_OPTIMAL`, then this value is calculated - // taking traffic conditions into account. - google.protobuf.Duration duration = 3; - - // The duration of travel through the route without taking traffic - // conditions into consideration. - google.protobuf.Duration static_duration = 4; - - // The overall route polyline. This polyline is the combined polyline of - // all `legs`. - Polyline polyline = 5; - - // A description of the route. - string description = 6; - - // An array of warnings to show when displaying the route. - repeated string warnings = 7; - - // The viewport bounding box of the polyline. - google.geo.type.Viewport viewport = 8; - - // Additional information about the route. - RouteTravelAdvisory travel_advisory = 9; - - // If you set - // [optimize_waypoint_order][google.maps.routing.v2.ComputeRoutesRequest.optimize_waypoint_order] - // to true, this field contains the optimized ordering of intermediate - // waypoints. Otherwise, this field is empty. - // For example, if you give an input of Origin: LA; Intermediate waypoints: - // Dallas, Bangor, Phoenix; Destination: New York; and the optimized - // intermediate waypoint order is Phoenix, Dallas, Bangor, then this field - // contains the values [2, 0, 1]. The index starts with 0 for the first - // intermediate waypoint provided in the input. - repeated int32 optimized_intermediate_waypoint_index = 10; - - // Text representations of properties of the `Route`. - RouteLocalizedValues localized_values = 11; - - // A web-safe, base64-encoded route token that can be passed to the Navigation - // SDK, that allows the Navigation SDK to reconstruct the route during - // navigation, and, in the event of rerouting, honor the original intention - // when you created the route by calling ComputeRoutes. Customers should treat - // this token as an opaque blob. It is not meant for reading or mutating. - // NOTE: `Route.route_token` is only available for requests that have set - // `ComputeRoutesRequest.routing_preference` to `TRAFFIC_AWARE` or - // `TRAFFIC_AWARE_OPTIMAL`. `Route.route_token` is not supported for requests - // that have Via waypoints. - string route_token = 12; -} - -// Contains the additional information that the user should be informed -// about, such as possible traffic zone restrictions. -message RouteTravelAdvisory { - // Contains information about tolls on the route. This field is only populated - // if tolls are expected on the route. If this field is set, but the - // estimatedPrice subfield is not populated, then the route contains tolls, - // but the estimated price is unknown. If this field is not set, then there - // are no tolls expected on the route. - TollInfo toll_info = 2; - - // Speed reading intervals detailing traffic density. Applicable in case of - // `TRAFFIC_AWARE` and `TRAFFIC_AWARE_OPTIMAL` routing preferences. - // The intervals cover the entire polyline of the route without overlap. - // The start point of a specified interval is the same as the end point of the - // preceding interval. - // - // Example: - // - // polyline: A ---- B ---- C ---- D ---- E ---- F ---- G - // speed_reading_intervals: [A,C), [C,D), [D,G). - repeated SpeedReadingInterval speed_reading_intervals = 3; - - // The predicted fuel consumption in microliters. - int64 fuel_consumption_microliters = 5; - - // Returned route may have restrictions that are not suitable for requested - // travel mode or route modifiers. - bool route_restrictions_partially_ignored = 6; - - // If present, contains the total fare or ticket costs on this route - // This property is only returned for `TRANSIT` requests and only - // for routes where fare information is available for all transit steps. - google.type.Money transit_fare = 7; -} - -// Contains the additional information that the user should be informed -// about on a leg step, such as possible traffic zone restrictions. -message RouteLegTravelAdvisory { - // Contains information about tolls on the specific `RouteLeg`. - // This field is only populated if we expect there are tolls on the - // `RouteLeg`. If this field is set but the estimated_price subfield is not - // populated, we expect that road contains tolls but we do not know an - // estimated price. If this field does not exist, then there is no toll on the - // `RouteLeg`. - TollInfo toll_info = 1; - - // Speed reading intervals detailing traffic density. Applicable in case of - // `TRAFFIC_AWARE` and `TRAFFIC_AWARE_OPTIMAL` routing preferences. - // The intervals cover the entire polyline of the `RouteLeg` without overlap. - // The start point of a specified interval is the same as the end point of the - // preceding interval. - // - // Example: - // - // polyline: A ---- B ---- C ---- D ---- E ---- F ---- G - // speed_reading_intervals: [A,C), [C,D), [D,G). - repeated SpeedReadingInterval speed_reading_intervals = 2; -} - -// Contains the additional information that the user should be informed -// about, such as possible traffic zone restrictions on a leg step. -message RouteLegStepTravelAdvisory { - // NOTE: This field is not currently populated. - repeated SpeedReadingInterval speed_reading_intervals = 1; -} - -// Contains a segment between non-`via` waypoints. -message RouteLeg { - // Text representations of certain properties. - message RouteLegLocalizedValues { - // Travel distance represented in text form. - google.type.LocalizedText distance = 1; - - // Duration taking traffic conditions into consideration represented in text - // form. Note: If you did not request traffic information, this value will - // be the same value as static_duration. - google.type.LocalizedText duration = 2; - - // Duration without taking traffic conditions into - // consideration, represented in text form. - google.type.LocalizedText static_duration = 3; - } - - // Provides overview information about a list of `RouteLegStep`s. - message StepsOverview { - // Provides summarized information about different multi-modal segments of - // the `RouteLeg.steps`. A multi-modal segment is defined as one or more - // contiguous `RouteLegStep` that have the same `RouteTravelMode`. - // This field is not populated if the `RouteLeg` does not contain any - // multi-modal segments in the steps. - message MultiModalSegment { - // The corresponding `RouteLegStep` index that is the start of a - // multi-modal segment. - optional int32 step_start_index = 1; - - // The corresponding `RouteLegStep` index that is the end of a - // multi-modal segment. - optional int32 step_end_index = 2; - - // NavigationInstruction for the multi-modal segment. - NavigationInstruction navigation_instruction = 3; - - // The travel mode of the multi-modal segment. - RouteTravelMode travel_mode = 4; - } - - // Summarized information about different multi-modal segments of - // the `RouteLeg.steps`. This field is not populated if the `RouteLeg` does - // not contain any multi-modal segments in the steps. - repeated MultiModalSegment multi_modal_segments = 1; - } - - // The travel distance of the route leg, in meters. - int32 distance_meters = 1; - - // The length of time needed to navigate the leg. If the `route_preference` - // is set to `TRAFFIC_UNAWARE`, then this value is the same as - // `static_duration`. If the `route_preference` is either `TRAFFIC_AWARE` or - // `TRAFFIC_AWARE_OPTIMAL`, then this value is calculated taking traffic - // conditions into account. - google.protobuf.Duration duration = 2; - - // The duration of travel through the leg, calculated without taking - // traffic conditions into consideration. - google.protobuf.Duration static_duration = 3; - - // The overall polyline for this leg that includes each `step`'s - // polyline. - Polyline polyline = 4; - - // The start location of this leg. This location might be different from the - // provided `origin`. For example, when the provided `origin` is not near a - // road, this is a point on the road. - Location start_location = 5; - - // The end location of this leg. This location might be different from the - // provided `destination`. For example, when the provided `destination` is not - // near a road, this is a point on the road. - Location end_location = 6; - - // An array of steps denoting segments within this leg. Each step represents - // one navigation instruction. - repeated RouteLegStep steps = 7; - - // Contains the additional information that the user should be informed - // about, such as possible traffic zone restrictions, on a route leg. - RouteLegTravelAdvisory travel_advisory = 8; - - // Text representations of properties of the `RouteLeg`. - RouteLegLocalizedValues localized_values = 9; - - // Overview information about the steps in this `RouteLeg`. This field is only - // populated for TRANSIT routes. - StepsOverview steps_overview = 10; -} - -// Contains a segment of a [RouteLeg][google.maps.routing.v2.RouteLeg]. A -// step corresponds to a single navigation instruction. Route legs are made up -// of steps. -message RouteLegStep { - // Text representations of certain properties. - message RouteLegStepLocalizedValues { - // Travel distance represented in text form. - google.type.LocalizedText distance = 1; - - // Duration without taking traffic conditions into - // consideration, represented in text form. - google.type.LocalizedText static_duration = 3; - } - - // The travel distance of this step, in meters. In some circumstances, this - // field might not have a value. - int32 distance_meters = 1; - - // The duration of travel through this step without taking traffic conditions - // into consideration. In some circumstances, this field might not have a - // value. - google.protobuf.Duration static_duration = 2; - - // The polyline associated with this step. - Polyline polyline = 3; - - // The start location of this step. - Location start_location = 4; - - // The end location of this step. - Location end_location = 5; - - // Navigation instructions. - NavigationInstruction navigation_instruction = 6; - - // Contains the additional information that the user should be informed - // about, such as possible traffic zone restrictions, on a leg step. - RouteLegStepTravelAdvisory travel_advisory = 7; - - // Text representations of properties of the `RouteLegStep`. - RouteLegStepLocalizedValues localized_values = 8; - - // Details pertaining to this step if the travel mode is `TRANSIT`. - RouteLegStepTransitDetails transit_details = 9; - - // The travel mode used for this step. - RouteTravelMode travel_mode = 10; -} - -// Additional information for the `RouteLegStep` related to `TRANSIT` routes. -message RouteLegStepTransitDetails { - // Details about the transit stops for the `RouteLegStep` - message TransitStopDetails { - // Information about the arrival stop for the step. - TransitStop arrival_stop = 1; - - // The estimated time of arrival for the step. - google.protobuf.Timestamp arrival_time = 2; - - // Information about the departure stop for the step. - TransitStop departure_stop = 3; - - // The estimated time of departure for the step. - google.protobuf.Timestamp departure_time = 4; - } - - // Localized descriptions of values for RouteTransitDetails. - message TransitDetailsLocalizedValues { - // Time in its formatted text representation with a corresponding time zone. - LocalizedTime arrival_time = 1; - - // Time in its formatted text representation with a corresponding time zone. - LocalizedTime departure_time = 2; - } - - // Information about the arrival and departure stops for the step. - TransitStopDetails stop_details = 1; - - // Text representations of properties of the `RouteLegStepTransitDetails`. - TransitDetailsLocalizedValues localized_values = 2; - - // Specifies the direction in which to travel on this line as marked on - // the vehicle or at the departure stop. The direction is often the terminus - // station. - string headsign = 3; - - // Specifies the expected time as a duration between departures from the same - // stop at this time. For example, with a headway seconds value of 600, you - // would expect a ten minute wait if you should miss your bus. - google.protobuf.Duration headway = 4; - - // Information about the transit line used in this step. - TransitLine transit_line = 5; - - // The number of stops from the departure to the arrival stop. This count - // includes the arrival stop, but excludes the departure stop. For example, if - // your route leaves from Stop A, passes through stops B and C, and arrives at - // stop D, stop_count will return 3. - int32 stop_count = 6; - - // The text that appears in schedules and sign boards to identify a transit - // trip to passengers. The text should uniquely identify a trip within a - // service day. For example, "538" is the `trip_short_text` of the Amtrak - // train that leaves San Jose, CA at 15:10 on weekdays to Sacramento, CA. - string trip_short_text = 7; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_label.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_label.proto deleted file mode 100644 index ba43b0b8c24..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_label.proto +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "RouteLabelProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Labels for the [Route][google.maps.routing.v2.Route] that are useful to -// identify specific properties of the route to compare against others. -enum RouteLabel { - // Default - not used. - ROUTE_LABEL_UNSPECIFIED = 0; - - // The default "best" route returned for the route computation. - DEFAULT_ROUTE = 1; - - // An alternative to the default "best" route. Routes like this will be - // returned when - // [compute_alternative_routes][google.maps.routing.v2.ComputeRoutesRequest.compute_alternative_routes] - // is specified. - DEFAULT_ROUTE_ALTERNATE = 2; - - // Fuel efficient route. Routes labeled with this value are determined to be - // optimized for Eco parameters such as fuel consumption. - FUEL_EFFICIENT = 3; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_modifiers.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_modifiers.proto deleted file mode 100644 index 33dcb7bd837..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_modifiers.proto +++ /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 -// -// 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.maps.routing.v2; - -import "google/maps/routing/v2/toll_passes.proto"; -import "google/maps/routing/v2/vehicle_info.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "RouteModifiersProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Encapsulates a set of optional conditions to satisfy when calculating the -// routes. -message RouteModifiers { - // When set to true, avoids toll roads where reasonable, giving preference to - // routes not containing toll roads. Applies only to the `DRIVE` and - // `TWO_WHEELER` [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. - bool avoid_tolls = 1; - - // When set to true, avoids highways where reasonable, giving preference to - // routes not containing highways. Applies only to the `DRIVE` and - // `TWO_WHEELER` [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. - bool avoid_highways = 2; - - // When set to true, avoids ferries where reasonable, giving preference to - // routes not containing ferries. Applies only to the `DRIVE` and`TWO_WHEELER` - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. - bool avoid_ferries = 3; - - // When set to true, avoids navigating indoors where reasonable, giving - // preference to routes not containing indoor navigation. Applies only to the - // `WALK` [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. - bool avoid_indoor = 4; - - // Specifies the vehicle information. - VehicleInfo vehicle_info = 5; - - // Encapsulates information about toll passes. - // If toll passes are provided, the API tries to return the pass price. If - // toll passes are not provided, the API treats the toll pass as unknown and - // tries to return the cash price. - // Applies only to the `DRIVE` and `TWO_WHEELER` - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. - repeated TollPass toll_passes = 6; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_travel_mode.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_travel_mode.proto deleted file mode 100644 index f6bd3e52a83..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/route_travel_mode.proto +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "RouteTravelModeProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// A set of values used to specify the mode of travel. -// NOTE: `WALK`, `BICYCLE`, and `TWO_WHEELER` routes are in beta and might -// sometimes be missing clear sidewalks, pedestrian paths, or bicycling paths. -// You must display this warning to the user for all walking, bicycling, and -// two-wheel routes that you display in your app. -enum RouteTravelMode { - // No travel mode specified. Defaults to `DRIVE`. - TRAVEL_MODE_UNSPECIFIED = 0; - - // Travel by passenger car. - DRIVE = 1; - - // Travel by bicycle. - BICYCLE = 2; - - // Travel by walking. - WALK = 3; - - // Two-wheeled, motorized vehicle. For example, motorcycle. Note that this - // differs from the `BICYCLE` travel mode which covers human-powered mode. - TWO_WHEELER = 4; - - // Travel by public transit routes, where available. - TRANSIT = 7; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routes_service.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routes_service.proto deleted file mode 100644 index 1ef6db73468..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routes_service.proto +++ /dev/null @@ -1,499 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/maps/routing/v2/fallback_info.proto"; -import "google/maps/routing/v2/geocoding_results.proto"; -import "google/maps/routing/v2/polyline.proto"; -import "google/maps/routing/v2/route.proto"; -import "google/maps/routing/v2/route_modifiers.proto"; -import "google/maps/routing/v2/route_travel_mode.proto"; -import "google/maps/routing/v2/routing_preference.proto"; -import "google/maps/routing/v2/traffic_model.proto"; -import "google/maps/routing/v2/transit_preferences.proto"; -import "google/maps/routing/v2/units.proto"; -import "google/maps/routing/v2/waypoint.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/localized_text.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "RoutesServiceProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// The Routes API. -service Routes { - option (google.api.default_host) = "routes.googleapis.com"; - - // Returns the primary route along with optional alternate routes, given a set - // of terminal and intermediate waypoints. - // - // **NOTE:** This method requires that you specify a response field mask in - // the input. You can provide the response field mask by using URL parameter - // `$fields` or `fields`, or by using an HTTP/gRPC header `X-Goog-FieldMask` - // (see the [available URL parameters and - // headers](https://cloud.google.com/apis/docs/system-parameters). The value - // is a comma separated list of field paths. See detailed documentation about - // [how to construct the field - // paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). - // - // For example, in this method: - // - // * Field mask of all available fields (for manual inspection): - // `X-Goog-FieldMask: *` - // * Field mask of Route-level duration, distance, and polyline (an example - // production setup): - // `X-Goog-FieldMask: - // routes.duration,routes.distanceMeters,routes.polyline.encodedPolyline` - // - // Google discourage the use of the wildcard (`*`) response field mask, or - // specifying the field mask at the top level (`routes`), because: - // - // * Selecting only the fields that you need helps our server save computation - // cycles, allowing us to return the result to you with a lower latency. - // * Selecting only the fields that you need - // in your production job ensures stable latency performance. We might add - // more response fields in the future, and those new fields might require - // extra computation time. If you select all fields, or if you select all - // fields at the top level, then you might experience performance degradation - // because any new field we add will be automatically included in the - // response. - // * Selecting only the fields that you need results in a smaller response - // size, and thus higher network throughput. - rpc ComputeRoutes(ComputeRoutesRequest) returns (ComputeRoutesResponse) { - option (google.api.http) = { - post: "/directions/v2:computeRoutes" - body: "*" - }; - } - - // Takes in a list of origins and destinations and returns a stream containing - // route information for each combination of origin and destination. - // - // **NOTE:** This method requires that you specify a response field mask in - // the input. You can provide the response field mask by using the URL - // parameter `$fields` or `fields`, or by using the HTTP/gRPC header - // `X-Goog-FieldMask` (see the [available URL parameters and - // headers](https://cloud.google.com/apis/docs/system-parameters). The value - // is a comma separated list of field paths. See this detailed documentation - // about [how to construct the field - // paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). - // - // For example, in this method: - // - // * Field mask of all available fields (for manual inspection): - // `X-Goog-FieldMask: *` - // * Field mask of route durations, distances, element status, condition, and - // element indices (an example production setup): - // `X-Goog-FieldMask: - // originIndex,destinationIndex,status,condition,distanceMeters,duration` - // - // It is critical that you include `status` in your field mask as otherwise - // all messages will appear to be OK. Google discourages the use of the - // wildcard (`*`) response field mask, because: - // - // * Selecting only the fields that you need helps our server save computation - // cycles, allowing us to return the result to you with a lower latency. - // * Selecting only the fields that you need in your production job ensures - // stable latency performance. We might add more response fields in the - // future, and those new fields might require extra computation time. If you - // select all fields, or if you select all fields at the top level, then you - // might experience performance degradation because any new field we add will - // be automatically included in the response. - // * Selecting only the fields that you need results in a smaller response - // size, and thus higher network throughput. - rpc ComputeRouteMatrix(ComputeRouteMatrixRequest) - returns (stream RouteMatrixElement) { - option (google.api.http) = { - post: "/distanceMatrix/v2:computeRouteMatrix" - body: "*" - }; - } -} - -// ComputeRoutes request message. -message ComputeRoutesRequest { - // A supported reference route on the ComputeRoutesRequest. - enum ReferenceRoute { - // Not used. Requests containing this value fail. - REFERENCE_ROUTE_UNSPECIFIED = 0; - - // Fuel efficient route. Routes labeled with this value are determined to be - // optimized for parameters such as fuel consumption. - FUEL_EFFICIENT = 1; - } - - // Extra computations to perform while completing the request. - enum ExtraComputation { - // Not used. Requests containing this value will fail. - EXTRA_COMPUTATION_UNSPECIFIED = 0; - - // Toll information for the route(s). - TOLLS = 1; - - // Estimated fuel consumption for the route(s). - FUEL_CONSUMPTION = 2; - - // Traffic aware polylines for the route(s). - TRAFFIC_ON_POLYLINE = 3; - - // [Navigation - // Instructions][google.maps.routing.v2.NavigationInstructions.instructions] - // presented as a formatted HTML text string. This content - // is meant to be read as-is. This content is for display only. - // Do not programmatically parse it. - HTML_FORMATTED_NAVIGATION_INSTRUCTIONS = 4; - } - - // Required. Origin waypoint. - Waypoint origin = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Destination waypoint. - Waypoint destination = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A set of waypoints along the route (excluding terminal points), - // for either stopping at or passing by. Up to 25 intermediate waypoints are - // supported. - repeated Waypoint intermediates = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the mode of transportation. - RouteTravelMode travel_mode = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies how to compute the route. The server - // attempts to use the selected routing preference to compute the route. If - // the routing preference results in an error or an extra long latency, then - // an error is returned. You can specify this option only when the - // `travel_mode` is `DRIVE` or `TWO_WHEELER`, otherwise the request fails. - RoutingPreference routing_preference = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies your preference for the quality of the polyline. - PolylineQuality polyline_quality = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the preferred encoding for the polyline. - PolylineEncoding polyline_encoding = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The departure time. If you don't set this value, then this value - // defaults to the time that you made the request. - // NOTE: You can only specify a `departure_time` in the past when - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to - // `TRANSIT`. - google.protobuf.Timestamp departure_time = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The arrival time. - // NOTE: Can only be set when - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to - // `TRANSIT`. You can specify either departure_time or arrival_time, but not - // both. - google.protobuf.Timestamp arrival_time = 19 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies whether to calculate alternate routes in addition to - // the route. No alternative routes are returned for requests that have - // intermediate waypoints. - bool compute_alternative_routes = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A set of conditions to satisfy that affect the way routes are - // calculated. - RouteModifiers route_modifiers = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more - // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See - // [Language Support](https://developers.google.com/maps/faq#languagesupport) - // for the list of supported languages. When you don't provide this value, the - // display language is inferred from the location of the route request. - string language_code = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The region code, specified as a ccTLD ("top-level domain") - // two-character value. For more information see - // https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains - string region_code = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the units of measure for the display fields. These - // fields include the `instruction` field in - // [NavigationInstruction][google.maps.routing.v2.NavigationInstruction]. The - // units of measure used for the route, leg, step distance, and duration are - // not affected by this value. If you don't provide this value, then the - // display units are inferred from the location of the first origin. - Units units = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, the service attempts to minimize the overall cost - // of the route by re-ordering the specified intermediate waypoints. The - // request fails if any of the intermediate waypoints is a `via` waypoint. Use - // `ComputeRoutesResponse.Routes.optimized_intermediate_waypoint_index` to - // find the new ordering. - // If `ComputeRoutesResponseroutes.optimized_intermediate_waypoint_index` is - // not requested in the `X-Goog-FieldMask` header, the request fails. - // If `optimize_waypoint_order` is set to false, - // `ComputeRoutesResponse.optimized_intermediate_waypoint_index` will be - // empty. - bool optimize_waypoint_order = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies what reference routes to calculate as part of the - // request in addition to the default route. A reference route is a route with - // a different route calculation objective than the default route. For example - // a `FUEL_EFFICIENT` reference route calculation takes into account various - // parameters that would generate an optimal fuel efficient route. - repeated ReferenceRoute requested_reference_routes = 14 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A list of extra computations which may be used to complete the - // request. Note: These extra computations may return extra fields on the - // response. These extra fields must also be specified in the field mask to be - // returned in the response. - repeated ExtraComputation extra_computations = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the assumptions to use when calculating time in - // traffic. This setting affects the value returned in the duration field in - // the [Route][google.maps.routing.v2.Route] and - // [RouteLeg][google.maps.routing.v2.RouteLeg] which contains the predicted - // time in traffic based on historical averages. - // `TrafficModel` is only available for requests that have set - // [RoutingPreference][google.maps.routing.v2.RoutingPreference] to - // `TRAFFIC_AWARE_OPTIMAL` and - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] to `DRIVE`. - // Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not - // specified. - TrafficModel traffic_model = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies preferences that influence the route returned for - // `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to - // `TRANSIT`. - TransitPreferences transit_preferences = 20 - [(google.api.field_behavior) = OPTIONAL]; -} - -// ComputeRoutes the response message. -message ComputeRoutesResponse { - // Contains an array of computed routes (up to three) when you specify - // compute_alternatives_routes, and contains just one route when you don't. - // When this array contains multiple entries, the first one is the most - // recommended route. If the array is empty, then it means no route could be - // found. - repeated Route routes = 1; - - // In some cases when the server is not able to compute the route results with - // all of the input preferences, it may fallback to using a different way of - // computation. When fallback mode is used, this field contains detailed info - // about the fallback response. Otherwise this field is unset. - FallbackInfo fallback_info = 2; - - // Contains geocoding response info for waypoints specified as addresses. - GeocodingResults geocoding_results = 3; -} - -// ComputeRouteMatrix request message -message ComputeRouteMatrixRequest { - // Extra computations to perform while completing the request. - enum ExtraComputation { - // Not used. Requests containing this value will fail. - EXTRA_COMPUTATION_UNSPECIFIED = 0; - - // Toll information for the matrix element(s). - TOLLS = 1; - } - - // Required. Array of origins, which determines the rows of the response - // matrix. Several size restrictions apply to the cardinality of origins and - // destinations: - // - // * The number of elements (origins × destinations) must be no greater than - // 625 in any case. - // * The number of elements (origins × destinations) must be no greater than - // 100 if routing_preference is set to `TRAFFIC_AWARE_OPTIMAL`. - // * The number of waypoints (origins + destinations) specified as `place_id` - // must be no greater than 50. - repeated RouteMatrixOrigin origins = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Array of destinations, which determines the columns of the - // response matrix. - repeated RouteMatrixDestination destinations = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. Specifies the mode of transportation. - RouteTravelMode travel_mode = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies how to compute the route. The server attempts to use - // the selected routing preference to compute the route. If the routing - // preference results in an error or an extra long latency, an error is - // returned. You can specify this option only when the `travel_mode` is - // `DRIVE` or `TWO_WHEELER`, otherwise the request fails. - RoutingPreference routing_preference = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The departure time. If you don't set this value, then this value - // defaults to the time that you made the request. - // NOTE: You can only specify a `departure_time` in the past when - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to - // `TRANSIT`. - google.protobuf.Timestamp departure_time = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The arrival time. - // NOTE: Can only be set when - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to - // `TRANSIT`. You can specify either departure_time or arrival_time, but not - // both. - google.protobuf.Timestamp arrival_time = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more - // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See - // [Language Support](https://developers.google.com/maps/faq#languagesupport) - // for the list of supported languages. When you don't provide this value, the - // display language is inferred from the location of the first origin. - string language_code = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The region code, specified as a ccTLD ("top-level domain") - // two-character value. For more information see - // https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains - string region_code = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A list of extra computations which may be used to complete the - // request. Note: These extra computations may return extra fields on the - // response. These extra fields must also be specified in the field mask to be - // returned in the response. - repeated ExtraComputation extra_computations = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the assumptions to use when calculating time in - // traffic. This setting affects the value returned in the duration field in - // the [RouteMatrixElement][google.maps.routing.v2.RouteMatrixElement] which - // contains the predicted time in traffic based on historical averages. - // [RoutingPreference][google.maps.routing.v2.RoutingPreference] to - // `TRAFFIC_AWARE_OPTIMAL` and - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] to `DRIVE`. - // Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not - // specified. - TrafficModel traffic_model = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies preferences that influence the route returned for - // `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] is set to - // `TRANSIT`. - TransitPreferences transit_preferences = 12 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A single origin for ComputeRouteMatrixRequest -message RouteMatrixOrigin { - // Required. Origin waypoint - Waypoint waypoint = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Modifiers for every route that takes this as the origin - RouteModifiers route_modifiers = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A single destination for ComputeRouteMatrixRequest -message RouteMatrixDestination { - // Required. Destination waypoint - Waypoint waypoint = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Contains route information computed for an origin/destination pair in the -// ComputeRouteMatrix API. This proto can be streamed to the client. -message RouteMatrixElement { - // Text representations of certain properties. - message LocalizedValues { - // Travel distance represented in text form. - google.type.LocalizedText distance = 1; - - // Duration represented in text form taking traffic conditions into - // consideration. Note: If traffic information was not requested, this value - // is the same value as static_duration. - google.type.LocalizedText duration = 2; - - // Duration represented in text form without taking traffic conditions into - // consideration. - google.type.LocalizedText static_duration = 3; - - // Transit fare represented in text form. - google.type.LocalizedText transit_fare = 4; - } - - // Zero-based index of the origin in the request. - optional int32 origin_index = 1; - - // Zero-based index of the destination in the request. - optional int32 destination_index = 2; - - // Error status code for this element. - google.rpc.Status status = 3; - - // Indicates whether the route was found or not. Independent of status. - RouteMatrixElementCondition condition = 9; - - // The travel distance of the route, in meters. - int32 distance_meters = 4; - - // The length of time needed to navigate the route. If you set the - // [routing_preference][google.maps.routing.v2.ComputeRouteMatrixRequest.routing_preference] - // to `TRAFFIC_UNAWARE`, then this value is the same as `static_duration`. If - // you set the `routing_preference` to either `TRAFFIC_AWARE` or - // `TRAFFIC_AWARE_OPTIMAL`, then this value is calculated taking traffic - // conditions into account. - google.protobuf.Duration duration = 5; - - // The duration of traveling through the route without taking traffic - // conditions into consideration. - google.protobuf.Duration static_duration = 6; - - // Additional information about the route. For example: restriction - // information and toll information - RouteTravelAdvisory travel_advisory = 7; - - // In some cases when the server is not able to compute the route with the - // given preferences for this particular origin/destination pair, it may - // fall back to using a different mode of computation. When fallback mode is - // used, this field contains detailed information about the fallback response. - // Otherwise this field is unset. - FallbackInfo fallback_info = 8; - - // Text representations of properties of the `RouteMatrixElement`. - LocalizedValues localized_values = 10; -} - -// The condition of the route being returned. -enum RouteMatrixElementCondition { - // Only used when the `status` of the element is not OK. - ROUTE_MATRIX_ELEMENT_CONDITION_UNSPECIFIED = 0; - - // A route was found, and the corresponding information was filled out for the - // element. - ROUTE_EXISTS = 1; - - // No route could be found. Fields containing route information, such as - // `distance_meters` or `duration`, will not be filled out in the element. - ROUTE_NOT_FOUND = 2; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routing_preference.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routing_preference.proto deleted file mode 100644 index eaca42dcd8f..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/routing_preference.proto +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "RoutingPreferenceProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// A set of values that specify factors to take into consideration when -// calculating the route. -enum RoutingPreference { - // No routing preference specified. Default to `TRAFFIC_UNAWARE`. - ROUTING_PREFERENCE_UNSPECIFIED = 0; - - // Computes routes without taking live traffic conditions into consideration. - // Suitable when traffic conditions don't matter or are not applicable. - // Using this value produces the lowest latency. - // Note: For [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] `DRIVE` - // and `TWO_WHEELER` choice of route and duration are based on road network - // and average time-independent traffic conditions. Results for a given - // request may vary over time due to changes in the road network, updated - // average traffic conditions, and the distributed nature of the service. - // Results may also vary between nearly-equivalent routes at any time or - // frequency. - TRAFFIC_UNAWARE = 1; - - // Calculates routes taking live traffic conditions into consideration. - // In contrast to `TRAFFIC_AWARE_OPTIMAL`, some optimizations are applied to - // significantly reduce latency. - TRAFFIC_AWARE = 2; - - // Calculates the routes taking live traffic conditions into consideration, - // without applying most performance optimizations. Using this value produces - // the highest latency. - TRAFFIC_AWARE_OPTIMAL = 3; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/speed_reading_interval.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/speed_reading_interval.proto deleted file mode 100644 index 2ca769c9e41..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/speed_reading_interval.proto +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "SpeedReadingIntervalProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Traffic density indicator on a contiguous segment of a polyline or path. -// Given a path with points P_0, P_1, ... , P_N (zero-based index), the -// SpeedReadingInterval defines an interval and describes its traffic using the -// following categories. -message SpeedReadingInterval { - // The classification of polyline speed based on traffic data. - enum Speed { - // Default value. This value is unused. - SPEED_UNSPECIFIED = 0; - - // Normal speed, no slowdown is detected. - NORMAL = 1; - - // Slowdown detected, but no traffic jam formed. - SLOW = 2; - - // Traffic jam detected. - TRAFFIC_JAM = 3; - } - - // The starting index of this interval in the polyline. - optional int32 start_polyline_point_index = 1; - - // The ending index of this interval in the polyline. - optional int32 end_polyline_point_index = 2; - - oneof speed_type { - // Traffic speed in this interval. - Speed speed = 3; - } -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_info.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_info.proto deleted file mode 100644 index 0788e5d454b..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_info.proto +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -import "google/type/money.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "TollInfoProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Encapsulates toll information on a [Route][google.maps.routing.v2.Route] or -// on a [RouteLeg][google.maps.routing.v2.RouteLeg]. -message TollInfo { - // The monetary amount of tolls for the corresponding - // [Route][google.maps.routing.v2.Route] or - // [RouteLeg][google.maps.routing.v2.RouteLeg]. This list contains a money - // amount for each currency that is expected to be charged by the toll - // stations. Typically this list will contain only one item for routes with - // tolls in one currency. For international trips, this list may contain - // multiple items to reflect tolls in different currencies. - repeated google.type.Money estimated_price = 1; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_passes.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_passes.proto deleted file mode 100644 index 72598e560a3..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/toll_passes.proto +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "TollPassesProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// List of toll passes around the world that we support. -enum TollPass { - // Not used. If this value is used, then the request fails. - TOLL_PASS_UNSPECIFIED = 0; - - // Sydney toll pass. See additional details at https://www.myetoll.com.au. - AU_ETOLL_TAG = 82; - - // Sydney toll pass. See additional details at https://www.tollpay.com.au. - AU_EWAY_TAG = 83; - - // Australia-wide toll pass. - // See additional details at https://www.linkt.com.au/. - AU_LINKT = 2; - - // Argentina toll pass. See additional details at https://telepase.com.ar - AR_TELEPASE = 3; - - // Brazil toll pass. See additional details at https://www.autoexpreso.com - BR_AUTO_EXPRESO = 81; - - // Brazil toll pass. See additional details at https://conectcar.com. - BR_CONECTCAR = 7; - - // Brazil toll pass. See additional details at https://movemais.com. - BR_MOVE_MAIS = 8; - - // Brazil toll pass. See additional details at https://pasorapido.gob.do/ - BR_PASSA_RAPIDO = 88; - - // Brazil toll pass. See additional details at https://www.semparar.com.br. - BR_SEM_PARAR = 9; - - // Brazil toll pass. See additional details at https://taggy.com.br. - BR_TAGGY = 10; - - // Brazil toll pass. See additional details at - // https://veloe.com.br/site/onde-usar. - BR_VELOE = 11; - - // Canada to United States border crossing. - CA_US_AKWASASNE_SEAWAY_CORPORATE_CARD = 84; - - // Canada to United States border crossing. - CA_US_AKWASASNE_SEAWAY_TRANSIT_CARD = 85; - - // Ontario, Canada to Michigan, United States border crossing. - CA_US_BLUE_WATER_EDGE_PASS = 18; - - // Ontario, Canada to Michigan, United States border crossing. - CA_US_CONNEXION = 19; - - // Canada to United States border crossing. - CA_US_NEXUS_CARD = 20; - - // Indonesia. - // E-card provided by multiple banks used to pay for tolls. All e-cards - // via banks are charged the same so only one enum value is needed. E.g. - // - Bank Mandiri https://www.bankmandiri.co.id/e-money - // - BCA https://www.bca.co.id/flazz - // - BNI https://www.bni.co.id/id-id/ebanking/tapcash - ID_E_TOLL = 16; - - // India. - IN_FASTAG = 78; - - // India, HP state plate exemption. - IN_LOCAL_HP_PLATE_EXEMPT = 79; - - // Mexico toll pass. - // https://iave.capufe.gob.mx/#/ - MX_IAVE = 90; - - // Mexico - // https://www.pase.com.mx - MX_PASE = 91; - - // Mexico - // https://operadoravial.com/quick-pass/ - MX_QUICKPASS = 93; - - // http://appsh.chihuahua.gob.mx/transparencia/?doc=/ingresos/TelepeajeFormato4.pdf - MX_SISTEMA_TELEPEAJE_CHIHUAHUA = 89; - - // Mexico - MX_TAG_IAVE = 12; - - // Mexico toll pass company. One of many operating in Mexico City. See - // additional details at https://www.televia.com.mx. - MX_TAG_TELEVIA = 13; - - // Mexico toll pass company. One of many operating in Mexico City. - // https://www.televia.com.mx - MX_TELEVIA = 92; - - // Mexico toll pass. See additional details at - // https://www.viapass.com.mx/viapass/web_home.aspx. - MX_VIAPASS = 14; - - // AL, USA. - US_AL_FREEDOM_PASS = 21; - - // AK, USA. - US_AK_ANTON_ANDERSON_TUNNEL_BOOK_OF_10_TICKETS = 22; - - // CA, USA. - US_CA_FASTRAK = 4; - - // Indicates driver has any FasTrak pass in addition to the DMV issued Clean - // Air Vehicle (CAV) sticker. - // https://www.bayareafastrak.org/en/guide/doINeedFlex.shtml - US_CA_FASTRAK_CAV_STICKER = 86; - - // CO, USA. - US_CO_EXPRESSTOLL = 23; - - // CO, USA. - US_CO_GO_PASS = 24; - - // DE, USA. - US_DE_EZPASSDE = 25; - - // FL, USA. - US_FL_BOB_SIKES_TOLL_BRIDGE_PASS = 65; - - // FL, USA. - US_FL_DUNES_COMMUNITY_DEVELOPMENT_DISTRICT_EXPRESSCARD = 66; - - // FL, USA. - US_FL_EPASS = 67; - - // FL, USA. - US_FL_GIBA_TOLL_PASS = 68; - - // FL, USA. - US_FL_LEEWAY = 69; - - // FL, USA. - US_FL_SUNPASS = 70; - - // FL, USA. - US_FL_SUNPASS_PRO = 71; - - // IL, USA. - US_IL_EZPASSIL = 73; - - // IL, USA. - US_IL_IPASS = 72; - - // IN, USA. - US_IN_EZPASSIN = 26; - - // KS, USA. - US_KS_BESTPASS_HORIZON = 27; - - // KS, USA. - US_KS_KTAG = 28; - - // KS, USA. - US_KS_NATIONALPASS = 29; - - // KS, USA. - US_KS_PREPASS_ELITEPASS = 30; - - // KY, USA. - US_KY_RIVERLINK = 31; - - // LA, USA. - US_LA_GEAUXPASS = 32; - - // LA, USA. - US_LA_TOLL_TAG = 33; - - // MA, USA. - US_MA_EZPASSMA = 6; - - // MD, USA. - US_MD_EZPASSMD = 34; - - // ME, USA. - US_ME_EZPASSME = 35; - - // MI, USA. - US_MI_AMBASSADOR_BRIDGE_PREMIER_COMMUTER_CARD = 36; - - // MI, USA. - US_MI_BCPASS = 94; - - // MI, USA. - US_MI_GROSSE_ILE_TOLL_BRIDGE_PASS_TAG = 37; - - // MI, USA. - // Deprecated as this pass type no longer exists. - US_MI_IQ_PROX_CARD = 38 [deprecated = true]; - - // MI, USA. - US_MI_IQ_TAG = 95; - - // MI, USA. - US_MI_MACKINAC_BRIDGE_MAC_PASS = 39; - - // MI, USA. - US_MI_NEXPRESS_TOLL = 40; - - // MN, USA. - US_MN_EZPASSMN = 41; - - // NC, USA. - US_NC_EZPASSNC = 42; - - // NC, USA. - US_NC_PEACH_PASS = 87; - - // NC, USA. - US_NC_QUICK_PASS = 43; - - // NH, USA. - US_NH_EZPASSNH = 80; - - // NJ, USA. - US_NJ_DOWNBEACH_EXPRESS_PASS = 75; - - // NJ, USA. - US_NJ_EZPASSNJ = 74; - - // NY, USA. - US_NY_EXPRESSPASS = 76; - - // NY, USA. - US_NY_EZPASSNY = 77; - - // OH, USA. - US_OH_EZPASSOH = 44; - - // PA, USA. - US_PA_EZPASSPA = 45; - - // RI, USA. - US_RI_EZPASSRI = 46; - - // SC, USA. - US_SC_PALPASS = 47; - - // TX, USA. - US_TX_AVI_TAG = 97; - - // TX, USA. - US_TX_BANCPASS = 48; - - // TX, USA. - US_TX_DEL_RIO_PASS = 49; - - // TX, USA. - US_TX_EFAST_PASS = 50; - - // TX, USA. - US_TX_EAGLE_PASS_EXPRESS_CARD = 51; - - // TX, USA. - US_TX_EPTOLL = 52; - - // TX, USA. - US_TX_EZ_CROSS = 53; - - // TX, USA. - US_TX_EZTAG = 54; - - // TX, USA. - US_TX_FUEGO_TAG = 96; - - // TX, USA. - US_TX_LAREDO_TRADE_TAG = 55; - - // TX, USA. - US_TX_PLUSPASS = 56; - - // TX, USA. - US_TX_TOLLTAG = 57; - - // TX, USA. - US_TX_TXTAG = 58; - - // TX, USA. - US_TX_XPRESS_CARD = 59; - - // UT, USA. - US_UT_ADAMS_AVE_PARKWAY_EXPRESSCARD = 60; - - // VA, USA. - US_VA_EZPASSVA = 61; - - // WA, USA. - US_WA_BREEZEBY = 17; - - // WA, USA. - US_WA_GOOD_TO_GO = 1; - - // WV, USA. - US_WV_EZPASSWV = 62; - - // WV, USA. - US_WV_MEMORIAL_BRIDGE_TICKETS = 63; - - // WV, USA. - US_WV_NEWELL_TOLL_BRIDGE_TICKET = 64; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/traffic_model.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/traffic_model.proto deleted file mode 100644 index 4326b4b12f7..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/traffic_model.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "TrafficModelProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Specifies the assumptions to use when calculating time in traffic. This -// setting affects the value returned in the `duration` field in the -// response, which contains the predicted time in traffic based on historical -// averages. -enum TrafficModel { - // Unused. If specified, will default to `BEST_GUESS`. - TRAFFIC_MODEL_UNSPECIFIED = 0; - - // Indicates that the returned `duration` should be the best - // estimate of travel time given what is known about both historical traffic - // conditions and live traffic. Live traffic becomes more important the closer - // the `departure_time` is to now. - BEST_GUESS = 1; - - // Indicates that the returned duration should be longer than the - // actual travel time on most days, though occasional days with particularly - // bad traffic conditions may exceed this value. - PESSIMISTIC = 2; - - // Indicates that the returned duration should be shorter than the actual - // travel time on most days, though occasional days with particularly good - // traffic conditions may be faster than this value. - OPTIMISTIC = 3; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit.proto deleted file mode 100644 index 5099a4ff131..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit.proto +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -import "google/maps/routing/v2/location.proto"; -import "google/type/localized_text.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "TransitProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// A transit agency that operates a transit line. -message TransitAgency { - // The name of this transit agency. - string name = 1; - - // The transit agency's locale-specific formatted phone number. - string phone_number = 2; - - // The transit agency's URI. - string uri = 3; -} - -// Contains information about the transit line used in this step. -message TransitLine { - // The transit agency (or agencies) that operates this transit line. - repeated TransitAgency agencies = 1; - - // The full name of this transit line, For example, "8 Avenue Local". - string name = 2; - - // the URI for this transit line as provided by the transit agency. - string uri = 3; - - // The color commonly used in signage for this line. Represented in - // hexadecimal. - string color = 4; - - // The URI for the icon associated with this line. - string icon_uri = 5; - - // The short name of this transit line. This name will normally be a line - // number, such as "M7" or "355". - string name_short = 6; - - // The color commonly used in text on signage for this line. Represented in - // hexadecimal. - string text_color = 7; - - // The type of vehicle that operates on this transit line. - TransitVehicle vehicle = 8; -} - -// Information about a transit stop. -message TransitStop { - // The name of the transit stop. - string name = 1; - - // The location of the stop expressed in latitude/longitude coordinates. - Location location = 2; -} - -// Information about a vehicle used in transit routes. -message TransitVehicle { - // The type of vehicles for transit routes. - enum TransitVehicleType { - // Unused. - TRANSIT_VEHICLE_TYPE_UNSPECIFIED = 0; - - // Bus. - BUS = 1; - - // A vehicle that operates on a cable, usually on the ground. Aerial cable - // cars may be of the type `GONDOLA_LIFT`. - CABLE_CAR = 2; - - // Commuter rail. - COMMUTER_TRAIN = 3; - - // Ferry. - FERRY = 4; - - // A vehicle that is pulled up a steep incline by a cable. A Funicular - // typically consists of two cars, with each car acting as a counterweight - // for the other. - FUNICULAR = 5; - - // An aerial cable car. - GONDOLA_LIFT = 6; - - // Heavy rail. - HEAVY_RAIL = 7; - - // High speed train. - HIGH_SPEED_TRAIN = 8; - - // Intercity bus. - INTERCITY_BUS = 9; - - // Long distance train. - LONG_DISTANCE_TRAIN = 10; - - // Light rail transit. - METRO_RAIL = 11; - - // Monorail. - MONORAIL = 12; - - // All other vehicles. - OTHER = 13; - - // Rail. - RAIL = 14; - - // Share taxi is a kind of bus with the ability to drop off and pick up - // passengers anywhere on its route. - SHARE_TAXI = 15; - - // Underground light rail. - SUBWAY = 16; - - // Above ground light rail. - TRAM = 17; - - // Trolleybus. - TROLLEYBUS = 18; - } - - // The name of this vehicle, capitalized. - google.type.LocalizedText name = 1; - - // The type of vehicle used. - TransitVehicleType type = 2; - - // The URI for an icon associated with this vehicle type. - string icon_uri = 3; - - // The URI for the icon associated with this vehicle type, based on the local - // transport signage. - string local_icon_uri = 4; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit_preferences.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit_preferences.proto deleted file mode 100644 index 987c062284e..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/transit_preferences.proto +++ /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 -// -// 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.maps.routing.v2; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "TransitPreferencesProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Preferences for `TRANSIT` based routes that influence the route that is -// returned. -message TransitPreferences { - // A set of values used to specify the mode of transit. - enum TransitTravelMode { - // No transit travel mode specified. - TRANSIT_TRAVEL_MODE_UNSPECIFIED = 0; - - // Travel by bus. - BUS = 1; - - // Travel by subway. - SUBWAY = 2; - - // Travel by train. - TRAIN = 3; - - // Travel by light rail or tram. - LIGHT_RAIL = 4; - - // Travel by rail. This is equivalent to a combination of `SUBWAY`, `TRAIN`, - // and `LIGHT_RAIL`. - RAIL = 5; - } - - // Specifies routing preferences for transit routes. - enum TransitRoutingPreference { - // No preference specified. - TRANSIT_ROUTING_PREFERENCE_UNSPECIFIED = 0; - - // Indicates that the calculated route should prefer limited amounts of - // walking. - LESS_WALKING = 1; - - // Indicates that the calculated route should prefer a limited number of - // transfers. - FEWER_TRANSFERS = 2; - } - - // A set of travel modes to use when getting a `TRANSIT` route. Defaults to - // all supported modes of travel. - repeated TransitTravelMode allowed_travel_modes = 1; - - // A routing preference that, when specified, influences the `TRANSIT` route - // returned. - TransitRoutingPreference routing_preference = 2; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/units.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/units.proto deleted file mode 100644 index d94df6c3ea0..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/units.proto +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "UnitsProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// A set of values that specify the unit of measure used in the display. -enum Units { - // Units of measure not specified. Defaults to the unit of measure inferred - // from the request. - UNITS_UNSPECIFIED = 0; - - // Metric units of measure. - METRIC = 1; - - // Imperial (English) units of measure. - IMPERIAL = 2; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_emission_type.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_emission_type.proto deleted file mode 100644 index 5109d4d30aa..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_emission_type.proto +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "VehicleEmissionTypeProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// A set of values describing the vehicle's emission type. -// Applies only to the `DRIVE` -// [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. -enum VehicleEmissionType { - // No emission type specified. Default to `GASOLINE`. - VEHICLE_EMISSION_TYPE_UNSPECIFIED = 0; - - // Gasoline/petrol fueled vehicle. - GASOLINE = 1; - - // Electricity powered vehicle. - ELECTRIC = 2; - - // Hybrid fuel (such as gasoline + electric) vehicle. - HYBRID = 3; - - // Diesel fueled vehicle. - DIESEL = 4; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_info.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_info.proto deleted file mode 100644 index 574d15f5de8..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/vehicle_info.proto +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.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.maps.routing.v2; - -import "google/maps/routing/v2/vehicle_emission_type.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "VehicleInfoProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Contains the vehicle information, such as the vehicle emission type. -message VehicleInfo { - // Describes the vehicle's emission type. - // Applies only to the `DRIVE` - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. - VehicleEmissionType emission_type = 2; -} diff --git a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/waypoint.proto b/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/waypoint.proto deleted file mode 100644 index 8a02d5e7d04..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/protos/google/maps/routing/v2/waypoint.proto +++ /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 -// -// 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.maps.routing.v2; - -import "google/maps/routing/v2/location.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Maps.Routing.V2"; -option go_package = "cloud.google.com/go/maps/routing/apiv2/routingpb;routingpb"; -option java_multiple_files = true; -option java_outer_classname = "WaypointProto"; -option java_package = "com.google.maps.routing.v2"; -option objc_class_prefix = "GMRV2"; -option php_namespace = "Google\\Maps\\Routing\\V2"; -option ruby_package = "Google::Maps::Routing::V2"; - -// Encapsulates a waypoint. Waypoints mark both the beginning and end of a -// route, and include intermediate stops along the route. -message Waypoint { - // Different ways to represent a location. - oneof location_type { - // A point specified using geographic coordinates, including an optional - // heading. - Location location = 1; - - // The POI Place ID associated with the waypoint. - string place_id = 2; - - // Human readable address or a plus code. - // See https://plus.codes for details. - string address = 7; - } - - // Marks this waypoint as a milestone rather a stopping point. For - // each non-via waypoint in the request, the response appends an entry to the - // [legs][google.maps.routing.v2.Route.legs] - // array to provide the details for stopovers on that leg of the trip. Set - // this value to true when you want the route to pass through this waypoint - // without stopping over. Via waypoints don't cause an entry to be added to - // the `legs` array, but they do route the journey through the waypoint. You - // can only set this value on waypoints that are intermediates. The request - // fails if you set this field on terminal waypoints. If - // `ComputeRoutesRequest.optimize_waypoint_order` is set to true then this - // field cannot be set to true; otherwise, the request fails. - bool via = 3; - - // Indicates that the waypoint is meant for vehicles to stop at, where the - // intention is to either pickup or drop-off. When you set this value, the - // calculated route won't include non-`via` waypoints on roads that are - // unsuitable for pickup and drop-off. This option works only for `DRIVE` and - // `TWO_WHEELER` travel modes, and when the `location_type` is - // [Location][google.maps.routing.v2.Location]. - bool vehicle_stopover = 4; - - // Indicates that the location of this waypoint is meant to have a preference - // for the vehicle to stop at a particular side of road. When you set this - // value, the route will pass through the location so that the vehicle can - // stop at the side of road that the location is biased towards from the - // center of the road. This option works only for 'DRIVE' and 'TWO_WHEELER' - // [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. - bool side_of_road = 5; -} diff --git a/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_route_matrix.js b/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_route_matrix.js deleted file mode 100644 index 4615a86aa37..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_route_matrix.js +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(origins, destinations) { - // [START routes_v2_generated_Routes_ComputeRouteMatrix_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Array of origins, which determines the rows of the response - * matrix. Several size restrictions apply to the cardinality of origins and - * destinations: - * * The number of elements (origins × destinations) must be no greater than - * 625 in any case. - * * The number of elements (origins × destinations) must be no greater than - * 100 if routing_preference is set to `TRAFFIC_AWARE_OPTIMAL`. - * * The number of waypoints (origins + destinations) specified as `place_id` - * must be no greater than 50. - */ - // const origins = [1,2,3,4] - /** - * Required. Array of destinations, which determines the columns of the - * response matrix. - */ - // const destinations = [1,2,3,4] - /** - * Optional. Specifies the mode of transportation. - */ - // const travelMode = {} - /** - * Optional. Specifies how to compute the route. The server attempts to use - * the selected routing preference to compute the route. If the routing - * preference results in an error or an extra long latency, an error is - * returned. You can specify this option only when the `travel_mode` is - * `DRIVE` or `TWO_WHEELER`, otherwise the request fails. - */ - // const routingPreference = {} - /** - * Optional. The departure time. If you don't set this value, then this value - * defaults to the time that you made the request. - * NOTE: You can only specify a `departure_time` in the past when - * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to - * `TRANSIT`. - */ - // const departureTime = {} - /** - * Optional. The arrival time. - * NOTE: Can only be set when - * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to - * `TRANSIT`. You can specify either departure_time or arrival_time, but not - * both. - */ - // const arrivalTime = {} - /** - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See - * Language Support (https://developers.google.com/maps/faq#languagesupport) - * for the list of supported languages. When you don't provide this value, the - * display language is inferred from the location of the first origin. - */ - // const languageCode = 'abc123' - /** - * Optional. The region code, specified as a ccTLD ("top-level domain") - * two-character value. For more information see - * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains - */ - // const regionCode = 'abc123' - /** - * Optional. A list of extra computations which may be used to complete the - * request. Note: These extra computations may return extra fields on the - * response. These extra fields must also be specified in the field mask to be - * returned in the response. - */ - // const extraComputations = [1,2,3,4] - /** - * Optional. Specifies the assumptions to use when calculating time in - * traffic. This setting affects the value returned in the duration field in - * the RouteMatrixElement google.maps.routing.v2.RouteMatrixElement which - * contains the predicted time in traffic based on historical averages. - * RoutingPreference google.maps.routing.v2.RoutingPreference to - * `TRAFFIC_AWARE_OPTIMAL` and - * RouteTravelMode google.maps.routing.v2.RouteTravelMode to `DRIVE`. - * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not - * specified. - */ - // const trafficModel = {} - /** - * Optional. Specifies preferences that influence the route returned for - * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when - * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to - * `TRANSIT`. - */ - // const transitPreferences = {} - - // Imports the Routing library - const {RoutesClient} = require('@googlemaps/routing').v2; - - // Instantiates a client - const routingClient = new RoutesClient(); - - async function callComputeRouteMatrix() { - // Construct request - const request = { - origins, - destinations, - }; - - // Run request - const stream = await routingClient.computeRouteMatrix(request); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - } - - callComputeRouteMatrix(); - // [END routes_v2_generated_Routes_ComputeRouteMatrix_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_routes.js b/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_routes.js deleted file mode 100644 index b4cd159c894..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/routes.compute_routes.js +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(origin, destination) { - // [START routes_v2_generated_Routes_ComputeRoutes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Origin waypoint. - */ - // const origin = {} - /** - * Required. Destination waypoint. - */ - // const destination = {} - /** - * Optional. A set of waypoints along the route (excluding terminal points), - * for either stopping at or passing by. Up to 25 intermediate waypoints are - * supported. - */ - // const intermediates = [1,2,3,4] - /** - * Optional. Specifies the mode of transportation. - */ - // const travelMode = {} - /** - * Optional. Specifies how to compute the route. The server - * attempts to use the selected routing preference to compute the route. If - * the routing preference results in an error or an extra long latency, then - * an error is returned. You can specify this option only when the - * `travel_mode` is `DRIVE` or `TWO_WHEELER`, otherwise the request fails. - */ - // const routingPreference = {} - /** - * Optional. Specifies your preference for the quality of the polyline. - */ - // const polylineQuality = {} - /** - * Optional. Specifies the preferred encoding for the polyline. - */ - // const polylineEncoding = {} - /** - * Optional. The departure time. If you don't set this value, then this value - * defaults to the time that you made the request. - * NOTE: You can only specify a `departure_time` in the past when - * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to - * `TRANSIT`. - */ - // const departureTime = {} - /** - * Optional. The arrival time. - * NOTE: Can only be set when - * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to - * `TRANSIT`. You can specify either departure_time or arrival_time, but not - * both. - */ - // const arrivalTime = {} - /** - * Optional. Specifies whether to calculate alternate routes in addition to - * the route. No alternative routes are returned for requests that have - * intermediate waypoints. - */ - // const computeAlternativeRoutes = true - /** - * Optional. A set of conditions to satisfy that affect the way routes are - * calculated. - */ - // const routeModifiers = {} - /** - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See - * Language Support (https://developers.google.com/maps/faq#languagesupport) - * for the list of supported languages. When you don't provide this value, the - * display language is inferred from the location of the route request. - */ - // const languageCode = 'abc123' - /** - * Optional. The region code, specified as a ccTLD ("top-level domain") - * two-character value. For more information see - * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains - */ - // const regionCode = 'abc123' - /** - * Optional. Specifies the units of measure for the display fields. These - * fields include the `instruction` field in - * NavigationInstruction google.maps.routing.v2.NavigationInstruction. The - * units of measure used for the route, leg, step distance, and duration are - * not affected by this value. If you don't provide this value, then the - * display units are inferred from the location of the first origin. - */ - // const units = {} - /** - * Optional. If set to true, the service attempts to minimize the overall cost - * of the route by re-ordering the specified intermediate waypoints. The - * request fails if any of the intermediate waypoints is a `via` waypoint. Use - * `ComputeRoutesResponse.Routes.optimized_intermediate_waypoint_index` to - * find the new ordering. - * If `ComputeRoutesResponseroutes.optimized_intermediate_waypoint_index` is - * not requested in the `X-Goog-FieldMask` header, the request fails. - * If `optimize_waypoint_order` is set to false, - * `ComputeRoutesResponse.optimized_intermediate_waypoint_index` will be - * empty. - */ - // const optimizeWaypointOrder = true - /** - * Optional. Specifies what reference routes to calculate as part of the - * request in addition to the default route. A reference route is a route with - * a different route calculation objective than the default route. For example - * a `FUEL_EFFICIENT` reference route calculation takes into account various - * parameters that would generate an optimal fuel efficient route. - */ - // const requestedReferenceRoutes = [1,2,3,4] - /** - * Optional. A list of extra computations which may be used to complete the - * request. Note: These extra computations may return extra fields on the - * response. These extra fields must also be specified in the field mask to be - * returned in the response. - */ - // const extraComputations = [1,2,3,4] - /** - * Optional. Specifies the assumptions to use when calculating time in - * traffic. This setting affects the value returned in the duration field in - * the Route google.maps.routing.v2.Route and - * RouteLeg google.maps.routing.v2.RouteLeg which contains the predicted - * time in traffic based on historical averages. - * `TrafficModel` is only available for requests that have set - * RoutingPreference google.maps.routing.v2.RoutingPreference to - * `TRAFFIC_AWARE_OPTIMAL` and - * RouteTravelMode google.maps.routing.v2.RouteTravelMode to `DRIVE`. - * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not - * specified. - */ - // const trafficModel = {} - /** - * Optional. Specifies preferences that influence the route returned for - * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when - * RouteTravelMode google.maps.routing.v2.RouteTravelMode is set to - * `TRANSIT`. - */ - // const transitPreferences = {} - - // Imports the Routing library - const {RoutesClient} = require('@googlemaps/routing').v2; - - // Instantiates a client - const routingClient = new RoutesClient(); - - async function callComputeRoutes() { - // Construct request - const request = { - origin, - destination, - }; - - // Run request - const response = await routingClient.computeRoutes(request); - console.log(response); - } - - callComputeRoutes(); - // [END routes_v2_generated_Routes_ComputeRoutes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/snippet_metadata_google.maps.routing.v2.json b/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/snippet_metadata_google.maps.routing.v2.json deleted file mode 100644 index c31ccda31ae..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/samples/generated/v2/snippet_metadata_google.maps.routing.v2.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-routing", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.maps.routing.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "routes_v2_generated_Routes_ComputeRoutes_async", - "title": "Routes computeRoutes Sample", - "origin": "API_DEFINITION", - "description": " Returns the primary route along with optional alternate routes, given a set of terminal and intermediate waypoints. **NOTE:** This method requires that you specify a response field mask in the input. You can provide the response field mask by using URL parameter `$fields` or `fields`, or by using an HTTP/gRPC header `X-Goog-FieldMask` (see the [available URL parameters and headers](https://cloud.google.com/apis/docs/system-parameters). The value is a comma separated list of field paths. See detailed documentation about [how to construct the field paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). For example, in this method: * Field mask of all available fields (for manual inspection): `X-Goog-FieldMask: *` * Field mask of Route-level duration, distance, and polyline (an example production setup): `X-Goog-FieldMask: routes.duration,routes.distanceMeters,routes.polyline.encodedPolyline` Google discourage the use of the wildcard (`*`) response field mask, or specifying the field mask at the top level (`routes`), because: * Selecting only the fields that you need helps our server save computation cycles, allowing us to return the result to you with a lower latency. * Selecting only the fields that you need in your production job ensures stable latency performance. We might add more response fields in the future, and those new fields might require extra computation time. If you select all fields, or if you select all fields at the top level, then you might experience performance degradation because any new field we add will be automatically included in the response. * Selecting only the fields that you need results in a smaller response size, and thus higher network throughput.", - "canonical": true, - "file": "routes.compute_routes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 184, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ComputeRoutes", - "fullName": "google.maps.routing.v2.Routes.ComputeRoutes", - "async": true, - "parameters": [ - { - "name": "origin", - "type": ".google.maps.routing.v2.Waypoint" - }, - { - "name": "destination", - "type": ".google.maps.routing.v2.Waypoint" - }, - { - "name": "intermediates", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "travel_mode", - "type": ".google.maps.routing.v2.RouteTravelMode" - }, - { - "name": "routing_preference", - "type": ".google.maps.routing.v2.RoutingPreference" - }, - { - "name": "polyline_quality", - "type": ".google.maps.routing.v2.PolylineQuality" - }, - { - "name": "polyline_encoding", - "type": ".google.maps.routing.v2.PolylineEncoding" - }, - { - "name": "departure_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "arrival_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compute_alternative_routes", - "type": "TYPE_BOOL" - }, - { - "name": "route_modifiers", - "type": ".google.maps.routing.v2.RouteModifiers" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "region_code", - "type": "TYPE_STRING" - }, - { - "name": "units", - "type": ".google.maps.routing.v2.Units" - }, - { - "name": "optimize_waypoint_order", - "type": "TYPE_BOOL" - }, - { - "name": "requested_reference_routes", - "type": "TYPE_ENUM[]" - }, - { - "name": "extra_computations", - "type": "TYPE_ENUM[]" - }, - { - "name": "traffic_model", - "type": ".google.maps.routing.v2.TrafficModel" - }, - { - "name": "transit_preferences", - "type": ".google.maps.routing.v2.TransitPreferences" - } - ], - "resultType": ".google.maps.routing.v2.ComputeRoutesResponse", - "client": { - "shortName": "RoutesClient", - "fullName": "google.maps.routing.v2.RoutesClient" - }, - "method": { - "shortName": "ComputeRoutes", - "fullName": "google.maps.routing.v2.Routes.ComputeRoutes", - "service": { - "shortName": "Routes", - "fullName": "google.maps.routing.v2.Routes" - } - } - } - }, - { - "regionTag": "routes_v2_generated_Routes_ComputeRouteMatrix_async", - "title": "Routes computeRouteMatrix Sample", - "origin": "API_DEFINITION", - "description": " Takes in a list of origins and destinations and returns a stream containing route information for each combination of origin and destination. **NOTE:** This method requires that you specify a response field mask in the input. You can provide the response field mask by using the URL parameter `$fields` or `fields`, or by using the HTTP/gRPC header `X-Goog-FieldMask` (see the [available URL parameters and headers](https://cloud.google.com/apis/docs/system-parameters). The value is a comma separated list of field paths. See this detailed documentation about [how to construct the field paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). For example, in this method: * Field mask of all available fields (for manual inspection): `X-Goog-FieldMask: *` * Field mask of route durations, distances, element status, condition, and element indices (an example production setup): `X-Goog-FieldMask: originIndex,destinationIndex,status,condition,distanceMeters,duration` It is critical that you include `status` in your field mask as otherwise all messages will appear to be OK. Google discourages the use of the wildcard (`*`) response field mask, because: * Selecting only the fields that you need helps our server save computation cycles, allowing us to return the result to you with a lower latency. * Selecting only the fields that you need in your production job ensures stable latency performance. We might add more response fields in the future, and those new fields might require extra computation time. If you select all fields, or if you select all fields at the top level, then you might experience performance degradation because any new field we add will be automatically included in the response. * Selecting only the fields that you need results in a smaller response size, and thus higher network throughput.", - "canonical": true, - "file": "routes.compute_route_matrix.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 138, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ComputeRouteMatrix", - "fullName": "google.maps.routing.v2.Routes.ComputeRouteMatrix", - "async": true, - "parameters": [ - { - "name": "origins", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "destinations", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "travel_mode", - "type": ".google.maps.routing.v2.RouteTravelMode" - }, - { - "name": "routing_preference", - "type": ".google.maps.routing.v2.RoutingPreference" - }, - { - "name": "departure_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "arrival_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "region_code", - "type": "TYPE_STRING" - }, - { - "name": "extra_computations", - "type": "TYPE_ENUM[]" - }, - { - "name": "traffic_model", - "type": ".google.maps.routing.v2.TrafficModel" - }, - { - "name": "transit_preferences", - "type": ".google.maps.routing.v2.TransitPreferences" - } - ], - "resultType": ".google.maps.routing.v2.RouteMatrixElement", - "client": { - "shortName": "RoutesClient", - "fullName": "google.maps.routing.v2.RoutesClient" - }, - "method": { - "shortName": "ComputeRouteMatrix", - "fullName": "google.maps.routing.v2.Routes.ComputeRouteMatrix", - "service": { - "shortName": "Routes", - "fullName": "google.maps.routing.v2.Routes" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-maps-routing/v2/src/index.ts b/owl-bot-staging/google-maps-routing/v2/src/index.ts deleted file mode 100644 index fd7f1a8a3c8..00000000000 --- a/owl-bot-staging/google-maps-routing/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 RoutesClient = v2.RoutesClient; -type RoutesClient = v2.RoutesClient; -export {v2, RoutesClient}; -export default {v2, RoutesClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-maps-routing/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-maps-routing/v2/src/v2/gapic_metadata.json deleted file mode 100644 index 46b4f4a8b5a..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.maps.routing.v2", - "libraryPackage": "@googlemaps/routing", - "services": { - "Routes": { - "clients": { - "grpc": { - "libraryClient": "RoutesClient", - "rpcs": { - "ComputeRoutes": { - "methods": [ - "computeRoutes" - ] - }, - "ComputeRouteMatrix": { - "methods": [ - "computeRouteMatrix" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "RoutesClient", - "rpcs": { - "ComputeRoutes": { - "methods": [ - "computeRoutes" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-maps-routing/v2/src/v2/index.ts b/owl-bot-staging/google-maps-routing/v2/src/v2/index.ts deleted file mode 100644 index 860222c098b..00000000000 --- a/owl-bot-staging/google-maps-routing/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 {RoutesClient} from './routes_client'; diff --git a/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client.ts b/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client.ts deleted file mode 100644 index 13493866202..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client.ts +++ /dev/null @@ -1,636 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/v2/routes_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './routes_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Routes API. - * @class - * @memberof v2 - */ -export class RoutesClient { - 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}; - routesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of RoutesClient. - * - * @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 RoutesClient({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 RoutesClient; - 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 = { - computeRouteMatrix: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.maps.routing.v2.Routes', 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.routesStub) { - return this.routesStub; - } - - // Put together the "service stub" for - // google.maps.routing.v2.Routes. - this.routesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.maps.routing.v2.Routes') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.maps.routing.v2.Routes, - 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 routesStubMethods = - ['computeRoutes', 'computeRouteMatrix']; - for (const methodName of routesStubMethods) { - const callPromise = this.routesStub.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.routesStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'routes.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 'routes.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 []; - } - - 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 the primary route along with optional alternate routes, given a set - * of terminal and intermediate waypoints. - * - * **NOTE:** This method requires that you specify a response field mask in - * the input. You can provide the response field mask by using URL parameter - * `$fields` or `fields`, or by using an HTTP/gRPC header `X-Goog-FieldMask` - * (see the [available URL parameters and - * headers](https://cloud.google.com/apis/docs/system-parameters). The value - * is a comma separated list of field paths. See detailed documentation about - * [how to construct the field - * paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). - * - * For example, in this method: - * - * * Field mask of all available fields (for manual inspection): - * `X-Goog-FieldMask: *` - * * Field mask of Route-level duration, distance, and polyline (an example - * production setup): - * `X-Goog-FieldMask: - * routes.duration,routes.distanceMeters,routes.polyline.encodedPolyline` - * - * Google discourage the use of the wildcard (`*`) response field mask, or - * specifying the field mask at the top level (`routes`), because: - * - * * Selecting only the fields that you need helps our server save computation - * cycles, allowing us to return the result to you with a lower latency. - * * Selecting only the fields that you need - * in your production job ensures stable latency performance. We might add - * more response fields in the future, and those new fields might require - * extra computation time. If you select all fields, or if you select all - * fields at the top level, then you might experience performance degradation - * because any new field we add will be automatically included in the - * response. - * * Selecting only the fields that you need results in a smaller response - * size, and thus higher network throughput. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.maps.routing.v2.Waypoint} request.origin - * Required. Origin waypoint. - * @param {google.maps.routing.v2.Waypoint} request.destination - * Required. Destination waypoint. - * @param {number[]} [request.intermediates] - * Optional. A set of waypoints along the route (excluding terminal points), - * for either stopping at or passing by. Up to 25 intermediate waypoints are - * supported. - * @param {google.maps.routing.v2.RouteTravelMode} [request.travelMode] - * Optional. Specifies the mode of transportation. - * @param {google.maps.routing.v2.RoutingPreference} [request.routingPreference] - * Optional. Specifies how to compute the route. The server - * attempts to use the selected routing preference to compute the route. If - * the routing preference results in an error or an extra long latency, then - * an error is returned. You can specify this option only when the - * `travel_mode` is `DRIVE` or `TWO_WHEELER`, otherwise the request fails. - * @param {google.maps.routing.v2.PolylineQuality} [request.polylineQuality] - * Optional. Specifies your preference for the quality of the polyline. - * @param {google.maps.routing.v2.PolylineEncoding} [request.polylineEncoding] - * Optional. Specifies the preferred encoding for the polyline. - * @param {google.protobuf.Timestamp} [request.departureTime] - * Optional. The departure time. If you don't set this value, then this value - * defaults to the time that you made the request. - * NOTE: You can only specify a `departure_time` in the past when - * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to - * `TRANSIT`. - * @param {google.protobuf.Timestamp} [request.arrivalTime] - * Optional. The arrival time. - * NOTE: Can only be set when - * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to - * `TRANSIT`. You can specify either departure_time or arrival_time, but not - * both. - * @param {boolean} [request.computeAlternativeRoutes] - * Optional. Specifies whether to calculate alternate routes in addition to - * the route. No alternative routes are returned for requests that have - * intermediate waypoints. - * @param {google.maps.routing.v2.RouteModifiers} [request.routeModifiers] - * Optional. A set of conditions to satisfy that affect the way routes are - * calculated. - * @param {string} [request.languageCode] - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See - * [Language Support](https://developers.google.com/maps/faq#languagesupport) - * for the list of supported languages. When you don't provide this value, the - * display language is inferred from the location of the route request. - * @param {string} [request.regionCode] - * Optional. The region code, specified as a ccTLD ("top-level domain") - * two-character value. For more information see - * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains - * @param {google.maps.routing.v2.Units} [request.units] - * Optional. Specifies the units of measure for the display fields. These - * fields include the `instruction` field in - * {@link protos.google.maps.routing.v2.NavigationInstruction|NavigationInstruction}. The - * units of measure used for the route, leg, step distance, and duration are - * not affected by this value. If you don't provide this value, then the - * display units are inferred from the location of the first origin. - * @param {boolean} [request.optimizeWaypointOrder] - * Optional. If set to true, the service attempts to minimize the overall cost - * of the route by re-ordering the specified intermediate waypoints. The - * request fails if any of the intermediate waypoints is a `via` waypoint. Use - * `ComputeRoutesResponse.Routes.optimized_intermediate_waypoint_index` to - * find the new ordering. - * If `ComputeRoutesResponseroutes.optimized_intermediate_waypoint_index` is - * not requested in the `X-Goog-FieldMask` header, the request fails. - * If `optimize_waypoint_order` is set to false, - * `ComputeRoutesResponse.optimized_intermediate_waypoint_index` will be - * empty. - * @param {number[]} [request.requestedReferenceRoutes] - * Optional. Specifies what reference routes to calculate as part of the - * request in addition to the default route. A reference route is a route with - * a different route calculation objective than the default route. For example - * a `FUEL_EFFICIENT` reference route calculation takes into account various - * parameters that would generate an optimal fuel efficient route. - * @param {number[]} [request.extraComputations] - * Optional. A list of extra computations which may be used to complete the - * request. Note: These extra computations may return extra fields on the - * response. These extra fields must also be specified in the field mask to be - * returned in the response. - * @param {google.maps.routing.v2.TrafficModel} [request.trafficModel] - * Optional. Specifies the assumptions to use when calculating time in - * traffic. This setting affects the value returned in the duration field in - * the {@link protos.google.maps.routing.v2.Route|Route} and - * {@link protos.google.maps.routing.v2.RouteLeg|RouteLeg} which contains the predicted - * time in traffic based on historical averages. - * `TrafficModel` is only available for requests that have set - * {@link protos.google.maps.routing.v2.RoutingPreference|RoutingPreference} to - * `TRAFFIC_AWARE_OPTIMAL` and - * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} to `DRIVE`. - * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not - * specified. - * @param {google.maps.routing.v2.TransitPreferences} [request.transitPreferences] - * Optional. Specifies preferences that influence the route returned for - * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when - * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to - * `TRANSIT`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.maps.routing.v2.ComputeRoutesResponse|ComputeRoutesResponse}. - * Please see the {@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/routes.compute_routes.js - * region_tag:routes_v2_generated_Routes_ComputeRoutes_async - */ - computeRoutes( - request?: protos.google.maps.routing.v2.IComputeRoutesRequest, - options?: CallOptions): - Promise<[ - protos.google.maps.routing.v2.IComputeRoutesResponse, - protos.google.maps.routing.v2.IComputeRoutesRequest|undefined, {}|undefined - ]>; - computeRoutes( - request: protos.google.maps.routing.v2.IComputeRoutesRequest, - options: CallOptions, - callback: Callback< - protos.google.maps.routing.v2.IComputeRoutesResponse, - protos.google.maps.routing.v2.IComputeRoutesRequest|null|undefined, - {}|null|undefined>): void; - computeRoutes( - request: protos.google.maps.routing.v2.IComputeRoutesRequest, - callback: Callback< - protos.google.maps.routing.v2.IComputeRoutesResponse, - protos.google.maps.routing.v2.IComputeRoutesRequest|null|undefined, - {}|null|undefined>): void; - computeRoutes( - request?: protos.google.maps.routing.v2.IComputeRoutesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.maps.routing.v2.IComputeRoutesResponse, - protos.google.maps.routing.v2.IComputeRoutesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.maps.routing.v2.IComputeRoutesResponse, - protos.google.maps.routing.v2.IComputeRoutesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.maps.routing.v2.IComputeRoutesResponse, - protos.google.maps.routing.v2.IComputeRoutesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.computeRoutes(request, options, callback); - } - -/** - * Takes in a list of origins and destinations and returns a stream containing - * route information for each combination of origin and destination. - * - * **NOTE:** This method requires that you specify a response field mask in - * the input. You can provide the response field mask by using the URL - * parameter `$fields` or `fields`, or by using the HTTP/gRPC header - * `X-Goog-FieldMask` (see the [available URL parameters and - * headers](https://cloud.google.com/apis/docs/system-parameters). The value - * is a comma separated list of field paths. See this detailed documentation - * about [how to construct the field - * paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). - * - * For example, in this method: - * - * * Field mask of all available fields (for manual inspection): - * `X-Goog-FieldMask: *` - * * Field mask of route durations, distances, element status, condition, and - * element indices (an example production setup): - * `X-Goog-FieldMask: - * originIndex,destinationIndex,status,condition,distanceMeters,duration` - * - * It is critical that you include `status` in your field mask as otherwise - * all messages will appear to be OK. Google discourages the use of the - * wildcard (`*`) response field mask, because: - * - * * Selecting only the fields that you need helps our server save computation - * cycles, allowing us to return the result to you with a lower latency. - * * Selecting only the fields that you need in your production job ensures - * stable latency performance. We might add more response fields in the - * future, and those new fields might require extra computation time. If you - * select all fields, or if you select all fields at the top level, then you - * might experience performance degradation because any new field we add will - * be automatically included in the response. - * * Selecting only the fields that you need results in a smaller response - * size, and thus higher network throughput. - * - * @param {Object} request - * The request object that will be sent. - * @param {number[]} request.origins - * Required. Array of origins, which determines the rows of the response - * matrix. Several size restrictions apply to the cardinality of origins and - * destinations: - * - * * The number of elements (origins × destinations) must be no greater than - * 625 in any case. - * * The number of elements (origins × destinations) must be no greater than - * 100 if routing_preference is set to `TRAFFIC_AWARE_OPTIMAL`. - * * The number of waypoints (origins + destinations) specified as `place_id` - * must be no greater than 50. - * @param {number[]} request.destinations - * Required. Array of destinations, which determines the columns of the - * response matrix. - * @param {google.maps.routing.v2.RouteTravelMode} [request.travelMode] - * Optional. Specifies the mode of transportation. - * @param {google.maps.routing.v2.RoutingPreference} [request.routingPreference] - * Optional. Specifies how to compute the route. The server attempts to use - * the selected routing preference to compute the route. If the routing - * preference results in an error or an extra long latency, an error is - * returned. You can specify this option only when the `travel_mode` is - * `DRIVE` or `TWO_WHEELER`, otherwise the request fails. - * @param {google.protobuf.Timestamp} [request.departureTime] - * Optional. The departure time. If you don't set this value, then this value - * defaults to the time that you made the request. - * NOTE: You can only specify a `departure_time` in the past when - * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to - * `TRANSIT`. - * @param {google.protobuf.Timestamp} [request.arrivalTime] - * Optional. The arrival time. - * NOTE: Can only be set when - * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to - * `TRANSIT`. You can specify either departure_time or arrival_time, but not - * both. - * @param {string} [request.languageCode] - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See - * [Language Support](https://developers.google.com/maps/faq#languagesupport) - * for the list of supported languages. When you don't provide this value, the - * display language is inferred from the location of the first origin. - * @param {string} [request.regionCode] - * Optional. The region code, specified as a ccTLD ("top-level domain") - * two-character value. For more information see - * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains - * @param {number[]} [request.extraComputations] - * Optional. A list of extra computations which may be used to complete the - * request. Note: These extra computations may return extra fields on the - * response. These extra fields must also be specified in the field mask to be - * returned in the response. - * @param {google.maps.routing.v2.TrafficModel} [request.trafficModel] - * Optional. Specifies the assumptions to use when calculating time in - * traffic. This setting affects the value returned in the duration field in - * the {@link protos.google.maps.routing.v2.RouteMatrixElement|RouteMatrixElement} which - * contains the predicted time in traffic based on historical averages. - * {@link protos.google.maps.routing.v2.RoutingPreference|RoutingPreference} to - * `TRAFFIC_AWARE_OPTIMAL` and - * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} to `DRIVE`. - * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not - * specified. - * @param {google.maps.routing.v2.TransitPreferences} [request.transitPreferences] - * Optional. Specifies preferences that influence the route returned for - * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when - * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to - * `TRANSIT`. - * @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 {@link protos.google.maps.routing.v2.RouteMatrixElement|RouteMatrixElement} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v2/routes.compute_route_matrix.js - * region_tag:routes_v2_generated_Routes_ComputeRouteMatrix_async - */ - computeRouteMatrix( - request?: protos.google.maps.routing.v2.IComputeRouteMatrixRequest, - options?: CallOptions): - gax.CancellableStream{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.computeRouteMatrix(request, 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.routesStub && !this._terminated) { - return this.routesStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client_config.json b/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client_config.json deleted file mode 100644 index c69ed299a73..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/src/v2/routes_client_config.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "interfaces": { - "google.maps.routing.v2.Routes": { - "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": { - "ComputeRoutes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ComputeRouteMatrix": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-maps-routing/v2/src/v2/routes_proto_list.json b/owl-bot-staging/google-maps-routing/v2/src/v2/routes_proto_list.json deleted file mode 100644 index a32ecb29518..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/src/v2/routes_proto_list.json +++ /dev/null @@ -1,26 +0,0 @@ -[ - "../../protos/google/geo/type/viewport.proto", - "../../protos/google/maps/routing/v2/fallback_info.proto", - "../../protos/google/maps/routing/v2/geocoding_results.proto", - "../../protos/google/maps/routing/v2/localized_time.proto", - "../../protos/google/maps/routing/v2/location.proto", - "../../protos/google/maps/routing/v2/maneuver.proto", - "../../protos/google/maps/routing/v2/navigation_instruction.proto", - "../../protos/google/maps/routing/v2/polyline.proto", - "../../protos/google/maps/routing/v2/route.proto", - "../../protos/google/maps/routing/v2/route_label.proto", - "../../protos/google/maps/routing/v2/route_modifiers.proto", - "../../protos/google/maps/routing/v2/route_travel_mode.proto", - "../../protos/google/maps/routing/v2/routes_service.proto", - "../../protos/google/maps/routing/v2/routing_preference.proto", - "../../protos/google/maps/routing/v2/speed_reading_interval.proto", - "../../protos/google/maps/routing/v2/toll_info.proto", - "../../protos/google/maps/routing/v2/toll_passes.proto", - "../../protos/google/maps/routing/v2/traffic_model.proto", - "../../protos/google/maps/routing/v2/transit.proto", - "../../protos/google/maps/routing/v2/transit_preferences.proto", - "../../protos/google/maps/routing/v2/units.proto", - "../../protos/google/maps/routing/v2/vehicle_emission_type.proto", - "../../protos/google/maps/routing/v2/vehicle_info.proto", - "../../protos/google/maps/routing/v2/waypoint.proto" -] diff --git a/owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 5ba9f8b1512..00000000000 --- a/owl-bot-staging/google-maps-routing/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 routing = require('@googlemaps/routing'); - -function main() { - const routesClient = new routing.RoutesClient(); -} - -main(); diff --git a/owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-maps-routing/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 1c6dfd98b95..00000000000 --- a/owl-bot-staging/google-maps-routing/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 {RoutesClient} from '@googlemaps/routing'; - -// check that the client class type name can be used -function doStuffWithRoutesClient(client: RoutesClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const routesClient = new RoutesClient(); - doStuffWithRoutesClient(routesClient); -} - -main(); diff --git a/owl-bot-staging/google-maps-routing/v2/system-test/install.ts b/owl-bot-staging/google-maps-routing/v2/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-maps-routing/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-maps-routing/v2/test/gapic_routes_v2.ts b/owl-bot-staging/google-maps-routing/v2/test/gapic_routes_v2.ts deleted file mode 100644 index 189479cad0d..00000000000 --- a/owl-bot-staging/google-maps-routing/v2/test/gapic_routes_v2.ts +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 routesModule 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 stubServerStreamingCall(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, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -describe('v2.RoutesClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = routesModule.v2.RoutesClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = routesModule.v2.RoutesClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = routesModule.v2.RoutesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new routesModule.v2.RoutesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new routesModule.v2.RoutesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new routesModule.v2.RoutesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.routesStub, undefined); - await client.initialize(); - assert(client.routesStub); - }); - - it('has close method for the initialized client', done => { - const client = new routesModule.v2.RoutesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.routesStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new routesModule.v2.RoutesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.routesStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new routesModule.v2.RoutesClient({ - 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 routesModule.v2.RoutesClient({ - 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('computeRoutes', () => { - it('invokes computeRoutes without error', async () => { - const client = new routesModule.v2.RoutesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.routing.v2.ComputeRoutesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.maps.routing.v2.ComputeRoutesResponse() - ); - client.innerApiCalls.computeRoutes = stubSimpleCall(expectedResponse); - const [response] = await client.computeRoutes(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes computeRoutes without error using callback', async () => { - const client = new routesModule.v2.RoutesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.routing.v2.ComputeRoutesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.maps.routing.v2.ComputeRoutesResponse() - ); - client.innerApiCalls.computeRoutes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.computeRoutes( - request, - (err?: Error|null, result?: protos.google.maps.routing.v2.IComputeRoutesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes computeRoutes with error', async () => { - const client = new routesModule.v2.RoutesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.routing.v2.ComputeRoutesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.computeRoutes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.computeRoutes(request), expectedError); - }); - - it('invokes computeRoutes with closed client', async () => { - const client = new routesModule.v2.RoutesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.routing.v2.ComputeRoutesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.computeRoutes(request), expectedError); - }); - }); - - describe('computeRouteMatrix', () => { - it('invokes computeRouteMatrix without error', async () => { - const client = new routesModule.v2.RoutesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.routing.v2.ComputeRouteMatrixRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.maps.routing.v2.RouteMatrixElement() - ); - client.innerApiCalls.computeRouteMatrix = stubServerStreamingCall(expectedResponse); - const stream = client.computeRouteMatrix(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.maps.routing.v2.RouteMatrixElement) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes computeRouteMatrix with error', async () => { - const client = new routesModule.v2.RoutesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.routing.v2.ComputeRouteMatrixRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.computeRouteMatrix = stubServerStreamingCall(undefined, expectedError); - const stream = client.computeRouteMatrix(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.maps.routing.v2.RouteMatrixElement) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - - it('invokes computeRouteMatrix with closed client', async () => { - const client = new routesModule.v2.RoutesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.maps.routing.v2.ComputeRouteMatrixRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - const stream = client.computeRouteMatrix(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.maps.routing.v2.RouteMatrixElement) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-maps-routing/v2/tsconfig.json b/owl-bot-staging/google-maps-routing/v2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-maps-routing/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-maps-routing/v2/webpack.config.js b/owl-bot-staging/google-maps-routing/v2/webpack.config.js deleted file mode 100644 index 311cb75c287..00000000000 --- a/owl-bot-staging/google-maps-routing/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: 'Routes', - filename: './routes.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-monitoring-dashboard/v1/.eslintignore b/owl-bot-staging/google-monitoring-dashboard/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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-monitoring-dashboard/v1/.eslintrc.json b/owl-bot-staging/google-monitoring-dashboard/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/.gitignore b/owl-bot-staging/google-monitoring-dashboard/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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-monitoring-dashboard/v1/.jsdoc.js b/owl-bot-staging/google-monitoring-dashboard/v1/.jsdoc.js deleted file mode 100644 index c063fb7c718..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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/monitoring-dashboards', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/.mocharc.js b/owl-bot-staging/google-monitoring-dashboard/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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-monitoring-dashboard/v1/.prettierrc.js b/owl-bot-staging/google-monitoring-dashboard/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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-monitoring-dashboard/v1/README.md b/owl-bot-staging/google-monitoring-dashboard/v1/README.md deleted file mode 100644 index 05b2e99d6ea..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Dashboard: Nodejs Client diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/package.json b/owl-bot-staging/google-monitoring-dashboard/v1/package.json deleted file mode 100644 index c3e132b8ba2..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/monitoring-dashboards", - "version": "0.1.0", - "description": "Dashboard client for Node.js", - "repository": "googleapis/nodejs-dashboard", - "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 dashboard", - "dashboard", - "dashboards 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-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/alertchart.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/alertchart.proto deleted file mode 100644 index e0bae9bcd8f..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/alertchart.proto +++ /dev/null @@ -1,41 +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.monitoring.dashboard.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "AlertChartProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// A chart that displays alert policy data. -message AlertChart { - option (google.api.resource) = { - type: "monitoring.googleapis.com/AlertPolicy" - pattern: "projects/{project}/alertPolicies/{alert_policy}" - }; - - // Required. The resource name of the alert policy. The format is: - // - // projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/collapsible_group.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/collapsible_group.proto deleted file mode 100644 index 2ef705d5921..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/collapsible_group.proto +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.monitoring.dashboard.v1; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "CollapsibleGroupProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// A widget that groups the other widgets. All widgets that are within -// the area spanned by the grouping widget are considered member widgets. -message CollapsibleGroup { - // The collapsed state of the widget on first page load. - bool collapsed = 1; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/common.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/common.proto deleted file mode 100644 index 1cb2b3089ec..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/common.proto +++ /dev/null @@ -1,452 +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.monitoring.dashboard.v1; - -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "CommonProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// Describes how to combine multiple time series to provide a different view of -// the data. Aggregation of time series is done in two steps. First, each time -// series in the set is _aligned_ to the same time interval boundaries, then the -// set of time series is optionally _reduced_ in number. -// -// Alignment consists of applying the `per_series_aligner` operation -// to each time series after its data has been divided into regular -// `alignment_period` time intervals. This process takes _all_ of the data -// points in an alignment period, applies a mathematical transformation such as -// averaging, minimum, maximum, delta, etc., and converts them into a single -// data point per period. -// -// Reduction is when the aligned and transformed time series can optionally be -// combined, reducing the number of time series through similar mathematical -// transformations. Reduction involves applying a `cross_series_reducer` to -// all the time series, optionally sorting the time series into subsets with -// `group_by_fields`, and applying the reducer to each subset. -// -// The raw time series data can contain a huge amount of information from -// multiple sources. Alignment and reduction transforms this mass of data into -// a more manageable and representative collection of data, for example "the -// 95% latency across the average of all tasks in a cluster". This -// representative data can be more easily graphed and comprehended, and the -// individual time series data is still available for later drilldown. For more -// details, see [Filtering and -// aggregation](https://cloud.google.com/monitoring/api/v3/aggregation). -message Aggregation { - // The `Aligner` specifies the operation that will be applied to the data - // points in each alignment period in a time series. Except for - // `ALIGN_NONE`, which specifies that no operation be applied, each alignment - // operation replaces the set of data values in each alignment period with - // a single value: the result of applying the operation to the data values. - // An aligned time series has a single data value at the end of each - // `alignment_period`. - // - // An alignment operation can change the data type of the values, too. For - // example, if you apply a counting operation to boolean values, the data - // `value_type` in the original time series is `BOOLEAN`, but the `value_type` - // in the aligned result is `INT64`. - enum Aligner { - // No alignment. Raw data is returned. Not valid if cross-series reduction - // is requested. The `value_type` of the result is the same as the - // `value_type` of the input. - ALIGN_NONE = 0; - - // Align and convert to - // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA]. - // The output is `delta = y1 - y0`. - // - // This alignment is valid for - // [CUMULATIVE][google.api.MetricDescriptor.MetricKind.CUMULATIVE] and - // `DELTA` metrics. If the selected alignment period results in periods - // with no data, then the aligned value for such a period is created by - // interpolation. The `value_type` of the aligned result is the same as - // the `value_type` of the input. - ALIGN_DELTA = 1; - - // Align and convert to a rate. The result is computed as - // `rate = (y1 - y0)/(t1 - t0)`, or "delta over time". - // Think of this aligner as providing the slope of the line that passes - // through the value at the start and at the end of the `alignment_period`. - // - // This aligner is valid for `CUMULATIVE` - // and `DELTA` metrics with numeric values. If the selected alignment - // period results in periods with no data, then the aligned value for - // such a period is created by interpolation. The output is a `GAUGE` - // metric with `value_type` `DOUBLE`. - // - // If, by "rate", you mean "percentage change", see the - // `ALIGN_PERCENT_CHANGE` aligner instead. - ALIGN_RATE = 2; - - // Align by interpolating between adjacent points around the alignment - // period boundary. This aligner is valid for `GAUGE` metrics with - // numeric values. The `value_type` of the aligned result is the same as the - // `value_type` of the input. - ALIGN_INTERPOLATE = 3; - - // Align by moving the most recent data point before the end of the - // alignment period to the boundary at the end of the alignment - // period. This aligner is valid for `GAUGE` metrics. The `value_type` of - // the aligned result is the same as the `value_type` of the input. - ALIGN_NEXT_OLDER = 4; - - // Align the time series by returning the minimum value in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric values. The `value_type` of the aligned result is the same as - // the `value_type` of the input. - ALIGN_MIN = 10; - - // Align the time series by returning the maximum value in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric values. The `value_type` of the aligned result is the same as - // the `value_type` of the input. - ALIGN_MAX = 11; - - // Align the time series by returning the mean value in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric values. The `value_type` of the aligned result is `DOUBLE`. - ALIGN_MEAN = 12; - - // Align the time series by returning the number of values in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric or Boolean values. The `value_type` of the aligned result is - // `INT64`. - ALIGN_COUNT = 13; - - // Align the time series by returning the sum of the values in each - // alignment period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with numeric and distribution values. The `value_type` of the - // aligned result is the same as the `value_type` of the input. - ALIGN_SUM = 14; - - // Align the time series by returning the standard deviation of the values - // in each alignment period. This aligner is valid for `GAUGE` and - // `DELTA` metrics with numeric values. The `value_type` of the output is - // `DOUBLE`. - ALIGN_STDDEV = 15; - - // Align the time series by returning the number of `True` values in - // each alignment period. This aligner is valid for `GAUGE` metrics with - // Boolean values. The `value_type` of the output is `INT64`. - ALIGN_COUNT_TRUE = 16; - - // Align the time series by returning the number of `False` values in - // each alignment period. This aligner is valid for `GAUGE` metrics with - // Boolean values. The `value_type` of the output is `INT64`. - ALIGN_COUNT_FALSE = 24; - - // Align the time series by returning the ratio of the number of `True` - // values to the total number of values in each alignment period. This - // aligner is valid for `GAUGE` metrics with Boolean values. The output - // value is in the range [0.0, 1.0] and has `value_type` `DOUBLE`. - ALIGN_FRACTION_TRUE = 17; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 99th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_99 = 18; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 95th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_95 = 19; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 50th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_50 = 20; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 5th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_05 = 21; - - // Align and convert to a percentage change. This aligner is valid for - // `GAUGE` and `DELTA` metrics with numeric values. This alignment returns - // `((current - previous)/previous) * 100`, where the value of `previous` is - // determined based on the `alignment_period`. - // - // If the values of `current` and `previous` are both 0, then the returned - // value is 0. If only `previous` is 0, the returned value is infinity. - // - // A 10-minute moving mean is computed at each point of the alignment period - // prior to the above calculation to smooth the metric and prevent false - // positives from very short-lived spikes. The moving mean is only - // applicable for data whose values are `>= 0`. Any values `< 0` are - // treated as a missing datapoint, and are ignored. While `DELTA` - // metrics are accepted by this alignment, special care should be taken that - // the values for the metric will always be positive. The output is a - // `GAUGE` metric with `value_type` `DOUBLE`. - ALIGN_PERCENT_CHANGE = 23; - } - - // A Reducer operation describes how to aggregate data points from multiple - // time series into a single time series, where the value of each data point - // in the resulting series is a function of all the already aligned values in - // the input time series. - enum Reducer { - // No cross-time series reduction. The output of the `Aligner` is - // returned. - REDUCE_NONE = 0; - - // Reduce by computing the mean value across time series for each - // alignment period. This reducer is valid for - // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA] and - // [GAUGE][google.api.MetricDescriptor.MetricKind.GAUGE] metrics with - // numeric or distribution values. The `value_type` of the output is - // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. - REDUCE_MEAN = 1; - - // Reduce by computing the minimum value across time series for each - // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics - // with numeric values. The `value_type` of the output is the same as the - // `value_type` of the input. - REDUCE_MIN = 2; - - // Reduce by computing the maximum value across time series for each - // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics - // with numeric values. The `value_type` of the output is the same as the - // `value_type` of the input. - REDUCE_MAX = 3; - - // Reduce by computing the sum across time series for each - // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics - // with numeric and distribution values. The `value_type` of the output is - // the same as the `value_type` of the input. - REDUCE_SUM = 4; - - // Reduce by computing the standard deviation across time series - // for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics with numeric or distribution values. The `value_type` - // of the output is `DOUBLE`. - REDUCE_STDDEV = 5; - - // Reduce by computing the number of data points across time series - // for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics of numeric, Boolean, distribution, and string - // `value_type`. The `value_type` of the output is `INT64`. - REDUCE_COUNT = 6; - - // Reduce by computing the number of `True`-valued data points across time - // series for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output - // is `INT64`. - REDUCE_COUNT_TRUE = 7; - - // Reduce by computing the number of `False`-valued data points across time - // series for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output - // is `INT64`. - REDUCE_COUNT_FALSE = 15; - - // Reduce by computing the ratio of the number of `True`-valued data points - // to the total number of data points for each alignment period. This - // reducer is valid for `DELTA` and `GAUGE` metrics of Boolean `value_type`. - // The output value is in the range [0.0, 1.0] and has `value_type` - // `DOUBLE`. - REDUCE_FRACTION_TRUE = 8; - - // Reduce by computing the [99th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_99 = 9; - - // Reduce by computing the [95th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_95 = 10; - - // Reduce by computing the [50th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_50 = 11; - - // Reduce by computing the [5th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_05 = 12; - } - - // The `alignment_period` specifies a time interval, in seconds, that is used - // to divide the data in all the - // [time series][google.monitoring.v3.TimeSeries] into consistent blocks of - // time. This will be done before the per-series aligner can be applied to - // the data. - // - // The value must be at least 60 seconds. If a per-series aligner other than - // `ALIGN_NONE` is specified, this field is required or an error is returned. - // If no per-series aligner is specified, or the aligner `ALIGN_NONE` is - // specified, then this field is ignored. - // - // The maximum value of the `alignment_period` is 2 years, or 104 weeks. - google.protobuf.Duration alignment_period = 1; - - // An `Aligner` describes how to bring the data points in a single - // time series into temporal alignment. Except for `ALIGN_NONE`, all - // alignments cause all the data points in an `alignment_period` to be - // mathematically grouped together, resulting in a single data point for - // each `alignment_period` with end timestamp at the end of the period. - // - // Not all alignment operations may be applied to all time series. The valid - // choices depend on the `metric_kind` and `value_type` of the original time - // series. Alignment can change the `metric_kind` or the `value_type` of - // the time series. - // - // Time series data must be aligned in order to perform cross-time - // series reduction. If `cross_series_reducer` is specified, then - // `per_series_aligner` must be specified and not equal to `ALIGN_NONE` - // and `alignment_period` must be specified; otherwise, an error is - // returned. - Aligner per_series_aligner = 2; - - // The reduction operation to be used to combine time series into a single - // time series, where the value of each data point in the resulting series is - // a function of all the already aligned values in the input time series. - // - // Not all reducer operations can be applied to all time series. The valid - // choices depend on the `metric_kind` and the `value_type` of the original - // time series. Reduction can yield a time series with a different - // `metric_kind` or `value_type` than the input time series. - // - // Time series data must first be aligned (see `per_series_aligner`) in order - // to perform cross-time series reduction. If `cross_series_reducer` is - // specified, then `per_series_aligner` must be specified, and must not be - // `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an - // error is returned. - Reducer cross_series_reducer = 4; - - // The set of fields to preserve when `cross_series_reducer` is - // specified. The `group_by_fields` determine how the time series are - // partitioned into subsets prior to applying the aggregation - // operation. Each subset contains time series that have the same - // value for each of the grouping fields. Each individual time - // series is a member of exactly one subset. The - // `cross_series_reducer` is applied to each subset of time series. - // It is not possible to reduce across different resource types, so - // this field implicitly contains `resource.type`. Fields not - // specified in `group_by_fields` are aggregated away. If - // `group_by_fields` is not specified and all the time series have - // the same resource type, then the time series are aggregated into - // a single output time series. If `cross_series_reducer` is not - // defined, this field is ignored. - repeated string group_by_fields = 5; -} - -// Describes a ranking-based time series filter. Each input time series is -// ranked with an aligner. The filter will allow up to `num_time_series` time -// series to pass through it, selecting them based on the relative ranking. -// -// For example, if `ranking_method` is `METHOD_MEAN`,`direction` is `BOTTOM`, -// and `num_time_series` is 3, then the 3 times series with the lowest mean -// values will pass through the filter. -message PickTimeSeriesFilter { - // The value reducers that can be applied to a `PickTimeSeriesFilter`. - enum Method { - // Not allowed. You must specify a different `Method` if you specify a - // `PickTimeSeriesFilter`. - METHOD_UNSPECIFIED = 0; - - // Select the mean of all values. - METHOD_MEAN = 1; - - // Select the maximum value. - METHOD_MAX = 2; - - // Select the minimum value. - METHOD_MIN = 3; - - // Compute the sum of all values. - METHOD_SUM = 4; - - // Select the most recent value. - METHOD_LATEST = 5; - } - - // Describes the ranking directions. - enum Direction { - // Not allowed. You must specify a different `Direction` if you specify a - // `PickTimeSeriesFilter`. - DIRECTION_UNSPECIFIED = 0; - - // Pass the highest `num_time_series` ranking inputs. - TOP = 1; - - // Pass the lowest `num_time_series` ranking inputs. - BOTTOM = 2; - } - - // `ranking_method` is applied to each time series independently to produce - // the value which will be used to compare the time series to other time - // series. - Method ranking_method = 1; - - // How many time series to allow to pass through the filter. - int32 num_time_series = 2; - - // How to use the ranking to select time series that pass through the filter. - Direction direction = 3; -} - -// A filter that ranks streams based on their statistical relation to other -// streams in a request. -// Note: This field is deprecated and completely ignored by the API. -message StatisticalTimeSeriesFilter { - // The filter methods that can be applied to a stream. - enum Method { - // Not allowed in well-formed requests. - METHOD_UNSPECIFIED = 0; - - // Compute the outlier score of each stream. - METHOD_CLUSTER_OUTLIER = 1; - } - - // `rankingMethod` is applied to a set of time series, and then the produced - // value for each individual time series is used to compare a given time - // series to others. - // These are methods that cannot be applied stream-by-stream, but rather - // require the full context of a request to evaluate time series. - Method ranking_method = 1; - - // How many time series to output. - int32 num_time_series = 2; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard.proto deleted file mode 100644 index 0f841093823..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard.proto +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.monitoring.dashboard.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/monitoring/dashboard/v1/dashboard_filter.proto"; -import "google/monitoring/dashboard/v1/layouts.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "DashboardsProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// A Google Stackdriver dashboard. Dashboards define the content and layout -// of pages in the Stackdriver web application. -message Dashboard { - option (google.api.resource) = { - type: "monitoring.googleapis.com/Dashboard" - pattern: "projects/{project}/dashboards/{dashboard}" - }; - - // Immutable. The resource name of the dashboard. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Required. The mutable, human-readable name. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // `etag` is used for optimistic concurrency control as a way to help - // prevent simultaneous updates of a policy from overwriting each other. - // An `etag` is returned in the response to `GetDashboard`, and - // users are expected to put that etag in the request to `UpdateDashboard` to - // ensure that their change will be applied to the same version of the - // Dashboard configuration. The field should not be passed during - // dashboard creation. - string etag = 4; - - // A dashboard's root container element that defines the layout style. - oneof layout { - // Content is arranged with a basic layout that re-flows a simple list of - // informational elements like widgets or tiles. - GridLayout grid_layout = 5; - - // The content is arranged as a grid of tiles, with each content widget - // occupying one or more grid blocks. - MosaicLayout mosaic_layout = 6; - - // The content is divided into equally spaced rows and the widgets are - // arranged horizontally. - RowLayout row_layout = 8; - - // The content is divided into equally spaced columns and the widgets are - // arranged vertically. - ColumnLayout column_layout = 9; - } - - // Filters to reduce the amount of data charted based on the filter criteria. - repeated DashboardFilter dashboard_filters = 11; - - // Labels applied to the dashboard - map labels = 12; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard_filter.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard_filter.proto deleted file mode 100644 index c234c3a9715..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboard_filter.proto +++ /dev/null @@ -1,68 +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.monitoring.dashboard.v1; - -import "google/api/field_behavior.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "DashboardFilterProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// A filter to reduce the amount of data charted in relevant widgets. -message DashboardFilter { - // The type for the dashboard filter - enum FilterType { - // Filter type is unspecified. This is not valid in a well-formed request. - FILTER_TYPE_UNSPECIFIED = 0; - - // Filter on a resource label value - RESOURCE_LABEL = 1; - - // Filter on a metrics label value - METRIC_LABEL = 2; - - // Filter on a user metadata label value - USER_METADATA_LABEL = 3; - - // Filter on a system metadata label value - SYSTEM_METADATA_LABEL = 4; - - // Filter on a group id - GROUP = 5; - } - - // Required. The key for the label - string label_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // The placeholder text that can be referenced in a filter string or MQL - // query. If omitted, the dashboard filter will be applied to all relevant - // widgets in the dashboard. - string template_variable = 3; - - // The default value used in the filter comparison - oneof default_value { - // A variable-length string value. - string string_value = 4; - } - - // The specified filter type - FilterType filter_type = 5; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboards_service.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboards_service.proto deleted file mode 100644 index 9679c569fd5..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/dashboards_service.proto +++ /dev/null @@ -1,189 +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.monitoring.dashboard.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/monitoring/dashboard/v1/dashboard.proto"; -import "google/protobuf/empty.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "DashboardsServiceProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// Manages Stackdriver dashboards. A dashboard is an arrangement of data display -// widgets in a specific layout. -service DashboardsService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read," - "https://www.googleapis.com/auth/monitoring.write"; - - // Creates a new custom dashboard. For examples on how you can use this API to - // create dashboards, see [Managing dashboards by - // API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This - // method requires the `monitoring.dashboards.create` permission on the - // specified project. For more information about permissions, see [Cloud - // Identity and Access Management](https://cloud.google.com/iam). - rpc CreateDashboard(CreateDashboardRequest) returns (Dashboard) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/dashboards" - body: "dashboard" - }; - } - - // Lists the existing dashboards. - // - // This method requires the `monitoring.dashboards.list` permission - // on the specified project. For more information, see - // [Cloud Identity and Access Management](https://cloud.google.com/iam). - rpc ListDashboards(ListDashboardsRequest) returns (ListDashboardsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/dashboards" - }; - } - - // Fetches a specific dashboard. - // - // This method requires the `monitoring.dashboards.get` permission - // on the specified dashboard. For more information, see - // [Cloud Identity and Access Management](https://cloud.google.com/iam). - rpc GetDashboard(GetDashboardRequest) returns (Dashboard) { - option (google.api.http) = { - get: "/v1/{name=projects/*/dashboards/*}" - }; - } - - // Deletes an existing custom dashboard. - // - // This method requires the `monitoring.dashboards.delete` permission - // on the specified dashboard. For more information, see - // [Cloud Identity and Access Management](https://cloud.google.com/iam). - rpc DeleteDashboard(DeleteDashboardRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/dashboards/*}" - }; - } - - // Replaces an existing custom dashboard with a new definition. - // - // This method requires the `monitoring.dashboards.update` permission - // on the specified dashboard. For more information, see - // [Cloud Identity and Access Management](https://cloud.google.com/iam). - rpc UpdateDashboard(UpdateDashboardRequest) returns (Dashboard) { - option (google.api.http) = { - patch: "/v1/{dashboard.name=projects/*/dashboards/*}" - body: "dashboard" - }; - } -} - -// The `CreateDashboard` request. -message CreateDashboardRequest { - // Required. The project on which to execute the request. The format is: - // - // projects/[PROJECT_ID_OR_NUMBER] - // - // The `[PROJECT_ID_OR_NUMBER]` must match the dashboard resource name. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The initial dashboard specification. - Dashboard dashboard = 2 [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // save it. - bool validate_only = 3; -} - -// The `ListDashboards` request. -message ListDashboardsRequest { - // Required. The scope of the dashboards to list. The format is: - // - // projects/[PROJECT_ID_OR_NUMBER] - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // A positive number that is the maximum number of results to return. - // If unspecified, a default of 1000 is used. - int32 page_size = 2; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 3; -} - -// The `ListDashboards` request. -message ListDashboardsResponse { - // The list of requested dashboards. - repeated Dashboard dashboards = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `page_token` in the next call to this method. - string next_page_token = 2; -} - -// The `GetDashboard` request. -message GetDashboardRequest { - // Required. The resource name of the Dashboard. The format is one of: - // - // - `dashboards/[DASHBOARD_ID]` (for system dashboards) - // - `projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]` - // (for custom dashboards). - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Dashboard" - } - ]; -} - -// The `DeleteDashboard` request. -message DeleteDashboardRequest { - // Required. The resource name of the Dashboard. The format is: - // - // projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID] - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Dashboard" - } - ]; -} - -// The `UpdateDashboard` request. -message UpdateDashboardRequest { - // Required. The dashboard that will replace the existing dashboard. - Dashboard dashboard = 1 [(google.api.field_behavior) = REQUIRED]; - - // If set, validate the request and preview the review, but do not actually - // save it. - bool validate_only = 3; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/drilldowns.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/drilldowns.proto deleted file mode 100644 index 806ab822f40..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/drilldowns.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.monitoring.dashboard.v1; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "DrilldownsProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/layouts.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/layouts.proto deleted file mode 100644 index 11373088058..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/layouts.proto +++ /dev/null @@ -1,112 +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.monitoring.dashboard.v1; - -import "google/monitoring/dashboard/v1/widget.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "LayoutsProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// A basic layout divides the available space into vertical columns of equal -// width and arranges a list of widgets using a row-first strategy. -message GridLayout { - // The number of columns into which the view's width is divided. If omitted - // or set to zero, a system default will be used while rendering. - int64 columns = 1; - - // The informational elements that are arranged into the columns row-first. - repeated Widget widgets = 2; -} - -// A mosaic layout divides the available space into a grid of blocks, and -// overlays the grid with tiles. Unlike `GridLayout`, tiles may span multiple -// grid blocks and can be placed at arbitrary locations in the grid. -message MosaicLayout { - // A single tile in the mosaic. The placement and size of the tile are - // configurable. - message Tile { - // The zero-indexed position of the tile in grid blocks relative to the - // left edge of the grid. Tiles must be contained within the specified - // number of columns. `x_pos` cannot be negative. - int32 x_pos = 1; - - // The zero-indexed position of the tile in grid blocks relative to the - // top edge of the grid. `y_pos` cannot be negative. - int32 y_pos = 2; - - // The width of the tile, measured in grid blocks. Tiles must have a - // minimum width of 1. - int32 width = 3; - - // The height of the tile, measured in grid blocks. Tiles must have a - // minimum height of 1. - int32 height = 4; - - // The informational widget contained in the tile. For example an `XyChart`. - Widget widget = 5; - } - - // The number of columns in the mosaic grid. The number of columns must be - // between 1 and 12, inclusive. - int32 columns = 1; - - // The tiles to display. - repeated Tile tiles = 3; -} - -// A simplified layout that divides the available space into rows -// and arranges a set of widgets horizontally in each row. -message RowLayout { - // Defines the layout properties and content for a row. - message Row { - // The relative weight of this row. The row weight is used to adjust the - // height of rows on the screen (relative to peers). Greater the weight, - // greater the height of the row on the screen. If omitted, a value - // of 1 is used while rendering. - int64 weight = 1; - - // The display widgets arranged horizontally in this row. - repeated Widget widgets = 2; - } - - // The rows of content to display. - repeated Row rows = 1; -} - -// A simplified layout that divides the available space into vertical columns -// and arranges a set of widgets vertically in each column. -message ColumnLayout { - // Defines the layout properties and content for a column. - message Column { - // The relative weight of this column. The column weight is used to adjust - // the width of columns on the screen (relative to peers). - // Greater the weight, greater the width of the column on the screen. - // If omitted, a value of 1 is used while rendering. - int64 weight = 1; - - // The display widgets arranged vertically in this column. - repeated Widget widgets = 2; - } - - // The columns of content to display. - repeated Column columns = 1; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/logs_panel.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/logs_panel.proto deleted file mode 100644 index f7a66c57c93..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/logs_panel.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.monitoring.dashboard.v1; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "LogsPanelProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// A widget that displays a stream of log. -message LogsPanel { - // A filter that chooses which log entries to return. See [Advanced Logs - // Queries](https://cloud.google.com/logging/docs/view/advanced-queries). - // Only log entries that match the filter are returned. An empty filter - // matches all log entries. - string filter = 1; - - // The names of logging resources to collect logs for. Currently only projects - // are supported. If empty, the widget will default to the host project. - repeated string resource_names = 2; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/metrics.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/metrics.proto deleted file mode 100644 index 6f73f67480e..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/metrics.proto +++ /dev/null @@ -1,198 +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.monitoring.dashboard.v1; - -import "google/api/field_behavior.proto"; -import "google/monitoring/dashboard/v1/common.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "MetricsProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// TimeSeriesQuery collects the set of supported methods for querying time -// series data from the Stackdriver metrics API. -message TimeSeriesQuery { - // Parameters needed to obtain data for the chart. - oneof source { - // Filter parameters to fetch time series. - TimeSeriesFilter time_series_filter = 1; - - // Parameters to fetch a ratio between two time series filters. - TimeSeriesFilterRatio time_series_filter_ratio = 2; - - // A query used to fetch time series with MQL. - string time_series_query_language = 3; - - // A query used to fetch time series with PromQL. - string prometheus_query = 6; - } - - // The unit of data contained in fetched time series. If non-empty, this - // unit will override any unit that accompanies fetched data. The format is - // the same as the - // [`unit`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors) - // field in `MetricDescriptor`. - string unit_override = 5; -} - -// A filter that defines a subset of time series data that is displayed in a -// widget. Time series data is fetched using the -// [`ListTimeSeries`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) -// method. -message TimeSeriesFilter { - // Required. The [monitoring - // filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies - // the metric types, resources, and projects to query. - string filter = 1 [(google.api.field_behavior) = REQUIRED]; - - // By default, the raw time series data is returned. - // Use this field to combine multiple time series for different views of the - // data. - Aggregation aggregation = 2; - - // Apply a second aggregation after `aggregation` is applied. - Aggregation secondary_aggregation = 3; - - // Selects an optional time series filter. - oneof output_filter { - // Ranking based time series filter. - PickTimeSeriesFilter pick_time_series_filter = 4; - - // Statistics based time series filter. - // Note: This field is deprecated and completely ignored by the API. - StatisticalTimeSeriesFilter statistical_time_series_filter = 5 - [deprecated = true]; - } -} - -// A pair of time series filters that define a ratio computation. The output -// time series is the pair-wise division of each aligned element from the -// numerator and denominator time series. -message TimeSeriesFilterRatio { - // Describes a query to build the numerator or denominator of a - // TimeSeriesFilterRatio. - message RatioPart { - // Required. The [monitoring - // filter](https://cloud.google.com/monitoring/api/v3/filters) that - // identifies the metric types, resources, and projects to query. - string filter = 1 [(google.api.field_behavior) = REQUIRED]; - - // By default, the raw time series data is returned. - // Use this field to combine multiple time series for different views of the - // data. - Aggregation aggregation = 2; - } - - // The numerator of the ratio. - RatioPart numerator = 1; - - // The denominator of the ratio. - RatioPart denominator = 2; - - // Apply a second aggregation after the ratio is computed. - Aggregation secondary_aggregation = 3; - - // Selects an optional filter that is applied to the time series after - // computing the ratio. - oneof output_filter { - // Ranking based time series filter. - PickTimeSeriesFilter pick_time_series_filter = 4; - - // Statistics based time series filter. - // Note: This field is deprecated and completely ignored by the API. - StatisticalTimeSeriesFilter statistical_time_series_filter = 5 - [deprecated = true]; - } -} - -// Defines a threshold for categorizing time series values. -message Threshold { - // The color suggests an interpretation to the viewer when actual values cross - // the threshold. Comments on each color provide UX guidance on how users can - // be expected to interpret a given state color. - enum Color { - // Color is unspecified. Not allowed in well-formed requests. - COLOR_UNSPECIFIED = 0; - - // Crossing the threshold is "concerning" behavior. - YELLOW = 4; - - // Crossing the threshold is "emergency" behavior. - RED = 6; - } - - // Whether the threshold is considered crossed by an actual value above or - // below its threshold value. - enum Direction { - // Not allowed in well-formed requests. - DIRECTION_UNSPECIFIED = 0; - - // The threshold will be considered crossed if the actual value is above - // the threshold value. - ABOVE = 1; - - // The threshold will be considered crossed if the actual value is below - // the threshold value. - BELOW = 2; - } - - // An axis identifier. - enum TargetAxis { - // The target axis was not specified. Defaults to Y1. - TARGET_AXIS_UNSPECIFIED = 0; - - // The y_axis (the right axis of chart). - Y1 = 1; - - // The y2_axis (the left axis of chart). - Y2 = 2; - } - - // A label for the threshold. - string label = 1; - - // The value of the threshold. The value should be defined in the native scale - // of the metric. - double value = 2; - - // The state color for this threshold. Color is not allowed in a XyChart. - Color color = 3; - - // The direction for the current threshold. Direction is not allowed in a - // XyChart. - Direction direction = 4; - - // The target axis to use for plotting the threshold. Target axis is not - // allowed in a Scorecard. - TargetAxis target_axis = 5; -} - -// Defines the possible types of spark chart supported by the `Scorecard`. -enum SparkChartType { - // Not allowed in well-formed requests. - SPARK_CHART_TYPE_UNSPECIFIED = 0; - - // The sparkline will be rendered as a small line chart. - SPARK_LINE = 1; - - // The sparkbar will be rendered as a small bar chart. - SPARK_BAR = 2; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/scorecard.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/scorecard.proto deleted file mode 100644 index 80c28e6e4fd..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/scorecard.proto +++ /dev/null @@ -1,118 +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.monitoring.dashboard.v1; - -import "google/api/field_behavior.proto"; -import "google/monitoring/dashboard/v1/metrics.proto"; -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "ScorecardProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// A widget showing the latest value of a metric, and how this value relates to -// one or more thresholds. -message Scorecard { - // A gauge chart shows where the current value sits within a pre-defined - // range. The upper and lower bounds should define the possible range of - // values for the scorecard's query (inclusive). - message GaugeView { - // The lower bound for this gauge chart. The value of the chart should - // always be greater than or equal to this. - double lower_bound = 1; - - // The upper bound for this gauge chart. The value of the chart should - // always be less than or equal to this. - double upper_bound = 2; - } - - // A sparkChart is a small chart suitable for inclusion in a table-cell or - // inline in text. This message contains the configuration for a sparkChart - // to show up on a Scorecard, showing recent trends of the scorecard's - // timeseries. - message SparkChartView { - // Required. The type of sparkchart to show in this chartView. - SparkChartType spark_chart_type = 1 - [(google.api.field_behavior) = REQUIRED]; - - // The lower bound on data point frequency in the chart implemented by - // specifying the minimum alignment period to use in a time series query. - // For example, if the data is published once every 10 minutes it would not - // make sense to fetch and align data at one minute intervals. This field is - // optional and exists only as a hint. - google.protobuf.Duration min_alignment_period = 2; - } - - // Required. Fields for querying time series data from the - // Stackdriver metrics API. - TimeSeriesQuery time_series_query = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Defines the optional additional chart shown on the scorecard. If - // neither is included - then a default scorecard is shown. - oneof data_view { - // Will cause the scorecard to show a gauge chart. - GaugeView gauge_view = 4; - - // Will cause the scorecard to show a spark chart. - SparkChartView spark_chart_view = 5; - } - - // The thresholds used to determine the state of the scorecard given the - // time series' current value. For an actual value x, the scorecard is in a - // danger state if x is less than or equal to a danger threshold that triggers - // below, or greater than or equal to a danger threshold that triggers above. - // Similarly, if x is above/below a warning threshold that triggers - // above/below, then the scorecard is in a warning state - unless x also puts - // it in a danger state. (Danger trumps warning.) - // - // As an example, consider a scorecard with the following four thresholds: - // - // ``` - // { - // value: 90, - // category: 'DANGER', - // trigger: 'ABOVE', - // }, - // { - // value: 70, - // category: 'WARNING', - // trigger: 'ABOVE', - // }, - // { - // value: 10, - // category: 'DANGER', - // trigger: 'BELOW', - // }, - // { - // value: 20, - // category: 'WARNING', - // trigger: 'BELOW', - // } - // ``` - // - // Then: values less than or equal to 10 would put the scorecard in a DANGER - // state, values greater than 10 but less than or equal to 20 a WARNING state, - // values strictly between 20 and 70 an OK state, values greater than or equal - // to 70 but less than 90 a WARNING state, and values greater than or equal to - // 90 a DANGER state. - repeated Threshold thresholds = 6; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/service.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/service.proto deleted file mode 100644 index b531fea0a09..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/service.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.monitoring.dashboard.v1; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "ServiceMonitoringProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table.proto deleted file mode 100644 index 081217b83a7..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table.proto +++ /dev/null @@ -1,92 +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.monitoring.dashboard.v1; - -import "google/api/field_behavior.proto"; -import "google/monitoring/dashboard/v1/metrics.proto"; -import "google/monitoring/dashboard/v1/table_display_options.proto"; -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "TableProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// A table that displays time series data. -message TimeSeriesTable { - // Groups a time series query definition with table options. - message TableDataSet { - // Required. Fields for querying time series data from the - // Stackdriver metrics API. - TimeSeriesQuery time_series_query = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. A template string for naming `TimeSeries` in the resulting data - // set. This should be a string with interpolations of the form - // `${label_name}`, which will resolve to the label's value i.e. - // "${resource.labels.project_id}." - string table_template = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The lower bound on data point frequency for this data set, - // implemented by specifying the minimum alignment period to use in a time - // series query For example, if the data is published once every 10 minutes, - // the `min_alignment_period` should be at least 10 minutes. It would not - // make sense to fetch and align data at one minute intervals. - google.protobuf.Duration min_alignment_period = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Table display options for configuring how the table is - // rendered. - TableDisplayOptions table_display_options = 4 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Enum for metric metric_visualization - enum MetricVisualization { - // Unspecified state - METRIC_VISUALIZATION_UNSPECIFIED = 0; - - // Default text rendering - NUMBER = 1; - - // Horizontal bar rendering - BAR = 2; - } - - // The persistent settings for a table's columns. - message ColumnSettings { - // Required. The id of the column. - string column = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Whether the column should be visible on page load. - bool visible = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. The data displayed in this table. - repeated TableDataSet data_sets = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Store rendering strategy - MetricVisualization metric_visualization = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The list of the persistent column settings for the table. - repeated ColumnSettings column_settings = 4 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table_display_options.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table_display_options.proto deleted file mode 100644 index 38e1dea57f6..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/table_display_options.proto +++ /dev/null @@ -1,35 +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.monitoring.dashboard.v1; - -import "google/api/field_behavior.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "TableDisplayOptionsProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// Table display options that can be reused. -message TableDisplayOptions { - // Optional. This field is unused and has been replaced by - // TimeSeriesTable.column_settings - repeated string shown_columns = 1 - [deprecated = true, (google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/text.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/text.proto deleted file mode 100644 index 7c3c17679ac..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/text.proto +++ /dev/null @@ -1,46 +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.monitoring.dashboard.v1; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "TextProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// A widget that displays textual content. -message Text { - // The format type of the text content. - enum Format { - // Format is unspecified. Defaults to MARKDOWN. - FORMAT_UNSPECIFIED = 0; - - // The text contains Markdown formatting. - MARKDOWN = 1; - - // The text contains no special formatting. - RAW = 2; - } - - // The text content to be displayed. - string content = 1; - - // How the text content is formatted. - Format format = 2; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/widget.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/widget.proto deleted file mode 100644 index cb77c7ae4a9..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/widget.proto +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.monitoring.dashboard.v1; - -import "google/api/field_behavior.proto"; -import "google/monitoring/dashboard/v1/alertchart.proto"; -import "google/monitoring/dashboard/v1/collapsible_group.proto"; -import "google/monitoring/dashboard/v1/logs_panel.proto"; -import "google/monitoring/dashboard/v1/scorecard.proto"; -import "google/monitoring/dashboard/v1/table.proto"; -import "google/monitoring/dashboard/v1/text.proto"; -import "google/monitoring/dashboard/v1/xychart.proto"; -import "google/protobuf/empty.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "WidgetProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// Widget contains a single dashboard component and configuration of how to -// present the component in the dashboard. -message Widget { - // Optional. The title of the widget. - string title = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Content defines the component used to populate the widget. - oneof content { - // A chart of time series data. - XyChart xy_chart = 2; - - // A scorecard summarizing time series data. - Scorecard scorecard = 3; - - // A raw string or markdown displaying textual content. - Text text = 4; - - // A blank space. - google.protobuf.Empty blank = 5; - - // A chart of alert policy data. - AlertChart alert_chart = 7; - - // A widget that displays time series data in a tabular format. - TimeSeriesTable time_series_table = 8; - - // A widget that groups the other widgets. All widgets that are within - // the area spanned by the grouping widget are considered member widgets. - CollapsibleGroup collapsible_group = 9; - - // A widget that shows a stream of logs. - LogsPanel logs_panel = 10; - } -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/xychart.proto b/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/xychart.proto deleted file mode 100644 index ae7ddc30599..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/protos/google/monitoring/dashboard/v1/xychart.proto +++ /dev/null @@ -1,168 +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.monitoring.dashboard.v1; - -import "google/api/field_behavior.proto"; -import "google/monitoring/dashboard/v1/metrics.proto"; -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1"; -option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb"; -option java_multiple_files = true; -option java_outer_classname = "XyChartProto"; -option java_package = "com.google.monitoring.dashboard.v1"; -option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1"; -option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1"; - -// A chart that displays data on a 2D (X and Y axes) plane. -message XyChart { - // Groups a time series query definition with charting options. - message DataSet { - // The types of plotting strategies for data sets. - enum PlotType { - // Plot type is unspecified. The view will default to `LINE`. - PLOT_TYPE_UNSPECIFIED = 0; - - // The data is plotted as a set of lines (one line per series). - LINE = 1; - - // The data is plotted as a set of filled areas (one area per series), - // with the areas stacked vertically (the base of each area is the top of - // its predecessor, and the base of the first area is the X axis). Since - // the areas do not overlap, each is filled with a different opaque color. - STACKED_AREA = 2; - - // The data is plotted as a set of rectangular boxes (one box per series), - // with the boxes stacked vertically (the base of each box is the top of - // its predecessor, and the base of the first box is the X axis). Since - // the boxes do not overlap, each is filled with a different opaque color. - STACKED_BAR = 3; - - // The data is plotted as a heatmap. The series being plotted must have a - // `DISTRIBUTION` value type. The value of each bucket in the distribution - // is displayed as a color. This type is not currently available in the - // Stackdriver Monitoring application. - HEATMAP = 4; - } - - // An axis identifier. - enum TargetAxis { - // The target axis was not specified. Defaults to Y1. - TARGET_AXIS_UNSPECIFIED = 0; - - // The y_axis (the right axis of chart). - Y1 = 1; - - // The y2_axis (the left axis of chart). - Y2 = 2; - } - - // Required. Fields for querying time series data from the - // Stackdriver metrics API. - TimeSeriesQuery time_series_query = 1 - [(google.api.field_behavior) = REQUIRED]; - - // How this data should be plotted on the chart. - PlotType plot_type = 2; - - // A template string for naming `TimeSeries` in the resulting data set. - // This should be a string with interpolations of the form `${label_name}`, - // which will resolve to the label's value. - string legend_template = 3; - - // Optional. The lower bound on data point frequency for this data set, - // implemented by specifying the minimum alignment period to use in a time - // series query For example, if the data is published once every 10 minutes, - // the `min_alignment_period` should be at least 10 minutes. It would not - // make sense to fetch and align data at one minute intervals. - google.protobuf.Duration min_alignment_period = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The target axis to use for plotting the metric. - TargetAxis target_axis = 5 [(google.api.field_behavior) = OPTIONAL]; - } - - // A chart axis. - message Axis { - // Types of scales used in axes. - enum Scale { - // Scale is unspecified. The view will default to `LINEAR`. - SCALE_UNSPECIFIED = 0; - - // Linear scale. - LINEAR = 1; - - // Logarithmic scale (base 10). - LOG10 = 2; - } - - // The label of the axis. - string label = 1; - - // The axis scale. By default, a linear scale is used. - Scale scale = 2; - } - - // Required. The data displayed in this chart. - repeated DataSet data_sets = 1 [(google.api.field_behavior) = REQUIRED]; - - // The duration used to display a comparison chart. A comparison chart - // simultaneously shows values from two similar-length time periods - // (e.g., week-over-week metrics). - // The duration must be positive, and it can only be applied to charts with - // data sets of LINE plot type. - google.protobuf.Duration timeshift_duration = 4; - - // Threshold lines drawn horizontally across the chart. - repeated Threshold thresholds = 5; - - // The properties applied to the X axis. - Axis x_axis = 6; - - // The properties applied to the Y axis. - Axis y_axis = 7; - - // The properties applied to the Y2 axis. - Axis y2_axis = 9; - - // Display options for the chart. - ChartOptions chart_options = 8; -} - -// Options to control visual rendering of a chart. -message ChartOptions { - // Chart mode options. - enum Mode { - // Mode is unspecified. The view will default to `COLOR`. - MODE_UNSPECIFIED = 0; - - // The chart distinguishes data series using different color. Line - // colors may get reused when there are many lines in the chart. - COLOR = 1; - - // The chart uses the Stackdriver x-ray mode, in which each - // data set is plotted using the same semi-transparent color. - X_RAY = 2; - - // The chart displays statistics such as average, median, 95th percentile, - // and more. - STATS = 3; - } - - // The chart mode. - Mode mode = 1; -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.create_dashboard.js b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.create_dashboard.js deleted file mode 100644 index 64949d3b3e9..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.create_dashboard.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, dashboard) { - // [START monitoring_v1_generated_DashboardsService_CreateDashboard_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 on which to execute the request. The format is: - * projects/[PROJECT_ID_OR_NUMBER] - * The `[PROJECT_ID_OR_NUMBER]` must match the dashboard resource name. - */ - // const parent = 'abc123' - /** - * Required. The initial dashboard specification. - */ - // const dashboard = {} - /** - * If set, validate the request and preview the review, but do not actually - * save it. - */ - // const validateOnly = true - - // Imports the Dashboard library - const {DashboardsServiceClient} = require('@google-cloud/monitoring-dashboards').v1; - - // Instantiates a client - const dashboardClient = new DashboardsServiceClient(); - - async function callCreateDashboard() { - // Construct request - const request = { - parent, - dashboard, - }; - - // Run request - const response = await dashboardClient.createDashboard(request); - console.log(response); - } - - callCreateDashboard(); - // [END monitoring_v1_generated_DashboardsService_CreateDashboard_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.delete_dashboard.js b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.delete_dashboard.js deleted file mode 100644 index f64f97225b2..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.delete_dashboard.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 monitoring_v1_generated_DashboardsService_DeleteDashboard_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Dashboard. The format is: - * projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID] - */ - // const name = 'abc123' - - // Imports the Dashboard library - const {DashboardsServiceClient} = require('@google-cloud/monitoring-dashboards').v1; - - // Instantiates a client - const dashboardClient = new DashboardsServiceClient(); - - async function callDeleteDashboard() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dashboardClient.deleteDashboard(request); - console.log(response); - } - - callDeleteDashboard(); - // [END monitoring_v1_generated_DashboardsService_DeleteDashboard_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.get_dashboard.js b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.get_dashboard.js deleted file mode 100644 index 8820abd1184..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.get_dashboard.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 monitoring_v1_generated_DashboardsService_GetDashboard_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 Dashboard. The format is one of: - * - `dashboards/[DASHBOARD_ID]` (for system dashboards) - * - `projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]` - * (for custom dashboards). - */ - // const name = 'abc123' - - // Imports the Dashboard library - const {DashboardsServiceClient} = require('@google-cloud/monitoring-dashboards').v1; - - // Instantiates a client - const dashboardClient = new DashboardsServiceClient(); - - async function callGetDashboard() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dashboardClient.getDashboard(request); - console.log(response); - } - - callGetDashboard(); - // [END monitoring_v1_generated_DashboardsService_GetDashboard_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.list_dashboards.js b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.list_dashboards.js deleted file mode 100644 index 1f9873de807..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.list_dashboards.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 monitoring_v1_generated_DashboardsService_ListDashboards_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The scope of the dashboards to list. The format is: - * projects/[PROJECT_ID_OR_NUMBER] - */ - // const parent = 'abc123' - /** - * A positive number that is the maximum number of results to return. - * If unspecified, a default of 1000 is used. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Dashboard library - const {DashboardsServiceClient} = require('@google-cloud/monitoring-dashboards').v1; - - // Instantiates a client - const dashboardClient = new DashboardsServiceClient(); - - async function callListDashboards() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dashboardClient.listDashboardsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDashboards(); - // [END monitoring_v1_generated_DashboardsService_ListDashboards_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.update_dashboard.js b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.update_dashboard.js deleted file mode 100644 index 1c241bab3ef..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/dashboards_service.update_dashboard.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(dashboard) { - // [START monitoring_v1_generated_DashboardsService_UpdateDashboard_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The dashboard that will replace the existing dashboard. - */ - // const dashboard = {} - /** - * If set, validate the request and preview the review, but do not actually - * save it. - */ - // const validateOnly = true - - // Imports the Dashboard library - const {DashboardsServiceClient} = require('@google-cloud/monitoring-dashboards').v1; - - // Instantiates a client - const dashboardClient = new DashboardsServiceClient(); - - async function callUpdateDashboard() { - // Construct request - const request = { - dashboard, - }; - - // Run request - const response = await dashboardClient.updateDashboard(request); - console.log(response); - } - - callUpdateDashboard(); - // [END monitoring_v1_generated_DashboardsService_UpdateDashboard_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/snippet_metadata_google.monitoring.dashboard.v1.json b/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/snippet_metadata_google.monitoring.dashboard.v1.json deleted file mode 100644 index 4f2d486331b..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/samples/generated/v1/snippet_metadata_google.monitoring.dashboard.v1.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-dashboard", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.monitoring.dashboard.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "monitoring_v1_generated_DashboardsService_CreateDashboard_async", - "title": "DashboardsService createDashboard Sample", - "origin": "API_DEFINITION", - "description": " Creates a new custom dashboard. For examples on how you can use this API to create dashboards, see [Managing dashboards by API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](https://cloud.google.com/iam).", - "canonical": true, - "file": "dashboards_service.create_dashboard.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDashboard", - "fullName": "google.monitoring.dashboard.v1.DashboardsService.CreateDashboard", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "dashboard", - "type": ".google.monitoring.dashboard.v1.Dashboard" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.monitoring.dashboard.v1.Dashboard", - "client": { - "shortName": "DashboardsServiceClient", - "fullName": "google.monitoring.dashboard.v1.DashboardsServiceClient" - }, - "method": { - "shortName": "CreateDashboard", - "fullName": "google.monitoring.dashboard.v1.DashboardsService.CreateDashboard", - "service": { - "shortName": "DashboardsService", - "fullName": "google.monitoring.dashboard.v1.DashboardsService" - } - } - } - }, - { - "regionTag": "monitoring_v1_generated_DashboardsService_ListDashboards_async", - "title": "DashboardsService listDashboards Sample", - "origin": "API_DEFINITION", - "description": " Lists the existing dashboards. This method requires the `monitoring.dashboards.list` permission on the specified project. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).", - "canonical": true, - "file": "dashboards_service.list_dashboards.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDashboards", - "fullName": "google.monitoring.dashboard.v1.DashboardsService.ListDashboards", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.dashboard.v1.ListDashboardsResponse", - "client": { - "shortName": "DashboardsServiceClient", - "fullName": "google.monitoring.dashboard.v1.DashboardsServiceClient" - }, - "method": { - "shortName": "ListDashboards", - "fullName": "google.monitoring.dashboard.v1.DashboardsService.ListDashboards", - "service": { - "shortName": "DashboardsService", - "fullName": "google.monitoring.dashboard.v1.DashboardsService" - } - } - } - }, - { - "regionTag": "monitoring_v1_generated_DashboardsService_GetDashboard_async", - "title": "DashboardsService getDashboard Sample", - "origin": "API_DEFINITION", - "description": " Fetches a specific dashboard. This method requires the `monitoring.dashboards.get` permission on the specified dashboard. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).", - "canonical": true, - "file": "dashboards_service.get_dashboard.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDashboard", - "fullName": "google.monitoring.dashboard.v1.DashboardsService.GetDashboard", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.dashboard.v1.Dashboard", - "client": { - "shortName": "DashboardsServiceClient", - "fullName": "google.monitoring.dashboard.v1.DashboardsServiceClient" - }, - "method": { - "shortName": "GetDashboard", - "fullName": "google.monitoring.dashboard.v1.DashboardsService.GetDashboard", - "service": { - "shortName": "DashboardsService", - "fullName": "google.monitoring.dashboard.v1.DashboardsService" - } - } - } - }, - { - "regionTag": "monitoring_v1_generated_DashboardsService_DeleteDashboard_async", - "title": "DashboardsService deleteDashboard Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing custom dashboard. This method requires the `monitoring.dashboards.delete` permission on the specified dashboard. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).", - "canonical": true, - "file": "dashboards_service.delete_dashboard.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDashboard", - "fullName": "google.monitoring.dashboard.v1.DashboardsService.DeleteDashboard", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DashboardsServiceClient", - "fullName": "google.monitoring.dashboard.v1.DashboardsServiceClient" - }, - "method": { - "shortName": "DeleteDashboard", - "fullName": "google.monitoring.dashboard.v1.DashboardsService.DeleteDashboard", - "service": { - "shortName": "DashboardsService", - "fullName": "google.monitoring.dashboard.v1.DashboardsService" - } - } - } - }, - { - "regionTag": "monitoring_v1_generated_DashboardsService_UpdateDashboard_async", - "title": "DashboardsService updateDashboard Sample", - "origin": "API_DEFINITION", - "description": " Replaces an existing custom dashboard with a new definition. This method requires the `monitoring.dashboards.update` permission on the specified dashboard. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).", - "canonical": true, - "file": "dashboards_service.update_dashboard.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDashboard", - "fullName": "google.monitoring.dashboard.v1.DashboardsService.UpdateDashboard", - "async": true, - "parameters": [ - { - "name": "dashboard", - "type": ".google.monitoring.dashboard.v1.Dashboard" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.monitoring.dashboard.v1.Dashboard", - "client": { - "shortName": "DashboardsServiceClient", - "fullName": "google.monitoring.dashboard.v1.DashboardsServiceClient" - }, - "method": { - "shortName": "UpdateDashboard", - "fullName": "google.monitoring.dashboard.v1.DashboardsService.UpdateDashboard", - "service": { - "shortName": "DashboardsService", - "fullName": "google.monitoring.dashboard.v1.DashboardsService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/index.ts b/owl-bot-staging/google-monitoring-dashboard/v1/src/index.ts deleted file mode 100644 index c83a446c84e..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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 DashboardsServiceClient = v1.DashboardsServiceClient; -type DashboardsServiceClient = v1.DashboardsServiceClient; -export {v1, DashboardsServiceClient}; -export default {v1, DashboardsServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client.ts b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client.ts deleted file mode 100644 index 62f9e7fad67..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client.ts +++ /dev/null @@ -1,937 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/dashboards_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dashboards_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Manages Stackdriver dashboards. A dashboard is an arrangement of data display - * widgets in a specific layout. - * @class - * @memberof v1 - */ -export class DashboardsServiceClient { - 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}; - dashboardsServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DashboardsServiceClient. - * - * @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 DashboardsServiceClient({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 DashboardsServiceClient; - 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 = { - alertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - dashboardPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/dashboards/{dashboard}' - ), - 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 = { - listDashboards: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'dashboards') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.dashboard.v1.DashboardsService', 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.dashboardsServiceStub) { - return this.dashboardsServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.dashboard.v1.DashboardsService. - this.dashboardsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.dashboard.v1.DashboardsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.dashboard.v1.DashboardsService, - 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 dashboardsServiceStubMethods = - ['createDashboard', 'listDashboards', 'getDashboard', 'deleteDashboard', 'updateDashboard']; - for (const methodName of dashboardsServiceStubMethods) { - const callPromise = this.dashboardsServiceStub.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.dashboardsServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'monitoring.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 'monitoring.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/monitoring', - 'https://www.googleapis.com/auth/monitoring.read', - 'https://www.googleapis.com/auth/monitoring.write' - ]; - } - - 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 new custom dashboard. For examples on how you can use this API to - * create dashboards, see [Managing dashboards by - * API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This - * method requires the `monitoring.dashboards.create` permission on the - * specified project. For more information about permissions, see [Cloud - * Identity and Access Management](https://cloud.google.com/iam). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project on which to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * The `[PROJECT_ID_OR_NUMBER]` must match the dashboard resource name. - * @param {google.monitoring.dashboard.v1.Dashboard} request.dashboard - * Required. The initial dashboard specification. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * save it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.dashboard.v1.Dashboard|Dashboard}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dashboards_service.create_dashboard.js - * region_tag:monitoring_v1_generated_DashboardsService_CreateDashboard_async - */ - createDashboard( - request?: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|undefined, {}|undefined - ]>; - createDashboard( - request: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|null|undefined, - {}|null|undefined>): void; - createDashboard( - request: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest, - callback: Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|null|undefined, - {}|null|undefined>): void; - createDashboard( - request?: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.ICreateDashboardRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createDashboard(request, options, callback); - } -/** - * Fetches a specific dashboard. - * - * This method requires the `monitoring.dashboards.get` permission - * on the specified dashboard. For more information, see - * [Cloud Identity and Access Management](https://cloud.google.com/iam). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Dashboard. The format is one of: - * - * - `dashboards/[DASHBOARD_ID]` (for system dashboards) - * - `projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]` - * (for custom dashboards). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.dashboard.v1.Dashboard|Dashboard}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dashboards_service.get_dashboard.js - * region_tag:monitoring_v1_generated_DashboardsService_GetDashboard_async - */ - getDashboard( - request?: protos.google.monitoring.dashboard.v1.IGetDashboardRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IGetDashboardRequest|undefined, {}|undefined - ]>; - getDashboard( - request: protos.google.monitoring.dashboard.v1.IGetDashboardRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IGetDashboardRequest|null|undefined, - {}|null|undefined>): void; - getDashboard( - request: protos.google.monitoring.dashboard.v1.IGetDashboardRequest, - callback: Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IGetDashboardRequest|null|undefined, - {}|null|undefined>): void; - getDashboard( - request?: protos.google.monitoring.dashboard.v1.IGetDashboardRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IGetDashboardRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IGetDashboardRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IGetDashboardRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getDashboard(request, options, callback); - } -/** - * Deletes an existing custom dashboard. - * - * This method requires the `monitoring.dashboards.delete` permission - * on the specified dashboard. For more information, see - * [Cloud Identity and Access Management](https://cloud.google.com/iam). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Dashboard. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_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/dashboards_service.delete_dashboard.js - * region_tag:monitoring_v1_generated_DashboardsService_DeleteDashboard_async - */ - deleteDashboard( - request?: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|undefined, {}|undefined - ]>; - deleteDashboard( - request: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|null|undefined, - {}|null|undefined>): void; - deleteDashboard( - request: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|null|undefined, - {}|null|undefined>): void; - deleteDashboard( - request?: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteDashboard(request, options, callback); - } -/** - * Replaces an existing custom dashboard with a new definition. - * - * This method requires the `monitoring.dashboards.update` permission - * on the specified dashboard. For more information, see - * [Cloud Identity and Access Management](https://cloud.google.com/iam). - * - * @param {Object} request - * The request object that will be sent. - * @param {google.monitoring.dashboard.v1.Dashboard} request.dashboard - * Required. The dashboard that will replace the existing dashboard. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the review, but do not actually - * save it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.dashboard.v1.Dashboard|Dashboard}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/dashboards_service.update_dashboard.js - * region_tag:monitoring_v1_generated_DashboardsService_UpdateDashboard_async - */ - updateDashboard( - request?: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|undefined, {}|undefined - ]>; - updateDashboard( - request: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|null|undefined, - {}|null|undefined>): void; - updateDashboard( - request: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest, - callback: Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|null|undefined, - {}|null|undefined>): void; - updateDashboard( - request?: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.dashboard.v1.IDashboard, - protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'dashboard.name': request.dashboard!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateDashboard(request, options, callback); - } - - /** - * Lists the existing dashboards. - * - * This method requires the `monitoring.dashboards.list` permission - * on the specified project. For more information, see - * [Cloud Identity and Access Management](https://cloud.google.com/iam). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The scope of the dashboards to list. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * If unspecified, a default of 1000 is used. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.monitoring.dashboard.v1.Dashboard|Dashboard}. - * 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 `listDashboardsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDashboards( - request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.dashboard.v1.IDashboard[], - protos.google.monitoring.dashboard.v1.IListDashboardsRequest|null, - protos.google.monitoring.dashboard.v1.IListDashboardsResponse - ]>; - listDashboards( - request: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.dashboard.v1.IListDashboardsRequest, - protos.google.monitoring.dashboard.v1.IListDashboardsResponse|null|undefined, - protos.google.monitoring.dashboard.v1.IDashboard>): void; - listDashboards( - request: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, - callback: PaginationCallback< - protos.google.monitoring.dashboard.v1.IListDashboardsRequest, - protos.google.monitoring.dashboard.v1.IListDashboardsResponse|null|undefined, - protos.google.monitoring.dashboard.v1.IDashboard>): void; - listDashboards( - request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.dashboard.v1.IListDashboardsRequest, - protos.google.monitoring.dashboard.v1.IListDashboardsResponse|null|undefined, - protos.google.monitoring.dashboard.v1.IDashboard>, - callback?: PaginationCallback< - protos.google.monitoring.dashboard.v1.IListDashboardsRequest, - protos.google.monitoring.dashboard.v1.IListDashboardsResponse|null|undefined, - protos.google.monitoring.dashboard.v1.IDashboard>): - Promise<[ - protos.google.monitoring.dashboard.v1.IDashboard[], - protos.google.monitoring.dashboard.v1.IListDashboardsRequest|null, - protos.google.monitoring.dashboard.v1.IListDashboardsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listDashboards(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 scope of the dashboards to list. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * If unspecified, a default of 1000 is used. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.dashboard.v1.Dashboard|Dashboard} 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 `listDashboardsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDashboardsStream( - request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, - 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['listDashboards']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDashboards.createStream( - this.innerApiCalls.listDashboards as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDashboards`, 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 scope of the dashboards to list. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * If unspecified, a default of 1000 is used. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.dashboard.v1.Dashboard|Dashboard}. 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/dashboards_service.list_dashboards.js - * region_tag:monitoring_v1_generated_DashboardsService_ListDashboards_async - */ - listDashboardsAsync( - request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, - 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['listDashboards']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDashboards.asyncIterate( - this.innerApiCalls['listDashboards'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - alertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.alertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from AlertPolicy resource. - * - * @param {string} alertPolicyName - * A fully-qualified path representing AlertPolicy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertPolicyName(alertPolicyName: string) { - return this.pathTemplates.alertPolicyPathTemplate.match(alertPolicyName).project; - } - - /** - * Parse the alert_policy from AlertPolicy resource. - * - * @param {string} alertPolicyName - * A fully-qualified path representing AlertPolicy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromAlertPolicyName(alertPolicyName: string) { - return this.pathTemplates.alertPolicyPathTemplate.match(alertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified dashboard resource name string. - * - * @param {string} project - * @param {string} dashboard - * @returns {string} Resource name string. - */ - dashboardPath(project:string,dashboard:string) { - return this.pathTemplates.dashboardPathTemplate.render({ - project: project, - dashboard: dashboard, - }); - } - - /** - * Parse the project from Dashboard resource. - * - * @param {string} dashboardName - * A fully-qualified path representing Dashboard resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDashboardName(dashboardName: string) { - return this.pathTemplates.dashboardPathTemplate.match(dashboardName).project; - } - - /** - * Parse the dashboard from Dashboard resource. - * - * @param {string} dashboardName - * A fully-qualified path representing Dashboard resource. - * @returns {string} A string representing the dashboard. - */ - matchDashboardFromDashboardName(dashboardName: string) { - return this.pathTemplates.dashboardPathTemplate.match(dashboardName).dashboard; - } - - /** - * 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.dashboardsServiceStub && !this._terminated) { - return this.dashboardsServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client_config.json b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client_config.json deleted file mode 100644 index 1b2f284ce9f..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_client_config.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "interfaces": { - "google.monitoring.dashboard.v1.DashboardsService": { - "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": { - "CreateDashboard": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDashboards": { - "timeout_millis": 30000, - "retry_codes_name": "unknown_unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetDashboard": { - "timeout_millis": 30000, - "retry_codes_name": "unknown_unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteDashboard": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDashboard": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_proto_list.json b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_proto_list.json deleted file mode 100644 index c084fbb63f9..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/dashboards_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/monitoring/dashboard/v1/alertchart.proto", - "../../protos/google/monitoring/dashboard/v1/collapsible_group.proto", - "../../protos/google/monitoring/dashboard/v1/common.proto", - "../../protos/google/monitoring/dashboard/v1/dashboard.proto", - "../../protos/google/monitoring/dashboard/v1/dashboard_filter.proto", - "../../protos/google/monitoring/dashboard/v1/dashboards_service.proto", - "../../protos/google/monitoring/dashboard/v1/drilldowns.proto", - "../../protos/google/monitoring/dashboard/v1/layouts.proto", - "../../protos/google/monitoring/dashboard/v1/logs_panel.proto", - "../../protos/google/monitoring/dashboard/v1/metrics.proto", - "../../protos/google/monitoring/dashboard/v1/scorecard.proto", - "../../protos/google/monitoring/dashboard/v1/service.proto", - "../../protos/google/monitoring/dashboard/v1/table.proto", - "../../protos/google/monitoring/dashboard/v1/table_display_options.proto", - "../../protos/google/monitoring/dashboard/v1/text.proto", - "../../protos/google/monitoring/dashboard/v1/widget.proto", - "../../protos/google/monitoring/dashboard/v1/xychart.proto" -] diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/gapic_metadata.json deleted file mode 100644 index b310e5783de..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/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.monitoring.dashboard.v1", - "libraryPackage": "@google-cloud/monitoring-dashboards", - "services": { - "DashboardsService": { - "clients": { - "grpc": { - "libraryClient": "DashboardsServiceClient", - "rpcs": { - "CreateDashboard": { - "methods": [ - "createDashboard" - ] - }, - "GetDashboard": { - "methods": [ - "getDashboard" - ] - }, - "DeleteDashboard": { - "methods": [ - "deleteDashboard" - ] - }, - "UpdateDashboard": { - "methods": [ - "updateDashboard" - ] - }, - "ListDashboards": { - "methods": [ - "listDashboards", - "listDashboardsStream", - "listDashboardsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DashboardsServiceClient", - "rpcs": { - "CreateDashboard": { - "methods": [ - "createDashboard" - ] - }, - "GetDashboard": { - "methods": [ - "getDashboard" - ] - }, - "DeleteDashboard": { - "methods": [ - "deleteDashboard" - ] - }, - "UpdateDashboard": { - "methods": [ - "updateDashboard" - ] - }, - "ListDashboards": { - "methods": [ - "listDashboards", - "listDashboardsStream", - "listDashboardsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/index.ts b/owl-bot-staging/google-monitoring-dashboard/v1/src/v1/index.ts deleted file mode 100644 index 749483a969e..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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 {DashboardsServiceClient} from './dashboards_service_client'; diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 883a89ca8cd..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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 dashboard = require('@google-cloud/monitoring-dashboards'); - -function main() { - const dashboardsServiceClient = new dashboard.DashboardsServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-monitoring-dashboard/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index bfd0a7a4b63..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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 {DashboardsServiceClient} from '@google-cloud/monitoring-dashboards'; - -// check that the client class type name can be used -function doStuffWithDashboardsServiceClient(client: DashboardsServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const dashboardsServiceClient = new DashboardsServiceClient(); - doStuffWithDashboardsServiceClient(dashboardsServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-monitoring-dashboard/v1/system-test/install.ts b/owl-bot-staging/google-monitoring-dashboard/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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-monitoring-dashboard/v1/test/gapic_dashboards_service_v1.ts b/owl-bot-staging/google-monitoring-dashboard/v1/test/gapic_dashboards_service_v1.ts deleted file mode 100644 index 1189781d839..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/v1/test/gapic_dashboards_service_v1.ts +++ /dev/null @@ -1,987 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 dashboardsserviceModule 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.DashboardsServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dashboardsserviceModule.v1.DashboardsServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dashboardsserviceModule.v1.DashboardsServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dashboardsserviceModule.v1.DashboardsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dashboardsServiceStub, undefined); - await client.initialize(); - assert(client.dashboardsServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dashboardsServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dashboardsServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - 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 dashboardsserviceModule.v1.DashboardsServiceClient({ - 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('createDashboard', () => { - it('invokes createDashboard without error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.CreateDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.CreateDashboardRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.Dashboard() - ); - client.innerApiCalls.createDashboard = stubSimpleCall(expectedResponse); - const [response] = await client.createDashboard(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDashboard without error using callback', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.CreateDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.CreateDashboardRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.Dashboard() - ); - client.innerApiCalls.createDashboard = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDashboard( - request, - (err?: Error|null, result?: protos.google.monitoring.dashboard.v1.IDashboard|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDashboard with error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.CreateDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.CreateDashboardRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDashboard = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDashboard(request), expectedError); - const actualRequest = (client.innerApiCalls.createDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDashboard with closed client', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.CreateDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.CreateDashboardRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createDashboard(request), expectedError); - }); - }); - - describe('getDashboard', () => { - it('invokes getDashboard without error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.GetDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.GetDashboardRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.Dashboard() - ); - client.innerApiCalls.getDashboard = stubSimpleCall(expectedResponse); - const [response] = await client.getDashboard(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDashboard without error using callback', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.GetDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.GetDashboardRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.Dashboard() - ); - client.innerApiCalls.getDashboard = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDashboard( - request, - (err?: Error|null, result?: protos.google.monitoring.dashboard.v1.IDashboard|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDashboard with error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.GetDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.GetDashboardRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDashboard = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDashboard(request), expectedError); - const actualRequest = (client.innerApiCalls.getDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDashboard with closed client', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.GetDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.GetDashboardRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDashboard(request), expectedError); - }); - }); - - describe('deleteDashboard', () => { - it('invokes deleteDashboard without error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.DeleteDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.DeleteDashboardRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDashboard = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDashboard(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDashboard without error using callback', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.DeleteDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.DeleteDashboardRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDashboard = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDashboard( - 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.deleteDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDashboard with error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.DeleteDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.DeleteDashboardRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDashboard = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDashboard(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDashboard with closed client', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.DeleteDashboardRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.DeleteDashboardRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteDashboard(request), expectedError); - }); - }); - - describe('updateDashboard', () => { - it('invokes updateDashboard without error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.UpdateDashboardRequest() - ); - request.dashboard ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.UpdateDashboardRequest', ['dashboard', 'name']); - request.dashboard.name = defaultValue1; - const expectedHeaderRequestParams = `dashboard.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.Dashboard() - ); - client.innerApiCalls.updateDashboard = stubSimpleCall(expectedResponse); - const [response] = await client.updateDashboard(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDashboard without error using callback', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.UpdateDashboardRequest() - ); - request.dashboard ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.UpdateDashboardRequest', ['dashboard', 'name']); - request.dashboard.name = defaultValue1; - const expectedHeaderRequestParams = `dashboard.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.Dashboard() - ); - client.innerApiCalls.updateDashboard = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDashboard( - request, - (err?: Error|null, result?: protos.google.monitoring.dashboard.v1.IDashboard|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDashboard with error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.UpdateDashboardRequest() - ); - request.dashboard ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.UpdateDashboardRequest', ['dashboard', 'name']); - request.dashboard.name = defaultValue1; - const expectedHeaderRequestParams = `dashboard.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDashboard = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDashboard(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDashboard as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDashboard as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDashboard with closed client', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.UpdateDashboardRequest() - ); - request.dashboard ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.UpdateDashboardRequest', ['dashboard', 'name']); - request.dashboard.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateDashboard(request), expectedError); - }); - }); - - describe('listDashboards', () => { - it('invokes listDashboards without error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - ]; - client.innerApiCalls.listDashboards = stubSimpleCall(expectedResponse); - const [response] = await client.listDashboards(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDashboards as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDashboards as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDashboards without error using callback', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - ]; - client.innerApiCalls.listDashboards = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDashboards( - request, - (err?: Error|null, result?: protos.google.monitoring.dashboard.v1.IDashboard[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDashboards as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDashboards as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDashboards with error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDashboards = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDashboards(request), expectedError); - const actualRequest = (client.innerApiCalls.listDashboards as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDashboards as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDashboardsStream without error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - ]; - client.descriptors.page.listDashboards.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDashboardsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.dashboard.v1.Dashboard[] = []; - stream.on('data', (response: protos.google.monitoring.dashboard.v1.Dashboard) => { - 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.listDashboards.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDashboards, request)); - assert( - (client.descriptors.page.listDashboards.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDashboardsStream with error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDashboards.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDashboardsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.dashboard.v1.Dashboard[] = []; - stream.on('data', (response: protos.google.monitoring.dashboard.v1.Dashboard) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDashboards.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDashboards, request)); - assert( - (client.descriptors.page.listDashboards.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDashboards without error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - generateSampleMessage(new protos.google.monitoring.dashboard.v1.Dashboard()), - ]; - client.descriptors.page.listDashboards.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.dashboard.v1.IDashboard[] = []; - const iterable = client.listDashboardsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDashboards.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDashboards.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDashboards with error', async () => { - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.dashboard.v1.ListDashboardsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.dashboard.v1.ListDashboardsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDashboards.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDashboardsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.dashboard.v1.IDashboard[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDashboards.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDashboards.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertPolicy', () => { - const fakePath = "/rendered/path/alertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.alertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertPolicyPath', () => { - const result = client.alertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertPolicyName', () => { - const result = client.matchProjectFromAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromAlertPolicyName', () => { - const result = client.matchAlertPolicyFromAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.alertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('dashboard', () => { - const fakePath = "/rendered/path/dashboard"; - const expectedParameters = { - project: "projectValue", - dashboard: "dashboardValue", - }; - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.dashboardPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dashboardPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dashboardPath', () => { - const result = client.dashboardPath("projectValue", "dashboardValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dashboardPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDashboardName', () => { - const result = client.matchProjectFromDashboardName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dashboardPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDashboardFromDashboardName', () => { - const result = client.matchDashboardFromDashboardName(fakePath); - assert.strictEqual(result, "dashboardValue"); - assert((client.pathTemplates.dashboardPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dashboardsserviceModule.v1.DashboardsServiceClient({ - 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-monitoring-dashboard/v1/tsconfig.json b/owl-bot-staging/google-monitoring-dashboard/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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-monitoring-dashboard/v1/webpack.config.js b/owl-bot-staging/google-monitoring-dashboard/v1/webpack.config.js deleted file mode 100644 index 5b23dff4a2f..00000000000 --- a/owl-bot-staging/google-monitoring-dashboard/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: 'DashboardsService', - filename: './dashboards-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-privacy-dlp/v2/.eslintignore b/owl-bot-staging/google-privacy-dlp/v2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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-privacy-dlp/v2/.eslintrc.json b/owl-bot-staging/google-privacy-dlp/v2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-privacy-dlp/v2/.gitignore b/owl-bot-staging/google-privacy-dlp/v2/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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-privacy-dlp/v2/.jsdoc.js b/owl-bot-staging/google-privacy-dlp/v2/.jsdoc.js deleted file mode 100644 index dd75f52f62c..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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/dlp', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-privacy-dlp/v2/.mocharc.js b/owl-bot-staging/google-privacy-dlp/v2/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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-privacy-dlp/v2/.prettierrc.js b/owl-bot-staging/google-privacy-dlp/v2/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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-privacy-dlp/v2/README.md b/owl-bot-staging/google-privacy-dlp/v2/README.md deleted file mode 100644 index cb63619c6c4..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Dlp: Nodejs Client diff --git a/owl-bot-staging/google-privacy-dlp/v2/package.json b/owl-bot-staging/google-privacy-dlp/v2/package.json deleted file mode 100644 index c6d0180feac..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/dlp", - "version": "0.1.0", - "description": "Dlp client for Node.js", - "repository": "googleapis/nodejs-dlp", - "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 dlp", - "dlp", - "dlp 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-privacy-dlp/v2/protos/google/privacy/dlp/v2/dlp.proto b/owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/dlp.proto deleted file mode 100644 index 1b185261662..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/dlp.proto +++ /dev/null @@ -1,5400 +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.privacy.dlp.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/privacy/dlp/v2/storage.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/date.proto"; -import "google/type/dayofweek.proto"; -import "google/type/timeofday.proto"; - -option csharp_namespace = "Google.Cloud.Dlp.V2"; -option go_package = "cloud.google.com/go/dlp/apiv2/dlppb;dlppb"; -option java_multiple_files = true; -option java_outer_classname = "DlpProto"; -option java_package = "com.google.privacy.dlp.v2"; -option php_namespace = "Google\\Cloud\\Dlp\\V2"; -option ruby_package = "Google::Cloud::Dlp::V2"; -option (google.api.resource_definition) = { - type: "dlp.googleapis.com/DlpContent" - pattern: "projects/{project}/dlpContent" - pattern: "projects/{project}/locations/{location}/dlpContent" -}; -option (google.api.resource_definition) = { - type: "dlp.googleapis.com/OrganizationLocation" - pattern: "organizations/{organization}/locations/{location}" -}; - -// The Cloud Data Loss Prevention (DLP) API is a service that allows clients -// to detect the presence of Personally Identifiable Information (PII) and other -// privacy-sensitive data in user-supplied, unstructured data streams, like text -// blocks or images. -// The service also includes methods for sensitive data redaction and -// scheduling of data scans on Google Cloud Platform based data sets. -// -// To learn more about concepts and find how-to guides see -// https://cloud.google.com/dlp/docs/. -service DlpService { - option (google.api.default_host) = "dlp.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Finds potentially sensitive info in content. - // This method has limits on input size, processing time, and output size. - // - // When no InfoTypes or CustomInfoTypes are specified in this request, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - // - // For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images - // and https://cloud.google.com/dlp/docs/inspecting-text, - rpc InspectContent(InspectContentRequest) returns (InspectContentResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/content:inspect" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/content:inspect" - body: "*" - } - }; - } - - // Redacts potentially sensitive info from an image. - // This method has limits on input size, processing time, and output size. - // See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to - // learn more. - // - // When no InfoTypes or CustomInfoTypes are specified in this request, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - rpc RedactImage(RedactImageRequest) returns (RedactImageResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/image:redact" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/image:redact" - body: "*" - } - }; - } - - // De-identifies potentially sensitive info from a ContentItem. - // This method has limits on input size and output size. - // See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to - // learn more. - // - // When no InfoTypes or CustomInfoTypes are specified in this request, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - rpc DeidentifyContent(DeidentifyContentRequest) returns (DeidentifyContentResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/content:deidentify" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/content:deidentify" - body: "*" - } - }; - } - - // Re-identifies content that has been de-identified. - // See - // https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example - // to learn more. - rpc ReidentifyContent(ReidentifyContentRequest) returns (ReidentifyContentResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/content:reidentify" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/content:reidentify" - body: "*" - } - }; - } - - // Returns a list of the sensitive information types that DLP API - // supports. See https://cloud.google.com/dlp/docs/infotypes-reference to - // learn more. - rpc ListInfoTypes(ListInfoTypesRequest) returns (ListInfoTypesResponse) { - option (google.api.http) = { - get: "/v2/infoTypes" - additional_bindings { - get: "/v2/{parent=locations/*}/infoTypes" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Creates an InspectTemplate for reusing frequently used configuration - // for inspecting content, images, and storage. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc CreateInspectTemplate(CreateInspectTemplateRequest) returns (InspectTemplate) { - option (google.api.http) = { - post: "/v2/{parent=organizations/*}/inspectTemplates" - body: "*" - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*}/inspectTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/inspectTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/inspectTemplates" - body: "*" - } - }; - option (google.api.method_signature) = "parent,inspect_template"; - } - - // Updates the InspectTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc UpdateInspectTemplate(UpdateInspectTemplateRequest) returns (InspectTemplate) { - option (google.api.http) = { - patch: "/v2/{name=organizations/*/inspectTemplates/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/inspectTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,inspect_template,update_mask"; - } - - // Gets an InspectTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc GetInspectTemplate(GetInspectTemplateRequest) returns (InspectTemplate) { - option (google.api.http) = { - get: "/v2/{name=organizations/*/inspectTemplates/*}" - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/inspectTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists InspectTemplates. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc ListInspectTemplates(ListInspectTemplatesRequest) returns (ListInspectTemplatesResponse) { - option (google.api.http) = { - get: "/v2/{parent=organizations/*}/inspectTemplates" - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*}/inspectTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*}/inspectTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/inspectTemplates" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes an InspectTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc DeleteInspectTemplate(DeleteInspectTemplateRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=organizations/*/inspectTemplates/*}" - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/inspectTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a DeidentifyTemplate for reusing frequently used configuration - // for de-identifying content, images, and storage. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc CreateDeidentifyTemplate(CreateDeidentifyTemplateRequest) returns (DeidentifyTemplate) { - option (google.api.http) = { - post: "/v2/{parent=organizations/*}/deidentifyTemplates" - body: "*" - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*}/deidentifyTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/deidentifyTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/deidentifyTemplates" - body: "*" - } - }; - option (google.api.method_signature) = "parent,deidentify_template"; - } - - // Updates the DeidentifyTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc UpdateDeidentifyTemplate(UpdateDeidentifyTemplateRequest) returns (DeidentifyTemplate) { - option (google.api.http) = { - patch: "/v2/{name=organizations/*/deidentifyTemplates/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/deidentifyTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,deidentify_template,update_mask"; - } - - // Gets a DeidentifyTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc GetDeidentifyTemplate(GetDeidentifyTemplateRequest) returns (DeidentifyTemplate) { - option (google.api.http) = { - get: "/v2/{name=organizations/*/deidentifyTemplates/*}" - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/deidentifyTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists DeidentifyTemplates. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc ListDeidentifyTemplates(ListDeidentifyTemplatesRequest) returns (ListDeidentifyTemplatesResponse) { - option (google.api.http) = { - get: "/v2/{parent=organizations/*}/deidentifyTemplates" - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*}/deidentifyTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*}/deidentifyTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/deidentifyTemplates" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a DeidentifyTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc DeleteDeidentifyTemplate(DeleteDeidentifyTemplateRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=organizations/*/deidentifyTemplates/*}" - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/deidentifyTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a job trigger to run DLP actions such as scanning storage for - // sensitive information on a set schedule. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc CreateJobTrigger(CreateJobTriggerRequest) returns (JobTrigger) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/jobTriggers" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/jobTriggers" - body: "*" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*}/jobTriggers" - body: "*" - } - }; - option (google.api.method_signature) = "parent,job_trigger"; - } - - // Updates a job trigger. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc UpdateJobTrigger(UpdateJobTriggerRequest) returns (JobTrigger) { - option (google.api.http) = { - patch: "/v2/{name=projects/*/jobTriggers/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/jobTriggers/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/jobTriggers/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,job_trigger,update_mask"; - } - - // Inspect hybrid content and store findings to a trigger. The inspection - // will be processed asynchronously. To review the findings monitor the - // jobs within the trigger. - rpc HybridInspectJobTrigger(HybridInspectJobTriggerRequest) returns (HybridInspectResponse) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/jobTriggers/*}:hybridInspect" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a job trigger. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc GetJobTrigger(GetJobTriggerRequest) returns (JobTrigger) { - option (google.api.http) = { - get: "/v2/{name=projects/*/jobTriggers/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/jobTriggers/*}" - } - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/jobTriggers/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists job triggers. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc ListJobTriggers(ListJobTriggersRequest) returns (ListJobTriggersResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/jobTriggers" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/jobTriggers" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*}/jobTriggers" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a job trigger. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc DeleteJobTrigger(DeleteJobTriggerRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/jobTriggers/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/jobTriggers/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/jobTriggers/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Activate a job trigger. Causes the immediate execute of a trigger - // instead of waiting on the trigger event to occur. - rpc ActivateJobTrigger(ActivateJobTriggerRequest) returns (DlpJob) { - option (google.api.http) = { - post: "/v2/{name=projects/*/jobTriggers/*}:activate" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/jobTriggers/*}:activate" - body: "*" - } - }; - } - - // Creates a new job to inspect storage or calculate risk metrics. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - // - // When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - rpc CreateDlpJob(CreateDlpJobRequest) returns (DlpJob) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/dlpJobs" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/dlpJobs" - body: "*" - } - }; - option (google.api.method_signature) = "parent,inspect_job"; - option (google.api.method_signature) = "parent,risk_job"; - } - - // Lists DlpJobs that match the specified filter in the request. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc ListDlpJobs(ListDlpJobsRequest) returns (ListDlpJobsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/dlpJobs" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/dlpJobs" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*}/dlpJobs" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the latest state of a long-running DlpJob. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc GetDlpJob(GetDlpJobRequest) returns (DlpJob) { - option (google.api.http) = { - get: "/v2/{name=projects/*/dlpJobs/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/dlpJobs/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a long-running DlpJob. This method indicates that the client is - // no longer interested in the DlpJob result. The job will be canceled if - // possible. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc DeleteDlpJob(DeleteDlpJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/dlpJobs/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/dlpJobs/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Starts asynchronous cancellation on a long-running DlpJob. The server - // makes a best effort to cancel the DlpJob, but success is not - // guaranteed. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc CancelDlpJob(CancelDlpJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v2/{name=projects/*/dlpJobs/*}:cancel" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/dlpJobs/*}:cancel" - body: "*" - } - }; - } - - // Creates a pre-built stored infoType to be used for inspection. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc CreateStoredInfoType(CreateStoredInfoTypeRequest) returns (StoredInfoType) { - option (google.api.http) = { - post: "/v2/{parent=organizations/*}/storedInfoTypes" - body: "*" - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*}/storedInfoTypes" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/storedInfoTypes" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/storedInfoTypes" - body: "*" - } - }; - option (google.api.method_signature) = "parent,config"; - } - - // Updates the stored infoType by creating a new version. The existing version - // will continue to be used until the new version is ready. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc UpdateStoredInfoType(UpdateStoredInfoTypeRequest) returns (StoredInfoType) { - option (google.api.http) = { - patch: "/v2/{name=organizations/*/storedInfoTypes/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/storedInfoTypes/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,config,update_mask"; - } - - // Gets a stored infoType. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc GetStoredInfoType(GetStoredInfoTypeRequest) returns (StoredInfoType) { - option (google.api.http) = { - get: "/v2/{name=organizations/*/storedInfoTypes/*}" - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/storedInfoTypes/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists stored infoTypes. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc ListStoredInfoTypes(ListStoredInfoTypesRequest) returns (ListStoredInfoTypesResponse) { - option (google.api.http) = { - get: "/v2/{parent=organizations/*}/storedInfoTypes" - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*}/storedInfoTypes" - } - additional_bindings { - get: "/v2/{parent=projects/*}/storedInfoTypes" - } - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/storedInfoTypes" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a stored infoType. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc DeleteStoredInfoType(DeleteStoredInfoTypeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=organizations/*/storedInfoTypes/*}" - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/storedInfoTypes/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Inspect hybrid content and store findings to a job. - // To review the findings, inspect the job. Inspection will occur - // asynchronously. - rpc HybridInspectDlpJob(HybridInspectDlpJobRequest) returns (HybridInspectResponse) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/dlpJobs/*}:hybridInspect" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Finish a running hybrid DlpJob. Triggers the finalization steps and running - // of any enabled actions that have not yet run. - rpc FinishDlpJob(FinishDlpJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/dlpJobs/*}:finish" - body: "*" - }; - } -} - -// List of excluded infoTypes. -message ExcludeInfoTypes { - // InfoType list in ExclusionRule rule drops a finding when it overlaps or - // contained within with a finding of an infoType from this list. For - // example, for `InspectionRuleSet.info_types` containing "PHONE_NUMBER"` and - // `exclusion_rule` containing `exclude_info_types.info_types` with - // "EMAIL_ADDRESS" the phone number findings are dropped if they overlap - // with EMAIL_ADDRESS finding. - // That leads to "555-222-2222@example.org" to generate only a single - // finding, namely email address. - repeated InfoType info_types = 1; -} - -// The rule to exclude findings based on a hotword. For record inspection of -// tables, column names are considered hotwords. An example of this is to -// exclude a finding if a BigQuery column matches a specific pattern. -message ExcludeByHotword { - // Regular expression pattern defining what qualifies as a hotword. - CustomInfoType.Regex hotword_regex = 1; - - // Range of characters within which the entire hotword must reside. - // The total length of the window cannot exceed 1000 characters. - // The windowBefore property in proximity should be set to 1 if the hotword - // needs to be included in a column header. - CustomInfoType.DetectionRule.Proximity proximity = 2; -} - -// The rule that specifies conditions when findings of infoTypes specified in -// `InspectionRuleSet` are removed from results. -message ExclusionRule { - // Exclusion rule types. - oneof type { - // Dictionary which defines the rule. - CustomInfoType.Dictionary dictionary = 1; - - // Regular expression which defines the rule. - CustomInfoType.Regex regex = 2; - - // Set of infoTypes for which findings would affect this rule. - ExcludeInfoTypes exclude_info_types = 3; - - // Drop if the hotword rule is contained in the proximate context. For - // tabular data, the context includes the column name. - ExcludeByHotword exclude_by_hotword = 5; - } - - // How the rule is applied, see MatchingType documentation for details. - MatchingType matching_type = 4; -} - -// A single inspection rule to be applied to infoTypes, specified in -// `InspectionRuleSet`. -message InspectionRule { - // Inspection rule types. - oneof type { - // Hotword-based detection rule. - CustomInfoType.DetectionRule.HotwordRule hotword_rule = 1; - - // Exclusion rule. - ExclusionRule exclusion_rule = 2; - } -} - -// Rule set for modifying a set of infoTypes to alter behavior under certain -// circumstances, depending on the specific details of the rules within the set. -message InspectionRuleSet { - // List of infoTypes this rule set is applied to. - repeated InfoType info_types = 1; - - // Set of rules to be applied to infoTypes. The rules are applied in order. - repeated InspectionRule rules = 2; -} - -// Configuration description of the scanning process. -// When used with redactContent only info_types and min_likelihood are currently -// used. -message InspectConfig { - // Configuration to control the number of findings returned for inspection. - // This is not used for de-identification or data profiling. - // - // When redacting sensitive data from images, finding limits don't apply. They - // can cause unexpected or inconsistent results, where only some data is - // redacted. Don't include finding limits in - // [RedactImage][google.privacy.dlp.v2.DlpService.RedactImage] - // requests. Otherwise, Cloud DLP returns an error. - message FindingLimits { - // Max findings configuration per infoType, per content item or long - // running DlpJob. - message InfoTypeLimit { - // Type of information the findings limit applies to. Only one limit per - // info_type should be provided. If InfoTypeLimit does not have an - // info_type, the DLP API applies the limit against all info_types that - // are found but not specified in another InfoTypeLimit. - InfoType info_type = 1; - - // Max findings limit for the given infoType. - int32 max_findings = 2; - } - - // Max number of findings that will be returned for each item scanned. - // When set within `InspectJobConfig`, - // the maximum returned is 2000 regardless if this is set higher. - // When set within `InspectContentRequest`, this field is ignored. - int32 max_findings_per_item = 1; - - // Max number of findings that will be returned per request/job. - // When set within `InspectContentRequest`, the maximum returned is 2000 - // regardless if this is set higher. - int32 max_findings_per_request = 2; - - // Configuration of findings limit given for specified infoTypes. - repeated InfoTypeLimit max_findings_per_info_type = 3; - } - - // Restricts what info_types to look for. The values must correspond to - // InfoType values returned by ListInfoTypes or listed at - // https://cloud.google.com/dlp/docs/infotypes-reference. - // - // When no InfoTypes or CustomInfoTypes are specified in a request, the - // system may automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - // - // If you need precise control and predictability as to what detectors are - // run you should specify specific InfoTypes listed in the reference, - // otherwise a default list will be used, which may change over time. - repeated InfoType info_types = 1; - - // Only returns findings equal or above this threshold. The default is - // POSSIBLE. - // See https://cloud.google.com/dlp/docs/likelihood to learn more. - Likelihood min_likelihood = 2; - - // Configuration to control the number of findings returned. - // This is not used for data profiling. - // - // When redacting sensitive data from images, finding limits don't apply. They - // can cause unexpected or inconsistent results, where only some data is - // redacted. Don't include finding limits in - // [RedactImage][google.privacy.dlp.v2.DlpService.RedactImage] - // requests. Otherwise, Cloud DLP returns an error. - FindingLimits limits = 3; - - // When true, a contextual quote from the data that triggered a finding is - // included in the response; see [Finding.quote][google.privacy.dlp.v2.Finding.quote]. - // This is not used for data profiling. - bool include_quote = 4; - - // When true, excludes type information of the findings. - // This is not used for data profiling. - bool exclude_info_types = 5; - - // CustomInfoTypes provided by the user. See - // https://cloud.google.com/dlp/docs/creating-custom-infotypes to learn more. - repeated CustomInfoType custom_info_types = 6; - - // Deprecated and unused. - repeated ContentOption content_options = 8; - - // Set of rules to apply to the findings for this InspectConfig. - // Exclusion rules, contained in the set are executed in the end, other - // rules are executed in the order they are specified for each info type. - repeated InspectionRuleSet rule_set = 10; -} - -// Container for bytes to inspect or redact. -message ByteContentItem { - // The type of data being sent for inspection. To learn more, see - // [Supported file - // types](https://cloud.google.com/dlp/docs/supported-file-types). - enum BytesType { - // Unused - BYTES_TYPE_UNSPECIFIED = 0; - - // Any image type. - IMAGE = 6; - - // jpeg - IMAGE_JPEG = 1; - - // bmp - IMAGE_BMP = 2; - - // png - IMAGE_PNG = 3; - - // svg - IMAGE_SVG = 4; - - // plain text - TEXT_UTF8 = 5; - - // docx, docm, dotx, dotm - WORD_DOCUMENT = 7; - - // pdf - PDF = 8; - - // pptx, pptm, potx, potm, pot - POWERPOINT_DOCUMENT = 9; - - // xlsx, xlsm, xltx, xltm - EXCEL_DOCUMENT = 10; - - // avro - AVRO = 11; - - // csv - CSV = 12; - - // tsv - TSV = 13; - } - - // The type of data stored in the bytes string. Default will be TEXT_UTF8. - BytesType type = 1; - - // Content data to inspect or redact. - bytes data = 2; -} - -message ContentItem { - // Data of the item either in the byte array or UTF-8 string form, or table. - oneof data_item { - // String data to inspect or redact. - string value = 3; - - // Structured content for inspection. See - // https://cloud.google.com/dlp/docs/inspecting-text#inspecting_a_table to - // learn more. - Table table = 4; - - // Content data to inspect or redact. Replaces `type` and `data`. - ByteContentItem byte_item = 5; - } -} - -// Structured content to inspect. Up to 50,000 `Value`s per request allowed. See -// https://cloud.google.com/dlp/docs/inspecting-structured-text#inspecting_a_table -// to learn more. -message Table { - // Values of the row. - message Row { - // Individual cells. - repeated Value values = 1; - } - - // Headers of the table. - repeated FieldId headers = 1; - - // Rows of the table. - repeated Row rows = 2; -} - -// All the findings for a single scanned item. -message InspectResult { - // List of findings for an item. - repeated Finding findings = 1; - - // If true, then this item might have more findings than were returned, - // and the findings returned are an arbitrary subset of all findings. - // The findings list might be truncated because the input items were too - // large, or because the server reached the maximum amount of resources - // allowed for a single API call. For best results, divide the input into - // smaller batches. - bool findings_truncated = 2; -} - -// Represents a piece of potentially sensitive content. -message Finding { - option (google.api.resource) = { - type: "dlp.googleapis.com/Finding" - pattern: "projects/{project}/locations/{location}/findings/{finding}" - }; - - // Resource name in format - // projects/{project}/locations/{location}/findings/{finding} Populated only - // when viewing persisted findings. - string name = 14; - - // The content that was found. Even if the content is not textual, it - // may be converted to a textual representation here. - // Provided if `include_quote` is true and the finding is - // less than or equal to 4096 bytes long. If the finding exceeds 4096 bytes - // in length, the quote may be omitted. - string quote = 1; - - // The type of content that might have been found. - // Provided if `excluded_types` is false. - InfoType info_type = 2; - - // Confidence of how likely it is that the `info_type` is correct. - Likelihood likelihood = 3; - - // Where the content was found. - Location location = 4; - - // Timestamp when finding was detected. - google.protobuf.Timestamp create_time = 6; - - // Contains data parsed from quotes. Only populated if include_quote was set - // to true and a supported infoType was requested. Currently supported - // infoTypes: DATE, DATE_OF_BIRTH and TIME. - QuoteInfo quote_info = 7; - - // The job that stored the finding. - string resource_name = 8 [(google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - }]; - - // Job trigger name, if applicable, for this finding. - string trigger_name = 9 [(google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - }]; - - // The labels associated with this `Finding`. - // - // Label keys must be between 1 and 63 characters long and must conform - // to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. - // - // Label values must be between 0 and 63 characters long and must conform - // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - // - // No more than 10 labels can be associated with a given finding. - // - // Examples: - // * `"environment" : "production"` - // * `"pipeline" : "etl"` - map labels = 10; - - // Time the job started that produced this finding. - google.protobuf.Timestamp job_create_time = 11; - - // The job that stored the finding. - string job_name = 13 [(google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - }]; - - // The unique finding id. - string finding_id = 15; -} - -// Specifies the location of the finding. -message Location { - // Zero-based byte offsets delimiting the finding. - // These are relative to the finding's containing element. - // Note that when the content is not textual, this references - // the UTF-8 encoded textual representation of the content. - // Omitted if content is an image. - Range byte_range = 1; - - // Unicode character offsets delimiting the finding. - // These are relative to the finding's containing element. - // Provided when the content is text. - Range codepoint_range = 2; - - // List of nested objects pointing to the precise location of the finding - // within the file or record. - repeated ContentLocation content_locations = 7; - - // Information about the container where this finding occurred, if available. - Container container = 8; -} - -// Precise location of the finding within a document, record, image, or metadata -// container. -message ContentLocation { - // Name of the container where the finding is located. - // The top level name is the source file name or table name. Names of some - // common storage containers are formatted as follows: - // - // * BigQuery tables: `{project_id}:{dataset_id}.{table_id}` - // * Cloud Storage files: `gs://{bucket}/{path}` - // * Datastore namespace: {namespace} - // - // Nested names could be absent if the embedded object has no string - // identifier (for example, an image contained within a document). - string container_name = 1; - - // Type of the container within the file with location of the finding. - oneof location { - // Location within a row or record of a database table. - RecordLocation record_location = 2; - - // Location within an image's pixels. - ImageLocation image_location = 3; - - // Location data for document files. - DocumentLocation document_location = 5; - - // Location within the metadata for inspected content. - MetadataLocation metadata_location = 8; - } - - // Finding container modification timestamp, if applicable. For Cloud Storage, - // this field contains the last file modification timestamp. For a BigQuery - // table, this field contains the last_modified_time property. For Datastore, - // this field isn't populated. - google.protobuf.Timestamp container_timestamp = 6; - - // Finding container version, if available - // ("generation" for Cloud Storage). - string container_version = 7; -} - -// Metadata Location -message MetadataLocation { - // Type of metadata containing the finding. - MetadataType type = 1; - - // Label of the piece of metadata containing the finding, for example - - // latitude, author, caption. - oneof label { - // Storage metadata. - StorageMetadataLabel storage_label = 3; - } -} - -// Storage metadata label to indicate which metadata entry contains findings. -message StorageMetadataLabel { - string key = 1; -} - -// Location of a finding within a document. -message DocumentLocation { - // Offset of the line, from the beginning of the file, where the finding - // is located. - int64 file_offset = 1; -} - -// Location of a finding within a row or record. -message RecordLocation { - // Key of the finding. - RecordKey record_key = 1; - - // Field id of the field containing the finding. - FieldId field_id = 2; - - // Location within a `ContentItem.Table`. - TableLocation table_location = 3; -} - -// Location of a finding within a table. -message TableLocation { - // The zero-based index of the row where the finding is located. Only - // populated for resources that have a natural ordering, not BigQuery. In - // BigQuery, to identify the row a finding came from, populate - // BigQueryOptions.identifying_fields with your primary key column names and - // when you store the findings the value of those columns will be stored - // inside of Finding. - int64 row_index = 1; -} - -// Represents a container that may contain DLP findings. -// Examples of a container include a file, table, or database record. -message Container { - // Container type, for example BigQuery or Cloud Storage. - string type = 1; - - // Project where the finding was found. - // Can be different from the project that owns the finding. - string project_id = 2; - - // A string representation of the full container name. - // Examples: - // - BigQuery: 'Project:DataSetId.TableId' - // - Cloud Storage: 'gs://Bucket/folders/filename.txt' - string full_path = 3; - - // The root of the container. - // Examples: - // - // - For BigQuery table `project_id:dataset_id.table_id`, the root is - // `dataset_id` - // - For Cloud Storage file `gs://bucket/folder/filename.txt`, the root - // is `gs://bucket` - string root_path = 4; - - // The rest of the path after the root. - // Examples: - // - // - For BigQuery table `project_id:dataset_id.table_id`, the relative path is - // `table_id` - // - For Cloud Storage file `gs://bucket/folder/filename.txt`, the relative - // path is `folder/filename.txt` - string relative_path = 5; - - // Findings container modification timestamp, if applicable. For Cloud - // Storage, this field contains the last file modification timestamp. For a - // BigQuery table, this field contains the last_modified_time property. For - // Datastore, this field isn't populated. - google.protobuf.Timestamp update_time = 6; - - // Findings container version, if available - // ("generation" for Cloud Storage). - string version = 7; -} - -// Generic half-open interval [start, end) -message Range { - // Index of the first character of the range (inclusive). - int64 start = 1; - - // Index of the last character of the range (exclusive). - int64 end = 2; -} - -// Location of the finding within an image. -message ImageLocation { - // Bounding boxes locating the pixels within the image containing the finding. - repeated BoundingBox bounding_boxes = 1; -} - -// Bounding box encompassing detected text within an image. -message BoundingBox { - // Top coordinate of the bounding box. (0,0) is upper left. - int32 top = 1; - - // Left coordinate of the bounding box. (0,0) is upper left. - int32 left = 2; - - // Width of the bounding box in pixels. - int32 width = 3; - - // Height of the bounding box in pixels. - int32 height = 4; -} - -// Request to search for potentially sensitive info in an image and redact it -// by covering it with a colored rectangle. -message RedactImageRequest { - // Configuration for determining how redaction of images should occur. - message ImageRedactionConfig { - // Type of information to redact from images. - oneof target { - // Only one per info_type should be provided per request. If not - // specified, and redact_all_text is false, the DLP API will redact all - // text that it matches against all info_types that are found, but not - // specified in another ImageRedactionConfig. - InfoType info_type = 1; - - // If true, all text found in the image, regardless whether it matches an - // info_type, is redacted. Only one should be provided. - bool redact_all_text = 2; - } - - // The color to use when redacting content from an image. If not specified, - // the default is black. - Color redaction_color = 3; - } - - // Parent resource name. - // - // The format of this value varies depending on whether you have [specified a - // processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [(google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DlpContent" - }]; - - // Deprecated. This field has no effect. - string location_id = 8; - - // Configuration for the inspector. - InspectConfig inspect_config = 2; - - // The configuration for specifying what content to redact from images. - repeated ImageRedactionConfig image_redaction_configs = 5; - - // Whether the response should include findings along with the redacted - // image. - bool include_findings = 6; - - // The content must be PNG, JPEG, SVG or BMP. - ByteContentItem byte_item = 7; -} - -// Represents a color in the RGB color space. -message Color { - // The amount of red in the color as a value in the interval [0, 1]. - float red = 1; - - // The amount of green in the color as a value in the interval [0, 1]. - float green = 2; - - // The amount of blue in the color as a value in the interval [0, 1]. - float blue = 3; -} - -// Results of redacting an image. -message RedactImageResponse { - // The redacted image. The type will be the same as the original image. - bytes redacted_image = 1; - - // If an image was being inspected and the InspectConfig's include_quote was - // set to true, then this field will include all text, if any, that was found - // in the image. - string extracted_text = 2; - - // The findings. Populated when include_findings in the request is true. - InspectResult inspect_result = 3; -} - -// Request to de-identify a ContentItem. -message DeidentifyContentRequest { - // Parent resource name. - // - // The format of this value varies depending on whether you have [specified a - // processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [(google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DlpContent" - }]; - - // Configuration for the de-identification of the content item. - // Items specified here will override the template referenced by the - // deidentify_template_name argument. - DeidentifyConfig deidentify_config = 2; - - // Configuration for the inspector. - // Items specified here will override the template referenced by the - // inspect_template_name argument. - InspectConfig inspect_config = 3; - - // The item to de-identify. Will be treated as text. - // - // This value must be of type - // [Table][google.privacy.dlp.v2.Table] if your - // [deidentify_config][google.privacy.dlp.v2.DeidentifyContentRequest.deidentify_config] - // is a - // [RecordTransformations][google.privacy.dlp.v2.RecordTransformations] - // object. - ContentItem item = 4; - - // Template to use. Any configuration directly specified in - // inspect_config will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string inspect_template_name = 5; - - // Template to use. Any configuration directly specified in - // deidentify_config will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string deidentify_template_name = 6; - - // Deprecated. This field has no effect. - string location_id = 7; -} - -// Results of de-identifying a ContentItem. -message DeidentifyContentResponse { - // The de-identified item. - ContentItem item = 1; - - // An overview of the changes that were made on the `item`. - TransformationOverview overview = 2; -} - -// Request to re-identify an item. -message ReidentifyContentRequest { - // Required. Parent resource name. - // - // The format of this value varies depending on whether you have [specified a - // processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DlpContent" - } - ]; - - // Configuration for the re-identification of the content item. - // This field shares the same proto message type that is used for - // de-identification, however its usage here is for the reversal of the - // previous de-identification. Re-identification is performed by examining - // the transformations used to de-identify the items and executing the - // reverse. This requires that only reversible transformations - // be provided here. The reversible transformations are: - // - // - `CryptoDeterministicConfig` - // - `CryptoReplaceFfxFpeConfig` - DeidentifyConfig reidentify_config = 2; - - // Configuration for the inspector. - InspectConfig inspect_config = 3; - - // The item to re-identify. Will be treated as text. - ContentItem item = 4; - - // Template to use. Any configuration directly specified in - // `inspect_config` will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string inspect_template_name = 5; - - // Template to use. References an instance of `DeidentifyTemplate`. - // Any configuration directly specified in `reidentify_config` or - // `inspect_config` will override those set in the template. The - // `DeidentifyTemplate` used must include only reversible transformations. - // Singular fields that are set in this request will replace their - // corresponding fields in the template. Repeated fields are appended. - // Singular sub-messages and groups are recursively merged. - string reidentify_template_name = 6; - - // Deprecated. This field has no effect. - string location_id = 7; -} - -// Results of re-identifying an item. -message ReidentifyContentResponse { - // The re-identified item. - ContentItem item = 1; - - // An overview of the changes that were made to the `item`. - TransformationOverview overview = 2; -} - -// Request to search for potentially sensitive info in a ContentItem. -message InspectContentRequest { - // Parent resource name. - // - // The format of this value varies depending on whether you have [specified a - // processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [(google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DlpContent" - }]; - - // Configuration for the inspector. What specified here will override - // the template referenced by the inspect_template_name argument. - InspectConfig inspect_config = 2; - - // The item to inspect. - ContentItem item = 3; - - // Template to use. Any configuration directly specified in - // inspect_config will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string inspect_template_name = 4; - - // Deprecated. This field has no effect. - string location_id = 5; -} - -// Results of inspecting an item. -message InspectContentResponse { - // The findings. - InspectResult result = 1; -} - -// Cloud repository for storing output. -message OutputStorageConfig { - // Predefined schemas for storing findings. - // Only for use with external storage. - enum OutputSchema { - // Unused. - OUTPUT_SCHEMA_UNSPECIFIED = 0; - - // Basic schema including only `info_type`, `quote`, `certainty`, and - // `timestamp`. - BASIC_COLUMNS = 1; - - // Schema tailored to findings from scanning Cloud Storage. - GCS_COLUMNS = 2; - - // Schema tailored to findings from scanning Google Datastore. - DATASTORE_COLUMNS = 3; - - // Schema tailored to findings from scanning Google BigQuery. - BIG_QUERY_COLUMNS = 4; - - // Schema containing all columns. - ALL_COLUMNS = 5; - } - - // Output storage types. - oneof type { - // Store findings in an existing table or a new table in an existing - // dataset. If table_id is not set a new one will be generated - // for you with the following format: - // dlp_googleapis_yyyy_mm_dd_[dlp_job_id]. Pacific time zone will be used - // for generating the date details. - // - // For Inspect, each column in an existing output table must have the same - // name, type, and mode of a field in the `Finding` object. - // - // For Risk, an existing output table should be the output of a previous - // Risk analysis job run on the same source table, with the same privacy - // metric and quasi-identifiers. Risk jobs that analyze the same table but - // compute a different privacy metric, or use different sets of - // quasi-identifiers, cannot store their results in the same table. - BigQueryTable table = 1; - } - - // Schema used for writing the findings for Inspect jobs. This field is only - // used for Inspect and must be unspecified for Risk jobs. Columns are derived - // from the `Finding` object. If appending to an existing table, any columns - // from the predefined schema that are missing will be added. No columns in - // the existing table will be deleted. - // - // If unspecified, then all available columns will be used for a new table or - // an (existing) table with no schema, and no changes will be made to an - // existing table that has a schema. - // Only for use with external storage. - OutputSchema output_schema = 3; -} - -// Statistics regarding a specific InfoType. -message InfoTypeStats { - // The type of finding this stat is for. - InfoType info_type = 1; - - // Number of findings for this infoType. - int64 count = 2; -} - -// The results of an inspect DataSource job. -message InspectDataSourceDetails { - // Snapshot of the inspection configuration. - message RequestedOptions { - // If run with an InspectTemplate, a snapshot of its state at the time of - // this run. - InspectTemplate snapshot_inspect_template = 1; - - // Inspect config. - InspectJobConfig job_config = 3; - } - - // All result fields mentioned below are updated while the job is processing. - message Result { - // Total size in bytes that were processed. - int64 processed_bytes = 1; - - // Estimate of the number of bytes to process. - int64 total_estimated_bytes = 2; - - // Statistics of how many instances of each info type were found during - // inspect job. - repeated InfoTypeStats info_type_stats = 3; - - // Statistics related to the processing of hybrid inspect. - HybridInspectStatistics hybrid_stats = 7; - } - - // The configuration used for this job. - RequestedOptions requested_options = 2; - - // A summary of the outcome of this inspection job. - Result result = 3; -} - -// Statistics related to processing hybrid inspect requests. -message HybridInspectStatistics { - // The number of hybrid inspection requests processed within this job. - int64 processed_count = 1; - - // The number of hybrid inspection requests aborted because the job ran - // out of quota or was ended before they could be processed. - int64 aborted_count = 2; - - // The number of hybrid requests currently being processed. Only populated - // when called via method `getDlpJob`. - // A burst of traffic may cause hybrid inspect requests to be enqueued. - // Processing will take place as quickly as possible, but resource limitations - // may impact how long a request is enqueued for. - int64 pending_count = 3; -} - -// InfoType description. -message InfoTypeDescription { - // Internal name of the infoType. - string name = 1; - - // Human readable form of the infoType name. - string display_name = 2; - - // Which parts of the API supports this InfoType. - repeated InfoTypeSupportedBy supported_by = 3; - - // Description of the infotype. Translated when language is provided in the - // request. - string description = 4; - - // A list of available versions for the infotype. - repeated VersionDescription versions = 9; - - // The category of the infoType. - repeated InfoTypeCategory categories = 10; -} - -// Classification of infoTypes to organize them according to geographic -// location, industry, and data type. -message InfoTypeCategory { - // Enum of the current locations. - // We might add more locations in the future. - enum LocationCategory { - // Unused location - LOCATION_UNSPECIFIED = 0; - - // The infoType is not issued by or tied to a specific region, but is used - // almost everywhere. - GLOBAL = 1; - - // The infoType is typically used in Argentina. - ARGENTINA = 2; - - // The infoType is typically used in Australia. - AUSTRALIA = 3; - - // The infoType is typically used in Belgium. - BELGIUM = 4; - - // The infoType is typically used in Brazil. - BRAZIL = 5; - - // The infoType is typically used in Canada. - CANADA = 6; - - // The infoType is typically used in Chile. - CHILE = 7; - - // The infoType is typically used in China. - CHINA = 8; - - // The infoType is typically used in Colombia. - COLOMBIA = 9; - - // The infoType is typically used in Denmark. - DENMARK = 10; - - // The infoType is typically used in France. - FRANCE = 11; - - // The infoType is typically used in Finland. - FINLAND = 12; - - // The infoType is typically used in Germany. - GERMANY = 13; - - // The infoType is typically used in Hong Kong. - HONG_KONG = 14; - - // The infoType is typically used in India. - INDIA = 15; - - // The infoType is typically used in Indonesia. - INDONESIA = 16; - - // The infoType is typically used in Ireland. - IRELAND = 17; - - // The infoType is typically used in Israel. - ISRAEL = 18; - - // The infoType is typically used in Italy. - ITALY = 19; - - // The infoType is typically used in Japan. - JAPAN = 20; - - // The infoType is typically used in Korea. - KOREA = 21; - - // The infoType is typically used in Mexico. - MEXICO = 22; - - // The infoType is typically used in the Netherlands. - THE_NETHERLANDS = 23; - - // The infoType is typically used in Norway. - NORWAY = 24; - - // The infoType is typically used in Paraguay. - PARAGUAY = 25; - - // The infoType is typically used in Peru. - PERU = 26; - - // The infoType is typically used in Poland. - POLAND = 27; - - // The infoType is typically used in Portugal. - PORTUGAL = 28; - - // The infoType is typically used in Singapore. - SINGAPORE = 29; - - // The infoType is typically used in South Africa. - SOUTH_AFRICA = 30; - - // The infoType is typically used in Spain. - SPAIN = 31; - - // The infoType is typically used in Sweden. - SWEDEN = 32; - - // The infoType is typically used in Taiwan. - TAIWAN = 33; - - // The infoType is typically used in Thailand. - THAILAND = 34; - - // The infoType is typically used in Turkey. - TURKEY = 35; - - // The infoType is typically used in the United Kingdom. - UNITED_KINGDOM = 36; - - // The infoType is typically used in the United States. - UNITED_STATES = 37; - - // The infoType is typically used in Uruguay. - URUGUAY = 38; - - // The infoType is typically used in Venezuela. - VENEZUELA = 39; - - // The infoType is typically used in Google internally. - INTERNAL = 40; - - // The infoType is typically used in New Zealand. - NEW_ZEALAND = 41; - } - - // Enum of the current industries in the category. - // We might add more industries in the future. - enum IndustryCategory { - // Unused industry - INDUSTRY_UNSPECIFIED = 0; - - // The infoType is typically used in the finance industry. - FINANCE = 1; - - // The infoType is typically used in the health industry. - HEALTH = 2; - - // The infoType is typically used in the telecommunications industry. - TELECOMMUNICATIONS = 3; - } - - // Enum of the current types in the category. - // We might add more types in the future. - enum TypeCategory { - // Unused type - TYPE_UNSPECIFIED = 0; - - // Personally identifiable information, for example, a - // name or phone number - PII = 1; - - // Personally identifiable information that is especially sensitive, for - // example, a passport number. - SPII = 2; - - // Attributes that can partially identify someone, especially in - // combination with other attributes, like age, height, and gender. - DEMOGRAPHIC = 3; - - // Confidential or secret information, for example, a password. - CREDENTIAL = 4; - - // An identification document issued by a government. - GOVERNMENT_ID = 5; - - // A document, for example, a resume or source code. - DOCUMENT = 6; - - // Information that is not sensitive on its own, but provides details about - // the circumstances surrounding an entity or an event. - CONTEXTUAL_INFORMATION = 7; - } - - oneof category { - // The region or country that issued the ID or document represented by the - // infoType. - LocationCategory location_category = 1; - - // The group of relevant businesses where this infoType is commonly used - IndustryCategory industry_category = 2; - - // The class of identifiers where this infoType belongs - TypeCategory type_category = 3; - } -} - -// Details about each available version for an infotype. -message VersionDescription { - // Name of the version - string version = 1; - - // Description of the version. - string description = 2; -} - -// Request for the list of infoTypes. -message ListInfoTypesRequest { - // The parent resource name. - // - // The format of this value is as follows: - // - // locations/LOCATION_ID - string parent = 4; - - // BCP-47 language code for localized infoType friendly - // names. If omitted, or if localized strings are not available, - // en-US strings will be returned. - string language_code = 1; - - // filter to only return infoTypes supported by certain parts of the - // API. Defaults to supported_by=INSPECT. - string filter = 2; - - // Deprecated. This field has no effect. - string location_id = 3; -} - -// Response to the ListInfoTypes request. -message ListInfoTypesResponse { - // Set of sensitive infoTypes. - repeated InfoTypeDescription info_types = 1; -} - -// Configuration for a risk analysis job. See -// https://cloud.google.com/dlp/docs/concepts-risk-analysis to learn more. -message RiskAnalysisJobConfig { - // Privacy metric to compute. - PrivacyMetric privacy_metric = 1; - - // Input dataset to compute metrics over. - BigQueryTable source_table = 2; - - // Actions to execute at the completion of the job. Are executed in the order - // provided. - repeated Action actions = 3; -} - -// A column with a semantic tag attached. -message QuasiId { - // Required. Identifies the column. - FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; - - // Semantic tag that identifies what a column contains, to determine which - // statistical model to use to estimate the reidentifiability of each - // value. [required] - oneof tag { - // A column can be tagged with a InfoType to use the relevant public - // dataset as a statistical model of population, if available. We - // currently support US ZIP codes, region codes, ages and genders. - // To programmatically obtain the list of supported InfoTypes, use - // ListInfoTypes with the supported_by=RISK_ANALYSIS filter. - InfoType info_type = 2; - - // A column can be tagged with a custom tag. In this case, the user must - // indicate an auxiliary table that contains statistical information on - // the possible values of this column (below). - string custom_tag = 3; - - // If no semantic tag is indicated, we infer the statistical model from - // the distribution of values in the input data - google.protobuf.Empty inferred = 4; - } -} - -// An auxiliary table containing statistical information on the relative -// frequency of different quasi-identifiers values. It has one or several -// quasi-identifiers columns, and one column that indicates the relative -// frequency of each quasi-identifier tuple. -// If a tuple is present in the data but not in the auxiliary table, the -// corresponding relative frequency is assumed to be zero (and thus, the -// tuple is highly reidentifiable). -message StatisticalTable { - // A quasi-identifier column has a custom_tag, used to know which column - // in the data corresponds to which column in the statistical model. - message QuasiIdentifierField { - // Identifies the column. - FieldId field = 1; - - // A column can be tagged with a custom tag. In this case, the user must - // indicate an auxiliary table that contains statistical information on - // the possible values of this column (below). - string custom_tag = 2; - } - - // Required. Auxiliary table location. - BigQueryTable table = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Quasi-identifier columns. - repeated QuasiIdentifierField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The relative frequency column must contain a floating-point number - // between 0 and 1 (inclusive). Null values are assumed to be zero. - FieldId relative_frequency = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Privacy metric to compute for reidentification risk analysis. -message PrivacyMetric { - // Compute numerical stats over an individual column, including - // min, max, and quantiles. - message NumericalStatsConfig { - // Field to compute numerical stats on. Supported types are - // integer, float, date, datetime, timestamp, time. - FieldId field = 1; - } - - // Compute numerical stats over an individual column, including - // number of distinct values and value count distribution. - message CategoricalStatsConfig { - // Field to compute categorical stats on. All column types are - // supported except for arrays and structs. However, it may be more - // informative to use NumericalStats when the field type is supported, - // depending on the data. - FieldId field = 1; - } - - // k-anonymity metric, used for analysis of reidentification risk. - message KAnonymityConfig { - // Set of fields to compute k-anonymity over. When multiple fields are - // specified, they are considered a single composite key. Structs and - // repeated data types are not supported; however, nested fields are - // supported so long as they are not structs themselves or nested within - // a repeated field. - repeated FieldId quasi_ids = 1; - - // Message indicating that multiple rows might be associated to a - // single individual. If the same entity_id is associated to multiple - // quasi-identifier tuples over distinct rows, we consider the entire - // collection of tuples as the composite quasi-identifier. This collection - // is a multiset: the order in which the different tuples appear in the - // dataset is ignored, but their frequency is taken into account. - // - // Important note: a maximum of 1000 rows can be associated to a single - // entity ID. If more rows are associated with the same entity ID, some - // might be ignored. - EntityId entity_id = 2; - } - - // l-diversity metric, used for analysis of reidentification risk. - message LDiversityConfig { - // Set of quasi-identifiers indicating how equivalence classes are - // defined for the l-diversity computation. When multiple fields are - // specified, they are considered a single composite key. - repeated FieldId quasi_ids = 1; - - // Sensitive field for computing the l-value. - FieldId sensitive_attribute = 2; - } - - // Reidentifiability metric. This corresponds to a risk model similar to what - // is called "journalist risk" in the literature, except the attack dataset is - // statistically modeled instead of being perfectly known. This can be done - // using publicly available data (like the US Census), or using a custom - // statistical model (indicated as one or several BigQuery tables), or by - // extrapolating from the distribution of values in the input dataset. - message KMapEstimationConfig { - // A column with a semantic tag attached. - message TaggedField { - // Required. Identifies the column. - FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; - - // Semantic tag that identifies what a column contains, to determine which - // statistical model to use to estimate the reidentifiability of each - // value. [required] - oneof tag { - // A column can be tagged with a InfoType to use the relevant public - // dataset as a statistical model of population, if available. We - // currently support US ZIP codes, region codes, ages and genders. - // To programmatically obtain the list of supported InfoTypes, use - // ListInfoTypes with the supported_by=RISK_ANALYSIS filter. - InfoType info_type = 2; - - // A column can be tagged with a custom tag. In this case, the user must - // indicate an auxiliary table that contains statistical information on - // the possible values of this column (below). - string custom_tag = 3; - - // If no semantic tag is indicated, we infer the statistical model from - // the distribution of values in the input data - google.protobuf.Empty inferred = 4; - } - } - - // An auxiliary table contains statistical information on the relative - // frequency of different quasi-identifiers values. It has one or several - // quasi-identifiers columns, and one column that indicates the relative - // frequency of each quasi-identifier tuple. - // If a tuple is present in the data but not in the auxiliary table, the - // corresponding relative frequency is assumed to be zero (and thus, the - // tuple is highly reidentifiable). - message AuxiliaryTable { - // A quasi-identifier column has a custom_tag, used to know which column - // in the data corresponds to which column in the statistical model. - message QuasiIdField { - // Identifies the column. - FieldId field = 1; - - // A auxiliary field. - string custom_tag = 2; - } - - // Required. Auxiliary table location. - BigQueryTable table = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Quasi-identifier columns. - repeated QuasiIdField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The relative frequency column must contain a floating-point number - // between 0 and 1 (inclusive). Null values are assumed to be zero. - FieldId relative_frequency = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. Fields considered to be quasi-identifiers. No two columns can have the - // same tag. - repeated TaggedField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // ISO 3166-1 alpha-2 region code to use in the statistical modeling. - // Set if no column is tagged with a region-specific InfoType (like - // US_ZIP_5) or a region code. - string region_code = 2; - - // Several auxiliary tables can be used in the analysis. Each custom_tag - // used to tag a quasi-identifiers column must appear in exactly one column - // of one auxiliary table. - repeated AuxiliaryTable auxiliary_tables = 3; - } - - // δ-presence metric, used to estimate how likely it is for an attacker to - // figure out that one given individual appears in a de-identified dataset. - // Similarly to the k-map metric, we cannot compute δ-presence exactly without - // knowing the attack dataset, so we use a statistical model instead. - message DeltaPresenceEstimationConfig { - // Required. Fields considered to be quasi-identifiers. No two fields can have the - // same tag. - repeated QuasiId quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // ISO 3166-1 alpha-2 region code to use in the statistical modeling. - // Set if no column is tagged with a region-specific InfoType (like - // US_ZIP_5) or a region code. - string region_code = 2; - - // Several auxiliary tables can be used in the analysis. Each custom_tag - // used to tag a quasi-identifiers field must appear in exactly one - // field of one auxiliary table. - repeated StatisticalTable auxiliary_tables = 3; - } - - // Types of analysis. - oneof type { - // Numerical stats - NumericalStatsConfig numerical_stats_config = 1; - - // Categorical stats - CategoricalStatsConfig categorical_stats_config = 2; - - // K-anonymity - KAnonymityConfig k_anonymity_config = 3; - - // l-diversity - LDiversityConfig l_diversity_config = 4; - - // k-map - KMapEstimationConfig k_map_estimation_config = 5; - - // delta-presence - DeltaPresenceEstimationConfig delta_presence_estimation_config = 6; - } -} - -// Result of a risk analysis operation request. -message AnalyzeDataSourceRiskDetails { - // Result of the numerical stats computation. - message NumericalStatsResult { - // Minimum value appearing in the column. - Value min_value = 1; - - // Maximum value appearing in the column. - Value max_value = 2; - - // List of 99 values that partition the set of field values into 100 equal - // sized buckets. - repeated Value quantile_values = 4; - } - - // Result of the categorical stats computation. - message CategoricalStatsResult { - // Histogram of value frequencies in the column. - message CategoricalStatsHistogramBucket { - // Lower bound on the value frequency of the values in this bucket. - int64 value_frequency_lower_bound = 1; - - // Upper bound on the value frequency of the values in this bucket. - int64 value_frequency_upper_bound = 2; - - // Total number of values in this bucket. - int64 bucket_size = 3; - - // Sample of value frequencies in this bucket. The total number of - // values returned per bucket is capped at 20. - repeated ValueFrequency bucket_values = 4; - - // Total number of distinct values in this bucket. - int64 bucket_value_count = 5; - } - - // Histogram of value frequencies in the column. - repeated CategoricalStatsHistogramBucket value_frequency_histogram_buckets = 5; - } - - // Result of the k-anonymity computation. - message KAnonymityResult { - // The set of columns' values that share the same ldiversity value - message KAnonymityEquivalenceClass { - // Set of values defining the equivalence class. One value per - // quasi-identifier column in the original KAnonymity metric message. - // The order is always the same as the original request. - repeated Value quasi_ids_values = 1; - - // Size of the equivalence class, for example number of rows with the - // above set of values. - int64 equivalence_class_size = 2; - } - - // Histogram of k-anonymity equivalence classes. - message KAnonymityHistogramBucket { - // Lower bound on the size of the equivalence classes in this bucket. - int64 equivalence_class_size_lower_bound = 1; - - // Upper bound on the size of the equivalence classes in this bucket. - int64 equivalence_class_size_upper_bound = 2; - - // Total number of equivalence classes in this bucket. - int64 bucket_size = 3; - - // Sample of equivalence classes in this bucket. The total number of - // classes returned per bucket is capped at 20. - repeated KAnonymityEquivalenceClass bucket_values = 4; - - // Total number of distinct equivalence classes in this bucket. - int64 bucket_value_count = 5; - } - - // Histogram of k-anonymity equivalence classes. - repeated KAnonymityHistogramBucket equivalence_class_histogram_buckets = 5; - } - - // Result of the l-diversity computation. - message LDiversityResult { - // The set of columns' values that share the same ldiversity value. - message LDiversityEquivalenceClass { - // Quasi-identifier values defining the k-anonymity equivalence - // class. The order is always the same as the original request. - repeated Value quasi_ids_values = 1; - - // Size of the k-anonymity equivalence class. - int64 equivalence_class_size = 2; - - // Number of distinct sensitive values in this equivalence class. - int64 num_distinct_sensitive_values = 3; - - // Estimated frequencies of top sensitive values. - repeated ValueFrequency top_sensitive_values = 4; - } - - // Histogram of l-diversity equivalence class sensitive value frequencies. - message LDiversityHistogramBucket { - // Lower bound on the sensitive value frequencies of the equivalence - // classes in this bucket. - int64 sensitive_value_frequency_lower_bound = 1; - - // Upper bound on the sensitive value frequencies of the equivalence - // classes in this bucket. - int64 sensitive_value_frequency_upper_bound = 2; - - // Total number of equivalence classes in this bucket. - int64 bucket_size = 3; - - // Sample of equivalence classes in this bucket. The total number of - // classes returned per bucket is capped at 20. - repeated LDiversityEquivalenceClass bucket_values = 4; - - // Total number of distinct equivalence classes in this bucket. - int64 bucket_value_count = 5; - } - - // Histogram of l-diversity equivalence class sensitive value frequencies. - repeated LDiversityHistogramBucket sensitive_value_frequency_histogram_buckets = 5; - } - - // Result of the reidentifiability analysis. Note that these results are an - // estimation, not exact values. - message KMapEstimationResult { - // A tuple of values for the quasi-identifier columns. - message KMapEstimationQuasiIdValues { - // The quasi-identifier values. - repeated Value quasi_ids_values = 1; - - // The estimated anonymity for these quasi-identifier values. - int64 estimated_anonymity = 2; - } - - // A KMapEstimationHistogramBucket message with the following values: - // min_anonymity: 3 - // max_anonymity: 5 - // frequency: 42 - // means that there are 42 records whose quasi-identifier values correspond - // to 3, 4 or 5 people in the overlying population. An important particular - // case is when min_anonymity = max_anonymity = 1: the frequency field then - // corresponds to the number of uniquely identifiable records. - message KMapEstimationHistogramBucket { - // Always positive. - int64 min_anonymity = 1; - - // Always greater than or equal to min_anonymity. - int64 max_anonymity = 2; - - // Number of records within these anonymity bounds. - int64 bucket_size = 5; - - // Sample of quasi-identifier tuple values in this bucket. The total - // number of classes returned per bucket is capped at 20. - repeated KMapEstimationQuasiIdValues bucket_values = 6; - - // Total number of distinct quasi-identifier tuple values in this bucket. - int64 bucket_value_count = 7; - } - - // The intervals [min_anonymity, max_anonymity] do not overlap. If a value - // doesn't correspond to any such interval, the associated frequency is - // zero. For example, the following records: - // {min_anonymity: 1, max_anonymity: 1, frequency: 17} - // {min_anonymity: 2, max_anonymity: 3, frequency: 42} - // {min_anonymity: 5, max_anonymity: 10, frequency: 99} - // mean that there are no record with an estimated anonymity of 4, 5, or - // larger than 10. - repeated KMapEstimationHistogramBucket k_map_estimation_histogram = 1; - } - - // Result of the δ-presence computation. Note that these results are an - // estimation, not exact values. - message DeltaPresenceEstimationResult { - // A tuple of values for the quasi-identifier columns. - message DeltaPresenceEstimationQuasiIdValues { - // The quasi-identifier values. - repeated Value quasi_ids_values = 1; - - // The estimated probability that a given individual sharing these - // quasi-identifier values is in the dataset. This value, typically - // called δ, is the ratio between the number of records in the dataset - // with these quasi-identifier values, and the total number of individuals - // (inside *and* outside the dataset) with these quasi-identifier values. - // For example, if there are 15 individuals in the dataset who share the - // same quasi-identifier values, and an estimated 100 people in the entire - // population with these values, then δ is 0.15. - double estimated_probability = 2; - } - - // A DeltaPresenceEstimationHistogramBucket message with the following - // values: - // min_probability: 0.1 - // max_probability: 0.2 - // frequency: 42 - // means that there are 42 records for which δ is in [0.1, 0.2). An - // important particular case is when min_probability = max_probability = 1: - // then, every individual who shares this quasi-identifier combination is in - // the dataset. - message DeltaPresenceEstimationHistogramBucket { - // Between 0 and 1. - double min_probability = 1; - - // Always greater than or equal to min_probability. - double max_probability = 2; - - // Number of records within these probability bounds. - int64 bucket_size = 5; - - // Sample of quasi-identifier tuple values in this bucket. The total - // number of classes returned per bucket is capped at 20. - repeated DeltaPresenceEstimationQuasiIdValues bucket_values = 6; - - // Total number of distinct quasi-identifier tuple values in this bucket. - int64 bucket_value_count = 7; - } - - // The intervals [min_probability, max_probability) do not overlap. If a - // value doesn't correspond to any such interval, the associated frequency - // is zero. For example, the following records: - // {min_probability: 0, max_probability: 0.1, frequency: 17} - // {min_probability: 0.2, max_probability: 0.3, frequency: 42} - // {min_probability: 0.3, max_probability: 0.4, frequency: 99} - // mean that there are no record with an estimated probability in [0.1, 0.2) - // nor larger or equal to 0.4. - repeated DeltaPresenceEstimationHistogramBucket delta_presence_estimation_histogram = 1; - } - - // Risk analysis options. - message RequestedRiskAnalysisOptions { - // The job config for the risk job. - RiskAnalysisJobConfig job_config = 1; - } - - // Privacy metric to compute. - PrivacyMetric requested_privacy_metric = 1; - - // Input dataset to compute metrics over. - BigQueryTable requested_source_table = 2; - - // Values associated with this metric. - oneof result { - // Numerical stats result - NumericalStatsResult numerical_stats_result = 3; - - // Categorical stats result - CategoricalStatsResult categorical_stats_result = 4; - - // K-anonymity result - KAnonymityResult k_anonymity_result = 5; - - // L-divesity result - LDiversityResult l_diversity_result = 6; - - // K-map result - KMapEstimationResult k_map_estimation_result = 7; - - // Delta-presence result - DeltaPresenceEstimationResult delta_presence_estimation_result = 9; - } - - // The configuration used for this job. - RequestedRiskAnalysisOptions requested_options = 10; -} - -// A value of a field, including its frequency. -message ValueFrequency { - // A value contained in the field in question. - Value value = 1; - - // How many times the value is contained in the field. - int64 count = 2; -} - -// Set of primitive values supported by the system. -// Note that for the purposes of inspection or transformation, the number -// of bytes considered to comprise a 'Value' is based on its representation -// as a UTF-8 encoded string. For example, if 'integer_value' is set to -// 123456789, the number of bytes would be counted as 9, even though an -// int64 only holds up to 8 bytes of data. -message Value { - // Value types - oneof type { - // integer - int64 integer_value = 1; - - // float - double float_value = 2; - - // string - string string_value = 3; - - // boolean - bool boolean_value = 4; - - // timestamp - google.protobuf.Timestamp timestamp_value = 5; - - // time of day - google.type.TimeOfDay time_value = 6; - - // date - google.type.Date date_value = 7; - - // day of week - google.type.DayOfWeek day_of_week_value = 8; - } -} - -// Message for infoType-dependent details parsed from quote. -message QuoteInfo { - // Object representation of the quote. - oneof parsed_quote { - // The date time indicated by the quote. - DateTime date_time = 2; - } -} - -// Message for a date time object. -// e.g. 2018-01-01, 5th August. -message DateTime { - // Time zone of the date time object. - message TimeZone { - // Set only if the offset can be determined. Positive for time ahead of UTC. - // E.g. For "UTC-9", this value is -540. - int32 offset_minutes = 1; - } - - // One or more of the following must be set. - // Must be a valid date or time value. - google.type.Date date = 1; - - // Day of week - google.type.DayOfWeek day_of_week = 2; - - // Time of day - google.type.TimeOfDay time = 3; - - // Time zone - TimeZone time_zone = 4; -} - -// The configuration that controls how the data will change. -message DeidentifyConfig { - oneof transformation { - // Treat the dataset as free-form text and apply the same free text - // transformation everywhere. - InfoTypeTransformations info_type_transformations = 1; - - // Treat the dataset as structured. Transformations can be applied to - // specific locations within structured datasets, such as transforming - // a column within a table. - RecordTransformations record_transformations = 2; - - // Treat the dataset as an image and redact. - ImageTransformations image_transformations = 4; - } - - // Mode for handling transformation errors. If left unspecified, the default - // mode is `TransformationErrorHandling.ThrowError`. - TransformationErrorHandling transformation_error_handling = 3; -} - -// A type of transformation that is applied over images. -message ImageTransformations { - // Configuration for determining how redaction of images should occur. - message ImageTransformation { - // Apply transformation to the selected info_types. - message SelectedInfoTypes { - // Required. InfoTypes to apply the transformation to. Required. Provided InfoType - // must be unique within the ImageTransformations message. - repeated InfoType info_types = 5 [(google.api.field_behavior) = REQUIRED]; - } - - // Apply transformation to all findings. - message AllInfoTypes { - - } - - // Apply to all text. - message AllText { - - } - - oneof target { - // Apply transformation to the selected info_types. - SelectedInfoTypes selected_info_types = 4; - - // Apply transformation to all findings not specified in other - // ImageTransformation's selected_info_types. Only one instance is allowed - // within the ImageTransformations message. - AllInfoTypes all_info_types = 5; - - // Apply transformation to all text that doesn't match an infoType. Only - // one instance is allowed within the ImageTransformations message. - AllText all_text = 6; - } - - // The color to use when redacting content from an image. If not - // specified, the default is black. - Color redaction_color = 3; - } - - repeated ImageTransformation transforms = 2; -} - -// How to handle transformation errors during de-identification. A -// transformation error occurs when the requested transformation is incompatible -// with the data. For example, trying to de-identify an IP address using a -// `DateShift` transformation would result in a transformation error, since date -// info cannot be extracted from an IP address. -// Information about any incompatible transformations, and how they were -// handled, is returned in the response as part of the -// `TransformationOverviews`. -message TransformationErrorHandling { - // Throw an error and fail the request when a transformation error occurs. - message ThrowError { - - } - - // Skips the data without modifying it if the requested transformation would - // cause an error. For example, if a `DateShift` transformation were applied - // an an IP address, this mode would leave the IP address unchanged in the - // response. - message LeaveUntransformed { - - } - - // How transformation errors should be handled. - oneof mode { - // Throw an error - ThrowError throw_error = 1; - - // Ignore errors - LeaveUntransformed leave_untransformed = 2; - } -} - -// A rule for transforming a value. -message PrimitiveTransformation { - oneof transformation { - // Replace with a specified value. - ReplaceValueConfig replace_config = 1; - - // Redact - RedactConfig redact_config = 2; - - // Mask - CharacterMaskConfig character_mask_config = 3; - - // Ffx-Fpe - CryptoReplaceFfxFpeConfig crypto_replace_ffx_fpe_config = 4; - - // Fixed size bucketing - FixedSizeBucketingConfig fixed_size_bucketing_config = 5; - - // Bucketing - BucketingConfig bucketing_config = 6; - - // Replace with infotype - ReplaceWithInfoTypeConfig replace_with_info_type_config = 7; - - // Time extraction - TimePartConfig time_part_config = 8; - - // Crypto - CryptoHashConfig crypto_hash_config = 9; - - // Date Shift - DateShiftConfig date_shift_config = 11; - - // Deterministic Crypto - CryptoDeterministicConfig crypto_deterministic_config = 12; - - // Replace with a value randomly drawn (with replacement) from a dictionary. - ReplaceDictionaryConfig replace_dictionary_config = 13; - } -} - -// For use with `Date`, `Timestamp`, and `TimeOfDay`, extract or preserve a -// portion of the value. -message TimePartConfig { - // Components that make up time. - enum TimePart { - // Unused - TIME_PART_UNSPECIFIED = 0; - - // [0-9999] - YEAR = 1; - - // [1-12] - MONTH = 2; - - // [1-31] - DAY_OF_MONTH = 3; - - // [1-7] - DAY_OF_WEEK = 4; - - // [1-53] - WEEK_OF_YEAR = 5; - - // [0-23] - HOUR_OF_DAY = 6; - } - - // The part of the time to keep. - TimePart part_to_extract = 1; -} - -// Pseudonymization method that generates surrogates via cryptographic hashing. -// Uses SHA-256. -// The key size must be either 32 or 64 bytes. -// Outputs a base64 encoded representation of the hashed output -// (for example, L7k0BHmF1ha5U3NfGykjro4xWi1MPVQPjhMAZbSV9mM=). -// Currently, only string and integer values can be hashed. -// See https://cloud.google.com/dlp/docs/pseudonymization to learn more. -message CryptoHashConfig { - // The key used by the hash function. - CryptoKey crypto_key = 1; -} - -// Pseudonymization method that generates deterministic encryption for the given -// input. Outputs a base64 encoded representation of the encrypted output. -// Uses AES-SIV based on the RFC https://tools.ietf.org/html/rfc5297. -message CryptoDeterministicConfig { - // The key used by the encryption function. For deterministic encryption - // using AES-SIV, the provided key is internally expanded to 64 bytes prior to - // use. - CryptoKey crypto_key = 1; - - // The custom info type to annotate the surrogate with. - // This annotation will be applied to the surrogate by prefixing it with - // the name of the custom info type followed by the number of - // characters comprising the surrogate. The following scheme defines the - // format: {info type name}({surrogate character count}):{surrogate} - // - // For example, if the name of custom info type is 'MY_TOKEN_INFO_TYPE' and - // the surrogate is 'abc', the full replacement value - // will be: 'MY_TOKEN_INFO_TYPE(3):abc' - // - // This annotation identifies the surrogate when inspecting content using the - // custom info type 'Surrogate'. This facilitates reversal of the - // surrogate when it occurs in free text. - // - // Note: For record transformations where the entire cell in a table is being - // transformed, surrogates are not mandatory. Surrogates are used to denote - // the location of the token and are necessary for re-identification in free - // form text. - // - // In order for inspection to work properly, the name of this info type must - // not occur naturally anywhere in your data; otherwise, inspection may either - // - // - reverse a surrogate that does not correspond to an actual identifier - // - be unable to parse the surrogate and result in an error - // - // Therefore, choose your custom info type name carefully after considering - // what your data looks like. One way to select a name that has a high chance - // of yielding reliable detection is to include one or more unicode characters - // that are highly improbable to exist in your data. - // For example, assuming your data is entered from a regular ASCII keyboard, - // the symbol with the hex code point 29DD might be used like so: - // ⧝MY_TOKEN_TYPE. - InfoType surrogate_info_type = 2; - - // A context may be used for higher security and maintaining - // referential integrity such that the same identifier in two different - // contexts will be given a distinct surrogate. The context is appended to - // plaintext value being encrypted. On decryption the provided context is - // validated against the value used during encryption. If a context was - // provided during encryption, same context must be provided during decryption - // as well. - // - // If the context is not set, plaintext would be used as is for encryption. - // If the context is set but: - // - // 1. there is no record present when transforming a given value or - // 2. the field is not present when transforming a given value, - // - // plaintext would be used as is for encryption. - // - // Note that case (1) is expected when an `InfoTypeTransformation` is - // applied to both structured and unstructured `ContentItem`s. - FieldId context = 3; -} - -// Replace each input value with a given `Value`. -message ReplaceValueConfig { - // Value to replace it with. - Value new_value = 1; -} - -// Replace each input value with a value randomly selected from the dictionary. -message ReplaceDictionaryConfig { - oneof type { - // A list of words to select from for random replacement. The - // [limits](https://cloud.google.com/dlp/limits) page contains details about - // the size limits of dictionaries. - CustomInfoType.Dictionary.WordList word_list = 1; - } -} - -// Replace each matching finding with the name of the info_type. -message ReplaceWithInfoTypeConfig { - -} - -// Redact a given value. For example, if used with an `InfoTypeTransformation` -// transforming PHONE_NUMBER, and input 'My phone number is 206-555-0123', the -// output would be 'My phone number is '. -message RedactConfig { - -} - -// Characters to skip when doing deidentification of a value. These will be left -// alone and skipped. -message CharsToIgnore { - // Convenience enum for indicating common characters to not transform. - enum CommonCharsToIgnore { - // Unused. - COMMON_CHARS_TO_IGNORE_UNSPECIFIED = 0; - - // 0-9 - NUMERIC = 1; - - // A-Z - ALPHA_UPPER_CASE = 2; - - // a-z - ALPHA_LOWER_CASE = 3; - - // US Punctuation, one of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ - PUNCTUATION = 4; - - // Whitespace character, one of [ \t\n\x0B\f\r] - WHITESPACE = 5; - } - - oneof characters { - // Characters to not transform when masking. - string characters_to_skip = 1; - - // Common characters to not transform when masking. Useful to avoid removing - // punctuation. - CommonCharsToIgnore common_characters_to_ignore = 2; - } -} - -// Partially mask a string by replacing a given number of characters with a -// fixed character. Masking can start from the beginning or end of the string. -// This can be used on data of any type (numbers, longs, and so on) and when -// de-identifying structured data we'll attempt to preserve the original data's -// type. (This allows you to take a long like 123 and modify it to a string like -// **3. -message CharacterMaskConfig { - // Character to use to mask the sensitive values—for example, `*` for an - // alphabetic string such as a name, or `0` for a numeric string such as ZIP - // code or credit card number. This string must have a length of 1. If not - // supplied, this value defaults to `*` for strings, and `0` for digits. - string masking_character = 1; - - // Number of characters to mask. If not set, all matching chars will be - // masked. Skipped characters do not count towards this tally. - // - // If `number_to_mask` is negative, this denotes inverse masking. Cloud DLP - // masks all but a number of characters. - // For example, suppose you have the following values: - // - // - `masking_character` is `*` - // - `number_to_mask` is `-4` - // - `reverse_order` is `false` - // - `CharsToIgnore` includes `-` - // - Input string is `1234-5678-9012-3456` - // - // The resulting de-identified string is - // `****-****-****-3456`. Cloud DLP masks all but the last four characters. - // If `reverse_order` is `true`, all but the first four characters are masked - // as `1234-****-****-****`. - int32 number_to_mask = 2; - - // Mask characters in reverse order. For example, if `masking_character` is - // `0`, `number_to_mask` is `14`, and `reverse_order` is `false`, then the - // input string `1234-5678-9012-3456` is masked as `00000000000000-3456`. - // If `masking_character` is `*`, `number_to_mask` is `3`, and `reverse_order` - // is `true`, then the string `12345` is masked as `12***`. - bool reverse_order = 3; - - // When masking a string, items in this list will be skipped when replacing - // characters. For example, if the input string is `555-555-5555` and you - // instruct Cloud DLP to skip `-` and mask 5 characters with `*`, Cloud DLP - // returns `***-**5-5555`. - repeated CharsToIgnore characters_to_ignore = 4; -} - -// Buckets values based on fixed size ranges. The -// Bucketing transformation can provide all of this functionality, -// but requires more configuration. This message is provided as a convenience to -// the user for simple bucketing strategies. -// -// The transformed value will be a hyphenated string of -// {lower_bound}-{upper_bound}. For example, if lower_bound = 10 and upper_bound -// = 20, all values that are within this bucket will be replaced with "10-20". -// -// This can be used on data of type: double, long. -// -// If the bound Value type differs from the type of data -// being transformed, we will first attempt converting the type of the data to -// be transformed to match the type of the bound before comparing. -// -// See https://cloud.google.com/dlp/docs/concepts-bucketing to learn more. -message FixedSizeBucketingConfig { - // Required. Lower bound value of buckets. All values less than `lower_bound` are - // grouped together into a single bucket; for example if `lower_bound` = 10, - // then all values less than 10 are replaced with the value "-10". - Value lower_bound = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Upper bound value of buckets. All values greater than upper_bound are - // grouped together into a single bucket; for example if `upper_bound` = 89, - // then all values greater than 89 are replaced with the value "89+". - Value upper_bound = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Size of each bucket (except for minimum and maximum buckets). So if - // `lower_bound` = 10, `upper_bound` = 89, and `bucket_size` = 10, then the - // following buckets would be used: -10, 10-20, 20-30, 30-40, 40-50, 50-60, - // 60-70, 70-80, 80-89, 89+. Precision up to 2 decimals works. - double bucket_size = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Generalization function that buckets values based on ranges. The ranges and -// replacement values are dynamically provided by the user for custom behavior, -// such as 1-30 -> LOW 31-65 -> MEDIUM 66-100 -> HIGH -// This can be used on -// data of type: number, long, string, timestamp. -// If the bound `Value` type differs from the type of data being transformed, we -// will first attempt converting the type of the data to be transformed to match -// the type of the bound before comparing. -// See https://cloud.google.com/dlp/docs/concepts-bucketing to learn more. -message BucketingConfig { - // Bucket is represented as a range, along with replacement values. - message Bucket { - // Lower bound of the range, inclusive. Type should be the same as max if - // used. - Value min = 1; - - // Upper bound of the range, exclusive; type must match min. - Value max = 2; - - // Required. Replacement value for this bucket. - Value replacement_value = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // Set of buckets. Ranges must be non-overlapping. - repeated Bucket buckets = 1; -} - -// Replaces an identifier with a surrogate using Format Preserving Encryption -// (FPE) with the FFX mode of operation; however when used in the -// `ReidentifyContent` API method, it serves the opposite function by reversing -// the surrogate back into the original identifier. The identifier must be -// encoded as ASCII. For a given crypto key and context, the same identifier -// will be replaced with the same surrogate. Identifiers must be at least two -// characters long. In the case that the identifier is the empty string, it will -// be skipped. See https://cloud.google.com/dlp/docs/pseudonymization to learn -// more. -// -// Note: We recommend using CryptoDeterministicConfig for all use cases which -// do not require preserving the input alphabet space and size, plus warrant -// referential integrity. -message CryptoReplaceFfxFpeConfig { - // These are commonly used subsets of the alphabet that the FFX mode - // natively supports. In the algorithm, the alphabet is selected using - // the "radix". Therefore each corresponds to a particular radix. - enum FfxCommonNativeAlphabet { - // Unused. - FFX_COMMON_NATIVE_ALPHABET_UNSPECIFIED = 0; - - // `[0-9]` (radix of 10) - NUMERIC = 1; - - // `[0-9A-F]` (radix of 16) - HEXADECIMAL = 2; - - // `[0-9A-Z]` (radix of 36) - UPPER_CASE_ALPHA_NUMERIC = 3; - - // `[0-9A-Za-z]` (radix of 62) - ALPHA_NUMERIC = 4; - } - - // Required. The key used by the encryption algorithm. - CryptoKey crypto_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // The 'tweak', a context may be used for higher security since the same - // identifier in two different contexts won't be given the same surrogate. If - // the context is not set, a default tweak will be used. - // - // If the context is set but: - // - // 1. there is no record present when transforming a given value or - // 1. the field is not present when transforming a given value, - // - // a default tweak will be used. - // - // Note that case (1) is expected when an `InfoTypeTransformation` is - // applied to both structured and unstructured `ContentItem`s. - // Currently, the referenced field may be of value type integer or string. - // - // The tweak is constructed as a sequence of bytes in big endian byte order - // such that: - // - // - a 64 bit integer is encoded followed by a single byte of value 1 - // - a string is encoded in UTF-8 format followed by a single byte of value 2 - FieldId context = 2; - - // Choose an alphabet which the data being transformed will be made up of. - oneof alphabet { - // Common alphabets. - FfxCommonNativeAlphabet common_alphabet = 4; - - // This is supported by mapping these to the alphanumeric characters - // that the FFX mode natively supports. This happens before/after - // encryption/decryption. - // Each character listed must appear only once. - // Number of characters must be in the range [2, 95]. - // This must be encoded as ASCII. - // The order of characters does not matter. - // The full list of allowed characters is: - // 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz - // ~`!@#$%^&*()_-+={[}]|\:;"'<,>.?/ - string custom_alphabet = 5; - - // The native way to select the alphabet. Must be in the range [2, 95]. - int32 radix = 6; - } - - // The custom infoType to annotate the surrogate with. - // This annotation will be applied to the surrogate by prefixing it with - // the name of the custom infoType followed by the number of - // characters comprising the surrogate. The following scheme defines the - // format: info_type_name(surrogate_character_count):surrogate - // - // For example, if the name of custom infoType is 'MY_TOKEN_INFO_TYPE' and - // the surrogate is 'abc', the full replacement value - // will be: 'MY_TOKEN_INFO_TYPE(3):abc' - // - // This annotation identifies the surrogate when inspecting content using the - // custom infoType - // [`SurrogateType`](https://cloud.google.com/dlp/docs/reference/rest/v2/InspectConfig#surrogatetype). - // This facilitates reversal of the surrogate when it occurs in free text. - // - // In order for inspection to work properly, the name of this infoType must - // not occur naturally anywhere in your data; otherwise, inspection may - // find a surrogate that does not correspond to an actual identifier. - // Therefore, choose your custom infoType name carefully after considering - // what your data looks like. One way to select a name that has a high chance - // of yielding reliable detection is to include one or more unicode characters - // that are highly improbable to exist in your data. - // For example, assuming your data is entered from a regular ASCII keyboard, - // the symbol with the hex code point 29DD might be used like so: - // ⧝MY_TOKEN_TYPE - InfoType surrogate_info_type = 8; -} - -// This is a data encryption key (DEK) (as opposed to -// a key encryption key (KEK) stored by Cloud Key Management Service -// (Cloud KMS). -// When using Cloud KMS to wrap or unwrap a DEK, be sure to set an appropriate -// IAM policy on the KEK to ensure an attacker cannot -// unwrap the DEK. -message CryptoKey { - // Sources of crypto keys. - oneof source { - // Transient crypto key - TransientCryptoKey transient = 1; - - // Unwrapped crypto key - UnwrappedCryptoKey unwrapped = 2; - - // Key wrapped using Cloud KMS - KmsWrappedCryptoKey kms_wrapped = 3; - } -} - -// Use this to have a random data crypto key generated. -// It will be discarded after the request finishes. -message TransientCryptoKey { - // Required. Name of the key. - // This is an arbitrary string used to differentiate different keys. - // A unique key is generated per name: two separate `TransientCryptoKey` - // protos share the same generated key if their names are the same. - // When the data crypto key is generated, this name is not used in any way - // (repeating the api call will result in a different key being generated). - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Using raw keys is prone to security risks due to accidentally -// leaking the key. Choose another type of key if possible. -message UnwrappedCryptoKey { - // Required. A 128/192/256 bit key. - bytes key = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Include to use an existing data crypto key wrapped by KMS. -// The wrapped key must be a 128-, 192-, or 256-bit key. -// Authorization requires the following IAM permissions when sending a request -// to perform a crypto transformation using a KMS-wrapped crypto key: -// dlp.kms.encrypt -// -// For more information, see [Creating a wrapped key] -// (https://cloud.google.com/dlp/docs/create-wrapped-key). -// -// Note: When you use Cloud KMS for cryptographic operations, -// [charges apply](https://cloud.google.com/kms/pricing). -message KmsWrappedCryptoKey { - // Required. The wrapped data crypto key. - bytes wrapped_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The resource name of the KMS CryptoKey to use for unwrapping. - string crypto_key_name = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Shifts dates by random number of days, with option to be consistent for the -// same context. See https://cloud.google.com/dlp/docs/concepts-date-shifting -// to learn more. -message DateShiftConfig { - // Required. Range of shift in days. Actual shift will be selected at random within this - // range (inclusive ends). Negative means shift to earlier in time. Must not - // be more than 365250 days (1000 years) each direction. - // - // For example, 3 means shift date to at most 3 days into the future. - int32 upper_bound_days = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. For example, -5 means shift date to at most 5 days back in the past. - int32 lower_bound_days = 2 [(google.api.field_behavior) = REQUIRED]; - - // Points to the field that contains the context, for example, an entity id. - // If set, must also set cryptoKey. If set, shift will be consistent for the - // given context. - FieldId context = 3; - - // Method for calculating shift that takes context into consideration. If - // set, must also set context. Can only be applied to table items. - oneof method { - // Causes the shift to be computed based on this key and the context. This - // results in the same shift for the same context and crypto_key. If - // set, must also set context. Can only be applied to table items. - CryptoKey crypto_key = 4; - } -} - -// A type of transformation that will scan unstructured text and -// apply various `PrimitiveTransformation`s to each finding, where the -// transformation is applied to only values that were identified as a specific -// info_type. -message InfoTypeTransformations { - // A transformation to apply to text that is identified as a specific - // info_type. - message InfoTypeTransformation { - // InfoTypes to apply the transformation to. An empty list will cause - // this transformation to apply to all findings that correspond to - // infoTypes that were requested in `InspectConfig`. - repeated InfoType info_types = 1; - - // Required. Primitive transformation to apply to the infoType. - PrimitiveTransformation primitive_transformation = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. Transformation for each infoType. Cannot specify more than one - // for a given infoType. - repeated InfoTypeTransformation transformations = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The transformation to apply to the field. -message FieldTransformation { - // Required. Input field(s) to apply the transformation to. - // When you have columns that reference their position within a list, - // omit the index from the FieldId. FieldId name matching ignores the index. - // For example, instead of "contact.nums[0].type", use "contact.nums.type". - repeated FieldId fields = 1 [(google.api.field_behavior) = REQUIRED]; - - // Only apply the transformation if the condition evaluates to true for the - // given `RecordCondition`. The conditions are allowed to reference fields - // that are not used in the actual transformation. - // - // Example Use Cases: - // - // - Apply a different bucket transformation to an age column if the zip code - // column for the same record is within a specific range. - // - Redact a field if the date of birth field is greater than 85. - RecordCondition condition = 3; - - // Transformation to apply. [required] - oneof transformation { - // Apply the transformation to the entire field. - PrimitiveTransformation primitive_transformation = 4; - - // Treat the contents of the field as free text, and selectively - // transform content that matches an `InfoType`. - InfoTypeTransformations info_type_transformations = 5; - } -} - -// A type of transformation that is applied over structured data such as a -// table. -message RecordTransformations { - // Transform the record by applying various field transformations. - repeated FieldTransformation field_transformations = 1; - - // Configuration defining which records get suppressed entirely. Records that - // match any suppression rule are omitted from the output. - repeated RecordSuppression record_suppressions = 2; -} - -// Configuration to suppress records whose suppression conditions evaluate to -// true. -message RecordSuppression { - // A condition that when it evaluates to true will result in the record being - // evaluated to be suppressed from the transformed content. - RecordCondition condition = 1; -} - -// A condition for determining whether a transformation should be applied to -// a field. -message RecordCondition { - // The field type of `value` and `field` do not need to match to be - // considered equal, but not all comparisons are possible. - // EQUAL_TO and NOT_EQUAL_TO attempt to compare even with incompatible types, - // but all other comparisons are invalid with incompatible types. - // A `value` of type: - // - // - `string` can be compared against all other types - // - `boolean` can only be compared against other booleans - // - `integer` can be compared against doubles or a string if the string value - // can be parsed as an integer. - // - `double` can be compared against integers or a string if the string can - // be parsed as a double. - // - `Timestamp` can be compared against strings in RFC 3339 date string - // format. - // - `TimeOfDay` can be compared against timestamps and strings in the format - // of 'HH:mm:ss'. - // - // If we fail to compare do to type mismatch, a warning will be given and - // the condition will evaluate to false. - message Condition { - // Required. Field within the record this condition is evaluated against. - FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Operator used to compare the field or infoType to the value. - RelationalOperator operator = 3 [(google.api.field_behavior) = REQUIRED]; - - // Value to compare against. [Mandatory, except for `EXISTS` tests.] - Value value = 4; - } - - // A collection of conditions. - message Conditions { - // A collection of conditions. - repeated Condition conditions = 1; - } - - // An expression, consisting of an operator and conditions. - message Expressions { - // Logical operators for conditional checks. - enum LogicalOperator { - // Unused - LOGICAL_OPERATOR_UNSPECIFIED = 0; - - // Conditional AND - AND = 1; - } - - // The operator to apply to the result of conditions. Default and currently - // only supported value is `AND`. - LogicalOperator logical_operator = 1; - - // Expression types. - oneof type { - // Conditions to apply to the expression. - Conditions conditions = 3; - } - } - - // An expression. - Expressions expressions = 3; -} - -// Overview of the modifications that occurred. -message TransformationOverview { - // Total size in bytes that were transformed in some way. - int64 transformed_bytes = 2; - - // Transformations applied to the dataset. - repeated TransformationSummary transformation_summaries = 3; -} - -// Summary of a single transformation. -// Only one of 'transformation', 'field_transformation', or 'record_suppress' -// will be set. -message TransformationSummary { - // Possible outcomes of transformations. - enum TransformationResultCode { - // Unused - TRANSFORMATION_RESULT_CODE_UNSPECIFIED = 0; - - // Transformation completed without an error. - SUCCESS = 1; - - // Transformation had an error. - ERROR = 2; - } - - // A collection that informs the user the number of times a particular - // `TransformationResultCode` and error details occurred. - message SummaryResult { - // Number of transformations counted by this result. - int64 count = 1; - - // Outcome of the transformation. - TransformationResultCode code = 2; - - // A place for warnings or errors to show up if a transformation didn't - // work as expected. - string details = 3; - } - - // Set if the transformation was limited to a specific InfoType. - InfoType info_type = 1; - - // Set if the transformation was limited to a specific FieldId. - FieldId field = 2; - - // The specific transformation these stats apply to. - PrimitiveTransformation transformation = 3; - - // The field transformation that was applied. - // If multiple field transformations are requested for a single field, - // this list will contain all of them; otherwise, only one is supplied. - repeated FieldTransformation field_transformations = 5; - - // The specific suppression option these stats apply to. - RecordSuppression record_suppress = 6; - - // Collection of all transformations that took place or had an error. - repeated SummaryResult results = 4; - - // Total size in bytes that were transformed in some way. - int64 transformed_bytes = 7; -} - -// A flattened description of a `PrimitiveTransformation` or -// `RecordSuppression`. -message TransformationDescription { - // The transformation type. - TransformationType type = 1; - - // A description of the transformation. This is empty for a - // RECORD_SUPPRESSION, or is the output of calling toString() on the - // `PrimitiveTransformation` protocol buffer message for any other type of - // transformation. - string description = 2; - - // A human-readable string representation of the `RecordCondition` - // corresponding to this transformation. Set if a `RecordCondition` was used - // to determine whether or not to apply this transformation. - // - // Examples: - // * (age_field > 85) - // * (age_field <= 18) - // * (zip_field exists) - // * (zip_field == 01234) && (city_field != "Springville") - // * (zip_field == 01234) && (age_field <= 18) && (city_field exists) - string condition = 3; - - // Set if the transformation was limited to a specific `InfoType`. - InfoType info_type = 4; -} - -// Details about a single transformation. This object contains a description of -// the transformation, information about whether the transformation was -// successfully applied, and the precise location where the transformation -// occurred. These details are stored in a user-specified BigQuery table. -message TransformationDetails { - // The name of the job that completed the transformation. - string resource_name = 1; - - // The top level name of the container where the transformation is located - // (this will be the source file name or table name). - string container_name = 2; - - // Description of transformation. This would only contain more than one - // element if there were multiple matching transformations and which one to - // apply was ambiguous. Not set for states that contain no transformation, - // currently only state that contains no transformation is - // TransformationResultStateType.METADATA_UNRETRIEVABLE. - repeated TransformationDescription transformation = 3; - - // Status of the transformation, if transformation was not successful, this - // will specify what caused it to fail, otherwise it will show that the - // transformation was successful. - TransformationResultStatus status_details = 4; - - // The number of bytes that were transformed. If transformation was - // unsuccessful or did not take place because there was no content to - // transform, this will be zero. - int64 transformed_bytes = 5; - - // The precise location of the transformed content in the original container. - TransformationLocation transformation_location = 6; -} - -// Specifies the location of a transformation. -message TransformationLocation { - oneof location_type { - // For infotype transformations, link to the corresponding findings ID so - // that location information does not need to be duplicated. Each findings - // ID correlates to an entry in the findings output table, this table only - // gets created when users specify to save findings (add the save findings - // action to the request). - string finding_id = 1; - - // For record transformations, provide a field and container information. - RecordTransformation record_transformation = 2; - } - - // Information about the functionality of the container where this finding - // occurred, if available. - TransformationContainerType container_type = 3; -} - -message RecordTransformation { - // For record transformations, provide a field. - FieldId field_id = 1; - - // Findings container modification timestamp, if applicable. - google.protobuf.Timestamp container_timestamp = 2; - - // Container version, if available ("generation" for Cloud Storage). - string container_version = 3; -} - -message TransformationResultStatus { - // Transformation result status type, this will be either SUCCESS, or it will - // be the reason for why the transformation was not completely successful. - TransformationResultStatusType result_status_type = 1; - - // Detailed error codes and messages - google.rpc.Status details = 2; -} - -// Enum of possible outcomes of transformations. SUCCESS if transformation and -// storing of transformation was successful, otherwise, reason for not -// transforming. -enum TransformationResultStatusType { - STATE_TYPE_UNSPECIFIED = 0; - - // This will be set when a finding could not be transformed (i.e. outside user - // set bucket range). - INVALID_TRANSFORM = 1; - - // This will be set when a BigQuery transformation was successful but could - // not be stored back in BigQuery because the transformed row exceeds - // BigQuery's max row size. - BIGQUERY_MAX_ROW_SIZE_EXCEEDED = 2; - - // This will be set when there is a finding in the custom metadata of a file, - // but at the write time of the transformed file, this key / value pair is - // unretrievable. - METADATA_UNRETRIEVABLE = 3; - - // This will be set when the transformation and storing of it is successful. - SUCCESS = 4; -} - -// Describes functionality of a given container in its original format. -enum TransformationContainerType { - TRANSFORM_UNKNOWN_CONTAINER = 0; - - TRANSFORM_BODY = 1; - - TRANSFORM_METADATA = 2; - - TRANSFORM_TABLE = 3; -} - -// An enum of rules that can be used to transform a value. Can be a -// record suppression, or one of the transformation rules specified under -// `PrimitiveTransformation`. -enum TransformationType { - // Unused - TRANSFORMATION_TYPE_UNSPECIFIED = 0; - - // Record suppression - RECORD_SUPPRESSION = 1; - - // Replace value - REPLACE_VALUE = 2; - - // Replace value using a dictionary. - REPLACE_DICTIONARY = 15; - - // Redact - REDACT = 3; - - // Character mask - CHARACTER_MASK = 4; - - // FFX-FPE - CRYPTO_REPLACE_FFX_FPE = 5; - - // Fixed size bucketing - FIXED_SIZE_BUCKETING = 6; - - // Bucketing - BUCKETING = 7; - - // Replace with info type - REPLACE_WITH_INFO_TYPE = 8; - - // Time part - TIME_PART = 9; - - // Crypto hash - CRYPTO_HASH = 10; - - // Date shift - DATE_SHIFT = 12; - - // Deterministic crypto - CRYPTO_DETERMINISTIC_CONFIG = 13; - - // Redact image - REDACT_IMAGE = 14; -} - -// Config for storing transformation details. -message TransformationDetailsStorageConfig { - // Location to store the transformation summary. - oneof type { - // The BigQuery table in which to store the output. This may be an existing - // table or in a new table in an existing dataset. - // If table_id is not set a new one will be generated for you with the - // following format: - // dlp_googleapis_transformation_details_yyyy_mm_dd_[dlp_job_id]. Pacific - // time zone will be used for generating the date details. - BigQueryTable table = 1; - } -} - -// Schedule for inspect job triggers. -message Schedule { - oneof option { - // With this option a job is started on a regular periodic basis. For - // example: every day (86400 seconds). - // - // A scheduled start time will be skipped if the previous - // execution has not ended when its scheduled time occurs. - // - // This value must be set to a time duration greater than or equal - // to 1 day and can be no longer than 60 days. - google.protobuf.Duration recurrence_period_duration = 1; - } -} - -// Job trigger option for hybrid jobs. Jobs must be manually created -// and finished. -message Manual { - -} - -// The inspectTemplate contains a configuration (set of types of sensitive data -// to be detected) to be used anywhere you otherwise would normally specify -// InspectConfig. See https://cloud.google.com/dlp/docs/concepts-templates -// to learn more. -message InspectTemplate { - option (google.api.resource) = { - type: "dlp.googleapis.com/InspectTemplate" - pattern: "organizations/{organization}/inspectTemplates/{inspect_template}" - pattern: "projects/{project}/inspectTemplates/{inspect_template}" - pattern: "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}" - pattern: "projects/{project}/locations/{location}/inspectTemplates/{inspect_template}" - }; - - // Output only. The template name. - // - // The template will have one of the following formats: - // `projects/PROJECT_ID/inspectTemplates/TEMPLATE_ID` OR - // `organizations/ORGANIZATION_ID/inspectTemplates/TEMPLATE_ID`; - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Display name (max 256 chars). - string display_name = 2; - - // Short description (max 256 chars). - string description = 3; - - // Output only. The creation timestamp of an inspectTemplate. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of an inspectTemplate. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The core content of the template. Configuration of the scanning process. - InspectConfig inspect_config = 6; -} - -// DeidentifyTemplates contains instructions on how to de-identify content. -// See https://cloud.google.com/dlp/docs/concepts-templates to learn more. -message DeidentifyTemplate { - option (google.api.resource) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - pattern: "organizations/{organization}/deidentifyTemplates/{deidentify_template}" - pattern: "projects/{project}/deidentifyTemplates/{deidentify_template}" - pattern: "organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}" - pattern: "projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}" - }; - - // Output only. The template name. - // - // The template will have one of the following formats: - // `projects/PROJECT_ID/deidentifyTemplates/TEMPLATE_ID` OR - // `organizations/ORGANIZATION_ID/deidentifyTemplates/TEMPLATE_ID` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Display name (max 256 chars). - string display_name = 2; - - // Short description (max 256 chars). - string description = 3; - - // Output only. The creation timestamp of an inspectTemplate. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of an inspectTemplate. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The core content of the template. - DeidentifyConfig deidentify_config = 6; -} - -// Details information about an error encountered during job execution or -// the results of an unsuccessful activation of the JobTrigger. -message Error { - // Detailed error codes and messages. - google.rpc.Status details = 1; - - // The times the error occurred. - repeated google.protobuf.Timestamp timestamps = 2; -} - -// Contains a configuration to make dlp api calls on a repeating basis. -// See https://cloud.google.com/dlp/docs/concepts-job-triggers to learn more. -message JobTrigger { - option (google.api.resource) = { - type: "dlp.googleapis.com/JobTrigger" - pattern: "projects/{project}/jobTriggers/{job_trigger}" - pattern: "projects/{project}/locations/{location}/jobTriggers/{job_trigger}" - }; - - // What event needs to occur for a new job to be started. - message Trigger { - oneof trigger { - // Create a job on a repeating basis based on the elapse of time. - Schedule schedule = 1; - - // For use with hybrid jobs. Jobs must be manually created and finished. - Manual manual = 2; - } - } - - // Whether the trigger is currently active. If PAUSED or CANCELLED, no jobs - // will be created with this configuration. The service may automatically - // pause triggers experiencing frequent errors. To restart a job, set the - // status to HEALTHY after correcting user errors. - enum Status { - // Unused. - STATUS_UNSPECIFIED = 0; - - // Trigger is healthy. - HEALTHY = 1; - - // Trigger is temporarily paused. - PAUSED = 2; - - // Trigger is cancelled and can not be resumed. - CANCELLED = 3; - } - - // Unique resource name for the triggeredJob, assigned by the service when the - // triggeredJob is created, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1; - - // Display name (max 100 chars) - string display_name = 2; - - // User provided description (max 256 chars) - string description = 3; - - // The configuration details for the specific type of job to run. - oneof job { - // For inspect jobs, a snapshot of the configuration. - InspectJobConfig inspect_job = 4; - } - - // A list of triggers which will be OR'ed together. Only one in the list - // needs to trigger for a job to be started. The list may contain only - // a single Schedule trigger and must have at least one object. - repeated Trigger triggers = 5; - - // Output only. A stream of errors encountered when the trigger was activated. Repeated - // errors may result in the JobTrigger automatically being paused. - // Will return the last 100 errors. Whenever the JobTrigger is modified - // this list will be cleared. - repeated Error errors = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The creation timestamp of a triggeredJob. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of a triggeredJob. - google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp of the last time this trigger executed. - google.protobuf.Timestamp last_run_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. A status for this trigger. - Status status = 10 [(google.api.field_behavior) = REQUIRED]; -} - -// A task to execute on the completion of a job. -// See https://cloud.google.com/dlp/docs/concepts-actions to learn more. -message Action { - // If set, the detailed findings will be persisted to the specified - // OutputStorageConfig. Only a single instance of this action can be - // specified. - // Compatible with: Inspect, Risk - message SaveFindings { - // Location to store findings outside of DLP. - OutputStorageConfig output_config = 1; - } - - // Publish a message into a given Pub/Sub topic when DlpJob has completed. The - // message contains a single field, `DlpJobName`, which is equal to the - // finished job's - // [`DlpJob.name`](https://cloud.google.com/dlp/docs/reference/rest/v2/projects.dlpJobs#DlpJob). - // Compatible with: Inspect, Risk - message PublishToPubSub { - // Cloud Pub/Sub topic to send notifications to. The topic must have given - // publishing access rights to the DLP API service account executing - // the long running DlpJob sending the notifications. - // Format is projects/{project}/topics/{topic}. - string topic = 1; - } - - // Publish the result summary of a DlpJob to the Cloud Security - // Command Center (CSCC Alpha). - // This action is only available for projects which are parts of - // an organization and whitelisted for the alpha Cloud Security Command - // Center. - // The action will publish the count of finding instances and their info - // types. The summary of findings will be persisted in CSCC and are governed - // by CSCC service-specific policy, see - // https://cloud.google.com/terms/service-terms Only a single instance of this - // action can be specified. Compatible with: Inspect - message PublishSummaryToCscc { - - } - - // Publish findings of a DlpJob to Data Catalog. In Data Catalog, tag - // templates are applied to the resource that Cloud DLP scanned. Data - // Catalog tag templates are stored in the same project and region where the - // BigQuery table exists. For Cloud DLP to create and apply the tag template, - // the Cloud DLP service agent must have the - // `roles/datacatalog.tagTemplateOwner` permission on the project. The tag - // template contains fields summarizing the results of the DlpJob. Any field - // values previously written by another DlpJob are deleted. [InfoType naming - // patterns][google.privacy.dlp.v2.InfoType] are strictly enforced when using - // this feature. - // - // Findings are persisted in Data Catalog storage and are governed by - // service-specific policies for Data Catalog. For more information, see - // [Service Specific Terms](https://cloud.google.com/terms/service-terms). - // - // Only a single instance of this action can be specified. This action is - // allowed only if all resources being scanned are BigQuery tables. - // Compatible with: Inspect - message PublishFindingsToCloudDataCatalog { - - } - - // Create a de-identified copy of the requested table or files. - // - // A TransformationDetail will be created for each transformation. - // - // If any rows in BigQuery are skipped during de-identification - // (transformation errors or row size exceeds BigQuery insert API limits) they - // are placed in the failure output table. If the original row exceeds - // the BigQuery insert API limit it will be truncated when written to the - // failure output table. The failure output table can be set in the - // action.deidentify.output.big_query_output.deidentified_failure_output_table - // field, if no table is set, a table will be automatically created in the - // same project and dataset as the original table. - // - // Compatible with: Inspect - message Deidentify { - // User specified deidentify templates and configs for structured, - // unstructured, and image files. - TransformationConfig transformation_config = 7; - - // Config for storing transformation details. This is separate from the - // de-identified content, and contains metadata about the successful - // transformations and/or failures that occurred while de-identifying. This - // needs to be set in order for users to access information about the status - // of each transformation (see - // [TransformationDetails][google.privacy.dlp.v2.TransformationDetails] - // message for more information about what is noted). - TransformationDetailsStorageConfig transformation_details_storage_config = 3; - - oneof output { - // Required. User settable Cloud Storage bucket and folders to store de-identified - // files. This field must be set for cloud storage deidentification. The - // output Cloud Storage bucket must be different from the input bucket. - // De-identified files will overwrite files in the output path. - // - // Form of: gs://bucket/folder/ or gs://bucket - string cloud_storage_output = 9 [(google.api.field_behavior) = REQUIRED]; - } - - // List of user-specified file type groups to transform. If specified, only - // the files with these filetypes will be transformed. If empty, all - // supported files will be transformed. Supported types may be automatically - // added over time. If a file type is set in this field that isn't supported - // by the Deidentify action then the job will fail and will not be - // successfully created/started. Currently the only filetypes supported are: - // IMAGES, TEXT_FILES, CSV, TSV. - repeated FileType file_types_to_transform = 8; - } - - // Sends an email when the job completes. The email goes to IAM project owners - // and technical [Essential - // Contacts](https://cloud.google.com/resource-manager/docs/managing-notification-contacts). - message JobNotificationEmails { - - } - - // Enable Stackdriver metric dlp.googleapis.com/finding_count. This - // will publish a metric to stack driver on each infotype requested and - // how many findings were found for it. CustomDetectors will be bucketed - // as 'Custom' under the Stackdriver label 'info_type'. - message PublishToStackdriver { - - } - - oneof action { - // Save resulting findings in a provided location. - SaveFindings save_findings = 1; - - // Publish a notification to a Pub/Sub topic. - PublishToPubSub pub_sub = 2; - - // Publish summary to Cloud Security Command Center (Alpha). - PublishSummaryToCscc publish_summary_to_cscc = 3; - - // Publish findings to Cloud Datahub. - PublishFindingsToCloudDataCatalog publish_findings_to_cloud_data_catalog = 5; - - // Create a de-identified copy of the input data. - Deidentify deidentify = 7; - - // Sends an email when the job completes. The email goes to IAM project - // owners and technical [Essential - // Contacts](https://cloud.google.com/resource-manager/docs/managing-notification-contacts). - JobNotificationEmails job_notification_emails = 8; - - // Enable Stackdriver metric dlp.googleapis.com/finding_count. - PublishToStackdriver publish_to_stackdriver = 9; - } -} - -// User specified templates and configs for how to deidentify structured, -// unstructures, and image files. User must provide either a unstructured -// deidentify template or at least one redact image config. -message TransformationConfig { - // De-identify template. - // If this template is specified, it will serve as the default de-identify - // template. This template cannot contain `record_transformations` since it - // can be used for unstructured content such as free-form text files. If this - // template is not set, a default `ReplaceWithInfoTypeConfig` will be used to - // de-identify unstructured content. - string deidentify_template = 1; - - // Structured de-identify template. - // If this template is specified, it will serve as the de-identify template - // for structured content such as delimited files and tables. If this template - // is not set but the `deidentify_template` is set, then `deidentify_template` - // will also apply to the structured content. If neither template is set, a - // default `ReplaceWithInfoTypeConfig` will be used to de-identify structured - // content. - string structured_deidentify_template = 2; - - // Image redact template. - // If this template is specified, it will serve as the de-identify template - // for images. If this template is not set, all findings in the image will be - // redacted with a black box. - string image_redact_template = 4; -} - -// Request message for CreateInspectTemplate. -message CreateInspectTemplateRequest { - // Required. Parent resource name. - // - // The format of this value varies depending on the scope of the request - // (project or organization) and whether you have [specified a processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // + Organizations scope, location specified:
- // `organizations/`ORG_ID`/locations/`LOCATION_ID - // + Organizations scope, no location specified (defaults to global):
- // `organizations/`ORG_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/InspectTemplate" - } - ]; - - // Required. The InspectTemplate to create. - InspectTemplate inspect_template = 2 [(google.api.field_behavior) = REQUIRED]; - - // The template id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string template_id = 3; - - // Deprecated. This field has no effect. - string location_id = 4; -} - -// Request message for UpdateInspectTemplate. -message UpdateInspectTemplateRequest { - // Required. Resource name of organization and inspectTemplate to be updated, for - // example `organizations/433245324/inspectTemplates/432452342` or - // projects/project-id/inspectTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/InspectTemplate" - } - ]; - - // New InspectTemplate value. - InspectTemplate inspect_template = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetInspectTemplate. -message GetInspectTemplateRequest { - // Required. Resource name of the organization and inspectTemplate to be read, for - // example `organizations/433245324/inspectTemplates/432452342` or - // projects/project-id/inspectTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/InspectTemplate" - } - ]; -} - -// Request message for ListInspectTemplates. -message ListInspectTemplatesRequest { - // Required. Parent resource name. - // - // The format of this value varies depending on the scope of the request - // (project or organization) and whether you have [specified a processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // + Organizations scope, location specified:
- // `organizations/`ORG_ID`/locations/`LOCATION_ID - // + Organizations scope, no location specified (defaults to global):
- // `organizations/`ORG_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/InspectTemplate" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to `ListInspectTemplates`. - string page_token = 2; - - // Size of the page, can be limited by the server. If zero server returns - // a page of max size 100. - int32 page_size = 3; - - // Comma separated list of fields to order by, - // followed by `asc` or `desc` postfix. This list is case-insensitive, - // default sorting order is ascending, redundant space characters are - // insignificant. - // - // Example: `name asc,update_time, create_time desc` - // - // Supported fields are: - // - // - `create_time`: corresponds to the time the template was created. - // - `update_time`: corresponds to the time the template was last updated. - // - `name`: corresponds to the template's name. - // - `display_name`: corresponds to the template's display name. - string order_by = 4; - - // Deprecated. This field has no effect. - string location_id = 5; -} - -// Response message for ListInspectTemplates. -message ListInspectTemplatesResponse { - // List of inspectTemplates, up to page_size in ListInspectTemplatesRequest. - repeated InspectTemplate inspect_templates = 1; - - // If the next page is available then the next page token to be used - // in following ListInspectTemplates request. - string next_page_token = 2; -} - -// Request message for DeleteInspectTemplate. -message DeleteInspectTemplateRequest { - // Required. Resource name of the organization and inspectTemplate to be deleted, for - // example `organizations/433245324/inspectTemplates/432452342` or - // projects/project-id/inspectTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/InspectTemplate" - } - ]; -} - -// Request message for CreateJobTrigger. -message CreateJobTriggerRequest { - // Required. Parent resource name. - // - // The format of this value varies depending on whether you have [specified a - // processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/JobTrigger" - } - ]; - - // Required. The JobTrigger to create. - JobTrigger job_trigger = 2 [(google.api.field_behavior) = REQUIRED]; - - // The trigger id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string trigger_id = 3; - - // Deprecated. This field has no effect. - string location_id = 4; -} - -// Request message for ActivateJobTrigger. -message ActivateJobTriggerRequest { - // Required. Resource name of the trigger to activate, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; -} - -// Request message for UpdateJobTrigger. -message UpdateJobTriggerRequest { - // Required. Resource name of the project and the triggeredJob, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; - - // New JobTrigger value. - JobTrigger job_trigger = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetJobTrigger. -message GetJobTriggerRequest { - // Required. Resource name of the project and the triggeredJob, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; -} - -// Request message for CreateDlpJobRequest. Used to initiate long running -// jobs such as calculating risk metrics or inspecting Google Cloud -// Storage. -message CreateDlpJobRequest { - // Required. Parent resource name. - // - // The format of this value varies depending on whether you have [specified a - // processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DlpJob" - } - ]; - - // The configuration details for the specific type of job to run. - oneof job { - // An inspection job scans a storage repository for InfoTypes. - InspectJobConfig inspect_job = 2; - - // A risk analysis job calculates re-identification risk metrics for a - // BigQuery table. - RiskAnalysisJobConfig risk_job = 3; - } - - // The job id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string job_id = 4; - - // Deprecated. This field has no effect. - string location_id = 5; -} - -// Request message for ListJobTriggers. -message ListJobTriggersRequest { - // Required. Parent resource name. - // - // The format of this value varies depending on whether you have [specified a - // processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/JobTrigger" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to ListJobTriggers. `order_by` field must not - // change for subsequent calls. - string page_token = 2; - - // Size of the page, can be limited by a server. - int32 page_size = 3; - - // Comma separated list of triggeredJob fields to order by, - // followed by `asc` or `desc` postfix. This list is case-insensitive, - // default sorting order is ascending, redundant space characters are - // insignificant. - // - // Example: `name asc,update_time, create_time desc` - // - // Supported fields are: - // - // - `create_time`: corresponds to the time the JobTrigger was created. - // - `update_time`: corresponds to the time the JobTrigger was last updated. - // - `last_run_time`: corresponds to the last time the JobTrigger ran. - // - `name`: corresponds to the JobTrigger's name. - // - `display_name`: corresponds to the JobTrigger's display name. - // - `status`: corresponds to JobTrigger's status. - string order_by = 4; - - // Allows filtering. - // - // Supported syntax: - // - // * Filter expressions are made up of one or more restrictions. - // * Restrictions can be combined by `AND` or `OR` logical operators. A - // sequence of restrictions implicitly uses `AND`. - // * A restriction has the form of `{field} {operator} {value}`. - // * Supported fields/values for inspect triggers: - // - `status` - HEALTHY|PAUSED|CANCELLED - // - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - // - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - // quotation marks. Nanoseconds are ignored. - // - 'error_count' - Number of errors that have occurred while running. - // * The operator must be `=` or `!=` for status and inspected_storage. - // - // Examples: - // - // * inspected_storage = cloud_storage AND status = HEALTHY - // * inspected_storage = cloud_storage OR inspected_storage = bigquery - // * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - // * last_run_time > \"2017-12-12T00:00:00+00:00\" - // - // The length of this field should be no more than 500 characters. - string filter = 5; - - // The type of jobs. Will use `DlpJobType.INSPECT` if not set. - DlpJobType type = 6; - - // Deprecated. This field has no effect. - string location_id = 7; -} - -// Response message for ListJobTriggers. -message ListJobTriggersResponse { - // List of triggeredJobs, up to page_size in ListJobTriggersRequest. - repeated JobTrigger job_triggers = 1; - - // If the next page is available then the next page token to be used - // in following ListJobTriggers request. - string next_page_token = 2; -} - -// Request message for DeleteJobTrigger. -message DeleteJobTriggerRequest { - // Required. Resource name of the project and the triggeredJob, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; -} - -// Controls what and how to inspect for findings. -message InspectJobConfig { - // The data to scan. - StorageConfig storage_config = 1; - - // How and what to scan for. - InspectConfig inspect_config = 2; - - // If provided, will be used as the default for all values in InspectConfig. - // `inspect_config` will be merged into the values persisted as part of the - // template. - string inspect_template_name = 3; - - // Actions to execute at the completion of the job. - repeated Action actions = 4; -} - -// A task to execute when a data profile has been generated. -message DataProfileAction { - // If set, the detailed data profiles will be persisted to the location - // of your choice whenever updated. - message Export { - // Store all table and column profiles in an existing table or a new table - // in an existing dataset. Each re-generation will result in a new row in - // BigQuery. - BigQueryTable profile_table = 1; - } - - // Send a Pub/Sub message into the given Pub/Sub topic to connect other - // systems to data profile generation. The message payload data will - // be the byte serialization of `DataProfilePubSubMessage`. - message PubSubNotification { - // The levels of detail that can be included in the Pub/Sub message. - enum DetailLevel { - // Unused. - DETAIL_LEVEL_UNSPECIFIED = 0; - - // The full table data profile. - TABLE_PROFILE = 1; - - // The resource name of the table. - RESOURCE_NAME = 2; - } - - // Cloud Pub/Sub topic to send notifications to. - // Format is projects/{project}/topics/{topic}. - string topic = 1; - - // The type of event that triggers a Pub/Sub. At most one - // `PubSubNotification` per EventType is permitted. - EventType event = 2; - - // Conditions (e.g., data risk or sensitivity level) for triggering a - // Pub/Sub. - DataProfilePubSubCondition pubsub_condition = 3; - - // How much data to include in the Pub/Sub message. If the user wishes to - // limit the size of the message, they can use resource_name and fetch the - // profile fields they wish to. Per table profile (not per column). - DetailLevel detail_of_message = 4; - } - - // Types of event that can trigger an action. - enum EventType { - // Unused. - EVENT_TYPE_UNSPECIFIED = 0; - - // New profile (not a re-profile). - NEW_PROFILE = 1; - - // Changed one of the following profile metrics: - // * Table data risk score - // * Table sensitivity score - // * Table resource visibility - // * Table encryption type - // * Table predicted infoTypes - // * Table other infoTypes - CHANGED_PROFILE = 2; - - // Table data risk score or sensitivity score increased. - SCORE_INCREASED = 3; - - // A user (non-internal) error occurred. - ERROR_CHANGED = 4; - } - - oneof action { - // Export data profiles into a provided location. - Export export_data = 1; - - // Publish a message into the Pub/Sub topic. - PubSubNotification pub_sub_notification = 2; - } -} - -// Configuration for setting up a job to scan resources for profile generation. -// Only one data profile configuration may exist per organization, folder, -// or project. -// -// The generated data profiles are retained according to the -// [data retention policy] -// (https://cloud.google.com/dlp/docs/data-profiles#retention). -message DataProfileJobConfig { - // The data to scan. - DataProfileLocation location = 1; - - // The project that will run the scan. The DLP service - // account that exists within this project must have access to all resources - // that are profiled, and the Cloud DLP API must be enabled. - string project_id = 5; - - // Detection logic for profile generation. - // - // Not all template features are used by profiles. FindingLimits, - // include_quote and exclude_info_types have no impact on - // data profiling. - // - // Multiple templates may be provided if there is data in multiple regions. - // At most one template must be specified per-region (including "global"). - // Each region is scanned using the applicable template. If no region-specific - // template is specified, but a "global" template is specified, it will be - // copied to that region and used instead. If no global or region-specific - // template is provided for a region with data, that region's data will not be - // scanned. - // - // For more information, see - // https://cloud.google.com/dlp/docs/data-profiles#data_residency. - repeated string inspect_templates = 7; - - // Actions to execute at the completion of the job. - repeated DataProfileAction data_profile_actions = 6; -} - -// The data that will be profiled. -message DataProfileLocation { - // The location to be scanned. - oneof location { - // The ID of an organization to scan. - int64 organization_id = 1; - - // The ID of the Folder within an organization to scan. - int64 folder_id = 2; - } -} - -// Combines all of the information about a DLP job. -message DlpJob { - option (google.api.resource) = { - type: "dlp.googleapis.com/DlpJob" - pattern: "projects/{project}/dlpJobs/{dlp_job}" - pattern: "projects/{project}/locations/{location}/dlpJobs/{dlp_job}" - }; - - // Possible states of a job. New items may be added. - enum JobState { - // Unused. - JOB_STATE_UNSPECIFIED = 0; - - // The job has not yet started. - PENDING = 1; - - // The job is currently running. Once a job has finished it will transition - // to FAILED or DONE. - RUNNING = 2; - - // The job is no longer running. - DONE = 3; - - // The job was canceled before it could be completed. - CANCELED = 4; - - // The job had an error and did not complete. - FAILED = 5; - - // The job is currently accepting findings via hybridInspect. - // A hybrid job in ACTIVE state may continue to have findings added to it - // through the calling of hybridInspect. After the job has finished no more - // calls to hybridInspect may be made. ACTIVE jobs can transition to DONE. - ACTIVE = 6; - } - - // The server-assigned name. - string name = 1; - - // The type of job. - DlpJobType type = 2; - - // State of a job. - JobState state = 3; - - oneof details { - // Results from analyzing risk of a data source. - AnalyzeDataSourceRiskDetails risk_details = 4; - - // Results from inspecting a data source. - InspectDataSourceDetails inspect_details = 5; - } - - // Time when the job was created. - google.protobuf.Timestamp create_time = 6; - - // Time when the job started. - google.protobuf.Timestamp start_time = 7; - - // Time when the job finished. - google.protobuf.Timestamp end_time = 8; - - // If created by a job trigger, the resource name of the trigger that - // instantiated the job. - string job_trigger_name = 10; - - // A stream of errors encountered running the job. - repeated Error errors = 11; -} - -// The request message for [DlpJobs.GetDlpJob][]. -message GetDlpJobRequest { - // Required. The name of the DlpJob resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - } - ]; -} - -// The request message for listing DLP jobs. -message ListDlpJobsRequest { - // Required. Parent resource name. - // - // The format of this value varies depending on whether you have [specified a - // processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DlpJob" - } - ]; - - // Allows filtering. - // - // Supported syntax: - // - // * Filter expressions are made up of one or more restrictions. - // * Restrictions can be combined by `AND` or `OR` logical operators. A - // sequence of restrictions implicitly uses `AND`. - // * A restriction has the form of `{field} {operator} {value}`. - // * Supported fields/values for inspect jobs: - // - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - // - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - // - `trigger_name` - The name of the trigger that created the job. - // - 'end_time` - Corresponds to the time the job finished. - // - 'start_time` - Corresponds to the time the job finished. - // * Supported fields for risk analysis jobs: - // - `state` - RUNNING|CANCELED|FINISHED|FAILED - // - 'end_time` - Corresponds to the time the job finished. - // - 'start_time` - Corresponds to the time the job finished. - // * The operator must be `=` or `!=`. - // - // Examples: - // - // * inspected_storage = cloud_storage AND state = done - // * inspected_storage = cloud_storage OR inspected_storage = bigquery - // * inspected_storage = cloud_storage AND (state = done OR state = canceled) - // * end_time > \"2017-12-12T00:00:00+00:00\" - // - // The length of this field should be no more than 500 characters. - string filter = 1; - - // The standard list page size. - int32 page_size = 2; - - // The standard list page token. - string page_token = 3; - - // The type of job. Defaults to `DlpJobType.INSPECT` - DlpJobType type = 5; - - // Comma separated list of fields to order by, - // followed by `asc` or `desc` postfix. This list is case-insensitive, - // default sorting order is ascending, redundant space characters are - // insignificant. - // - // Example: `name asc, end_time asc, create_time desc` - // - // Supported fields are: - // - // - `create_time`: corresponds to the time the job was created. - // - `end_time`: corresponds to the time the job ended. - // - `name`: corresponds to the job's name. - // - `state`: corresponds to `state` - string order_by = 6; - - // Deprecated. This field has no effect. - string location_id = 7; -} - -// The response message for listing DLP jobs. -message ListDlpJobsResponse { - // A list of DlpJobs that matches the specified filter in the request. - repeated DlpJob jobs = 1; - - // The standard List next-page token. - string next_page_token = 2; -} - -// The request message for canceling a DLP job. -message CancelDlpJobRequest { - // Required. The name of the DlpJob resource to be cancelled. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - } - ]; -} - -// The request message for finishing a DLP hybrid job. -message FinishDlpJobRequest { - // Required. The name of the DlpJob resource to be cancelled. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - } - ]; -} - -// The request message for deleting a DLP job. -message DeleteDlpJobRequest { - // Required. The name of the DlpJob resource to be deleted. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - } - ]; -} - -// Request message for CreateDeidentifyTemplate. -message CreateDeidentifyTemplateRequest { - // Required. Parent resource name. - // - // The format of this value varies depending on the scope of the request - // (project or organization) and whether you have [specified a processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // + Organizations scope, location specified:
- // `organizations/`ORG_ID`/locations/`LOCATION_ID - // + Organizations scope, no location specified (defaults to global):
- // `organizations/`ORG_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; - - // Required. The DeidentifyTemplate to create. - DeidentifyTemplate deidentify_template = 2 [(google.api.field_behavior) = REQUIRED]; - - // The template id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string template_id = 3; - - // Deprecated. This field has no effect. - string location_id = 4; -} - -// Request message for UpdateDeidentifyTemplate. -message UpdateDeidentifyTemplateRequest { - // Required. Resource name of organization and deidentify template to be updated, for - // example `organizations/433245324/deidentifyTemplates/432452342` or - // projects/project-id/deidentifyTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; - - // New DeidentifyTemplate value. - DeidentifyTemplate deidentify_template = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetDeidentifyTemplate. -message GetDeidentifyTemplateRequest { - // Required. Resource name of the organization and deidentify template to be read, for - // example `organizations/433245324/deidentifyTemplates/432452342` or - // projects/project-id/deidentifyTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; -} - -// Request message for ListDeidentifyTemplates. -message ListDeidentifyTemplatesRequest { - // Required. Parent resource name. - // - // The format of this value varies depending on the scope of the request - // (project or organization) and whether you have [specified a processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // + Organizations scope, location specified:
- // `organizations/`ORG_ID`/locations/`LOCATION_ID - // + Organizations scope, no location specified (defaults to global):
- // `organizations/`ORG_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to `ListDeidentifyTemplates`. - string page_token = 2; - - // Size of the page, can be limited by the server. If zero server returns - // a page of max size 100. - int32 page_size = 3; - - // Comma separated list of fields to order by, - // followed by `asc` or `desc` postfix. This list is case-insensitive, - // default sorting order is ascending, redundant space characters are - // insignificant. - // - // Example: `name asc,update_time, create_time desc` - // - // Supported fields are: - // - // - `create_time`: corresponds to the time the template was created. - // - `update_time`: corresponds to the time the template was last updated. - // - `name`: corresponds to the template's name. - // - `display_name`: corresponds to the template's display name. - string order_by = 4; - - // Deprecated. This field has no effect. - string location_id = 5; -} - -// Response message for ListDeidentifyTemplates. -message ListDeidentifyTemplatesResponse { - // List of deidentify templates, up to page_size in - // ListDeidentifyTemplatesRequest. - repeated DeidentifyTemplate deidentify_templates = 1; - - // If the next page is available then the next page token to be used - // in following ListDeidentifyTemplates request. - string next_page_token = 2; -} - -// Request message for DeleteDeidentifyTemplate. -message DeleteDeidentifyTemplateRequest { - // Required. Resource name of the organization and deidentify template to be deleted, - // for example `organizations/433245324/deidentifyTemplates/432452342` or - // projects/project-id/deidentifyTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; -} - -// Configuration for a custom dictionary created from a data source of any size -// up to the maximum size defined in the -// [limits](https://cloud.google.com/dlp/limits) page. The artifacts of -// dictionary creation are stored in the specified Cloud Storage -// location. Consider using `CustomInfoType.Dictionary` for smaller dictionaries -// that satisfy the size requirements. -message LargeCustomDictionaryConfig { - // Location to store dictionary artifacts in Cloud Storage. These files - // will only be accessible by project owners and the DLP API. If any of these - // artifacts are modified, the dictionary is considered invalid and can no - // longer be used. - CloudStoragePath output_path = 1; - - oneof source { - // Set of files containing newline-delimited lists of dictionary phrases. - CloudStorageFileSet cloud_storage_file_set = 2; - - // Field in a BigQuery table where each cell represents a dictionary phrase. - BigQueryField big_query_field = 3; - } -} - -// Summary statistics of a custom dictionary. -message LargeCustomDictionaryStats { - // Approximate number of distinct phrases in the dictionary. - int64 approx_num_phrases = 1; -} - -// Configuration for stored infoTypes. All fields and subfield are provided -// by the user. For more information, see -// https://cloud.google.com/dlp/docs/creating-custom-infotypes. -message StoredInfoTypeConfig { - // Display name of the StoredInfoType (max 256 characters). - string display_name = 1; - - // Description of the StoredInfoType (max 256 characters). - string description = 2; - - // Stored infotype types. - oneof type { - // StoredInfoType where findings are defined by a dictionary of phrases. - LargeCustomDictionaryConfig large_custom_dictionary = 3; - - // Store dictionary-based CustomInfoType. - CustomInfoType.Dictionary dictionary = 4; - - // Store regular expression-based StoredInfoType. - CustomInfoType.Regex regex = 5; - } -} - -// Statistics for a StoredInfoType. -message StoredInfoTypeStats { - // Stat types - oneof type { - // StoredInfoType where findings are defined by a dictionary of phrases. - LargeCustomDictionaryStats large_custom_dictionary = 1; - } -} - -// Version of a StoredInfoType, including the configuration used to build it, -// create timestamp, and current state. -message StoredInfoTypeVersion { - // StoredInfoType configuration. - StoredInfoTypeConfig config = 1; - - // Create timestamp of the version. Read-only, determined by the system - // when the version is created. - google.protobuf.Timestamp create_time = 2; - - // Stored info type version state. Read-only, updated by the system - // during dictionary creation. - StoredInfoTypeState state = 3; - - // Errors that occurred when creating this storedInfoType version, or - // anomalies detected in the storedInfoType data that render it unusable. Only - // the five most recent errors will be displayed, with the most recent error - // appearing first. - // - // For example, some of the data for stored custom dictionaries is put in - // the user's Cloud Storage bucket, and if this data is modified or - // deleted by the user or another system, the dictionary becomes invalid. - // - // If any errors occur, fix the problem indicated by the error message and - // use the UpdateStoredInfoType API method to create another version of the - // storedInfoType to continue using it, reusing the same `config` if it was - // not the source of the error. - repeated Error errors = 4; - - // Statistics about this storedInfoType version. - StoredInfoTypeStats stats = 5; -} - -// StoredInfoType resource message that contains information about the current -// version and any pending updates. -message StoredInfoType { - option (google.api.resource) = { - type: "dlp.googleapis.com/StoredInfoType" - pattern: "organizations/{organization}/storedInfoTypes/{stored_info_type}" - pattern: "projects/{project}/storedInfoTypes/{stored_info_type}" - pattern: "organizations/{organization}/locations/{location}/storedInfoTypes/{stored_info_type}" - pattern: "projects/{project}/locations/{location}/storedInfoTypes/{stored_info_type}" - }; - - // Resource name. - string name = 1; - - // Current version of the stored info type. - StoredInfoTypeVersion current_version = 2; - - // Pending versions of the stored info type. Empty if no versions are - // pending. - repeated StoredInfoTypeVersion pending_versions = 3; -} - -// Request message for CreateStoredInfoType. -message CreateStoredInfoTypeRequest { - // Required. Parent resource name. - // - // The format of this value varies depending on the scope of the request - // (project or organization) and whether you have [specified a processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // + Organizations scope, location specified:
- // `organizations/`ORG_ID`/locations/`LOCATION_ID - // + Organizations scope, no location specified (defaults to global):
- // `organizations/`ORG_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/StoredInfoType" - } - ]; - - // Required. Configuration of the storedInfoType to create. - StoredInfoTypeConfig config = 2 [(google.api.field_behavior) = REQUIRED]; - - // The storedInfoType ID can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string stored_info_type_id = 3; - - // Deprecated. This field has no effect. - string location_id = 4; -} - -// Request message for UpdateStoredInfoType. -message UpdateStoredInfoTypeRequest { - // Required. Resource name of organization and storedInfoType to be updated, for - // example `organizations/433245324/storedInfoTypes/432452342` or - // projects/project-id/storedInfoTypes/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/StoredInfoType" - } - ]; - - // Updated configuration for the storedInfoType. If not provided, a new - // version of the storedInfoType will be created with the existing - // configuration. - StoredInfoTypeConfig config = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetStoredInfoType. -message GetStoredInfoTypeRequest { - // Required. Resource name of the organization and storedInfoType to be read, for - // example `organizations/433245324/storedInfoTypes/432452342` or - // projects/project-id/storedInfoTypes/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/StoredInfoType" - } - ]; -} - -// Request message for ListStoredInfoTypes. -message ListStoredInfoTypesRequest { - // Required. Parent resource name. - // - // The format of this value varies depending on the scope of the request - // (project or organization) and whether you have [specified a processing - // location](https://cloud.google.com/dlp/docs/specifying-location): - // - // + Projects scope, location specified:
- // `projects/`PROJECT_ID`/locations/`LOCATION_ID - // + Projects scope, no location specified (defaults to global):
- // `projects/`PROJECT_ID - // - // The following example `parent` string specifies a parent project with the - // identifier `example-project`, and specifies the `europe-west3` location - // for processing data: - // - // parent=projects/example-project/locations/europe-west3 - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/StoredInfoType" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to `ListStoredInfoTypes`. - string page_token = 2; - - // Size of the page, can be limited by the server. If zero server returns - // a page of max size 100. - int32 page_size = 3; - - // Comma separated list of fields to order by, - // followed by `asc` or `desc` postfix. This list is case-insensitive, - // default sorting order is ascending, redundant space characters are - // insignificant. - // - // Example: `name asc, display_name, create_time desc` - // - // Supported fields are: - // - // - `create_time`: corresponds to the time the most recent version of the - // resource was created. - // - `state`: corresponds to the state of the resource. - // - `name`: corresponds to resource name. - // - `display_name`: corresponds to info type's display name. - string order_by = 4; - - // Deprecated. This field has no effect. - string location_id = 5; -} - -// Response message for ListStoredInfoTypes. -message ListStoredInfoTypesResponse { - // List of storedInfoTypes, up to page_size in ListStoredInfoTypesRequest. - repeated StoredInfoType stored_info_types = 1; - - // If the next page is available then the next page token to be used - // in following ListStoredInfoTypes request. - string next_page_token = 2; -} - -// Request message for DeleteStoredInfoType. -message DeleteStoredInfoTypeRequest { - // Required. Resource name of the organization and storedInfoType to be deleted, for - // example `organizations/433245324/storedInfoTypes/432452342` or - // projects/project-id/storedInfoTypes/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/StoredInfoType" - } - ]; -} - -// Request to search for potentially sensitive info in a custom location. -message HybridInspectJobTriggerRequest { - // Required. Resource name of the trigger to execute a hybrid inspect on, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; - - // The item to inspect. - HybridContentItem hybrid_item = 3; -} - -// Request to search for potentially sensitive info in a custom location. -message HybridInspectDlpJobRequest { - // Required. Resource name of the job to execute a hybrid inspect on, for example - // `projects/dlp-test-project/dlpJob/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - } - ]; - - // The item to inspect. - HybridContentItem hybrid_item = 3; -} - -// An individual hybrid item to inspect. Will be stored temporarily during -// processing. -message HybridContentItem { - // The item to inspect. - ContentItem item = 1; - - // Supplementary information that will be added to each finding. - HybridFindingDetails finding_details = 2; -} - -// Populate to associate additional data with each finding. -message HybridFindingDetails { - // Details about the container where the content being inspected is from. - Container container_details = 1; - - // Offset in bytes of the line, from the beginning of the file, where the - // finding is located. Populate if the item being scanned is only part of a - // bigger item, such as a shard of a file and you want to track the absolute - // position of the finding. - int64 file_offset = 2; - - // Offset of the row for tables. Populate if the row(s) being scanned are - // part of a bigger dataset and you want to keep track of their absolute - // position. - int64 row_offset = 3; - - // If the container is a table, additional information to make findings - // meaningful such as the columns that are primary keys. If not known ahead - // of time, can also be set within each inspect hybrid call and the two - // will be merged. Note that identifying_fields will only be stored to - // BigQuery, and only if the BigQuery action has been included. - TableOptions table_options = 4; - - // Labels to represent user provided metadata about the data being inspected. - // If configured by the job, some key values may be required. - // The labels associated with `Finding`'s produced by hybrid - // inspection. - // - // Label keys must be between 1 and 63 characters long and must conform - // to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. - // - // Label values must be between 0 and 63 characters long and must conform - // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - // - // No more than 10 labels can be associated with a given finding. - // - // Examples: - // * `"environment" : "production"` - // * `"pipeline" : "etl"` - map labels = 5; -} - -// Quota exceeded errors will be thrown once quota has been met. -message HybridInspectResponse { - -} - -// Operators available for comparing the value of fields. -enum RelationalOperator { - // Unused - RELATIONAL_OPERATOR_UNSPECIFIED = 0; - - // Equal. Attempts to match even with incompatible types. - EQUAL_TO = 1; - - // Not equal to. Attempts to match even with incompatible types. - NOT_EQUAL_TO = 2; - - // Greater than. - GREATER_THAN = 3; - - // Less than. - LESS_THAN = 4; - - // Greater than or equals. - GREATER_THAN_OR_EQUALS = 5; - - // Less than or equals. - LESS_THAN_OR_EQUALS = 6; - - // Exists - EXISTS = 7; -} - -// Type of the match which can be applied to different ways of matching, like -// Dictionary, regular expression and intersecting with findings of another -// info type. -enum MatchingType { - // Invalid. - MATCHING_TYPE_UNSPECIFIED = 0; - - // Full match. - // - // - Dictionary: join of Dictionary results matched complete finding quote - // - Regex: all regex matches fill a finding quote start to end - // - Exclude info type: completely inside affecting info types findings - MATCHING_TYPE_FULL_MATCH = 1; - - // Partial match. - // - // - Dictionary: at least one of the tokens in the finding matches - // - Regex: substring of the finding matches - // - Exclude info type: intersects with affecting info types findings - MATCHING_TYPE_PARTIAL_MATCH = 2; - - // Inverse match. - // - // - Dictionary: no tokens in the finding match the dictionary - // - Regex: finding doesn't match the regex - // - Exclude info type: no intersection with affecting info types findings - MATCHING_TYPE_INVERSE_MATCH = 3; -} - -// Deprecated and unused. -enum ContentOption { - // Includes entire content of a file or a data stream. - CONTENT_UNSPECIFIED = 0; - - // Text content within the data, excluding any metadata. - CONTENT_TEXT = 1; - - // Images found in the data. - CONTENT_IMAGE = 2; -} - -// Type of metadata containing the finding. -enum MetadataType { - // Unused - METADATATYPE_UNSPECIFIED = 0; - - // General file metadata provided by Cloud Storage. - STORAGE_METADATA = 2; -} - -// Parts of the APIs which use certain infoTypes. -enum InfoTypeSupportedBy { - // Unused. - ENUM_TYPE_UNSPECIFIED = 0; - - // Supported by the inspect operations. - INSPECT = 1; - - // Supported by the risk analysis operations. - RISK_ANALYSIS = 2; -} - -// An enum to represent the various types of DLP jobs. -enum DlpJobType { - // Defaults to INSPECT_JOB. - DLP_JOB_TYPE_UNSPECIFIED = 0; - - // The job inspected Google Cloud for sensitive data. - INSPECT_JOB = 1; - - // The job executed a Risk Analysis computation. - RISK_ANALYSIS_JOB = 2; -} - -// State of a StoredInfoType version. -enum StoredInfoTypeState { - // Unused - STORED_INFO_TYPE_STATE_UNSPECIFIED = 0; - - // StoredInfoType version is being created. - PENDING = 1; - - // StoredInfoType version is ready for use. - READY = 2; - - // StoredInfoType creation failed. All relevant error messages are returned in - // the `StoredInfoTypeVersion` message. - FAILED = 3; - - // StoredInfoType is no longer valid because artifacts stored in - // user-controlled storage were modified. To fix an invalid StoredInfoType, - // use the `UpdateStoredInfoType` method to create a new version. - INVALID = 4; -} - -// Score is a summary of all elements in the data profile. -// A higher number means more risk. -message DataRiskLevel { - // Various score levels for resources. - enum DataRiskLevelScore { - // Unused. - RISK_SCORE_UNSPECIFIED = 0; - - // Low risk - Lower indication of sensitive data that appears to have - // additional access restrictions in place or no indication of sensitive - // data found. - RISK_LOW = 10; - - // Medium risk - Sensitive data may be present but additional access or fine - // grain access restrictions appear to be present. Consider limiting - // access even further or transform data to mask. - RISK_MODERATE = 20; - - // High risk – SPII may be present. Access controls may include public - // ACLs. Exfiltration of data may lead to user data loss. Re-identification - // of users may be possible. Consider limiting usage and or removing SPII. - RISK_HIGH = 30; - } - - // The score applied to the resource. - DataRiskLevelScore score = 1; -} - -// How broadly a resource has been shared. New items may be added over time. -// A higher number means more restricted. -enum ResourceVisibility { - // Unused. - RESOURCE_VISIBILITY_UNSPECIFIED = 0; - - // Visible to any user. - RESOURCE_VISIBILITY_PUBLIC = 10; - - // Visible only to specific users. - RESOURCE_VISIBILITY_RESTRICTED = 20; -} - -// Snapshot of the configurations used to generate the profile. -message DataProfileConfigSnapshot { - // A copy of the inspection config used to generate this profile. This - // is a copy of the inspect_template specified in `DataProfileJobConfig`. - InspectConfig inspect_config = 2; - - // A copy of the configuration used to generate this profile. - DataProfileJobConfig data_profile_job = 3; -} - -// The profile for a scanned table. -message TableDataProfile { - // Possible states of a profile. New items may be added. - enum State { - // Unused. - STATE_UNSPECIFIED = 0; - - // The profile is currently running. Once a profile has finished it will - // transition to DONE. - RUNNING = 1; - - // The profile is no longer generating. - // If profile_status.status.code is 0, the profile succeeded, otherwise, it - // failed. - DONE = 2; - } - - // The name of the profile. - string name = 1; - - // The resource name to the project data profile for this table. - string project_data_profile = 2; - - // The GCP project ID that owns the BigQuery dataset. - string dataset_project_id = 24; - - // The BigQuery location where the dataset's data is stored. - // See https://cloud.google.com/bigquery/docs/locations for supported - // locations. - string dataset_location = 29; - - // The BigQuery dataset ID. - string dataset_id = 25; - - // The BigQuery table ID. - string table_id = 26; - - // The resource name of the table. - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string full_resource = 3; - - // Success or error status from the most recent profile generation attempt. - // May be empty if the profile is still being generated. - ProfileStatus profile_status = 21; - - // State of a profile. - State state = 22; - - // The sensitivity score of this table. - SensitivityScore sensitivity_score = 5; - - // The data risk level of this table. - DataRiskLevel data_risk_level = 6; - - // The infoTypes predicted from this table's data. - repeated InfoTypeSummary predicted_info_types = 27; - - // Other infoTypes found in this table's data. - repeated OtherInfoTypeSummary other_info_types = 28; - - // The snapshot of the configurations used to generate the profile. - DataProfileConfigSnapshot config_snapshot = 7; - - // The time when this table was last modified - google.protobuf.Timestamp last_modified_time = 8; - - // Optional. The time when this table expires. - google.protobuf.Timestamp expiration_time = 9; - - // The number of columns profiled in the table. - int64 scanned_column_count = 10; - - // The number of columns skipped in the table because of an error. - int64 failed_column_count = 11; - - // The size of the table when the profile was generated. - int64 table_size_bytes = 12; - - // Number of rows in the table when the profile was generated. - // This will not be populated for BigLake tables. - int64 row_count = 13; - - // How the table is encrypted. - EncryptionStatus encryption_status = 14; - - // How broadly a resource has been shared. - ResourceVisibility resource_visibility = 15; - - // The last time the profile was generated. - google.protobuf.Timestamp profile_last_generated = 16; - - // The labels applied to the resource at the time the profile was generated. - map resource_labels = 17; - - // The time at which the table was created. - google.protobuf.Timestamp create_time = 23; -} - -message ProfileStatus { - // Profiling status code and optional message - google.rpc.Status status = 1; - - // Time when the profile generation status was updated - google.protobuf.Timestamp timestamp = 3; -} - -// How a resource is encrypted. -enum EncryptionStatus { - // Unused. - ENCRYPTION_STATUS_UNSPECIFIED = 0; - - // Google manages server-side encryption keys on your behalf. - ENCRYPTION_GOOGLE_MANAGED = 1; - - // Customer provides the key. - ENCRYPTION_CUSTOMER_MANAGED = 2; -} - -// The infoType details for this column. -message InfoTypeSummary { - // The infoType. - InfoType info_type = 1; - - // Not populated for predicted infotypes. - int32 estimated_prevalence = 2 [deprecated = true]; -} - -// Infotype details for other infoTypes found within a column. -message OtherInfoTypeSummary { - // The other infoType. - InfoType info_type = 1; - - // Approximate percentage of non-null rows that contained data detected by - // this infotype. - int32 estimated_prevalence = 2; -} - -// A condition for determining whether a Pub/Sub should be triggered. -message DataProfilePubSubCondition { - // Various score levels for resources. - enum ProfileScoreBucket { - // Unused. - PROFILE_SCORE_BUCKET_UNSPECIFIED = 0; - - // High risk/sensitivity detected. - HIGH = 1; - - // Medium or high risk/sensitivity detected. - MEDIUM_OR_HIGH = 2; - } - - // A condition consisting of a value. - message PubSubCondition { - // The value for the condition to trigger. - oneof value { - // The minimum data risk score that triggers the condition. - ProfileScoreBucket minimum_risk_score = 1; - - // The minimum sensitivity level that triggers the condition. - ProfileScoreBucket minimum_sensitivity_score = 2; - } - } - - // An expression, consisting of an operator and conditions. - message PubSubExpressions { - // Logical operators for conditional checks. - enum PubSubLogicalOperator { - // Unused. - LOGICAL_OPERATOR_UNSPECIFIED = 0; - - // Conditional OR. - OR = 1; - - // Conditional AND. - AND = 2; - } - - // The operator to apply to the collection of conditions. - PubSubLogicalOperator logical_operator = 1; - - // Conditions to apply to the expression. - repeated PubSubCondition conditions = 2; - } - - // An expression. - PubSubExpressions expressions = 1; -} - -// Pub/Sub topic message for a DataProfileAction.PubSubNotification event. -// To receive a message of protocol buffer schema type, convert the message data -// to an object of this proto class. -message DataProfilePubSubMessage { - // If `DetailLevel` is `TABLE_PROFILE` this will be fully populated. - // Otherwise, if `DetailLevel` is `RESOURCE_NAME`, then only `name` and - // `full_resource` will be populated. - TableDataProfile profile = 1; - - // The event that caused the Pub/Sub message to be sent. - DataProfileAction.EventType event = 2; -} diff --git a/owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/storage.proto b/owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/storage.proto deleted file mode 100644 index 3c9661d3c79..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/protos/google/privacy/dlp/v2/storage.proto +++ /dev/null @@ -1,808 +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.privacy.dlp.v2; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Dlp.V2"; -option go_package = "cloud.google.com/go/dlp/apiv2/dlppb;dlppb"; -option java_multiple_files = true; -option java_outer_classname = "DlpStorage"; -option java_package = "com.google.privacy.dlp.v2"; -option php_namespace = "Google\\Cloud\\Dlp\\V2"; -option ruby_package = "Google::Cloud::Dlp::V2"; - -// Type of information detected by the API. -message InfoType { - // Name of the information type. Either a name of your choosing when - // creating a CustomInfoType, or one of the names listed - // at https://cloud.google.com/dlp/docs/infotypes-reference when specifying - // a built-in type. When sending Cloud DLP results to Data Catalog, infoType - // names should conform to the pattern `[A-Za-z0-9$_-]{1,64}`. - string name = 1; - - // Optional version name for this InfoType. - string version = 2; -} - -// Score is a summary of all elements in the data profile. -// A higher number means more sensitive. -message SensitivityScore { - // Various score levels for resources. - enum SensitivityScoreLevel { - // Unused. - SENSITIVITY_SCORE_UNSPECIFIED = 0; - - // No sensitive information detected. Limited access. - SENSITIVITY_LOW = 10; - - // Medium risk - PII, potentially sensitive data, or fields with free-text - // data that are at higher risk of having intermittent sensitive data. - // Consider limiting access. - SENSITIVITY_MODERATE = 20; - - // High risk – SPII may be present. Exfiltration of data may lead to user - // data loss. Re-identification of users may be possible. Consider limiting - // usage and or removing SPII. - SENSITIVITY_HIGH = 30; - } - - // The score applied to the resource. - SensitivityScoreLevel score = 1; -} - -// Categorization of results based on how likely they are to represent a match, -// based on the number of elements they contain which imply a match. -enum Likelihood { - // Default value; same as POSSIBLE. - LIKELIHOOD_UNSPECIFIED = 0; - - // Few matching elements. - VERY_UNLIKELY = 1; - - UNLIKELY = 2; - - // Some matching elements. - POSSIBLE = 3; - - LIKELY = 4; - - // Many matching elements. - VERY_LIKELY = 5; -} - -// A reference to a StoredInfoType to use with scanning. -message StoredType { - // Resource name of the requested `StoredInfoType`, for example - // `organizations/433245324/storedInfoTypes/432452342` or - // `projects/project-id/storedInfoTypes/432452342`. - string name = 1; - - // Timestamp indicating when the version of the `StoredInfoType` used for - // inspection was created. Output-only field, populated by the system. - google.protobuf.Timestamp create_time = 2; -} - -// Custom information type provided by the user. Used to find domain-specific -// sensitive information configurable to the data in question. -message CustomInfoType { - // Custom information type based on a dictionary of words or phrases. This can - // be used to match sensitive information specific to the data, such as a list - // of employee IDs or job titles. - // - // Dictionary words are case-insensitive and all characters other than letters - // and digits in the unicode [Basic Multilingual - // Plane](https://en.wikipedia.org/wiki/Plane_%28Unicode%29#Basic_Multilingual_Plane) - // will be replaced with whitespace when scanning for matches, so the - // dictionary phrase "Sam Johnson" will match all three phrases "sam johnson", - // "Sam, Johnson", and "Sam (Johnson)". Additionally, the characters - // surrounding any match must be of a different type than the adjacent - // characters within the word, so letters must be next to non-letters and - // digits next to non-digits. For example, the dictionary word "jen" will - // match the first three letters of the text "jen123" but will return no - // matches for "jennifer". - // - // Dictionary words containing a large number of characters that are not - // letters or digits may result in unexpected findings because such characters - // are treated as whitespace. The - // [limits](https://cloud.google.com/dlp/limits) page contains details about - // the size limits of dictionaries. For dictionaries that do not fit within - // these constraints, consider using `LargeCustomDictionaryConfig` in the - // `StoredInfoType` API. - message Dictionary { - // Message defining a list of words or phrases to search for in the data. - message WordList { - // Words or phrases defining the dictionary. The dictionary must contain - // at least one phrase and every phrase must contain at least 2 characters - // that are letters or digits. [required] - repeated string words = 1; - } - - oneof source { - // List of words or phrases to search for. - WordList word_list = 1; - - // Newline-delimited file of words in Cloud Storage. Only a single file - // is accepted. - CloudStoragePath cloud_storage_path = 3; - } - } - - // Message defining a custom regular expression. - message Regex { - // Pattern defining the regular expression. Its syntax - // (https://github.com/google/re2/wiki/Syntax) can be found under the - // google/re2 repository on GitHub. - string pattern = 1; - - // The index of the submatch to extract as findings. When not - // specified, the entire match is returned. No more than 3 may be included. - repeated int32 group_indexes = 2; - } - - // Message for detecting output from deidentification transformations - // such as - // [`CryptoReplaceFfxFpeConfig`](https://cloud.google.com/dlp/docs/reference/rest/v2/organizations.deidentifyTemplates#cryptoreplaceffxfpeconfig). - // These types of transformations are - // those that perform pseudonymization, thereby producing a "surrogate" as - // output. This should be used in conjunction with a field on the - // transformation such as `surrogate_info_type`. This CustomInfoType does - // not support the use of `detection_rules`. - message SurrogateType { - - } - - // Deprecated; use `InspectionRuleSet` instead. Rule for modifying a - // `CustomInfoType` to alter behavior under certain circumstances, depending - // on the specific details of the rule. Not supported for the `surrogate_type` - // custom infoType. - message DetectionRule { - // Message for specifying a window around a finding to apply a detection - // rule. - message Proximity { - // Number of characters before the finding to consider. For tabular data, - // if you want to modify the likelihood of an entire column of findngs, - // set this to 1. For more information, see - // [Hotword example: Set the match likelihood of a table column] - // (https://cloud.google.com/dlp/docs/creating-custom-infotypes-likelihood#match-column-values). - int32 window_before = 1; - - // Number of characters after the finding to consider. - int32 window_after = 2; - } - - // Message for specifying an adjustment to the likelihood of a finding as - // part of a detection rule. - message LikelihoodAdjustment { - oneof adjustment { - // Set the likelihood of a finding to a fixed value. - Likelihood fixed_likelihood = 1; - - // Increase or decrease the likelihood by the specified number of - // levels. For example, if a finding would be `POSSIBLE` without the - // detection rule and `relative_likelihood` is 1, then it is upgraded to - // `LIKELY`, while a value of -1 would downgrade it to `UNLIKELY`. - // Likelihood may never drop below `VERY_UNLIKELY` or exceed - // `VERY_LIKELY`, so applying an adjustment of 1 followed by an - // adjustment of -1 when base likelihood is `VERY_LIKELY` will result in - // a final likelihood of `LIKELY`. - int32 relative_likelihood = 2; - } - } - - // The rule that adjusts the likelihood of findings within a certain - // proximity of hotwords. - message HotwordRule { - // Regular expression pattern defining what qualifies as a hotword. - Regex hotword_regex = 1; - - // Range of characters within which the entire hotword must reside. - // The total length of the window cannot exceed 1000 characters. - // The finding itself will be included in the window, so that hotwords can - // be used to match substrings of the finding itself. Suppose you - // want Cloud DLP to promote the likelihood of the phone number - // regex "\(\d{3}\) \d{3}-\d{4}" if the area code is known to be the - // area code of a company's office. In this case, use the hotword regex - // "\(xxx\)", where "xxx" is the area code in question. - // - // For tabular data, if you want to modify the likelihood of an entire - // column of findngs, see - // [Hotword example: Set the match likelihood of a table column] - // (https://cloud.google.com/dlp/docs/creating-custom-infotypes-likelihood#match-column-values). - Proximity proximity = 2; - - // Likelihood adjustment to apply to all matching findings. - LikelihoodAdjustment likelihood_adjustment = 3; - } - - oneof type { - // Hotword-based detection rule. - HotwordRule hotword_rule = 1; - } - } - - enum ExclusionType { - // A finding of this custom info type will not be excluded from results. - EXCLUSION_TYPE_UNSPECIFIED = 0; - - // A finding of this custom info type will be excluded from final results, - // but can still affect rule execution. - EXCLUSION_TYPE_EXCLUDE = 1; - } - - // CustomInfoType can either be a new infoType, or an extension of built-in - // infoType, when the name matches one of existing infoTypes and that infoType - // is specified in `InspectContent.info_types` field. Specifying the latter - // adds findings to the one detected by the system. If built-in info type is - // not specified in `InspectContent.info_types` list then the name is treated - // as a custom info type. - InfoType info_type = 1; - - // Likelihood to return for this CustomInfoType. This base value can be - // altered by a detection rule if the finding meets the criteria specified by - // the rule. Defaults to `VERY_LIKELY` if not specified. - Likelihood likelihood = 6; - - oneof type { - // A list of phrases to detect as a CustomInfoType. - Dictionary dictionary = 2; - - // Regular expression based CustomInfoType. - Regex regex = 3; - - // Message for detecting output from deidentification transformations that - // support reversing. - SurrogateType surrogate_type = 4; - - // Load an existing `StoredInfoType` resource for use in - // `InspectDataSource`. Not currently supported in `InspectContent`. - StoredType stored_type = 5; - } - - // Set of detection rules to apply to all findings of this CustomInfoType. - // Rules are applied in order that they are specified. Not supported for the - // `surrogate_type` CustomInfoType. - repeated DetectionRule detection_rules = 7; - - // If set to EXCLUSION_TYPE_EXCLUDE this infoType will not cause a finding - // to be returned. It still can be used for rules matching. - ExclusionType exclusion_type = 8; -} - -// General identifier of a data field in a storage service. -message FieldId { - // Name describing the field. - string name = 1; -} - -// Datastore partition ID. -// A partition ID identifies a grouping of entities. The grouping is always -// by project and namespace, however the namespace ID may be empty. -// -// A partition ID contains several dimensions: -// project ID and namespace ID. -message PartitionId { - // The ID of the project to which the entities belong. - string project_id = 2; - - // If not empty, the ID of the namespace to which the entities belong. - string namespace_id = 4; -} - -// A representation of a Datastore kind. -message KindExpression { - // The name of the kind. - string name = 1; -} - -// Options defining a data set within Google Cloud Datastore. -message DatastoreOptions { - // A partition ID identifies a grouping of entities. The grouping is always - // by project and namespace, however the namespace ID may be empty. - PartitionId partition_id = 1; - - // The kind to process. - KindExpression kind = 2; -} - -// Definitions of file type groups to scan. New types will be added to this -// list. -enum FileType { - // Includes all files. - FILE_TYPE_UNSPECIFIED = 0; - - // Includes all file extensions not covered by another entry. Binary - // scanning attempts to convert the content of the file to utf_8 to scan - // the file. - // If you wish to avoid this fall back, specify one or more of the other - // FileType's in your storage scan. - BINARY_FILE = 1; - - // Included file extensions: - // asc,asp, aspx, brf, c, cc,cfm, cgi, cpp, csv, cxx, c++, cs, css, dart, - // dat, dot, eml,, epbub, ged, go, h, hh, hpp, hxx, h++, hs, html, htm, - // mkd, markdown, m, ml, mli, perl, pl, plist, pm, php, phtml, pht, - // properties, py, pyw, rb, rbw, rs, rss, rc, scala, sh, sql, swift, tex, - // shtml, shtm, xhtml, lhs, ics, ini, java, js, json, kix, kml, ocaml, md, - // txt, text, tsv, vb, vcard, vcs, wml, xcodeproj, xml, xsl, xsd, yml, yaml. - TEXT_FILE = 2; - - // Included file extensions: - // bmp, gif, jpg, jpeg, jpe, png. - // bytes_limit_per_file has no effect on image files. - // Image inspection is restricted to 'global', 'us', 'asia', and 'europe'. - IMAGE = 3; - - // Word files >30 MB will be scanned as binary files. - // Included file extensions: - // docx, dotx, docm, dotm - WORD = 5; - - // PDF files >30 MB will be scanned as binary files. - // Included file extensions: - // pdf - PDF = 6; - - // Included file extensions: - // avro - AVRO = 7; - - // Included file extensions: - // csv - CSV = 8; - - // Included file extensions: - // tsv - TSV = 9; - - // Powerpoint files >30 MB will be scanned as binary files. - // Included file extensions: - // pptx, pptm, potx, potm, pot - POWERPOINT = 11; - - // Excel files >30 MB will be scanned as binary files. - // Included file extensions: - // xlsx, xlsm, xltx, xltm - EXCEL = 12; -} - -// Message representing a set of files in a Cloud Storage bucket. Regular -// expressions are used to allow fine-grained control over which files in the -// bucket to include. -// -// Included files are those that match at least one item in `include_regex` and -// do not match any items in `exclude_regex`. Note that a file that matches -// items from both lists will _not_ be included. For a match to occur, the -// entire file path (i.e., everything in the url after the bucket name) must -// match the regular expression. -// -// For example, given the input `{bucket_name: "mybucket", include_regex: -// ["directory1/.*"], exclude_regex: -// ["directory1/excluded.*"]}`: -// -// * `gs://mybucket/directory1/myfile` will be included -// * `gs://mybucket/directory1/directory2/myfile` will be included (`.*` matches -// across `/`) -// * `gs://mybucket/directory0/directory1/myfile` will _not_ be included (the -// full path doesn't match any items in `include_regex`) -// * `gs://mybucket/directory1/excludedfile` will _not_ be included (the path -// matches an item in `exclude_regex`) -// -// If `include_regex` is left empty, it will match all files by default -// (this is equivalent to setting `include_regex: [".*"]`). -// -// Some other common use cases: -// -// * `{bucket_name: "mybucket", exclude_regex: [".*\.pdf"]}` will include all -// files in `mybucket` except for .pdf files -// * `{bucket_name: "mybucket", include_regex: ["directory/[^/]+"]}` will -// include all files directly under `gs://mybucket/directory/`, without matching -// across `/` -message CloudStorageRegexFileSet { - // The name of a Cloud Storage bucket. Required. - string bucket_name = 1; - - // A list of regular expressions matching file paths to include. All files in - // the bucket that match at least one of these regular expressions will be - // included in the set of files, except for those that also match an item in - // `exclude_regex`. Leaving this field empty will match all files by default - // (this is equivalent to including `.*` in the list). - // - // Regular expressions use RE2 - // [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found - // under the google/re2 repository on GitHub. - repeated string include_regex = 2; - - // A list of regular expressions matching file paths to exclude. All files in - // the bucket that match at least one of these regular expressions will be - // excluded from the scan. - // - // Regular expressions use RE2 - // [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found - // under the google/re2 repository on GitHub. - repeated string exclude_regex = 3; -} - -// Options defining a file or a set of files within a Cloud Storage -// bucket. -message CloudStorageOptions { - // Set of files to scan. - message FileSet { - // The Cloud Storage url of the file(s) to scan, in the format - // `gs:///`. Trailing wildcard in the path is allowed. - // - // If the url ends in a trailing slash, the bucket or directory represented - // by the url will be scanned non-recursively (content in sub-directories - // will not be scanned). This means that `gs://mybucket/` is equivalent to - // `gs://mybucket/*`, and `gs://mybucket/directory/` is equivalent to - // `gs://mybucket/directory/*`. - // - // Exactly one of `url` or `regex_file_set` must be set. - string url = 1; - - // The regex-filtered set of files to scan. Exactly one of `url` or - // `regex_file_set` must be set. - CloudStorageRegexFileSet regex_file_set = 2; - } - - // How to sample bytes if not all bytes are scanned. Meaningful only when used - // in conjunction with bytes_limit_per_file. If not specified, scanning would - // start from the top. - enum SampleMethod { - SAMPLE_METHOD_UNSPECIFIED = 0; - - // Scan from the top (default). - TOP = 1; - - // For each file larger than bytes_limit_per_file, randomly pick the offset - // to start scanning. The scanned bytes are contiguous. - RANDOM_START = 2; - } - - // The set of one or more files to scan. - FileSet file_set = 1; - - // Max number of bytes to scan from a file. If a scanned file's size is bigger - // than this value then the rest of the bytes are omitted. Only one - // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. - // Cannot be set if de-identification is requested. - int64 bytes_limit_per_file = 4; - - // Max percentage of bytes to scan from a file. The rest are omitted. The - // number of bytes scanned is rounded down. Must be between 0 and 100, - // inclusively. Both 0 and 100 means no limit. Defaults to 0. Only one - // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. - // Cannot be set if de-identification is requested. - int32 bytes_limit_per_file_percent = 8; - - // List of file type groups to include in the scan. - // If empty, all files are scanned and available data format processors - // are applied. In addition, the binary content of the selected files - // is always scanned as well. - // Images are scanned only as binary if the specified region - // does not support image inspection and no file_types were specified. - // Image inspection is restricted to 'global', 'us', 'asia', and 'europe'. - repeated FileType file_types = 5; - - SampleMethod sample_method = 6; - - // Limits the number of files to scan to this percentage of the input FileSet. - // Number of files scanned is rounded down. Must be between 0 and 100, - // inclusively. Both 0 and 100 means no limit. Defaults to 0. - int32 files_limit_percent = 7; -} - -// Message representing a set of files in Cloud Storage. -message CloudStorageFileSet { - // The url, in the format `gs:///`. Trailing wildcard in the - // path is allowed. - string url = 1; -} - -// Message representing a single file or path in Cloud Storage. -message CloudStoragePath { - // A url representing a file or path (no wildcards) in Cloud Storage. - // Example: gs://[BUCKET_NAME]/dictionary.txt - string path = 1; -} - -// Options defining BigQuery table and row identifiers. -message BigQueryOptions { - // How to sample rows if not all rows are scanned. Meaningful only when used - // in conjunction with either rows_limit or rows_limit_percent. If not - // specified, rows are scanned in the order BigQuery reads them. - enum SampleMethod { - SAMPLE_METHOD_UNSPECIFIED = 0; - - // Scan groups of rows in the order BigQuery provides (default). Multiple - // groups of rows may be scanned in parallel, so results may not appear in - // the same order the rows are read. - TOP = 1; - - // Randomly pick groups of rows to scan. - RANDOM_START = 2; - } - - // Complete BigQuery table reference. - BigQueryTable table_reference = 1; - - // Table fields that may uniquely identify a row within the table. When - // `actions.saveFindings.outputConfig.table` is specified, the values of - // columns specified here are available in the output table under - // `location.content_locations.record_location.record_key.id_values`. Nested - // fields such as `person.birthdate.year` are allowed. - repeated FieldId identifying_fields = 2; - - // Max number of rows to scan. If the table has more rows than this value, the - // rest of the rows are omitted. If not set, or if set to 0, all rows will be - // scanned. Only one of rows_limit and rows_limit_percent can be specified. - // Cannot be used in conjunction with TimespanConfig. - int64 rows_limit = 3; - - // Max percentage of rows to scan. The rest are omitted. The number of rows - // scanned is rounded down. Must be between 0 and 100, inclusively. Both 0 and - // 100 means no limit. Defaults to 0. Only one of rows_limit and - // rows_limit_percent can be specified. Cannot be used in conjunction with - // TimespanConfig. - int32 rows_limit_percent = 6; - - SampleMethod sample_method = 4; - - // References to fields excluded from scanning. This allows you to skip - // inspection of entire columns which you know have no findings. - repeated FieldId excluded_fields = 5; - - // Limit scanning only to these fields. - repeated FieldId included_fields = 7; -} - -// Shared message indicating Cloud storage type. -message StorageConfig { - // Configuration of the timespan of the items to include in scanning. - // Currently only supported when inspecting Cloud Storage and BigQuery. - message TimespanConfig { - // Exclude files, tables, or rows older than this value. - // If not set, no lower time limit is applied. - google.protobuf.Timestamp start_time = 1; - - // Exclude files, tables, or rows newer than this value. - // If not set, no upper time limit is applied. - google.protobuf.Timestamp end_time = 2; - - // Specification of the field containing the timestamp of scanned items. - // Used for data sources like Datastore and BigQuery. - // - // For BigQuery - // - // If this value is not specified and the table was modified between the - // given start and end times, the entire table will be scanned. If this - // value is specified, then rows are filtered based on the given start and - // end times. Rows with a `NULL` value in the provided BigQuery column are - // skipped. - // Valid data types of the provided BigQuery column are: `INTEGER`, `DATE`, - // `TIMESTAMP`, and `DATETIME`. - // - // If your BigQuery table is [partitioned at ingestion - // time](https://cloud.google.com/bigquery/docs/partitioned-tables#ingestion_time), - // you can use any of the following pseudo-columns as your timestamp field. - // When used with Cloud DLP, these pseudo-column names are case sensitive. - // - //
    - //
  • _PARTITIONTIME
  • - //
  • _PARTITIONDATE
  • - //
  • _PARTITION_LOAD_TIME
  • - //
- // - // For Datastore - // - // If this value is specified, then entities are filtered based on the given - // start and end times. If an entity does not contain the provided timestamp - // property or contains empty or invalid values, then it is included. - // Valid data types of the provided timestamp property are: `TIMESTAMP`. - // - // See the - // [known issue](https://cloud.google.com/dlp/docs/known-issues#bq-timespan) - // related to this operation. - FieldId timestamp_field = 3; - - // When the job is started by a JobTrigger we will automatically figure out - // a valid start_time to avoid scanning files that have not been modified - // since the last time the JobTrigger executed. This will be based on the - // time of the execution of the last run of the JobTrigger or the timespan - // end_time used in the last run of the JobTrigger. - bool enable_auto_population_of_timespan_config = 4; - } - - oneof type { - // Google Cloud Datastore options. - DatastoreOptions datastore_options = 2; - - // Cloud Storage options. - CloudStorageOptions cloud_storage_options = 3; - - // BigQuery options. - BigQueryOptions big_query_options = 4; - - // Hybrid inspection options. - HybridOptions hybrid_options = 9; - } - - TimespanConfig timespan_config = 6; -} - -// Configuration to control jobs where the content being inspected is outside -// of Google Cloud Platform. -message HybridOptions { - // A short description of where the data is coming from. Will be stored once - // in the job. 256 max length. - string description = 1; - - // These are labels that each inspection request must include within their - // 'finding_labels' map. Request may contain others, but any missing one of - // these will be rejected. - // - // Label keys must be between 1 and 63 characters long and must conform - // to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. - // - // No more than 10 keys can be required. - repeated string required_finding_label_keys = 2; - - // To organize findings, these labels will be added to each finding. - // - // Label keys must be between 1 and 63 characters long and must conform - // to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. - // - // Label values must be between 0 and 63 characters long and must conform - // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - // - // No more than 10 labels can be associated with a given finding. - // - // Examples: - // * `"environment" : "production"` - // * `"pipeline" : "etl"` - map labels = 3; - - // If the container is a table, additional information to make findings - // meaningful such as the columns that are primary keys. - TableOptions table_options = 4; -} - -// Row key for identifying a record in BigQuery table. -message BigQueryKey { - // Complete BigQuery table reference. - BigQueryTable table_reference = 1; - - // Row number inferred at the time the table was scanned. This value is - // nondeterministic, cannot be queried, and may be null for inspection - // jobs. To locate findings within a table, specify - // `inspect_job.storage_config.big_query_options.identifying_fields` in - // `CreateDlpJobRequest`. - int64 row_number = 2; -} - -// Record key for a finding in Cloud Datastore. -message DatastoreKey { - // Datastore entity key. - Key entity_key = 1; -} - -// A unique identifier for a Datastore entity. -// If a key's partition ID or any of its path kinds or names are -// reserved/read-only, the key is reserved/read-only. -// A reserved/read-only key is forbidden in certain documented contexts. -message Key { - // A (kind, ID/name) pair used to construct a key path. - // - // If either name or ID is set, the element is complete. - // If neither is set, the element is incomplete. - message PathElement { - // The kind of the entity. - // A kind matching regex `__.*__` is reserved/read-only. - // A kind must not contain more than 1500 bytes when UTF-8 encoded. - // Cannot be `""`. - string kind = 1; - - // The type of ID. - oneof id_type { - // The auto-allocated ID of the entity. - // Never equal to zero. Values less than zero are discouraged and may not - // be supported in the future. - int64 id = 2; - - // The name of the entity. - // A name matching regex `__.*__` is reserved/read-only. - // A name must not be more than 1500 bytes when UTF-8 encoded. - // Cannot be `""`. - string name = 3; - } - } - - // Entities are partitioned into subsets, currently identified by a project - // ID and namespace ID. - // Queries are scoped to a single partition. - PartitionId partition_id = 1; - - // The entity path. - // An entity path consists of one or more elements composed of a kind and a - // string or numerical identifier, which identify entities. The first - // element identifies a _root entity_, the second element identifies - // a _child_ of the root entity, the third element identifies a child of the - // second entity, and so forth. The entities identified by all prefixes of - // the path are called the element's _ancestors_. - // - // A path can never be empty, and a path can have at most 100 elements. - repeated PathElement path = 2; -} - -// Message for a unique key indicating a record that contains a finding. -message RecordKey { - oneof type { - DatastoreKey datastore_key = 2; - - BigQueryKey big_query_key = 3; - } - - // Values of identifying columns in the given row. Order of values matches - // the order of `identifying_fields` specified in the scanning request. - repeated string id_values = 5; -} - -// Message defining the location of a BigQuery table. A table is uniquely -// identified by its project_id, dataset_id, and table_name. Within a query -// a table is often referenced with a string in the format of: -// `:.` or -// `..`. -message BigQueryTable { - // The Google Cloud Platform project ID of the project containing the table. - // If omitted, project ID is inferred from the API call. - string project_id = 1; - - // Dataset ID of the table. - string dataset_id = 2; - - // Name of the table. - string table_id = 3; -} - -// Message defining a field of a BigQuery table. -message BigQueryField { - // Source table of the field. - BigQueryTable table = 1; - - // Designated field in the BigQuery table. - FieldId field = 2; -} - -// An entity in a dataset is a field or set of fields that correspond to a -// single person. For example, in medical records the `EntityId` might be a -// patient identifier, or for financial records it might be an account -// identifier. This message is used when generalizations or analysis must take -// into account that multiple rows correspond to the same entity. -message EntityId { - // Composite key indicating which field contains the entity identifier. - FieldId field = 1; -} - -// Instructions regarding the table content being inspected. -message TableOptions { - // The columns that are the primary keys for table objects included in - // ContentItem. A copy of this cell's value will stored alongside alongside - // each finding so that the finding can be traced to the specific row it came - // from. No more than 3 may be provided. - repeated FieldId identifying_fields = 1; -} diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.activate_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.activate_job_trigger.js deleted file mode 100644 index b126e882810..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.activate_job_trigger.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 dlp_v2_generated_DlpService_ActivateJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 trigger to activate, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callActivateJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.activateJobTrigger(request); - console.log(response); - } - - callActivateJobTrigger(); - // [END dlp_v2_generated_DlpService_ActivateJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.cancel_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.cancel_dlp_job.js deleted file mode 100644 index 9163ea6292d..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.cancel_dlp_job.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 dlp_v2_generated_DlpService_CancelDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 DlpJob resource to be cancelled. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCancelDlpJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.cancelDlpJob(request); - console.log(response); - } - - callCancelDlpJob(); - // [END dlp_v2_generated_DlpService_CancelDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_deidentify_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_deidentify_template.js deleted file mode 100644 index f1a86d00491..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_deidentify_template.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, deidentifyTemplate) { - // [START dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have specified a processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Required. The DeidentifyTemplate to create. - */ - // const deidentifyTemplate = {} - /** - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const templateId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateDeidentifyTemplate() { - // Construct request - const request = { - parent, - deidentifyTemplate, - }; - - // Run request - const response = await dlpClient.createDeidentifyTemplate(request); - console.log(response); - } - - callCreateDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_dlp_job.js deleted file mode 100644 index ed22fa5331e..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_dlp_job.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) { - // [START dlp_v2_generated_DlpService_CreateDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - * The format of this value varies depending on whether you have specified a - * processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * An inspection job scans a storage repository for InfoTypes. - */ - // const inspectJob = {} - /** - * A risk analysis job calculates re-identification risk metrics for a - * BigQuery table. - */ - // const riskJob = {} - /** - * The job id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const jobId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateDlpJob() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dlpClient.createDlpJob(request); - console.log(response); - } - - callCreateDlpJob(); - // [END dlp_v2_generated_DlpService_CreateDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_inspect_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_inspect_template.js deleted file mode 100644 index b5e1abc9eaa..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_inspect_template.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, inspectTemplate) { - // [START dlp_v2_generated_DlpService_CreateInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have specified a processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Required. The InspectTemplate to create. - */ - // const inspectTemplate = {} - /** - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const templateId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateInspectTemplate() { - // Construct request - const request = { - parent, - inspectTemplate, - }; - - // Run request - const response = await dlpClient.createInspectTemplate(request); - console.log(response); - } - - callCreateInspectTemplate(); - // [END dlp_v2_generated_DlpService_CreateInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_job_trigger.js deleted file mode 100644 index 52a10923012..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_job_trigger.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, jobTrigger) { - // [START dlp_v2_generated_DlpService_CreateJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - * The format of this value varies depending on whether you have specified a - * processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Required. The JobTrigger to create. - */ - // const jobTrigger = {} - /** - * The trigger id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const triggerId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateJobTrigger() { - // Construct request - const request = { - parent, - jobTrigger, - }; - - // Run request - const response = await dlpClient.createJobTrigger(request); - console.log(response); - } - - callCreateJobTrigger(); - // [END dlp_v2_generated_DlpService_CreateJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_stored_info_type.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_stored_info_type.js deleted file mode 100644 index fcba969fbef..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.create_stored_info_type.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, config) { - // [START dlp_v2_generated_DlpService_CreateStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have specified a processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Required. Configuration of the storedInfoType to create. - */ - // const config = {} - /** - * The storedInfoType ID can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const storedInfoTypeId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateStoredInfoType() { - // Construct request - const request = { - parent, - config, - }; - - // Run request - const response = await dlpClient.createStoredInfoType(request); - console.log(response); - } - - callCreateStoredInfoType(); - // [END dlp_v2_generated_DlpService_CreateStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.deidentify_content.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.deidentify_content.js deleted file mode 100644 index 914636a1cf8..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.deidentify_content.js +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically 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 dlp_v2_generated_DlpService_DeidentifyContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Parent resource name. - * The format of this value varies depending on whether you have specified a - * processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Configuration for the de-identification of the content item. - * Items specified here will override the template referenced by the - * deidentify_template_name argument. - */ - // const deidentifyConfig = {} - /** - * Configuration for the inspector. - * Items specified here will override the template referenced by the - * inspect_template_name argument. - */ - // const inspectConfig = {} - /** - * The item to de-identify. Will be treated as text. - * This value must be of type - * Table google.privacy.dlp.v2.Table if your - * deidentify_config google.privacy.dlp.v2.DeidentifyContentRequest.deidentify_config - * is a - * RecordTransformations google.privacy.dlp.v2.RecordTransformations - * object. - */ - // const item = {} - /** - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const inspectTemplateName = 'abc123' - /** - * Template to use. Any configuration directly specified in - * deidentify_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const deidentifyTemplateName = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeidentifyContent() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.deidentifyContent(request); - console.log(response); - } - - callDeidentifyContent(); - // [END dlp_v2_generated_DlpService_DeidentifyContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_deidentify_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_deidentify_template.js deleted file mode 100644 index 0c4352262fe..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_deidentify_template.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 dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 and deidentify template to be deleted, - * for example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteDeidentifyTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteDeidentifyTemplate(request); - console.log(response); - } - - callDeleteDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_dlp_job.js deleted file mode 100644 index 7c227fe4438..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_dlp_job.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 dlp_v2_generated_DlpService_DeleteDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 DlpJob resource to be deleted. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteDlpJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteDlpJob(request); - console.log(response); - } - - callDeleteDlpJob(); - // [END dlp_v2_generated_DlpService_DeleteDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_inspect_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_inspect_template.js deleted file mode 100644 index cf5d3da58e9..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_inspect_template.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 dlp_v2_generated_DlpService_DeleteInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 and inspectTemplate to be deleted, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteInspectTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteInspectTemplate(request); - console.log(response); - } - - callDeleteInspectTemplate(); - // [END dlp_v2_generated_DlpService_DeleteInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_job_trigger.js deleted file mode 100644 index 6b8c860ce36..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_job_trigger.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 dlp_v2_generated_DlpService_DeleteJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteJobTrigger(request); - console.log(response); - } - - callDeleteJobTrigger(); - // [END dlp_v2_generated_DlpService_DeleteJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_stored_info_type.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_stored_info_type.js deleted file mode 100644 index eb85ab85306..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.delete_stored_info_type.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 dlp_v2_generated_DlpService_DeleteStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 and storedInfoType to be deleted, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteStoredInfoType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteStoredInfoType(request); - console.log(response); - } - - callDeleteStoredInfoType(); - // [END dlp_v2_generated_DlpService_DeleteStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.finish_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.finish_dlp_job.js deleted file mode 100644 index 0d84fd8ba8e..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.finish_dlp_job.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 dlp_v2_generated_DlpService_FinishDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 DlpJob resource to be cancelled. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callFinishDlpJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.finishDlpJob(request); - console.log(response); - } - - callFinishDlpJob(); - // [END dlp_v2_generated_DlpService_FinishDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_deidentify_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_deidentify_template.js deleted file mode 100644 index de10069316a..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_deidentify_template.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 dlp_v2_generated_DlpService_GetDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 and deidentify template to be read, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetDeidentifyTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getDeidentifyTemplate(request); - console.log(response); - } - - callGetDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_GetDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_dlp_job.js deleted file mode 100644 index bed4af7395e..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_dlp_job.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 dlp_v2_generated_DlpService_GetDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require 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 DlpJob resource. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetDlpJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getDlpJob(request); - console.log(response); - } - - callGetDlpJob(); - // [END dlp_v2_generated_DlpService_GetDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_inspect_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_inspect_template.js deleted file mode 100644 index 63d837a3413..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_inspect_template.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 dlp_v2_generated_DlpService_GetInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 and inspectTemplate to be read, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetInspectTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getInspectTemplate(request); - console.log(response); - } - - callGetInspectTemplate(); - // [END dlp_v2_generated_DlpService_GetInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_job_trigger.js deleted file mode 100644 index e28ad5f4b32..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_job_trigger.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 dlp_v2_generated_DlpService_GetJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getJobTrigger(request); - console.log(response); - } - - callGetJobTrigger(); - // [END dlp_v2_generated_DlpService_GetJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_stored_info_type.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_stored_info_type.js deleted file mode 100644 index 72c4d56842f..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.get_stored_info_type.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 dlp_v2_generated_DlpService_GetStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 and storedInfoType to be read, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetStoredInfoType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getStoredInfoType(request); - console.log(response); - } - - callGetStoredInfoType(); - // [END dlp_v2_generated_DlpService_GetStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_dlp_job.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_dlp_job.js deleted file mode 100644 index 6d811586a7f..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_dlp_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 dlp_v2_generated_DlpService_HybridInspectDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 job to execute a hybrid inspect on, for example - * `projects/dlp-test-project/dlpJob/53234423`. - */ - // const name = 'abc123' - /** - * The item to inspect. - */ - // const hybridItem = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callHybridInspectDlpJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.hybridInspectDlpJob(request); - console.log(response); - } - - callHybridInspectDlpJob(); - // [END dlp_v2_generated_DlpService_HybridInspectDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_job_trigger.js deleted file mode 100644 index 18fbecf35ba..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.hybrid_inspect_job_trigger.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 dlp_v2_generated_DlpService_HybridInspectJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 trigger to execute a hybrid inspect on, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - /** - * The item to inspect. - */ - // const hybridItem = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callHybridInspectJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.hybridInspectJobTrigger(request); - console.log(response); - } - - callHybridInspectJobTrigger(); - // [END dlp_v2_generated_DlpService_HybridInspectJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.inspect_content.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.inspect_content.js deleted file mode 100644 index 08c1d913674..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.inspect_content.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() { - // [START dlp_v2_generated_DlpService_InspectContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Parent resource name. - * The format of this value varies depending on whether you have specified a - * processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Configuration for the inspector. What specified here will override - * the template referenced by the inspect_template_name argument. - */ - // const inspectConfig = {} - /** - * The item to inspect. - */ - // const item = {} - /** - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const inspectTemplateName = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callInspectContent() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.inspectContent(request); - console.log(response); - } - - callInspectContent(); - // [END dlp_v2_generated_DlpService_InspectContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_deidentify_templates.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_deidentify_templates.js deleted file mode 100644 index 65af2f2e5db..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_deidentify_templates.js +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated 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 dlp_v2_generated_DlpService_ListDeidentifyTemplates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have specified a processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - */ - // const pageSize = 1234 - /** - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * Example: `name asc,update_time, create_time desc` - * Supported fields are: - * - `create_time`: corresponds to the time the template was created. - * - `update_time`: corresponds to the time the template was last updated. - * - `name`: corresponds to the template's name. - * - `display_name`: corresponds to the template's display name. - */ - // const orderBy = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListDeidentifyTemplates() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dlpClient.listDeidentifyTemplatesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDeidentifyTemplates(); - // [END dlp_v2_generated_DlpService_ListDeidentifyTemplates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_dlp_jobs.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_dlp_jobs.js deleted file mode 100644 index d4cba6b16a3..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_dlp_jobs.js +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated 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 dlp_v2_generated_DlpService_ListDlpJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - * The format of this value varies depending on whether you have specified a - * processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Allows filtering. - * Supported syntax: - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The name of the trigger that created the job. - * - 'end_time` - Corresponds to the time the job finished. - * - 'start_time` - Corresponds to the time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to the time the job finished. - * - 'start_time` - Corresponds to the time the job finished. - * * The operator must be `=` or `!=`. - * Examples: - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * The length of this field should be no more than 500 characters. - */ - // const filter = 'abc123' - /** - * The standard list page size. - */ - // const pageSize = 1234 - /** - * The standard list page token. - */ - // const pageToken = 'abc123' - /** - * The type of job. Defaults to `DlpJobType.INSPECT` - */ - // const type = {} - /** - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * Example: `name asc, end_time asc, create_time desc` - * Supported fields are: - * - `create_time`: corresponds to the time the job was created. - * - `end_time`: corresponds to the time the job ended. - * - `name`: corresponds to the job's name. - * - `state`: corresponds to `state` - */ - // const orderBy = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListDlpJobs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dlpClient.listDlpJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDlpJobs(); - // [END dlp_v2_generated_DlpService_ListDlpJobs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_info_types.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_info_types.js deleted file mode 100644 index 3e30f0c394a..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_info_types.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 dlp_v2_generated_DlpService_ListInfoTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It 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 resource name. - * The format of this value is as follows: - * locations/LOCATION_ID - */ - // const parent = 'abc123' - /** - * BCP-47 language code for localized infoType friendly - * names. If omitted, or if localized strings are not available, - * en-US strings will be returned. - */ - // const languageCode = 'abc123' - /** - * filter to only return infoTypes supported by certain parts of the - * API. Defaults to supported_by=INSPECT. - */ - // const filter = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListInfoTypes() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.listInfoTypes(request); - console.log(response); - } - - callListInfoTypes(); - // [END dlp_v2_generated_DlpService_ListInfoTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_inspect_templates.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_inspect_templates.js deleted file mode 100644 index 23830cc72d1..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_inspect_templates.js +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated 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 dlp_v2_generated_DlpService_ListInspectTemplates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have specified a processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to `ListInspectTemplates`. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - */ - // const pageSize = 1234 - /** - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * Example: `name asc,update_time, create_time desc` - * Supported fields are: - * - `create_time`: corresponds to the time the template was created. - * - `update_time`: corresponds to the time the template was last updated. - * - `name`: corresponds to the template's name. - * - `display_name`: corresponds to the template's display name. - */ - // const orderBy = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListInspectTemplates() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dlpClient.listInspectTemplatesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListInspectTemplates(); - // [END dlp_v2_generated_DlpService_ListInspectTemplates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_job_triggers.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_job_triggers.js deleted file mode 100644 index 32c4f39d06b..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_job_triggers.js +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated 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 dlp_v2_generated_DlpService_ListJobTriggers_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - * The format of this value varies depending on whether you have specified a - * processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by a server. - */ - // const pageSize = 1234 - /** - * Comma separated list of triggeredJob fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * Example: `name asc,update_time, create_time desc` - * Supported fields are: - * - `create_time`: corresponds to the time the JobTrigger was created. - * - `update_time`: corresponds to the time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to the JobTrigger's name. - * - `display_name`: corresponds to the JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - */ - // const orderBy = 'abc123' - /** - * Allows filtering. - * Supported syntax: - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect triggers: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * Examples: - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * The length of this field should be no more than 500 characters. - */ - // const filter = 'abc123' - /** - * The type of jobs. Will use `DlpJobType.INSPECT` if not set. - */ - // const type = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListJobTriggers() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dlpClient.listJobTriggersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListJobTriggers(); - // [END dlp_v2_generated_DlpService_ListJobTriggers_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_stored_info_types.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_stored_info_types.js deleted file mode 100644 index 91d84fe85dd..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.list_stored_info_types.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 dlp_v2_generated_DlpService_ListStoredInfoTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have specified a processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - */ - // const pageSize = 1234 - /** - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * Example: `name asc, display_name, create_time desc` - * Supported fields are: - * - `create_time`: corresponds to the time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - */ - // const orderBy = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListStoredInfoTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dlpClient.listStoredInfoTypesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListStoredInfoTypes(); - // [END dlp_v2_generated_DlpService_ListStoredInfoTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.redact_image.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.redact_image.js deleted file mode 100644 index 419fb8ab927..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.redact_image.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() { - // [START dlp_v2_generated_DlpService_RedactImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Parent resource name. - * The format of this value varies depending on whether you have specified a - * processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Configuration for the inspector. - */ - // const inspectConfig = {} - /** - * The configuration for specifying what content to redact from images. - */ - // const imageRedactionConfigs = [1,2,3,4] - /** - * Whether the response should include findings along with the redacted - * image. - */ - // const includeFindings = true - /** - * The content must be PNG, JPEG, SVG or BMP. - */ - // const byteItem = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callRedactImage() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.redactImage(request); - console.log(response); - } - - callRedactImage(); - // [END dlp_v2_generated_DlpService_RedactImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.reidentify_content.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.reidentify_content.js deleted file mode 100644 index 1db23fa5a1a..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.reidentify_content.js +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated 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 dlp_v2_generated_DlpService_ReidentifyContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 resource name. - * The format of this value varies depending on whether you have specified a - * processing - * location (https://cloud.google.com/dlp/docs/specifying-location): - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * parent=projects/example-project/locations/europe-west3 - */ - // const parent = 'abc123' - /** - * Configuration for the re-identification of the content item. - * This field shares the same proto message type that is used for - * de-identification, however its usage here is for the reversal of the - * previous de-identification. Re-identification is performed by examining - * the transformations used to de-identify the items and executing the - * reverse. This requires that only reversible transformations - * be provided here. The reversible transformations are: - * - `CryptoDeterministicConfig` - * - `CryptoReplaceFfxFpeConfig` - */ - // const reidentifyConfig = {} - /** - * Configuration for the inspector. - */ - // const inspectConfig = {} - /** - * The item to re-identify. Will be treated as text. - */ - // const item = {} - /** - * Template to use. Any configuration directly specified in - * `inspect_config` will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const inspectTemplateName = 'abc123' - /** - * Template to use. References an instance of `DeidentifyTemplate`. - * Any configuration directly specified in `reidentify_config` or - * `inspect_config` will override those set in the template. The - * `DeidentifyTemplate` used must include only reversible transformations. - * Singular fields that are set in this request will replace their - * corresponding fields in the template. Repeated fields are appended. - * Singular sub-messages and groups are recursively merged. - */ - // const reidentifyTemplateName = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callReidentifyContent() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dlpClient.reidentifyContent(request); - console.log(response); - } - - callReidentifyContent(); - // [END dlp_v2_generated_DlpService_ReidentifyContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_deidentify_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_deidentify_template.js deleted file mode 100644 index 2a1b632f436..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_deidentify_template.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(name) { - // [START dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 organization and deidentify template to be updated, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - */ - // const name = 'abc123' - /** - * New DeidentifyTemplate value. - */ - // const deidentifyTemplate = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateDeidentifyTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateDeidentifyTemplate(request); - console.log(response); - } - - callUpdateDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_inspect_template.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_inspect_template.js deleted file mode 100644 index 69a1b2c0cb3..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_inspect_template.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(name) { - // [START dlp_v2_generated_DlpService_UpdateInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 organization and inspectTemplate to be updated, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - */ - // const name = 'abc123' - /** - * New InspectTemplate value. - */ - // const inspectTemplate = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateInspectTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateInspectTemplate(request); - console.log(response); - } - - callUpdateInspectTemplate(); - // [END dlp_v2_generated_DlpService_UpdateInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_job_trigger.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_job_trigger.js deleted file mode 100644 index 24becdb8f7f..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_job_trigger.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(name) { - // [START dlp_v2_generated_DlpService_UpdateJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - /** - * New JobTrigger value. - */ - // const jobTrigger = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateJobTrigger(request); - console.log(response); - } - - callUpdateJobTrigger(); - // [END dlp_v2_generated_DlpService_UpdateJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_stored_info_type.js b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_stored_info_type.js deleted file mode 100644 index bde7297da18..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/dlp_service.update_stored_info_type.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 dlp_v2_generated_DlpService_UpdateStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will 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 organization and storedInfoType to be updated, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - */ - // const name = 'abc123' - /** - * Updated configuration for the storedInfoType. If not provided, a new - * version of the storedInfoType will be created with the existing - * configuration. - */ - // const config = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('@google-cloud/dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateStoredInfoType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateStoredInfoType(request); - console.log(response); - } - - callUpdateStoredInfoType(); - // [END dlp_v2_generated_DlpService_UpdateStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json b/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json deleted file mode 100644 index 50feadaad95..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json +++ /dev/null @@ -1,1671 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-dlp", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.privacy.dlp.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "dlp_v2_generated_DlpService_InspectContent_async", - "title": "DlpService inspectContent Sample", - "origin": "API_DEFINITION", - "description": " Finds potentially sensitive info in content. This method has limits on input size, processing time, and output size. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated. For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images and https://cloud.google.com/dlp/docs/inspecting-text,", - "canonical": true, - "file": "dlp_service.inspect_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InspectContent", - "fullName": "google.privacy.dlp.v2.DlpService.InspectContent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "item", - "type": ".google.privacy.dlp.v2.ContentItem" - }, - { - "name": "inspect_template_name", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectContentResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "InspectContent", - "fullName": "google.privacy.dlp.v2.DlpService.InspectContent", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_RedactImage_async", - "title": "DlpService redactImage Sample", - "origin": "API_DEFINITION", - "description": " Redacts potentially sensitive info from an image. This method has limits on input size, processing time, and output size. See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to learn more. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", - "canonical": true, - "file": "dlp_service.redact_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RedactImage", - "fullName": "google.privacy.dlp.v2.DlpService.RedactImage", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "image_redaction_configs", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "include_findings", - "type": "TYPE_BOOL" - }, - { - "name": "byte_item", - "type": ".google.privacy.dlp.v2.ByteContentItem" - } - ], - "resultType": ".google.privacy.dlp.v2.RedactImageResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "RedactImage", - "fullName": "google.privacy.dlp.v2.DlpService.RedactImage", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeidentifyContent_async", - "title": "DlpService deidentifyContent Sample", - "origin": "API_DEFINITION", - "description": " De-identifies potentially sensitive info from a ContentItem. This method has limits on input size and output size. See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to learn more. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", - "canonical": true, - "file": "dlp_service.deidentify_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 101, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.DeidentifyContent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_config", - "type": ".google.privacy.dlp.v2.DeidentifyConfig" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "item", - "type": ".google.privacy.dlp.v2.ContentItem" - }, - { - "name": "inspect_template_name", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_template_name", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyContentResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.DeidentifyContent", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ReidentifyContent_async", - "title": "DlpService reidentifyContent Sample", - "origin": "API_DEFINITION", - "description": " Re-identifies content that has been de-identified. See https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example to learn more.", - "canonical": true, - "file": "dlp_service.reidentify_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 102, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.ReidentifyContent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "reidentify_config", - "type": ".google.privacy.dlp.v2.DeidentifyConfig" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "item", - "type": ".google.privacy.dlp.v2.ContentItem" - }, - { - "name": "inspect_template_name", - "type": "TYPE_STRING" - }, - { - "name": "reidentify_template_name", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ReidentifyContentResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ReidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.ReidentifyContent", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListInfoTypes_async", - "title": "DlpService listInfoTypes Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of the sensitive information types that DLP API supports. See https://cloud.google.com/dlp/docs/infotypes-reference to learn more.", - "canonical": true, - "file": "dlp_service.list_info_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListInfoTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListInfoTypesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListInfoTypes", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateInspectTemplate_async", - "title": "DlpService createInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Creates an InspectTemplate for reusing frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.create_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateInspectTemplate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "inspect_template", - "type": ".google.privacy.dlp.v2.InspectTemplate" - }, - { - "name": "template_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateInspectTemplate_async", - "title": "DlpService updateInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Updates the InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.update_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateInspectTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "inspect_template", - "type": ".google.privacy.dlp.v2.InspectTemplate" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetInspectTemplate_async", - "title": "DlpService getInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Gets an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.get_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetInspectTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListInspectTemplates_async", - "title": "DlpService listInspectTemplates Sample", - "origin": "API_DEFINITION", - "description": " Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.list_inspect_templates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 93, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInspectTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListInspectTemplates", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListInspectTemplatesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListInspectTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListInspectTemplates", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteInspectTemplate_async", - "title": "DlpService deleteInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Deletes an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.delete_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteInspectTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async", - "title": "DlpService createDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Creates a DeidentifyTemplate for reusing frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.create_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_template", - "type": ".google.privacy.dlp.v2.DeidentifyTemplate" - }, - { - "name": "template_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async", - "title": "DlpService updateDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Updates the DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.update_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_template", - "type": ".google.privacy.dlp.v2.DeidentifyTemplate" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetDeidentifyTemplate_async", - "title": "DlpService getDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Gets a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.get_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListDeidentifyTemplates_async", - "title": "DlpService listDeidentifyTemplates Sample", - "origin": "API_DEFINITION", - "description": " Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.list_deidentify_templates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 93, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDeidentifyTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListDeidentifyTemplates", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListDeidentifyTemplatesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListDeidentifyTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListDeidentifyTemplates", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async", - "title": "DlpService deleteDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.delete_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateJobTrigger_async", - "title": "DlpService createJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.create_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.CreateJobTrigger", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "job_trigger", - "type": ".google.privacy.dlp.v2.JobTrigger" - }, - { - "name": "trigger_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.JobTrigger", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.CreateJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateJobTrigger_async", - "title": "DlpService updateJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Updates a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.update_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "job_trigger", - "type": ".google.privacy.dlp.v2.JobTrigger" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.JobTrigger", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_HybridInspectJobTrigger_async", - "title": "DlpService hybridInspectJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Inspect hybrid content and store findings to a trigger. The inspection will be processed asynchronously. To review the findings monitor the jobs within the trigger.", - "canonical": true, - "file": "dlp_service.hybrid_inspect_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "HybridInspectJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.HybridInspectJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "hybrid_item", - "type": ".google.privacy.dlp.v2.HybridContentItem" - } - ], - "resultType": ".google.privacy.dlp.v2.HybridInspectResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "HybridInspectJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.HybridInspectJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetJobTrigger_async", - "title": "DlpService getJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Gets a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.get_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.GetJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.JobTrigger", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.GetJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListJobTriggers_async", - "title": "DlpService listJobTriggers Sample", - "origin": "API_DEFINITION", - "description": " Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.list_job_triggers.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 117, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListJobTriggers", - "fullName": "google.privacy.dlp.v2.DlpService.ListJobTriggers", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": ".google.privacy.dlp.v2.DlpJobType" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListJobTriggersResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListJobTriggers", - "fullName": "google.privacy.dlp.v2.DlpService.ListJobTriggers", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteJobTrigger_async", - "title": "DlpService deleteJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Deletes a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.delete_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ActivateJobTrigger_async", - "title": "DlpService activateJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Activate a job trigger. Causes the immediate execute of a trigger instead of waiting on the trigger event to occur.", - "canonical": true, - "file": "dlp_service.activate_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ActivateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.ActivateJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DlpJob", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ActivateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.ActivateJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateDlpJob_async", - "title": "DlpService createDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", - "canonical": true, - "file": "dlp_service.create_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDlpJob", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "inspect_job", - "type": ".google.privacy.dlp.v2.InspectJobConfig" - }, - { - "name": "risk_job", - "type": ".google.privacy.dlp.v2.RiskAnalysisJobConfig" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DlpJob", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListDlpJobs_async", - "title": "DlpService listDlpJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists DlpJobs that match the specified filter in the request. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.list_dlp_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 117, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDlpJobs", - "fullName": "google.privacy.dlp.v2.DlpService.ListDlpJobs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": ".google.privacy.dlp.v2.DlpJobType" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListDlpJobsResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListDlpJobs", - "fullName": "google.privacy.dlp.v2.DlpService.ListDlpJobs", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetDlpJob_async", - "title": "DlpService getDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Gets the latest state of a long-running DlpJob. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.get_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.GetDlpJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DlpJob", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.GetDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteDlpJob_async", - "title": "DlpService deleteDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Deletes a long-running DlpJob. This method indicates that the client is no longer interested in the DlpJob result. The job will be canceled if possible. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.delete_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDlpJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CancelDlpJob_async", - "title": "DlpService cancelDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Starts asynchronous cancellation on a long-running DlpJob. The server makes a best effort to cancel the DlpJob, but success is not guaranteed. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.cancel_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CancelDlpJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CancelDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CancelDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateStoredInfoType_async", - "title": "DlpService createStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Creates a pre-built stored infoType to be used for inspection. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.create_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.CreateStoredInfoType", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "config", - "type": ".google.privacy.dlp.v2.StoredInfoTypeConfig" - }, - { - "name": "stored_info_type_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.StoredInfoType", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.CreateStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateStoredInfoType_async", - "title": "DlpService updateStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Updates the stored infoType by creating a new version. The existing version will continue to be used until the new version is ready. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.update_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateStoredInfoType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "config", - "type": ".google.privacy.dlp.v2.StoredInfoTypeConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.StoredInfoType", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetStoredInfoType_async", - "title": "DlpService getStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Gets a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.get_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.GetStoredInfoType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.StoredInfoType", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.GetStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListStoredInfoTypes_async", - "title": "DlpService listStoredInfoTypes Sample", - "origin": "API_DEFINITION", - "description": " Lists stored infoTypes. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.list_stored_info_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 90, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListStoredInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListStoredInfoTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListStoredInfoTypesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListStoredInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListStoredInfoTypes", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteStoredInfoType_async", - "title": "DlpService deleteStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Deletes a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.delete_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteStoredInfoType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_HybridInspectDlpJob_async", - "title": "DlpService hybridInspectDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Inspect hybrid content and store findings to a job. To review the findings, inspect the job. Inspection will occur asynchronously.", - "canonical": true, - "file": "dlp_service.hybrid_inspect_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "HybridInspectDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.HybridInspectDlpJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "hybrid_item", - "type": ".google.privacy.dlp.v2.HybridContentItem" - } - ], - "resultType": ".google.privacy.dlp.v2.HybridInspectResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "HybridInspectDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.HybridInspectDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_FinishDlpJob_async", - "title": "DlpService finishDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Finish a running hybrid DlpJob. Triggers the finalization steps and running of any enabled actions that have not yet run.", - "canonical": true, - "file": "dlp_service.finish_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FinishDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.FinishDlpJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "FinishDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.FinishDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/index.ts b/owl-bot-staging/google-privacy-dlp/v2/src/index.ts deleted file mode 100644 index 651447ba32a..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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 DlpServiceClient = v2.DlpServiceClient; -type DlpServiceClient = v2.DlpServiceClient; -export {v2, DlpServiceClient}; -export default {v2, DlpServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client.ts b/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client.ts deleted file mode 100644 index 6c1c00bf3d9..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client.ts +++ /dev/null @@ -1,5285 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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, 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/dlp_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dlp_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Cloud Data Loss Prevention (DLP) API is a service that allows clients - * to detect the presence of Personally Identifiable Information (PII) and other - * privacy-sensitive data in user-supplied, unstructured data streams, like text - * blocks or images. - * The service also includes methods for sensitive data redaction and - * scheduling of data scans on Google Cloud Platform based data sets. - * - * To learn more about concepts and find how-to guides see - * https://cloud.google.com/dlp/docs/. - * @class - * @memberof v2 - */ -export class DlpServiceClient { - 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}; - dlpServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DlpServiceClient. - * - * @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 DlpServiceClient({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 DlpServiceClient; - 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 = { - findingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/findings/{finding}' - ), - organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' - ), - organizationDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/deidentifyTemplates/{deidentify_template}' - ), - organizationInspectTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/inspectTemplates/{inspect_template}' - ), - organizationLocationDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}' - ), - organizationLocationInspectTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}' - ), - organizationLocationStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/storedInfoTypes/{stored_info_type}' - ), - organizationStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/storedInfoTypes/{stored_info_type}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/deidentifyTemplates/{deidentify_template}' - ), - projectDlpContentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/dlpContent' - ), - projectDlpJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/dlpJobs/{dlp_job}' - ), - projectInspectTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/inspectTemplates/{inspect_template}' - ), - projectJobTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/jobTriggers/{job_trigger}' - ), - projectLocationDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}' - ), - projectLocationDlpJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dlpJobs/{dlp_job}' - ), - projectLocationInspectTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/inspectTemplates/{inspect_template}' - ), - projectLocationJobTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/jobTriggers/{job_trigger}' - ), - projectLocationStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/storedInfoTypes/{stored_info_type}' - ), - projectStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/storedInfoTypes/{stored_info_type}' - ), - }; - - // 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 = { - listInspectTemplates: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'inspectTemplates'), - listDeidentifyTemplates: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'deidentifyTemplates'), - listJobTriggers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobTriggers'), - listDlpJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs'), - listStoredInfoTypes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'storedInfoTypes') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.privacy.dlp.v2.DlpService', 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.dlpServiceStub) { - return this.dlpServiceStub; - } - - // Put together the "service stub" for - // google.privacy.dlp.v2.DlpService. - this.dlpServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.privacy.dlp.v2.DlpService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.privacy.dlp.v2.DlpService, - 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 dlpServiceStubMethods = - ['inspectContent', 'redactImage', 'deidentifyContent', 'reidentifyContent', 'listInfoTypes', 'createInspectTemplate', 'updateInspectTemplate', 'getInspectTemplate', 'listInspectTemplates', 'deleteInspectTemplate', 'createDeidentifyTemplate', 'updateDeidentifyTemplate', 'getDeidentifyTemplate', 'listDeidentifyTemplates', 'deleteDeidentifyTemplate', 'createJobTrigger', 'updateJobTrigger', 'hybridInspectJobTrigger', 'getJobTrigger', 'listJobTriggers', 'deleteJobTrigger', 'activateJobTrigger', 'createDlpJob', 'listDlpJobs', 'getDlpJob', 'deleteDlpJob', 'cancelDlpJob', 'createStoredInfoType', 'updateStoredInfoType', 'getStoredInfoType', 'listStoredInfoTypes', 'deleteStoredInfoType', 'hybridInspectDlpJob', 'finishDlpJob']; - for (const methodName of dlpServiceStubMethods) { - const callPromise = this.dlpServiceStub.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.dlpServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dlp.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 'dlp.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 -- - // ------------------- -/** - * Finds potentially sensitive info in content. - * This method has limits on input size, processing time, and output size. - * - * When no InfoTypes or CustomInfoTypes are specified in this request, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images - * and https://cloud.google.com/dlp/docs/inspecting-text, - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Parent resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. What specified here will override - * the template referenced by the inspect_template_name argument. - * @param {google.privacy.dlp.v2.ContentItem} request.item - * The item to inspect. - * @param {string} request.inspectTemplateName - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.InspectContentResponse|InspectContentResponse}. - * Please see the {@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/dlp_service.inspect_content.js - * region_tag:dlp_v2_generated_DlpService_InspectContent_async - */ - inspectContent( - request?: protos.google.privacy.dlp.v2.IInspectContentRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|undefined, {}|undefined - ]>; - inspectContent( - request: protos.google.privacy.dlp.v2.IInspectContentRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>): void; - inspectContent( - request: protos.google.privacy.dlp.v2.IInspectContentRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>): void; - inspectContent( - request?: protos.google.privacy.dlp.v2.IInspectContentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.inspectContent(request, options, callback); - } -/** - * Redacts potentially sensitive info from an image. - * This method has limits on input size, processing time, and output size. - * See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to - * learn more. - * - * When no InfoTypes or CustomInfoTypes are specified in this request, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Parent resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. - * @param {number[]} request.imageRedactionConfigs - * The configuration for specifying what content to redact from images. - * @param {boolean} request.includeFindings - * Whether the response should include findings along with the redacted - * image. - * @param {google.privacy.dlp.v2.ByteContentItem} request.byteItem - * The content must be PNG, JPEG, SVG or BMP. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.RedactImageResponse|RedactImageResponse}. - * Please see the {@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/dlp_service.redact_image.js - * region_tag:dlp_v2_generated_DlpService_RedactImage_async - */ - redactImage( - request?: protos.google.privacy.dlp.v2.IRedactImageRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|undefined, {}|undefined - ]>; - redactImage( - request: protos.google.privacy.dlp.v2.IRedactImageRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>): void; - redactImage( - request: protos.google.privacy.dlp.v2.IRedactImageRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>): void; - redactImage( - request?: protos.google.privacy.dlp.v2.IRedactImageRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.redactImage(request, options, callback); - } -/** - * De-identifies potentially sensitive info from a ContentItem. - * This method has limits on input size and output size. - * See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to - * learn more. - * - * When no InfoTypes or CustomInfoTypes are specified in this request, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Parent resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {google.privacy.dlp.v2.DeidentifyConfig} request.deidentifyConfig - * Configuration for the de-identification of the content item. - * Items specified here will override the template referenced by the - * deidentify_template_name argument. - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. - * Items specified here will override the template referenced by the - * inspect_template_name argument. - * @param {google.privacy.dlp.v2.ContentItem} request.item - * The item to de-identify. Will be treated as text. - * - * This value must be of type - * {@link protos.google.privacy.dlp.v2.Table|Table} if your - * {@link protos.google.privacy.dlp.v2.DeidentifyContentRequest.deidentify_config|deidentify_config} - * is a - * {@link protos.google.privacy.dlp.v2.RecordTransformations|RecordTransformations} - * object. - * @param {string} request.inspectTemplateName - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.deidentifyTemplateName - * Template to use. Any configuration directly specified in - * deidentify_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.DeidentifyContentResponse|DeidentifyContentResponse}. - * Please see the {@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/dlp_service.deidentify_content.js - * region_tag:dlp_v2_generated_DlpService_DeidentifyContent_async - */ - deidentifyContent( - request?: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|undefined, {}|undefined - ]>; - deidentifyContent( - request: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - deidentifyContent( - request: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - deidentifyContent( - request?: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.deidentifyContent(request, options, callback); - } -/** - * Re-identifies content that has been de-identified. - * See - * https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example - * to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {google.privacy.dlp.v2.DeidentifyConfig} request.reidentifyConfig - * Configuration for the re-identification of the content item. - * This field shares the same proto message type that is used for - * de-identification, however its usage here is for the reversal of the - * previous de-identification. Re-identification is performed by examining - * the transformations used to de-identify the items and executing the - * reverse. This requires that only reversible transformations - * be provided here. The reversible transformations are: - * - * - `CryptoDeterministicConfig` - * - `CryptoReplaceFfxFpeConfig` - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. - * @param {google.privacy.dlp.v2.ContentItem} request.item - * The item to re-identify. Will be treated as text. - * @param {string} request.inspectTemplateName - * Template to use. Any configuration directly specified in - * `inspect_config` will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.reidentifyTemplateName - * Template to use. References an instance of `DeidentifyTemplate`. - * Any configuration directly specified in `reidentify_config` or - * `inspect_config` will override those set in the template. The - * `DeidentifyTemplate` used must include only reversible transformations. - * Singular fields that are set in this request will replace their - * corresponding fields in the template. Repeated fields are appended. - * Singular sub-messages and groups are recursively merged. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.ReidentifyContentResponse|ReidentifyContentResponse}. - * Please see the {@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/dlp_service.reidentify_content.js - * region_tag:dlp_v2_generated_DlpService_ReidentifyContent_async - */ - reidentifyContent( - request?: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|undefined, {}|undefined - ]>; - reidentifyContent( - request: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - reidentifyContent( - request: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - reidentifyContent( - request?: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.reidentifyContent(request, options, callback); - } -/** - * Returns a list of the sensitive information types that DLP API - * supports. See https://cloud.google.com/dlp/docs/infotypes-reference to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource name. - * - * The format of this value is as follows: - * - * locations/LOCATION_ID - * @param {string} request.languageCode - * BCP-47 language code for localized infoType friendly - * names. If omitted, or if localized strings are not available, - * en-US strings will be returned. - * @param {string} request.filter - * filter to only return infoTypes supported by certain parts of the - * API. Defaults to supported_by=INSPECT. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.ListInfoTypesResponse|ListInfoTypesResponse}. - * Please see the {@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/dlp_service.list_info_types.js - * region_tag:dlp_v2_generated_DlpService_ListInfoTypes_async - */ - listInfoTypes( - request?: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|undefined, {}|undefined - ]>; - listInfoTypes( - request: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>): void; - listInfoTypes( - request: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>): void; - listInfoTypes( - request?: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listInfoTypes(request, options, callback); - } -/** - * Creates an InspectTemplate for reusing frequently used configuration - * for inspecting content, images, and storage. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {google.privacy.dlp.v2.InspectTemplate} request.inspectTemplate - * Required. The InspectTemplate to create. - * @param {string} request.templateId - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * Please see the {@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/dlp_service.create_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_CreateInspectTemplate_async - */ - createInspectTemplate( - request?: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|undefined, {}|undefined - ]>; - createInspectTemplate( - request: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - createInspectTemplate( - request: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - createInspectTemplate( - request?: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createInspectTemplate(request, options, callback); - } -/** - * Updates the InspectTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of organization and inspectTemplate to be updated, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - * @param {google.privacy.dlp.v2.InspectTemplate} request.inspectTemplate - * New InspectTemplate value. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * Please see the {@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/dlp_service.update_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_UpdateInspectTemplate_async - */ - updateInspectTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|undefined, {}|undefined - ]>; - updateInspectTemplate( - request: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateInspectTemplate( - request: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateInspectTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateInspectTemplate(request, options, callback); - } -/** - * Gets an InspectTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and inspectTemplate to be read, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * Please see the {@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/dlp_service.get_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_GetInspectTemplate_async - */ - getInspectTemplate( - request?: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|undefined, {}|undefined - ]>; - getInspectTemplate( - request: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - getInspectTemplate( - request: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - getInspectTemplate( - request?: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getInspectTemplate(request, options, callback); - } -/** - * Deletes an InspectTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and inspectTemplate to be deleted, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.delete_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_DeleteInspectTemplate_async - */ - deleteInspectTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|undefined, {}|undefined - ]>; - deleteInspectTemplate( - request: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteInspectTemplate( - request: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteInspectTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteInspectTemplate(request, options, callback); - } -/** - * Creates a DeidentifyTemplate for reusing frequently used configuration - * for de-identifying content, images, and storage. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {google.privacy.dlp.v2.DeidentifyTemplate} request.deidentifyTemplate - * Required. The DeidentifyTemplate to create. - * @param {string} request.templateId - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * Please see the {@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/dlp_service.create_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async - */ - createDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - createDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - createDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - createDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createDeidentifyTemplate(request, options, callback); - } -/** - * Updates the DeidentifyTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of organization and deidentify template to be updated, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - * @param {google.privacy.dlp.v2.DeidentifyTemplate} request.deidentifyTemplate - * New DeidentifyTemplate value. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * Please see the {@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/dlp_service.update_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async - */ - updateDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - updateDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateDeidentifyTemplate(request, options, callback); - } -/** - * Gets a DeidentifyTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and deidentify template to be read, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * Please see the {@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/dlp_service.get_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_GetDeidentifyTemplate_async - */ - getDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - getDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - getDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - getDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getDeidentifyTemplate(request, options, callback); - } -/** - * Deletes a DeidentifyTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and deidentify template to be deleted, - * for example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.delete_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async - */ - deleteDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - deleteDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteDeidentifyTemplate(request, options, callback); - } -/** - * Creates a job trigger to run DLP actions such as scanning storage for - * sensitive information on a set schedule. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {google.privacy.dlp.v2.JobTrigger} request.jobTrigger - * Required. The JobTrigger to create. - * @param {string} request.triggerId - * The trigger id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. - * Please see the {@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/dlp_service.create_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_CreateJobTrigger_async - */ - createJobTrigger( - request?: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|undefined, {}|undefined - ]>; - createJobTrigger( - request: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - createJobTrigger( - request: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - createJobTrigger( - request?: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createJobTrigger(request, options, callback); - } -/** - * Updates a job trigger. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @param {google.privacy.dlp.v2.JobTrigger} request.jobTrigger - * New JobTrigger value. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. - * Please see the {@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/dlp_service.update_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_UpdateJobTrigger_async - */ - updateJobTrigger( - request?: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|undefined, {}|undefined - ]>; - updateJobTrigger( - request: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - updateJobTrigger( - request: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - updateJobTrigger( - request?: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateJobTrigger(request, options, callback); - } -/** - * Inspect hybrid content and store findings to a trigger. The inspection - * will be processed asynchronously. To review the findings monitor the - * jobs within the trigger. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the trigger to execute a hybrid inspect on, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @param {google.privacy.dlp.v2.HybridContentItem} request.hybridItem - * The item to inspect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.HybridInspectResponse|HybridInspectResponse}. - * Please see the {@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/dlp_service.hybrid_inspect_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_HybridInspectJobTrigger_async - */ - hybridInspectJobTrigger( - request?: protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|undefined, {}|undefined - ]>; - hybridInspectJobTrigger( - request: protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - hybridInspectJobTrigger( - request: protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - hybridInspectJobTrigger( - request?: protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.hybridInspectJobTrigger(request, options, callback); - } -/** - * Gets a job trigger. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. - * Please see the {@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/dlp_service.get_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_GetJobTrigger_async - */ - getJobTrigger( - request?: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|undefined, {}|undefined - ]>; - getJobTrigger( - request: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - getJobTrigger( - request: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - getJobTrigger( - request?: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getJobTrigger(request, options, callback); - } -/** - * Deletes a job trigger. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.delete_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_DeleteJobTrigger_async - */ - deleteJobTrigger( - request?: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|undefined, {}|undefined - ]>; - deleteJobTrigger( - request: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - deleteJobTrigger( - request: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - deleteJobTrigger( - request?: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteJobTrigger(request, options, callback); - } -/** - * Activate a job trigger. Causes the immediate execute of a trigger - * instead of waiting on the trigger event to occur. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the trigger to activate, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. - * Please see the {@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/dlp_service.activate_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_ActivateJobTrigger_async - */ - activateJobTrigger( - request?: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|undefined, {}|undefined - ]>; - activateJobTrigger( - request: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - activateJobTrigger( - request: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - activateJobTrigger( - request?: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.activateJobTrigger(request, options, callback); - } -/** - * Creates a new job to inspect storage or calculate risk metrics. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {google.privacy.dlp.v2.InspectJobConfig} request.inspectJob - * An inspection job scans a storage repository for InfoTypes. - * @param {google.privacy.dlp.v2.RiskAnalysisJobConfig} request.riskJob - * A risk analysis job calculates re-identification risk metrics for a - * BigQuery table. - * @param {string} request.jobId - * The job id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. - * Please see the {@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/dlp_service.create_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_CreateDlpJob_async - */ - createDlpJob( - request?: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|undefined, {}|undefined - ]>; - createDlpJob( - request: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>): void; - createDlpJob( - request: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>): void; - createDlpJob( - request?: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createDlpJob(request, options, callback); - } -/** - * Gets the latest state of a long-running DlpJob. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DlpJob 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.privacy.dlp.v2.DlpJob|DlpJob}. - * Please see the {@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/dlp_service.get_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_GetDlpJob_async - */ - getDlpJob( - request?: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|undefined, {}|undefined - ]>; - getDlpJob( - request: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>): void; - getDlpJob( - request: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>): void; - getDlpJob( - request?: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getDlpJob(request, options, callback); - } -/** - * Deletes a long-running DlpJob. This method indicates that the client is - * no longer interested in the DlpJob result. The job will be canceled if - * possible. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DlpJob resource to 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 {@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/v2/dlp_service.delete_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_DeleteDlpJob_async - */ - deleteDlpJob( - request?: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|undefined, {}|undefined - ]>; - deleteDlpJob( - request: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>): void; - deleteDlpJob( - request: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>): void; - deleteDlpJob( - request?: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteDlpJob(request, options, callback); - } -/** - * Starts asynchronous cancellation on a long-running DlpJob. The server - * makes a best effort to cancel the DlpJob, but success is not - * guaranteed. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DlpJob resource to be cancelled. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.cancel_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_CancelDlpJob_async - */ - cancelDlpJob( - request?: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|undefined, {}|undefined - ]>; - cancelDlpJob( - request: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>): void; - cancelDlpJob( - request: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>): void; - cancelDlpJob( - request?: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.cancelDlpJob(request, options, callback); - } -/** - * Creates a pre-built stored infoType to be used for inspection. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {google.privacy.dlp.v2.StoredInfoTypeConfig} request.config - * Required. Configuration of the storedInfoType to create. - * @param {string} request.storedInfoTypeId - * The storedInfoType ID can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * Please see the {@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/dlp_service.create_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_CreateStoredInfoType_async - */ - createStoredInfoType( - request?: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|undefined, {}|undefined - ]>; - createStoredInfoType( - request: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - createStoredInfoType( - request: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - createStoredInfoType( - request?: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createStoredInfoType(request, options, callback); - } -/** - * Updates the stored infoType by creating a new version. The existing version - * will continue to be used until the new version is ready. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of organization and storedInfoType to be updated, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - * @param {google.privacy.dlp.v2.StoredInfoTypeConfig} request.config - * Updated configuration for the storedInfoType. If not provided, a new - * version of the storedInfoType will be created with the existing - * configuration. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * Please see the {@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/dlp_service.update_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_UpdateStoredInfoType_async - */ - updateStoredInfoType( - request?: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|undefined, {}|undefined - ]>; - updateStoredInfoType( - request: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - updateStoredInfoType( - request: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - updateStoredInfoType( - request?: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateStoredInfoType(request, options, callback); - } -/** - * Gets a stored infoType. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and storedInfoType to be read, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * Please see the {@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/dlp_service.get_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_GetStoredInfoType_async - */ - getStoredInfoType( - request?: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|undefined, {}|undefined - ]>; - getStoredInfoType( - request: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - getStoredInfoType( - request: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - getStoredInfoType( - request?: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getStoredInfoType(request, options, callback); - } -/** - * Deletes a stored infoType. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and storedInfoType to be deleted, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.delete_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_DeleteStoredInfoType_async - */ - deleteStoredInfoType( - request?: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|undefined, {}|undefined - ]>; - deleteStoredInfoType( - request: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - deleteStoredInfoType( - request: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - deleteStoredInfoType( - request?: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteStoredInfoType(request, options, callback); - } -/** - * Inspect hybrid content and store findings to a job. - * To review the findings, inspect the job. Inspection will occur - * asynchronously. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the job to execute a hybrid inspect on, for example - * `projects/dlp-test-project/dlpJob/53234423`. - * @param {google.privacy.dlp.v2.HybridContentItem} request.hybridItem - * The item to inspect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.privacy.dlp.v2.HybridInspectResponse|HybridInspectResponse}. - * Please see the {@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/dlp_service.hybrid_inspect_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_HybridInspectDlpJob_async - */ - hybridInspectDlpJob( - request?: protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|undefined, {}|undefined - ]>; - hybridInspectDlpJob( - request: protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|null|undefined, - {}|null|undefined>): void; - hybridInspectDlpJob( - request: protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|null|undefined, - {}|null|undefined>): void; - hybridInspectDlpJob( - request?: protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IHybridInspectResponse, - protos.google.privacy.dlp.v2.IHybridInspectDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.hybridInspectDlpJob(request, options, callback); - } -/** - * Finish a running hybrid DlpJob. Triggers the finalization steps and running - * of any enabled actions that have not yet run. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DlpJob resource to be cancelled. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for 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/v2/dlp_service.finish_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_FinishDlpJob_async - */ - finishDlpJob( - request?: protos.google.privacy.dlp.v2.IFinishDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IFinishDlpJobRequest|undefined, {}|undefined - ]>; - finishDlpJob( - request: protos.google.privacy.dlp.v2.IFinishDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IFinishDlpJobRequest|null|undefined, - {}|null|undefined>): void; - finishDlpJob( - request: protos.google.privacy.dlp.v2.IFinishDlpJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IFinishDlpJobRequest|null|undefined, - {}|null|undefined>): void; - finishDlpJob( - request?: protos.google.privacy.dlp.v2.IFinishDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IFinishDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IFinishDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IFinishDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.finishDlpJob(request, options, callback); - } - - /** - * Lists InspectTemplates. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListInspectTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc,update_time, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the template was created. - * - `update_time`: corresponds to the time the template was last updated. - * - `name`: corresponds to the template's name. - * - `display_name`: corresponds to the template's display name. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * 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 `listInspectTemplatesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listInspectTemplates( - request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate[], - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse - ]>; - listInspectTemplates( - request: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>): void; - listInspectTemplates( - request: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>): void; - listInspectTemplates( - request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate[], - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listInspectTemplates(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 resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListInspectTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc,update_time, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the template was created. - * - `update_time`: corresponds to the time the template was last updated. - * - `name`: corresponds to the template's name. - * - `display_name`: corresponds to the template's display name. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @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.privacy.dlp.v2.InspectTemplate|InspectTemplate} 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 `listInspectTemplatesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listInspectTemplatesStream( - request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - 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['listInspectTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listInspectTemplates.createStream( - this.innerApiCalls.listInspectTemplates as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listInspectTemplates`, 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 resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListInspectTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc,update_time, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the template was created. - * - `update_time`: corresponds to the time the template was last updated. - * - `name`: corresponds to the template's name. - * - `display_name`: corresponds to the template's display name. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @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.privacy.dlp.v2.InspectTemplate|InspectTemplate}. 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/dlp_service.list_inspect_templates.js - * region_tag:dlp_v2_generated_DlpService_ListInspectTemplates_async - */ - listInspectTemplatesAsync( - request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - 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['listInspectTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listInspectTemplates.asyncIterate( - this.innerApiCalls['listInspectTemplates'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists DeidentifyTemplates. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc,update_time, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the template was created. - * - `update_time`: corresponds to the time the template was last updated. - * - `name`: corresponds to the template's name. - * - `display_name`: corresponds to the template's display name. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * 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 `listDeidentifyTemplatesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDeidentifyTemplates( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate[], - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse - ]>; - listDeidentifyTemplates( - request: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>): void; - listDeidentifyTemplates( - request: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>): void; - listDeidentifyTemplates( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate[], - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listDeidentifyTemplates(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 resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc,update_time, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the template was created. - * - `update_time`: corresponds to the time the template was last updated. - * - `name`: corresponds to the template's name. - * - `display_name`: corresponds to the template's display name. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @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.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate} 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 `listDeidentifyTemplatesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDeidentifyTemplatesStream( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - 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['listDeidentifyTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDeidentifyTemplates.createStream( - this.innerApiCalls.listDeidentifyTemplates as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDeidentifyTemplates`, 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 resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * + Organizations scope, location specified:
- * `organizations/`ORG_ID`/locations/`LOCATION_ID - * + Organizations scope, no location specified (defaults to global):
- * `organizations/`ORG_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc,update_time, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the template was created. - * - `update_time`: corresponds to the time the template was last updated. - * - `name`: corresponds to the template's name. - * - `display_name`: corresponds to the template's display name. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @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.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. 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/dlp_service.list_deidentify_templates.js - * region_tag:dlp_v2_generated_DlpService_ListDeidentifyTemplates_async - */ - listDeidentifyTemplatesAsync( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - 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['listDeidentifyTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDeidentifyTemplates.asyncIterate( - this.innerApiCalls['listDeidentifyTemplates'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists job triggers. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - * @param {number} request.pageSize - * Size of the page, can be limited by a server. - * @param {string} request.orderBy - * Comma separated list of triggeredJob fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc,update_time, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the JobTrigger was created. - * - `update_time`: corresponds to the time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to the JobTrigger's name. - * - `display_name`: corresponds to the JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect triggers: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * - * Examples: - * - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of jobs. Will use `DlpJobType.INSPECT` if not set. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.privacy.dlp.v2.JobTrigger|JobTrigger}. - * 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 `listJobTriggersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listJobTriggers( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger[], - protos.google.privacy.dlp.v2.IListJobTriggersRequest|null, - protos.google.privacy.dlp.v2.IListJobTriggersResponse - ]>; - listJobTriggers( - request: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>): void; - listJobTriggers( - request: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>): void; - listJobTriggers( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger[], - protos.google.privacy.dlp.v2.IListJobTriggersRequest|null, - protos.google.privacy.dlp.v2.IListJobTriggersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listJobTriggers(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 resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - * @param {number} request.pageSize - * Size of the page, can be limited by a server. - * @param {string} request.orderBy - * Comma separated list of triggeredJob fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc,update_time, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the JobTrigger was created. - * - `update_time`: corresponds to the time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to the JobTrigger's name. - * - `display_name`: corresponds to the JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect triggers: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * - * Examples: - * - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of jobs. Will use `DlpJobType.INSPECT` if not set. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @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.privacy.dlp.v2.JobTrigger|JobTrigger} 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 `listJobTriggersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listJobTriggersStream( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - 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['listJobTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobTriggers.createStream( - this.innerApiCalls.listJobTriggers as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobTriggers`, 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 resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - * @param {number} request.pageSize - * Size of the page, can be limited by a server. - * @param {string} request.orderBy - * Comma separated list of triggeredJob fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc,update_time, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the JobTrigger was created. - * - `update_time`: corresponds to the time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to the JobTrigger's name. - * - `display_name`: corresponds to the JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect triggers: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * - * Examples: - * - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of jobs. Will use `DlpJobType.INSPECT` if not set. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @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.privacy.dlp.v2.JobTrigger|JobTrigger}. 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/dlp_service.list_job_triggers.js - * region_tag:dlp_v2_generated_DlpService_ListJobTriggers_async - */ - listJobTriggersAsync( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - 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['listJobTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobTriggers.asyncIterate( - this.innerApiCalls['listJobTriggers'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists DlpJobs that match the specified filter in the request. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The name of the trigger that created the job. - * - 'end_time` - Corresponds to the time the job finished. - * - 'start_time` - Corresponds to the time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to the time the job finished. - * - 'start_time` - Corresponds to the time the job finished. - * * The operator must be `=` or `!=`. - * - * Examples: - * - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of job. Defaults to `DlpJobType.INSPECT` - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc, end_time asc, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the job was created. - * - `end_time`: corresponds to the time the job ended. - * - `name`: corresponds to the job's name. - * - `state`: corresponds to `state` - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.privacy.dlp.v2.DlpJob|DlpJob}. - * 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 `listDlpJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDlpJobs( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob[], - protos.google.privacy.dlp.v2.IListDlpJobsRequest|null, - protos.google.privacy.dlp.v2.IListDlpJobsResponse - ]>; - listDlpJobs( - request: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>): void; - listDlpJobs( - request: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>): void; - listDlpJobs( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob[], - protos.google.privacy.dlp.v2.IListDlpJobsRequest|null, - protos.google.privacy.dlp.v2.IListDlpJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listDlpJobs(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 resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The name of the trigger that created the job. - * - 'end_time` - Corresponds to the time the job finished. - * - 'start_time` - Corresponds to the time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to the time the job finished. - * - 'start_time` - Corresponds to the time the job finished. - * * The operator must be `=` or `!=`. - * - * Examples: - * - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of job. Defaults to `DlpJobType.INSPECT` - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc, end_time asc, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the job was created. - * - `end_time`: corresponds to the time the job ended. - * - `name`: corresponds to the job's name. - * - `state`: corresponds to `state` - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @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.privacy.dlp.v2.DlpJob|DlpJob} 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 `listDlpJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listDlpJobsStream( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - 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['listDlpJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDlpJobs.createStream( - this.innerApiCalls.listDlpJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDlpJobs`, 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 resource name. - * - * The format of this value varies depending on whether you have [specified a - * processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The name of the trigger that created the job. - * - 'end_time` - Corresponds to the time the job finished. - * - 'start_time` - Corresponds to the time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to the time the job finished. - * - 'start_time` - Corresponds to the time the job finished. - * * The operator must be `=` or `!=`. - * - * Examples: - * - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of job. Defaults to `DlpJobType.INSPECT` - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc, end_time asc, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the job was created. - * - `end_time`: corresponds to the time the job ended. - * - `name`: corresponds to the job's name. - * - `state`: corresponds to `state` - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @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.privacy.dlp.v2.DlpJob|DlpJob}. 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/dlp_service.list_dlp_jobs.js - * region_tag:dlp_v2_generated_DlpService_ListDlpJobs_async - */ - listDlpJobsAsync( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - 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['listDlpJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDlpJobs.asyncIterate( - this.innerApiCalls['listDlpJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists stored infoTypes. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - * @param {number} request.pageSize - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc, display_name, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * 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 `listStoredInfoTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listStoredInfoTypes( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType[], - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest|null, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse - ]>; - listStoredInfoTypes( - request: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>): void; - listStoredInfoTypes( - request: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>): void; - listStoredInfoTypes( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType[], - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest|null, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listStoredInfoTypes(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 resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - * @param {number} request.pageSize - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc, display_name, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @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.privacy.dlp.v2.StoredInfoType|StoredInfoType} 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 `listStoredInfoTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listStoredInfoTypesStream( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - 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['listStoredInfoTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listStoredInfoTypes.createStream( - this.innerApiCalls.listStoredInfoTypes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listStoredInfoTypes`, 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 resource name. - * - * The format of this value varies depending on the scope of the request - * (project or organization) and whether you have [specified a processing - * location](https://cloud.google.com/dlp/docs/specifying-location): - * - * + Projects scope, location specified:
- * `projects/`PROJECT_ID`/locations/`LOCATION_ID - * + Projects scope, no location specified (defaults to global):
- * `projects/`PROJECT_ID - * - * The following example `parent` string specifies a parent project with the - * identifier `example-project`, and specifies the `europe-west3` location - * for processing data: - * - * parent=projects/example-project/locations/europe-west3 - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - * @param {number} request.pageSize - * Size of the page, can be limited by the server. If zero server returns - * a page of max size 100. - * @param {string} request.orderBy - * Comma separated list of fields to order by, - * followed by `asc` or `desc` postfix. This list is case-insensitive, - * default sorting order is ascending, redundant space characters are - * insignificant. - * - * Example: `name asc, display_name, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to the time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - * @param {string} request.locationId - * Deprecated. This field has no effect. - * @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.privacy.dlp.v2.StoredInfoType|StoredInfoType}. 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/dlp_service.list_stored_info_types.js - * region_tag:dlp_v2_generated_DlpService_ListStoredInfoTypes_async - */ - listStoredInfoTypesAsync( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - 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['listStoredInfoTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listStoredInfoTypes.asyncIterate( - this.innerApiCalls['listStoredInfoTypes'] 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); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified finding resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} finding - * @returns {string} Resource name string. - */ - findingPath(project:string,location:string,finding:string) { - return this.pathTemplates.findingPathTemplate.render({ - project: project, - location: location, - finding: finding, - }); - } - - /** - * Parse the project from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).project; - } - - /** - * Parse the location from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).location; - } - - /** - * Parse the finding from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).finding; - } - - /** - * 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 organizationDeidentifyTemplate resource name string. - * - * @param {string} organization - * @param {string} deidentify_template - * @returns {string} Resource name string. - */ - organizationDeidentifyTemplatePath(organization:string,deidentifyTemplate:string) { - return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.render({ - organization: organization, - deidentify_template: deidentifyTemplate, - }); - } - - /** - * Parse the organization from OrganizationDeidentifyTemplate resource. - * - * @param {string} organizationDeidentifyTemplateName - * A fully-qualified path representing organization_deidentify_template resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationDeidentifyTemplateName(organizationDeidentifyTemplateName: string) { - return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.match(organizationDeidentifyTemplateName).organization; - } - - /** - * Parse the deidentify_template from OrganizationDeidentifyTemplate resource. - * - * @param {string} organizationDeidentifyTemplateName - * A fully-qualified path representing organization_deidentify_template resource. - * @returns {string} A string representing the deidentify_template. - */ - matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName(organizationDeidentifyTemplateName: string) { - return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.match(organizationDeidentifyTemplateName).deidentify_template; - } - - /** - * Return a fully-qualified organizationInspectTemplate resource name string. - * - * @param {string} organization - * @param {string} inspect_template - * @returns {string} Resource name string. - */ - organizationInspectTemplatePath(organization:string,inspectTemplate:string) { - return this.pathTemplates.organizationInspectTemplatePathTemplate.render({ - organization: organization, - inspect_template: inspectTemplate, - }); - } - - /** - * Parse the organization from OrganizationInspectTemplate resource. - * - * @param {string} organizationInspectTemplateName - * A fully-qualified path representing organization_inspect_template resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationInspectTemplateName(organizationInspectTemplateName: string) { - return this.pathTemplates.organizationInspectTemplatePathTemplate.match(organizationInspectTemplateName).organization; - } - - /** - * Parse the inspect_template from OrganizationInspectTemplate resource. - * - * @param {string} organizationInspectTemplateName - * A fully-qualified path representing organization_inspect_template resource. - * @returns {string} A string representing the inspect_template. - */ - matchInspectTemplateFromOrganizationInspectTemplateName(organizationInspectTemplateName: string) { - return this.pathTemplates.organizationInspectTemplatePathTemplate.match(organizationInspectTemplateName).inspect_template; - } - - /** - * Return a fully-qualified organizationLocationDeidentifyTemplate resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} deidentify_template - * @returns {string} Resource name string. - */ - organizationLocationDeidentifyTemplatePath(organization:string,location:string,deidentifyTemplate:string) { - return this.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.render({ - organization: organization, - location: location, - deidentify_template: deidentifyTemplate, - }); - } - - /** - * Parse the organization from OrganizationLocationDeidentifyTemplate resource. - * - * @param {string} organizationLocationDeidentifyTemplateName - * A fully-qualified path representing organization_location_deidentify_template resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationDeidentifyTemplateName(organizationLocationDeidentifyTemplateName: string) { - return this.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match(organizationLocationDeidentifyTemplateName).organization; - } - - /** - * Parse the location from OrganizationLocationDeidentifyTemplate resource. - * - * @param {string} organizationLocationDeidentifyTemplateName - * A fully-qualified path representing organization_location_deidentify_template resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationDeidentifyTemplateName(organizationLocationDeidentifyTemplateName: string) { - return this.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match(organizationLocationDeidentifyTemplateName).location; - } - - /** - * Parse the deidentify_template from OrganizationLocationDeidentifyTemplate resource. - * - * @param {string} organizationLocationDeidentifyTemplateName - * A fully-qualified path representing organization_location_deidentify_template resource. - * @returns {string} A string representing the deidentify_template. - */ - matchDeidentifyTemplateFromOrganizationLocationDeidentifyTemplateName(organizationLocationDeidentifyTemplateName: string) { - return this.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match(organizationLocationDeidentifyTemplateName).deidentify_template; - } - - /** - * Return a fully-qualified organizationLocationInspectTemplate resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} inspect_template - * @returns {string} Resource name string. - */ - organizationLocationInspectTemplatePath(organization:string,location:string,inspectTemplate:string) { - return this.pathTemplates.organizationLocationInspectTemplatePathTemplate.render({ - organization: organization, - location: location, - inspect_template: inspectTemplate, - }); - } - - /** - * Parse the organization from OrganizationLocationInspectTemplate resource. - * - * @param {string} organizationLocationInspectTemplateName - * A fully-qualified path representing organization_location_inspect_template resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationInspectTemplateName(organizationLocationInspectTemplateName: string) { - return this.pathTemplates.organizationLocationInspectTemplatePathTemplate.match(organizationLocationInspectTemplateName).organization; - } - - /** - * Parse the location from OrganizationLocationInspectTemplate resource. - * - * @param {string} organizationLocationInspectTemplateName - * A fully-qualified path representing organization_location_inspect_template resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationInspectTemplateName(organizationLocationInspectTemplateName: string) { - return this.pathTemplates.organizationLocationInspectTemplatePathTemplate.match(organizationLocationInspectTemplateName).location; - } - - /** - * Parse the inspect_template from OrganizationLocationInspectTemplate resource. - * - * @param {string} organizationLocationInspectTemplateName - * A fully-qualified path representing organization_location_inspect_template resource. - * @returns {string} A string representing the inspect_template. - */ - matchInspectTemplateFromOrganizationLocationInspectTemplateName(organizationLocationInspectTemplateName: string) { - return this.pathTemplates.organizationLocationInspectTemplatePathTemplate.match(organizationLocationInspectTemplateName).inspect_template; - } - - /** - * Return a fully-qualified organizationLocationStoredInfoType resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} stored_info_type - * @returns {string} Resource name string. - */ - organizationLocationStoredInfoTypePath(organization:string,location:string,storedInfoType:string) { - return this.pathTemplates.organizationLocationStoredInfoTypePathTemplate.render({ - organization: organization, - location: location, - stored_info_type: storedInfoType, - }); - } - - /** - * Parse the organization from OrganizationLocationStoredInfoType resource. - * - * @param {string} organizationLocationStoredInfoTypeName - * A fully-qualified path representing organization_location_stored_info_type resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationStoredInfoTypeName(organizationLocationStoredInfoTypeName: string) { - return this.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match(organizationLocationStoredInfoTypeName).organization; - } - - /** - * Parse the location from OrganizationLocationStoredInfoType resource. - * - * @param {string} organizationLocationStoredInfoTypeName - * A fully-qualified path representing organization_location_stored_info_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationStoredInfoTypeName(organizationLocationStoredInfoTypeName: string) { - return this.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match(organizationLocationStoredInfoTypeName).location; - } - - /** - * Parse the stored_info_type from OrganizationLocationStoredInfoType resource. - * - * @param {string} organizationLocationStoredInfoTypeName - * A fully-qualified path representing organization_location_stored_info_type resource. - * @returns {string} A string representing the stored_info_type. - */ - matchStoredInfoTypeFromOrganizationLocationStoredInfoTypeName(organizationLocationStoredInfoTypeName: string) { - return this.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match(organizationLocationStoredInfoTypeName).stored_info_type; - } - - /** - * Return a fully-qualified organizationStoredInfoType resource name string. - * - * @param {string} organization - * @param {string} stored_info_type - * @returns {string} Resource name string. - */ - organizationStoredInfoTypePath(organization:string,storedInfoType:string) { - return this.pathTemplates.organizationStoredInfoTypePathTemplate.render({ - organization: organization, - stored_info_type: storedInfoType, - }); - } - - /** - * Parse the organization from OrganizationStoredInfoType resource. - * - * @param {string} organizationStoredInfoTypeName - * A fully-qualified path representing organization_stored_info_type resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationStoredInfoTypeName(organizationStoredInfoTypeName: string) { - return this.pathTemplates.organizationStoredInfoTypePathTemplate.match(organizationStoredInfoTypeName).organization; - } - - /** - * Parse the stored_info_type from OrganizationStoredInfoType resource. - * - * @param {string} organizationStoredInfoTypeName - * A fully-qualified path representing organization_stored_info_type resource. - * @returns {string} A string representing the stored_info_type. - */ - matchStoredInfoTypeFromOrganizationStoredInfoTypeName(organizationStoredInfoTypeName: string) { - return this.pathTemplates.organizationStoredInfoTypePathTemplate.match(organizationStoredInfoTypeName).stored_info_type; - } - - /** - * 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 projectDeidentifyTemplate resource name string. - * - * @param {string} project - * @param {string} deidentify_template - * @returns {string} Resource name string. - */ - projectDeidentifyTemplatePath(project:string,deidentifyTemplate:string) { - return this.pathTemplates.projectDeidentifyTemplatePathTemplate.render({ - project: project, - deidentify_template: deidentifyTemplate, - }); - } - - /** - * Parse the project from ProjectDeidentifyTemplate resource. - * - * @param {string} projectDeidentifyTemplateName - * A fully-qualified path representing project_deidentify_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectDeidentifyTemplateName(projectDeidentifyTemplateName: string) { - return this.pathTemplates.projectDeidentifyTemplatePathTemplate.match(projectDeidentifyTemplateName).project; - } - - /** - * Parse the deidentify_template from ProjectDeidentifyTemplate resource. - * - * @param {string} projectDeidentifyTemplateName - * A fully-qualified path representing project_deidentify_template resource. - * @returns {string} A string representing the deidentify_template. - */ - matchDeidentifyTemplateFromProjectDeidentifyTemplateName(projectDeidentifyTemplateName: string) { - return this.pathTemplates.projectDeidentifyTemplatePathTemplate.match(projectDeidentifyTemplateName).deidentify_template; - } - - /** - * Return a fully-qualified projectDlpContent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectDlpContentPath(project:string) { - return this.pathTemplates.projectDlpContentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectDlpContent resource. - * - * @param {string} projectDlpContentName - * A fully-qualified path representing project_dlpContent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectDlpContentName(projectDlpContentName: string) { - return this.pathTemplates.projectDlpContentPathTemplate.match(projectDlpContentName).project; - } - - /** - * Return a fully-qualified projectDlpJob resource name string. - * - * @param {string} project - * @param {string} dlp_job - * @returns {string} Resource name string. - */ - projectDlpJobPath(project:string,dlpJob:string) { - return this.pathTemplates.projectDlpJobPathTemplate.render({ - project: project, - dlp_job: dlpJob, - }); - } - - /** - * Parse the project from ProjectDlpJob resource. - * - * @param {string} projectDlpJobName - * A fully-qualified path representing project_dlp_job resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectDlpJobName(projectDlpJobName: string) { - return this.pathTemplates.projectDlpJobPathTemplate.match(projectDlpJobName).project; - } - - /** - * Parse the dlp_job from ProjectDlpJob resource. - * - * @param {string} projectDlpJobName - * A fully-qualified path representing project_dlp_job resource. - * @returns {string} A string representing the dlp_job. - */ - matchDlpJobFromProjectDlpJobName(projectDlpJobName: string) { - return this.pathTemplates.projectDlpJobPathTemplate.match(projectDlpJobName).dlp_job; - } - - /** - * Return a fully-qualified projectInspectTemplate resource name string. - * - * @param {string} project - * @param {string} inspect_template - * @returns {string} Resource name string. - */ - projectInspectTemplatePath(project:string,inspectTemplate:string) { - return this.pathTemplates.projectInspectTemplatePathTemplate.render({ - project: project, - inspect_template: inspectTemplate, - }); - } - - /** - * Parse the project from ProjectInspectTemplate resource. - * - * @param {string} projectInspectTemplateName - * A fully-qualified path representing project_inspect_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectInspectTemplateName(projectInspectTemplateName: string) { - return this.pathTemplates.projectInspectTemplatePathTemplate.match(projectInspectTemplateName).project; - } - - /** - * Parse the inspect_template from ProjectInspectTemplate resource. - * - * @param {string} projectInspectTemplateName - * A fully-qualified path representing project_inspect_template resource. - * @returns {string} A string representing the inspect_template. - */ - matchInspectTemplateFromProjectInspectTemplateName(projectInspectTemplateName: string) { - return this.pathTemplates.projectInspectTemplatePathTemplate.match(projectInspectTemplateName).inspect_template; - } - - /** - * Return a fully-qualified projectJobTrigger resource name string. - * - * @param {string} project - * @param {string} job_trigger - * @returns {string} Resource name string. - */ - projectJobTriggerPath(project:string,jobTrigger:string) { - return this.pathTemplates.projectJobTriggerPathTemplate.render({ - project: project, - job_trigger: jobTrigger, - }); - } - - /** - * Parse the project from ProjectJobTrigger resource. - * - * @param {string} projectJobTriggerName - * A fully-qualified path representing project_job_trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectJobTriggerName(projectJobTriggerName: string) { - return this.pathTemplates.projectJobTriggerPathTemplate.match(projectJobTriggerName).project; - } - - /** - * Parse the job_trigger from ProjectJobTrigger resource. - * - * @param {string} projectJobTriggerName - * A fully-qualified path representing project_job_trigger resource. - * @returns {string} A string representing the job_trigger. - */ - matchJobTriggerFromProjectJobTriggerName(projectJobTriggerName: string) { - return this.pathTemplates.projectJobTriggerPathTemplate.match(projectJobTriggerName).job_trigger; - } - - /** - * Return a fully-qualified projectLocationDeidentifyTemplate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} deidentify_template - * @returns {string} Resource name string. - */ - projectLocationDeidentifyTemplatePath(project:string,location:string,deidentifyTemplate:string) { - return this.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.render({ - project: project, - location: location, - deidentify_template: deidentifyTemplate, - }); - } - - /** - * Parse the project from ProjectLocationDeidentifyTemplate resource. - * - * @param {string} projectLocationDeidentifyTemplateName - * A fully-qualified path representing project_location_deidentify_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationDeidentifyTemplateName(projectLocationDeidentifyTemplateName: string) { - return this.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match(projectLocationDeidentifyTemplateName).project; - } - - /** - * Parse the location from ProjectLocationDeidentifyTemplate resource. - * - * @param {string} projectLocationDeidentifyTemplateName - * A fully-qualified path representing project_location_deidentify_template resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationDeidentifyTemplateName(projectLocationDeidentifyTemplateName: string) { - return this.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match(projectLocationDeidentifyTemplateName).location; - } - - /** - * Parse the deidentify_template from ProjectLocationDeidentifyTemplate resource. - * - * @param {string} projectLocationDeidentifyTemplateName - * A fully-qualified path representing project_location_deidentify_template resource. - * @returns {string} A string representing the deidentify_template. - */ - matchDeidentifyTemplateFromProjectLocationDeidentifyTemplateName(projectLocationDeidentifyTemplateName: string) { - return this.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match(projectLocationDeidentifyTemplateName).deidentify_template; - } - - /** - * Return a fully-qualified projectLocationDlpJob resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} dlp_job - * @returns {string} Resource name string. - */ - projectLocationDlpJobPath(project:string,location:string,dlpJob:string) { - return this.pathTemplates.projectLocationDlpJobPathTemplate.render({ - project: project, - location: location, - dlp_job: dlpJob, - }); - } - - /** - * Parse the project from ProjectLocationDlpJob resource. - * - * @param {string} projectLocationDlpJobName - * A fully-qualified path representing project_location_dlp_job resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationDlpJobName(projectLocationDlpJobName: string) { - return this.pathTemplates.projectLocationDlpJobPathTemplate.match(projectLocationDlpJobName).project; - } - - /** - * Parse the location from ProjectLocationDlpJob resource. - * - * @param {string} projectLocationDlpJobName - * A fully-qualified path representing project_location_dlp_job resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationDlpJobName(projectLocationDlpJobName: string) { - return this.pathTemplates.projectLocationDlpJobPathTemplate.match(projectLocationDlpJobName).location; - } - - /** - * Parse the dlp_job from ProjectLocationDlpJob resource. - * - * @param {string} projectLocationDlpJobName - * A fully-qualified path representing project_location_dlp_job resource. - * @returns {string} A string representing the dlp_job. - */ - matchDlpJobFromProjectLocationDlpJobName(projectLocationDlpJobName: string) { - return this.pathTemplates.projectLocationDlpJobPathTemplate.match(projectLocationDlpJobName).dlp_job; - } - - /** - * Return a fully-qualified projectLocationInspectTemplate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} inspect_template - * @returns {string} Resource name string. - */ - projectLocationInspectTemplatePath(project:string,location:string,inspectTemplate:string) { - return this.pathTemplates.projectLocationInspectTemplatePathTemplate.render({ - project: project, - location: location, - inspect_template: inspectTemplate, - }); - } - - /** - * Parse the project from ProjectLocationInspectTemplate resource. - * - * @param {string} projectLocationInspectTemplateName - * A fully-qualified path representing project_location_inspect_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationInspectTemplateName(projectLocationInspectTemplateName: string) { - return this.pathTemplates.projectLocationInspectTemplatePathTemplate.match(projectLocationInspectTemplateName).project; - } - - /** - * Parse the location from ProjectLocationInspectTemplate resource. - * - * @param {string} projectLocationInspectTemplateName - * A fully-qualified path representing project_location_inspect_template resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationInspectTemplateName(projectLocationInspectTemplateName: string) { - return this.pathTemplates.projectLocationInspectTemplatePathTemplate.match(projectLocationInspectTemplateName).location; - } - - /** - * Parse the inspect_template from ProjectLocationInspectTemplate resource. - * - * @param {string} projectLocationInspectTemplateName - * A fully-qualified path representing project_location_inspect_template resource. - * @returns {string} A string representing the inspect_template. - */ - matchInspectTemplateFromProjectLocationInspectTemplateName(projectLocationInspectTemplateName: string) { - return this.pathTemplates.projectLocationInspectTemplatePathTemplate.match(projectLocationInspectTemplateName).inspect_template; - } - - /** - * Return a fully-qualified projectLocationJobTrigger resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} job_trigger - * @returns {string} Resource name string. - */ - projectLocationJobTriggerPath(project:string,location:string,jobTrigger:string) { - return this.pathTemplates.projectLocationJobTriggerPathTemplate.render({ - project: project, - location: location, - job_trigger: jobTrigger, - }); - } - - /** - * Parse the project from ProjectLocationJobTrigger resource. - * - * @param {string} projectLocationJobTriggerName - * A fully-qualified path representing project_location_job_trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationJobTriggerName(projectLocationJobTriggerName: string) { - return this.pathTemplates.projectLocationJobTriggerPathTemplate.match(projectLocationJobTriggerName).project; - } - - /** - * Parse the location from ProjectLocationJobTrigger resource. - * - * @param {string} projectLocationJobTriggerName - * A fully-qualified path representing project_location_job_trigger resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationJobTriggerName(projectLocationJobTriggerName: string) { - return this.pathTemplates.projectLocationJobTriggerPathTemplate.match(projectLocationJobTriggerName).location; - } - - /** - * Parse the job_trigger from ProjectLocationJobTrigger resource. - * - * @param {string} projectLocationJobTriggerName - * A fully-qualified path representing project_location_job_trigger resource. - * @returns {string} A string representing the job_trigger. - */ - matchJobTriggerFromProjectLocationJobTriggerName(projectLocationJobTriggerName: string) { - return this.pathTemplates.projectLocationJobTriggerPathTemplate.match(projectLocationJobTriggerName).job_trigger; - } - - /** - * Return a fully-qualified projectLocationStoredInfoType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} stored_info_type - * @returns {string} Resource name string. - */ - projectLocationStoredInfoTypePath(project:string,location:string,storedInfoType:string) { - return this.pathTemplates.projectLocationStoredInfoTypePathTemplate.render({ - project: project, - location: location, - stored_info_type: storedInfoType, - }); - } - - /** - * Parse the project from ProjectLocationStoredInfoType resource. - * - * @param {string} projectLocationStoredInfoTypeName - * A fully-qualified path representing project_location_stored_info_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationStoredInfoTypeName(projectLocationStoredInfoTypeName: string) { - return this.pathTemplates.projectLocationStoredInfoTypePathTemplate.match(projectLocationStoredInfoTypeName).project; - } - - /** - * Parse the location from ProjectLocationStoredInfoType resource. - * - * @param {string} projectLocationStoredInfoTypeName - * A fully-qualified path representing project_location_stored_info_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationStoredInfoTypeName(projectLocationStoredInfoTypeName: string) { - return this.pathTemplates.projectLocationStoredInfoTypePathTemplate.match(projectLocationStoredInfoTypeName).location; - } - - /** - * Parse the stored_info_type from ProjectLocationStoredInfoType resource. - * - * @param {string} projectLocationStoredInfoTypeName - * A fully-qualified path representing project_location_stored_info_type resource. - * @returns {string} A string representing the stored_info_type. - */ - matchStoredInfoTypeFromProjectLocationStoredInfoTypeName(projectLocationStoredInfoTypeName: string) { - return this.pathTemplates.projectLocationStoredInfoTypePathTemplate.match(projectLocationStoredInfoTypeName).stored_info_type; - } - - /** - * Return a fully-qualified projectStoredInfoType resource name string. - * - * @param {string} project - * @param {string} stored_info_type - * @returns {string} Resource name string. - */ - projectStoredInfoTypePath(project:string,storedInfoType:string) { - return this.pathTemplates.projectStoredInfoTypePathTemplate.render({ - project: project, - stored_info_type: storedInfoType, - }); - } - - /** - * Parse the project from ProjectStoredInfoType resource. - * - * @param {string} projectStoredInfoTypeName - * A fully-qualified path representing project_stored_info_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectStoredInfoTypeName(projectStoredInfoTypeName: string) { - return this.pathTemplates.projectStoredInfoTypePathTemplate.match(projectStoredInfoTypeName).project; - } - - /** - * Parse the stored_info_type from ProjectStoredInfoType resource. - * - * @param {string} projectStoredInfoTypeName - * A fully-qualified path representing project_stored_info_type resource. - * @returns {string} A string representing the stored_info_type. - */ - matchStoredInfoTypeFromProjectStoredInfoTypeName(projectStoredInfoTypeName: string) { - return this.pathTemplates.projectStoredInfoTypePathTemplate.match(projectStoredInfoTypeName).stored_info_type; - } - - /** - * 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.dlpServiceStub && !this._terminated) { - return this.dlpServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client_config.json b/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client_config.json deleted file mode 100644 index bcdbe63fe82..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_client_config.json +++ /dev/null @@ -1,196 +0,0 @@ -{ - "interfaces": { - "google.privacy.dlp.v2.DlpService": { - "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": { - "InspectContent": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "RedactImage": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeidentifyContent": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ReidentifyContent": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListInfoTypes": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateInspectTemplate": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateInspectTemplate": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetInspectTemplate": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListInspectTemplates": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteInspectTemplate": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateDeidentifyTemplate": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDeidentifyTemplate": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDeidentifyTemplate": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListDeidentifyTemplates": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteDeidentifyTemplate": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateJobTrigger": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateJobTrigger": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "HybridInspectJobTrigger": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetJobTrigger": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListJobTriggers": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteJobTrigger": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ActivateJobTrigger": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateDlpJob": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDlpJobs": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetDlpJob": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteDlpJob": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CancelDlpJob": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateStoredInfoType": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateStoredInfoType": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetStoredInfoType": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListStoredInfoTypes": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteStoredInfoType": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "HybridInspectDlpJob": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "FinishDlpJob": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_proto_list.json b/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_proto_list.json deleted file mode 100644 index 482924bde32..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/src/v2/dlp_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/privacy/dlp/v2/dlp.proto", - "../../protos/google/privacy/dlp/v2/storage.proto" -] diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-privacy-dlp/v2/src/v2/gapic_metadata.json deleted file mode 100644 index e82d006d6e9..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,383 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.privacy.dlp.v2", - "libraryPackage": "@google-cloud/dlp", - "services": { - "DlpService": { - "clients": { - "grpc": { - "libraryClient": "DlpServiceClient", - "rpcs": { - "InspectContent": { - "methods": [ - "inspectContent" - ] - }, - "RedactImage": { - "methods": [ - "redactImage" - ] - }, - "DeidentifyContent": { - "methods": [ - "deidentifyContent" - ] - }, - "ReidentifyContent": { - "methods": [ - "reidentifyContent" - ] - }, - "ListInfoTypes": { - "methods": [ - "listInfoTypes" - ] - }, - "CreateInspectTemplate": { - "methods": [ - "createInspectTemplate" - ] - }, - "UpdateInspectTemplate": { - "methods": [ - "updateInspectTemplate" - ] - }, - "GetInspectTemplate": { - "methods": [ - "getInspectTemplate" - ] - }, - "DeleteInspectTemplate": { - "methods": [ - "deleteInspectTemplate" - ] - }, - "CreateDeidentifyTemplate": { - "methods": [ - "createDeidentifyTemplate" - ] - }, - "UpdateDeidentifyTemplate": { - "methods": [ - "updateDeidentifyTemplate" - ] - }, - "GetDeidentifyTemplate": { - "methods": [ - "getDeidentifyTemplate" - ] - }, - "DeleteDeidentifyTemplate": { - "methods": [ - "deleteDeidentifyTemplate" - ] - }, - "CreateJobTrigger": { - "methods": [ - "createJobTrigger" - ] - }, - "UpdateJobTrigger": { - "methods": [ - "updateJobTrigger" - ] - }, - "HybridInspectJobTrigger": { - "methods": [ - "hybridInspectJobTrigger" - ] - }, - "GetJobTrigger": { - "methods": [ - "getJobTrigger" - ] - }, - "DeleteJobTrigger": { - "methods": [ - "deleteJobTrigger" - ] - }, - "ActivateJobTrigger": { - "methods": [ - "activateJobTrigger" - ] - }, - "CreateDlpJob": { - "methods": [ - "createDlpJob" - ] - }, - "GetDlpJob": { - "methods": [ - "getDlpJob" - ] - }, - "DeleteDlpJob": { - "methods": [ - "deleteDlpJob" - ] - }, - "CancelDlpJob": { - "methods": [ - "cancelDlpJob" - ] - }, - "CreateStoredInfoType": { - "methods": [ - "createStoredInfoType" - ] - }, - "UpdateStoredInfoType": { - "methods": [ - "updateStoredInfoType" - ] - }, - "GetStoredInfoType": { - "methods": [ - "getStoredInfoType" - ] - }, - "DeleteStoredInfoType": { - "methods": [ - "deleteStoredInfoType" - ] - }, - "HybridInspectDlpJob": { - "methods": [ - "hybridInspectDlpJob" - ] - }, - "FinishDlpJob": { - "methods": [ - "finishDlpJob" - ] - }, - "ListInspectTemplates": { - "methods": [ - "listInspectTemplates", - "listInspectTemplatesStream", - "listInspectTemplatesAsync" - ] - }, - "ListDeidentifyTemplates": { - "methods": [ - "listDeidentifyTemplates", - "listDeidentifyTemplatesStream", - "listDeidentifyTemplatesAsync" - ] - }, - "ListJobTriggers": { - "methods": [ - "listJobTriggers", - "listJobTriggersStream", - "listJobTriggersAsync" - ] - }, - "ListDlpJobs": { - "methods": [ - "listDlpJobs", - "listDlpJobsStream", - "listDlpJobsAsync" - ] - }, - "ListStoredInfoTypes": { - "methods": [ - "listStoredInfoTypes", - "listStoredInfoTypesStream", - "listStoredInfoTypesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DlpServiceClient", - "rpcs": { - "InspectContent": { - "methods": [ - "inspectContent" - ] - }, - "RedactImage": { - "methods": [ - "redactImage" - ] - }, - "DeidentifyContent": { - "methods": [ - "deidentifyContent" - ] - }, - "ReidentifyContent": { - "methods": [ - "reidentifyContent" - ] - }, - "ListInfoTypes": { - "methods": [ - "listInfoTypes" - ] - }, - "CreateInspectTemplate": { - "methods": [ - "createInspectTemplate" - ] - }, - "UpdateInspectTemplate": { - "methods": [ - "updateInspectTemplate" - ] - }, - "GetInspectTemplate": { - "methods": [ - "getInspectTemplate" - ] - }, - "DeleteInspectTemplate": { - "methods": [ - "deleteInspectTemplate" - ] - }, - "CreateDeidentifyTemplate": { - "methods": [ - "createDeidentifyTemplate" - ] - }, - "UpdateDeidentifyTemplate": { - "methods": [ - "updateDeidentifyTemplate" - ] - }, - "GetDeidentifyTemplate": { - "methods": [ - "getDeidentifyTemplate" - ] - }, - "DeleteDeidentifyTemplate": { - "methods": [ - "deleteDeidentifyTemplate" - ] - }, - "CreateJobTrigger": { - "methods": [ - "createJobTrigger" - ] - }, - "UpdateJobTrigger": { - "methods": [ - "updateJobTrigger" - ] - }, - "HybridInspectJobTrigger": { - "methods": [ - "hybridInspectJobTrigger" - ] - }, - "GetJobTrigger": { - "methods": [ - "getJobTrigger" - ] - }, - "DeleteJobTrigger": { - "methods": [ - "deleteJobTrigger" - ] - }, - "ActivateJobTrigger": { - "methods": [ - "activateJobTrigger" - ] - }, - "CreateDlpJob": { - "methods": [ - "createDlpJob" - ] - }, - "GetDlpJob": { - "methods": [ - "getDlpJob" - ] - }, - "DeleteDlpJob": { - "methods": [ - "deleteDlpJob" - ] - }, - "CancelDlpJob": { - "methods": [ - "cancelDlpJob" - ] - }, - "CreateStoredInfoType": { - "methods": [ - "createStoredInfoType" - ] - }, - "UpdateStoredInfoType": { - "methods": [ - "updateStoredInfoType" - ] - }, - "GetStoredInfoType": { - "methods": [ - "getStoredInfoType" - ] - }, - "DeleteStoredInfoType": { - "methods": [ - "deleteStoredInfoType" - ] - }, - "HybridInspectDlpJob": { - "methods": [ - "hybridInspectDlpJob" - ] - }, - "FinishDlpJob": { - "methods": [ - "finishDlpJob" - ] - }, - "ListInspectTemplates": { - "methods": [ - "listInspectTemplates", - "listInspectTemplatesStream", - "listInspectTemplatesAsync" - ] - }, - "ListDeidentifyTemplates": { - "methods": [ - "listDeidentifyTemplates", - "listDeidentifyTemplatesStream", - "listDeidentifyTemplatesAsync" - ] - }, - "ListJobTriggers": { - "methods": [ - "listJobTriggers", - "listJobTriggersStream", - "listJobTriggersAsync" - ] - }, - "ListDlpJobs": { - "methods": [ - "listDlpJobs", - "listDlpJobsStream", - "listDlpJobsAsync" - ] - }, - "ListStoredInfoTypes": { - "methods": [ - "listStoredInfoTypes", - "listStoredInfoTypesStream", - "listStoredInfoTypesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-privacy-dlp/v2/src/v2/index.ts b/owl-bot-staging/google-privacy-dlp/v2/src/v2/index.ts deleted file mode 100644 index 431cf809518..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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 {DlpServiceClient} from './dlp_service_client'; diff --git a/owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index c845b99c767..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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 dlp = require('@google-cloud/dlp'); - -function main() { - const dlpServiceClient = new dlp.DlpServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-privacy-dlp/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 69f24de7ba9..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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 {DlpServiceClient} from '@google-cloud/dlp'; - -// check that the client class type name can be used -function doStuffWithDlpServiceClient(client: DlpServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const dlpServiceClient = new DlpServiceClient(); - doStuffWithDlpServiceClient(dlpServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-privacy-dlp/v2/system-test/install.ts b/owl-bot-staging/google-privacy-dlp/v2/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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-privacy-dlp/v2/test/gapic_dlp_service_v2.ts b/owl-bot-staging/google-privacy-dlp/v2/test/gapic_dlp_service_v2.ts deleted file mode 100644 index 701172c09cc..00000000000 --- a/owl-bot-staging/google-privacy-dlp/v2/test/gapic_dlp_service_v2.ts +++ /dev/null @@ -1,5531 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This 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 dlpserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, 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('v2.DlpServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dlpserviceModule.v2.DlpServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dlpserviceModule.v2.DlpServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dlpserviceModule.v2.DlpServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dlpserviceModule.v2.DlpServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dlpServiceStub, undefined); - await client.initialize(); - assert(client.dlpServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dlpServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dlpServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dlpserviceModule.v2.DlpServiceClient({ - 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 dlpserviceModule.v2.DlpServiceClient({ - 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('inspectContent', () => { - it('invokes inspectContent without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentResponse() - ); - client.innerApiCalls.inspectContent = stubSimpleCall(expectedResponse); - const [response] = await client.inspectContent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes inspectContent without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentResponse() - ); - client.innerApiCalls.inspectContent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.inspectContent( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectContentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes inspectContent with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.inspectContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.inspectContent(request), expectedError); - const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes inspectContent with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.inspectContent(request), expectedError); - }); - }); - - describe('redactImage', () => { - it('invokes redactImage without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageResponse() - ); - client.innerApiCalls.redactImage = stubSimpleCall(expectedResponse); - const [response] = await client.redactImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes redactImage without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageResponse() - ); - client.innerApiCalls.redactImage = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.redactImage( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IRedactImageResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes redactImage with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.redactImage = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.redactImage(request), expectedError); - const actualRequest = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes redactImage with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.redactImage(request), expectedError); - }); - }); - - describe('deidentifyContent', () => { - it('invokes deidentifyContent without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentResponse() - ); - client.innerApiCalls.deidentifyContent = stubSimpleCall(expectedResponse); - const [response] = await client.deidentifyContent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deidentifyContent without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentResponse() - ); - client.innerApiCalls.deidentifyContent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deidentifyContent( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyContentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deidentifyContent with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deidentifyContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deidentifyContent(request), expectedError); - const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deidentifyContent with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deidentifyContent(request), expectedError); - }); - }); - - describe('reidentifyContent', () => { - it('invokes reidentifyContent without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentResponse() - ); - client.innerApiCalls.reidentifyContent = stubSimpleCall(expectedResponse); - const [response] = await client.reidentifyContent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reidentifyContent without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentResponse() - ); - client.innerApiCalls.reidentifyContent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reidentifyContent( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IReidentifyContentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reidentifyContent with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reidentifyContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reidentifyContent(request), expectedError); - const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reidentifyContent with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.reidentifyContent(request), expectedError); - }); - }); - - describe('listInfoTypes', () => { - it('invokes listInfoTypes without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesResponse() - ); - client.innerApiCalls.listInfoTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listInfoTypes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInfoTypes without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesResponse() - ); - client.innerApiCalls.listInfoTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInfoTypes( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IListInfoTypesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInfoTypes with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInfoTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInfoTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInfoTypes with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listInfoTypes(request), expectedError); - }); - }); - - describe('createInspectTemplate', () => { - it('invokes createInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.createInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.createInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.createInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInspectTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createInspectTemplate(request), expectedError); - }); - }); - - describe('updateInspectTemplate', () => { - it('invokes updateInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.updateInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.updateInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.updateInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInspectTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateInspectTemplate(request), expectedError); - }); - }); - - describe('getInspectTemplate', () => { - it('invokes getInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.getInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.getInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.getInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInspectTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getInspectTemplate(request), expectedError); - }); - }); - - describe('deleteInspectTemplate', () => { - it('invokes deleteInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.deleteInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInspectTemplate( - 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.deleteInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteInspectTemplate(request), expectedError); - }); - }); - - describe('createDeidentifyTemplate', () => { - it('invokes createDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.createDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.createDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.createDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDeidentifyTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createDeidentifyTemplate(request), expectedError); - }); - }); - - describe('updateDeidentifyTemplate', () => { - it('invokes updateDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.updateDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDeidentifyTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateDeidentifyTemplate(request), expectedError); - }); - }); - - describe('getDeidentifyTemplate', () => { - it('invokes getDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.getDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.getDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.getDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDeidentifyTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDeidentifyTemplate(request), expectedError); - }); - }); - - describe('deleteDeidentifyTemplate', () => { - it('invokes deleteDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDeidentifyTemplate( - 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.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteDeidentifyTemplate(request), expectedError); - }); - }); - - describe('createJobTrigger', () => { - it('invokes createJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.createJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.createJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.createJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createJobTrigger(request), expectedError); - }); - }); - - describe('updateJobTrigger', () => { - it('invokes updateJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.updateJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.updateJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.updateJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateJobTrigger(request), expectedError); - }); - }); - - describe('hybridInspectJobTrigger', () => { - it('invokes hybridInspectJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectResponse() - ); - client.innerApiCalls.hybridInspectJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.hybridInspectJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes hybridInspectJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectResponse() - ); - client.innerApiCalls.hybridInspectJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.hybridInspectJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IHybridInspectResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes hybridInspectJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.hybridInspectJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.hybridInspectJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes hybridInspectJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.hybridInspectJobTrigger(request), expectedError); - }); - }); - - describe('getJobTrigger', () => { - it('invokes getJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.getJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.getJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.getJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getJobTrigger(request), expectedError); - }); - }); - - describe('deleteJobTrigger', () => { - it('invokes deleteJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.deleteJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteJobTrigger( - 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.deleteJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteJobTrigger(request), expectedError); - }); - }); - - describe('activateJobTrigger', () => { - it('invokes activateJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.activateJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.activateJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes activateJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.activateJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.activateJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes activateJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.activateJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.activateJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes activateJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.activateJobTrigger(request), expectedError); - }); - }); - - describe('createDlpJob', () => { - it('invokes createDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.createDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.createDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.createDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDlpJob( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createDlpJob(request), expectedError); - }); - }); - - describe('getDlpJob', () => { - it('invokes getDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.getDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.getDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.getDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDlpJob( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDlpJob(request), expectedError); - }); - }); - - describe('deleteDlpJob', () => { - it('invokes deleteDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDlpJob( - 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.deleteDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteDlpJob(request), expectedError); - }); - }); - - describe('cancelDlpJob', () => { - it('invokes cancelDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancelDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.cancelDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancelDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelDlpJob( - 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.cancelDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelDlpJob(request), expectedError); - }); - }); - - describe('createStoredInfoType', () => { - it('invokes createStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.createStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.createStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.createStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createStoredInfoType( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createStoredInfoType(request), expectedError); - }); - }); - - describe('updateStoredInfoType', () => { - it('invokes updateStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.updateStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.updateStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.updateStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateStoredInfoType( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateStoredInfoType(request), expectedError); - }); - }); - - describe('getStoredInfoType', () => { - it('invokes getStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.getStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.getStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.getStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getStoredInfoType( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getStoredInfoType(request), expectedError); - }); - }); - - describe('deleteStoredInfoType', () => { - it('invokes deleteStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.deleteStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteStoredInfoType( - 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.deleteStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteStoredInfoType(request), expectedError); - }); - }); - - describe('hybridInspectDlpJob', () => { - it('invokes hybridInspectDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectResponse() - ); - client.innerApiCalls.hybridInspectDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.hybridInspectDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes hybridInspectDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectResponse() - ); - client.innerApiCalls.hybridInspectDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.hybridInspectDlpJob( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IHybridInspectResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes hybridInspectDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.hybridInspectDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.hybridInspectDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.hybridInspectDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes hybridInspectDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.HybridInspectDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.HybridInspectDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.hybridInspectDlpJob(request), expectedError); - }); - }); - - describe('finishDlpJob', () => { - it('invokes finishDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.FinishDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.FinishDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.finishDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.finishDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.finishDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finishDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes finishDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.FinishDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.FinishDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.finishDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.finishDlpJob( - 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.finishDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finishDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes finishDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.FinishDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.FinishDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.finishDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.finishDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.finishDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finishDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes finishDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.FinishDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.FinishDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.finishDlpJob(request), expectedError); - }); - }); - - describe('listInspectTemplates', () => { - it('invokes listInspectTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.innerApiCalls.listInspectTemplates = stubSimpleCall(expectedResponse); - const [response] = await client.listInspectTemplates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInspectTemplates without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.innerApiCalls.listInspectTemplates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInspectTemplates( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInspectTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInspectTemplates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInspectTemplates(request), expectedError); - const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInspectTemplatesStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.descriptors.page.listInspectTemplates.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInspectTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.InspectTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.InspectTemplate) => { - 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.listInspectTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInspectTemplates, request)); - assert( - (client.descriptors.page.listInspectTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listInspectTemplatesStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listInspectTemplates.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInspectTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.InspectTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.InspectTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInspectTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInspectTemplates, request)); - assert( - (client.descriptors.page.listInspectTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInspectTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.descriptors.page.listInspectTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IInspectTemplate[] = []; - const iterable = client.listInspectTemplatesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInspectTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listInspectTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInspectTemplatesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IInspectTemplate[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listDeidentifyTemplates', () => { - it('invokes listDeidentifyTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.innerApiCalls.listDeidentifyTemplates = stubSimpleCall(expectedResponse); - const [response] = await client.listDeidentifyTemplates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeidentifyTemplates without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.innerApiCalls.listDeidentifyTemplates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDeidentifyTemplates( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeidentifyTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDeidentifyTemplates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDeidentifyTemplates(request), expectedError); - const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeidentifyTemplatesStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.descriptors.page.listDeidentifyTemplates.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDeidentifyTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DeidentifyTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DeidentifyTemplate) => { - 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.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDeidentifyTemplates, request)); - assert( - (client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDeidentifyTemplatesStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDeidentifyTemplates.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDeidentifyTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DeidentifyTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DeidentifyTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDeidentifyTemplates, request)); - assert( - (client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDeidentifyTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.descriptors.page.listDeidentifyTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IDeidentifyTemplate[] = []; - const iterable = client.listDeidentifyTemplatesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDeidentifyTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDeidentifyTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDeidentifyTemplatesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IDeidentifyTemplate[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listJobTriggers', () => { - it('invokes listJobTriggers without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.innerApiCalls.listJobTriggers = stubSimpleCall(expectedResponse); - const [response] = await client.listJobTriggers(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobTriggers without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.innerApiCalls.listJobTriggers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobTriggers( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobTriggers with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobTriggers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobTriggers(request), expectedError); - const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobTriggersStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.descriptors.page.listJobTriggers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.JobTrigger[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.JobTrigger) => { - 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.listJobTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobTriggers, request)); - assert( - (client.descriptors.page.listJobTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listJobTriggersStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobTriggers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.JobTrigger[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.JobTrigger) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobTriggers, request)); - assert( - (client.descriptors.page.listJobTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobTriggers without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.descriptors.page.listJobTriggers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IJobTrigger[] = []; - const iterable = client.listJobTriggersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobTriggers with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobTriggers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobTriggersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IJobTrigger[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listDlpJobs', () => { - it('invokes listDlpJobs without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.innerApiCalls.listDlpJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listDlpJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDlpJobs without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.innerApiCalls.listDlpJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDlpJobs( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDlpJobs with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDlpJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDlpJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDlpJobsStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.descriptors.page.listDlpJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDlpJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DlpJob[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DlpJob) => { - 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.listDlpJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDlpJobs, request)); - assert( - (client.descriptors.page.listDlpJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDlpJobsStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDlpJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDlpJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DlpJob[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DlpJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDlpJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDlpJobs, request)); - assert( - (client.descriptors.page.listDlpJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDlpJobs without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.descriptors.page.listDlpJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IDlpJob[] = []; - const iterable = client.listDlpJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDlpJobs with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDlpJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDlpJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IDlpJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listStoredInfoTypes', () => { - it('invokes listStoredInfoTypes without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.innerApiCalls.listStoredInfoTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listStoredInfoTypes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStoredInfoTypes without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.innerApiCalls.listStoredInfoTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listStoredInfoTypes( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStoredInfoTypes with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listStoredInfoTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listStoredInfoTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStoredInfoTypesStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.descriptors.page.listStoredInfoTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listStoredInfoTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.StoredInfoType[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.StoredInfoType) => { - 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.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStoredInfoTypes, request)); - assert( - (client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listStoredInfoTypesStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listStoredInfoTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listStoredInfoTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.StoredInfoType[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.StoredInfoType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStoredInfoTypes, request)); - assert( - (client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStoredInfoTypes without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.descriptors.page.listStoredInfoTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IStoredInfoType[] = []; - const iterable = client.listStoredInfoTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStoredInfoTypes with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listStoredInfoTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listStoredInfoTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IStoredInfoType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStoredInfoTypes.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 dlpserviceModule.v2.DlpServiceClient({ - 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 dlpserviceModule.v2.DlpServiceClient({ - 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 dlpserviceModule.v2.DlpServiceClient({ - 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 dlpserviceModule.v2.DlpServiceClient({ - 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 dlpserviceModule.v2.DlpServiceClient({ - 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('finding', () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - finding: "findingValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.findingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.findingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('findingPath', () => { - const result = client.findingPath("projectValue", "locationValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFindingName', () => { - const result = client.matchProjectFromFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFindingName', () => { - const result = client.matchLocationFromFindingName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFindingName', () => { - const result = client.matchFindingFromFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - 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('organizationDeidentifyTemplate', () => { - const fakePath = "/rendered/path/organizationDeidentifyTemplate"; - const expectedParameters = { - organization: "organizationValue", - deidentify_template: "deidentifyTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationDeidentifyTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationDeidentifyTemplatePath', () => { - const result = client.organizationDeidentifyTemplatePath("organizationValue", "deidentifyTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationDeidentifyTemplateName', () => { - const result = client.matchOrganizationFromOrganizationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName', () => { - const result = client.matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "deidentifyTemplateValue"); - assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationInspectTemplate', () => { - const fakePath = "/rendered/path/organizationInspectTemplate"; - const expectedParameters = { - organization: "organizationValue", - inspect_template: "inspectTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationInspectTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationInspectTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationInspectTemplatePath', () => { - const result = client.organizationInspectTemplatePath("organizationValue", "inspectTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationInspectTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationInspectTemplateName', () => { - const result = client.matchOrganizationFromOrganizationInspectTemplateName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInspectTemplateFromOrganizationInspectTemplateName', () => { - const result = client.matchInspectTemplateFromOrganizationInspectTemplateName(fakePath); - assert.strictEqual(result, "inspectTemplateValue"); - assert((client.pathTemplates.organizationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationDeidentifyTemplate', () => { - const fakePath = "/rendered/path/organizationLocationDeidentifyTemplate"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - deidentify_template: "deidentifyTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationDeidentifyTemplatePath', () => { - const result = client.organizationLocationDeidentifyTemplatePath("organizationValue", "locationValue", "deidentifyTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationDeidentifyTemplateName', () => { - const result = client.matchOrganizationFromOrganizationLocationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationDeidentifyTemplateName', () => { - const result = client.matchLocationFromOrganizationLocationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeidentifyTemplateFromOrganizationLocationDeidentifyTemplateName', () => { - const result = client.matchDeidentifyTemplateFromOrganizationLocationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "deidentifyTemplateValue"); - assert((client.pathTemplates.organizationLocationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationInspectTemplate', () => { - const fakePath = "/rendered/path/organizationLocationInspectTemplate"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - inspect_template: "inspectTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationInspectTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationInspectTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationInspectTemplatePath', () => { - const result = client.organizationLocationInspectTemplatePath("organizationValue", "locationValue", "inspectTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationInspectTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationInspectTemplateName', () => { - const result = client.matchOrganizationFromOrganizationLocationInspectTemplateName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationInspectTemplateName', () => { - const result = client.matchLocationFromOrganizationLocationInspectTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInspectTemplateFromOrganizationLocationInspectTemplateName', () => { - const result = client.matchInspectTemplateFromOrganizationLocationInspectTemplateName(fakePath); - assert.strictEqual(result, "inspectTemplateValue"); - assert((client.pathTemplates.organizationLocationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationStoredInfoType', () => { - const fakePath = "/rendered/path/organizationLocationStoredInfoType"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - stored_info_type: "storedInfoTypeValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationStoredInfoTypePath', () => { - const result = client.organizationLocationStoredInfoTypePath("organizationValue", "locationValue", "storedInfoTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationStoredInfoTypeName', () => { - const result = client.matchOrganizationFromOrganizationLocationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationStoredInfoTypeName', () => { - const result = client.matchLocationFromOrganizationLocationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStoredInfoTypeFromOrganizationLocationStoredInfoTypeName', () => { - const result = client.matchStoredInfoTypeFromOrganizationLocationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "storedInfoTypeValue"); - assert((client.pathTemplates.organizationLocationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationStoredInfoType', () => { - const fakePath = "/rendered/path/organizationStoredInfoType"; - const expectedParameters = { - organization: "organizationValue", - stored_info_type: "storedInfoTypeValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationStoredInfoTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationStoredInfoTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationStoredInfoTypePath', () => { - const result = client.organizationStoredInfoTypePath("organizationValue", "storedInfoTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationStoredInfoTypeName', () => { - const result = client.matchOrganizationFromOrganizationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStoredInfoTypeFromOrganizationStoredInfoTypeName', () => { - const result = client.matchStoredInfoTypeFromOrganizationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "storedInfoTypeValue"); - assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - 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('projectDeidentifyTemplate', () => { - const fakePath = "/rendered/path/projectDeidentifyTemplate"; - const expectedParameters = { - project: "projectValue", - deidentify_template: "deidentifyTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectDeidentifyTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectDeidentifyTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectDeidentifyTemplatePath', () => { - const result = client.projectDeidentifyTemplatePath("projectValue", "deidentifyTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectDeidentifyTemplateName', () => { - const result = client.matchProjectFromProjectDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeidentifyTemplateFromProjectDeidentifyTemplateName', () => { - const result = client.matchDeidentifyTemplateFromProjectDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "deidentifyTemplateValue"); - assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectDlpContent', () => { - const fakePath = "/rendered/path/projectDlpContent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectDlpContentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectDlpContentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectDlpContentPath', () => { - const result = client.projectDlpContentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectDlpContentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectDlpContentName', () => { - const result = client.matchProjectFromProjectDlpContentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectDlpContentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectDlpJob', () => { - const fakePath = "/rendered/path/projectDlpJob"; - const expectedParameters = { - project: "projectValue", - dlp_job: "dlpJobValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectDlpJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectDlpJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectDlpJobPath', () => { - const result = client.projectDlpJobPath("projectValue", "dlpJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectDlpJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectDlpJobName', () => { - const result = client.matchProjectFromProjectDlpJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectDlpJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDlpJobFromProjectDlpJobName', () => { - const result = client.matchDlpJobFromProjectDlpJobName(fakePath); - assert.strictEqual(result, "dlpJobValue"); - assert((client.pathTemplates.projectDlpJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectInspectTemplate', () => { - const fakePath = "/rendered/path/projectInspectTemplate"; - const expectedParameters = { - project: "projectValue", - inspect_template: "inspectTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectInspectTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectInspectTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectInspectTemplatePath', () => { - const result = client.projectInspectTemplatePath("projectValue", "inspectTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectInspectTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectInspectTemplateName', () => { - const result = client.matchProjectFromProjectInspectTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInspectTemplateFromProjectInspectTemplateName', () => { - const result = client.matchInspectTemplateFromProjectInspectTemplateName(fakePath); - assert.strictEqual(result, "inspectTemplateValue"); - assert((client.pathTemplates.projectInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectJobTrigger', () => { - const fakePath = "/rendered/path/projectJobTrigger"; - const expectedParameters = { - project: "projectValue", - job_trigger: "jobTriggerValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectJobTriggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectJobTriggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectJobTriggerPath', () => { - const result = client.projectJobTriggerPath("projectValue", "jobTriggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectJobTriggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectJobTriggerName', () => { - const result = client.matchProjectFromProjectJobTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectJobTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchJobTriggerFromProjectJobTriggerName', () => { - const result = client.matchJobTriggerFromProjectJobTriggerName(fakePath); - assert.strictEqual(result, "jobTriggerValue"); - assert((client.pathTemplates.projectJobTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationDeidentifyTemplate', () => { - const fakePath = "/rendered/path/projectLocationDeidentifyTemplate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - deidentify_template: "deidentifyTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationDeidentifyTemplatePath', () => { - const result = client.projectLocationDeidentifyTemplatePath("projectValue", "locationValue", "deidentifyTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationDeidentifyTemplateName', () => { - const result = client.matchProjectFromProjectLocationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationDeidentifyTemplateName', () => { - const result = client.matchLocationFromProjectLocationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeidentifyTemplateFromProjectLocationDeidentifyTemplateName', () => { - const result = client.matchDeidentifyTemplateFromProjectLocationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "deidentifyTemplateValue"); - assert((client.pathTemplates.projectLocationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationDlpJob', () => { - const fakePath = "/rendered/path/projectLocationDlpJob"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dlp_job: "dlpJobValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationDlpJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationDlpJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationDlpJobPath', () => { - const result = client.projectLocationDlpJobPath("projectValue", "locationValue", "dlpJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationDlpJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationDlpJobName', () => { - const result = client.matchProjectFromProjectLocationDlpJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationDlpJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationDlpJobName', () => { - const result = client.matchLocationFromProjectLocationDlpJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationDlpJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDlpJobFromProjectLocationDlpJobName', () => { - const result = client.matchDlpJobFromProjectLocationDlpJobName(fakePath); - assert.strictEqual(result, "dlpJobValue"); - assert((client.pathTemplates.projectLocationDlpJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationInspectTemplate', () => { - const fakePath = "/rendered/path/projectLocationInspectTemplate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - inspect_template: "inspectTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationInspectTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationInspectTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationInspectTemplatePath', () => { - const result = client.projectLocationInspectTemplatePath("projectValue", "locationValue", "inspectTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationInspectTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationInspectTemplateName', () => { - const result = client.matchProjectFromProjectLocationInspectTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationInspectTemplateName', () => { - const result = client.matchLocationFromProjectLocationInspectTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInspectTemplateFromProjectLocationInspectTemplateName', () => { - const result = client.matchInspectTemplateFromProjectLocationInspectTemplateName(fakePath); - assert.strictEqual(result, "inspectTemplateValue"); - assert((client.pathTemplates.projectLocationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationJobTrigger', () => { - const fakePath = "/rendered/path/projectLocationJobTrigger"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - job_trigger: "jobTriggerValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationJobTriggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationJobTriggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationJobTriggerPath', () => { - const result = client.projectLocationJobTriggerPath("projectValue", "locationValue", "jobTriggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationJobTriggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationJobTriggerName', () => { - const result = client.matchProjectFromProjectLocationJobTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationJobTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationJobTriggerName', () => { - const result = client.matchLocationFromProjectLocationJobTriggerName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationJobTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchJobTriggerFromProjectLocationJobTriggerName', () => { - const result = client.matchJobTriggerFromProjectLocationJobTriggerName(fakePath); - assert.strictEqual(result, "jobTriggerValue"); - assert((client.pathTemplates.projectLocationJobTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationStoredInfoType', () => { - const fakePath = "/rendered/path/projectLocationStoredInfoType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - stored_info_type: "storedInfoTypeValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationStoredInfoTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationStoredInfoTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationStoredInfoTypePath', () => { - const result = client.projectLocationStoredInfoTypePath("projectValue", "locationValue", "storedInfoTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationStoredInfoTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationStoredInfoTypeName', () => { - const result = client.matchProjectFromProjectLocationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationStoredInfoTypeName', () => { - const result = client.matchLocationFromProjectLocationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStoredInfoTypeFromProjectLocationStoredInfoTypeName', () => { - const result = client.matchStoredInfoTypeFromProjectLocationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "storedInfoTypeValue"); - assert((client.pathTemplates.projectLocationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectStoredInfoType', () => { - const fakePath = "/rendered/path/projectStoredInfoType"; - const expectedParameters = { - project: "projectValue", - stored_info_type: "storedInfoTypeValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectStoredInfoTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectStoredInfoTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectStoredInfoTypePath', () => { - const result = client.projectStoredInfoTypePath("projectValue", "storedInfoTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectStoredInfoTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectStoredInfoTypeName', () => { - const result = client.matchProjectFromProjectStoredInfoTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStoredInfoTypeFromProjectStoredInfoTypeName', () => { - const result = client.matchStoredInfoTypeFromProjectStoredInfoTypeName(fakePath); - assert.strictEqual(result, "storedInfoTypeValue"); - assert((client.pathTemplates.projectStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-privacy-dlp/v2/tsconfig.json b/owl-bot-staging/google-privacy-dlp/v2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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-privacy-dlp/v2/webpack.config.js b/owl-bot-staging/google-privacy-dlp/v2/webpack.config.js deleted file mode 100644 index 4eaa3715661..00000000000 --- a/owl-bot-staging/google-privacy-dlp/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: 'DlpService', - filename: './dlp-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-vmwareengine/README.md b/packages/google-cloud-vmwareengine/README.md index 3aae240a953..2279504c468 100644 --- a/packages/google-cloud-vmwareengine/README.md +++ b/packages/google-cloud-vmwareengine/README.md @@ -131,9 +131,8 @@ async function callListVmwareEngineNetworks() { }; // Run request - const iterable = await vmwareengineClient.listVmwareEngineNetworksAsync( - request - ); + const iterable = + await vmwareengineClient.listVmwareEngineNetworksAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-vmwareengine/samples/quickstart.js b/packages/google-cloud-vmwareengine/samples/quickstart.js index bae0a721f39..7eb25261c20 100644 --- a/packages/google-cloud-vmwareengine/samples/quickstart.js +++ b/packages/google-cloud-vmwareengine/samples/quickstart.js @@ -94,8 +94,9 @@ function main(parent) { }; // Run request - const iterable = - await vmwareengineClient.listVmwareEngineNetworksAsync(request); + const iterable = await vmwareengineClient.listVmwareEngineNetworksAsync( + request + ); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-vmwareengine/src/v1/vmware_engine_client.ts b/packages/google-cloud-vmwareengine/src/v1/vmware_engine_client.ts index 1a94c5f3df6..a626bdeb4d9 100644 --- a/packages/google-cloud-vmwareengine/src/v1/vmware_engine_client.ts +++ b/packages/google-cloud-vmwareengine/src/v1/vmware_engine_client.ts @@ -99,8 +99,7 @@ export class VmwareEngineClient { * 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 @@ -108,7 +107,7 @@ export class VmwareEngineClient { * 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 VmwareEngineClient({fallback: 'rest'}, gax); + * const client = new VmwareEngineClient({fallback: true}, gax); * ``` */ constructor( @@ -180,7 +179,7 @@ export class VmwareEngineClient { } 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) { @@ -284,7 +283,7 @@ export class VmwareEngineClient { 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-vmwareengine/test/gapic_vmware_engine_v1.ts b/packages/google-cloud-vmwareengine/test/gapic_vmware_engine_v1.ts index 16fab7c48b1..9367cc9204e 100644 --- a/packages/google-cloud-vmwareengine/test/gapic_vmware_engine_v1.ts +++ b/packages/google-cloud-vmwareengine/test/gapic_vmware_engine_v1.ts @@ -8221,8 +8221,9 @@ describe('v1.VmwareEngineClient', () => { ]; client.innerApiCalls.listPrivateConnectionPeeringRoutes = stubSimpleCall(expectedResponse); - const [response] = - await client.listPrivateConnectionPeeringRoutes(request); + const [response] = await client.listPrivateConnectionPeeringRoutes( + request + ); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub diff --git a/packages/google-cloud-vpcaccess/src/v1/vpc_access_service_client.ts b/packages/google-cloud-vpcaccess/src/v1/vpc_access_service_client.ts index 86631cc56c8..57d71b21df9 100644 --- a/packages/google-cloud-vpcaccess/src/v1/vpc_access_service_client.ts +++ b/packages/google-cloud-vpcaccess/src/v1/vpc_access_service_client.ts @@ -98,8 +98,7 @@ export class VpcAccessServiceClient { * 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 @@ -107,7 +106,7 @@ export class VpcAccessServiceClient { * 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 VpcAccessServiceClient({fallback: 'rest'}, gax); + * const client = new VpcAccessServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -177,7 +176,7 @@ export class VpcAccessServiceClient { } 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) { @@ -217,7 +216,7 @@ export class VpcAccessServiceClient { 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-webrisk/src/v1/web_risk_service_client.ts b/packages/google-cloud-webrisk/src/v1/web_risk_service_client.ts index 13130938cdc..5489641a71f 100644 --- a/packages/google-cloud-webrisk/src/v1/web_risk_service_client.ts +++ b/packages/google-cloud-webrisk/src/v1/web_risk_service_client.ts @@ -92,8 +92,7 @@ export class WebRiskServiceClient { * 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 WebRiskServiceClient { * 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 WebRiskServiceClient({fallback: 'rest'}, gax); + * const client = new WebRiskServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -167,7 +166,7 @@ export class WebRiskServiceClient { } 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) { @@ -193,7 +192,7 @@ export class WebRiskServiceClient { 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-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts b/packages/google-cloud-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts index 064d7c399af..65f0c661c2f 100644 --- a/packages/google-cloud-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts +++ b/packages/google-cloud-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts @@ -88,8 +88,7 @@ export class WebRiskServiceV1Beta1Client { * 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 WebRiskServiceV1Beta1Client { * 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 WebRiskServiceV1Beta1Client({fallback: 'rest'}, gax); + * const client = new WebRiskServiceV1Beta1Client({fallback: true}, gax); * ``` */ constructor( @@ -164,7 +163,7 @@ export class WebRiskServiceV1Beta1Client { } 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-websecurityscanner/src/v1/web_security_scanner_client.ts b/packages/google-cloud-websecurityscanner/src/v1/web_security_scanner_client.ts index 32ccaf9aa00..fc95af1ce0e 100644 --- a/packages/google-cloud-websecurityscanner/src/v1/web_security_scanner_client.ts +++ b/packages/google-cloud-websecurityscanner/src/v1/web_security_scanner_client.ts @@ -92,8 +92,7 @@ export class WebSecurityScannerClient { * 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 WebSecurityScannerClient { * 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 WebSecurityScannerClient({fallback: 'rest'}, gax); + * const client = new WebSecurityScannerClient({fallback: true}, gax); * ``` */ constructor( @@ -167,7 +166,7 @@ export class WebSecurityScannerClient { } 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-websecurityscanner/src/v1alpha/web_security_scanner_client.ts b/packages/google-cloud-websecurityscanner/src/v1alpha/web_security_scanner_client.ts index 91f5c82554e..2a36e63cd5d 100644 --- a/packages/google-cloud-websecurityscanner/src/v1alpha/web_security_scanner_client.ts +++ b/packages/google-cloud-websecurityscanner/src/v1alpha/web_security_scanner_client.ts @@ -92,8 +92,7 @@ export class WebSecurityScannerClient { * 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 WebSecurityScannerClient { * 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 WebSecurityScannerClient({fallback: 'rest'}, gax); + * const client = new WebSecurityScannerClient({fallback: true}, gax); * ``` */ constructor( @@ -167,7 +166,7 @@ export class WebSecurityScannerClient { } 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-websecurityscanner/src/v1beta/web_security_scanner_client.ts b/packages/google-cloud-websecurityscanner/src/v1beta/web_security_scanner_client.ts index f297aad114f..4506cebb47f 100644 --- a/packages/google-cloud-websecurityscanner/src/v1beta/web_security_scanner_client.ts +++ b/packages/google-cloud-websecurityscanner/src/v1beta/web_security_scanner_client.ts @@ -92,8 +92,7 @@ export class WebSecurityScannerClient { * 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 WebSecurityScannerClient { * 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 WebSecurityScannerClient({fallback: 'rest'}, gax); + * const client = new WebSecurityScannerClient({fallback: true}, gax); * ``` */ constructor( @@ -167,7 +166,7 @@ export class WebSecurityScannerClient { } 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-workflows-executions/src/v1/executions_client.ts b/packages/google-cloud-workflows-executions/src/v1/executions_client.ts index a3c1e6abdbd..4ad0a31c467 100644 --- a/packages/google-cloud-workflows-executions/src/v1/executions_client.ts +++ b/packages/google-cloud-workflows-executions/src/v1/executions_client.ts @@ -18,14 +18,7 @@ /* global window */ import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - PaginationCallback, - GaxCall, -} 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'); @@ -91,8 +84,7 @@ export class ExecutionsClient { * 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,25 +92,17 @@ export class ExecutionsClient { * 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 ExecutionsClient({fallback: 'rest'}, gax); + * const client = new ExecutionsClient({fallback: true}, gax); * ``` */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ExecutionsClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); + 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'); + 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. @@ -141,7 +125,7 @@ export class ExecutionsClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,7 +139,10 @@ export class ExecutionsClient { } // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -163,7 +150,7 @@ export class ExecutionsClient { } 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) { @@ -188,20 +175,14 @@ export class ExecutionsClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listExecutions: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'executions' - ), + listExecutions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.executions.v1.Executions', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')} - ); + 'google.cloud.workflows.executions.v1.Executions', 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 @@ -232,40 +213,32 @@ export class ExecutionsClient { // Put together the "service stub" for // google.cloud.workflows.executions.v1.Executions. this.executionsStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.workflows.executions.v1.Executions' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1.Executions') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.workflows.executions.v1.Executions, - this._opts, - this._providedCustomServicePath - ) as Promise<{[method: string]: Function}>; + 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 executionsStubMethods = [ - 'listExecutions', - 'createExecution', - 'getExecution', - 'cancelExecution', - ]; + const executionsStubMethods = + ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; for (const methodName of executionsStubMethods) { const callPromise = this.executionsStub.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) => () => { + 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 descriptor = + this.descriptors.page[methodName] || + undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], @@ -310,7 +283,9 @@ export class ExecutionsClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return ['https://www.googleapis.com/auth/cloud-platform']; + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; } getProjectId(): Promise; @@ -319,9 +294,8 @@ export class ExecutionsClient { * 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 { + getProjectId(callback?: Callback): + Promise|void { if (callback) { this.auth.getProjectId(callback); return; @@ -332,490 +306,395 @@ export class ExecutionsClient { // ------------------- // -- Service calls -- // ------------------- - /** - * Creates a new execution using the latest revision of the given workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @param {google.cloud.workflows.executions.v1.Execution} request.execution - * Required. Execution 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.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.create_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_CreateExecution_async - */ +/** + * Creates a new execution using the latest revision of the given workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @param {google.cloud.workflows.executions.v1.Execution} request.execution + * Required. Execution 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.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.create_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_CreateExecution_async + */ createExecution( - request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.executions.v1.IExecution, - ( - | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest - | undefined - ), - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined + ]>; createExecution( - request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; createExecution( - request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; createExecution( - request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.workflows.executions.v1.IExecution, - ( - | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest - | undefined - ), - {} | undefined, - ] - > | void { + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.createExecution(request, options, callback); } - /** - * Returns an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * execution. The API will default to the FULL 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.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.get_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_GetExecution_async - */ +/** + * Returns an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * execution. The API will default to the FULL 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.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.get_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_GetExecution_async + */ getExecution( - request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.executions.v1.IExecution, - ( - | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest - | undefined - ), - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined + ]>; getExecution( - request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; getExecution( - request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; getExecution( - request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.workflows.executions.v1.IExecution, - ( - | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest - | undefined - ), - {} | undefined, - ] - > | void { + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); this.initialize(); return this.innerApiCalls.getExecution(request, options, callback); } - /** - * Cancels an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.cancel_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_CancelExecution_async - */ +/** + * Cancels an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.cancel_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_CancelExecution_async + */ cancelExecution( - request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.executions.v1.IExecution, - ( - | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest - | undefined - ), - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined + ]>; cancelExecution( - request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; cancelExecution( - request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; cancelExecution( - request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.workflows.executions.v1.IExecution, - ( - | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest - | undefined - ), - {} | undefined, - ] - > | void { + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution, + protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); this.initialize(); return this.innerApiCalls.cancelExecution(request, options, callback); } - /** - * Returns a list of executions which belong to the workflow with - * the given name. The method returns executions of all workflow - * revisions. Returned executions are ordered by their start time (newest - * first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.workflows.executions.v1.Execution|Execution}. - * 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.workflows.executions.v1.Execution|Execution}. + * 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutions( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.executions.v1.IExecution[], - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest | null, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse, - ] - >; + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution[], + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + ]>; listExecutions( - request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - | null - | undefined, - protos.google.cloud.workflows.executions.v1.IExecution - > - ): void; + request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>): void; listExecutions( - request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - | null - | undefined, - protos.google.cloud.workflows.executions.v1.IExecution - > - ): void; + request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>): void; listExecutions( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - | null - | undefined, - protos.google.cloud.workflows.executions.v1.IExecution - >, - callback?: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - | null - | undefined, - protos.google.cloud.workflows.executions.v1.IExecution - > - ): Promise< - [ - protos.google.cloud.workflows.executions.v1.IExecution[], - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest | null, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse, - ] - > | void { + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>, + callback?: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1.IExecution>): + Promise<[ + protos.google.cloud.workflows.executions.v1.IExecution[], + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @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.workflows.executions.v1.Execution|Execution} 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ +/** + * 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @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.workflows.executions.v1.Execution|Execution} 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutionsStream( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options?: CallOptions - ): Transform { + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + 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 ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -826,67 +705,68 @@ export class ExecutionsClient { ); } - /** - * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @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.workflows.executions.v1.Execution|Execution}. 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/executions.list_executions.js - * region_tag:workflowexecutions_v1_generated_Executions_ListExecutions_async - */ +/** + * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @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.workflows.executions.v1.Execution|Execution}. 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/executions.list_executions.js + * region_tag:workflowexecutions_v1_generated_Executions_ListExecutions_async + */ listExecutionsAsync( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options?: CallOptions - ): AsyncIterable { + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + 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 ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -909,12 +789,7 @@ export class ExecutionsClient { * @param {string} execution * @returns {string} Resource name string. */ - executionPath( - project: string, - location: string, - workflow: string, - execution: string - ) { + executionPath(project:string,location:string,workflow:string,execution:string) { return this.pathTemplates.executionPathTemplate.render({ project: project, location: location, @@ -931,8 +806,7 @@ export class ExecutionsClient { * @returns {string} A string representing the project. */ matchProjectFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName) - .project; + return this.pathTemplates.executionPathTemplate.match(executionName).project; } /** @@ -943,8 +817,7 @@ export class ExecutionsClient { * @returns {string} A string representing the location. */ matchLocationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName) - .location; + return this.pathTemplates.executionPathTemplate.match(executionName).location; } /** @@ -955,8 +828,7 @@ export class ExecutionsClient { * @returns {string} A string representing the workflow. */ matchWorkflowFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName) - .workflow; + return this.pathTemplates.executionPathTemplate.match(executionName).workflow; } /** @@ -967,8 +839,7 @@ export class ExecutionsClient { * @returns {string} A string representing the execution. */ matchExecutionFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName) - .execution; + return this.pathTemplates.executionPathTemplate.match(executionName).execution; } /** @@ -979,7 +850,7 @@ export class ExecutionsClient { * @param {string} workflow * @returns {string} Resource name string. */ - workflowPath(project: string, location: string, workflow: string) { + workflowPath(project:string,location:string,workflow:string) { return this.pathTemplates.workflowPathTemplate.render({ project: project, location: location, @@ -1028,7 +899,7 @@ export class ExecutionsClient { */ close(): Promise { if (this.executionsStub && !this._terminated) { - return this.executionsStub.then((stub) => { + return this.executionsStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-workflows-executions/src/v1/workflows_client.ts b/packages/google-cloud-workflows-executions/src/v1/workflows_client.ts index 34e29feeda3..18d1152ede6 100644 --- a/packages/google-cloud-workflows-executions/src/v1/workflows_client.ts +++ b/packages/google-cloud-workflows-executions/src/v1/workflows_client.ts @@ -18,18 +18,7 @@ /* 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 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'); @@ -98,8 +87,7 @@ export class WorkflowsClient { * 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 @@ -107,25 +95,17 @@ export class WorkflowsClient { * 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 WorkflowsClient({fallback: 'rest'}, gax); + * const client = new WorkflowsClient({fallback: true}, gax); * ``` */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof WorkflowsClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); + 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'); + 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. @@ -151,7 +131,7 @@ export class WorkflowsClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -167,9 +147,13 @@ export class WorkflowsClient { this._gaxGrpc, opts ); + // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -177,7 +161,7 @@ export class WorkflowsClient { } 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) { @@ -205,11 +189,8 @@ export class WorkflowsClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listWorkflows: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'workflows' - ), + listWorkflows: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workflows') }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -218,80 +199,45 @@ export class WorkflowsClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined }; - if (opts.fallback === 'rest') { + 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.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', - }, - ]; + 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.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); + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); const createWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.Workflow' - ) as gax.protobuf.Type; + '.google.cloud.workflows.v1.Workflow') as gax.protobuf.Type; const createWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.OperationMetadata' - ) as gax.protobuf.Type; + '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; const deleteWorkflowResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty' - ) as gax.protobuf.Type; + '.google.protobuf.Empty') as gax.protobuf.Type; const deleteWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.OperationMetadata' - ) as gax.protobuf.Type; + '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; const updateWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.Workflow' - ) as gax.protobuf.Type; + '.google.cloud.workflows.v1.Workflow') as gax.protobuf.Type; const updateWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.OperationMetadata' - ) as gax.protobuf.Type; + '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; this.descriptors.longrunning = { createWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createWorkflowResponse.decode.bind(createWorkflowResponse), - createWorkflowMetadata.decode.bind(createWorkflowMetadata) - ), + createWorkflowMetadata.decode.bind(createWorkflowMetadata)), deleteWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteWorkflowResponse.decode.bind(deleteWorkflowResponse), - deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata) - ), + deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata)), updateWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateWorkflowResponse.decode.bind(updateWorkflowResponse), - updateWorkflowMetadata.decode.bind(updateWorkflowMetadata) - ), + updateWorkflowMetadata.decode.bind(updateWorkflowMetadata)) }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.v1.Workflows', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')} - ); + 'google.cloud.workflows.v1.Workflows', 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 @@ -322,39 +268,28 @@ export class WorkflowsClient { // Put together the "service stub" for // google.cloud.workflows.v1.Workflows. this.workflowsStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.workflows.v1.Workflows' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workflows.v1.Workflows') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.workflows.v1.Workflows, - this._opts, - this._providedCustomServicePath - ) as Promise<{[method: string]: Function}>; + 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 workflowsStubMethods = [ - 'listWorkflows', - 'getWorkflow', - 'createWorkflow', - 'deleteWorkflow', - 'updateWorkflow', - ]; + const workflowsStubMethods = + ['listWorkflows', 'getWorkflow', 'createWorkflow', 'deleteWorkflow', 'updateWorkflow']; for (const methodName of workflowsStubMethods) { const callPromise = this.workflowsStub.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) => () => { + 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] || @@ -404,7 +339,9 @@ export class WorkflowsClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return ['https://www.googleapis.com/auth/cloud-platform']; + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; } getProjectId(): Promise; @@ -413,9 +350,8 @@ export class WorkflowsClient { * 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 { + getProjectId(callback?: Callback): + Promise|void { if (callback) { this.auth.getProjectId(callback); return; @@ -426,692 +362,520 @@ export class WorkflowsClient { // ------------------- // -- Service calls -- // ------------------- - /** - * Gets details of a single workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow for which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {string} [request.revisionId] - * Optional. The revision of the workflow to retrieve. If the revision_id is - * empty, the latest revision is retrieved. - * The format is "000001-a4d", where the first six characters define - * the zero-padded decimal revision number. They are followed by a hyphen and - * three hexadecimal 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.workflows.v1.Workflow|Workflow}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.get_workflow.js - * region_tag:workflows_v1_generated_Workflows_GetWorkflow_async - */ +/** + * Gets details of a single workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow for which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {string} [request.revisionId] + * Optional. The revision of the workflow to retrieve. If the revision_id is + * empty, the latest revision is retrieved. + * The format is "000001-a4d", where the first six characters define + * the zero-padded decimal revision number. They are followed by a hyphen and + * three hexadecimal 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.workflows.v1.Workflow|Workflow}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.get_workflow.js + * region_tag:workflows_v1_generated_Workflows_GetWorkflow_async + */ getWorkflow( - request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest | undefined, - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest|undefined, {}|undefined + ]>; getWorkflow( - request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): void; getWorkflow( - request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - callback: Callback< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + callback: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): void; getWorkflow( - request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.cloud.workflows.v1.IWorkflow, - | protos.google.cloud.workflows.v1.IGetWorkflowRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest | undefined, - {} | undefined, - ] - > | void { + protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); this.initialize(); return this.innerApiCalls.getWorkflow(request, options, callback); } - /** - * Creates a new workflow. If a workflow with the specified name already - * exists in the specified project and location, the long running operation - * returns a {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - * @param {google.cloud.workflows.v1.Workflow} request.workflow - * Required. Workflow to be created. - * @param {string} request.workflowId - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and 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/workflows.create_workflow.js - * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async - */ +/** + * Creates a new workflow. If a workflow with the specified name already + * exists in the specified project and location, the long running operation + * returns a {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * @param {google.cloud.workflows.v1.Workflow} request.workflow + * Required. Workflow to be created. + * @param {string} request.workflowId + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and 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/workflows.create_workflow.js + * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async + */ createWorkflow( - request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; createWorkflow( - request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createWorkflow( - request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - callback: Callback< - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createWorkflow( - request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - > | void { + request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.createWorkflow(request, options, callback); } - /** - * Check the status of the long running operation returned by `createWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.create_workflow.js - * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async - */ - async checkCreateWorkflowProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.workflows.v1.Workflow, - protos.google.cloud.workflows.v1.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `createWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.create_workflow.js + * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async + */ + async checkCreateWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.createWorkflow, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.workflows.v1.Workflow, - protos.google.cloud.workflows.v1.OperationMetadata - >; + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Deletes a workflow with the specified name. - * This method also cancels and deletes all running executions of the - * workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.delete_workflow.js - * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async - */ +/** + * Deletes a workflow with the specified name. + * This method also cancels and deletes all running executions of the + * workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.delete_workflow.js + * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async + */ deleteWorkflow( - request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; deleteWorkflow( - request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; deleteWorkflow( - request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; deleteWorkflow( - request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - > | void { + request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); this.initialize(); return this.innerApiCalls.deleteWorkflow(request, options, callback); } - /** - * Check the status of the long running operation returned by `deleteWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.delete_workflow.js - * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async - */ - async checkDeleteWorkflowProgress( - name: string - ): Promise< - LROperation< - protos.google.protobuf.Empty, - protos.google.cloud.workflows.v1.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `deleteWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.delete_workflow.js + * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async + */ + async checkDeleteWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.deleteWorkflow, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.protobuf.Empty, - protos.google.cloud.workflows.v1.OperationMetadata - >; + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Updates an existing workflow. - * Running this method has no impact on already running executions of the - * workflow. A new revision of the workflow might be created as a result of a - * successful update operation. In that case, the new revision is used - * in new workflow executions. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workflows.v1.Workflow} request.workflow - * Required. Workflow to be updated. - * @param {google.protobuf.FieldMask} request.updateMask - * List of fields to be updated. If not present, the entire workflow - * 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/v1/workflows.update_workflow.js - * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async - */ +/** + * Updates an existing workflow. + * Running this method has no impact on already running executions of the + * workflow. A new revision of the workflow might be created as a result of a + * successful update operation. In that case, the new revision is used + * in new workflow executions. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workflows.v1.Workflow} request.workflow + * Required. Workflow to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * List of fields to be updated. If not present, the entire workflow + * 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/v1/workflows.update_workflow.js + * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async + */ updateWorkflow( - request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; updateWorkflow( - request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; updateWorkflow( - request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - callback: Callback< - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; updateWorkflow( - request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - > | void { + request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'workflow.name': request.workflow!.name ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workflow.name': request.workflow!.name ?? '', + }); this.initialize(); return this.innerApiCalls.updateWorkflow(request, options, callback); } - /** - * Check the status of the long running operation returned by `updateWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.update_workflow.js - * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async - */ - async checkUpdateWorkflowProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.workflows.v1.Workflow, - protos.google.cloud.workflows.v1.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `updateWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.update_workflow.js + * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async + */ + async checkUpdateWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.updateWorkflow, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.workflows.v1.Workflow, - protos.google.cloud.workflows.v1.OperationMetadata - >; + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Lists workflows in a given project and location. - * The default order is not specified. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service might return - * fewer than this value even if not at the end of the collection. If a value - * is not specified, a default value of 500 is used. The maximum permitted - * value is 1000 and values greater than 1000 are coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a "desc" suffix. - * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. - * 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists workflows in a given project and location. + * The default order is not specified. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. + * 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listWorkflows( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.v1.IWorkflow[], - protos.google.cloud.workflows.v1.IListWorkflowsRequest | null, - protos.google.cloud.workflows.v1.IListWorkflowsResponse, - ] - >; + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowsRequest|null, + protos.google.cloud.workflows.v1.IListWorkflowsResponse + ]>; listWorkflows( - request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.v1.IListWorkflowsRequest, - | protos.google.cloud.workflows.v1.IListWorkflowsResponse - | null - | undefined, - protos.google.cloud.workflows.v1.IWorkflow - > - ): void; + request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1.IWorkflow>): void; listWorkflows( - request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.v1.IListWorkflowsRequest, - | protos.google.cloud.workflows.v1.IListWorkflowsResponse - | null - | undefined, - protos.google.cloud.workflows.v1.IWorkflow - > - ): void; + request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1.IWorkflow>): void; listWorkflows( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< protos.google.cloud.workflows.v1.IListWorkflowsRequest, - | protos.google.cloud.workflows.v1.IListWorkflowsResponse - | null - | undefined, - protos.google.cloud.workflows.v1.IWorkflow - >, - callback?: PaginationCallback< - protos.google.cloud.workflows.v1.IListWorkflowsRequest, - | protos.google.cloud.workflows.v1.IListWorkflowsResponse - | null - | undefined, - protos.google.cloud.workflows.v1.IWorkflow - > - ): Promise< - [ - protos.google.cloud.workflows.v1.IWorkflow[], - protos.google.cloud.workflows.v1.IListWorkflowsRequest | null, - protos.google.cloud.workflows.v1.IListWorkflowsResponse, - ] - > | void { + protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1.IWorkflow>, + callback?: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1.IWorkflow>): + Promise<[ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowsRequest|null, + protos.google.cloud.workflows.v1.IListWorkflowsResponse + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.listWorkflows(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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service might return - * fewer than this value even if not at the end of the collection. If a value - * is not specified, a default value of 500 is used. The maximum permitted - * value is 1000 and values greater than 1000 are coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a "desc" suffix. - * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow} 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ +/** + * 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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow} 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listWorkflowsStream( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - options?: CallOptions - ): Transform { + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + 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 ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); const defaultCallSettings = this._defaults['listWorkflows']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -1122,57 +886,58 @@ export class WorkflowsClient { ); } - /** - * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service might return - * fewer than this value even if not at the end of the collection. If a value - * is not specified, a default value of 500 is used. The maximum permitted - * value is 1000 and values greater than 1000 are coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a "desc" suffix. - * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. 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/workflows.list_workflows.js - * region_tag:workflows_v1_generated_Workflows_ListWorkflows_async - */ +/** + * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. 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/workflows.list_workflows.js + * region_tag:workflows_v1_generated_Workflows_ListWorkflows_async + */ listWorkflowsAsync( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - options?: CallOptions - ): AsyncIterable { + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + 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 ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); const defaultCallSettings = this._defaults['listWorkflows']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -1182,7 +947,7 @@ export class WorkflowsClient { callSettings ) as AsyncIterable; } - /** +/** * Gets information about a location. * * @param {Object} request @@ -1222,7 +987,7 @@ export class WorkflowsClient { 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. @@ -1260,7 +1025,7 @@ export class WorkflowsClient { 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. @@ -1374,7 +1139,7 @@ export class WorkflowsClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, options?: | gax.CallOptions @@ -1448,12 +1213,7 @@ export class WorkflowsClient { * @param {string} cryptoKey * @returns {string} Resource name string. */ - cryptoKeyPath( - project: string, - location: string, - keyRing: string, - cryptoKey: string - ) { + cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { return this.pathTemplates.cryptoKeyPathTemplate.render({ project: project, location: location, @@ -1470,8 +1230,7 @@ export class WorkflowsClient { * @returns {string} A string representing the project. */ matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .project; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; } /** @@ -1482,8 +1241,7 @@ export class WorkflowsClient { * @returns {string} A string representing the location. */ matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .location; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; } /** @@ -1494,8 +1252,7 @@ export class WorkflowsClient { * @returns {string} A string representing the keyRing. */ matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .keyRing; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).keyRing; } /** @@ -1506,8 +1263,7 @@ export class WorkflowsClient { * @returns {string} A string representing the cryptoKey. */ matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .cryptoKey; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).cryptoKey; } /** @@ -1517,7 +1273,7 @@ export class WorkflowsClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project: string, location: string) { + locationPath(project:string,location:string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -1554,7 +1310,7 @@ export class WorkflowsClient { * @param {string} workflow * @returns {string} Resource name string. */ - workflowPath(project: string, location: string, workflow: string) { + workflowPath(project:string,location:string,workflow:string) { return this.pathTemplates.workflowPathTemplate.render({ project: project, location: location, @@ -1603,7 +1359,7 @@ export class WorkflowsClient { */ close(): Promise { if (this.workflowsStub && !this._terminated) { - return this.workflowsStub.then((stub) => { + return this.workflowsStub.then(stub => { this._terminated = true; stub.close(); this.locationsClient.close(); diff --git a/packages/google-cloud-workflows-executions/src/v1beta/executions_client.ts b/packages/google-cloud-workflows-executions/src/v1beta/executions_client.ts index 6f21ba86562..d9acaa01415 100644 --- a/packages/google-cloud-workflows-executions/src/v1beta/executions_client.ts +++ b/packages/google-cloud-workflows-executions/src/v1beta/executions_client.ts @@ -18,14 +18,7 @@ /* global window */ import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - PaginationCallback, - GaxCall, -} 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'); @@ -91,8 +84,7 @@ export class ExecutionsClient { * 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,25 +92,17 @@ export class ExecutionsClient { * 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 ExecutionsClient({fallback: 'rest'}, gax); + * const client = new ExecutionsClient({fallback: true}, gax); * ``` */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ExecutionsClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); + 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'); + 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. @@ -141,7 +125,7 @@ export class ExecutionsClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,7 +139,10 @@ export class ExecutionsClient { } // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -163,7 +150,7 @@ export class ExecutionsClient { } 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) { @@ -188,20 +175,14 @@ export class ExecutionsClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listExecutions: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'executions' - ), + listExecutions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.executions.v1beta.Executions', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')} - ); + 'google.cloud.workflows.executions.v1beta.Executions', 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 @@ -232,41 +213,32 @@ export class ExecutionsClient { // Put together the "service stub" for // google.cloud.workflows.executions.v1beta.Executions. this.executionsStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.workflows.executions.v1beta.Executions' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.workflows.executions.v1beta - .Executions, - this._opts, - this._providedCustomServicePath - ) as Promise<{[method: string]: Function}>; + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1beta.Executions') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workflows.executions.v1beta.Executions, + 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 executionsStubMethods = [ - 'listExecutions', - 'createExecution', - 'getExecution', - 'cancelExecution', - ]; + const executionsStubMethods = + ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; for (const methodName of executionsStubMethods) { const callPromise = this.executionsStub.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) => () => { + 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 descriptor = + this.descriptors.page[methodName] || + undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], @@ -311,7 +283,9 @@ export class ExecutionsClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return ['https://www.googleapis.com/auth/cloud-platform']; + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; } getProjectId(): Promise; @@ -320,9 +294,8 @@ export class ExecutionsClient { * 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 { + getProjectId(callback?: Callback): + Promise|void { if (callback) { this.auth.getProjectId(callback); return; @@ -333,464 +306,369 @@ export class ExecutionsClient { // ------------------- // -- Service calls -- // ------------------- - /** - * Creates a new execution using the latest revision of the given workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @param {google.cloud.workflows.executions.v1beta.Execution} request.execution - * Required. Execution 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.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.create_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_CreateExecution_async - */ +/** + * Creates a new execution using the latest revision of the given workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @param {google.cloud.workflows.executions.v1beta.Execution} request.execution + * Required. Execution 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.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.create_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_CreateExecution_async + */ createExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.executions.v1beta.IExecution, - ( - | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest - | undefined - ), - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined + ]>; createExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; createExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): void; createExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.workflows.executions.v1beta.IExecution, - ( - | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest - | undefined - ), - {} | undefined, - ] - > | void { + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.createExecution(request, options, callback); } - /** - * Returns an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned execution. - * The API will default to the FULL 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.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.get_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_GetExecution_async - */ +/** + * Returns an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL 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.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.get_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_GetExecution_async + */ getExecution( - request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.executions.v1beta.IExecution, - ( - | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest - | undefined - ), - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined + ]>; getExecution( - request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; getExecution( - request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>): void; getExecution( - request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.workflows.executions.v1beta.IExecution, - ( - | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest - | undefined - ), - {} | undefined, - ] - > | void { + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); this.initialize(); return this.innerApiCalls.getExecution(request, options, callback); } - /** - * Cancels an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.cancel_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_CancelExecution_async - */ +/** + * Cancels an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.cancel_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_CancelExecution_async + */ cancelExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.executions.v1beta.IExecution, - ( - | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest - | undefined - ), - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined + ]>; cancelExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; cancelExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): void; cancelExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.workflows.executions.v1beta.IExecution, - ( - | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest - | undefined - ), - {} | undefined, - ] - > | void { + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution, + protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); this.initialize(); return this.innerApiCalls.cancelExecution(request, options, callback); } - /** - * Returns a list of executions which belong to the workflow with - * the given name. The method returns executions of all workflow - * revisions. Returned executions are ordered by their start time (newest - * first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. - * 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. + * 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutions( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.executions.v1beta.IExecution[], - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest | null, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse, - ] - >; + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution[], + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + ]>; listExecutions( - request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - | null - | undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution - > - ): void; + request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>): void; listExecutions( - request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - | null - | undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution - > - ): void; + request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>): void; listExecutions( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>, + callback?: PaginationCallback< protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - | null - | undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution - >, - callback?: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - | null - | undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution - > - ): Promise< - [ - protos.google.cloud.workflows.executions.v1beta.IExecution[], - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest | null, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse, - ] - > | void { + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution>): + Promise<[ + protos.google.cloud.workflows.executions.v1beta.IExecution[], + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution} 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ +/** + * 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution} 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutionsStream( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options?: CallOptions - ): Transform { + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + 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 ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -801,54 +679,55 @@ export class ExecutionsClient { ); } - /** - * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. 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/executions.list_executions.js - * region_tag:workflowexecutions_v1beta_generated_Executions_ListExecutions_async - */ +/** + * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. 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/executions.list_executions.js + * region_tag:workflowexecutions_v1beta_generated_Executions_ListExecutions_async + */ listExecutionsAsync( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options?: CallOptions - ): AsyncIterable { + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + 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 ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -871,12 +750,7 @@ export class ExecutionsClient { * @param {string} execution * @returns {string} Resource name string. */ - executionPath( - project: string, - location: string, - workflow: string, - execution: string - ) { + executionPath(project:string,location:string,workflow:string,execution:string) { return this.pathTemplates.executionPathTemplate.render({ project: project, location: location, @@ -893,8 +767,7 @@ export class ExecutionsClient { * @returns {string} A string representing the project. */ matchProjectFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName) - .project; + return this.pathTemplates.executionPathTemplate.match(executionName).project; } /** @@ -905,8 +778,7 @@ export class ExecutionsClient { * @returns {string} A string representing the location. */ matchLocationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName) - .location; + return this.pathTemplates.executionPathTemplate.match(executionName).location; } /** @@ -917,8 +789,7 @@ export class ExecutionsClient { * @returns {string} A string representing the workflow. */ matchWorkflowFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName) - .workflow; + return this.pathTemplates.executionPathTemplate.match(executionName).workflow; } /** @@ -929,8 +800,7 @@ export class ExecutionsClient { * @returns {string} A string representing the execution. */ matchExecutionFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName) - .execution; + return this.pathTemplates.executionPathTemplate.match(executionName).execution; } /** @@ -941,7 +811,7 @@ export class ExecutionsClient { * @param {string} workflow * @returns {string} Resource name string. */ - workflowPath(project: string, location: string, workflow: string) { + workflowPath(project:string,location:string,workflow:string) { return this.pathTemplates.workflowPathTemplate.render({ project: project, location: location, @@ -990,7 +860,7 @@ export class ExecutionsClient { */ close(): Promise { if (this.executionsStub && !this._terminated) { - return this.executionsStub.then((stub) => { + return this.executionsStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-workflows-executions/src/v1beta/workflows_client.ts b/packages/google-cloud-workflows-executions/src/v1beta/workflows_client.ts index 1512ccade4f..28c018c5a47 100644 --- a/packages/google-cloud-workflows-executions/src/v1beta/workflows_client.ts +++ b/packages/google-cloud-workflows-executions/src/v1beta/workflows_client.ts @@ -18,16 +18,7 @@ /* global window */ import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - GrpcClientOptions, - LROperation, - PaginationCallback, - GaxCall, -} 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'); @@ -95,8 +86,7 @@ export class WorkflowsClient { * 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,25 +94,17 @@ export class WorkflowsClient { * 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 WorkflowsClient({fallback: 'rest'}, gax); + * const client = new WorkflowsClient({fallback: true}, gax); * ``` */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof WorkflowsClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); + 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'); + 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. @@ -148,7 +130,7 @@ export class WorkflowsClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -162,7 +144,10 @@ export class WorkflowsClient { } // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -170,7 +155,7 @@ export class WorkflowsClient { } 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) { @@ -195,11 +180,8 @@ export class WorkflowsClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listWorkflows: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'workflows' - ), + listWorkflows: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workflows') }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -208,80 +190,45 @@ export class WorkflowsClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined }; - if (opts.fallback === 'rest') { + 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.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', - }, - ]; + 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.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); + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); const createWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.Workflow' - ) as gax.protobuf.Type; + '.google.cloud.workflows.v1beta.Workflow') as gax.protobuf.Type; const createWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.OperationMetadata' - ) as gax.protobuf.Type; + '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; const deleteWorkflowResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty' - ) as gax.protobuf.Type; + '.google.protobuf.Empty') as gax.protobuf.Type; const deleteWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.OperationMetadata' - ) as gax.protobuf.Type; + '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; const updateWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.Workflow' - ) as gax.protobuf.Type; + '.google.cloud.workflows.v1beta.Workflow') as gax.protobuf.Type; const updateWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.OperationMetadata' - ) as gax.protobuf.Type; + '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; this.descriptors.longrunning = { createWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createWorkflowResponse.decode.bind(createWorkflowResponse), - createWorkflowMetadata.decode.bind(createWorkflowMetadata) - ), + createWorkflowMetadata.decode.bind(createWorkflowMetadata)), deleteWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteWorkflowResponse.decode.bind(deleteWorkflowResponse), - deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata) - ), + deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata)), updateWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateWorkflowResponse.decode.bind(updateWorkflowResponse), - updateWorkflowMetadata.decode.bind(updateWorkflowMetadata) - ), + updateWorkflowMetadata.decode.bind(updateWorkflowMetadata)) }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.v1beta.Workflows', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')} - ); + 'google.cloud.workflows.v1beta.Workflows', 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 @@ -312,39 +259,28 @@ export class WorkflowsClient { // Put together the "service stub" for // google.cloud.workflows.v1beta.Workflows. this.workflowsStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.workflows.v1beta.Workflows' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.workflows.v1beta.Workflows') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.workflows.v1beta.Workflows, - this._opts, - this._providedCustomServicePath - ) as Promise<{[method: string]: Function}>; + 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 workflowsStubMethods = [ - 'listWorkflows', - 'getWorkflow', - 'createWorkflow', - 'deleteWorkflow', - 'updateWorkflow', - ]; + const workflowsStubMethods = + ['listWorkflows', 'getWorkflow', 'createWorkflow', 'deleteWorkflow', 'updateWorkflow']; for (const methodName of workflowsStubMethods) { const callPromise = this.workflowsStub.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) => () => { + 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] || @@ -394,7 +330,9 @@ export class WorkflowsClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return ['https://www.googleapis.com/auth/cloud-platform']; + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; } getProjectId(): Promise; @@ -403,9 +341,8 @@ export class WorkflowsClient { * 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 { + getProjectId(callback?: Callback): + Promise|void { if (callback) { this.auth.getProjectId(callback); return; @@ -416,692 +353,514 @@ export class WorkflowsClient { // ------------------- // -- Service calls -- // ------------------- - /** - * Gets details of a single Workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workflows.v1beta.Workflow|Workflow}. - * Please see the {@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/workflows.get_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_GetWorkflow_async - */ +/** + * Gets details of a single Workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workflows.v1beta.Workflow|Workflow}. + * Please see the {@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/workflows.get_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_GetWorkflow_async + */ getWorkflow( - request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest | undefined, - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|undefined, {}|undefined + ]>; getWorkflow( - request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.v1beta.IWorkflow, - | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): void; getWorkflow( - request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - callback: Callback< - protos.google.cloud.workflows.v1beta.IWorkflow, - | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + callback: Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): void; getWorkflow( - request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< protos.google.cloud.workflows.v1beta.IWorkflow, - | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.workflows.v1beta.IWorkflow, - | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest | undefined, - {} | undefined, - ] - > | void { + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); this.initialize(); return this.innerApiCalls.getWorkflow(request, options, callback); } - /** - * Creates a new workflow. If a workflow with the specified name already - * exists in the specified project and location, the long running operation - * will return {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - * @param {google.cloud.workflows.v1beta.Workflow} request.workflow - * Required. Workflow to be created. - * @param {string} request.workflowId - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and 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/v1beta/workflows.create_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async - */ +/** + * Creates a new workflow. If a workflow with the specified name already + * exists in the specified project and location, the long running operation + * will return {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * @param {google.cloud.workflows.v1beta.Workflow} request.workflow + * Required. Workflow to be created. + * @param {string} request.workflowId + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and 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/v1beta/workflows.create_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async + */ createWorkflow( - request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; createWorkflow( - request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createWorkflow( - request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - callback: Callback< - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createWorkflow( - request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - > | void { + request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.createWorkflow(request, options, callback); } - /** - * Check the status of the long running operation returned by `createWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workflows.create_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async - */ - async checkCreateWorkflowProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.workflows.v1beta.Workflow, - protos.google.cloud.workflows.v1beta.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `createWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workflows.create_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async + */ + async checkCreateWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.createWorkflow, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.workflows.v1beta.Workflow, - protos.google.cloud.workflows.v1beta.OperationMetadata - >; + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Deletes a workflow with the specified name. - * This method also cancels and deletes all running executions of the - * workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workflows.delete_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async - */ +/** + * Deletes a workflow with the specified name. + * This method also cancels and deletes all running executions of the + * workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workflows.delete_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async + */ deleteWorkflow( - request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; deleteWorkflow( - request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; deleteWorkflow( - request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; deleteWorkflow( - request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - > | void { + request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); this.initialize(); return this.innerApiCalls.deleteWorkflow(request, options, callback); } - /** - * Check the status of the long running operation returned by `deleteWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workflows.delete_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async - */ - async checkDeleteWorkflowProgress( - name: string - ): Promise< - LROperation< - protos.google.protobuf.Empty, - protos.google.cloud.workflows.v1beta.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `deleteWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workflows.delete_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async + */ + async checkDeleteWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.deleteWorkflow, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.protobuf.Empty, - protos.google.cloud.workflows.v1beta.OperationMetadata - >; + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Updates an existing workflow. - * Running this method has no impact on already running executions of the - * workflow. A new revision of the workflow may be created as a result of a - * successful update operation. In that case, such revision will be used - * in new workflow executions. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workflows.v1beta.Workflow} request.workflow - * Required. Workflow to be updated. - * @param {google.protobuf.FieldMask} request.updateMask - * List of fields to be updated. If not present, the entire workflow - * 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/v1beta/workflows.update_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async - */ +/** + * Updates an existing workflow. + * Running this method has no impact on already running executions of the + * workflow. A new revision of the workflow may be created as a result of a + * successful update operation. In that case, such revision will be used + * in new workflow executions. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workflows.v1beta.Workflow} request.workflow + * Required. Workflow to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * List of fields to be updated. If not present, the entire workflow + * 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/v1beta/workflows.update_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async + */ updateWorkflow( - request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - >; + request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; updateWorkflow( - request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; updateWorkflow( - request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - callback: Callback< - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; updateWorkflow( - request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined, - ] - > | void { + request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'workflow.name': request.workflow!.name ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'workflow.name': request.workflow!.name ?? '', + }); this.initialize(); return this.innerApiCalls.updateWorkflow(request, options, callback); } - /** - * Check the status of the long running operation returned by `updateWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workflows.update_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async - */ - async checkUpdateWorkflowProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.workflows.v1beta.Workflow, - protos.google.cloud.workflows.v1beta.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `updateWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workflows.update_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async + */ + async checkUpdateWorkflowProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.updateWorkflow, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.workflows.v1beta.Workflow, - protos.google.cloud.workflows.v1beta.OperationMetadata - >; + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkflow, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Lists Workflows in a given project and location. - * The default order is not specified. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. - * 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Workflows in a given project and location. + * The default order is not specified. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. + * 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listWorkflows( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.workflows.v1beta.IWorkflow[], - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest | null, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse, - ] - >; + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.workflows.v1beta.IWorkflow[], + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest|null, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + ]>; listWorkflows( - request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse - | null - | undefined, - protos.google.cloud.workflows.v1beta.IWorkflow - > - ): void; + request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1beta.IWorkflow>): void; listWorkflows( - request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse - | null - | undefined, - protos.google.cloud.workflows.v1beta.IWorkflow - > - ): void; + request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1beta.IWorkflow>): void; listWorkflows( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1beta.IWorkflow>, + callback?: PaginationCallback< protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse - | null - | undefined, - protos.google.cloud.workflows.v1beta.IWorkflow - >, - callback?: PaginationCallback< - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse - | null - | undefined, - protos.google.cloud.workflows.v1beta.IWorkflow - > - ): Promise< - [ - protos.google.cloud.workflows.v1beta.IWorkflow[], - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest | null, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse, - ] - > | void { + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, + protos.google.cloud.workflows.v1beta.IWorkflow>): + Promise<[ + protos.google.cloud.workflows.v1beta.IWorkflow[], + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest|null, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.listWorkflows(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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow} 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ +/** + * 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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow} 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listWorkflowsStream( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - options?: CallOptions - ): Transform { + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + 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 ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); const defaultCallSettings = this._defaults['listWorkflows']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -1112,57 +871,58 @@ export class WorkflowsClient { ); } - /** - * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. 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/workflows.list_workflows.js - * region_tag:workflows_v1beta_generated_Workflows_ListWorkflows_async - */ +/** + * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. 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/workflows.list_workflows.js + * region_tag:workflows_v1beta_generated_Workflows_ListWorkflows_async + */ listWorkflowsAsync( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - options?: CallOptions - ): AsyncIterable { + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + 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 ?? '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); const defaultCallSettings = this._defaults['listWorkflows']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -1183,7 +943,7 @@ export class WorkflowsClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project: string, location: string) { + locationPath(project:string,location:string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -1220,7 +980,7 @@ export class WorkflowsClient { * @param {string} workflow * @returns {string} Resource name string. */ - workflowPath(project: string, location: string, workflow: string) { + workflowPath(project:string,location:string,workflow:string) { return this.pathTemplates.workflowPathTemplate.render({ project: project, location: location, @@ -1269,7 +1029,7 @@ export class WorkflowsClient { */ close(): Promise { if (this.workflowsStub && !this._terminated) { - return this.workflowsStub.then((stub) => { + return this.workflowsStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-workflows-executions/system-test/fixtures/sample/src/index.js b/packages/google-cloud-workflows-executions/system-test/fixtures/sample/src/index.js index f844841bc7f..c7a7c423f62 100644 --- a/packages/google-cloud-workflows-executions/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-workflows-executions/system-test/fixtures/sample/src/index.js @@ -16,6 +16,7 @@ // ** 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 workflows = require('@google-cloud/workflows'); diff --git a/packages/google-cloud-workflows-executions/system-test/install.ts b/packages/google-cloud-workflows-executions/system-test/install.ts index f61fe236476..c8f81b25a86 100644 --- a/packages/google-cloud-workflows-executions/system-test/install.ts +++ b/packages/google-cloud-workflows-executions/system-test/install.ts @@ -21,31 +21,29 @@ import {readFileSync} from 'fs'; import {describe, it} from 'mocha'; describe('📦 pack-n-play test', () => { - it('TypeScript code', async function () { + + 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(), - }, + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } }; await packNTest(options); }); - it('JavaScript code', async function () { + 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(), - }, + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } }; await packNTest(options); }); + }); diff --git a/packages/google-cloud-workflows-executions/test/gapic_executions_v1.ts b/packages/google-cloud-workflows-executions/test/gapic_executions_v1.ts index aaebe6dd1e5..b971ac138bd 100644 --- a/packages/google-cloud-workflows-executions/test/gapic_executions_v1.ts +++ b/packages/google-cloud-workflows-executions/test/gapic_executions_v1.ts @@ -29,1062 +29,841 @@ 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(); +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; + 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; + 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]); + 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 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]); +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({}); - }); + 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(); }); } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); + 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); +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.ExecutionsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = executionsModule.v1.ExecutionsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = executionsModule.v1.ExecutionsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = executionsModule.v1.ExecutionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new executionsModule.v1.ExecutionsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new executionsModule.v1.ExecutionsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - await client.initialize(); - assert(client.executionsStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.executionsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - client.close().then(() => { - done(); - }); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = executionsModule.v1.ExecutionsClient.servicePath; + assert(servicePath); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1.ExecutionsClient({ - 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 apiEndpoint', () => { + const apiEndpoint = executionsModule.v1.ExecutionsClient.apiEndpoint; + assert(apiEndpoint); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1.ExecutionsClient({ - 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); - } + it('has port', () => { + const port = executionsModule.v1.ExecutionsClient.port; + assert(port); + assert(typeof port === 'number'); }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - describe('createExecution', () => { - it('invokes createExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.CreateExecutionRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); - const [response] = await client.createExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new executionsModule.v1.ExecutionsClient(); + assert(client); + }); - it('invokes createExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.CreateExecutionRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.createExecution = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExecution( - request, - ( - err?: Error | null, - result?: protos.google.cloud.workflows.executions.v1.IExecution | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new executionsModule.v1.ExecutionsClient({ + fallback: true, + }); + assert(client); + }); - it('invokes createExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.CreateExecutionRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExecution = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createExecution(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + await client.initialize(); + assert(client.executionsStub); + }); - it('invokes createExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.CreateExecutionRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createExecution(request), expectedError); - }); - }); + it('has close method for the initialized client', done => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.executionsStub); + client.close().then(() => { + done(); + }); + }); - describe('getExecution', () => { - it('invokes getExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.GetExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); - const [response] = await client.getExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has close method for the non-initialized client', done => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + client.close().then(() => { + done(); + }); + }); - it('invokes getExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.GetExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.getExecution = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExecution( - request, - ( - err?: Error | null, - result?: protos.google.cloud.workflows.executions.v1.IExecution | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1.ExecutionsClient({ + 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('invokes getExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.GetExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExecution = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getExecution(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1.ExecutionsClient({ + 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); + }); }); - it('invokes getExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.GetExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getExecution(request), expectedError); - }); - }); + describe('createExecution', () => { + it('invokes createExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); + const [response] = await client.createExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('cancelExecution', () => { - it('invokes cancelExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.CancelExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); - const [response] = await client.cancelExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.CancelExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.cancelExecution = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelExecution( - request, - ( - err?: Error | null, - result?: protos.google.cloud.workflows.executions.v1.IExecution | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.CancelExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelExecution = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.cancelExecution(request), expectedError); - const actualRequest = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes createExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createExecution(request), expectedError); + }); }); - it('invokes cancelExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.CancelExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelExecution(request), expectedError); - }); - }); + describe('getExecution', () => { + it('invokes getExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); + const [response] = await client.getExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('listExecutions', () => { - it('invokes listExecutions without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - ]; - client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - ]; - client.innerApiCalls.listExecutions = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutions( - request, - ( - err?: Error | null, - result?: - | protos.google.cloud.workflows.executions.v1.IExecution[] - | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutions = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listExecutions(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes getExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getExecution(request), expectedError); + }); }); - it('invokes listExecutionsStream without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - ]; - client.descriptors.page.listExecutions.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1.Execution[] = - []; - stream.on( - 'data', - (response: protos.google.cloud.workflows.executions.v1.Execution) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); + describe('cancelExecution', () => { + it('invokes cancelExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); + const [response] = await client.cancelExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listExecutions, request) - ); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('invokes listExecutionsStream with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1.Execution[] = - []; - stream.on( - 'data', - (response: protos.google.cloud.workflows.executions.v1.Execution) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + it('invokes cancelExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes cancelExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listExecutions, request) - ); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listExecutions without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ), - ]; - client.descriptors.page.listExecutions.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = - []; - const iterable = client.listExecutionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listExecutions.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes cancelExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelExecution(request), expectedError); + }); }); - it('uses async iteration with listExecutions with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = - []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listExecutions.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); + describe('listExecutions', () => { + it('invokes listExecutions without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); + const [response] = await client.listExecutions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('Path templates', () => { - describe('execution', () => { - const fakePath = '/rendered/path/execution'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - workflow: 'workflowValue', - execution: 'executionValue', - }; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.executionPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.executionPathTemplate.match = sinon - .stub() - .returns(expectedParameters); + it('invokes listExecutions without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutions( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('executionPath', () => { - const result = client.executionPath( - 'projectValue', - 'locationValue', - 'workflowValue', - 'executionValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.executionPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); + it('invokes listExecutions with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listExecutions(request), expectedError); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromExecutionName', () => { - const result = client.matchProjectFromExecutionName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + it('invokes listExecutionsStream without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { + 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.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('matchLocationFromExecutionName', () => { - const result = client.matchLocationFromExecutionName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + it('invokes listExecutionsStream with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('matchWorkflowFromExecutionName', () => { - const result = client.matchWorkflowFromExecutionName(fakePath); - assert.strictEqual(result, 'workflowValue'); - assert( - (client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + it('uses async iteration with listExecutions without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), + ]; + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; + const iterable = client.listExecutionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('matchExecutionFromExecutionName', () => { - const result = client.matchExecutionFromExecutionName(fakePath); - assert.strictEqual(result, 'executionValue'); - assert( - (client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + it('uses async iteration with listExecutions with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); }); - describe('workflow', () => { - const fakePath = '/rendered/path/workflow'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - workflow: 'workflowValue', - }; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath( - 'projectValue', - 'locationValue', - 'workflowValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + describe('Path templates', () => { + + describe('execution', () => { + const fakePath = "/rendered/path/execution"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + execution: "executionValue", + }; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.executionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.executionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('executionPath', () => { + const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.executionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromExecutionName', () => { + const result = client.matchProjectFromExecutionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromExecutionName', () => { + const result = client.matchLocationFromExecutionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromExecutionName', () => { + const result = client.matchWorkflowFromExecutionName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExecutionFromExecutionName', () => { + const result = client.matchExecutionFromExecutionName(fakePath); + assert.strictEqual(result, "executionValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, 'workflowValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + describe('workflow', () => { + const fakePath = "/rendered/path/workflow"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + }; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); }); - }); }); diff --git a/packages/google-cloud-workflows-executions/test/gapic_executions_v1beta.ts b/packages/google-cloud-workflows-executions/test/gapic_executions_v1beta.ts index c25e7d14da6..aabf52f4cda 100644 --- a/packages/google-cloud-workflows-executions/test/gapic_executions_v1beta.ts +++ b/packages/google-cloud-workflows-executions/test/gapic_executions_v1beta.ts @@ -29,1066 +29,841 @@ 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(); +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; + 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; + 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]); + 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 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]); +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({}); - }); + 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(); }); } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); + 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); +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.ExecutionsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = executionsModule.v1beta.ExecutionsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = executionsModule.v1beta.ExecutionsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = executionsModule.v1beta.ExecutionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new executionsModule.v1beta.ExecutionsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - await client.initialize(); - assert(client.executionsStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.executionsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - client.close().then(() => { - done(); - }); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = executionsModule.v1beta.ExecutionsClient.servicePath; + assert(servicePath); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1beta.ExecutionsClient({ - 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 apiEndpoint', () => { + const apiEndpoint = executionsModule.v1beta.ExecutionsClient.apiEndpoint; + assert(apiEndpoint); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1beta.ExecutionsClient({ - 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); - } + it('has port', () => { + const port = executionsModule.v1beta.ExecutionsClient.port; + assert(port); + assert(typeof port === 'number'); }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - describe('createExecution', () => { - it('invokes createExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); - const [response] = await client.createExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new executionsModule.v1beta.ExecutionsClient(); + assert(client); + }); - it('invokes createExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.createExecution = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExecution( - request, - ( - err?: Error | null, - result?: protos.google.cloud.workflows.executions.v1beta.IExecution | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + fallback: true, + }); + assert(client); + }); - it('invokes createExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExecution = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createExecution(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + await client.initialize(); + assert(client.executionsStub); + }); - it('invokes createExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createExecution(request), expectedError); - }); - }); + it('has close method for the initialized client', done => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.executionsStub); + client.close().then(() => { + done(); + }); + }); - describe('getExecution', () => { - it('invokes getExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); - const [response] = await client.getExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has close method for the non-initialized client', done => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + client.close().then(() => { + done(); + }); + }); - it('invokes getExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.getExecution = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExecution( - request, - ( - err?: Error | null, - result?: protos.google.cloud.workflows.executions.v1beta.IExecution | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1beta.ExecutionsClient({ + 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('invokes getExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExecution = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getExecution(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1beta.ExecutionsClient({ + 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); + }); }); - it('invokes getExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getExecution(request), expectedError); - }); - }); + describe('createExecution', () => { + it('invokes createExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); + const [response] = await client.createExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('cancelExecution', () => { - it('invokes cancelExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); - const [response] = await client.cancelExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.cancelExecution = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelExecution( - request, - ( - err?: Error | null, - result?: protos.google.cloud.workflows.executions.v1beta.IExecution | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelExecution = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.cancelExecution(request), expectedError); - const actualRequest = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancelExecution as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes createExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createExecution(request), expectedError); + }); }); - it('invokes cancelExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelExecution(request), expectedError); - }); - }); + describe('getExecution', () => { + it('invokes getExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); + const [response] = await client.getExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('listExecutions', () => { - it('invokes listExecutions without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - ]; - client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - ]; - client.innerApiCalls.listExecutions = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutions( - request, - ( - err?: Error | null, - result?: - | protos.google.cloud.workflows.executions.v1beta.IExecution[] - | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutions = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listExecutions(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listExecutions as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes getExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getExecution(request), expectedError); + }); }); - it('invokes listExecutionsStream without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - ]; - client.descriptors.page.listExecutions.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = - []; - stream.on( - 'data', - ( - response: protos.google.cloud.workflows.executions.v1beta.Execution - ) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); + describe('cancelExecution', () => { + it('invokes cancelExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); + const [response] = await client.cancelExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listExecutions, request) - ); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('invokes listExecutionsStream with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = - []; - stream.on( - 'data', - ( - response: protos.google.cloud.workflows.executions.v1beta.Execution - ) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + it('invokes cancelExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelExecution( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes cancelExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelExecution(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listExecutions, request) - ); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listExecutions without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ), - ]; - client.descriptors.page.listExecutions.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = - []; - const iterable = client.listExecutionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listExecutions.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes cancelExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelExecution(request), expectedError); + }); }); - it('uses async iteration with listExecutions with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = - []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listExecutions.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); + describe('listExecutions', () => { + it('invokes listExecutions without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); + const [response] = await client.listExecutions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('Path templates', () => { - describe('execution', () => { - const fakePath = '/rendered/path/execution'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - workflow: 'workflowValue', - execution: 'executionValue', - }; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.executionPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.executionPathTemplate.match = sinon - .stub() - .returns(expectedParameters); + it('invokes listExecutions without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutions( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('executionPath', () => { - const result = client.executionPath( - 'projectValue', - 'locationValue', - 'workflowValue', - 'executionValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.executionPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); + it('invokes listExecutions with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listExecutions(request), expectedError); + const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromExecutionName', () => { - const result = client.matchProjectFromExecutionName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + it('invokes listExecutionsStream without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { + 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.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('matchLocationFromExecutionName', () => { - const result = client.matchLocationFromExecutionName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + it('invokes listExecutionsStream with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; + stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('matchWorkflowFromExecutionName', () => { - const result = client.matchWorkflowFromExecutionName(fakePath); - assert.strictEqual(result, 'workflowValue'); - assert( - (client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + it('uses async iteration with listExecutions without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), + ]; + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; + const iterable = client.listExecutionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('matchExecutionFromExecutionName', () => { - const result = client.matchExecutionFromExecutionName(fakePath); - assert.strictEqual(result, 'executionValue'); - assert( - (client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + it('uses async iteration with listExecutions with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); }); - describe('workflow', () => { - const fakePath = '/rendered/path/workflow'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - workflow: 'workflowValue', - }; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath( - 'projectValue', - 'locationValue', - 'workflowValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + describe('Path templates', () => { + + describe('execution', () => { + const fakePath = "/rendered/path/execution"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + execution: "executionValue", + }; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.executionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.executionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('executionPath', () => { + const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.executionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromExecutionName', () => { + const result = client.matchProjectFromExecutionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromExecutionName', () => { + const result = client.matchLocationFromExecutionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromExecutionName', () => { + const result = client.matchWorkflowFromExecutionName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExecutionFromExecutionName', () => { + const result = client.matchExecutionFromExecutionName(fakePath); + assert.strictEqual(result, "executionValue"); + assert((client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, 'workflowValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + describe('workflow', () => { + const fakePath = "/rendered/path/workflow"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + }; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); }); - }); }); diff --git a/packages/google-cloud-workflows-executions/test/gapic_workflows_v1.ts b/packages/google-cloud-workflows-executions/test/gapic_workflows_v1.ts index 2735d94e662..c1de3a97d3f 100644 --- a/packages/google-cloud-workflows-executions/test/gapic_workflows_v1.ts +++ b/packages/google-cloud-workflows-executions/test/gapic_workflows_v1.ts @@ -25,1951 +25,1570 @@ import * as workflowsModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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({}); - }); +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]); + } } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); + // 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); +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.WorkflowsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = workflowsModule.v1.WorkflowsClient.servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = workflowsModule.v1.WorkflowsClient.servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = workflowsModule.v1.WorkflowsClient.apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = workflowsModule.v1.WorkflowsClient.apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = workflowsModule.v1.WorkflowsClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = workflowsModule.v1.WorkflowsClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = new workflowsModule.v1.WorkflowsClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = new workflowsModule.v1.WorkflowsClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = new workflowsModule.v1.WorkflowsClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = new workflowsModule.v1.WorkflowsClient({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - await client.initialize(); - assert(client.workflowsStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + await client.initialize(); + assert(client.workflowsStub); + }); - it('has close method for the initialized client', (done) => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.workflowsStub); - client.close().then(() => { - done(); - }); - }); + it('has close method for the initialized client', done => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.workflowsStub); + client.close().then(() => { + done(); + }); + }); - it('has close method for the non-initialized client', (done) => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - client.close().then(() => { - done(); - }); - }); + it('has close method for the non-initialized client', done => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + client.close().then(() => { + done(); + }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workflowsModule.v1.WorkflowsClient({ - 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', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ - 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); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1.WorkflowsClient({ + 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); }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getWorkflow', () => { - it('invokes getWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.GetWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1.Workflow() - ); - client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkflow(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes getWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.GetWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1.Workflow() - ); - client.innerApiCalls.getWorkflow = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkflow( - request, - ( - err?: Error | null, - result?: protos.google.cloud.workflows.v1.IWorkflow | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('getWorkflow', () => { + it('invokes getWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1.Workflow() + ); + client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkflow(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getWorkflow with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.GetWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkflow = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getWorkflow(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1.Workflow() + ); + client.innerApiCalls.getWorkflow = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkflow( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.v1.IWorkflow|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getWorkflow with closed client', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.GetWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkflow(request), expectedError); - }); - }); - - describe('createWorkflow', () => { - it('invokes createWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.CreateWorkflowRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = - stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getWorkflow with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkflow = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.CreateWorkflowRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkflow( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes getWorkflow with closed client', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkflow(request), expectedError); + }); }); - it('invokes createWorkflow with call error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.CreateWorkflowRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.createWorkflow(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('createWorkflow', () => { + it('invokes createWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createWorkflow with LRO error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.CreateWorkflowRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.createWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkflowProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkCreateWorkflowProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('deleteWorkflow', () => { - it('invokes deleteWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.DeleteWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = - stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.DeleteWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkflow( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteWorkflow with call error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.DeleteWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteWorkflow(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes checkCreateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); }); - it('invokes deleteWorkflow with LRO error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.DeleteWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.deleteWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('deleteWorkflow', () => { + it('invokes deleteWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteWorkflowProgress without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkflowProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteWorkflowProgress with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkDeleteWorkflowProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('updateWorkflow', () => { - it('invokes updateWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.UpdateWorkflowRequest', - ['workflow', 'name'] - ); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = - stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.UpdateWorkflowRequest', - ['workflow', 'name'] - ); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkflow( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateWorkflow with call error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.UpdateWorkflowRequest', - ['workflow', 'name'] - ); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.updateWorkflow(request), expectedError); - const actualRequest = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateWorkflow with LRO error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.UpdateWorkflowRequest', - ['workflow', 'name'] - ); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.updateWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes checkDeleteWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); }); - it('invokes checkUpdateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkflowProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + describe('updateWorkflow', () => { + it('invokes updateWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkUpdateWorkflowProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('listWorkflows', () => { - it('invokes listWorkflows without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkflows(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listWorkflows without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.innerApiCalls.listWorkflows = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkflows( - request, - ( - err?: Error | null, - result?: protos.google.cloud.workflows.v1.IWorkflow[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listWorkflows with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkflows = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listWorkflows(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listWorkflowsStream without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.descriptors.page.listWorkflows.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1.Workflow[] = []; - stream.on( - 'data', - (response: protos.google.cloud.workflows.v1.Workflow) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + it('invokes checkUpdateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes checkUpdateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listWorkflows, request) - ); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); }); - it('invokes listWorkflowsStream with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1.Workflow[] = []; - stream.on( - 'data', - (response: protos.google.cloud.workflows.v1.Workflow) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + describe('listWorkflows', () => { + it('invokes listWorkflows without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkflows(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes listWorkflows without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkflows( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.v1.IWorkflow[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listWorkflows, request) - ); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listWorkflows without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.descriptors.page.listWorkflows.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; - const iterable = client.listWorkflowsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listWorkflows.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listWorkflows with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkflows = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkflows(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listWorkflows with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkflowsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listWorkflows.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listWorkflows.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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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); + it('invokes listWorkflowsStream without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1.Workflow[] = []; + stream.on('data', (response: protos.google.cloud.workflows.v1.Workflow) => { + 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.listWorkflows.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkflowsStream with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1.Workflow[] = []; + stream.on('data', (response: protos.google.cloud.workflows.v1.Workflow) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkflows without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; + const iterable = client.listWorkflowsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); } - } - ); - }); - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 - ) - ); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkflows with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkflowsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkflows.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 workflowsModule.v1.WorkflowsClient({ - 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) - ); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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)); + }); }); - it('invokes getOperation without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - 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); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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!); } - } - ); - }); - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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) - ); + 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 workflowsModule.v1.WorkflowsClient({ + 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 + ) + ); + }); }); - it('invokes cancelOperation without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - 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)); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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)); + }); }); - it('invokes cancelOperation with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - 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('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ - 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) - ); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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)); + }); }); - it('invokes deleteOperation without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - 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); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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!); } - } - ); - }); - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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('cryptoKey', () => { - const fakePath = '/rendered/path/cryptoKey'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - keyRing: 'keyRingValue', - cryptoKey: 'cryptoKeyValue', - }; - const client = new workflowsModule.v1.WorkflowsClient({ - 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) - ); - }); + 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 workflowsModule.v1.WorkflowsClient({ + 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('location', () => { - const fakePath = '/rendered/path/location'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - }; - const client = new workflowsModule.v1.WorkflowsClient({ - 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('Path templates', () => { + + describe('cryptoKey', () => { + const fakePath = "/rendered/path/cryptoKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + keyRing: "keyRingValue", + cryptoKey: "cryptoKeyValue", + }; + const client = new workflowsModule.v1.WorkflowsClient({ + 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('workflow', () => { - const fakePath = '/rendered/path/workflow'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - workflow: 'workflowValue', - }; - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath( - 'projectValue', - 'locationValue', - 'workflowValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, 'workflowValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new workflowsModule.v1.WorkflowsClient({ + 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('workflow', () => { + const fakePath = "/rendered/path/workflow"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + }; + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); }); - }); }); diff --git a/packages/google-cloud-workflows-executions/test/gapic_workflows_v1beta.ts b/packages/google-cloud-workflows-executions/test/gapic_workflows_v1beta.ts index c52f4fc60a4..b444a534938 100644 --- a/packages/google-cloud-workflows-executions/test/gapic_workflows_v1beta.ts +++ b/packages/google-cloud-workflows-executions/test/gapic_workflows_v1beta.ts @@ -29,1387 +29,1091 @@ 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(); +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; + 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; + 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]); + 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 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 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 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({}); - }); +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]); + } } - setImmediate(() => { - mockStream.end(); + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); + // 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); +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.WorkflowsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = workflowsModule.v1beta.WorkflowsClient.servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = workflowsModule.v1beta.WorkflowsClient.servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = workflowsModule.v1beta.WorkflowsClient.apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = workflowsModule.v1beta.WorkflowsClient.apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = workflowsModule.v1beta.WorkflowsClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = workflowsModule.v1beta.WorkflowsClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = new workflowsModule.v1beta.WorkflowsClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = new workflowsModule.v1beta.WorkflowsClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - await client.initialize(); - assert(client.workflowsStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + await client.initialize(); + assert(client.workflowsStub); + }); - it('has close method for the initialized client', (done) => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.workflowsStub); - client.close().then(() => { - done(); - }); - }); + it('has close method for the initialized client', done => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.workflowsStub); + client.close().then(() => { + done(); + }); + }); - it('has close method for the non-initialized client', (done) => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - client.close().then(() => { - done(); - }); - }); + it('has close method for the non-initialized client', done => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + client.close().then(() => { + done(); + }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workflowsModule.v1beta.WorkflowsClient({ - 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', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1beta.WorkflowsClient({ + 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 workflowsModule.v1beta.WorkflowsClient({ - 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); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1beta.WorkflowsClient({ + 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); }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getWorkflow', () => { - it('invokes getWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.GetWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ); - client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkflow(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes getWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.GetWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ); - client.innerApiCalls.getWorkflow = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkflow( - request, - ( - err?: Error | null, - result?: protos.google.cloud.workflows.v1beta.IWorkflow | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('getWorkflow', () => { + it('invokes getWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ); + client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkflow(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getWorkflow with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.GetWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkflow = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getWorkflow(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ); + client.innerApiCalls.getWorkflow = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkflow( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.v1beta.IWorkflow|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getWorkflow with closed client', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.GetWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkflow(request), expectedError); - }); - }); - - describe('createWorkflow', () => { - it('invokes createWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.CreateWorkflowRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = - stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getWorkflow with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkflow = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.CreateWorkflowRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkflow( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes getWorkflow with closed client', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkflow(request), expectedError); + }); }); - it('invokes createWorkflow with call error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.CreateWorkflowRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.createWorkflow(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('createWorkflow', () => { + it('invokes createWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createWorkflow with LRO error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.CreateWorkflowRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.createWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkflowProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkCreateWorkflowProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('deleteWorkflow', () => { - it('invokes deleteWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = - stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkflow( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1beta.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteWorkflow with call error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteWorkflow(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes checkCreateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); }); - it('invokes deleteWorkflow with LRO error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.deleteWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('deleteWorkflow', () => { + it('invokes deleteWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteWorkflowProgress without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkflowProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteWorkflowProgress with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkDeleteWorkflowProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('updateWorkflow', () => { - it('invokes updateWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', - ['workflow', 'name'] - ); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = - stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', - ['workflow', 'name'] - ); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkflow( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateWorkflow with call error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', - ['workflow', 'name'] - ); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.updateWorkflow(request), expectedError); - const actualRequest = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateWorkflow with LRO error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', - ['workflow', 'name'] - ); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.updateWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateWorkflow as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes checkDeleteWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); }); - it('invokes checkUpdateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkflowProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + describe('updateWorkflow', () => { + it('invokes updateWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkUpdateWorkflowProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('listWorkflows', () => { - it('invokes listWorkflows without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - ]; - client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkflows(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkflow( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listWorkflows without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - ]; - client.innerApiCalls.listWorkflows = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkflows( - request, - ( - err?: Error | null, - result?: protos.google.cloud.workflows.v1beta.IWorkflow[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkflow(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listWorkflows with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkflows = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listWorkflows(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listWorkflows as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listWorkflowsStream without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - ]; - client.descriptors.page.listWorkflows.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; - stream.on( - 'data', - (response: protos.google.cloud.workflows.v1beta.Workflow) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + it('invokes checkUpdateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkflowProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes checkUpdateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkflowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listWorkflows, request) - ); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); }); - it('invokes listWorkflowsStream with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; - stream.on( - 'data', - (response: protos.google.cloud.workflows.v1beta.Workflow) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + describe('listWorkflows', () => { + it('invokes listWorkflows without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkflows(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes listWorkflows without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkflows( + request, + (err?: Error|null, result?: protos.google.cloud.workflows.v1beta.IWorkflow[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listWorkflows, request) - ); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listWorkflows without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ), - ]; - client.descriptors.page.listWorkflows.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; - const iterable = client.listWorkflowsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listWorkflows.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listWorkflows with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkflows = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkflows(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listWorkflows with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.workflows.v1beta.ListWorkflowsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkflowsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listWorkflows.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listWorkflows.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 workflowsModule.v1beta.WorkflowsClient({ - 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) - ); - }); + it('invokes listWorkflowsStream without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + ]; + client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; + stream.on('data', (response: protos.google.cloud.workflows.v1beta.Workflow) => { + 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.listWorkflows.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkflowsStream with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; + stream.on('data', (response: protos.google.cloud.workflows.v1beta.Workflow) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkflows without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), + ]; + client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; + const iterable = client.listWorkflowsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkflows with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkflowsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); }); - describe('workflow', () => { - const fakePath = '/rendered/path/workflow'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - workflow: 'workflowValue', - }; - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath( - 'projectValue', - 'locationValue', - 'workflowValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, 'workflowValue'); - assert( - (client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + describe('Path templates', () => { + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new workflowsModule.v1beta.WorkflowsClient({ + 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('workflow', () => { + const fakePath = "/rendered/path/workflow"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow: "workflowValue", + }; + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, "workflowValue"); + assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); }); - }); }); diff --git a/packages/google-cloud-workflows-executions/webpack.config.js b/packages/google-cloud-workflows-executions/webpack.config.js index 6d04c9e5b9a..5a6fddf6078 100644 --- a/packages/google-cloud-workflows-executions/webpack.config.js +++ b/packages/google-cloud-workflows-executions/webpack.config.js @@ -36,27 +36,27 @@ module.exports = { { test: /\.tsx?$/, use: 'ts-loader', - exclude: /node_modules/, + exclude: /node_modules/ }, { test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]grpc/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]retry-request/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]gtoken/, - use: 'null-loader', + use: 'null-loader' }, ], }, diff --git a/packages/google-cloud-workstations/src/v1/workstations_client.ts b/packages/google-cloud-workstations/src/v1/workstations_client.ts index 8ce0bf63741..86022a8d06c 100644 --- a/packages/google-cloud-workstations/src/v1/workstations_client.ts +++ b/packages/google-cloud-workstations/src/v1/workstations_client.ts @@ -99,8 +99,7 @@ export class WorkstationsClient { * 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 @@ -108,7 +107,7 @@ export class WorkstationsClient { * 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 WorkstationsClient({fallback: 'rest'}, gax); + * const client = new WorkstationsClient({fallback: true}, gax); * ``` */ constructor( @@ -180,7 +179,7 @@ export class WorkstationsClient { } 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) { @@ -249,7 +248,7 @@ export class WorkstationsClient { 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-workstations/src/v1beta/workstations_client.ts b/packages/google-cloud-workstations/src/v1beta/workstations_client.ts index cf2a3161623..ebb8a822a8f 100644 --- a/packages/google-cloud-workstations/src/v1beta/workstations_client.ts +++ b/packages/google-cloud-workstations/src/v1beta/workstations_client.ts @@ -99,8 +99,7 @@ export class WorkstationsClient { * 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 @@ -108,7 +107,7 @@ export class WorkstationsClient { * 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 WorkstationsClient({fallback: 'rest'}, gax); + * const client = new WorkstationsClient({fallback: true}, gax); * ``` */ constructor( @@ -180,7 +179,7 @@ export class WorkstationsClient { } 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) { @@ -249,7 +248,7 @@ export class WorkstationsClient { 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-container/src/v1/cluster_manager_client.ts b/packages/google-container/src/v1/cluster_manager_client.ts index fb185ed297b..e487d1a247b 100644 --- a/packages/google-container/src/v1/cluster_manager_client.ts +++ b/packages/google-container/src/v1/cluster_manager_client.ts @@ -89,8 +89,7 @@ export class ClusterManagerClient { * 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 @@ -98,7 +97,7 @@ export class ClusterManagerClient { * 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 ClusterManagerClient({fallback: 'rest'}, gax); + * const client = new ClusterManagerClient({fallback: true}, gax); * ``` */ constructor( @@ -164,7 +163,7 @@ export class ClusterManagerClient { } 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-container/src/v1beta1/cluster_manager_client.ts b/packages/google-container/src/v1beta1/cluster_manager_client.ts index 7ca154caa76..10c5238ace2 100644 --- a/packages/google-container/src/v1beta1/cluster_manager_client.ts +++ b/packages/google-container/src/v1beta1/cluster_manager_client.ts @@ -89,8 +89,7 @@ export class ClusterManagerClient { * 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 @@ -98,7 +97,7 @@ export class ClusterManagerClient { * 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 ClusterManagerClient({fallback: 'rest'}, gax); + * const client = new ClusterManagerClient({fallback: true}, gax); * ``` */ constructor( @@ -164,7 +163,7 @@ export class ClusterManagerClient { } 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-dataflow/src/v1beta3/flex_templates_service_client.ts b/packages/google-dataflow/src/v1beta3/flex_templates_service_client.ts index c12469decdc..88c97768637 100644 --- a/packages/google-dataflow/src/v1beta3/flex_templates_service_client.ts +++ b/packages/google-dataflow/src/v1beta3/flex_templates_service_client.ts @@ -87,8 +87,7 @@ export class FlexTemplatesServiceClient { * 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 FlexTemplatesServiceClient { * 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 FlexTemplatesServiceClient({fallback: 'rest'}, gax); + * const client = new FlexTemplatesServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -162,7 +161,7 @@ export class FlexTemplatesServiceClient { } 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-dataflow/src/v1beta3/jobs_v1_beta3_client.ts b/packages/google-dataflow/src/v1beta3/jobs_v1_beta3_client.ts index 6ad480b3898..24869924141 100644 --- a/packages/google-dataflow/src/v1beta3/jobs_v1_beta3_client.ts +++ b/packages/google-dataflow/src/v1beta3/jobs_v1_beta3_client.ts @@ -90,8 +90,7 @@ export class JobsV1Beta3Client { * 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 JobsV1Beta3Client { * 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 JobsV1Beta3Client({fallback: 'rest'}, gax); + * const client = new JobsV1Beta3Client({fallback: true}, gax); * ``` */ constructor( @@ -165,7 +164,7 @@ export class JobsV1Beta3Client { } 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-dataflow/src/v1beta3/messages_v1_beta3_client.ts b/packages/google-dataflow/src/v1beta3/messages_v1_beta3_client.ts index fbf34499741..522ed16d068 100644 --- a/packages/google-dataflow/src/v1beta3/messages_v1_beta3_client.ts +++ b/packages/google-dataflow/src/v1beta3/messages_v1_beta3_client.ts @@ -90,8 +90,7 @@ export class MessagesV1Beta3Client { * 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 MessagesV1Beta3Client { * 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 MessagesV1Beta3Client({fallback: 'rest'}, gax); + * const client = new MessagesV1Beta3Client({fallback: true}, gax); * ``` */ constructor( @@ -165,7 +164,7 @@ export class MessagesV1Beta3Client { } 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-dataflow/src/v1beta3/metrics_v1_beta3_client.ts b/packages/google-dataflow/src/v1beta3/metrics_v1_beta3_client.ts index 9512016ec36..7cce821105e 100644 --- a/packages/google-dataflow/src/v1beta3/metrics_v1_beta3_client.ts +++ b/packages/google-dataflow/src/v1beta3/metrics_v1_beta3_client.ts @@ -90,8 +90,7 @@ export class MetricsV1Beta3Client { * 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 MetricsV1Beta3Client { * 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 MetricsV1Beta3Client({fallback: 'rest'}, gax); + * const client = new MetricsV1Beta3Client({fallback: true}, gax); * ``` */ constructor( @@ -165,7 +164,7 @@ export class MetricsV1Beta3Client { } 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-dataflow/src/v1beta3/snapshots_v1_beta3_client.ts b/packages/google-dataflow/src/v1beta3/snapshots_v1_beta3_client.ts index d9f58e077f4..9078f70ba97 100644 --- a/packages/google-dataflow/src/v1beta3/snapshots_v1_beta3_client.ts +++ b/packages/google-dataflow/src/v1beta3/snapshots_v1_beta3_client.ts @@ -87,8 +87,7 @@ export class SnapshotsV1Beta3Client { * 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 SnapshotsV1Beta3Client { * 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 SnapshotsV1Beta3Client({fallback: 'rest'}, gax); + * const client = new SnapshotsV1Beta3Client({fallback: true}, gax); * ``` */ constructor( @@ -162,7 +161,7 @@ export class SnapshotsV1Beta3Client { } 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-dataflow/src/v1beta3/templates_service_client.ts b/packages/google-dataflow/src/v1beta3/templates_service_client.ts index 2c49793954c..b488ffa110b 100644 --- a/packages/google-dataflow/src/v1beta3/templates_service_client.ts +++ b/packages/google-dataflow/src/v1beta3/templates_service_client.ts @@ -87,8 +87,7 @@ export class TemplatesServiceClient { * 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 TemplatesServiceClient { * 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 TemplatesServiceClient({fallback: 'rest'}, gax); + * const client = new TemplatesServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -162,7 +161,7 @@ export class TemplatesServiceClient { } 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-devtools-artifactregistry/src/v1/artifact_registry_client.ts b/packages/google-devtools-artifactregistry/src/v1/artifact_registry_client.ts index 869132a3421..a72e3bb48cc 100644 --- a/packages/google-devtools-artifactregistry/src/v1/artifact_registry_client.ts +++ b/packages/google-devtools-artifactregistry/src/v1/artifact_registry_client.ts @@ -108,8 +108,7 @@ export class ArtifactRegistryClient { * 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 ArtifactRegistryClient { * 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 ArtifactRegistryClient({fallback: 'rest'}, gax); + * const client = new ArtifactRegistryClient({fallback: true}, gax); * ``` */ constructor( @@ -187,7 +186,7 @@ export class ArtifactRegistryClient { } 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) { @@ -300,7 +299,7 @@ export class ArtifactRegistryClient { 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-devtools-artifactregistry/src/v1beta2/artifact_registry_client.ts b/packages/google-devtools-artifactregistry/src/v1beta2/artifact_registry_client.ts index 4ccb06abdbc..3ed5603b089 100644 --- a/packages/google-devtools-artifactregistry/src/v1beta2/artifact_registry_client.ts +++ b/packages/google-devtools-artifactregistry/src/v1beta2/artifact_registry_client.ts @@ -108,8 +108,7 @@ export class ArtifactRegistryClient { * 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 ArtifactRegistryClient { * 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 ArtifactRegistryClient({fallback: 'rest'}, gax); + * const client = new ArtifactRegistryClient({fallback: true}, gax); * ``` */ constructor( @@ -187,7 +186,7 @@ export class ArtifactRegistryClient { } 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) { @@ -262,7 +261,7 @@ export class ArtifactRegistryClient { 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-devtools-cloudbuild/src/v1/cloud_build_client.ts b/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts index 615854cc906..8026ebd6027 100644 --- a/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts +++ b/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts @@ -100,8 +100,7 @@ export class CloudBuildClient { * 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 CloudBuildClient { * 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 CloudBuildClient({fallback: 'rest'}, gax); + * const client = new CloudBuildClient({fallback: true}, gax); * ``` */ constructor( @@ -175,7 +174,7 @@ export class CloudBuildClient { } 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) { @@ -267,7 +266,7 @@ export class CloudBuildClient { 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-devtools-cloudbuild/src/v2/repository_manager_client.ts b/packages/google-devtools-cloudbuild/src/v2/repository_manager_client.ts index 9221720ee94..5f4ebc7a167 100644 --- a/packages/google-devtools-cloudbuild/src/v2/repository_manager_client.ts +++ b/packages/google-devtools-cloudbuild/src/v2/repository_manager_client.ts @@ -99,8 +99,7 @@ export class RepositoryManagerClient { * 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 @@ -108,7 +107,7 @@ export class RepositoryManagerClient { * 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 RepositoryManagerClient({fallback: 'rest'}, gax); + * const client = new RepositoryManagerClient({fallback: true}, gax); * ``` */ constructor( @@ -180,7 +179,7 @@ export class RepositoryManagerClient { } 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 RepositoryManagerClient { 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-devtools-containeranalysis/src/v1/container_analysis_client.ts b/packages/google-devtools-containeranalysis/src/v1/container_analysis_client.ts index 38fae63a4d2..2214fe60e6b 100644 --- a/packages/google-devtools-containeranalysis/src/v1/container_analysis_client.ts +++ b/packages/google-devtools-containeranalysis/src/v1/container_analysis_client.ts @@ -101,8 +101,7 @@ export class ContainerAnalysisClient { * 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 ContainerAnalysisClient { * 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 ContainerAnalysisClient({fallback: 'rest'}, gax); + * const client = new ContainerAnalysisClient({fallback: true}, gax); * ``` */ constructor( @@ -176,7 +175,7 @@ export class ContainerAnalysisClient { } 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-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client.ts b/packages/google-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client.ts index 7b7d19dfea4..3d9f1c1186a 100644 --- a/packages/google-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client.ts +++ b/packages/google-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client.ts @@ -99,8 +99,7 @@ export class ContainerAnalysisV1Beta1Client { * 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 @@ -108,7 +107,7 @@ export class ContainerAnalysisV1Beta1Client { * 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 ContainerAnalysisV1Beta1Client({fallback: 'rest'}, gax); + * const client = new ContainerAnalysisV1Beta1Client({fallback: true}, gax); * ``` */ constructor( @@ -175,7 +174,7 @@ export class ContainerAnalysisV1Beta1Client { } 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-devtools-containeranalysis/src/v1beta1/grafeas_v1_beta1_client.ts b/packages/google-devtools-containeranalysis/src/v1beta1/grafeas_v1_beta1_client.ts index 8706aa91354..a4edbb0a42d 100644 --- a/packages/google-devtools-containeranalysis/src/v1beta1/grafeas_v1_beta1_client.ts +++ b/packages/google-devtools-containeranalysis/src/v1beta1/grafeas_v1_beta1_client.ts @@ -102,8 +102,7 @@ export class GrafeasV1Beta1Client { * 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 @@ -111,7 +110,7 @@ export class GrafeasV1Beta1Client { * 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 GrafeasV1Beta1Client({fallback: 'rest'}, gax); + * const client = new GrafeasV1Beta1Client({fallback: true}, gax); * ``` */ constructor( @@ -177,7 +176,7 @@ export class GrafeasV1Beta1Client { } 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-devtools-containeranalysis/test/gapic_container_analysis_v1.ts b/packages/google-devtools-containeranalysis/test/gapic_container_analysis_v1.ts index 44319456077..ac43199dc79 100644 --- a/packages/google-devtools-containeranalysis/test/gapic_container_analysis_v1.ts +++ b/packages/google-devtools-containeranalysis/test/gapic_container_analysis_v1.ts @@ -576,8 +576,9 @@ describe('v1.ContainerAnalysisClient', () => { ); client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCall(expectedResponse); - const [response] = - await client.getVulnerabilityOccurrencesSummary(request); + const [response] = await client.getVulnerabilityOccurrencesSummary( + request + ); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub diff --git a/packages/google-devtools-containeranalysis/test/gapic_grafeas_v1_beta1_v1beta1.ts b/packages/google-devtools-containeranalysis/test/gapic_grafeas_v1_beta1_v1beta1.ts index f4f0b6dd5f9..89ef9aacfd8 100644 --- a/packages/google-devtools-containeranalysis/test/gapic_grafeas_v1_beta1_v1beta1.ts +++ b/packages/google-devtools-containeranalysis/test/gapic_grafeas_v1_beta1_v1beta1.ts @@ -1682,8 +1682,9 @@ describe('v1beta1.GrafeasV1Beta1Client', () => { ); client.innerApiCalls.getVulnerabilityOccurrencesSummary = stubSimpleCall(expectedResponse); - const [response] = - await client.getVulnerabilityOccurrencesSummary(request); + const [response] = await client.getVulnerabilityOccurrencesSummary( + request + ); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.getVulnerabilityOccurrencesSummary as SinonStub diff --git a/packages/google-iam-credentials/src/v1/i_a_m_credentials_client.ts b/packages/google-iam-credentials/src/v1/i_a_m_credentials_client.ts index d0346e2e566..0ec94fd413e 100644 --- a/packages/google-iam-credentials/src/v1/i_a_m_credentials_client.ts +++ b/packages/google-iam-credentials/src/v1/i_a_m_credentials_client.ts @@ -95,8 +95,7 @@ export class IAMCredentialsClient { * 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 IAMCredentialsClient { * 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 IAMCredentialsClient({fallback: 'rest'}, gax); + * const client = new IAMCredentialsClient({fallback: true}, gax); * ``` */ constructor( @@ -170,7 +169,7 @@ export class IAMCredentialsClient { } 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-iam/src/v2/policies_client.ts b/packages/google-iam/src/v2/policies_client.ts index af796a9f16a..56a669ef70b 100644 --- a/packages/google-iam/src/v2/policies_client.ts +++ b/packages/google-iam/src/v2/policies_client.ts @@ -92,8 +92,7 @@ export class PoliciesClient { * 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 PoliciesClient { * 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 PoliciesClient({fallback: 'rest'}, gax); + * const client = new PoliciesClient({fallback: true}, gax); * ``` */ constructor( @@ -167,7 +166,7 @@ export class PoliciesClient { } 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) { @@ -195,7 +194,7 @@ export class PoliciesClient { 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-identity-accesscontextmanager/README.md b/packages/google-identity-accesscontextmanager/README.md index f9329818244..944f5b29802 100644 --- a/packages/google-identity-accesscontextmanager/README.md +++ b/packages/google-identity-accesscontextmanager/README.md @@ -91,9 +91,8 @@ async function listAccessPolicies() { }; // Run request - const iterable = await accesscontextmanagerClient.listAccessPoliciesAsync( - request - ); + const iterable = + await accesscontextmanagerClient.listAccessPoliciesAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-identity-accesscontextmanager/samples/quickstart.js b/packages/google-identity-accesscontextmanager/samples/quickstart.js index 1470f7f1ac9..96182cdf1e1 100644 --- a/packages/google-identity-accesscontextmanager/samples/quickstart.js +++ b/packages/google-identity-accesscontextmanager/samples/quickstart.js @@ -50,8 +50,9 @@ function main(parent) { }; // Run request - const iterable = - await accesscontextmanagerClient.listAccessPoliciesAsync(request); + const iterable = await accesscontextmanagerClient.listAccessPoliciesAsync( + request + ); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-identity-accesscontextmanager/src/v1/access_context_manager_client.ts b/packages/google-identity-accesscontextmanager/src/v1/access_context_manager_client.ts index 5e0b3250683..e4d85bbf1e7 100644 --- a/packages/google-identity-accesscontextmanager/src/v1/access_context_manager_client.ts +++ b/packages/google-identity-accesscontextmanager/src/v1/access_context_manager_client.ts @@ -103,8 +103,7 @@ export class AccessContextManagerClient { * 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 @@ -112,7 +111,7 @@ export class AccessContextManagerClient { * 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 AccessContextManagerClient({fallback: 'rest'}, gax); + * const client = new AccessContextManagerClient({fallback: true}, gax); * ``` */ constructor( @@ -178,7 +177,7 @@ export class AccessContextManagerClient { } 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 AccessContextManagerClient { 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-maps-addressvalidation/src/v1/address_validation_client.ts b/packages/google-maps-addressvalidation/src/v1/address_validation_client.ts index 87abc563b45..ff1d80c0b5b 100644 --- a/packages/google-maps-addressvalidation/src/v1/address_validation_client.ts +++ b/packages/google-maps-addressvalidation/src/v1/address_validation_client.ts @@ -87,8 +87,7 @@ export class AddressValidationClient { * 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 AddressValidationClient { * 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 AddressValidationClient({fallback: 'rest'}, gax); + * const client = new AddressValidationClient({fallback: true}, gax); * ``` */ constructor( @@ -162,7 +161,7 @@ export class AddressValidationClient { } 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-maps-mapsplatformdatasets/README.md b/packages/google-maps-mapsplatformdatasets/README.md index c6018f6736c..ef9530dfab7 100644 --- a/packages/google-maps-mapsplatformdatasets/README.md +++ b/packages/google-maps-mapsplatformdatasets/README.md @@ -94,9 +94,8 @@ async function callListDataset() { }; // Run request - const iterable = await mapsplatformdatasetsClient.listDatasetsAsync( - request - ); + const iterable = + await mapsplatformdatasetsClient.listDatasetsAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-maps-mapsplatformdatasets/samples/quickstart.js b/packages/google-maps-mapsplatformdatasets/samples/quickstart.js index 91889ebcbf8..eece7f785e2 100644 --- a/packages/google-maps-mapsplatformdatasets/samples/quickstart.js +++ b/packages/google-maps-mapsplatformdatasets/samples/quickstart.js @@ -57,8 +57,9 @@ function main(parent) { }; // Run request - const iterable = - await mapsplatformdatasetsClient.listDatasetsAsync(request); + const iterable = await mapsplatformdatasetsClient.listDatasetsAsync( + request + ); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-maps-mapsplatformdatasets/src/v1/maps_platform_datasets_client.ts b/packages/google-maps-mapsplatformdatasets/src/v1/maps_platform_datasets_client.ts index be2754e199a..164a3257ede 100644 --- a/packages/google-maps-mapsplatformdatasets/src/v1/maps_platform_datasets_client.ts +++ b/packages/google-maps-mapsplatformdatasets/src/v1/maps_platform_datasets_client.ts @@ -90,8 +90,7 @@ export class MapsPlatformDatasetsClient { * 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 MapsPlatformDatasetsClient { * 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 MapsPlatformDatasetsClient({fallback: 'rest'}, gax); + * const client = new MapsPlatformDatasetsClient({fallback: true}, gax); * ``` */ constructor( @@ -165,7 +164,7 @@ export class MapsPlatformDatasetsClient { } 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-maps-mapsplatformdatasets/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts b/packages/google-maps-mapsplatformdatasets/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts index 47ed19cb705..73f2861d30a 100644 --- a/packages/google-maps-mapsplatformdatasets/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts +++ b/packages/google-maps-mapsplatformdatasets/src/v1alpha/maps_platform_datasets_v1_alpha_client.ts @@ -90,8 +90,7 @@ export class MapsPlatformDatasetsV1AlphaClient { * 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 MapsPlatformDatasetsV1AlphaClient { * 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 MapsPlatformDatasetsV1AlphaClient({fallback: 'rest'}, gax); + * const client = new MapsPlatformDatasetsV1AlphaClient({fallback: true}, gax); * ``` */ constructor( @@ -166,7 +165,7 @@ export class MapsPlatformDatasetsV1AlphaClient { } 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-maps-places/src/v1/places_client.ts b/packages/google-maps-places/src/v1/places_client.ts index 3004bf13b69..ab5f63e0d33 100644 --- a/packages/google-maps-places/src/v1/places_client.ts +++ b/packages/google-maps-places/src/v1/places_client.ts @@ -87,8 +87,7 @@ export class PlacesClient { * 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 PlacesClient { * 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 PlacesClient({fallback: 'rest'}, gax); + * const client = new PlacesClient({fallback: true}, gax); * ``` */ constructor( @@ -162,7 +161,7 @@ export class PlacesClient { } 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-maps-routing/src/v2/routes_client.ts b/packages/google-maps-routing/src/v2/routes_client.ts index 7ddb0d7fab8..9bf4eb310e9 100644 --- a/packages/google-maps-routing/src/v2/routes_client.ts +++ b/packages/google-maps-routing/src/v2/routes_client.ts @@ -87,8 +87,7 @@ export class RoutesClient { * 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 RoutesClient { * 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 RoutesClient({fallback: 'rest'}, gax); + * const client = new RoutesClient({fallback: true}, gax); * ``` */ constructor( @@ -162,7 +161,7 @@ export class RoutesClient { } 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) { @@ -176,7 +175,7 @@ export class RoutesClient { this.descriptors.stream = { computeRouteMatrix: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.SERVER_STREAMING, - opts.fallback === 'rest' + !!opts.fallback ), }; diff --git a/packages/google-monitoring-dashboard/src/v1/dashboards_service_client.ts b/packages/google-monitoring-dashboard/src/v1/dashboards_service_client.ts index 304179e2fab..87080a1e452 100644 --- a/packages/google-monitoring-dashboard/src/v1/dashboards_service_client.ts +++ b/packages/google-monitoring-dashboard/src/v1/dashboards_service_client.ts @@ -91,8 +91,7 @@ export class DashboardsServiceClient { * 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 DashboardsServiceClient { * 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 DashboardsServiceClient({fallback: 'rest'}, gax); + * const client = new DashboardsServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -166,7 +165,7 @@ export class DashboardsServiceClient { } 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-privacy-dlp/src/v2/dlp_service_client.ts b/packages/google-privacy-dlp/src/v2/dlp_service_client.ts index aab5bb1bfe0..d89cd54ecc7 100644 --- a/packages/google-privacy-dlp/src/v2/dlp_service_client.ts +++ b/packages/google-privacy-dlp/src/v2/dlp_service_client.ts @@ -101,8 +101,7 @@ export class DlpServiceClient { * 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 DlpServiceClient { * 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 DlpServiceClient({fallback: 'rest'}, gax); + * const client = new DlpServiceClient({fallback: true}, gax); * ``` */ constructor( @@ -180,7 +179,7 @@ export class DlpServiceClient { } 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) { From cc6c01631f5d3e1d58a1607f841edb5172b3c98d Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 24 Aug 2023 21:32:01 +0000 Subject: [PATCH 3/3] =?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 --- packages/google-cloud-vmwareengine/README.md | 5 +- .../src/v1/executions_client.ts | 950 +++-- .../src/v1/workflows_client.ts | 1283 ++++--- .../src/v1beta/executions_client.ts | 875 +++-- .../src/v1beta/workflows_client.ts | 1247 +++--- .../system-test/fixtures/sample/src/index.js | 1 - .../system-test/install.ts | 18 +- .../test/gapic_executions_v1.ts | 1777 +++++---- .../test/gapic_executions_v1beta.ts | 1781 +++++---- .../test/gapic_workflows_v1.ts | 3347 +++++++++-------- .../test/gapic_workflows_v1beta.ts | 2330 +++++++----- .../webpack.config.js | 12 +- .../README.md | 5 +- .../README.md | 5 +- 14 files changed, 7751 insertions(+), 5885 deletions(-) diff --git a/packages/google-cloud-vmwareengine/README.md b/packages/google-cloud-vmwareengine/README.md index 2279504c468..3aae240a953 100644 --- a/packages/google-cloud-vmwareengine/README.md +++ b/packages/google-cloud-vmwareengine/README.md @@ -131,8 +131,9 @@ async function callListVmwareEngineNetworks() { }; // Run request - const iterable = - await vmwareengineClient.listVmwareEngineNetworksAsync(request); + const iterable = await vmwareengineClient.listVmwareEngineNetworksAsync( + request + ); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-workflows-executions/src/v1/executions_client.ts b/packages/google-cloud-workflows-executions/src/v1/executions_client.ts index 4ad0a31c467..6be3bd6cd0e 100644 --- a/packages/google-cloud-workflows-executions/src/v1/executions_client.ts +++ b/packages/google-cloud-workflows-executions/src/v1/executions_client.ts @@ -18,7 +18,14 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} 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'); @@ -95,14 +102,22 @@ export class ExecutionsClient { * const client = new ExecutionsClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ExecutionsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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'); + 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. @@ -125,7 +140,7 @@ export class ExecutionsClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -139,10 +154,7 @@ export class ExecutionsClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -175,14 +187,20 @@ export class ExecutionsClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listExecutions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') + listExecutions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'executions' + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.executions.v1.Executions', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.workflows.executions.v1.Executions', + 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 @@ -213,32 +231,40 @@ export class ExecutionsClient { // Put together the "service stub" for // google.cloud.workflows.executions.v1.Executions. this.executionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1.Executions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.workflows.executions.v1.Executions' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.workflows.executions.v1.Executions, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + 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 executionsStubMethods = - ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; + const executionsStubMethods = [ + 'listExecutions', + 'createExecution', + 'getExecution', + 'cancelExecution', + ]; for (const methodName of executionsStubMethods) { const callPromise = this.executionsStub.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) => () => { + (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 descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], @@ -283,9 +309,7 @@ export class ExecutionsClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -294,8 +318,9 @@ export class ExecutionsClient { * 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 { + getProjectId( + callback?: Callback + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -306,395 +331,490 @@ export class ExecutionsClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Creates a new execution using the latest revision of the given workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @param {google.cloud.workflows.executions.v1.Execution} request.execution - * Required. Execution 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.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.create_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_CreateExecution_async - */ + /** + * Creates a new execution using the latest revision of the given workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @param {google.cloud.workflows.executions.v1.Execution} request.execution + * Required. Execution 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.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.create_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_CreateExecution_async + */ createExecution( - request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | undefined + ), + {} | undefined, + ] + >; createExecution( - request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; createExecution( - request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; createExecution( - request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.createExecution(request, options, callback); } -/** - * Returns an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * execution. The API will default to the FULL 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.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.get_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_GetExecution_async - */ + /** + * Returns an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * execution. The API will default to the FULL 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.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.get_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_GetExecution_async + */ getExecution( - request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | undefined + ), + {} | undefined, + ] + >; getExecution( - request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; getExecution( - request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; getExecution( - request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); this.initialize(); return this.innerApiCalls.getExecution(request, options, callback); } -/** - * Cancels an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.cancel_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_CancelExecution_async - */ + /** + * Cancels an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.cancel_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_CancelExecution_async + */ cancelExecution( - request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | undefined + ), + {} | undefined, + ] + >; cancelExecution( - request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; cancelExecution( - request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; cancelExecution( - request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); this.initialize(); return this.innerApiCalls.cancelExecution(request, options, callback); } - /** - * Returns a list of executions which belong to the workflow with - * the given name. The method returns executions of all workflow - * revisions. Returned executions are ordered by their start time (newest - * first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.workflows.executions.v1.Execution|Execution}. - * 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.workflows.executions.v1.Execution|Execution}. + * 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutions( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution[], - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - ]>; + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution[], + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest | null, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse, + ] + >; listExecutions( - request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): void; + request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1.IExecution + > + ): void; listExecutions( - request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): void; + request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1.IExecution + > + ): void; listExecutions( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>, - callback?: PaginationCallback< + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution[], - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - ]>|void { + | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1.IExecution + >, + callback?: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1.IExecution + > + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution[], + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest | null, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @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.workflows.executions.v1.Execution|Execution} 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @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.workflows.executions.v1.Execution|Execution} 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutionsStream( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -705,68 +825,67 @@ export class ExecutionsClient { ); } -/** - * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @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.workflows.executions.v1.Execution|Execution}. 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/executions.list_executions.js - * region_tag:workflowexecutions_v1_generated_Executions_ListExecutions_async - */ + /** + * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @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.workflows.executions.v1.Execution|Execution}. 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/executions.list_executions.js + * region_tag:workflowexecutions_v1_generated_Executions_ListExecutions_async + */ listExecutionsAsync( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -789,7 +908,12 @@ export class ExecutionsClient { * @param {string} execution * @returns {string} Resource name string. */ - executionPath(project:string,location:string,workflow:string,execution:string) { + executionPath( + project: string, + location: string, + workflow: string, + execution: string + ) { return this.pathTemplates.executionPathTemplate.render({ project: project, location: location, @@ -806,7 +930,8 @@ export class ExecutionsClient { * @returns {string} A string representing the project. */ matchProjectFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).project; + return this.pathTemplates.executionPathTemplate.match(executionName) + .project; } /** @@ -817,7 +942,8 @@ export class ExecutionsClient { * @returns {string} A string representing the location. */ matchLocationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).location; + return this.pathTemplates.executionPathTemplate.match(executionName) + .location; } /** @@ -828,7 +954,8 @@ export class ExecutionsClient { * @returns {string} A string representing the workflow. */ matchWorkflowFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).workflow; + return this.pathTemplates.executionPathTemplate.match(executionName) + .workflow; } /** @@ -839,7 +966,8 @@ export class ExecutionsClient { * @returns {string} A string representing the execution. */ matchExecutionFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).execution; + return this.pathTemplates.executionPathTemplate.match(executionName) + .execution; } /** @@ -850,7 +978,7 @@ export class ExecutionsClient { * @param {string} workflow * @returns {string} Resource name string. */ - workflowPath(project:string,location:string,workflow:string) { + workflowPath(project: string, location: string, workflow: string) { return this.pathTemplates.workflowPathTemplate.render({ project: project, location: location, @@ -899,7 +1027,7 @@ export class ExecutionsClient { */ close(): Promise { if (this.executionsStub && !this._terminated) { - return this.executionsStub.then(stub => { + return this.executionsStub.then((stub) => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-workflows-executions/src/v1/workflows_client.ts b/packages/google-cloud-workflows-executions/src/v1/workflows_client.ts index 18d1152ede6..c7c021b1072 100644 --- a/packages/google-cloud-workflows-executions/src/v1/workflows_client.ts +++ b/packages/google-cloud-workflows-executions/src/v1/workflows_client.ts @@ -18,7 +18,18 @@ /* 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 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'); @@ -98,14 +109,22 @@ export class WorkflowsClient { * const client = new WorkflowsClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof WorkflowsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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'); + 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. @@ -131,7 +150,7 @@ export class WorkflowsClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -147,13 +166,9 @@ export class WorkflowsClient { this._gaxGrpc, opts ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -189,8 +204,11 @@ export class WorkflowsClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listWorkflows: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workflows') + listWorkflows: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'workflows' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -199,45 +217,80 @@ export class WorkflowsClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + 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.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',}]; + 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.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); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.Workflow') as gax.protobuf.Type; + '.google.cloud.workflows.v1.Workflow' + ) as gax.protobuf.Type; const createWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.workflows.v1.OperationMetadata' + ) as gax.protobuf.Type; const deleteWorkflowResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty' + ) as gax.protobuf.Type; const deleteWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.workflows.v1.OperationMetadata' + ) as gax.protobuf.Type; const updateWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.Workflow') as gax.protobuf.Type; + '.google.cloud.workflows.v1.Workflow' + ) as gax.protobuf.Type; const updateWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.workflows.v1.OperationMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { createWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createWorkflowResponse.decode.bind(createWorkflowResponse), - createWorkflowMetadata.decode.bind(createWorkflowMetadata)), + createWorkflowMetadata.decode.bind(createWorkflowMetadata) + ), deleteWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteWorkflowResponse.decode.bind(deleteWorkflowResponse), - deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata)), + deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata) + ), updateWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateWorkflowResponse.decode.bind(updateWorkflowResponse), - updateWorkflowMetadata.decode.bind(updateWorkflowMetadata)) + updateWorkflowMetadata.decode.bind(updateWorkflowMetadata) + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.v1.Workflows', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.workflows.v1.Workflows', + 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 @@ -268,28 +321,39 @@ export class WorkflowsClient { // Put together the "service stub" for // google.cloud.workflows.v1.Workflows. this.workflowsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.v1.Workflows') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.workflows.v1.Workflows' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.workflows.v1.Workflows, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + 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 workflowsStubMethods = - ['listWorkflows', 'getWorkflow', 'createWorkflow', 'deleteWorkflow', 'updateWorkflow']; + const workflowsStubMethods = [ + 'listWorkflows', + 'getWorkflow', + 'createWorkflow', + 'deleteWorkflow', + 'updateWorkflow', + ]; for (const methodName of workflowsStubMethods) { const callPromise = this.workflowsStub.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) => () => { + (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] || @@ -339,9 +403,7 @@ export class WorkflowsClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -350,8 +412,9 @@ export class WorkflowsClient { * 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 { + getProjectId( + callback?: Callback + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -362,520 +425,692 @@ export class WorkflowsClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow for which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {string} [request.revisionId] - * Optional. The revision of the workflow to retrieve. If the revision_id is - * empty, the latest revision is retrieved. - * The format is "000001-a4d", where the first six characters define - * the zero-padded decimal revision number. They are followed by a hyphen and - * three hexadecimal 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.workflows.v1.Workflow|Workflow}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.get_workflow.js - * region_tag:workflows_v1_generated_Workflows_GetWorkflow_async - */ + /** + * Gets details of a single workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow for which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {string} [request.revisionId] + * Optional. The revision of the workflow to retrieve. If the revision_id is + * empty, the latest revision is retrieved. + * The format is "000001-a4d", where the first six characters define + * the zero-padded decimal revision number. They are followed by a hyphen and + * three hexadecimal 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.workflows.v1.Workflow|Workflow}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.get_workflow.js + * region_tag:workflows_v1_generated_Workflows_GetWorkflow_async + */ getWorkflow( - request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest | undefined, + {} | undefined, + ] + >; getWorkflow( - request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest | null | undefined, + {} | null | undefined + > + ): void; getWorkflow( - request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - callback: Callback< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + callback: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest | null | undefined, + {} | null | undefined + > + ): void; getWorkflow( - request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.v1.IWorkflow, - protos.google.cloud.workflows.v1.IGetWorkflowRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.v1.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); this.initialize(); return this.innerApiCalls.getWorkflow(request, options, callback); } -/** - * Creates a new workflow. If a workflow with the specified name already - * exists in the specified project and location, the long running operation - * returns a {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - * @param {google.cloud.workflows.v1.Workflow} request.workflow - * Required. Workflow to be created. - * @param {string} request.workflowId - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and 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/workflows.create_workflow.js - * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async - */ + /** + * Creates a new workflow. If a workflow with the specified name already + * exists in the specified project and location, the long running operation + * returns a {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * @param {google.cloud.workflows.v1.Workflow} request.workflow + * Required. Workflow to be created. + * @param {string} request.workflowId + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and 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/workflows.create_workflow.js + * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async + */ createWorkflow( - request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createWorkflow( - request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; createWorkflow( - request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; createWorkflow( - request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.createWorkflow(request, options, callback); } -/** - * Check the status of the long running operation returned by `createWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.create_workflow.js - * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async - */ - async checkCreateWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + /** + * Check the status of the long running operation returned by `createWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.create_workflow.js + * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async + */ + async checkCreateWorkflowProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.workflows.v1.Workflow, + protos.google.cloud.workflows.v1.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createWorkflow, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.workflows.v1.Workflow, + protos.google.cloud.workflows.v1.OperationMetadata + >; } -/** - * Deletes a workflow with the specified name. - * This method also cancels and deletes all running executions of the - * workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.delete_workflow.js - * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async - */ + /** + * Deletes a workflow with the specified name. + * This method also cancels and deletes all running executions of the + * workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.delete_workflow.js + * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async + */ deleteWorkflow( - request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteWorkflow( - request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; deleteWorkflow( - request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; deleteWorkflow( - request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); this.initialize(); return this.innerApiCalls.deleteWorkflow(request, options, callback); } -/** - * Check the status of the long running operation returned by `deleteWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.delete_workflow.js - * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async - */ - async checkDeleteWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + /** + * Check the status of the long running operation returned by `deleteWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.delete_workflow.js + * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async + */ + async checkDeleteWorkflowProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workflows.v1.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteWorkflow, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workflows.v1.OperationMetadata + >; } -/** - * Updates an existing workflow. - * Running this method has no impact on already running executions of the - * workflow. A new revision of the workflow might be created as a result of a - * successful update operation. In that case, the new revision is used - * in new workflow executions. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workflows.v1.Workflow} request.workflow - * Required. Workflow to be updated. - * @param {google.protobuf.FieldMask} request.updateMask - * List of fields to be updated. If not present, the entire workflow - * 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/v1/workflows.update_workflow.js - * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async - */ + /** + * Updates an existing workflow. + * Running this method has no impact on already running executions of the + * workflow. A new revision of the workflow might be created as a result of a + * successful update operation. In that case, the new revision is used + * in new workflow executions. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workflows.v1.Workflow} request.workflow + * Required. Workflow to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * List of fields to be updated. If not present, the entire workflow + * 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/v1/workflows.update_workflow.js + * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async + */ updateWorkflow( - request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateWorkflow( - request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; updateWorkflow( - request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; updateWorkflow( - request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workflow.name': request.workflow!.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'workflow.name': request.workflow!.name ?? '', + }); this.initialize(); return this.innerApiCalls.updateWorkflow(request, options, callback); } -/** - * Check the status of the long running operation returned by `updateWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflows.update_workflow.js - * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async - */ - async checkUpdateWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + /** + * Check the status of the long running operation returned by `updateWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.update_workflow.js + * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async + */ + async checkUpdateWorkflowProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.workflows.v1.Workflow, + protos.google.cloud.workflows.v1.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateWorkflow, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.workflows.v1.Workflow, + protos.google.cloud.workflows.v1.OperationMetadata + >; } - /** - * Lists workflows in a given project and location. - * The default order is not specified. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service might return - * fewer than this value even if not at the end of the collection. If a value - * is not specified, a default value of 500 is used. The maximum permitted - * value is 1000 and values greater than 1000 are coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a "desc" suffix. - * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. - * 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists workflows in a given project and location. + * The default order is not specified. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. + * 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listWorkflows( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.v1.IWorkflow[], - protos.google.cloud.workflows.v1.IListWorkflowsRequest|null, - protos.google.cloud.workflows.v1.IListWorkflowsResponse - ]>; + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowsRequest | null, + protos.google.cloud.workflows.v1.IListWorkflowsResponse, + ] + >; listWorkflows( - request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.v1.IListWorkflowsRequest, - protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1.IWorkflow>): void; + request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + > + ): void; listWorkflows( - request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.v1.IListWorkflowsRequest, - protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1.IWorkflow>): void; + request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + > + ): void; listWorkflows( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workflows.v1.IListWorkflowsRequest, - protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1.IWorkflow>, - callback?: PaginationCallback< + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.workflows.v1.IListWorkflowsRequest, - protos.google.cloud.workflows.v1.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1.IWorkflow>): - Promise<[ - protos.google.cloud.workflows.v1.IWorkflow[], - protos.google.cloud.workflows.v1.IListWorkflowsRequest|null, - protos.google.cloud.workflows.v1.IListWorkflowsResponse - ]>|void { + | protos.google.cloud.workflows.v1.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + >, + callback?: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + > + ): Promise< + [ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowsRequest | null, + protos.google.cloud.workflows.v1.IListWorkflowsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.listWorkflows(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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service might return - * fewer than this value even if not at the end of the collection. If a value - * is not specified, a default value of 500 is used. The maximum permitted - * value is 1000 and values greater than 1000 are coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a "desc" suffix. - * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow} 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * 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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow} 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listWorkflowsStream( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listWorkflows']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -886,58 +1121,57 @@ export class WorkflowsClient { ); } -/** - * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service might return - * fewer than this value even if not at the end of the collection. If a value - * is not specified, a default value of 500 is used. The maximum permitted - * value is 1000 and values greater than 1000 are coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a "desc" suffix. - * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. 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/workflows.list_workflows.js - * region_tag:workflows_v1_generated_Workflows_ListWorkflows_async - */ + /** + * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified 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.workflows.v1.Workflow|Workflow}. 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/workflows.list_workflows.js + * region_tag:workflows_v1_generated_Workflows_ListWorkflows_async + */ listWorkflowsAsync( - request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listWorkflows']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -947,7 +1181,7 @@ export class WorkflowsClient { callSettings ) as AsyncIterable; } -/** + /** * Gets information about a location. * * @param {Object} request @@ -987,7 +1221,7 @@ export class WorkflowsClient { 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. @@ -1025,7 +1259,7 @@ export class WorkflowsClient { 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. @@ -1139,7 +1373,7 @@ export class WorkflowsClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, options?: | gax.CallOptions @@ -1213,7 +1447,12 @@ export class WorkflowsClient { * @param {string} cryptoKey * @returns {string} Resource name string. */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + cryptoKeyPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string + ) { return this.pathTemplates.cryptoKeyPathTemplate.render({ project: project, location: location, @@ -1230,7 +1469,8 @@ export class WorkflowsClient { * @returns {string} A string representing the project. */ matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .project; } /** @@ -1241,7 +1481,8 @@ export class WorkflowsClient { * @returns {string} A string representing the location. */ matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .location; } /** @@ -1252,7 +1493,8 @@ export class WorkflowsClient { * @returns {string} A string representing the keyRing. */ matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).keyRing; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .keyRing; } /** @@ -1263,7 +1505,8 @@ export class WorkflowsClient { * @returns {string} A string representing the cryptoKey. */ matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).cryptoKey; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .cryptoKey; } /** @@ -1273,7 +1516,7 @@ export class WorkflowsClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -1310,7 +1553,7 @@ export class WorkflowsClient { * @param {string} workflow * @returns {string} Resource name string. */ - workflowPath(project:string,location:string,workflow:string) { + workflowPath(project: string, location: string, workflow: string) { return this.pathTemplates.workflowPathTemplate.render({ project: project, location: location, @@ -1359,7 +1602,7 @@ export class WorkflowsClient { */ close(): Promise { if (this.workflowsStub && !this._terminated) { - return this.workflowsStub.then(stub => { + return this.workflowsStub.then((stub) => { this._terminated = true; stub.close(); this.locationsClient.close(); diff --git a/packages/google-cloud-workflows-executions/src/v1beta/executions_client.ts b/packages/google-cloud-workflows-executions/src/v1beta/executions_client.ts index d9acaa01415..b51e46ecd36 100644 --- a/packages/google-cloud-workflows-executions/src/v1beta/executions_client.ts +++ b/packages/google-cloud-workflows-executions/src/v1beta/executions_client.ts @@ -18,7 +18,14 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} 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'); @@ -95,14 +102,22 @@ export class ExecutionsClient { * const client = new ExecutionsClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ExecutionsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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'); + 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. @@ -125,7 +140,7 @@ export class ExecutionsClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -139,10 +154,7 @@ export class ExecutionsClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -175,14 +187,20 @@ export class ExecutionsClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listExecutions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') + listExecutions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'executions' + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.executions.v1beta.Executions', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.workflows.executions.v1beta.Executions', + 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 @@ -213,32 +231,41 @@ export class ExecutionsClient { // Put together the "service stub" for // google.cloud.workflows.executions.v1beta.Executions. this.executionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1beta.Executions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.workflows.executions.v1beta.Executions, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.workflows.executions.v1beta.Executions' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workflows.executions.v1beta + .Executions, + 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 executionsStubMethods = - ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; + const executionsStubMethods = [ + 'listExecutions', + 'createExecution', + 'getExecution', + 'cancelExecution', + ]; for (const methodName of executionsStubMethods) { const callPromise = this.executionsStub.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) => () => { + (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 descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], @@ -283,9 +310,7 @@ export class ExecutionsClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -294,8 +319,9 @@ export class ExecutionsClient { * 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 { + getProjectId( + callback?: Callback + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -306,369 +332,464 @@ export class ExecutionsClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Creates a new execution using the latest revision of the given workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @param {google.cloud.workflows.executions.v1beta.Execution} request.execution - * Required. Execution 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.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.create_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_CreateExecution_async - */ + /** + * Creates a new execution using the latest revision of the given workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @param {google.cloud.workflows.executions.v1beta.Execution} request.execution + * Required. Execution 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.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.create_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_CreateExecution_async + */ createExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | undefined + ), + {} | undefined, + ] + >; createExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; createExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; createExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.createExecution(request, options, callback); } -/** - * Returns an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned execution. - * The API will default to the FULL 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.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.get_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_GetExecution_async - */ + /** + * Returns an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL 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.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.get_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_GetExecution_async + */ getExecution( - request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | undefined + ), + {} | undefined, + ] + >; getExecution( - request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; getExecution( - request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; getExecution( - request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); this.initialize(); return this.innerApiCalls.getExecution(request, options, callback); } -/** - * Cancels an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@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/executions.cancel_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_CancelExecution_async - */ + /** + * Cancels an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@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/executions.cancel_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_CancelExecution_async + */ cancelExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | undefined + ), + {} | undefined, + ] + >; cancelExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; cancelExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): void; cancelExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); this.initialize(); return this.innerApiCalls.cancelExecution(request, options, callback); } - /** - * Returns a list of executions which belong to the workflow with - * the given name. The method returns executions of all workflow - * revisions. Returned executions are ordered by their start time (newest - * first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. - * 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. + * 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutions( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution[], - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - ]>; + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution[], + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest | null, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse, + ] + >; listExecutions( - request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): void; + request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution + > + ): void; listExecutions( - request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): void; + request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution + > + ): void; listExecutions( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>, - callback?: PaginationCallback< + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution[], - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - ]>|void { + | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution + >, + callback?: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution + > + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution[], + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest | null, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.listExecutions(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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution} 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 `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution} 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 `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutionsStream( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -679,55 +800,54 @@ export class ExecutionsClient { ); } -/** - * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. 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/executions.list_executions.js - * region_tag:workflowexecutions_v1beta_generated_Executions_ListExecutions_async - */ + /** + * Equivalent to `listExecutions`, 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 workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC 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.workflows.executions.v1beta.Execution|Execution}. 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/executions.list_executions.js + * region_tag:workflowexecutions_v1beta_generated_Executions_ListExecutions_async + */ listExecutionsAsync( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -750,7 +870,12 @@ export class ExecutionsClient { * @param {string} execution * @returns {string} Resource name string. */ - executionPath(project:string,location:string,workflow:string,execution:string) { + executionPath( + project: string, + location: string, + workflow: string, + execution: string + ) { return this.pathTemplates.executionPathTemplate.render({ project: project, location: location, @@ -767,7 +892,8 @@ export class ExecutionsClient { * @returns {string} A string representing the project. */ matchProjectFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).project; + return this.pathTemplates.executionPathTemplate.match(executionName) + .project; } /** @@ -778,7 +904,8 @@ export class ExecutionsClient { * @returns {string} A string representing the location. */ matchLocationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).location; + return this.pathTemplates.executionPathTemplate.match(executionName) + .location; } /** @@ -789,7 +916,8 @@ export class ExecutionsClient { * @returns {string} A string representing the workflow. */ matchWorkflowFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).workflow; + return this.pathTemplates.executionPathTemplate.match(executionName) + .workflow; } /** @@ -800,7 +928,8 @@ export class ExecutionsClient { * @returns {string} A string representing the execution. */ matchExecutionFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).execution; + return this.pathTemplates.executionPathTemplate.match(executionName) + .execution; } /** @@ -811,7 +940,7 @@ export class ExecutionsClient { * @param {string} workflow * @returns {string} Resource name string. */ - workflowPath(project:string,location:string,workflow:string) { + workflowPath(project: string, location: string, workflow: string) { return this.pathTemplates.workflowPathTemplate.render({ project: project, location: location, @@ -860,7 +989,7 @@ export class ExecutionsClient { */ close(): Promise { if (this.executionsStub && !this._terminated) { - return this.executionsStub.then(stub => { + return this.executionsStub.then((stub) => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-workflows-executions/src/v1beta/workflows_client.ts b/packages/google-cloud-workflows-executions/src/v1beta/workflows_client.ts index 28c018c5a47..726d30c2ad5 100644 --- a/packages/google-cloud-workflows-executions/src/v1beta/workflows_client.ts +++ b/packages/google-cloud-workflows-executions/src/v1beta/workflows_client.ts @@ -18,7 +18,16 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} 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'); @@ -97,14 +106,22 @@ export class WorkflowsClient { * const client = new WorkflowsClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof WorkflowsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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'); + 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. @@ -130,7 +147,7 @@ export class WorkflowsClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -144,10 +161,7 @@ export class WorkflowsClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -180,8 +194,11 @@ export class WorkflowsClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listWorkflows: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workflows') + listWorkflows: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'workflows' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -190,45 +207,80 @@ export class WorkflowsClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + 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.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',}]; + 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.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); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.Workflow') as gax.protobuf.Type; + '.google.cloud.workflows.v1beta.Workflow' + ) as gax.protobuf.Type; const createWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.workflows.v1beta.OperationMetadata' + ) as gax.protobuf.Type; const deleteWorkflowResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty' + ) as gax.protobuf.Type; const deleteWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.workflows.v1beta.OperationMetadata' + ) as gax.protobuf.Type; const updateWorkflowResponse = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.Workflow') as gax.protobuf.Type; + '.google.cloud.workflows.v1beta.Workflow' + ) as gax.protobuf.Type; const updateWorkflowMetadata = protoFilesRoot.lookup( - '.google.cloud.workflows.v1beta.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.workflows.v1beta.OperationMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { createWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createWorkflowResponse.decode.bind(createWorkflowResponse), - createWorkflowMetadata.decode.bind(createWorkflowMetadata)), + createWorkflowMetadata.decode.bind(createWorkflowMetadata) + ), deleteWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteWorkflowResponse.decode.bind(deleteWorkflowResponse), - deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata)), + deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata) + ), updateWorkflow: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateWorkflowResponse.decode.bind(updateWorkflowResponse), - updateWorkflowMetadata.decode.bind(updateWorkflowMetadata)) + updateWorkflowMetadata.decode.bind(updateWorkflowMetadata) + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.v1beta.Workflows', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.workflows.v1beta.Workflows', + 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 @@ -259,28 +311,39 @@ export class WorkflowsClient { // Put together the "service stub" for // google.cloud.workflows.v1beta.Workflows. this.workflowsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.v1beta.Workflows') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.workflows.v1beta.Workflows' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.workflows.v1beta.Workflows, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + 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 workflowsStubMethods = - ['listWorkflows', 'getWorkflow', 'createWorkflow', 'deleteWorkflow', 'updateWorkflow']; + const workflowsStubMethods = [ + 'listWorkflows', + 'getWorkflow', + 'createWorkflow', + 'deleteWorkflow', + 'updateWorkflow', + ]; for (const methodName of workflowsStubMethods) { const callPromise = this.workflowsStub.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) => () => { + (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] || @@ -330,9 +393,7 @@ export class WorkflowsClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -341,8 +402,9 @@ export class WorkflowsClient { * 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 { + getProjectId( + callback?: Callback + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -353,514 +415,692 @@ export class WorkflowsClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single Workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.workflows.v1beta.Workflow|Workflow}. - * Please see the {@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/workflows.get_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_GetWorkflow_async - */ + /** + * Gets details of a single Workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.workflows.v1beta.Workflow|Workflow}. + * Please see the {@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/workflows.get_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_GetWorkflow_async + */ getWorkflow( - request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest | undefined, + {} | undefined, + ] + >; getWorkflow( - request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + > + ): void; getWorkflow( - request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - callback: Callback< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + callback: Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + > + ): void; getWorkflow( - request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.v1beta.IWorkflow, - protos.google.cloud.workflows.v1beta.IGetWorkflowRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); this.initialize(); return this.innerApiCalls.getWorkflow(request, options, callback); } -/** - * Creates a new workflow. If a workflow with the specified name already - * exists in the specified project and location, the long running operation - * will return {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - * @param {google.cloud.workflows.v1beta.Workflow} request.workflow - * Required. Workflow to be created. - * @param {string} request.workflowId - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and 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/v1beta/workflows.create_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async - */ + /** + * Creates a new workflow. If a workflow with the specified name already + * exists in the specified project and location, the long running operation + * will return {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * @param {google.cloud.workflows.v1beta.Workflow} request.workflow + * Required. Workflow to be created. + * @param {string} request.workflowId + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and 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/v1beta/workflows.create_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async + */ createWorkflow( - request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createWorkflow( - request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; createWorkflow( - request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; createWorkflow( - request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.createWorkflow(request, options, callback); } -/** - * Check the status of the long running operation returned by `createWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workflows.create_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async - */ - async checkCreateWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + /** + * Check the status of the long running operation returned by `createWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workflows.create_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async + */ + async checkCreateWorkflowProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.workflows.v1beta.Workflow, + protos.google.cloud.workflows.v1beta.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createWorkflow, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.workflows.v1beta.Workflow, + protos.google.cloud.workflows.v1beta.OperationMetadata + >; } -/** - * Deletes a workflow with the specified name. - * This method also cancels and deletes all running executions of the - * workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link 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/workflows.delete_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async - */ + /** + * Deletes a workflow with the specified name. + * This method also cancels and deletes all running executions of the + * workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link 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/workflows.delete_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async + */ deleteWorkflow( - request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteWorkflow( - request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; deleteWorkflow( - request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; deleteWorkflow( - request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); this.initialize(); return this.innerApiCalls.deleteWorkflow(request, options, callback); } -/** - * Check the status of the long running operation returned by `deleteWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workflows.delete_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async - */ - async checkDeleteWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + /** + * Check the status of the long running operation returned by `deleteWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workflows.delete_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async + */ + async checkDeleteWorkflowProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workflows.v1beta.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteWorkflow, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workflows.v1beta.OperationMetadata + >; } -/** - * Updates an existing workflow. - * Running this method has no impact on already running executions of the - * workflow. A new revision of the workflow may be created as a result of a - * successful update operation. In that case, such revision will be used - * in new workflow executions. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.workflows.v1beta.Workflow} request.workflow - * Required. Workflow to be updated. - * @param {google.protobuf.FieldMask} request.updateMask - * List of fields to be updated. If not present, the entire workflow - * 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/v1beta/workflows.update_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async - */ + /** + * Updates an existing workflow. + * Running this method has no impact on already running executions of the + * workflow. A new revision of the workflow may be created as a result of a + * successful update operation. In that case, such revision will be used + * in new workflow executions. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workflows.v1beta.Workflow} request.workflow + * Required. Workflow to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * List of fields to be updated. If not present, the entire workflow + * 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/v1beta/workflows.update_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async + */ updateWorkflow( - request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateWorkflow( - request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; updateWorkflow( - request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; updateWorkflow( - request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'workflow.name': request.workflow!.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'workflow.name': request.workflow!.name ?? '', + }); this.initialize(); return this.innerApiCalls.updateWorkflow(request, options, callback); } -/** - * Check the status of the long running operation returned by `updateWorkflow()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link 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/workflows.update_workflow.js - * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async - */ - async checkUpdateWorkflowProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + /** + * Check the status of the long running operation returned by `updateWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link 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/workflows.update_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async + */ + async checkUpdateWorkflowProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.workflows.v1beta.Workflow, + protos.google.cloud.workflows.v1beta.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkflow, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateWorkflow, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.workflows.v1beta.Workflow, + protos.google.cloud.workflows.v1beta.OperationMetadata + >; } - /** - * Lists Workflows in a given project and location. - * The default order is not specified. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. - * 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Workflows in a given project and location. + * The default order is not specified. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. + * 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listWorkflows( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.v1beta.IWorkflow[], - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest|null, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse - ]>; + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.workflows.v1beta.IWorkflow[], + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest | null, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse, + ] + >; listWorkflows( - request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1beta.IWorkflow>): void; + request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1beta.IWorkflow + > + ): void; listWorkflows( - request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1beta.IWorkflow>): void; + request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1beta.IWorkflow + > + ): void; listWorkflows( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1beta.IWorkflow>, - callback?: PaginationCallback< + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse|null|undefined, - protos.google.cloud.workflows.v1beta.IWorkflow>): - Promise<[ - protos.google.cloud.workflows.v1beta.IWorkflow[], - protos.google.cloud.workflows.v1beta.IListWorkflowsRequest|null, - protos.google.cloud.workflows.v1beta.IListWorkflowsResponse - ]>|void { + | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1beta.IWorkflow + >, + callback?: PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1beta.IWorkflow + > + ): Promise< + [ + protos.google.cloud.workflows.v1beta.IWorkflow[], + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest | null, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); this.initialize(); return this.innerApiCalls.listWorkflows(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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow} 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 `listWorkflowsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * 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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow} 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 `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listWorkflowsStream( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listWorkflows']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -871,58 +1111,57 @@ export class WorkflowsClient { ); } -/** - * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @param {string} request.filter - * Filter to restrict results to specific workflows. - * @param {string} request.orderBy - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. 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/workflows.list_workflows.js - * region_tag:workflows_v1beta_generated_Workflows_ListWorkflows_async - */ + /** + * Equivalent to `listWorkflows`, 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. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified 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.workflows.v1beta.Workflow|Workflow}. 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/workflows.list_workflows.js + * region_tag:workflows_v1beta_generated_Workflows_ListWorkflows_async + */ listWorkflowsAsync( - request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listWorkflows']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -943,7 +1182,7 @@ export class WorkflowsClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -980,7 +1219,7 @@ export class WorkflowsClient { * @param {string} workflow * @returns {string} Resource name string. */ - workflowPath(project:string,location:string,workflow:string) { + workflowPath(project: string, location: string, workflow: string) { return this.pathTemplates.workflowPathTemplate.render({ project: project, location: location, @@ -1029,7 +1268,7 @@ export class WorkflowsClient { */ close(): Promise { if (this.workflowsStub && !this._terminated) { - return this.workflowsStub.then(stub => { + return this.workflowsStub.then((stub) => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-workflows-executions/system-test/fixtures/sample/src/index.js b/packages/google-cloud-workflows-executions/system-test/fixtures/sample/src/index.js index c7a7c423f62..f844841bc7f 100644 --- a/packages/google-cloud-workflows-executions/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-workflows-executions/system-test/fixtures/sample/src/index.js @@ -16,7 +16,6 @@ // ** 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 workflows = require('@google-cloud/workflows'); diff --git a/packages/google-cloud-workflows-executions/system-test/install.ts b/packages/google-cloud-workflows-executions/system-test/install.ts index c8f81b25a86..f61fe236476 100644 --- a/packages/google-cloud-workflows-executions/system-test/install.ts +++ b/packages/google-cloud-workflows-executions/system-test/install.ts @@ -21,29 +21,31 @@ import {readFileSync} from 'fs'; import {describe, it} from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + 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() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts' + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + 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() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.js' + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-workflows-executions/test/gapic_executions_v1.ts b/packages/google-cloud-workflows-executions/test/gapic_executions_v1.ts index b971ac138bd..aaebe6dd1e5 100644 --- a/packages/google-cloud-workflows-executions/test/gapic_executions_v1.ts +++ b/packages/google-cloud-workflows-executions/test/gapic_executions_v1.ts @@ -29,841 +29,1062 @@ 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(); +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; + 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; + 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]); + 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.ExecutionsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = executionsModule.v1.ExecutionsClient.servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = executionsModule.v1.ExecutionsClient.servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = executionsModule.v1.ExecutionsClient.apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = executionsModule.v1.ExecutionsClient.apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = executionsModule.v1.ExecutionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = executionsModule.v1.ExecutionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = new executionsModule.v1.ExecutionsClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = new executionsModule.v1.ExecutionsClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = new executionsModule.v1.ExecutionsClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = new executionsModule.v1.ExecutionsClient({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - await client.initialize(); - assert(client.executionsStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + await client.initialize(); + assert(client.executionsStub); + }); - it('has close method for the initialized client', done => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.executionsStub); - client.close().then(() => { - done(); - }); - }); + it('has close method for the initialized client', (done) => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.executionsStub); + client.close().then(() => { + done(); + }); + }); - it('has close method for the non-initialized client', done => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - client.close().then(() => { - done(); - }); - }); + it('has close method for the non-initialized client', (done) => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + client.close().then(() => { + done(); + }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1.ExecutionsClient({ - 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', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1.ExecutionsClient({ + 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 executionsModule.v1.ExecutionsClient({ - 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); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1.ExecutionsClient({ + 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('createExecution', () => { - it('invokes createExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); - const [response] = await client.createExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('createExecution', () => { + it('invokes createExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CreateExecutionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); + const [response] = await client.createExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CreateExecutionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.createExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1.IExecution | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CreateExecutionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExecution = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createExecution(request), expectedError); - }); + it('invokes createExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CreateExecutionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createExecution(request), expectedError); }); + }); - describe('getExecution', () => { - it('invokes getExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); - const [response] = await client.getExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('getExecution', () => { + it('invokes getExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.GetExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); + const [response] = await client.getExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.GetExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.getExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1.IExecution | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.GetExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExecution = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getExecution(request), expectedError); - }); + it('invokes getExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.GetExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getExecution(request), expectedError); }); + }); - describe('cancelExecution', () => { - it('invokes cancelExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); - const [response] = await client.cancelExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('cancelExecution', () => { + it('invokes cancelExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CancelExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); + const [response] = await client.cancelExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CancelExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ); + client.innerApiCalls.cancelExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1.IExecution | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CancelExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelExecution = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.cancelExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelExecution(request), expectedError); - }); + it('invokes cancelExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CancelExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelExecution(request), expectedError); }); + }); - describe('listExecutions', () => { - it('invokes listExecutions without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('listExecutions', () => { + it('invokes listExecutions without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + ]; + client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); + const [response] = await client.listExecutions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutions( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExecutions without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + ]; + client.innerApiCalls.listExecutions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutions( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.workflows.executions.v1.IExecution[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExecutions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExecutions with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listExecutions(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutionsStream without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { - 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.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listExecutionsStream without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + ]; + client.descriptors.page.listExecutions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1.Execution[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.executions.v1.Execution) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listExecutionsStream with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutions, request) + ); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('uses async iteration with listExecutions without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; - const iterable = client.listExecutionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listExecutionsStream with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1.Execution[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.executions.v1.Execution) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('uses async iteration with listExecutions with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutions, request) + ); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); }); - describe('Path templates', () => { - - describe('execution', () => { - const fakePath = "/rendered/path/execution"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - execution: "executionValue", - }; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.executionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.executionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('executionPath', () => { - const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.executionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExecutionName', () => { - const result = client.matchProjectFromExecutionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExecutionName', () => { - const result = client.matchLocationFromExecutionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromExecutionName', () => { - const result = client.matchWorkflowFromExecutionName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExecutionFromExecutionName', () => { - const result = client.matchExecutionFromExecutionName(fakePath); - assert.strictEqual(result, "executionValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listExecutions without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution() + ), + ]; + client.descriptors.page.listExecutions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = + []; + const iterable = client.listExecutionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - describe('workflow', () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listExecutions with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('execution', () => { + const fakePath = '/rendered/path/execution'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + execution: 'executionValue', + }; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.executionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.executionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('executionPath', () => { + const result = client.executionPath( + 'projectValue', + 'locationValue', + 'workflowValue', + 'executionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.executionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromExecutionName', () => { + const result = client.matchProjectFromExecutionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromExecutionName', () => { + const result = client.matchLocationFromExecutionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWorkflowFromExecutionName', () => { + const result = client.matchWorkflowFromExecutionName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchExecutionFromExecutionName', () => { + const result = client.matchExecutionFromExecutionName(fakePath); + assert.strictEqual(result, 'executionValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('workflow', () => { + const fakePath = '/rendered/path/workflow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + }; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath( + 'projectValue', + 'locationValue', + 'workflowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); }); + }); }); diff --git a/packages/google-cloud-workflows-executions/test/gapic_executions_v1beta.ts b/packages/google-cloud-workflows-executions/test/gapic_executions_v1beta.ts index aabf52f4cda..c25e7d14da6 100644 --- a/packages/google-cloud-workflows-executions/test/gapic_executions_v1beta.ts +++ b/packages/google-cloud-workflows-executions/test/gapic_executions_v1beta.ts @@ -29,841 +29,1066 @@ 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(); +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; + 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; + 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]); + 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.ExecutionsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = executionsModule.v1beta.ExecutionsClient.servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = executionsModule.v1beta.ExecutionsClient.servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = executionsModule.v1beta.ExecutionsClient.apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = executionsModule.v1beta.ExecutionsClient.apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = executionsModule.v1beta.ExecutionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = executionsModule.v1beta.ExecutionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = new executionsModule.v1beta.ExecutionsClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = new executionsModule.v1beta.ExecutionsClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - await client.initialize(); - assert(client.executionsStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + await client.initialize(); + assert(client.executionsStub); + }); - it('has close method for the initialized client', done => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.executionsStub); - client.close().then(() => { - done(); - }); - }); + it('has close method for the initialized client', (done) => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.executionsStub); + client.close().then(() => { + done(); + }); + }); - it('has close method for the non-initialized client', done => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - client.close().then(() => { - done(); - }); - }); + it('has close method for the non-initialized client', (done) => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + client.close().then(() => { + done(); + }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1beta.ExecutionsClient({ - 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', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1beta.ExecutionsClient({ + 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 executionsModule.v1beta.ExecutionsClient({ - 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); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1beta.ExecutionsClient({ + 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('createExecution', () => { - it('invokes createExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); - const [response] = await client.createExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('createExecution', () => { + it('invokes createExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); + const [response] = await client.createExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.createExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1beta.IExecution | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExecution = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createExecution(request), expectedError); - }); + it('invokes createExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createExecution(request), expectedError); }); + }); - describe('getExecution', () => { - it('invokes getExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); - const [response] = await client.getExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('getExecution', () => { + it('invokes getExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); + const [response] = await client.getExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.getExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1beta.IExecution | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExecution = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getExecution(request), expectedError); - }); + it('invokes getExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getExecution(request), expectedError); }); + }); - describe('cancelExecution', () => { - it('invokes cancelExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); - const [response] = await client.cancelExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('cancelExecution', () => { + it('invokes cancelExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); + const [response] = await client.cancelExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ); + client.innerApiCalls.cancelExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1beta.IExecution | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelExecution = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.cancelExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelExecution(request), expectedError); - }); + it('invokes cancelExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelExecution(request), expectedError); }); + }); - describe('listExecutions', () => { - it('invokes listExecutions without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('listExecutions', () => { + it('invokes listExecutions without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + ]; + client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); + const [response] = await client.listExecutions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutions( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExecutions without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + ]; + client.innerApiCalls.listExecutions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutions( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.workflows.executions.v1beta.IExecution[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExecutions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExecutions with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listExecutions(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutionsStream without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { - 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.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listExecutionsStream without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + ]; + client.descriptors.page.listExecutions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.workflows.executions.v1beta.Execution + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listExecutionsStream with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutions, request) + ); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('uses async iteration with listExecutions without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; - const iterable = client.listExecutionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listExecutionsStream with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.workflows.executions.v1beta.Execution + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('uses async iteration with listExecutions with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutions, request) + ); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); }); - describe('Path templates', () => { - - describe('execution', () => { - const fakePath = "/rendered/path/execution"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - execution: "executionValue", - }; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.executionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.executionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('executionPath', () => { - const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.executionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExecutionName', () => { - const result = client.matchProjectFromExecutionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExecutionName', () => { - const result = client.matchLocationFromExecutionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromExecutionName', () => { - const result = client.matchWorkflowFromExecutionName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExecutionFromExecutionName', () => { - const result = client.matchExecutionFromExecutionName(fakePath); - assert.strictEqual(result, "executionValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listExecutions without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution() + ), + ]; + client.descriptors.page.listExecutions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = + []; + const iterable = client.listExecutionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - describe('workflow', () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listExecutions with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('execution', () => { + const fakePath = '/rendered/path/execution'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + execution: 'executionValue', + }; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.executionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.executionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('executionPath', () => { + const result = client.executionPath( + 'projectValue', + 'locationValue', + 'workflowValue', + 'executionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.executionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromExecutionName', () => { + const result = client.matchProjectFromExecutionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromExecutionName', () => { + const result = client.matchLocationFromExecutionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWorkflowFromExecutionName', () => { + const result = client.matchWorkflowFromExecutionName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchExecutionFromExecutionName', () => { + const result = client.matchExecutionFromExecutionName(fakePath); + assert.strictEqual(result, 'executionValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('workflow', () => { + const fakePath = '/rendered/path/workflow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + }; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath( + 'projectValue', + 'locationValue', + 'workflowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); }); + }); }); diff --git a/packages/google-cloud-workflows-executions/test/gapic_workflows_v1.ts b/packages/google-cloud-workflows-executions/test/gapic_workflows_v1.ts index c1de3a97d3f..2735d94e662 100644 --- a/packages/google-cloud-workflows-executions/test/gapic_workflows_v1.ts +++ b/packages/google-cloud-workflows-executions/test/gapic_workflows_v1.ts @@ -25,1570 +25,1951 @@ import * as workflowsModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.WorkflowsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = workflowsModule.v1.WorkflowsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = workflowsModule.v1.WorkflowsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = workflowsModule.v1.WorkflowsClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = workflowsModule.v1.WorkflowsClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new workflowsModule.v1.WorkflowsClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = workflowsModule.v1.WorkflowsClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new workflowsModule.v1.WorkflowsClient({ - fallback: true, - }); - assert(client); - }); + it('has port', () => { + const port = workflowsModule.v1.WorkflowsClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - await client.initialize(); - assert(client.workflowsStub); - }); + it('should create a client with no option', () => { + const client = new workflowsModule.v1.WorkflowsClient(); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.workflowsStub); - client.close().then(() => { - done(); - }); - }); + it('should create a client with gRPC fallback', () => { + const client = new workflowsModule.v1.WorkflowsClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - client.close().then(() => { - done(); - }); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + await client.initialize(); + assert(client.workflowsStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workflowsModule.v1.WorkflowsClient({ - 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 close method for the initialized client', (done) => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.workflowsStub); + client.close().then(() => { + done(); + }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workflowsModule.v1.WorkflowsClient({ - 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); - }); + it('has close method for the non-initialized client', (done) => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + client.close().then(() => { + done(); + }); }); - describe('getWorkflow', () => { - it('invokes getWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1.Workflow() - ); - client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkflow(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1.WorkflowsClient({ + 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('invokes getWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1.Workflow() - ); - client.innerApiCalls.getWorkflow = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkflow( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.v1.IWorkflow|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1.WorkflowsClient({ + 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('getWorkflow', () => { + it('invokes getWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.GetWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1.Workflow() + ); + client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkflow(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getWorkflow with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkflow = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.GetWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1.Workflow() + ); + client.innerApiCalls.getWorkflow = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkflow( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.v1.IWorkflow | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getWorkflow with closed client', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkflow(request), expectedError); - }); + it('invokes getWorkflow with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.GetWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkflow = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createWorkflow', () => { - it('invokes createWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getWorkflow with closed client', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.GetWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkflow(request), expectedError); + }); + }); + + describe('createWorkflow', () => { + it('invokes createWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.CreateWorkflowRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.CreateWorkflowRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createWorkflow with call error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.CreateWorkflowRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createWorkflow with LRO error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.CreateWorkflowRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkflowProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkCreateWorkflowProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteWorkflow', () => { + it('invokes deleteWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.DeleteWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteWorkflow', () => { - it('invokes deleteWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.DeleteWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.DeleteWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteWorkflow with call error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.DeleteWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteWorkflow with LRO error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkflowProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteWorkflowProgress without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkDeleteWorkflowProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateWorkflow', () => { + it('invokes updateWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.UpdateWorkflowRequest', + ['workflow', 'name'] + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteWorkflowProgress with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.UpdateWorkflowRequest', + ['workflow', 'name'] + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateWorkflow', () => { - it('invokes updateWorkflow without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.UpdateWorkflowRequest', + ['workflow', 'name'] + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateWorkflow without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.UpdateWorkflowRequest', + ['workflow', 'name'] + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateWorkflow with call error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkflowProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateWorkflow with LRO error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkUpdateWorkflowProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listWorkflows', () => { + it('invokes listWorkflows without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkflows(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes listWorkflows without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.innerApiCalls.listWorkflows = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkflows( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.v1.IWorkflow[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listWorkflows with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkflows = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listWorkflows(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listWorkflows', () => { - it('invokes listWorkflows without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkflows(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listWorkflowsStream without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.descriptors.page.listWorkflows.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1.Workflow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.v1.Workflow) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listWorkflows without error using callback', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.innerApiCalls.listWorkflows = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkflows( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.v1.IWorkflow[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listWorkflows, request) + ); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('invokes listWorkflows with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkflows = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkflows(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listWorkflowsStream with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1.Workflow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.v1.Workflow) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listWorkflowsStream without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1.Workflow[] = []; - stream.on('data', (response: protos.google.cloud.workflows.v1.Workflow) => { - 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.listWorkflows.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listWorkflows, request) + ); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('invokes listWorkflowsStream with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1.Workflow[] = []; - stream.on('data', (response: protos.google.cloud.workflows.v1.Workflow) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listWorkflows without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.descriptors.page.listWorkflows.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; + const iterable = client.listWorkflowsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listWorkflows.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('uses async iteration with listWorkflows without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), - ]; - client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; - const iterable = client.listWorkflowsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('uses async iteration with listWorkflows with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkflowsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listWorkflows.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listWorkflows.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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkflows with error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkflowsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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)); - }); + it('invokes getLocation with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ - 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!); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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); } - 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 workflowsModule.v1.WorkflowsClient({ - 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 - ) - ); - }); + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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)); - }); + it('invokes getOperation with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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) + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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)); - }); + it('invokes cancelOperation without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new workflowsModule.v1.WorkflowsClient({ - 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!); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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); } - 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 workflowsModule.v1.WorkflowsClient({ - 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); - }); + } + ); + }); + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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 workflowsModule.v1.WorkflowsClient({ + 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('cryptoKey', () => { + const fakePath = '/rendered/path/cryptoKey'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + keyRing: 'keyRingValue', + cryptoKey: 'cryptoKeyValue', + }; + const client = new workflowsModule.v1.WorkflowsClient({ + 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('Path templates', () => { - - describe('cryptoKey', () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - keyRing: "keyRingValue", - cryptoKey: "cryptoKeyValue", - }; - const client = new workflowsModule.v1.WorkflowsClient({ - 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 workflowsModule.v1.WorkflowsClient({ - 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('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new workflowsModule.v1.WorkflowsClient({ + 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('workflow', () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new workflowsModule.v1.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('workflow', () => { + const fakePath = '/rendered/path/workflow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + }; + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath( + 'projectValue', + 'locationValue', + 'workflowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); }); + }); }); diff --git a/packages/google-cloud-workflows-executions/test/gapic_workflows_v1beta.ts b/packages/google-cloud-workflows-executions/test/gapic_workflows_v1beta.ts index b444a534938..c52f4fc60a4 100644 --- a/packages/google-cloud-workflows-executions/test/gapic_workflows_v1beta.ts +++ b/packages/google-cloud-workflows-executions/test/gapic_workflows_v1beta.ts @@ -29,1091 +29,1387 @@ 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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.WorkflowsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = workflowsModule.v1beta.WorkflowsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = workflowsModule.v1beta.WorkflowsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = workflowsModule.v1beta.WorkflowsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new workflowsModule.v1beta.WorkflowsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - fallback: true, - }); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = workflowsModule.v1beta.WorkflowsClient.servicePath; + assert(servicePath); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - await client.initialize(); - assert(client.workflowsStub); - }); + it('has apiEndpoint', () => { + const apiEndpoint = workflowsModule.v1beta.WorkflowsClient.apiEndpoint; + assert(apiEndpoint); + }); - it('has close method for the initialized client', done => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.workflowsStub); - client.close().then(() => { - done(); - }); - }); + it('has port', () => { + const port = workflowsModule.v1beta.WorkflowsClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the non-initialized client', done => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsStub, undefined); - client.close().then(() => { - done(); - }); - }); + it('should create a client with no option', () => { + const client = new workflowsModule.v1beta.WorkflowsClient(); + assert(client); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workflowsModule.v1beta.WorkflowsClient({ - 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('should create a client with gRPC fallback', () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + fallback: true, + }); + assert(client); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workflowsModule.v1beta.WorkflowsClient({ - 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); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + await client.initialize(); + assert(client.workflowsStub); }); - describe('getWorkflow', () => { - it('invokes getWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ); - client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkflow(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has close method for the initialized client', (done) => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.workflowsStub); + client.close().then(() => { + done(); + }); + }); - it('invokes getWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.Workflow() - ); - client.innerApiCalls.getWorkflow = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkflow( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.v1beta.IWorkflow|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has close method for the non-initialized client', (done) => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + client.close().then(() => { + done(); + }); + }); - it('invokes getWorkflow with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkflow = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1beta.WorkflowsClient({ + 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('invokes getWorkflow with closed client', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.GetWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkflow(request), expectedError); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1beta.WorkflowsClient({ + 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('getWorkflow', () => { + it('invokes getWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.GetWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ); + client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkflow(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createWorkflow', () => { - it('invokes createWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.GetWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ); + client.innerApiCalls.getWorkflow = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkflow( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.v1beta.IWorkflow | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getWorkflow with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.GetWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkflow = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createWorkflow with call error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getWorkflow with closed client', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.GetWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkflow(request), expectedError); + }); + }); + + describe('createWorkflow', () => { + it('invokes createWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.CreateWorkflowRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createWorkflow with LRO error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.CreateWorkflowRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.CreateWorkflowRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.CreateWorkflowRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.CreateWorkflowRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteWorkflow', () => { - it('invokes deleteWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkflowProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkCreateWorkflowProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteWorkflow', () => { + it('invokes deleteWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteWorkflow with call error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteWorkflow with LRO error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.DeleteWorkflowRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteWorkflowProgress without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteWorkflowProgress with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkflowProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateWorkflow', () => { - it('invokes updateWorkflow without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkflow(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkDeleteWorkflowProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateWorkflow', () => { + it('invokes updateWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', + ['workflow', 'name'] + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateWorkflow without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateWorkflow = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkflow( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', + ['workflow', 'name'] + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateWorkflow with call error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkflow(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', + ['workflow', 'name'] + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateWorkflow with LRO error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() - ); - request.workflow ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.UpdateWorkflowRequest', ['workflow', 'name']); - request.workflow.name = defaultValue1; - const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflow = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkflow(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflow as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest() + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', + ['workflow', 'name'] + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateWorkflowProgress without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkflowProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkflowProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateWorkflowProgress with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkflowProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkUpdateWorkflowProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listWorkflows', () => { + it('invokes listWorkflows without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkflows(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listWorkflows', () => { - it('invokes listWorkflows without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - ]; - client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkflows(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listWorkflows without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + ]; + client.innerApiCalls.listWorkflows = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkflows( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.v1beta.IWorkflow[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listWorkflows without error using callback', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - ]; - client.innerApiCalls.listWorkflows = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkflows( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.v1beta.IWorkflow[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listWorkflows with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkflows = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listWorkflows(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listWorkflows with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkflows = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkflows(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listWorkflowsStream without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + ]; + client.descriptors.page.listWorkflows.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.v1beta.Workflow) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listWorkflowsStream without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - ]; - client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; - stream.on('data', (response: protos.google.cloud.workflows.v1beta.Workflow) => { - 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.listWorkflows.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listWorkflows, request) + ); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('invokes listWorkflowsStream with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkflowsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; - stream.on('data', (response: protos.google.cloud.workflows.v1beta.Workflow) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkflows, request)); - assert( - (client.descriptors.page.listWorkflows.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listWorkflowsStream with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.v1beta.Workflow) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('uses async iteration with listWorkflows without error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - generateSampleMessage(new protos.google.cloud.workflows.v1beta.Workflow()), - ]; - client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; - const iterable = client.listWorkflowsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listWorkflows, request) + ); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); - it('uses async iteration with listWorkflows with error', async () => { - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.v1beta.ListWorkflowsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflows.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkflowsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listWorkflows without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow() + ), + ]; + client.descriptors.page.listWorkflows.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; + const iterable = client.listWorkflowsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listWorkflows.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listWorkflows.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 workflowsModule.v1beta.WorkflowsClient({ - 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)); - }); - }); + it('uses async iteration with listWorkflows with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkflowsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listWorkflows.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listWorkflows.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 workflowsModule.v1beta.WorkflowsClient({ + 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('workflow', () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new workflowsModule.v1beta.WorkflowsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('workflow', () => { + const fakePath = '/rendered/path/workflow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + }; + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workflowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath( + 'projectValue', + 'locationValue', + 'workflowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); }); + }); }); diff --git a/packages/google-cloud-workflows-executions/webpack.config.js b/packages/google-cloud-workflows-executions/webpack.config.js index 5a6fddf6078..6d04c9e5b9a 100644 --- a/packages/google-cloud-workflows-executions/webpack.config.js +++ b/packages/google-cloud-workflows-executions/webpack.config.js @@ -36,27 +36,27 @@ module.exports = { { test: /\.tsx?$/, use: 'ts-loader', - exclude: /node_modules/ + exclude: /node_modules/, }, { test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]grpc/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]retry-request/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]gtoken/, - use: 'null-loader' + use: 'null-loader', }, ], }, diff --git a/packages/google-identity-accesscontextmanager/README.md b/packages/google-identity-accesscontextmanager/README.md index 944f5b29802..f9329818244 100644 --- a/packages/google-identity-accesscontextmanager/README.md +++ b/packages/google-identity-accesscontextmanager/README.md @@ -91,8 +91,9 @@ async function listAccessPolicies() { }; // Run request - const iterable = - await accesscontextmanagerClient.listAccessPoliciesAsync(request); + const iterable = await accesscontextmanagerClient.listAccessPoliciesAsync( + request + ); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-maps-mapsplatformdatasets/README.md b/packages/google-maps-mapsplatformdatasets/README.md index ef9530dfab7..c6018f6736c 100644 --- a/packages/google-maps-mapsplatformdatasets/README.md +++ b/packages/google-maps-mapsplatformdatasets/README.md @@ -94,8 +94,9 @@ async function callListDataset() { }; // Run request - const iterable = - await mapsplatformdatasetsClient.listDatasetsAsync(request); + const iterable = await mapsplatformdatasetsClient.listDatasetsAsync( + request + ); for await (const response of iterable) { console.log(response); }